Huma Platform Play (1.23.0)
Welcome to API documentation for Platform Play product. Download the spec here.
Introduction
This API is written in OpenAPI v3 and is based on existing functionalities of Huma Portal And Huma App.
Authentication
There are two ways to authenticate to the API:
- End user authentication: Using username, password flow. It may ask to setup 2FA based of deployment configuration.
- Machine user authencation: Using Hawk method to authenticate into system.
For Hawk authentication, Huma staffs provides you with the necessary credentials.
Python / export de-identified data
Download from the export.py file here. Make sure to have python3 (>= 3.7) and pip on your system.
Install dependencies:
$ pip install requests mohawk
Set AUTH_ID, AUTH_KEY, DEPLOYMENT_ID in code and call export.py:
$ python3 export.py
Or alternatively to step 2, set the env variable and call export.py:
$ AUTH_ID=<ID> AUTH_KEY=<KEY> DEPLOYMENT_ID=<DEP_ID> python3 export.py
Step 2 or 3 generates an export.json based on the input parameters.
Note
OpenAPI syntax we use a few vendor extensions.
The users with any these roles can access the export API: Admin
, OrganizationStaff
, AccessController
and Contributor
If you are using End user authentication
- Sign in for clinician user:
- API
/api/auth/{version}/signin
will return theauthToken
anduser_id
in response.
- API
- Get deploymentId:
- Using the
Bearer {authToken}
do call/api/extensions/{version}/user/{user_id}/configuration
to getdeploymentId
- Using the
- Export patients data in CSV/JSON format(for that clinician):
- For given
deploymentId
the data can be exported using/api/extensions/{version}/export/
- For given
If you are using Hawk authentication
- Sign in Api Key and Api ID:
- Huma staffs provides you with Api credentials
- Get deploymentId:
- Huma staffs provides you with necessary deployment ID(s)
- Export patients data in CSV/JSON format:
- For given
deploymentId
the data can be exported using/api/extensions/{version}/export/
- For given
Request Body schema: application/json
Export request
deIdentified | boolean Default: false Identified information type:
|
format | string Default: "JSON" Enum: "JSON" "CSV" "JSON_CSV" Exported files format |
fromDate | string <yyyy-mm-dd> Export data starting date |
toDate | string <yyyy-mm-dd> Export data ending date |
deploymentId | string Export data for specific |
deploymentIds | Array of strings Export data from multiple deployments by its |
userIds | Array of strings Export data only for specific users specified by thier |
moduleNames | Array of strings Export only specific modules specific by module names |
excludedModuleNames | Array of strings Export all modules but not these |
includeUserMetaData | boolean Default: true User's meta data type:
|
includeNullFields | boolean Default: true
|
useFlatStructure | boolean Default: false
|
view | string Default: "USER" Export the data according to the selected view.
|
binaryOption | string Default: "BINARY_INCLUDE" Binary options type:
|
layer | string Default: "NESTED" Export files based on below layer type:
|
quantity | string Default: "MULTIPLE" Export files based on below quantity type:
|
questionnairePerName | boolean Default: false
|
splitMultipleChoice | boolean Default: false
|
splitSymptoms | boolean Default: false
|
translatePrimitives | boolean Default: false
|
singleFileResponse | boolean Default: false
|
translationShortCodesObjectFormat | string Default: "JSON" Enum: "JSON" "CSV" "JSON_CSV" Translation Short Codes Object files format |
doTranslate | boolean |
baseProfile | string Export data for created profile |
organizationId | string Export data for specific organization by |
Responses
Request samples
- Payload
{- "userExportProfile": false,
- "deIdentified": true,
- "excludedModuleNames": [
- "Step"
], - "binaryOption": "NONE",
- "includeNullFields": false,
- "format": "JSON",
- "singleFileResponse": true,
- "fromDate": "2021-07-15",
- "toDate": "2021-08-12",
- "deploymentId": "{{deploymentId}}"
}
Response samples
- 200
- 401
- 403
- 404
{- "BloodPressure": {
- "BloodPressure": [
- {
- "id": "0a4bb54aa61b9130dc60f0e81f85c45c3a7649c23e649a0559382784c3377f87",
- "userId": "7d7f29bc7bf67f9cd931350b85cb8650d9295248ab5986710e1e2e5d03d5bc71",
- "moduleId": "BloodPressure",
- "moduleConfigId": "5f7258e729e61eb9f9b8397a",
- "deploymentId": "5f72588029e61eb9f9b83979",
- "version": 0,
- "deviceName": "Android",
- "isAggregated": false,
- "startDateTime": "2021-07-15T08:03:31.000000Z",
- "createDateTime": "2021-07-15T08:03:33.921000Z",
- "submitterId": "7d7f29bc7bf67f9cd931350b85cb8650d9295248ab5986710e1e2e5d03d5bc71",
- "client": {
- "product": "Huma-Demo",
- "version": "1.10.0",
- "software_name": "Android",
- "software_version": "25 (7.1.1)",
- "bundle_id": "com.huma.humaapp.demo",
- "build": "8508",
- "hardware": "motorola Moto E (4) Plus"
}, - "server": {
- "hostUrl": "demoapi.humaapp.io",
- "server": "1.10.0",
- "api": "V1"
}, - "diastolicValue": 68,
- "systolicValue": 120,
- "diastolicValueUnit": "mmHg",
- "systolicValueUnit": "mmHg",
- "_cls": "BloodPressure",
- "user": {
- "id": "7d7f29bc7bf67f9cd931350b85cb8650d9295248ab5986710e1e2e5d03d5bc71",
- "updateDateTime": "2021-10-22T12:01:28.023000Z",
- "createDateTime": "2021-07-14T14:38:05.185000Z",
- "height": 168,
- "extraCustomFields": { },
- "timezone": "Europe/London",
- "enrollmentId": 18,
- "language": "en",
- "stats": {
- "taskCompliance": { }
}, - "consent": {
- "id": "c7a71c9d389d5843849b69b0051bfec26bdf9ee98eb231aa11234c5c00e27c49",
- "userId": "631dcb9cadeb648a38997466b180ad6af4e962459f9523c39bbe0fd0d37a992b",
- "consentId": "5f7258f329e61eb9f9b8397e",
- "revision": 4,
- "sharingOption": 0,
- "createDateTime": "2021-07-14T15:00:55.389000Z",
- "agreement": true,
- "deploymentId": "5f72588029e61eb9f9b83979"
}
}
}
]
}
}
Using Export Profile API endpoint you can perform basic CRUD operations against Export Profile data
For example, To export the data using created export profile we can call below APIs:
- Create export profile for patients(for that clinician)/deployments(for that organization) data :
- For given
deploymentId/organizationId
,content
andname
the export profile can be created using/api/extensions/{version}/export/profile
- Export patients/deployments data in CSV/JSON format(for that clinician/organization) by using created profile:
- For given
baseProfile
anddeploymentId/organizationId
the data can be exported using/api/extensions/{version}/export/
Request Body schema: application/json
Create export profile request
name | string Name of the export profile |
deploymentId | string Export data for specific |
organizationId | string Export data for specific organization by |
deploymentIds | Array of strings Export data from multiple deployments by its |
object |
Responses
Request samples
- Payload
{- "name": "{{profile name}}",
- "deploymentId": "{{deploymentId}}",
- "content": {
- "fromDate": "2021-07-08",
- "toDate": "2021-07-25",
- "format": "JSON",
- "deIdentified": false,
- "singleFileFormat": true
}
}
Response samples
- 201
- 400
- 401
- 403
{- "id": "60fa5ce3ee36446d38825f11"
}
- Hawk