Last updated:
0 purchases
fhir questionnaire
FHIR Questionnaire #
A Flutter package for working with FHIR® Questionnaires. FHIR® is the registered trademark of HL7 and is used with the permission of HL7. Use of the FHIR trademark does not constitute endorsement of this product by HL7.
This package takes care building the UI of a FHIR R4 Questionnaire, handle behavior and validations and finally generates the QuestionnaireResponse from the user answers.
Supported Questionnaire Items #
So far this package only supports FHIR R4 Item Types
Item
Supported
Group
✅
Display
✅
Question
☑️
Boolean
✅
Decimal
✅
Integer
✅
Date
✅
DateTime
✅
Time
✅
String
✅
Text
✅
Url
✅
Choice
✅
OpenChoice
✅
Attachment
✅
Reference
☑️
Quantity
✅
Supported extra features #
enableWhen supported
enableBehavior supported.
Calculated Expression supported
How to use #
Just add a QuestionnaireView widget to your widget tree and you will have your Questionnaire UI.
QuestionnaireView(
questionnaire: questionnaire, // A FHIR R4 Questionnaire instance
onAttachmentLoaded: onAttachmentLoaded, // A callback to handle attachment loading (explained below)
locale: locale, // The specific locale for the Button and validation texts
localizations: localizations, // To add support for extra localization
isLoading: loading, // Wether is some ongoing operation before loading the UI
onSubmit: onSubmit, // Callback to get the QuestionnaireResponse
controller: controller, // The QuestionnaireController to use for item view and response generation.
)
copied to clipboard
QuestionnaireView #
Questionnaire questionnaire: QuestionnaireView requires an object of type Questionnaire this is the definition of the Questionnaire and will be used to build the Form UI and generate the Questions and Answers.
String? locale: Optionally you can specify the language like "es" or "en" or "fr", etc. you want to use for validation messages and Submit button, by default the system language will be used.
List: this is a list allows you to add extra language translations to the Questionnaire, currently the package supports only English and Spanish, so you can add other Languages, you just need to create a class for each new Language you want to support and extend QuestionnaireBaseLocalization.
QuestionnaireBaseLocalization? defaultLocalization: Indicates what should be the fallback localization if the specified language or the system language is not supported, by default English is the fallback.
bool isLoading: use this to indicate there is an ongoing operation, for instance if you need to make an API request to load your Questionnaire you can set isLoading = true so the QuestionnaireView will show a Shimmer loading effect view.
Future<Attachment?> Function()? onAttachmentLoaded: To make this package simpler and compatible with all Flutter supported platforms, the feature to load an attachment is delegated to the App, so you have to handle this logic by implementing this function and returning an Attachment instance according to FHIR.
ValueChanged: This is the callback that will be triggered once the user taps on the Submit button, and you will get a QuestionnaireResponse instance ready, you just have to set the subject or whatever extra data you consider necessary but the answers will covered.
QuestionnaireController? controller: This is the controller to be used for items and response generation within the QuestionnaireView, the purpose of this controller here is to allow you to use an instance of an extension of QuestionnaireController so you can override the behavior and widgets.
Some extra notes #
This widget will use the app Theme to build, so if you want to change colors, InputDecorations, etc, you just have to change it in your app Theme. Also all the package widgets are public and exposed so you could override it if necessary.
The QuestionnaireView implementation takes care of validations depending on each QuestionnaireItem definition.
Check the example project which shows all the features in action.
Demo #
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.