Doctorlink has joined HealthHerohealthheroLearn More
doctorlink

Injected History

Request Explained

Below is a detailed look at injected history and what each property does

{
    "traversalId": Guid,
    "assetId": int,
    "answerId": int,
    "value": "string",
    "injectedHistoryType": Enum,
    "isAnswered": bool
}

TraversalId : Your unique traversal Identifier. Nullable. Because you are injecting history into a fresh traversal, this is not needed.

AssetId : Identifier of the asset, i.e. Question Id. Required

AnswerId : Identifier of the Answer. Required

Value : The value of answer. Only used for answers that were of type Text, Date, or Number. Nullable

InjectedHistoryType : An enum that takes either PreAnswer or PrePopulate. Defaults to PreAnswer PreAnswer tells the API to automatically answer the question so it will not be shown on the UI. PrePopulate returns the question to the UI, but the given answers will be already set. These answers are changable.

IsAnswered : Tells us which answer of a question was selected.


When starting a product like Online triage (aka Symptom Assessment) it is possible to push data into your traversal that could affect the questions and answers you see. Taking the example from the quickstart guide, if we wanted to skip the question asking who you're answering for, you would push the data for that question into your first API call.

The below call will now skip the first question, immediately moving to the second question.

curl ".../api/v1/{tenantId}/Traversals" \
  -X "POST" \
  -H "Authorization: Bearer ACCESS_TOKEN" \
  -H "Content-Type: application/json" -d '{
    "shortCode": "XYZ",
    "injectedHistory": [{
	"assetId": 13045,
	"answerId": 7527,
	"injectedHistoryType": "PreAnswer",
	"isAnswered": true
    },
    {
	"assetId": 13045,
	"answerId": 7528,
	"injectedHistoryType": "PreAnswer",
	"isAnswered": false
    }]
}'

You could easily do this for any question in a product, assuming you knew all the pertinent Ids and values. But they do need to be injected at the start of a traversal, when it's created.

Example Injection

The three examples below cover every type of presented question. All these examples will PreAnswer the question meaning the user will no longer be presented with that question.

Note: any Ids stated are for example use only and may change based on content.

Single-Answer Question

Single-answer questions are, essentially, a list of radio buttons. Only one option may be choosen and as such, only 1 answer needs to be injected in order to prevent that question being shown/asked.

{
    "assetId": 70,
    "answerId": 88,
    "injectedHistoryType": "preanswer",
    "isAnswered": true
}

This will inject BiologicalSex as Male and skip over asking the user.

qt-radio-button.png

Multi-Answer Question

These are displayed to the user as checkboxes, and they may select more than 1 answer. Due to the way a negative-afirmation works in the engine, if the engine can't prove the user hasn't selected an answer on a multi-answer question, then it must display it (to be selected or not) before moving on.

This means, if you wish to prevent a user from seeing a multi-answer question entirely, you need to inject every answer that is on the question even if it's not 'selected'.

Injecting only the 'selected' answers will result in the multi-answer question being shown, but without the answers already injected. Not showing answers we've already injected prevents the user from changing something that we already know to be true.

If you wish for a user to review, and potentially change an answer, use PrePopulate.

[{
    "assetId": 1549,
    "answerId": 1542,
    "injectedHistoryType": "preanswer",
    "isAnswered": false
},
{
    "assetId": 1549,
    "answerId": 1549,
    "injectedHistoryType": "preanswer",
    "isAnswered": false
},
{
    "assetId": 1549,
    "answerId": 1551,
    "injectedHistoryType": "preanswer",
    "isAnswered": false
},
{
    "assetId": 1549,
    "answerId": 1543,
    "injectedHistoryType": "preanswer",
    "isAnswered": false
},
{
    "assetId": 1549,
    "answerId": 33862,
    "injectedHistoryType": "preanswer",
    "isAnswered": false
},
{
    "assetId": 1549,
    "answerId": 1545,
    "injectedHistoryType": "preanswer",
    "isAnswered": false
},
{
    "assetId": 1549,
    "answerId": 1554,
    "injectedHistoryType": "preanswer",
    "isAnswered": true
},
{
    "assetId": 1549,
    "answerId": 33863,
    "injectedHistoryType": "preanswer",
    "isAnswered": false
},
{
    "assetId": 1549,
    "answerId": 9963,
    "injectedHistoryType": "preanswer",
    "isAnswered": false
}]

This will inject all Ethnicity answers in the screenshot below and skip over asking the user.

inject-example-ma-ethnicity.png

Note: the order of injected history is irrelevant.

Value-Entry Question

Value entry questions are just that, user input boxes that can be typed into or changed by the user (based on the UX.) These can be number, date, and text. In all case, injecting the answer still requires the isAnswered=true property.

{
    "assetId": 19063,
    "answerId": 16309,
    "injectedHistoryType": "preanswer",
    "isAnswered": true,
    "value": "81"
}

This will inject the user's age as 81. Again, you may want to use PrePopulate, if you require user confirmation.