Attempting an Assessment

In this page, the detailed workflow of attempting an assessment is explained with examples. In the subsequent page, the summary workflow is given, which you may use for quick reference.

Creating a Profile Questionnaire

For a profile to attempt a questionnaire, the first step is to create a profile questionnaire which is a relationship entity between the profile and the questionnaire using the POST /service/profiles/profile-questionnaire/ endpoint. Body params:

questionnaire_id: received via the listing endpoint outlined in the previous page
profile_id: ID of the profile attempting the questionnaire.

Sample Response

{
    "id": "927522d3-e9b4-4196-9b1c-b550f801db27",
    "questionnaire_id": "a85a1e95-3e7a-44a0-8847-b5c5145b0756",
    "profile_id": "bbe3cedb-4315-4677-a8bb-d5084542908a",
    "email": "",
    "status": "unsent",
    "answers": [],
    "progress": 0.0,
    "sent_at": null
}

Fields of concern are:

id: ID of the newly created profile questionnaire

answers: Since the profile questionnaire is just created, and no question has yet been answered, it is an empty list.

progress: Current progress is 0, since no questions have yet been answered

For more details, refer to the Profile Questionnaire entity.

Fetching Questions Against a Questionnaire

Next step is to fetch questions against the concerned questionnaire. To do that, call the GET /service/profiles/question/ listing endpoint with questionnaire_id as a query parameter.

Sample response is given below, showing one question.

Question

[
    {
        "id": "091db4b1-5f8d-422c-97f6-c58c0e52888f",
        "name": "Bipolar-FH",
        "related_slug": null,
        "position": null,
        "question_type": "standard",
        "question_text": "<p>Do you have a parent or sibling who has ever been diagnosed with bipolar disorder?</p>",
        "answer_type": "single choice",
        "leading_text": "",
        "followup_text": "",
        "category": "General",
        "answer_options": [
            {
                "id": "8f794184-151c-4e1d-b639-74eaf4a88985",
                "question_id": "091db4b1-5f8d-422c-97f6-c58c0e52888f",
                "option_text": "Yes",
                "order": 1,
                "icon": null,
                "archived": false,
                "resourcetype": "MultipleChoiceOption"
            },
            {
                "id": "d9118922-5807-4845-8265-53bf0a2bfe34",
                "question_id": "091db4b1-5f8d-422c-97f6-c58c0e52888f",
                "option_text": "No",
                "order": 2,
                "icon": null,
                "archived": false,
                "resourcetype": "MultipleChoiceOption"
            },
            {
                "id": "096637a9-2d29-44ec-a104-65d3eb7e5e1c",
                "question_id": "091db4b1-5f8d-422c-97f6-c58c0e52888f",
                "option_text": "Not sure",
                "order": 3,
                "icon": null,
                "archived": false,
                "resourcetype": "MultipleChoiceOption"
            }
        ],
        "constraints": [],
        "questionnaires": [
            {
                "id": 329,
                "position": 8,
                "questionnaire_id": "a85a1e95-3e7a-44a0-8847-b5c5145b0756",
                "question_id": "091db4b1-5f8d-422c-97f6-c58c0e52888f"
            }
        ],
        "depends_on_question_ids": [],
        "archived": false
    },
  	...
  ]

Displaying Questions

These questionnaires have some complexities when it comes to displaying them to end users, but don't worry; we got you covered. All those complexities are handled in the backend, and the below sub-section just briefly explains them.

Complexities

Questions within these questionnaires are often inter-dependent, based on user's responses. Certain questions have constraints, for example some questions are only supposed to be shown to female or male users exclusively, while other questions are displayed depending upon the answer to a previous question.

Let's say there are two single choice questions in a questionnaire:

  1. Do you smoke?
    1. Yes
    2. No
  2. How often do you smoke?
    1. Daily
    2. Once a week
    3. Occasionally

Now whether the 2nd question is supposed to be displayed to the user attempting the questionnaire depends on their answer to the first question, i.e. it should be displayed only if they answer "Yes" to the 1st question.

To deal with these complexities, we need to call another endpoint, after answering each question within the questionnaire, to fetch the list of available questions, that satisfy all the constraints.

Available Questions

