User Tools

Site Tools


alerts_engine:main_structure

As described by the schema below, in your instance you have several models of alerts. They represent the alert type. Each model of alert has many alerts.
structure alerts

Features

Alert model
Property Type Description
name String Custom data (<255 characters)
instance_id Integer The ID of your instance
description String Description of the type of alert
Alert
Property Type Description
instance_id Integer The ID of your instance
alert_model_id Integer ID of the alert_model of this alert
student_id Integer ID of the student involved by 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_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
knowledge_node_id Integer Knowledge Node, i.e. concept, involved in the trigger of the alert
assignment_type String What is advised to the student to do
assignment String ID of what is advised to the student to do

Alert Model

FETCH (GET)

URL

Method PUT
URL /alert_models/{alert_model_id}

Get the response (JSON output example)
With an alert_model_id

{
    "id": 3,
    "name": "Hesitating",
    "instance_id": 1,
    "created_at": "2017-08-08T15:24:31.252Z",
    "updated_at": "2017-08-08T15:25:19.591Z",
    "description": "Alerts when a student took a long time to complete a content"
}

Without an alert_model_id

[
    {
        "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"
    }
]

Alerts

FETCH (GET) - first way

URL

Method PUT
URL /alerts/{alert_id}

Get the response (JSON output example)

{
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
}
FETCH (GET) - second way

URL

Method PUT
URL /alerts

Send the request (JSON input example)

{
	student_id: 2,
	alert_model_id: 1,
	start_date: "2017-08-22"
	end_date: "2017-08-23"
}

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)

[
{
"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"}
}
]
FETCH (GET) - third way

URL

Method PUT
URL /students/{student_id}/alerts

Get the response (JSON output example)

[
  {
    "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"}
  }
]
FETCH (GET) - fourth way

URL

Method PUT
URL /alert_models/{alert_model_id}/alerts

Get the response (JSON output example)

[
  {
        "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"}
     }
]
alerts_engine/main_structure.txt · Last modified: 2017/10/11 10:20 by maries