@synanetics/fdl-interpreter
v1.0.3
Published
A React interpreter for the Forms Definition Language (FDL)
Downloads
22
Maintainers
Keywords
Readme
FDL Interpreter
This is a React implementation of a Forms Definition Language (FDL) interpreter.
Installation and Usage
See the example folder for an example setup of using the FDL Interpreter. The general steps are:
- Install using
npm install @synanetics/fdl-interpreter
. - Setup all controls that will be required as React components. These must have the props of type
FdlControlProps
. - Create a map of React controls to the AbstractFormControlDefinition URLs.
- Create a button component that has props of type
ButtonComponentProps
. - Have an FDL template FHIR bundle ready to be loaded in. This bundle includes all AbstractFormControlDefinitions and StructureMaps required to generate the form.
- Create a
Parameters
FHIR resource to inject context into the form. For example, this could contain the current patient reference and if editing a form then the previous form response. - Use the
FdlForm
component to render the form:
<FdlForm
controls={controls}
fdl={fdlBundle}
params={params}
onOutputChange={setOutput}
ButtonComponent={MyButton}
/>
Development Setup
- Run
npm run setup
to install dependencies - Run
npm run dev
to run watch changes to both the FDL interpreter and the example app - Open http://localhost:5173 to see the example app