That endpoint is the GET /service/profiles/profile-questionnaire/{profile_questionnaire_id}/available-questions/ endpoint. profile_questionnaire_id is returned as id from POST /service/profiles/profile-questionnaire/ endpoint discussed in the first section of the page.

Sample response is given below. If you haven't answered any question within the questionnaire, this is how the response looks like:

{
    "available_question_ids": [
        "4fee7512-9e04-4a10-b262-5cfa39d205ca",
        "a4c30c15-5470-4710-b491-d73e3ed3e312",
        "f1f00ce0-ad99-432e-82df-0665c0dc1481",
        "e19aedd4-a26f-4f43-83db-7afaa3adf67f",
        "091db4b1-5f8d-422c-97f6-c58c0e52888f",
        "1ba063e6-a404-4897-8a92-736557508a75",
        "eed7fedb-6968-47d7-85cd-0b8d1cf1c294",
        "ab8f16d8-5fda-4057-8133-7f106e74c3c9",
        "fb50d2bb-2ced-4536-a761-6bb566bb330d",
        "28a1a86e-5ede-47ae-b6cd-dff720177416"
    ],
    "answered_question_ids": [
    ]
}

available_question_ids: A list of ordered question IDs that satisfy all the constraints.
answered_question_ids: A list of question IDs that the user has already answered.

Displaying one question at a time

Please note that you are supposed to display only one question at a time to the end user, and every time a user answers the question, you are supposed to call the available-questions endpoint once more, because the list of available question IDs may vary based on the user's answer. In other words, these questionnaires cannot be displayed in a single form, where users are allowed to select answers for multiple questions at once, and submit at the end. Each question has to be answered separately, and the new list of available questions has to be fetched after each answer. It goes like this:

  • Call the available questions endpoint. Display the first question returned in the available_question_ids field.
  • Answer the first question. Details on answering a question will follow later.
  • Call the available questions endpoint again. This time, the response will be like
{
    "available_question_ids": [
        "4fee7512-9e04-4a10-b262-5cfa39d205ca",
        "a4c30c15-5470-4710-b491-d73e3ed3e312",
        "f1f00ce0-ad99-432e-82df-0665c0dc1481",
        "e19aedd4-a26f-4f43-83db-7afaa3adf67f",
        "091db4b1-5f8d-422c-97f6-c58c0e52888f",
        "1ba063e6-a404-4897-8a92-736557508a75",
        "eed7fedb-6968-47d7-85cd-0b8d1cf1c294",
        "ab8f16d8-5fda-4057-8133-7f106e74c3c9",
        "fb50d2bb-2ced-4536-a761-6bb566bb330d",
        "28a1a86e-5ede-47ae-b6cd-dff720177416"
    ],
    "answered_question_ids": [
        "4fee7512-9e04-4a10-b262-5cfa39d205ca",
    ]
}
  • As can be seen, the first question is also present in the answered_question_ids array as it was answered previously. Now the first unanswered question, i.e. 2nd question in the available_question_ids arrays can be displayed to the user, and so on.
  • Once user has answered all questions, the length of available_question_ids will be equal to the length of answered_question_ids and the questionnaire will be completed.

Answering Question

To answer a question, make a POST call to /service/profiles/answer/ endpoint.

Standard questions

For single choice and multiple choices questions, pass the selected option ID(s) in the options body param. response_text is not required.

Example

    {
        "id": "4fee7512-9e04-4a10-b262-5cfa39d205ca",
        "name": "Bipolar-asthma",
        "related_slug": null,
        "position": null,
        "question_type": "standard",
        "question_text": "<p>Have you ever been diagnosed with asthma?</p>",
        "answer_type": "single choice",
        "leading_text": "",
        "followup_text": "",
        "category": "General",
        "answer_options": [
            {
                "id": "b47a0421-6ba2-46d0-bfe2-f7aa0c568636",
                "question_id": "4fee7512-9e04-4a10-b262-5cfa39d205ca",
                "option_text": "Yes",
                "order": 1,
                "icon": null,
                "archived": false,
                "resourcetype": "MultipleChoiceOption"
            },
            {
                "id": "5beb6b7f-25cf-4cfb-93d2-bc08fa963e32",
                "question_id": "4fee7512-9e04-4a10-b262-5cfa39d205ca",
                "option_text": "No",
                "order": 2,
                "icon": null,
                "archived": false,
                "resourcetype": "MultipleChoiceOption"
            }
        ]
    }

POST /service/profiles/answer/ with body:

{
    "profile_questionnaire_id": "927522d3-e9b4-4196-9b1c-b550f801db27",
    "question_id": "4fee7512-9e04-4a10-b262-5cfa39d205ca",
    "options": ["5beb6b7f-25cf-4cfb-93d2-bc08fa963e32"]
}

Weight question

The weight question would have only one option, which would correspond to the free response option. A weight question looks like the following:

    {
        "id": "a1fa96ba-1ac1-4157-9d20-95a194e36742",
        "name": "Current Weight",
        "related_slug": null,
        "position": null,
        "question_type": "weight",
        "question_text": "<p>What is your current weight?</p>",
        "answer_type": "free response",
        "leading_text": "",
        "followup_text": "",
        "category": "Medical History & Current Health",
        "answer_options": [
            {
                "id": "017a5c0b-5983-4999-bf20-01f45ffb90e5",
                "question_id": "a1fa96ba-1ac1-4157-9d20-95a194e36742",
                "option_text": "My current weight is:",
                "order": 1,
                "archived": false,
                "resourcetype": "FreeResponseOption"
            }
        ],
      	...
    }

As shown, it has only one answer option, which must be provided in the options body param when posting the answer. Since it is a free response question, the response_text field also has to be provided, containing the weight in kgs. The value must be a positive number less than 650.

POST /service/profiles/answer/ with body:

{
    "profile_questionnaire_id": "ed302905-33bc-4355-9ae9-222479d1640a",
    "question_id": "a1fa96ba-1ac1-4157-9d20-95a194e36742",
    "options": ["017a5c0b-5983-4999-bf20-01f45ffb90e5"],
    "response_text": "72"
}

Height Question

Similarly, for height question, there would be only one answer option, which must be provided upon posting an answer, along with a positive number less than 300 in the response_text, which denotes the height in cm.

{
        "id": "a9a5dd19-f269-4898-9b72-3c55115aa3d5",
        "name": "Height",
        "related_slug": null,
        "position": null,
        "question_type": "height",
        "question_text": "<p>What is your height?</p>",
        "answer_type": "free response",
        "leading_text": "",
        "followup_text": "",
        "category": "Medical History & Current Health",
        "answer_options": [
            {
                "id": "1f49f2ae-3ffb-495e-a066-1e10cffaa2b8",
                "question_id": "a9a5dd19-f269-4898-9b72-3c55115aa3d5",
                "option_text": "My height is:",
                "order": 1,
                "archived": false,
                "resourcetype": "FreeResponseOption"
            }
        ],
  			...
}

POST /service/profiles/answer/ with body:

{
    "profile_questionnaire_id": "ed302905-33bc-4355-9ae9-222479d1640a",
    "question_id": "a9a5dd19-f269-4898-9b72-3c55115aa3d5",
    "options": ["1f49f2ae-3ffb-495e-a066-1e10cffaa2b8"],
    "response_text": "170"
}

Impact of answering a question on other profile questionnaires and profile risks

There are questions which are shared across questionnaires. For example, some common questions inquiring weight or smoking habits of the user are used by many lifestyle assessments because for many diseases, weight / BMI and smoking habits are a risk factor.

So if an answer for Question A is stored for a profile while attempting Questionnaire A, the same answer will be used when the user is attempting Questionnaire B, i.e. the question would be returned in the answered_question_ids field in the response of available-questions endpoint. If, while attempting Questionnaire B, the user updates the answer, it would impact the user's score for Questionnaire A as well, which would be auto-computed and re-calculated.

Also, answering a question within a questionnaire can also alter the progress of other incomplete questionnaires against a profile.

Impacted profile questionnaires

As we discussed, questions and answers are shared across questionnaires. Let's say we have "Question 1" shared between Questionnaire A and Questionnaire B. Let's further assume that each Questionnaire A and Questionnaire B have a total of 10 questions to be answered.

