-
Notifications
You must be signed in to change notification settings - Fork 3
Home
Welcome to the WebServerAndClient wiki!
-
Connect to MQTT using
username
andpassword
and Will as follows:- topic:
user/{username}/client/{client-id}/status
- payload:
disconnected
- qos: 2
- retain: True
- topic:
-
Subscribe to
user/{username}/client/{client-id}/error
to retrieve eventual errors. -
Publish
"online"
touser/{username}/client/{client-id}/status
withqos = 2
andretain = True
. -
Subscribe to
settings
to retrieve settings and defaults. Expected format is:{ "ambulance_status": { "UK": "Unknown", "AV": "Available", "OS": "Out of service", "PB": "Patient bound", "AP": "At patient", "HB": "Hospital bound", "AH": "At hospital" }, "ambulance_capability": { "B": "Basic", "A": "Advanced", "R": "Rescue" }, "call_priority": { "A": "Resucitation" "B": "Emergent" "C": "Urgent" "D": "Less urgent" "E": "Not urgent" "O": "Omega" }, "call_status": { "P": "Pending" "S": "Started" "E": "Ended" }, // The status for the ambulance in the call "ambulance_call_status": { "R": "Requested" "O": "Onging" "I": "Interrupted" "C": "Completed" }, "equipment_type": { "B": "Boolean", "I": "Integer", "S": "String" }, "defaults": { "location": { "latitude": "32.5149", "longitude": "-117.0382" }, "state": "BC", "city": "Tijuana", "country": "MX" } }
-
Subscribe to
user/{username}/profile
to retrieve ambulances and hospitals available. Expected format is:{ "ambulances": [ { "ambulance_id": 1, "ambulance_identifier": "BUD1234", "can_read": true, "can_write": true }, { "ambulance_id": 2, "ambulance_identifier": "BUH4321", "can_read": true, "can_write": true }, { "ambulance_id": 34, "ambulance_identifier": "BUH1111", "can_read": true, "can_write": true }, { "ambulance_id": 35, "ambulance_identifier": "BUJ1616", "can_read": true, "can_write": true } ], "hospitals": [ { "hospital_id": 34, "hospital_name": "Hospital Nuevo", "can_read": true, "can_write": true }, { "hospital_id": 35, "hospital_name": "Hospital Viejo", "can_read": true, "can_write": true }, { "hospital_id": 36, "hospital_name": "Another Hospital", "can_read": true, "can_write": true }, { "hospital_id": 37, "hospital_name": "Yet another", "can_read": true, "can_write": true }, { "hospital_id": 38, "hospital_name": "Uno mas", "can_read": true, "can_write": true } ] }
- Publish
"ambulance login"
touser/{username}/client/{client-id}/ambulance/{id}/status
withqos = 2
when logging in. - Publish
"ambulance logout"
touser/{username}/client/{client-id}/ambulance/{id}/status
withqos = 2
when logging out.
- Subscribe to
ambulance/{id}/data
- Publish
{"location_client": client_id}
touser/{username}/client/{client-id}/ambulance/{id}/data
. - Start streaming locations when
location_client
inambulance/{id}/data
matchesclient_id
. - Stop streaming locations when
location_client
inambulance/{id}/data
no longer matchesclient_id
. - Publish
{"location_client": ""}
touser/{username}/client/{client-id}/ambulance/{id}/data
to stop streaming data or hijack current streaming source.
- Make sure application is streaming location.
- Subscribe to
ambulance/{ambulance-id}/call/+/status
- Wait for
"Requested"
inambulance/{ambulance-id}/call/{call-id}/status
and retrievecall-id
. - Subscribe to
call/{call-id}/data
- Wait to retrieve data and prompt user to accept call.
- Publish
"Accepted"
touser/{username}/client/{client-id}/ambulance/{ambulance-id}/call/{call-id}/status
. - Receive
"Ongoing"
onambulance/{ambulance-id}/call/{call-id}/status
. - Publish patient bound (
PB
) as status touser/{username}/client/{client-id}/ambulance/{call-id}/data
- Publish other status updates, e.g. at patient (
AP
), hospital bound (HB
), etc, as status touser/{username}/client/{client-id}/ambulance/{call-id}/data
. - When call is finished, publish
"Finished"
touser/{username}/client/{client-id}/ambulance/{ambulance-id}/call/{call-id}/status
. - Receive
"Completed"
onambulance/{ambulance-id}/call/{call-id}/status
. - Unsubscribe to
call/{call-id}/data
- Follow steps 1.-5. as in "Accepting Calls".
- Publish
"Declined"
touser/{username}/client/{client-id}/ambulance/{ambulance-id}/call/{call-id}/status
. - Receive
"Declined"
onambulance/{ambulance-id}/call/{call-id}/status
. - Unsubscribe to
call/{call-id}/data
- Follow steps 1.-8. as in "Accepting Calls".
- Publish
"Suspended"
touser/{username}/client/{client-id}/ambulance/{ambulance-id}/call/{call-id}/status
. - Receive
"Requested"
onambulance/{ambulance-id}/call/{call-id}/status
. - Unsubscribe to
call/{call-id}/data
- Publish
"online"
touser/{username}/client/{client-id}/hospital/{id}/status
withqos = 2
andretain = true
when logging in. - Publish
"offline"
to clearuser/{username}/client/{client-id}/hospital/{id}/status
when logging out.
-
Subscribe to
ambulance/{id}/data
to retrieve ambulance information. Expected format is:{ "id": 2, "identifier": "BUH4321", "capability": "A", "status": "AV", "orientation": 0, "location": { "latitude": "32.51667385665262", "longitude": "-117.0299291610718" }, "timestamp": null, "location_client": "clientUniqueId12345678", "comment": null, "updated_by": 1, "updated_on": "2018-01-17T01:15:45.972000Z" }
-
Subscribe to
hospital/{id}/data
to retrieve hospital information. Expected format is:{ "id": 34, "number": "1234", "street": "Unknown Street", "unit": null, "neighborhood": null, "city": "Tijuana", "state": "BC", "zipcode": "92093", "country": "MX", "location": { "latitude": "32.5149", "longitude": "-117.0382" }, "name": "Hospital Nuevo", "comment": null, "updated_by": 1, "updated_on": "2018-01-16T18:17:19.678000Z", "hospitalequipment_set": [ { "hospital_id": 1, "equipment_id": 6, "equipment_name": "CT Scan", "equipment_type": "B", "value": "True", "comment": null, "updated_by": 9, "updated_on": "2018-04-20T04:00:52.164571Z" }, { "hospital_id": 1, "equipment_id": 4, "equipment_name": "Number of Ventilators (ER)", "equipment_type": "I", "value": "5", "comment": null, "updated_by": 9, "updated_on": "2018-04-20T03:59:55.016004Z" } ] }
-
Subscribe to
hospital/{id}/metadata
to retrieve hospital equipment metadata information. Expected format is:[ { "id": 2, "name": "Beds", "etype": "I", "toggleable": false } ]
-
Subscribe to
hospital/{id}/equipment/{equipment-id}/data
to retrieve hospital equipment information. Expected format is:{ "hospital_id": 38, "equipment_id": 2, "equipment_name": "Beds", "equipment_etype": "I", "value": "132", "comment": null, "updated_by": 1, "updated_on": "2018-01-16T22:39:45.280000Z" }
-
Subscribe to
call/{id}/data
to retrieve call information. Expected format is:{ "id": 3, "status": "AV", "details": null, "priority": "A", "number": 169, "street": "Unknown Street", "unit": null, "neighborhood': null, "city": "Tijuana", "state": "BC", "zipcode": "92093", "country": "MX", "location": { "latitude": "32.51667385665262", "longitude": "-117.0299291610718" }, "created_at": "2018-01-17T00:00:45.972000Z" "pending_at": "2018-01-17T00:00:45.972000Z" "started_at": "2018-01-17T00:01:00.972000Z" "ended_at": "2018-01-17T02:15:45.972000Z" "comment": null, "updated_by": 1, "updated_on": "2018-01-17T01:15:45.972000Z", "ambulancecalltime_set": null, //need modified "patient_set": [{"id": 345, "name": "A", "age": 37}] }
-
Publish to
user/{username}/client/{client-id}/ambulance/{id}/data
to update ambulance information. -
Publish to
user/{username}/client/{client-id}/hospital/{id}/data
to update hospital information. -
Publish to
user/{username}/client/{client-id}/hospital/{id}/equipment/{equipment-id}/data
to update hospital equipment information.
Format is the same as shown in Section Retrieving information.
- Publish
"offline"
touser/{username}/client/{client-id}/status
withqos = 1
andretain = True
.
METHOD | API | METHOD | MQTT | Description |
---|---|---|---|---|
GET | api/ambulance/ | --- | --- | List of ambulances |
POST | api/ambulance/ | --- | --- | Create new ambulance |
GET | api/ambulance/{id}/ | SUB | ambulance/{id}/data | Get existing ambulance |
PATCH/PUT | api/ambulance/{id}/ | PUB | user/{username}/client/{client-id}/ambulance/{id}/data | Modify existing ambulance |
METHOD | API | METHOD | MQTT | Description |
---|---|---|---|---|
GET | api/hospital/ | --- | --- | List of hospitals |
POST | api/hospital/ | --- | --- | Create new hospital |
GET | api/hospital/{id}/ | SUB | hospital/{id}/data | Get existing hospital |
PATCH/PUT | api/hospital/{id}/ | PUB | user/{username}/client/{client-id}/hospital/{id}/data | Modify existing hospital |
METHOD | API | METHOD | MQTT | Description |
---|---|---|---|---|
GET | api/hospital/{id}/equipment/ | --- | --- | List of hospital equipment |
GET | api/hospital/{id}/equipment/{equipment__name}/ | SUB | hospital/{id}/equipment/{equipment__name}/data | Get existing hospital equipment |
PATCH/PUT | api/hospital/{id}/equipment/{equipment__name}/ | PUB | user/{username}/client/{client-id}/hospital/{id}/equipment/{equipment__name}/data | Modify existing hospital equipment |
GET | api/hospital/{id}/metadata/ | SUB | hospital/{id}/metadata | Hospital equipment metadata |
METHOD | API | METHOD | MQTT | Description |
---|---|---|---|---|
GET | api/user/{username}/profile/ | SUB | user/{username}/profile | List of hospital and ambulance permissions |
METHOD | API | METHOD | MQTT | Description |
---|---|---|---|---|
GET | api/settings/ | SUB | settings | Retrieve settings and defaults |
METHOD | MQTT | Description |
---|---|---|
SUB | user/{username}/client/{client-id}/error | Error messages from django generated after successfully posting a message |
SUB | user/{username}/client/{client-id}/status | Used to communicate connection status of client: "online" and "offline" should be posted at login and logout. "disconnected" should be posted as a will message in case of unexpected disconnection. |