Skip to content
Tarun-Bhardwaj edited this page Sep 21, 2021 · 1 revision

>>>>> gd2md-html alert: ERRORs: 0; WARNINGs: 1; ALERTS: 0.

  • See top comment block for details on ERRORs and WARNINGs.
  • In the converted Markdown or HTML, search for inline alerts that start with >>>>> gd2md-html alert: for specific instances that need correction.

Links to alert messages:

>>>>> PLEASE check and correct alert issues and delete this message and the inline alerts.


Android FHIR SDK Data Capture API

Beta release

Last updated: August 2021

This document tracks the support for the SDC Specification implemented within the SDK (data-capture library) over time. In addition we can use this to prioritise and work on examples using the SDC Library that can be added to the wiki.

Using the library

  • Create a Questionnaire UI
    • Pre-fill
    • Example controls
    • Pagination
  • Collect a questionnaire response
    • Show field level validations (displaying error messages)
    • Optionally running validation on submission (validation API WIP)
    • Get QuestionnaireResponse from the library
  • (Optional) Extract responses to FHIR resources
    • DefinitionBased
    • StructureMap

FHIR Questionnaire

Questionnaire item support

The following table summarizes the support for the key fields in the questionnaire item element (see http://build.fhir.org/questionnaire.html for details).

Support Notes
linkId -
definition yes See definition-based extraction
code no
prefix yes
text yes
type yes See next section
enableWhen yes
enableBehavior yes
disabledDisplay no
required yes
repeats yes
readOnly no See open issue <>
maxLength yes
answerConstraint no
answerValueSet WIP
answerOption yes
initial yes
item yes Nested items

Questionnaire item type support

The following table summarizes the library's support for questionnaire item types (see https://www.hl7.org/fhir/valueset-item-type.html for the value set expansion). To use these types, populate the type field within the questionnaire item.

Item type Support Notes
Group yes
Display yes
Question yes See sub-types below
Boolean yes
Decimal yes
Integer yes
Date yes
Date time yes
Time no
String yes Rendered as single-line text box
Text yes Rendered as multi-line text box
Url no
Choice yes
Open Choice no See open issue <>
Attachment no
Reference no Rarely rendered as an actual widget
Quantity yes

SDC Extensions

Questionnaire item control support

Amongst SDC advanced rendering extensions (see http://build.fhir.org/ig/HL7/sdc/rendering.html), we provide limited support for itemControl extensions (see http://hl7.org/fhir/R4/valueset-questionnaire-item-control.html and https://build.fhir.org/codesystem-questionnaire-item-control.html for the value set expansion) which allows for the selection of a specific control widget for questionnaire items. See example usage: http://build.fhir.org/ig/HL7/sdc/examples.html#itemControl. Please note that item controls are only compatible with certain questionnaire item types (e.g. drop down item control cannot be applied to boolean type questions). This is listed in the Compatible item type column in the following table. Unsupported item controls are omitted in the table below.

Item control Compatible item type Notes
Page Group
Auto-complete Choice Filter-forward based on inlined answerOptions
Drop down Choice Default for 4 or more answer options
Check-box Choice Default for repeat answers
Radio Button Choice Default for less than 4 answer options
Slider Integer WIP

Value constraint support

The library supports the following value constraints which limit the allowed values for answers. See http://build.fhir.org/ig/HL7/sdc/behavior.html#value-constraints for more details and example usage.

Value constraint Support Notes
maxLength yes Support for string inputs. This is a core element in Questionnaire.
minLength yes Support for string inputs
regex yes
minValue yes
maxValue yes
minQuantity no
maxQuantity no
maxDecimalPlaces no
mimeType no
maxSize no

Choice Restriction support

See http://build.fhir.org/ig/HL7/sdc/behavior.html#choice-restriction

Choice restriction Support Notes
answerOption yes
answerValueSet WIP Working on contains and reference to ValueSet resource (add issues)
answerExpression no
required yes Core element in Questionnaire
repeats yes Core element in Questionnaire
readOnly WIP Core element in Questionnaire
minOccurs no
maxOccurs no
optionExclusive no
unitOption no
unitValueSet No
referenceResource no
referenceProfile no
candidateExpression no
lookupQuestionnaire no

Other extensions

  • Hidden / WIP
  • choice orientation (for itemLayout) / WIP
  • entryFormat / No
  • optionPrefix / No

Extraction/Population

The SDC library provides support for data extraction (transforming questionnaire responses to FHIR resources, see http://build.fhir.org/ig/HL7/sdc/extraction.html) and questionnaire population (transforming FHIR resources to questionnaire responses for prefilling questionnaires, see http://build.fhir.org/ig/HL7/sdc/populate.html).

There are three questionnaire population mechanisms: Observation-based population, Expression-based population, and StructureMap-based population. There are three corresponding data extraction mechanisms that are the reverse processes of the population mechanisms: Observation-based extraction, Definition-based extraction, and StructureMap-based extraction. The following table lists the corresponding population/extraction mechanisms on the same row and indicates the library's support.

Population mechanism Extraction mechanism Support
Observation-based population Observation-based extraction no
Expression-based population Definition-based extraction yes
StructureMap-based population StructureMap-based extraction yes (StructureMap-based population population planned)

To use population/extraction, see the ResourceMapper class in the com.google.android.fhir.datacapture.mapping package and the test cases.

Other relevant features

Feature/Extensions Notes
Prefill questionnaire Provide an optional questionnaire response to the library in order to pre-fill the questionnaire in the UI. This is normally used together with questionnaire population.
Language extension support Provide translations for questionnaires
Custom widgets Implement custom widgets for specific questionnaire items (e.g. bar code widget) that are not supported by the library, or to override the default widget provided by the library
Validator API (WIP) Validate a QuestionnaireResponse conforms to the Questionnaire it is linked to