google / android-fhir

The Android FHIR SDK is a set of Kotlin libraries for building offline-capable, mobile-first healthcare applications using the HL7® FHIR® standard on Android.
https://google.github.io/android-fhir/
Apache License 2.0
499 stars 296 forks source link

Add support for open-choice answerFormats in Questionnaire #689

Closed fredhersch closed 3 years ago

fredhersch commented 3 years ago

Is your feature request related to a problem? Please describe. Current SDC library does not support open-choice option

Describe the solution you'd like Able to provide open-choice as an item type. Specifying this will then implement the behaviour as per the specification

Additional context Here is a sample Questionnaire that uses open-choice options - https://openhie.github.io/case-reporting-hiv-vn/Questionnaire-hiv-case-report-questionnaire.json.html

There are two scenarios to support:

1. No list to select from: There are no choices to select from and open-choice just provides a text box and the answer is stored as a String

{ 
"linkId" : "confirming_lab",
 "text" : "Confirming lab", 
"type" : "open-choice", 
"repeats" : false 
},
  1. When there is an answerValueSet (or answerOptions) specified open-choice renders a selection list (e.g. a drop-down) with an 'other' option which is selected then shows a text box to be populated e.g here: there would be a list of occupations and an other option
    { "linkId" : "occupation", 
    "text" : "Occupation", 
    "type" : "open-choice", 
    "repeats" : false, 
    "answerValueSet" : "http://openhie.org/fhir/openhie.vn.case-reporting.hiv/ValueSet/vs-hiv-occupation"
    }

Ux designs

For option 1, this should just display a text field

For option 2, this should be a single choice set of options (drop down list or if repeats is true a set of checkboxes with an 'other' option.

Here are two designs:

  1. The first shows a drop-down list with Other as the option

Drop down list for open-choice

  1. The second is a set of check-boxes with other option

checkboxes with other for open-choice

fredhersch commented 3 years ago

@jingtang10 @Tarun-Bhardwaj for triaging

fredhersch commented 3 years ago

Decision to implement as per the current spec:

"Answer is a Coding drawn from a list of possible answers (as with the choice type) or a free-text entry in a string (valueCoding or valueString)."

  1. Use autoComplete widget that can allow for free-text entry (if not selected from the list)
  2. If option is selected, use valueCoding, if free-text then valueString

Will explore adding a default valueCoding system to the extension and then treating free-text options as valueCoding. @costateixeira to propose to SDC group

cc: @jingtang10, costateixeira