Skip to content
This repository has been archived by the owner on Oct 7, 2022. It is now read-only.
pwhitebe edited this page Apr 5, 2021 · 9 revisions

Customizing the COVID-19 Self-Checker

The information provided in this wiki shows how to customize the outcome message in the core protocol, as well as leverage the core protocol conversation data in a wrapping scenario.

The customizations described below do not require making changes to the Core Protocol scenario, but will involve a modification to a wrapping scenario.

Adding a custom message to the outcome messages in the Core Protocol

The Core Protocol scenario accepts a variable called custom_outcome_message. You can use this variable to add a custom message that will appear below each of the Core Protocol scenario outcomes.

You can set the value of this variable in a wrapping scenario and pass it through to the Core Protocol by specifying it in the element the wrapper scenario uses to start the Core Protocol scenario.

Preventing outcome messages from displaying in the Core Protocol

The Core Protocol scenario accepts a variable called show_core_message. This variable is used to tell the Core Protocol whether or not is should show the final message. If it is set to false, then the final message will not be shown in the Core Protocol. If it is set to true, then the final message will be shown in the Core Protocol.

This variable is useful if you need to modify the outcome message content more than what the custom_outcome_message allows. See the next section for using Core Protocol outcomes in a wrapping scenario.

You can set the value of this variable in a wrapping scenario and pass it through to the Core Protocol by specifying it in the element the wrapper scenario uses to start the Core Protocol scenario.

Using the Core Protocol outcomes in a wrapping scenario

The Core Protocol scenario provides a global conversation variable called core_outcome. This variable is a JavaScript object with the following structure:

core_outcome: {
  core_scenario_data = {
    is_ill: Object,
    who_for: Object,
    age: Object,
    gender: Object,
    transgender: Object,
    latinx: Object,
    ethnicity: Array,
    life_threat: Object,
    cov19_contact: Object,
    cov_test_result: Object,
    symptom_severity: Object,
    covid_symptoms: Array,
    comorbidity: Array,
    nursing_home: Object,
    healthcare_facility: Object,
    ped_nursing_home: Object,
    school_dorm_daycare: Object,
    ppe: Object,
    close_contact: Object,
    covid_other_symptoms: Object,
    ed_symptoms: Object,
    _911_symptoms: Object,
    breathing_symptoms: Object
 },
  core_scenario_outcomes: Array //list of messages shown to user
}

Each of the properties in the core_outcome.core_scenario_data object relate to a question in the Core Protocol. Within those objects, the users answer is stored for the related question.

The core_outcome.core_scenario_outcomes array contains the message IDs that the user saw at the end of the scenario. These message IDs match the keys in the scenario.messages variable.

To be able to use this variable in the wrapping scenario, the wrapping scenario must use a ‘Begin’ scenario node when triggering the Core Protocol scenario.

After you create the ‘Begin’ scenario node, you will be able to connect new elements to it. The elements that come after the ‘Begin’ will start after the Core Protocol scenario has completed. These elements have access to the core_outcome variable. The core_outcome variable can be accessed by using conversation.core_outcome. Below is an example of accessing the Core Protocol outcome message id and using that information to retrieve the message from the scenario.messages variable. You could use this statement in a wrapping scenario block that accepts a JavaScript expression.

scenario.messages[conversation.core_outcome.core_scenario_outcomes[0]]

Reporting indexes for multi-select items like covid-symptoms and comorbidities within the bot-code

In the core scenarios, reporting indexes are assigned to symptoms and comorbidities and other things that may show up as a list. Because guidance shifts as time goes on, the order of these list items may change, and some might be removed. The reporting indexes are never removed, and are independent of ordering from version to version.

Please note that the ordering set up in the "list builder" step of bot code is not the reporting index, and that the list items chosen are assigned their reporting index in the outcome section of any given bot.

Adult core reporting index assignment

 covid_symptoms: scenario.covid_symptoms
        ? scenario.covid_symptoms.map(sym => ({ index: scenario.symptom_lists.COV_symptoms.indices[sym.index], entity: sym.entity }))
        : null,
    comorbidity: scenario.risk_factors
        ? scenario.risk_factors.map(risk => ({ index: scenario.symptom_lists.comorbidity.indices[risk.index], entity: risk.entity }))
        : null,

Pediatric core reporting index assignment

covid_symptoms: scenario.covid_symptoms
        ? scenario.covid_symptoms.map(sym => ({ index: scenario.symptom_lists.ped_COV_symptoms.indices[sym.index], entity: sym.entity }))
        : null,
    comorbidity: scenario.risk_factors
        ? scenario.risk_factors.map(risk => ({ index: scenario.symptom_lists.ped_comorbidity.indices[risk.index], entity: risk.entity }))
        : null,