Expand description
StructureMap for the FHIR Mapping Language: compile FML to a StructureMap resource.
let compiled = fml_model::compile(r#"
/// url = 'http://example.org/StructureMap/Copy'
/// name = 'Copy'
uses "http://hl7.org/fhir/StructureDefinition/Patient" as source
uses "http://hl7.org/fhir/StructureDefinition/Patient" as target
group Copy(source src : Patient, target tgt : Patient) {
src.name -> tgt.name;
}
"#);
assert!(!compiled.has_errors());
let rule = &compiled.map.group[0].rule[0];
assert_eq!(rule.name.as_deref(), Some("name"));
assert_eq!(rule.target[0].transform.as_deref(), Some("create"));Re-exports§
pub use flavor::R4Map;pub use flavor::from_json;pub use flavor::to_r4;pub use model::StructureMap;
Modules§
- flavor
- StructureMap as FHIR R4 (and R4B) shape it, and back.
- model
- The StructureMap resource, as FHIR R5 and the Mapping Language IG define it.
Structs§
- Compiled
- The outcome of compiling FML: the map, as complete as the source allows, and the problems.
- Locations
- The text range of each part of a compiled map, by its location in the StructureMap
(
StructureMap.group[0].rule[2].source[0], as a debug trace names it). The rules a batch identity rule produces all point at that rule. - Span
- A range in the text as the Mapping Language debug trace gives it: zero-based rows and zero-based columns in UTF-16 code units, the end exclusive.
Constants§
- AUTO_
VARIABLE - The variable the simple copy form
src.a -> tgt.a;binds on both sides. - BATCH_
UNNAMED_ PREFIX - Name prefix of the rules produced by an unnamed batch identity rule
src -> tgt : a, b;. - REFERENCES_
CONTAINED_ EXTENSION - Extension on a parameter value that refers to a contained resource.
- SOURCE_
ELEMENT_ EXTENSION - Extension holding source path segments after the first element (
src.a.b→b). - TARGET_
ELEMENT_ EXTENSION - Extension holding target path segments after the first element.
Functions§
- compile
- Compiles FML source text to a StructureMap.
- compile_
tree - Compiles a parsed file. Syntax errors in the tree are not repeated in the result.
- make_id
Utilities.makeIdof the reference implementation: keeps ASCII letters, digits,-and..- Writes a StructureMap as FML.
- source_
path - The source element path: the element and the path segments in the element extension.