Entities

Entities and their attributes of concern are discussed here.

Before we deep dive into the API endpoints, we need to be clear of some entities associated with this feature.

Please note that the API endpoints discussed in the following pages return extra attributes associated with these entities. Those extra attributes can be ignored, and for the lifestyle analyzer feature, you're only supposed to be concerned with the attributes discussed in this page against each entity.

Lifestyle Assessment

As discussed earlier, for each disorder, there is a unique lifestyle assessment. A lifestyle assessment is the core entity of this feature that comprises of the following attributes:

AttributeDescription
idID of the assessment
questionnaire_idID of linked questionnaire that users would be attempting
areasAreas of the body that the assessment is concerned with
disease_nameThe disease or trait whose risk the assessment determines
capitalize_disease_nameThere are some diseases whose initial letter of the name is supposed to be capitalized, like H. pylori. The value of this field will be true for such assessments, and will be false for the rest.
durationEstimated time in minutes to complete an assessment.
activeThis will always be true as we return only active assessments via the API.
show_to_sexIt has three possible values, "all", "male", and "female".
related_report_idsIDs of related DNA wellness reports. To fetch further details of the related reports, refer to Reports Service API
about_textRich text field containing detailed explanation of the disease / condition under consideration
disclaimerText field like "This assessment is not diagnostic of bipolar disorder"

Questionnaire

There is strictly one-to-one mapping between a questionnaire and a lifestyle assessment. A questionnaire comprises of:

AttributeDescription
idUnique ID of the questionnaire
list of questionsThere is a many to many relationship between questions and questionnaires, meaning questions are shared across multiple questionnaires. For more details regarding the question entity, refer to the sub-section below

Question

A question comprises of:

AttributeDescription
idUnique ID of the question
question_typeThere are multiple types of questions, but as far as lifestyle assessments are concerned, we'll mainly be dealing with three types:

- "standard": most questions have standard type. Standard questions are like multiple choice questions, allowing users to pick one or more options as their answer.
- "weight" and "height": these are special question types, specifically for just one question each in our database. They expect a free response answer, i.e. text input from a user. More details about these question types and how to answer them are discussed later.
question_textA rich text field containing the main question text.
answer_typeThere are multiple answer types, but for lifestyle assessments, we'll mainly be concerned with three:

- "single choice": out of the given options, user is allowed to pick only one option. Selecting multiple options would result in a validation error.
- "multiple choices": the question accepts multiple options as an answer
- "free response": the question accepts text input. Weight and height question types have this answer type. Rest of the questions for lifestyle assessments either have single choice or multiple choices answer type.
answer_optionsRefer to the sub-section below for details

Answer options

There is a one to many relationship between a question and its answer options (choices). Each answer option comprises of

AttributeDescription
idID of the option
option_textText of the option
orderOrder in which the options are supposed to be displayed within a question

Profile Questionnaire

It is a relationship entity between a profile and a questionnaire. There is a profile questionnaire entity created for each questionnaire that a user has attempted. If a user has attempted 50 questionnaires, there will be 50 profile questionnaires against their profile.

It comprises of the following attributes:

AttributeDescription
idUnique ID of the profile questionnaire
questionnaire_idID of the linked questionnaire
profile_idID of the linked profile that attempted this questionnaire
progressA float value between 0.0 (no question of the questionnaire has been answered) and 1.0 (questionnaire is completed).
answersFor details, refer to the subsection below

Profile Questionnaire Answer

Each answer is associated with a single question, and with a profile of the user that answered the question, and is stored in the context of a particular profile questionnaire. Attributes are as follows:

AttributeDescription
idID of the answer
question_idID of the question that the answer is associated with
profile_idID of the profile of the user that attempted the question
profile_questionnaire_idID of the profile questionnaire that in context of which this answer is stored.
optionsArray of option IDs that were chosen as an answer to the question. The array would contain only one option if the answer type of the linked question is "single choice". If the answer type is "multiple choices", it can contain more than one option. It will always contain at least one option.
response_textThis field is non-empty only for answers of weight and height question types, that have free response answer type.
impactThis field indicates the impact that this answer is having on the overall risk of the disorder that is associated with the profile questionnaire. Remember, an answer is linked with a profile questionnaire, which is linked with a questionnaire, which is further linked with a lifestyle assessment, and each lifestyle assessment maps strictly to one disorder. This field has three possible values:

- decreasing
- increasing
- no impact

Why are answers stored in context of profile questionnaires (optional read)

As discussed above, a single question can belong to multiple questionnaires. The user's answer to that questionnaire may have a different impact on each questionnaire. Let's say a question is shared between two questionnaires, Questionnaire A and Questionnaire B. The user's answer to that question may be decreasing the risk of the disorder associated with Questionnaire A, while increasing the risk of the disorder associated with Questionnaire B. It would be a single answer, but stored in a denormalised manner, against both Profile Questionnaire A, with decreasing impact, and Profile Questionnaire B, with increasing impact.

Profile Risk

Once an assessment is completed by a user, i.e. when a user answers all required questions in an assessment, their risk relative to the population, of the disorder that the assessment is associated with, is computed based on those answers. A relationship entity, containing score details, between the profile and the lifestyle assessment is stored. Attributes are given below:

AttributeDescription
idID of the profile risk
profile_idID of the profile that attempted the assessment
risk_idID of the lifestyle assessment that was attempted
range_labelLabel of the range in which the user's risk score lies in
range_colorColor of the range in which the user's risk score lies in
range_textText explaining the range in which the user's risk score lies in
gauge_percentA float percentage value that can be used if you want to represent the risk in a gauge. The value determines what percentage of the gauge that should be filled to portray the risk.

The fields with prefix "range" indicate information about the user's risk score. For simplicity, the risk score is categorised into one of the five categories, aka ranges, given in the below table. Value combinations for range_label, range_color range_text and gauge_percent for each category are listed.

range_labelrange_textrange_colorgauge_percent
Reduced riskYou have a reduced riskGreen10
Slightly reduced riskYou have a slightly reduced riskLight Green30
Average riskYou have an average riskYellow50
Slightly increased riskYou have a slightly increased riskOrange70
Increased riskYou have an increased riskRed90

For visualisation, a gauge_percent value of 50.0 would result in a gauge like this: