Uploading Data

To optimize resources, Aidlab Web 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
startDate
required
Beginning of the Session, in ISO 8601 format.
endDate
required
End of the Session, in ISO 8601 format.
ecg
optional
Raw ECG signal. The signal is compressed by gzip, and then Base64 encoded. Each sample is a float4 (4 bytes) value, little endian encoded.
respiration
optional
Raw respiration signal. The signal is compressed by gzip, and then Base64 encoded. Each sample is a float4 (4 bytes) value, little endian encoded.
orientation
optional
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.
motion
optional
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.
pressure
optional
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.
spo2
optional
An array of numbers containing SpO2 samples.
pulse
optional
An array of numbers containing heart rates.
activities
optional
String array of activities (walking, stationary, cycling, etc.)
temperature
optional
An array of numbers containing skin temperature samples.
respirationRate
optional
An array containing respiration rates
steps
optional
An array containing steps.
soundVolume
optional
An array containing sound volume.
hrv
optional
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 a Session, you’ll need to send a request of type multipart/form-data. The request should contain the file that contains the JSON encoded Session you would like to upload. The file should follow the specifications of RFC 2388 (which defines file transfers for the multipart/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).

results matching ""

    No results matching ""