// todo link to source
This documentation covers files located at: Questionnaire Item String // todo link to source createExtensionAccessor
Extensions
In FHIR, every extension requires a unique URL that serves as its identifier. While FHIR provides standard definitions for many features, it does not cover every requirement. Other renderers (such as Aidbox) may use different URLs, and custom functionalities require the definition of proprietary URLs.
Supported Extension URLs
The following URLs are supported and parsed by our renderer:
| Feature | Extension URL | Key / Value Type |
|---|---|---|
| Translation | http://hl7.org/fhir/StructureDefinition/translation | Complex Type |
| Min Value | http://hl7.org/fhir/StructureDefinition/minValue | valueDecimal |
| Max Value | http://hl7.org/fhir/StructureDefinition/maxValue | valueDecimal |
| Min Length | http://hl7.org/fhir/StructureDefinition/minLength | valueDecimal |
| Max Length | CUSTOM/maxLength | valueDecimal |
| Min Occurrences | http://hl7.org/fhir/StructureDefinition/questionnaire-minOccurs | valueInteger |
| Max Occurrences | http://hl7.org/fhir/StructureDefinition/questionnaire-maxOccurs | valueInteger |
| Item Control | http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl | valueCodeableConcept |
| Choice Orientation | http://hl7.org/fhir/StructureDefinition/questionnaire-choiceOrientation | valueCode |
| Unit | http://hl7.org/fhir/StructureDefinition/questionnaire-unit | valueUnit |
| Regex Pattern | http://hl7.org/fhir/StructureDefinition/regex | valueString |
| Entry Format | http://hl7.org/fhir/StructureDefinition/entryFormat | valueString |
| Display Logic | http://hl7.org/fhir/StructureDefinition/display | valueString |
| Variable | http://hl7.org/fhir/StructureDefinition/variable | valueExpression |
| SDC Enable When | http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-enableWhenExpression | valueExpression |
Implementation Notes
- Standardization: Most URLs follow the official HL7 FHIR StructureDefinitions.
- Custom Extensions: Features like
MAX_LENGTHcurrently use a custom path (CUSTOM/maxLength) and should be verified against R4 standards if high interoperability is required. - SDC Support: We support the Structured Data Capture (SDC) implementation guide for advanced logic like
enableWhenExpression.
Requirements
Some extensions require additional configuration to be active. For example, the minOccurs extension requires the item to be required by FHIR Definition.
Extension Accessor
To simplify interactions with FHIR extensions, we utilize an ExtensionAccessor. This utility provides a streamlined way to extract the values defined in our supported extensions list.
Initialization & Usage
The accessor must be initialized for each item using the respective questionnaireItem. Once initialized, the extension values are exposed as Angular Signals, allowing for reactive and efficient UI updates.
Key Features
- Reactive Access: Values are retrieved as Signals, ensuring the UI stays in sync with the underlying data model.
- Key Overriding: While the accessor uses the defined value keys passed via a map (e.g.,
valueDecimal), you can manually override the key if a different data type is expected. - Collection Handling: Ability to retrieve all occurrences of an extension if multiple instances are present.
- Full Extension Access: Provides access to the entire extension object for complex calculations that require metadata beyond the raw value.
Example Usage (Conceptual)
questionnaireItem: Signal<QuestionnaireItem>>
extensionAccessor = createExtensionAccessor(this.questionnaireItem, FHIR_QUESTIONNAIRE_EXTENSION_VALUE_MAP);
private minOccurExtension: Signal<number | undefined> = this.extensionAccessor(FHIR_EXTENSIONS.QUESTIONNAIRE.MIN_OCCURS);