====== Differences ====== This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
alerts_engine:main_structure [2017/10/10 17:43] maries |
alerts_engine:main_structure [2017/10/11 10:20] (current) maries |
||
---|---|---|---|
Line 17: | Line 17: | ||
| content_id | Integer | ID of the content involved in the trigger of the alert | | | content_id | Integer | ID of the content involved in the trigger of the alert | | ||
| content_url | String | url of the content involved in the trigger of the alert | | | content_url | String | url of the content involved in the trigger of the alert | | ||
- | | content_uid |`String | uid of the content involved in the trigger of the alert | | + | | content_uid | String | uid of the content involved in the trigger of the alert | |
| event_id | String | ID of the event involved in the trigger of the alert | | | event_id | String | ID of the event involved in the trigger of the alert | | ||
| knowledge_node_id | Integer | Knowledge Node, i.e. concept, involved in the trigger of the alert| | | knowledge_node_id | Integer | Knowledge Node, i.e. concept, involved in the trigger of the alert| | ||
Line 25: | Line 25: | ||
===Alert Model=== | ===Alert Model=== | ||
==FETCH (GET)== | ==FETCH (GET)== | ||
- | =URL= | + | **URL** |
^ Method | PUT | | ^ Method | PUT | | ||
^ URL | /alert_models/{alert_model_id} | | ^ URL | /alert_models/{alert_model_id} | | ||
- | =Get the response (JSON output example)= | + | **Get the response (JSON output example)**\\ |
- | **With an alert_model_id** | + | __With an alert_model_id__\\ |
+ | |||
- | <code postgresql> | + | <code> |
{ | { | ||
"id": 3, | "id": 3, | ||
Line 42: | Line 43: | ||
"description": "Alerts when a student took a long time to complete a content" | "description": "Alerts when a student took a long time to complete a content" | ||
} | } | ||
- | </code postgresql> | + | </code> |
- | **Without an alert_model_id** | + | __Without an alert_model_id__\\ |
+ | <code> | ||
+ | [ | ||
+ | { | ||
+ | "id": 1, | ||
+ | "name": "Student Failing", | ||
+ | "instance_id": 1, | ||
+ | "created_at": "2017-03-24T09:12:15.753Z", | ||
+ | "updated_at": "2017-03-24T09:12:15.753Z", | ||
+ | "description": "Alerts when a student fails to one or more exercise(s) consecutively" | ||
+ | }, | ||
+ | { | ||
+ | "id": 2, | ||
+ | "name": "Tutoring", | ||
+ | "instance_id": 1, | ||
+ | "created_at": "2017-03-24T09:13:23.257Z", | ||
+ | "updated_at": "2017-03-24T09:13:23.257Z", | ||
+ | "description": "A succeeding student have been found as a tutor for one student in difficulty" | ||
+ | } | ||
+ | ] | ||
+ | </code> | ||
+ | |||
+ | ===Alerts=== | ||
+ | ==FETCH (GET) - first way== | ||
+ | |||
+ | **URL** | ||
+ | |||
+ | ^ Method | PUT | | ||
+ | ^ URL | /alerts/{alert_id} | | ||
+ | |||
+ | **Get the response (JSON output example)**\\ | ||
+ | |||
+ | <code> | ||
+ | { | ||
+ | id":644, | ||
+ | "student_id":45, | ||
+ | "content_id":2004, | ||
+ | "alert_model_id":3, | ||
+ | "displayed":false, | ||
+ | "active":true, | ||
+ | "created_at":"2017-08-22T08:22:42.137Z", | ||
+ | "updated_at":"2017-08-22T08:22:42.137Z", | ||
+ | "assignment":null, | ||
+ | "assignment_type":null, | ||
+ | "instance_id":1, | ||
+ | "event_id":17, | ||
+ | "content_url":null, | ||
+ | "content_uid":“math_content3”, | ||
+ | "knowledge_node_id":5 | ||
+ | } | ||
+ | </code> | ||
+ | |||
+ | ==FETCH (GET) - second way== | ||
+ | |||
+ | **URL** | ||
+ | |||
+ | ^ Method | PUT | | ||
+ | ^ URL | /alerts | | ||
+ | |||
+ | **Send the request (JSON input example)**\\ | ||
+ | <code> | ||
+ | { | ||
+ | student_id: 2, | ||
+ | alert_model_id: 1, | ||
+ | start_date: "2017-08-22" | ||
+ | end_date: "2017-08-23" | ||
+ | } | ||
+ | </code> | ||
+ | The start date indicates that one wants to fetch the alerts created after the date, while the end date indicates that one wants to fetch the alerts created before the date.\\ | ||
+ | Note that none of these parameters is mandatory. | ||
+ | |||
+ | |||
+ | **Get the response (JSON output example)**\\ | ||
+ | |||
+ | <code> | ||
+ | [ | ||
+ | { | ||
+ | "id":644, | ||
+ | "student_id":45, | ||
+ | "content_id":2004, | ||
+ | "content_uid":null, | ||
+ | "content_url":null, | ||
+ | "assignment_id":null, | ||
+ | "assignement_type":null, | ||
+ | "created_at":"2017-08-22T08:22:42.137Z", | ||
+ | "alert_model":{"name":"Hesitating","description":"Alerts when a student took a long time to complete a content"} | ||
+ | }, | ||
+ | { | ||
+ | "id":645, | ||
+ | "student_id":884, | ||
+ | "content_id":2010, | ||
+ | "content_uid":null, | ||
+ | "content_url":null, | ||
+ | "assignment_id":null, | ||
+ | "assignement_type":null, | ||
+ | "created_at":"2017-08-22T15:03:36.484Z", | ||
+ | "alert_model":{"name":"Hesitating","description":"Alerts when a student took a long time to complete a content"} | ||
+ | } | ||
+ | ] | ||
+ | </code> | ||
+ | |||
+ | |||
+ | ==FETCH (GET) - third way== | ||
+ | |||
+ | **URL** | ||
+ | |||
+ | ^ Method | PUT | | ||
+ | ^ URL | /students/{student_id}/alerts | | ||
+ | |||
+ | **Get the response (JSON output example)** | ||
+ | |||
+ | <code> | ||
+ | [ | ||
+ | { | ||
+ | "id": 639, | ||
+ | "student_id": 45, | ||
+ | "content_id": null, | ||
+ | "content_uid": null, | ||
+ | "content_url": null, | ||
+ | "assignment_id": "885", | ||
+ | "assignement_type": "Student", | ||
+ | "created_at": "2017-08-17T07:00:42.707Z", | ||
+ | "alert_model": {"name": "Tutoring","description": "A succeeding student have been found as a tutor for one student in difficulty"} | ||
+ | }, | ||
+ | { | ||
+ | "id": 644, | ||
+ | "student_id": 45, | ||
+ | "content_id": 2004, | ||
+ | "content_uid": null, | ||
+ | "content_url": null, | ||
+ | "assignment_id": null, | ||
+ | "assignement_type": null, | ||
+ | "created_at": "2017-08-22T08:22:42.137Z", | ||
+ | "alert_model": {"name": "Hesitating","description": "Alerts when a student took a long time to complete a content"} | ||
+ | } | ||
+ | ] | ||
+ | </code> | ||
+ | |||
+ | ==FETCH (GET) - fourth way== | ||
+ | |||
+ | **URL** | ||
+ | |||
+ | ^ Method | PUT | | ||
+ | ^ URL | /alert_models/{alert_model_id}/alerts | | ||
+ | |||
+ | **Get the response (JSON output example)** | ||
+ | |||
+ | <code> | ||
+ | [ | ||
+ | { | ||
+ | "id": 849, | ||
+ | "student_id": 91, | ||
+ | "content_id": null, | ||
+ | "content_uid": null, | ||
+ | "content_url": null, | ||
+ | "assignment_id": "53", | ||
+ | "assignement_type": "Student", | ||
+ | "created_at": "2017-09-14T07:00:21.511Z", | ||
+ | "alert_model": {"name": "Tutoring","description": "A succeeding student have been found as a tutor for one student in difficulty"} | ||
+ | }, | ||
+ | { | ||
+ | "id": 769, | ||
+ | "student_id": 55, | ||
+ | "content_id": null, | ||
+ | "content_uid": null, | ||
+ | "content_url": null, | ||
+ | "assignment_id": "147", | ||
+ | "assignement_type": "Student", | ||
+ | "created_at": "2017-09-08T07:00:51.584Z", | ||
+ | "alert_model": {"name": "Tutoring","description": "A succeeding student have been found as a tutor for one student in difficulty"} | ||
+ | } | ||
+ | ] | ||
+ | </code> | ||