Class ProfileRequirementsCompiler
deriveRequirements(org.hl7.fhir.r4.model.StructureDefinition) implements algorithm.md §2-§4
(must-support extraction, partitioned per §3.0, plus mandatory-element extraction per §4) and
compileAssertions(org.hl7.fhir.r4.model.StructureDefinition) implements the per-instance literal-FHIRPath translation (§7, this
change's tasks.md 5.11). Binding extraction (§5) and the full reference inventory / delayed-
reference test-ordering (§6) are deliberate v1 exclusions - see this change's design.md.
Mandatory-by-path is ambiguous for slices, so it isn't used for them.
ProfileRequirements.mandatoryElementPaths() is keyed by ElementDefinition.path,
which - unlike id - is identical across a sliced element's base and every one of its
slices (e.g. Patient.identifier, Patient.identifier:ihi, and
Patient.identifier:medicare all share the path "Patient.identifier"). Looking a slice's
mandatory-ness up in that set would therefore either wrongly mark every slice mandatory (if the
shared path is mandatory) or wrongly mark none of them (if it isn't), regardless of that
specific slice's own cardinality. This compiler instead reads each slice's, choice element's,
and plain element's own min directly (see SliceRequirement.mandatory() /
ChoiceTypeMustSupportElement.mandatory() / PlainMustSupportElement.mandatory()),
and keeps mandatoryElementPaths only as algorithm.md §4's own descriptive bucket.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncompileAssertions(org.hl7.fhir.r4.model.StructureDefinition profile) deriveRequirements(org.hl7.fhir.r4.model.StructureDefinition profile) List<org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent>toTestScriptAsserts(List<GeneratedAssertion> assertions) Converts compiled assertions to literalTestScript.SetupActionAssertComponents (design.md's chosen artifact shape: the same "compile to literal, inspectable TestScript" patternfhir-frog-shorthand/fhir-frog-mbtalready use).
-
Constructor Details
-
ProfileRequirementsCompiler
-
-
Method Details
-
deriveRequirements
-
compileAssertions
public List<GeneratedAssertion> compileAssertions(org.hl7.fhir.r4.model.StructureDefinition profile) -
toTestScriptAsserts
public List<org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent> toTestScriptAsserts(List<GeneratedAssertion> assertions) Converts compiled assertions to literalTestScript.SetupActionAssertComponents (design.md's chosen artifact shape: the same "compile to literal, inspectable TestScript" patternfhir-frog-shorthand/fhir-frog-mbtalready use). Deliberately does not assemble a fullTestScript(setup/test actions, fixtures, the operations that would fetch an instance to run these asserts against) - wiring compiled asserts into actual operations is a separate, TestPlan/MBT-shaped concern this change doesn't attempt to solve; see design.md.
-