Mappings with lisp/mapping

Aidbox provides the ability to convert data dynamically using lisp/mapping in your configuration. This is used in the HL7 v2 pipeline and some API constructor operations.
In order to create mapping, you need to declare a definition with lisp/mapping tag and write a structure with :mapping key, using lisp expressions in places where data will be calculated dynamically from the passed structure. It also allow to define an optional parameter :data-schema, which should be tagged as zen/schema and allows to validate the input data.
{:zen/tags #{zen/schema}
:type zen/map
:values {:type zen/any}}
{:zen/tags #{lisp/mapping}
:mapping {:resourceType "Bundle"
:type "transaction"
:entry [{:resource {:resourceType "Patient"}
:request {:method "PUT"
:url "/Patient/zero"}}
{:resource {:resourceType "Observation"
:status "final"
:code {:coding [{:system ""
:code "8867-4"
:display "Respiratory rate"}]
:text "Breathing Rate"}
:subject {:reference "Patient/zero"}
:effectiveDateTime (get-in [:br 0 :dateTime]),
:valueQuantity {
:value (get-in [:br 0 :value :breathingRate]),
:unit "breaths/minute",
:system "",
:code "/min"}}
:request {:method "POST"
:url "/Observation"}}]}
:data-schema my-data-schema ;; Optional


Passed structure

{:br [{:value {:breathingRate 18.1}
:dateTime "2022-11-15"}]}


{:type "transaction-response"
{:id "zero"
:resourceType "Patient"}}
{:code "/min",
:unit "breaths/minute",
:value 17.8,
:system ""},
:resourceType "Observation",
:effectiveDateTime "2021-10-25",
:status "final",
{:text "Breathing Rate",
[{:code "8867-4",
:system "",
:display "Respiratory rate"}]},
:subject {:reference "Patient/zero"}},}]}
In the provided example, mapping is used to create a Bundle with dynamically calculated Observation.valueQuantity.value and Obsevation.effectiveDateTime FHIR properties.
Last modified 4mo ago