Skip to main content

@aehrc/smart-forms-renderer

Interfaces

InterfaceDescription
BuildFormParamsParameters for buildForm().
CalculatedExpressionCalculatedExpression interface
ItemToRepopulateRepresents an item within a questionnaire that can be re-populated with updated data from the patient record.
LaunchContextLaunchContext interface
QItemOverrideComponentProps-
QuestionnaireResponseStoreTypeQuestionnaireResponseStore properties and methods Properties can be accessed for fine-grain details. Methods are usually used internally, but it is possible to use them externally to hook into the renderer for more fine-grain control.
QuestionnaireStoreTypeQuestionnaireStore properties and methods Properties can be accessed for fine-grain details. Methods are usually used internally, using them from an external source is not recommended.
RendererConfigRendererConfig interface Provides fine-grained control over the styling and behaviour of the renderer.
RendererConfigStoreTypeRendererConfigStore properties and methods
RepopulateFormParamsParameters for repopulateForm().
SdcUiOverrideComponentProps-
SmartConfigStoreTypeSmartConfigStore properties and methods Properties can be accessed for fine-grain details. Methods are usually used internally, using them from an external source is not recommended.
SmartFormsRendererPropsSmartFormsRenderer properties
TerminologyServerStoreTypeTerminologyServerStore properties and methods Properties can be accessed for fine-grain details. Methods are usually used internally, using them from an external source is not recommended.
UseResponsivePropsProps for the useResponsive() hook - used to determine if the screen size matches a given breakpoint query.
VariablesVariables interface
VariableXFhirQueryVariableXFhirQuery interface

Type Aliases

Type AliasDescription
TabTab interface
TabsKey-value pair of tabs Record<linkId, Tab>

Variables

VariableDescription
BooleanField-
FullWidthFormComponentBox-
ItemLabel-
questionnaireResponseStoreQuestionnaireResponse state management store which contains all properties and methods to manage the state of the questionnaireResponse. This is the vanilla version of the store which can be used in non-React environments.
questionnaireStoreQuestionnaire state management store which contains all properties and methods to manage the state of the questionnaire. This is the vanilla version of the store which can be used in non-React environments.
rendererConfigStore-
rendererThemeOptions-
smartConfigStoreSmart Config state management store. This is only used for answerExpressions. It is recommended to manage the state of the FHIRClient, patient, user, and encounter in the parent application, since the renderer doesn't provide pre-population capabilities. Will be deprecated in version 1.0.0.
terminologyServerStoreTerminology server state management store. This is used for resolving valueSets externally. Defaults to use https://tx.ontoserver.csiro.au/fhir. This is the vanilla version of the store which can be used in non-React environments.
useQuestionnaireResponseStoreQuestionnaireResponse state management store which contains all properties and methods to manage the state of the questionnaire. This is the React version of the store which can be used as React hooks in React functional components.
useQuestionnaireStoreQuestionnaire state management store which contains all properties and methods to manage the state of the questionnaire. This is the React version of the store which can be used as React hooks in React functional components.
useRendererConfigStore-
useSmartConfigStoreSmart Config state management store. This is only used for answerExpressions. It is recommended to manage the state of the FHIRClient, patient, user, and encounter in the parent application, since the renderer doesn't provide pre-population capabilities. Will be deprecated in version 1.0.0.
useTerminologyServerStoreTerminology server state management store. This is used for resolving valueSets externally. Defaults to use https://tx.ontoserver.csiro.au/fhir. This is the React version of the store which can be used as React hooks in React functional components.

Functions

