Sending Measurements in Bulk
BioT enables devices to transmit measurements in bulk, offering significant advantages in scenarios where data transmission needs to be optimized. This feature is particularly useful for sending large volumes of measurements or for uploading accumulated measurements from devices that were previously offline.
To post measurements in bulk perform the following steps:
- Create a session.
- Post measurements for the session.
- Repeat for subsequent sessions.
Create a Session
Use the following API to create a usage session for the patient.
For example:
https://www.example.com/device/v1/devices/deviceId1/usage-sessions/usage-type/MyUsageTemplate
{
"_startTime": "2023-11-01T07:00:10.263Z",
"_endTime": "2023-11-03T07:00:10.263Z",
"_state": "DONE",
"_summary": {
"_stopReason": "Manual Stop",
"_stopReasonCode": "COMPLETION"
},
"_patient": {
"id": "377663dc-0a9c-46ce-bbe3-ca8b8ebb1a33"
}
}
In the response you'll get the session ID.
Post Measurements for the Session
Use the following API to post measurements in bulk to the session.
The following example posts 2 heart_rate measurements to the session created in the previous paragraph:
{
"measures": [
{
"metadata": {
"timestamp": "2023-11-02T08:00:10.263Z",
"deviceId": "deviceId1",
"patientId": "377663dc-0a9c-46ce-bbe3-ca8b8ebb1a33",
"sessionId": "570a3dbc-7256-4e58-be60-1dd42cb0ada0"
},
"data": {
"heart_rate":85
}
},
{
"metadata": {
"timestamp": "2023-11-02T11:00:10.263Z",
"deviceId": "deviceId1",
"patientId": "377663dc-0a9c-46ce-bbe3-ca8b8ebb1a33",
"sessionId": "570a3dbc-7256-4e58-be60-1dd42cb0ada0"
},
"data": {
"heart_rate":70
}
}
]
}
Error Handling
If there is an error while posting multiple measurements, you will receive a post summary in the API response. You should check for errors and re-post failed measurements using this API.
Max Data Size
Please note that the maximum data size that you can post via the bulk measurements API is 70MB.
Repeat for Subsequent Sessions
Once all measurements for the session are saved you may remove them from the device storage and repeat steps 1 & 2 again.
Updated 11 months ago