as String Value
- Returns the string representation of a PrimitiveType.
If the type isn't a [PrimitiveType], an empty string is returned.
Returns the string representation of a PrimitiveType.
If the type isn't a [PrimitiveType], an empty string is returned.
Returns a QuestionnaireItemViewHolderDelegate that handles the initialization of views and binding of items in RecyclerView.
Returns a QuestionnaireItemViewHolderDelegate that handles the initialization of views and binding of items in RecyclerView.
Returns a list of pair of item and the calculated and evaluated value for all items with calculated expression extension, which is dependent on value of updated response
Evaluates an expression and returns its result.
Expressions can be defined at questionnaire level and questionnaire item level. This ExpressionEvaluator supports evaluation of variable expression defined at either questionnaire level or questionnaire item level.
Returns a list of pair of item and the calculated and evaluated value for all items with calculated expression extension, which is dependent on value of updated response
Extract FHIR resources from a questionnaire and questionnaireResponse.
This method will perform StructureMap-based extraction if the Questionnaire specified by questionnaire includes a targetStructureMap
extension. In this case structureMapExtractionContext is required; extraction will fail and an empty Bundle is returned if structureMapExtractionContext is not provided.
Otherwise, this method will perform Definition-based extraction .
Bundle containing the extracted Resources or empty Bundle if the extraction fails. An exception might also be thrown in a few cases
A Questionnaire with data extraction extensions.
A QuestionnaireResponse with answers for questionnaire.
The IWorkerContext may be used along with StructureMapUtilities to parse the script and convert it into StructureMap.
Maps a QuestionnaireResponse to FHIR resources and vice versa.
The process of converting QuestionnaireResponse s to other FHIR resources is called extraction. The reverse process of converting existing FHIR resources to QuestionnaireResponse s to be used to pre-fill the UI is called population.
This class supports Definition-based extraction , StructureMap-based extraction , and expression-based population .
See the developer guide for more information.
Extract FHIR resources from a questionnaire and questionnaireResponse.
Performs Expression-based population and returns a QuestionnaireResponse for the questionnaire that is populated from the resources.
Performs Expression-based population and returns a QuestionnaireResponse for the questionnaire that is populated from the resources.
The application context.
Data used during StructureMap-based extraction.
A lambda function which returns a StructureMap. Depending on your app this could be hard-coded or use the String parameter to fetch the appropriate structure map.
A lambda function which returns a StructureMap. Depending on your app this could be hard-coded or use the String parameter to fetch the appropriate structure map.
Optionally pass a custom version of StructureMapUtilities.ITransformerServices to support specific use cases.
Maps a QuestionnaireResponse to FHIR resources and vice versa.
Data used during StructureMap-based extraction.
Checks that the QuestionnaireResponse is structurally consistent with the Questionnaire.
Each item in the QuestionnaireResponse must have a corresponding item in the Questionnaire with the same linkId
and type
The order of items in the QuestionnaireResponse must be the same as the order of the items in the Questionnaire
Items nested under group and items nested under answer should follow the same rules recursively
Note that although all the items in the Questionnaire SHOULD be included in the QuestionnaireResponse, we do not throw an exception for missing items. This allows the QuestionnaireResponse to not include items that are not enabled due to enableWhen
.
if multiple answers are provided for a non-repeat questionnaire item
See http://www.hl7.org/fhir/questionnaireresponse.html#link for more information.
Checks that the QuestionnaireResponse is structurally consistent with the Questionnaire.
Validates QuestionnaireResponse using the constraints defined in the Questionnaire.
Validates QuestionnaireResponse using the constraints defined in the Questionnaire.
Each item in the QuestionnaireResponse must have a corresponding item in the Questionnaire with the same linkId
and type
The order of items in the QuestionnaireResponse must be the same as the order of the items in the Questionnaire
Items nested under group and items nested under answer should follow the same rules recursively
Note that although all the items in the Questionnaire SHOULD be included in the QuestionnaireResponse, we do not throw an exception for missing items. This allows the QuestionnaireResponse to not include items that are not enabled due to enableWhen
.
a maplinkIdToValidationResultMap of linkIds to list of ValidationResult
if multiple answers are provided for a non-repeat questionnaire item
See http://www.hl7.org/fhir/questionnaireresponse.html#link for more information.
Int value for the desired margin used as item offset
ItemDecoration that applies a specified margin to the items. Use this instead of manually adding a margin to the item's layout.
Int value for the desired margin used as item offset
Binds a QuestionnaireItemViewItem to the view.
Displays validation messages on the view.
Binds a QuestionnaireItemViewItem to the view.
Displays validation messages on the view.
Initializes the view in QuestionnaireItemViewHolder. Any listeners to record user input should be set in this function.
Sets view read only if isReadOnly is true.
Initializes the view in QuestionnaireItemViewHolder. Any listeners to record user input should be set in this function.
Sets view read only if isReadOnly is true.
Binds a QuestionnaireItemViewItem to the view.
Displays validation messages on the view.
Delegate for QuestionnaireItemViewHolder.
This interface provides an abstraction of the operations that need to be implemented for a type of view in the questionnaire.
There is a 1:1 relationship between this and QuestionnaireItemViewHolder. In other words, there is a unique QuestionnaireItemViewHolderDelegate for each QuestionnaireItemViewHolder. This is critical for the correctness of the recycler view.
Binds a QuestionnaireItemViewItem to the view.
Displays validation messages on the view.
Initializes the view in QuestionnaireItemViewHolder. Any listeners to record user input should be set in this function.
Sets view read only if isReadOnly is true.
Initializes the view in QuestionnaireItemViewHolder. Any listeners to record user input should be set in this function.
Sets view read only if isReadOnly is true.
the layout resource for the view
Returns a QuestionnaireItemViewHolderDelegate that handles the initialization of views and binding of items in RecyclerView.
Factory for QuestionnaireItemViewHolder.
the layout resource for the view
Returns a QuestionnaireItemViewHolderDelegate that handles the initialization of views and binding of items in RecyclerView.
The RecyclerView.ViewHolder for QuestionnaireItemViewItem.
This is used by QuestionnaireItemAdapter to initialize views and bind items in RecyclerView.
the Questionnaire.QuestionnaireItemComponent in the Questionnaire
the QuestionnaireResponse.QuestionnaireResponseItemComponent in the QuestionnaireResponse
the ValidationResult of the answer(s) against the questionnaireItem
the callback to notify the view model that the answers have been changed for the QuestionnaireResponse.QuestionnaireResponseItemComponent
the callback to resolve the answer value set and return the answer
the callback to resolve answer options when answer-expression extension exists options
A read-only list of answers to be rendered in the view.
The view should call the APIs provided in this class (setAnswer, addAnswer, removeAnswer and clearAnswer) to modify the answers. This is to make sure any updates to the answers are propagated to the view model and a subsequent UI refresh will be triggered (e.g. in case the enablement status or validation results of this or other questions are affected).
This is a deep copy of the answers in the QuestionnaireResponse.QuestionnaireResponseItemComponent so that proper comparisons can be carried out for the RecyclerView.Adapter to decide which items need to be updated.
Clears existing answers.
Data item for QuestionnaireItemViewHolder in RecyclerView.
The view should use questionnaireItem, answers, answerOption, and validationResult to render the data item in the UI. The view SHOULD NOT mutate the data using these properties.
The view should use the following answer APIs to update the answer(s):
setAnswer (for single and repeated answers)
clearAnswer (for single and repeated answers)
addAnswer (for repeated answers only)
removeAnswer (for repeated answers only)
Updates to the answers using these APIs will invoke answersChangedCallback to notify the view model that the answer(s) have been changed. This will trigger a re-render of the RecyclerView UI.
the Questionnaire.QuestionnaireItemComponent in the Questionnaire
the QuestionnaireResponse.QuestionnaireResponseItemComponent in the QuestionnaireResponse
the ValidationResult of the answer(s) against the questionnaireItem
the callback to notify the view model that the answers have been changed for the QuestionnaireResponse.QuestionnaireResponseItemComponent
the callback to resolve the answer value set and return the answer
the callback to resolve answer options when answer-expression extension exists options
Clears existing answers.
Updates the answers. This will override any existing answers.
ItemDecoration that applies a specified margin to the items. Use this instead of manually adding a margin to the item's layout.
Represents selectable options in the multi-select page.
The RecyclerView.ViewHolder for QuestionnaireItemViewItem.
Delegate for QuestionnaireItemViewHolder.
Factory for QuestionnaireItemViewHolder.
Data item for QuestionnaireItemViewHolder in RecyclerView.
Returns the AppCompatActivity if there exists one wrapped inside ContextThemeWrapper s, or null
otherwise.
Returns the AppCompatActivity if there exists one wrapped inside ContextThemeWrapper s, or null
otherwise.
This function is inspired by the function with the same name in AppCompateDelegateImpl
. See https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:appcompat/appcompat/src/main/java/androidx/appcompat/app/AppCompatDelegateImpl.java;l=1615
TODO: find a more robust way to do this as it is not guaranteed that the activity is an AppCompatActivity.
A class that can provide the DataCaptureConfig for the Structured Data Capture Library. To do this, implement the DataCaptureConfig.Provider interface on your Application class. You should provide the same configuration throughout the lifecycle of your application. The library may cache the configuration and different configurations will be ignored.
The App developers may provide the DataCaptureConfig for the DataCapture library by implementing Provider interface in the Application class. The library would load and cache the configuration by calling Provider.getDataCaptureConfig.
NOTE: App developers should make sure that Provider.getDataCaptureConfig provides a constant DataCaptureConfig throughout the lifecycle of the application.
A class that can provide the DataCaptureConfig for the Structured Data Capture Library. To do this, implement the DataCaptureConfig.Provider interface on your Application class. You should provide the same configuration throughout the lifecycle of your application. The library may cache the configuration and different configurations will be ignored.
An ExternalAnswerValueSetResolver may be set to provide answer options dynamically for choice
and open-choice
type questions.
A NpmPackage may be set by the client for Structure-Map based Resource Extraction.
The loading and extraction of a NpmPackage may take multiple seconds, so the client app should try to include the smallest NpmPackage possible that contains only the resources needed by StructureMaps used by the client app.
An ExternalAnswerValueSetResolver may be set to provide answer options dynamically for choice
and open-choice
type questions.
Resolves external answer value sets not defined in the questionnaire's contained
element. This allows the library to render answer options to choice
and open-choice
type questions more dynamically.
NOTE: The result of the resolution may be cached to improve performance. In other words, the resolver may be called only once after which the same answer value set may be used multiple times in the UI to populate answer options.
A Boolean extra to control if a review page is shown. By default it will be shown at the end of the questionnaire.
A JSON encoded string extra for a questionnaire. This should only be used for questionnaires with size at most 512KB. For large questionnaires, use EXTRA_QUESTIONNAIRE_JSON_URI.
This is required unless EXTRA_QUESTIONNAIRE_JSON_URI is provided.
If this and EXTRA_QUESTIONNAIRE_JSON_URI are provided, EXTRA_QUESTIONNAIRE_JSON_URI takes precedence.
A android.net.Uri extra for streaming a JSON encoded questionnaire.
This is required unless EXTRA_QUESTIONNAIRE_JSON_STRING is provided.
If this and EXTRA_QUESTIONNAIRE_JSON_STRING are provided, this extra takes precedence.
A JSON encoded string extra for a prefilled questionnaire response. This should only be used for questionnaire response with size at most 512KB. For large questionnaire response, use EXTRA_QUESTIONNAIRE_RESPONSE_JSON_URI.
If this and EXTRA_QUESTIONNAIRE_RESPONSE_JSON_URI are provided, EXTRA_QUESTIONNAIRE_RESPONSE_JSON_URI takes precedence.
A android.net.Uri extra for streaming a JSON encoded questionnaire response.
If this and EXTRA_QUESTIONNAIRE_RESPONSE_JSON_STRING are provided, this extra takes precedence.
An Boolean extra to control if the review page is to be opened first. This has no effect if review page is not enabled.
Extras that can be passed to QuestionnaireFragment to define its behavior. When you create a QuestionnaireFragment, one of EXTRA_QUESTIONNAIRE_JSON_URI or EXTRA_QUESTIONNAIRE_JSON_STRING is required.
A Boolean extra to control if a review page is shown. By default it will be shown at the end of the questionnaire.
A JSON encoded string extra for a questionnaire. This should only be used for questionnaires with size at most 512KB. For large questionnaires, use EXTRA_QUESTIONNAIRE_JSON_URI.
A JSON encoded string extra for a prefilled questionnaire response. This should only be used for questionnaire response with size at most 512KB. For large questionnaire response, use EXTRA_QUESTIONNAIRE_RESPONSE_JSON_URI.
An Boolean extra to control if the review page is to be opened first. This has no effect if review page is not enabled.
The custom QuestionnaireItemViewHolderFactory to use.
Data class that holds a matcher function (matches) which evaluates whether a given factory should be used to display a given Questionnaire.QuestionnaireItemComponent.
See the developer guide for more information.
The custom QuestionnaireItemViewHolderFactory to use.
Override this method to specify when custom questionnaire components should be used. It should return a List of QuestionnaireItemViewHolderFactoryMatchers which are used to evaluate whether a custom QuestionnaireItemViewHolderFactory should be used to render a given questionnaire item.
User-provided custom views take precedence over canonical views provided by the library. If multiple QuestionnaireItemViewHolderFactoryMatcher are applicable for the same item, the behavior is undefined (any of them may be selected).
See the developer guide for more information.
Returns a org.hl7.fhir.r4.model.QuestionnaireResponse populated with any answers that are present on the rendered QuestionnaireFragment when it is called.
A Fragment for displaying FHIR Questionnaires and getting user responses as FHIR QuestionnareResponses.
For more information, see the QuestionnaireFragment developer guide.
Extras that can be passed to QuestionnaireFragment to define its behavior. When you create a QuestionnaireFragment, one of EXTRA_QUESTIONNAIRE_JSON_URI or EXTRA_QUESTIONNAIRE_JSON_STRING is required.
Override this method to specify when custom questionnaire components should be used. It should return a List of QuestionnaireItemViewHolderFactoryMatchers which are used to evaluate whether a custom QuestionnaireItemViewHolderFactory should be used to render a given questionnaire item.
Returns a org.hl7.fhir.r4.model.QuestionnaireResponse populated with any answers that are present on the rendered QuestionnaireFragment when it is called.
Add items within QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent from the provided parent Questionnaire.QuestionnaireItemComponent with nested items. The hierarchy and order of child items will be retained as specified in the standard. See https://www.hl7.org/fhir/questionnaireresponse.html#notes for more details.
Creates a QuestionnaireResponse.QuestionnaireResponseItemComponent from the provided Questionnaire.QuestionnaireItemComponent.
The hierarchy and order of child items will be retained as specified in the standard. See https://www.hl7.org/fhir/questionnaireresponse.html#notes for more details.
Whether the QuestionnaireItem should have entry format string.
The App developers may provide the DataCaptureConfig for the DataCapture library by implementing Provider interface in the Application class. The library would load and cache the configuration by calling Provider.getDataCaptureConfig.
Resolves external answer value sets not defined in the questionnaire's contained
element. This allows the library to render answer options to choice
and open-choice
type questions more dynamically.
A Fragment for displaying FHIR Questionnaires and getting user responses as FHIR QuestionnareResponses.
Add items within QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent from the provided parent Questionnaire.QuestionnaireItemComponent with nested items. The hierarchy and order of child items will be retained as specified in the standard. See https://www.hl7.org/fhir/questionnaireresponse.html#notes for more details.
Creates a QuestionnaireResponse.QuestionnaireResponseItemComponent from the provided Questionnaire.QuestionnaireItemComponent.
The StructureMap url in the target structure-map extension s.
Localized and spanned value of Questionnaire.QuestionnaireItemComponent.prefix if translation is present. Default value otherwise.
Localized and spanned value of Questionnaire.QuestionnaireItemComponent.text if translation is present. Default value otherwise.
The StructureMap url in the target structure-map extension s.