FunctionDescription
accordionOverride-
autocompleteOverride-
BaseRendererMain 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.
buildBundleFromObservationArray-
buildFormBuild 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.
buttonOverride-
canBeObservationExtractedChecks whether a Questionnaire or any of its items contains a valid sdc-questionnaire-observationExtract extension (and if it's at the item level, a valid item.code too). Array.prototype.some() is short-circuiting, so it will return true as soon as it finds a valid extension.
cardOverride-
ChoiceRadioSingle-
createEmptyQrGroupCreate an empty group qrItem from a given group qItem
createEmptyQrItemCreate an empty qrItem from a given qItem, optionally with an answer key
DecimalField-
destroyFormDestroy the form to clean up the questionnaire and questionnaireResponse stores.
extractObservationBasedExtract an array of Observations from a QuestionnaireResponse and its source Questionnaire.
generateItemsToRepopulateCompare latest data from the server with the current QuestionnaireResponse and decide items to re-populate
getDecimalPrecisionCheck if the decimal value has a quantity precision for the decimal value
getQrItemsIndexGenerate an array of QuestionnaireResponseItems corresponding to its QuestionnaireItem indexes an array. QuestionnaireItems without a corresponding QuestionnaireResponseItem is set as undefined. i.e. QItems = [QItem0, QItem1, QItem2]. Only QItem0 and QItem2 have QrItems Generated array: [QrItem0, undefined, QrItem2] Note: There's a bug where if the qItems are child items from a repeat group, the function fails at the isRepeatGroup line. Ensure that repeat groups are handled prior to calling this function.
getQuestionnaireItem-
getResponseGet the filled QuestionnaireResponse at its current state. If no changes have been made to the form, the initial QuestionnaireResponse is returned.
getSectionHeadingReturns the section heading text for a given linkId in a questionnaire, used to label tab sections.
GridGroupMain component to render a Group Grid (grid) Questionnaire item.
GroupItem-
GroupTableMain component to render a Group Table (gtable) Questionnaire item.
initialiseQuestionnaireResponseInitialise a questionnaireResponse from a given questionnaire optionally takes in an existing questionnaireResponse to be initialised
inputOverride-
isHiddenByEnableWhen-
isRepeatItemAndNotCheckboxCheck 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
isSpecificItemControlCheck if the extension has an itemControl code equal to the given itemControlCode
ItemFieldGrid-
mapQItemsIndexGenerate a dictionary of QuestionnaireItems linkIds mapped to their respective array indexes <linkId, QItemIndex> i.e. { ee2589d5: 0, f9aaa187: 1, 88cab112: 2 } where ee2589d5, f9aaa187 and 88cab112 are linkIds of QItem0, QItem1 and QItem2 respectively
paperOverride-
parseDecimalStringToFloat-
parseDecimalStringWithPrecision-
parseFhirDateTimeToDisplayDateTimeParse a FHIR dateTime string to a human-readable display format. Supports full and partial FHIR dateTime values.
parseFhirDateToDisplayDateParse a FHIR date string to a human-readable display format.
removeEmptyAnswersFromResponseRemove 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.
removeInternalIdsFromResponseRemove 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.
rendererThemeComponentOverrides-
RendererThemeProviderDefault theme used by the renderer using Material UI. You can customise your own theme by defining a new ThemeProvider.
RepeatGroupMain component to render a repeating, group Questionnaire item. Store and manages the state of multiple instances of GroupItem in a repeating group.
RepeatItemMain component to render a repeating, non-group Questionnaire item.
repopulateFormRe-populate the form with a provided (already filled) QuestionnaireResponse.
repopulateResponseRe-populate checked items in the re-population dialog into the current QuestionnaireResponse
SingleItemMain component to render a repeating, non-group Questionnaire item. Store and manages the state of multiple instances of SingleItem in a repeating item.
SmartFormsRendererA self-initialising wrapper around the BaseRenderer rendering engine.
speedDialOverride-
StringField-
tableOverride-
updateQrItemsInGroupUpdates the QuestionnaireResponseItem group by adding/removing a new/modified child QuestionnaireResponseItem into/from a qrGroup Takes either a single newQrItem or an array of newQrItems
useBuildFormReact hook wrapping around buildForm to build a form from a Questionnaire and an optional filled QuestionnaireResponse. If a QuestionnaireResponse is not provided, an empty QuestionnaireResponse is set as the initial QuestionnaireResponse.
useDisplayCqfAndCalculatedExpressionReturns the value of a cqf-expression, calculatedExpression or ItemTextAriaLabelExpression.
useHiddenReact 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.
useReadOnly-
useRendererQueryClientDefault QueryClient used by the renderer. You can customise your own QueryClient with your own options, use v5 of @tanstack/react-query.
useRenderingExtensions-
useResponsiveA hook to determine if the screen size matches a given breakpoint query.
useValidationFeedback-
useValueSetCodings-