fml-engine
A StructureMap engine for the FHIR Mapping Language: runs maps over FHIR JSON, the way the HL7 reference engine does.
- Passes the reference tests. Every JSON structure-mapping test of the FHIR test cases (12 of 12, R4B and R5).
- Converts FHIR versions. With the HL7 cross-version maps
and their ConceptMaps, it converts 2,863 of the 2,881 R4 specification examples that have a
map to R5: R4
medicationReferencebecomes the R5 CodeableReference, Encounterclassbecomes a list of CodeableConcepts, and so on. A code a ConceptMap does not know is left out, as the reference engine does, and reported inwarnings. - The whole language. Groups and
extends, source filters (type,where,check,log, list modes,default), targets that create or reuse elements (repeating, choice elements written asvalueReference,share), dependent groups, default groups chosen by type, imported maps, primitives with theiridand extensions, and rules with several sources. - Transforms:
create,copy,evaluate,truncate,cast,append,translate,reference,pointer,uuid,cc,c,id,cp,qty,escape(html, xml, json), and the IG's date and time transforms:toDateTime,toDate,toTimewith format patterns (dd/MM/yyyy HH:mm,MMMM d, yyyy, …) andunixToDateTime,unixToDate,unixToTime. Not yet:dateOp, which the IG lists without defining. - Produced resources. Resources a map creates outside the target (a
createwith no target element) come back inproduced, ready for a Bundle. - Debug trace.
with_trace(true)records theenter/step/exitevents the IG proposes for$transform?debug=true: depth, the position in the StructureMap (StructureMap.group[0].rule[2]), and the variables in scope.debug_parameterswrites them as theParametersresponse, also when the transform fails. - Pluggable. Structure definitions come from fml-check's
Definitions, FHIRPath from anExpressionsimplementation (thefhirpathfeature uses octofhir-fhirpath), imported maps from aMapResolver, ConceptMaps from aConceptMapResolver. ConceptMaps are found by URL and by the canonical URLs they replace.
use ;
use ;
let definitions = new;
let expressions = new.await?;
let output = new
.with_maps // MapSet: StructureMaps for `imports`
.with_concept_maps // ConceptMapSet: for translate()
.transform
.await?;
println!; // also: output.produced, output.warnings
Part of fml-rs. Licensed under MIT or Apache-2.0.