fml-model 0.1.0

StructureMap model for the FHIR Mapping Language: compile FML to StructureMap and print it back
Documentation

fml-model

The StructureMap resource for the FHIR Mapping Language: compile FML to a StructureMap, and print a StructureMap back as FML.

  • Matches the HL7 reference compiler. The StructureMap JSON is the one StructureMapUtilities in org.hl7.fhir.core builds, byte for byte, on all 1,659 maps we test against: generated rule names, the variables of the simple copy form, batch identity rules, contained ConceptMaps, documentation from comments, FHIRPath in the reference parser's canonical form. Two documented differences keep what the map says: whitespace-only strings, which the reference JSON writer drops, and calendar durations (5 days), which it rewrites as 5 'days'.
  • Prints FML back. The printed map compiles to the same StructureMap, for every map in the corpus; it also reads maps built by older IG Publisher versions.
  • R4 and R5. to_r4 writes the R4 shape (dependent.variable, defaultValue[x], contextType, ConceptMap equivalence) and reports what R4 cannot hold; from_json reads both.
  • Elements the model does not name are kept, so reading and writing a StructureMap loses nothing.
let compiled = fml_model::compile(source);         // StructureMap + diagnostics
let json = serde_json::to_string_pretty(&compiled.map)?;
let r4 = fml_model::to_r4(&compiled.map);          // R4 JSON + what it could not hold
let fml = fml_model::print(&compiled.map);         // back to FML

Part of fml-rs. Licensed under MIT or Apache-2.0.