The user starts Questionnaire A. A profile questionnaire entity for Questionnaire A will have to be created using a POST call to the profile-questionnaire endpoint. It will have 0 progress.

When the user answers Question 1, the progress of Questionnaire A is increased from 0.0 to 0.1, since 1 question of the total 10 questions is answered. The question is also answered for Questionnaire B, since the question is shared.

We discussed that a profile questionnaire entity has to be created for all questionnaires that have been attempted. Since one question of Questionnaire B is also attempted, a profile questionnaire entity will be created for Questionnaire B, with progress 0.1. All of this will happen in the backend, as a side affect of posting an answer to Question 1 while attempting Questionnaire A. The backend will take car of creating all profile questionnaires whose question has been attempted, or updating existing profile questionnaires with the new progress.

So, one answer, can impact multiple profile questionnaires. If a question is shared among 10 questionnaires, once answered in any of the 10 questionnaires, it will affect the progress of all 10 questionnaires.

Therefore, the POST /answer/ endpoint returns, in the response body, the updated list of all profile_questionnaires and profile_risks impacted by the answer.

Impacted profile risks

As mentioned here, when a questionnaire is completed, a profile risk entity is created. There can be cases such that a user answers a question in Questionnaire A, and Questionnaire B gets completed.

Let's take the same example of Questionnaire A and B each having 10 questions. If a user attempts 9 questions of Questionnaire B, leaving the shared question unanswered, their progress for questionnaire B will be 0.9. Let's say the same user then switches to attempting Questionnaire. A Once they answer the shared question while attempting Questionnaire A, it will result in:

  • Their progress for Questionnaire A getting increased
  • Their progress for Questionnaire B getting to 1.0, i.e. all 10 questions would be answered. This would result in the profile risk entity getting created.

Response of posting an answer

Since posting a single answer can impact multiple profile questionnaires and profile risks, all the impacted profile questionnaire entities and profile risk entities are returned as part of the response in the profile_questionnaires and profile_risks array fields respectively. Therefore, after posting any answer, you can update the stores on the frontend application with the latest profile questionnaires and profile risks received in response, to reflect the latest state of progress on the frontend. Before creating any new profile questionnaire, it should be checked that it is not already existing, otherwise it will result in a validation error.

Example

Let's take a new profile with ID b33078e4-fb56-49f1-9f7f-cbfe0faf4b8f, that hasn't answered any question of any assessment. There won't be any profile questionnaire entity created against that profile to begin with.

