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
StructureMapUtilitiesin 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. One documented difference keeps what the map says: calendar durations (5 days), which the reference compiler rewrites as5 '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_r4writes the R4 shape (dependent.variable,defaultValue[x],contextType, ConceptMapequivalence) and reports what R4 cannot hold;from_jsonreads both. - All the IG's metadata.
/// jurisdiction.coding.code = 'AQ': sub-properties, repeats and complex elements, foridentifier,contact,useContext,jurisdictionand the rest. - Locations.
compiled.locationsgives the text range of every group, rule, source and target by its place in the StructureMap (StructureMap.group[0].rule[2].source[0]), in rows and UTF-16 columns as the IG's debug trace wants them. - Elements the model does not name are kept, so reading and writing a StructureMap loses nothing.
let compiled = compile; // StructureMap + diagnostics
let json = to_string_pretty?;
let r4 = to_r4; // R4 JSON + what it could not hold
let fml = print; // back to FML
Part of fml-rs. Licensed under MIT or Apache-2.0.