BaseRenderer | Main component of the form-rendering engine. Renders the Questionnaire and QuestionnaireResponse defined in the state management stores QuestionnaireStore and QuestionnaireResponseStore respectively. Use buildForm() in your wrapping component or in an event handler to initialise the form. |
buildForm | Build the form with an initial Questionnaire and an optional filled QuestionnaireResponse. If a QuestionnaireResponse is not provided, an empty QuestionnaireResponse is set as the initial QuestionnaireResponse. There are other optional properties such as applying readOnly, providing a terminology server url and additional variables. |
destroyForm | Destroy the form to clean up the questionnaire and questionnaireResponse stores. |
extractObservationBased | Extract an array of Observations from a QuestionnaireResponse and its source Questionnaire. |
generateItemsToRepopulate | Compare latest data from the server with the current QuestionnaireResponse and decide items to re-populate |
getResponse | Get the filled QuestionnaireResponse at its current state. If no changes have been made to the form, the initial QuestionnaireResponse is returned. |
GridGroup | Main component to render a Group Grid (grid) Questionnaire item. |
GroupTable | Main component to render a Group Table (gtable) Questionnaire item. |
InitialiseFormWrapperForStorybook | This is a one-to-one replacement for the SmartFormsRenderer for demo purposes. Instead of using this React component, define your own wrapper component that uses the BaseRenderer directly. Things to note: - It is required to wrap the BaseRenderer with the QueryClientProvider to make requests. - You can wrap the BaseRenderer with the RendererThemeProvider to apply the default renderer theme used in Smart Forms. Optionally, you can define your own ThemeProvider https://mui.com/material-ui/customization/theming/. - Make your buildForm() call in a button click or other event handler. Alternatively, you can use the useInitialiseForm hook to initialise the form. - Make your own initialiseFhirClient() call in a button click or other event handler. Alternatively, you can use the useInitialiseForm hook to initialise the form. - The initialised FHIRClient is only used for further FHIR calls. It does not provide pre-population capabilities. |
initialiseQuestionnaireResponse | Initialise a questionnaireResponse from a given questionnaire optionally takes in an existing questionnaireResponse to be initialised |
isRepeatItemAndNotCheckbox | Check if qItem is a repeat item AND if it isn't a checkbox item Note: repeat checkbox items are rendered as multi-select checkbox instead of being rendered as a traditional repeat item |
isSpecificItemControl | Check if the extension has an itemControl code equal to the given itemControlCode |
parseFhirDateToDisplayDate | Parse a FHIR date string to a date to be consumed and displayed by the DateItem component. |
removeEmptyAnswersFromResponse | Remove all empty/hidden answers from the filled QuestionnaireResponse. This takes into account enableWhens, enableWhenExpressions, items without item.answer, empty item.answer arrays and empty strings. This does not remove items that are hidden by the http://hl7.org/fhir/StructureDefinition/questionnaire-hidden extension. |
removeInternalIdsFromResponse | Remove all instances of item.answer.id from the filled QuestionnaireResponse. These IDs are used internally for rendering repeating items, and can be safely left out of the final response. |
RendererThemeProvider | Default theme used by the renderer using Material UI. You can customise your own theme by defining a new ThemeProvider. |
RepeatGroup | Main component to render a repeating, group Questionnaire item. Store and manages the state of multiple instances of GroupItem in a repeating group. |
RepeatItem | Main component to render a repeating, non-group Questionnaire item. |
repopulateResponse | Re-populate checked items in the re-population dialog into the current QuestionnaireResponse |
SingleItem | Main component to render a repeating, non-group Questionnaire item. Store and manages the state of multiple instances of SingleItem in a repeating item. |
SmartFormsRenderer | A self-initialising wrapper around the BaseRenderer rendering engine. Will be deprecated in version 1.0.0. For alternative usage, see: - https://github.com/aehrc/smart-forms/blob/main/packages/smart-forms-renderer/src/stories/storybookWrappers/InitialiseFormWrapperForStorybook.tsx#L40-L57 |
useBuildForm | React hook wrapping around the buildForm() function to build a form from a questionnaire and an optional QuestionnaireResponse. |
useHidden | React hook to determine if a QuestionnaireItem is hidden via item.hidden, enableWhens, enableWhenExpressions. When checking for repeating group enableWhen items, the parentRepeatGroupIndex should be provided. |
useRendererQueryClient | Default QueryClient used by the renderer. You can customise your own QueryClient with your own options, use v4 of @tanstack/react-query. |