Uploading Data
To optimize resources, Aidlab API utilizes a Session
object type. A single Session
is a variable-length chunk containing collected data from Aidlab and Aidmed, like respiration, activity or motion. We encourage developers to keep sessions short (around 1-3 minutes long) as we found it as optimal duration.
The Session object type
Field | Description |
---|---|
startDaterequired |
Beginning of the Session , in ISO 8601 format. |
endDaterequired |
End of the Session , in ISO 8601 format. |
ecgoptional |
Raw ECG signal. The signal is compressed by gzip, and then Base64 encoded. Each sample is a float4 (4 bytes) value, little endian encoded. |
respirationoptional |
Raw respiration signal. The signal is compressed by gzip, and then Base64 encoded. Each sample is a float4 (4 bytes) value, little endian encoded. |
orientationoptional |
Raw user's orientation in the XYZ axis. The signal is compressed by gzip, and then Base64 encoded. Each sample is a float4 (4 bytes) value, little endian encoded. |
motionoptional |
Raw readings from the 9-axis motion sensor unit. Within this signal, three events are available with the following sets of values: acceleration (ax, ay, az), angular velocity (gx, gy, gz) and magnetic induction (mx, my, mz). The signal is compressed by gzip, and then Base64 encoded. Each sample is a float4 (4 bytes) value, little endian encoded. |
pressureoptional |
User orientation in XYZ axis. The signal is compressed by gzip, and then Base64 encoded. Each sample is a int16 (2 bytes) value, little endian encoded. |
spo2optional |
An array of numbers containing SpO2 samples. |
pulseoptional |
An array of numbers containing heart rates. |
activitiesoptional |
String array of activities (walking , stationary , cycling , etc.) |
temperatureoptional |
An array of numbers containing skin temperature samples. |
respirationRateoptional |
An array containing respiration rates |
stepsoptional |
An array containing steps. |
soundVolumeoptional |
An array containing sound volume. |
hrvoptional |
An array of numbers containing heart rate variability |
Create Session
POST /api/v2/sessions creates a new Session
object.
The header must contain following values:
Content-Type
. To upload aSession
, you’ll need to send a request of typemultipart/form-data
. The request should contain the file that contains the JSON encodedSession
you would like to upload. The file should follow the specifications of RFC 2388 (which defines file transfers for themultipart/form-data
protocol). The file name should be empty.
Only 15 second time window is reserved to send a session. If you are unable to send Session
within this time, the error will be raised with the 408
HTTP status code.
Also, sending Sessions when two dates are overlapping is not possible, and will result with error response:
{"response":"Error: session overlap","code":100}
Such situation can mostly happen in three cases:
- User was measuring himself simultaniously on two devices and on the same account.
- Session was sent, but server did not respond with success message (either server was killed or some serious glitch occured).
- Client could not receive message before server had a chance to recieve the status (app was killed soon after Session was sent).