This document describes the interface between the frontend and the backend of the K-dPS project. The events are divided into three categories: events used to log in, events available on the patient route and event available on the trainer route. They are then further divided within their categories into events that can be sent from the frontend to the backend and events that can be sent from the backend to the frontend. Within these subcategories, the events are ordered alphabetically.
🟢 → event fully implemented
🟡 → event only implemented in frontend
🔵 → event only implemented in backend
🔴 → event not implemented
via HTTP
if a new username is entered, a new account is automatically generated and logged in
debug exercise credentials: username=test, password=password
{
"username":"X",
"password":"X"
}
success:
{
"token":"X"
}
username or password is missing → status code 400
username exists, but password is wrong → status code 401
debug exercise credentials: exerciseid=abcdef, patientId=123456
{
"exerciseId":"abcdef",
"patientId":"123456"
}
exerciseId
: always six letters
patientId
: always six digits
success
{
"token": "X"
}
exerciseId or patientId is missing → status code 400
either exerciseId or patientId is wrong → status code 401
Websocket events that are available in Patient and Trainer connections
expects to receive test-passthrough
event back
{
"messageType": "test-passthrough"
}
send after authentication
at the moment only used in patient module but makes more sense as common because of consistency
{
"messageType": "available-actions",
"availableActions": [
{
"actionName": "X",
"actionCategory": "treatment|examination|lab|other"
}
]
}
send after authentication
{
"messageType": "available-materials",
"availableMaterials": [
{
"materialName": "X",
"materialType": "device|blood"
}
]
}
send after authentication
{
"messageType": "available-patients",
"availablePatients": [
{
"code": 1001,
"personalDetails": "X",
"injury": "X",
"biometrics": "X",
"triage": "-|G|Y|R|A|B|C|D|E",
"mobility": "X",
"preexistingIllnesses": "X",
"permanentMedication": "X",
"currentCaseHistory": "X",
"pretreatment": "X"
}
]
}
code
: 1001-1041: IDs corresponding to the dynamic patient templates
send after authentication and on each exercise update
{
"messageType": "exercise",
"exercise": {
"exerciseId": "X",
"areas": [
{
"areaId": 0,
"areaName": "X",
"patients": [
{
"patientId": "X",
"patientName": "X",
"code": 1001,
"triage": "-|X|1|2|3"
}
],
"personnel": [
{
"personnelId": 0,
"personnelName": "X"
}
],
"material": [
{
"materialId": 0,
"materialType": "X",
"materialName": "X"
}
]
}
]
}
}
code
: 1001-1041: analog to available-patients
fetch
{
"messageType": "exercise-end"
}
{
"messageType":"exercise-pause"
}
{
"messageType":"exercise-resume"
}
{
"messageType": "exercise-start"
}
{
"messageType": "failure",
"message": "X"
}
{
"messageType": "test-passthrough",
"message": "received test event"
}
{
"messageType": "warning",
"message": "X"
}
Websocket events that are available in Patient connections
frontend won’t accept new actions by user until either an action-declination
event or an action-confirmation
event was sent in response to this
event
{
"messageType": "action-add",
"actionName": "X"
}
{
"messageType":"action-cancel",
"actionId":213
}
start sending action-check
events for the specific action
{
"messageType":"action-check",
"actionName":"X"
}
start sending action-check
events for the specific action
{
"messageType":"action-check-stop"
}
used for internal backend tests
{
"messageType":"example",
"exerciseId":"abcdef",
"patientId":"123456"
}
{
"messageType":"material-assign",
"materialId":1
}
{
"messageType":"material-move",
"materialId":0,
"areaId":0
}
{
"messageType":"material-release",
"materialId":1
}
{
"messageType":"patient-move",
"areaId":0
}
{
"messageType":"personnel-assign",
"personnelId":1
}
{
"messageType":"personnel-move",
"personnelId":0,
"areaId":0
}
{
"messageType":"personnel-release",
"personnelId":1
}
the current triage color of this patient
{
"messageType": "triage",
"triage": "-|X|1|2|3"
}
check action requirements
will only be sent if action-check
was sent by frontend before
{
"messageType": "action-check",
"actionCheck": {
"actionName": "X",
"applicationDuration": 4,
"effectDuration": 3,
"personnel": [
{
"name": "X",
"available": 1,
"assigned": 1,
"needed": 1
}
],
"material": [
{
"name": "X",
"available": 1,
"assigned": 1,
"needed": 1
}
],
"lab_devices": [
{
"name": "X",
"available": 1,
"needed": 1
}
],
"requiredActions": {
"singleActions": ["A1"],
"actionGroups": [
{
"groupName": "Tubusse",
"actions": [
"A2",
"A3"
]
}
]
},
"prohibitiveActions":["A1"]
}
}
actionName
: important if the user already opened another action
applicationDuration
: in seconds
effectDuration
: in seconds
requiredActions
: only the ones still missing
prohibitiveActions
: only the ones actually blocking it
frontend won’t accept new actions by user until this event or an action-declination
event was sent for the last action added via action-add
{
"messageType": "action-confirmation",
"actionName": "X",
"actionId": 123
}
frontend won’t accept new actions by user until this event or an action-confirmation
event was sent for the last action added via action-add
{
"messageType": "action-declination",
"actionName": "X",
"actionDeclinationReason": "X"
}
send every time the action list of the patient is changed (no timeUntilCompletion updates)
{
"messageType":"action-list",
"actions":[{
"actionId":123,
"orderId":123,
"actionName":"X",
"actionStatus":"IP|FI|PL|OH|IE|EX",
"timeUntilCompletion":123,
"actionResult":"X"
}]
}
timeUntilCompletion
: in seconds, null if completed
actionResult
: null if not completed or no result
{
"messageType":"delete"
}
can consist out of one or multiple areas
{
"messageType": "ressource-assignments",
"ressourceAssignments": [
{
"areaId": 0,
"personnel": [
{
"personnelId": 1,
"patientId": 1
}
],
"material": [
{
"materialId": 1,
"patientId": 1
}
]
}
]
}
patientId
: null if unassigned
used for internal backend tests
{
"messageType":"response",
"content":"X"
}
dynamic patient information - send on ever phase change
{
"messageType": "state",
"state": {
"airway": "X",
"breathing": "X",
"circulation": "X",
"consciousness": "X",
"pupils": "X",
"psyche": "X",
"skin": "X"
}
}
{
"messageType":"patient-active"
}
send if lab-side action is finished
{
"messageType":"patient-back"
}
{
"messageType":"patient-inactive",
"inactiveInfo":"X",
"timeUntilBack":123
}
timeUntilBack
: in seconds
send if a lab-side action is started
{
"messageType":"patient-relocating",
"relocatingInfo":"X",
"timeUntilBack":123
}
timeUntilBack
: in seconds
{
"messageType":"visible-injuries",
"injuries":[{
"injuryId":0,
"injuryType":"blood|fracture",
"position":"X"
}]
}
position
: there is a list of possible positions in the frontend
Websocket events that are available in Patient connections
{
"messageType":"area-add"
}
{
"messageType":"area-delete",
"areaId":0
}
{
"messageType":"area-rename",
"areaId":0,
"areaName":"X"
}
used for internal backend tests
{
"messageType":"example",
"exerciseId":"abcdef"
}
{
"messageType":"exercise-create"
}
{
"messageType":"exercise-end"
}
{
"messageType":"exercise-pause"
}
{
"messageType":"exercise-resume"
}
{
"messageType":"exercise-start"
}
{
"messageType": "material-add",
"areaId": 0,
"materialName": "X"
}
{
"messageType": "material-delete",
"materialId": 0
}
{
"messageType":"patient-add",
"areaId":0,
"patientName":"X",
"code":1001
}
code
: 1001-1041: analog to available-patients
fetch
{
"messageType":"patient-delete",
"patientId":"X"
}
{
"messageType":"patient-rename",
"patientId":0,
"patientName":"X"
}
{
"messageType": "patient-update",
"patientId": "X",
"code": 1001
}
code
: 1001-1041: analog to available-patients
fetch
{
"messageType":"personnel-add",
"areaId":0,
"personnelName":"X"
}
{
"messageType":"personnel-delete",
"personnelId":0
}
{
"messageType": "personnel-rename",
"personnelId": 0,
"personnelName": "X"
}
{
"messageType": "set-speed",
"speed": 1
}
speed
: from 0.2 to 4 in 0.1 steps
on first login during running exercise send all log entries
{
"messageType":"log-update",
"logEntries":[{
"logId":0,
"logMessage":"X",
"logTime":0,
"areaId":0,
"patientId":"X",
"personnelIds":[0],
"materialNames": ["X"]
}]
}
logTime
: number of milliseconds since January 1, 1970, 00:00:00 UTC.
used for internal backend tests
{
"messageType":"response",
"content":"X"
}
{
"messageType": "set-speed",
"speed": 1
}
speed
: from 0.2 to 4 in 0.1 steps