fml-model 0.2.1

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](https://build.fhir.org/ig/HL7/mapping-language-ig/):
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. One documented
  difference keeps what the map says: calendar durations (`5 days`), which the reference
  compiler 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.
- **All the IG's metadata.** `/// jurisdiction.coding.code = 'AQ'`: sub-properties, repeats and
  complex elements, for `identifier`, `contact`, `useContext`, `jurisdiction` and the rest.
- **Locations.** `compiled.locations` gives 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.

```rust
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](https://github.com/octofhir/fml-rs). Licensed under MIT or Apache-2.0.