A microservice for the NHS National Early Warning Score (NEWS)
make build
./cli/server/server --config config.yaml migratedb
Before building the database, you will need to create one that corresponds to dbuser
, dbname
, etc. as defined in config.yaml
.
./cli/server/server --config config.yaml server
Documents the HTTP API for the service.
This will fetch, create, replace or delete a NEWS observation. Upon creation, the NEWS score and clinical risk will be calculated alongwith the time of calculation.
-
URL
/news or /news/:id
-
Methods
GET
|POST
|DELETE
|PUT
-
URL Params
-
Required (
GET
,DELETE
):id=[integer]
-
-
Data Params
Example:
{ "patient_id": [integer], "location_id": [integer], "spell_id": [integer], "user_id": [integer], "avpu": [string], "heart_rate": [integer], "respiratory_rate": [integer], "o2_saturation": [integer], "o2_supplement": [bool], "temperature": [float], "systolic_bp": [integer] }
-
Success Response
-
Code: 200 (
GET
|PUT
)
Content:{"id":6,"patient_id":3,"spell_id":5,"user_id":4,"location_id":1,"avpu":"A","heart_rate":60,"respiratory_rate":12,"o2_saturation":97,"o2_supplement":false,"temperature":20.1,"systolic_bp":30,"score":6,"risk":"Medium","completed":1448439536}
* **Code:** 201 (`POST`) <br /> **Content:**
{"id":6,"patient_id":3,"spell_id":5,"user_id":4,"location_id":1,"avpu":"A","heart_rate":60,"respiratory_rate":12,"o2_saturation":97,"o2_supplement":false,"temperature":20.1,"systolic_bp":30,"score":6,"risk":"Medium","completed":1448439536}
* **Code:** 204 (`DELETE`)
-
-
Error Response
-
Code: 400 (
GET
|DELETE
|PUT
)
Content:{"error": "problem decoding query parameter sent"}
-
Code: 400 (
PUT
|POST
)
Content:{"error": "problem decoding body"}
-
Code: 404 (
GET
|DELETE
|PUT
)
Content:{"error": "not found"}
-
-
Sample Call
curl -H "Content-Type: application/json" -X POST -d '{"location_id": 1, "patient_id": 3, "user_id": 4, "spell_id": 5, "avpu": "A", "heart_rate": 60, "respiratory_rate": 12, "o2_saturation": 97, "temperature": 36.1, "o2_supplement": false}' http://localhost:8080/news
-
Notes
None
Fetches a list of NEWS observations based on given querystring parameters. Returns an empty list if no News observations match the parameters provided.
-
URL
/news?
-
Methods
GET
-
URL Params
-
Optional:
risk=[string]
patient_id=[integer]
spell_id=[integer]
location_id=[integer]
user_id=[integer]
-
-
Success Response
-
Code: 200 (
GET
)
Content:[{"id":6,"patient_id":3,"spell_id":5,"user_id":4,"location_id":1,"avpu":"A","heart_rate":60,"respiratory_rate":12,"o2_saturation":97,"o2_supplement":false,"temperature":20.1,"systolic_bp":30,"score":6,"risk":"Medium","completed":1448439536},{"id":7,"patient_id":3,"spell_id":5,"user_id":4,"location_id":1,"avpu":"A","heart_rate":60,"respiratory_rate":12,"o2_saturation":97,"o2_supplement":false,"temperature":20.1,"systolic_bp":30,"score":6,"risk":"Medium","completed":1448439539}]
-
-
Error Response
-
Code: 400 (
GET
)
Content:{"error": "problem decoding query parameter sent"}
-
-
Sample Call
curl http://localhost:8080/news?risk=medium&spell_id=3&location_id=1
-
Notes
Returns all News observations if no parameters are given.