The user (profile owner) attempts Bipolar Disorder questionnaire that has questionnaire_id a85a1e95-3e7a-44a0-8847-b5c5145b0756 making a POST request to /service/profiles/profile-questionnaire/` endpoint with payload

{
  "profile_id": "b33078e4-fb56-49f1-9f7f-cbfe0faf4b8f",
  "questionnaire_id": "a85a1e95-3e7a-44a0-8847-b5c5145b0756"
}

Response will be a profile questionnaire entity with 0 progress.

The user is then presented with the first question "Have you ever been diagnosed with asthma?", with two options, "Yes", and "No". The user chooses "No" as their answer, and a POST call is made to the /answer/ endpoint. The response is given below:

{
    "id": "e9d465f3-e44a-45a7-b73c-950bacd4f093",
    "question_id": "4fee7512-9e04-4a10-b262-5cfa39d205ca",
    "profile_id": "b33078e4-fb56-49f1-9f7f-cbfe0faf4b8f",
    "profile_questionnaire_id": null,
    "options": [
        "5beb6b7f-25cf-4cfb-93d2-bc08fa963e32"
    ],
    "response_text": "",
    "profile_questionnaires": [
        {
            "id": "0f0f86ac-67d6-49e3-89ff-c37e6f65eb22",
            "questionnaire_id": "231f7e48-495c-4774-8b5f-91a68258bbfc",
            "profile_id": "b33078e4-fb56-49f1-9f7f-cbfe0faf4b8f",
            "email": "",
            "status": "unsent",
            "answers": [
                {
                    "id": "6df77197-1e9b-44c5-b70b-fe4378aa1429",
                    "question_id": "d58b99f2-204a-4ead-8f02-81442aafa91d",
                    "profile_id": "b33078e4-fb56-49f1-9f7f-cbfe0faf4b8f",
                    "options": [],
                    "response_text": "26",
                    "impact": "increasing",
                    "profile_questionnaire_id": "0f0f86ac-67d6-49e3-89ff-c37e6f65eb22",
                    "is_actionable": false,
                    "is_available": false
                },
                {
                    "id": "93a0d49f-f58d-4026-b1c8-752f5f4e14c2",
                    "question_id": "67b11f3b-2fec-4f7f-925d-f816b3c231e2",
                    "profile_id": "b33078e4-fb56-49f1-9f7f-cbfe0faf4b8f",
                    "options": [],
                    "response_text": "Male",
                    "impact": "decreasing",
                    "profile_questionnaire_id": "0f0f86ac-67d6-49e3-89ff-c37e6f65eb22",
                    "is_actionable": false,
                    "is_available": false
                },
                {
                    "id": "e9d465f3-e44a-45a7-b73c-950bacd4f093",
                    "question_id": "4fee7512-9e04-4a10-b262-5cfa39d205ca",
                    "profile_id": "b33078e4-fb56-49f1-9f7f-cbfe0faf4b8f",
                    "options": [
                        "5beb6b7f-25cf-4cfb-93d2-bc08fa963e32"
                    ],
                    "response_text": "",
                    "impact": "decreasing",
                    "profile_questionnaire_id": "0f0f86ac-67d6-49e3-89ff-c37e6f65eb22",
                    "is_actionable": false,
                    "is_available": true
                }
            ],
            "progress": 0.1,
            "sent_at": null
        },
        {
            "id": "85661f20-5ce1-4ce2-8933-bc971cdb5b6c",
            "questionnaire_id": "2adbef90-442e-4de6-8831-95b12073b25a",
            "profile_id": "b33078e4-fb56-49f1-9f7f-cbfe0faf4b8f",
            "email": "",
            "status": "unsent",
            "answers": [
                {
                    "id": "93a0d49f-f58d-4026-b1c8-752f5f4e14c2",
                    "question_id": "67b11f3b-2fec-4f7f-925d-f816b3c231e2",
                    "profile_id": "b33078e4-fb56-49f1-9f7f-cbfe0faf4b8f",
                    "options": [],
                    "response_text": "Male",
                    "impact": "decreasing",
                    "profile_questionnaire_id": "85661f20-5ce1-4ce2-8933-bc971cdb5b6c",
                    "is_actionable": false,
                    "is_available": false
                },
                {
                    "id": "e9d465f3-e44a-45a7-b73c-950bacd4f093",
                    "question_id": "4fee7512-9e04-4a10-b262-5cfa39d205ca",
                    "profile_id": "b33078e4-fb56-49f1-9f7f-cbfe0faf4b8f",
                    "options": [
                        "5beb6b7f-25cf-4cfb-93d2-bc08fa963e32"
                    ],
                    "response_text": "",
                    "impact": "decreasing",
                    "profile_questionnaire_id": "85661f20-5ce1-4ce2-8933-bc971cdb5b6c",
                    "is_actionable": false,
                    "is_available": true
                }
            ],
            "progress": 0.07692307692307693,
            "sent_at": null
        },
        {
            "id": "feeaa018-4f91-4a02-9a5e-e41ec7f4068c",
            "questionnaire_id": "72858ed6-26b4-4f84-bc6c-9f67ecb2ef23",
            "profile_id": "b33078e4-fb56-49f1-9f7f-cbfe0faf4b8f",
            "email": "",
            "status": "unsent",
            "answers": [
                {
                    "id": "e9d465f3-e44a-45a7-b73c-950bacd4f093",
                    "question_id": "4fee7512-9e04-4a10-b262-5cfa39d205ca",
                    "profile_id": "b33078e4-fb56-49f1-9f7f-cbfe0faf4b8f",
                    "options": [
                        "5beb6b7f-25cf-4cfb-93d2-bc08fa963e32"
                    ],
                    "response_text": "",
                    "impact": "decreasing",
                    "profile_questionnaire_id": "feeaa018-4f91-4a02-9a5e-e41ec7f4068c",
                    "is_actionable": false,
                    "is_available": true
                }
            ],
            "progress": 0.1,
            "sent_at": null
        },
        {
            "id": "f3bdde95-29c6-451b-a43a-771bb5afd58a",
            "questionnaire_id": "97c7e63f-01ec-4a03-ab5d-9c4ab558c271",
            "profile_id": "b33078e4-fb56-49f1-9f7f-cbfe0faf4b8f",
            "email": "",
            "status": "unsent",
            "answers": [
                {
                    "id": "e9d465f3-e44a-45a7-b73c-950bacd4f093",
                    "question_id": "4fee7512-9e04-4a10-b262-5cfa39d205ca",
                    "profile_id": "b33078e4-fb56-49f1-9f7f-cbfe0faf4b8f",
                    "options": [
                        "5beb6b7f-25cf-4cfb-93d2-bc08fa963e32"
                    ],
                    "response_text": "",
                    "impact": "decreasing",
                    "profile_questionnaire_id": "f3bdde95-29c6-451b-a43a-771bb5afd58a",
                    "is_actionable": false,
                    "is_available": true
                }
            ],
            "progress": 0.14285714285714285,
            "sent_at": null
        },
        {
            "id": "5a71a946-f25d-4501-a468-06474b071aac",
            "questionnaire_id": "a85a1e95-3e7a-44a0-8847-b5c5145b0756",
            "profile_id": "b33078e4-fb56-49f1-9f7f-cbfe0faf4b8f",
            "email": "",
            "status": "unsent",
            "answers": [
                {
                    "id": "e9d465f3-e44a-45a7-b73c-950bacd4f093",
                    "question_id": "4fee7512-9e04-4a10-b262-5cfa39d205ca",
                    "profile_id": "b33078e4-fb56-49f1-9f7f-cbfe0faf4b8f",
                    "options": [
                        "5beb6b7f-25cf-4cfb-93d2-bc08fa963e32"
                    ],
                    "response_text": "",
                    "impact": "decreasing",
                    "profile_questionnaire_id": "5a71a946-f25d-4501-a468-06474b071aac",
                    "is_actionable": false,
                    "is_available": true
                }
            ],
            "progress": 0.1,
            "sent_at": null
        },
        {
            "id": "3f8b3c3a-02c7-4ceb-bc5a-321fef34f78d",
            "questionnaire_id": "abc92d14-ce60-4a29-921e-0cf72210335c",
            "profile_id": "b33078e4-fb56-49f1-9f7f-cbfe0faf4b8f",
            "email": "",
            "status": "unsent",
            "answers": [
                {
                    "id": "6df77197-1e9b-44c5-b70b-fe4378aa1429",
                    "question_id": "d58b99f2-204a-4ead-8f02-81442aafa91d",
                    "profile_id": "b33078e4-fb56-49f1-9f7f-cbfe0faf4b8f",
                    "options": [],
                    "response_text": "26",
                    "impact": "decreasing",
                    "profile_questionnaire_id": "3f8b3c3a-02c7-4ceb-bc5a-321fef34f78d",
                    "is_actionable": false,
                    "is_available": false
                },
                {
                    "id": "93a0d49f-f58d-4026-b1c8-752f5f4e14c2",
                    "question_id": "67b11f3b-2fec-4f7f-925d-f816b3c231e2",
                    "profile_id": "b33078e4-fb56-49f1-9f7f-cbfe0faf4b8f",
                    "options": [],
                    "response_text": "Male",
                    "impact": "increasing",
                    "profile_questionnaire_id": "3f8b3c3a-02c7-4ceb-bc5a-321fef34f78d",
                    "is_actionable": false,
                    "is_available": false
                },
                {
                    "id": "e9d465f3-e44a-45a7-b73c-950bacd4f093",
                    "question_id": "4fee7512-9e04-4a10-b262-5cfa39d205ca",
                    "profile_id": "b33078e4-fb56-49f1-9f7f-cbfe0faf4b8f",
                    "options": [
                        "5beb6b7f-25cf-4cfb-93d2-bc08fa963e32"
                    ],
                    "response_text": "",
                    "impact": "decreasing",
                    "profile_questionnaire_id": "3f8b3c3a-02c7-4ceb-bc5a-321fef34f78d",
                    "is_actionable": false,
                    "is_available": true
                }
            ],
            "progress": 0.14285714285714285,
            "sent_at": null
        }
    ],
    "profile_risks": []
}

profile_questionnaires

The profile_questionnaires field contains a list of 6 entities, meaning that POSTing the answer resulted in 5 new profile questionnaires being created, and the current profile questionnaire of Bipolar Disorder being updated, because the asthma question was shared among 6 different questionnaires (including the Bipolar Disorder questionnaire). You can see how the progress of each profile questionnaire varies, depending upon the total number of questions that the questionnaires have.

Let's pick the first profile_questionnaire from the profile_questionnaires field in the response above and examine it in detail:

        {
            "id": "0f0f86ac-67d6-49e3-89ff-c37e6f65eb22",
            "questionnaire_id": "231f7e48-495c-4774-8b5f-91a68258bbfc",
            "profile_id": "b33078e4-fb56-49f1-9f7f-cbfe0faf4b8f",
            "email": "",
            "status": "unsent",
            "answers": [
                {
                    "id": "6df77197-1e9b-44c5-b70b-fe4378aa1429",
                    "question_id": "d58b99f2-204a-4ead-8f02-81442aafa91d",
                    "profile_id": "b33078e4-fb56-49f1-9f7f-cbfe0faf4b8f",
                    "options": [],
                    "response_text": "26",
                    "impact": "increasing",
                    "profile_questionnaire_id": "0f0f86ac-67d6-49e3-89ff-c37e6f65eb22",
                    "is_actionable": false,
                    "is_available": false
                },
                {
                    "id": "93a0d49f-f58d-4026-b1c8-752f5f4e14c2",
                    "question_id": "67b11f3b-2fec-4f7f-925d-f816b3c231e2",
                    "profile_id": "b33078e4-fb56-49f1-9f7f-cbfe0faf4b8f",
                    "options": [],
                    "response_text": "Male",
                    "impact": "decreasing",
                    "profile_questionnaire_id": "0f0f86ac-67d6-49e3-89ff-c37e6f65eb22",
                    "is_actionable": false,
                    "is_available": false
                },
                {
                    "id": "e9d465f3-e44a-45a7-b73c-950bacd4f093",
                    "question_id": "4fee7512-9e04-4a10-b262-5cfa39d205ca",
                    "profile_id": "b33078e4-fb56-49f1-9f7f-cbfe0faf4b8f",
                    "options": [
                        "5beb6b7f-25cf-4cfb-93d2-bc08fa963e32"
                    ],
                    "response_text": "",
                    "impact": "decreasing",
                    "profile_questionnaire_id": "0f0f86ac-67d6-49e3-89ff-c37e6f65eb22",
                    "is_actionable": false,
                    "is_available": true
                }
            ],
            "progress": 0.1,
            "sent_at": null
        },

The answers field contains an array of user answers, with each answer showing the selected options, response text, and impact that the answer is having on the risk.

It contains 3 answers, the 1st one having response text "26", the 2nd one having response text "Male", and the 3rd one is the answer to the asthma question that was posted. Where do the first two answers come from, when we never explicitly answered them?

Inferred answers

These answers can be referred to as inferred answers, because they are inferred from the user's profile and never explicitly asked from the users, i.e. they are not returned in the available-questions endpoint. The first answer is to the "Age" question, which is inferred from the profile's birth date. The 2nd answer is the answer to the "Sex" question, which is inferred from the profile's sex, and auto-populated in the backend. Whenever a profile questionnaire is created or updated after posting an answer the inferred answers are created on their own. There are a total of 4 inferred answer types:

  • age
  • sex
  • ethnicity
  • BMI (it is calculated using the profile's weight and height)

Inferred answers are created only if any of the above questions are part of a questionnaire. The questionnaire associated with the single profile questionnaire entity given above had age and sex questions, and not ethnicity or BMI questions. Hence the inferred answers for age and sex questions were auto-computed and returned, while they were not computed for ethnicity and BMI questions.

profile_risks

The returned profile_risks field is empty, because no assessment was completed as a result of answering this question. For details of what it would comprise of if returned, refer to the Profile Risk entity.