Exporting Data

How to export data from the BioT platform

BioT enables to export data out of the platform to be used for any mean, and especially by external BI and analysis tools.

Export Process

  1. Make a "Create Report" API call
  2. Wait for the report to be created (BioT will send a notification about it to a callback URL you provide in the "Create Report" call).
  3. Download the data

📘

Enable Export

To save costs the export feature is not enabled by default.
If you require this feature please contact us and we will enable it for you.

Make a "Create Report" API call

To create the report make the following API call:

POST https://example.com/dms/v1/data/reports/export
Body:

{
  "queries": [
    {
      "dataType": "device",
      "filter": {
        "_creationTime": {
          "from": "2023-04-02T13:13:05.703Z",
          "to": "2023-04-03T13:13:05.703Z"
        },
        "_lastModifiedTime": {
          "from": "2023-04-02T13:13:05.703Z",
          "to": "2023-04-03T13:13:05.703Z"
        },
        "_templateId": {
          "in": [
            "456171e0-78ba-4991-995f-e8488b68041b"
          ]
        }
      },
      "sort": [
        {
          "prop": "_creationTime",
          "order": "ASC"
        }
      ]
    }
  ],
  "outputMetadata": {
    "maxFileSizeInBytes": 1000000000,
    "exportFormat": "JSON"
  },
  "callbackEndpoint": "https://my-url.com/"
}
ParameterDescriptionExample
queriesString
An array of queries
mandatory
JSON array
dataTypeString
The data type to export
mandatory
String
possible values:
device
device-alert
usage-session
command
organization
patient
organization-user
caregiver
patient-alert
generic-entity
measurements
filter.prop1String
Filter by creation time or last modified time.
You have to set at least one of them but not both.
possible values:
_creationTime
_lastModifiedTime
_templateId
sort.propString
Sort only supports "_creationTime"
optional
possible values:
_creationTime
sort.orderString
Sort order
possible values:
ASC
DESC
outputMetadata.maxFileSizeInBytesNumber
The max file size. BioT will split large report files into files of this size.
The number in bytes,
Optional
Example:
1000000000
exportFormatString
At the moment only JSON is supported
Optional
possible values:
JSON
callbackEndpointString/URL
A public URL. BioT will call this URL once the report is ready
Mandatory
Example:
"https://my-url.com/"

The API will return:

{
  "queries": [
    {} // Copy of the request
  ],
  "outputMetadata": {
    "maxFileSizeInBytes": 1000000000,
    "exportFormat": "JSON"
  },
  "callbackEndpoint": "https://my-url.com/",
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "status": "IN_PROGRESS",
  "fileOutput": {
    "filesLocation": {
      "additionalProp1": {},
      "additionalProp2": {},
      "additionalProp3": {}
    },
    "urlExpirationTime": "2007-12-20T10:15:30Z"
  },
  "reportInitiator": {
    "userId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "ownerOrganizationId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "userEntityType": "string",
    "templateId": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  }
}

Wait for the report to be created

The report will be created asynchronously and depending on the size of it it might take a long time to be created.
You can determine if the report is ready in 2 ways:

  1. Wait for BioT to make a call back to the URL you supplied in the request.
  2. Poll BioT to check if the report is ready.
    To poll make the following API call:
    GET https://example.com/dms/v1/data/reports/{id}
    Use the report ID from the Create Report response.
    In the response check the status attribute.
    If the status is COMPLETED then the report is ready to be downloaded.

Download the data

To download the data make the API call mentioned in the previous section.
Use the fileOutput object to download the report.
The report will hold a list of files to download.