Skip to content

Enhance FHIR linting for StructureDefinition bindings and fixed Task input constraints #37

@khalilmalla95

Description

@khalilmalla95

Description

The linter currently validates several StructureDefinition and Task aspects (metadata, placeholders, differential/snapshot structure, slice cardinality, basic Task input checks), but it does not yet enforce some important cross-resource/profile-driven constraints.

We should extend linting to support the following cases:

  1. Validate binding.valueSet references in StructureDefinition

    • When an element contains:
      • binding.strength
      • binding.valueSet
    • Resolve the canonical URL in binding.valueSet against available ValueSet resources in the project.
    • If no matching ValueSet is found:
      • emit ERROR when binding.strength = required
      • emit WARNING for other strengths (extensible, preferred, example)
  2. Validate fixedUri constraints against Task instances

    • For relevant StructureDefinition differential elements (e.g. Task.input:*...coding.system), ensure the fixed URI value is present in corresponding Task instances.
    • Missing required fixed URI in Task should emit ERROR.
  3. Validate fixedCode in the context of the corresponding URI/system

    • For profile elements like Task.input:*...coding.code with fixedCode, validate that Task instances contain the expected (system, code) pair.
    • Example target pair:
      • system = http://example.org/fhir/CodeSystem/tutorial
      • code = tutorial-input
    • If code exists under wrong system, or expected pair is missing, emit ERROR.

Example profile fragment

<binding>
  <strength value="required" />
  <valueSet value="http://example.org/fhir/ValueSet/tutorial" />
</binding>
<element id="Task.input:tutorial-input.type.coding.system">
  <path value="Task.input.type.coding.system" />
  <fixedUri value="http://example.org/fhir/CodeSystem/tutorial" />
</element>
<element id="Task.input:tutorial-input.type.coding.code">
  <path value="Task.input.type.coding.code" />
  <fixedCode value="tutorial-input" />
</element>

Expected Task coding:

<coding>
  <system value="http://example.org/fhir/CodeSystem/tutorial"/>
  <code value="tutorial-input"/>
</coding>

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions