Sonde Health API Platform Documentation

Health Check with questionnaire support

Overview

Use these use-cases (with curl language examples) as a guide for your app development.

Notes:

  • Currently Sonde doesn’t support any measure with questionnaire, please contact Sonde at support@sondehealth.com. Please provide your company name and address in support ticket.

API Credentials

For all use-cases, you should have the following information (the following values are examples only):

Refer Account for detail on how to create an account with Sonde and obtained below client-id & client-secret.

client-id: 6lpo5bolnp4uda4n2is3u8tt2

client-secret: 1114assc3pnln1b2lngjjml6mkce3uw0q70mrv9pqphusfbgtq9a

domain: api.sondeservices.com

The Sonde Service API uses an access-token to authenticate requests. Generate a access-token using ‘client-credential’ (consists of “client-id” and “client-secret”).

Your 'client-credential' must be kept secure on your server (or preferably in secret storage at server side). Do not share your client-credential in publicly accessible areas (such as GitHub, client-side code, and so forth).

Obtain the access-token by following the steps below.

API call

$ curl --request POST 'https://api.sondeservices.com/platform/v1/oauth2/token' \ --header 'Authorization: Basic <Base64EncodedString>' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'grant_type=client_credentials' \ --data-urlencode 'scope=sonde-platform/users.write sonde-platform/scores.write sonde-platform/storage.write'

Get <Base64EncodedString> using the below command

$ echo -n "<clientid>:<clientsecret>" | openssl base64 -A

API response

{ "access_token": "ya29.QQIBibTwvKkE39hY8mdkT_mXZoRh7Ub9cK9hNsqrxem4QJ6sQa36VHfyuBe", "expire_in": 3600, "token_type": "Bearer" }

Pass the “access_token” key value in the Authorization header of Sonde Service APIs.

The access_token will expire_in 3600 seconds.

The token_type is “Bearer” (this value is fixed).

For a list of supported scopes, please check the schema in the Authentication section of the API Documentation REST API Reference.

For a list of scopes required for Scoring refer to Authentication Scopes

Using the generated access-token, you can access Sonde Platform’s Services.

Example; if you want your device to upload a voice sample to the Sonde Platform using Storage Service, then you can share an access-token with the device having scope sonde-platform/storage.write to restrict the access and prevent the misuse of privileges your client-credential is carrying.

As a developer, I want to generate a score for Health Check “XYZ”.

Score an “XYZ” health condition with the Sonde Platform “XYZ” measure.

On your backend perform the below steps to get the score:

STEP 1: GET THE APPROPRIATE ACCESS-TOKEN
STEP 2: REGISTER A USER WITH SONDE HEALTH
STEP 3: GET THE S3 SIGNED URL TO UPLOAD YOUR AUDIO FILE
STEP 4: UPLOAD YOUR AUDIO FILE
STEP 5: LOOK FOR QUESTIONNAIRE REQUIRED FOR MEASURE
STEP 6: GET QUESTIONNAIRE FOR THE MEASURE
STEP 7: SUBMIT QUESTIONNAIRE RESPONSE TO SERVER
STEP 8: ASK FOR THE EXPECTED MEASURE SCORE

Detailed explanation with curl examples of each step is given below.

STEP 1: GET THE APPROPRIATE ACCESS-TOKEN

Get the access-token with scopes sonde-platform/scores.write , sonde-platform/users.write, sonde-platform/questionnaires.read, sonde-platform/questionnaire-responses.write and sonde-platform/storage.write.

Ensure your client-credentials are granted to these scopes during the registration/onboarding process with Sonde Health.

 

Response 1:

 

STEP 2: REGISTER A USER WITH SONDE HEALTH

Use "access_token" to register a user. Put the value of access_token into the Authorization header (refer to the below curl command).

It is expected that your server will register the user with SondePlatform during user sign-up process.

 

Response 2:

Capture the userIdentifier, in the below response wiNODNXcm. This userIdentifier will be required while calling the /inference/score API in following steps.

Keep userIdentifier in your UserManagement module (or database) to later use it for same patient.
userIdentifier will be used in STEP 3 .

STEP 3: GET THE S3 SIGNED URL TO UPLOAD YOUR AUDIO FILE

Call Storage Service to get the signed URL. In the Authorization header put the value of the access_token attribute from Response 1 and the country-code in which you want to upload the wave file. (For supported country codes please check the REST API Reference).

For better measure accuracy it is recommended to upload the audio file which has the elicitation mentioned on page Vocal Biomarkers - Health Checks .

countryCode should be the country information which you have used while creating the account with Sonde Health.

 

Response 3:

The response is shown for illustration purposes.

The signedURL is required in STEP 4.

The filePath is required in STEP 8.

STEP 4: UPLOAD YOUR AUDIO FILE

Upload a local audio file to <signedURL>. In the below curl command replace <audioFilePath> with your local file path and <signedURL> with the value of the signedURL attribute received in Response 3.

 

You can expect the 20X response code for the above mentioned API.

STEP 5: LOOK FOR QUESTIONNAIRE REQUIRED FOR MEASURE

Call the /measures/name/{measureName} API to check the questionnaire required for measure and list of languages in which questionnaire is available on Server.

Response 5:

questionnaire.id and questionnaire.languages is required in STEP 6.

STEP 6: GET QUESTIONNAIRE FOR THE MEASURE

Call /questionnaires/{questionnaireId}?language=<language> to get questionnaire.

Below API will return questionnaire qnr_e23er432w in English language.

 

Replace <access_token> with the value of the access_token attribute of Response 1

 

Response 6:

<Detail of questions is TBD>

STEP 7: SUBMIT QUESTIONNAIRE RESPONSE TO SERVER

Ask questionnaire (Got in STEP 6) to your app user and use API POST /questionnaire-responses to submit response to server

 

Replace <access_token> with the value of the access_token attribute of Response 1
Replace <questionnaireId> with the value of the id attribute of Response6
Replace <language> with the value of one of the language received in languages attribute of Response6
Replace <userIdentifier> with the value of userIdentifier attribute of Response2
Fill-up questionnaire.questionResponses as per user response to questionnaire

<Detail of questionResponses is TBD>

Response 7:

id is required in STEP 8

STEP 8: ASK FOR EXPECTED MEASURE SCORE

Call the /inference/score API to get the "XYZ" score. Refer to the below curl command.

Replace <access_token> with the value of the access_token attribute of Response 1
Replace <userIdentifier> with the value of userIdentifier attribute of Response 2
Replace <filePath> with the value of the path attribute of Response3
Replace <questionnaireResponseId> with the value of the id attribute of Response7

 

Response 8:

The User’s "XYZ" score is 40 (for score and associated severity level please check Vocal Biomarkers - Health Checks ).

 

Sonde Health