Skip to main content

// 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:

FeatureExtension URLKey / Value Type
Translationhttp://hl7.org/fhir/StructureDefinition/translationComplex Type
Min Valuehttp://hl7.org/fhir/StructureDefinition/minValuevalueDecimal
Max Valuehttp://hl7.org/fhir/StructureDefinition/maxValuevalueDecimal
Min Lengthhttp://hl7.org/fhir/StructureDefinition/minLengthvalueDecimal
Max LengthCUSTOM/maxLengthvalueDecimal
Min Occurrenceshttp://hl7.org/fhir/StructureDefinition/questionnaire-minOccursvalueInteger
Max Occurrenceshttp://hl7.org/fhir/StructureDefinition/questionnaire-maxOccursvalueInteger
Item Controlhttp://hl7.org/fhir/StructureDefinition/questionnaire-itemControlvalueCodeableConcept
Choice Orientationhttp://hl7.org/fhir/StructureDefinition/questionnaire-choiceOrientationvalueCode
Unithttp://hl7.org/fhir/StructureDefinition/questionnaire-unitvalueUnit
Regex Patternhttp://hl7.org/fhir/StructureDefinition/regexvalueString
Entry Formathttp://hl7.org/fhir/StructureDefinition/entryFormatvalueString
Display Logichttp://hl7.org/fhir/StructureDefinition/displayvalueString
Variablehttp://hl7.org/fhir/StructureDefinition/variablevalueExpression
SDC Enable Whenhttp://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-enableWhenExpressionvalueExpression

Implementation Notes

  • Standardization: Most URLs follow the official HL7 FHIR StructureDefinitions.
  • Custom Extensions: Features like MAX_LENGTH currently 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);