Starter FHIR Implementation Guide
1.0.1 - draft International flag

Starter FHIR Implementation Guide, published by Jembi Health Systems. This guide is not an authorized publication; it is the continuous build for version 1.0.1 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/jembi/Starter-FHIR-IG/ and changes regularly. See the Directory of published versions

: Map Breastfeeding Question to an Observation - JSON Representation

Draft as of 2024-11-17

Raw json | Download

{
  "resourceType" : "StructureMap",
  "id" : "QRBreastfeedingStatusToObservation",
  "text" : {
    "status" : "generated",
    "div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p class=\"res-header-id\"><b>Generated Narrative: StructureMap QRBreastfeedingStatusToObservation</b></p><a name=\"QRBreastfeedingStatusToObservation\"> </a><a name=\"hcQRBreastfeedingStatusToObservation\"> </a><a name=\"QRBreastfeedingStatusToObservation-en-US\"> </a><pre class=\"fml\">\r\n<b>map</b><span style=\"color: navy\"> &quot;</span>http://jembi.org/fhir/StructureMap/QRBreastfeedingStatusToObservation<span style=\"color: navy\">&quot; = &quot;</span>QRBreastfeedingStatusToObservation<span style=\"color: navy\">&quot;\r\n\r\n</span><b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/questionnaireresponse.html\" title=\"QuestionnaireResponse\">http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse</a><span style=\"color: navy\">&quot; </span><b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"StructureDefinition-breastfeeding-status-observation.html\" title=\"Observation - Breastfeeding Status\">http://jembi.org/fhir/StructureDefinition/breastfeeding-status-observation</a><span style=\"color: navy\">&quot; </span><b>as </b><b>target</b>\r\n\r\n<b>group </b>QRBreastfeedingStatusToObservation<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span><span style=\"color: navy\"> : </span>QuestionnaireResponse, <b>target</b> <span style=\"color: maroon\">tgt</span><span style=\"color: navy\"> : </span>Observation<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src<span style=\"color: navy\"><b> -&gt; </b></span>tgt.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span> <i>&quot;SetObservationId&quot;</i><span style=\"color: navy\">;</span>\r\n  src<span style=\"color: navy\"><b> -&gt; </b></span>tgt.meta<b> as </b><span style=\"color: maroon\">meta</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    src<span style=\"color: navy\"><b> -&gt; </b></span>meta.profile = <span style=\"color: blue\">'http://jembi.org/fhir/StructureDefinition/breastfeeding-status-observation'</span> <i>&quot;SetObservationMetaProfile&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;SetObservationMeta&quot;</i><span style=\"color: navy\">;</span>\r\n  src<span style=\"color: navy\"><b> -&gt; </b></span>tgt.status = <span style=\"color: blue\">'final'</span> <i>&quot;SetObservationStatus&quot;</i><span style=\"color: navy\">;</span>\r\n  src<span style=\"color: navy\"><b> -&gt; </b></span>tgt.code = <b>cc</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'http://loinc.org'</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'63895-7'</span><span style=\"color: navy\">)</span> <i>&quot;SetObservationCode&quot;</i><span style=\"color: navy\">;</span>\r\n  src<span style=\"color: navy\"><b> -&gt; </b></span> tgt.code<b> as </b><span style=\"color: maroon\">code</span><span style=\"color: navy\">, </span> code.text = <span style=\"color: blue\">'Breastfeeding status'</span> <i>&quot;SetObservationCodeText&quot;</i><span style=\"color: navy\">;</span>\r\n  src.authored<b> as </b><span style=\"color: maroon\">authored</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.effective = <span style=\"color: maroon\">authored</span> <i>&quot;SetObservationEffectiveDateTime&quot;</i><span style=\"color: navy\">;</span>\r\n  src<span style=\"color: navy\"><b> -&gt; </b></span>tgt.category = <b>cc</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/observation-category'</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'exam'</span><span style=\"color: navy\">)</span> <i>&quot;SetObservationCategory&quot;</i><span style=\"color: navy\">;</span>\r\n  src.subject<b> as </b><span style=\"color: maroon\">patient</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.subject = <span style=\"color: maroon\">patient</span> <i>&quot;SetObservationSubjectReference&quot;</i><span style=\"color: navy\">;</span>\r\n  src.author<b> as </b><span style=\"color: maroon\">author</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.performer = <span style=\"color: maroon\">author</span> <i>&quot;SetObservationPerfomerReference&quot;</i><span style=\"color: navy\">;</span>\r\n  src.encounter<b> as </b><span style=\"color: maroon\">encounter</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.encounter = <span style=\"color: maroon\">encounter</span> <i>&quot;SetObservationEncounterReference&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId = '1.1')<b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer first<b> as </b><span style=\"color: maroon\">ans</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      ans.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">breastfeeding</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'CodeableConcept'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">obsValue</span><b> then</b><span style=\"color: navy\"> {\r\n</span>        breastfeeding<span style=\"color: navy\"><b> -&gt; </b></span>obsValue.coding = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><b> then</b><span style=\"color: navy\"> {\r\n</span>          breastfeeding<span style=\"color: navy\"><b> -&gt; </b></span>coding.system = <b>translate</b><span style=\"color: navy\">(</span><span style=\"color: maroon\">breastfeeding</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'http://jembi.org/fhir/ConceptMap/LOINCCodesToProprietary'</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'system'</span><span style=\"color: navy\">)</span> <i>&quot;SetObservationValueCodingSystem&quot;</i><span style=\"color: navy\">;</span>\r\n          breastfeeding<span style=\"color: navy\"><b> -&gt; </b></span>coding.code = <b>translate</b><span style=\"color: navy\">(</span><span style=\"color: maroon\">breastfeeding</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'http://jembi.org/fhir/ConceptMap/LOINCCodesToProprietary'</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'code'</span><span style=\"color: navy\">)</span> <i>&quot;SetObservationValueCodingCode&quot;</i><span style=\"color: navy\">;</span>\r\n        <span style=\"color: navy\">}</span> <i>&quot;SetObservationValueCoding&quot;</i><span style=\"color: navy\">;</span>\r\n      <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span></pre></div>"
  },
  "url" : "http://jembi.org/fhir/StructureMap/QRBreastfeedingStatusToObservation",
  "version" : "1.0.1",
  "name" : "QRBreastfeedingStatusToObservation",
  "status" : "draft",
  "date" : "2024-11-17T13:26:33+00:00",
  "publisher" : "Jembi Health Systems",
  "contact" : [
    {
      "name" : "Jembi Health Systems",
      "telecom" : [
        {
          "system" : "url",
          "value" : "https://www.jembi.org/"
        },
        {
          "system" : "email",
          "value" : "info@jembi.org"
        }
      ]
    },
    {
      "name" : "Richard Langford",
      "telecom" : [
        {
          "system" : "email",
          "value" : "richard.langford@jembi.org",
          "use" : "work"
        }
      ]
    }
  ],
  "jurisdiction" : [
    {
      "coding" : [
        {
          "system" : "http://unstats.un.org/unsd/methods/m49/m49.htm",
          "code" : "001",
          "display" : "World"
        }
      ]
    }
  ],
  "structure" : [
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse",
      "mode" : "source"
    },
    {
      "url" : "http://jembi.org/fhir/StructureDefinition/breastfeeding-status-observation",
      "mode" : "target"
    }
  ],
  "group" : [
    {
      "name" : "QRBreastfeedingStatusToObservation",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "type" : "QuestionnaireResponse",
          "mode" : "source"
        },
        {
          "name" : "tgt",
          "type" : "Observation",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "SetObservationId",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "id",
              "transform" : "uuid"
            }
          ]
        },
        {
          "name" : "SetObservationMeta",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "meta",
              "variable" : "meta"
            }
          ],
          "rule" : [
            {
              "name" : "SetObservationMetaProfile",
              "source" : [
                {
                  "context" : "src"
                }
              ],
              "target" : [
                {
                  "context" : "meta",
                  "contextType" : "variable",
                  "element" : "profile",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "http://jembi.org/fhir/StructureDefinition/breastfeeding-status-observation"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "SetObservationStatus",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "status",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "final"
                }
              ]
            }
          ]
        },
        {
          "name" : "SetObservationCode",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "code",
              "transform" : "cc",
              "parameter" : [
                {
                  "valueString" : "http://loinc.org"
                },
                {
                  "valueString" : "63895-7"
                }
              ]
            }
          ]
        },
        {
          "name" : "SetObservationCodeText",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "code",
              "variable" : "code"
            },
            {
              "context" : "code",
              "contextType" : "variable",
              "element" : "text",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "Breastfeeding status"
                }
              ]
            }
          ]
        },
        {
          "name" : "SetObservationEffectiveDateTime",
          "source" : [
            {
              "context" : "src",
              "element" : "authored",
              "variable" : "authored"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "effective",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "authored"
                }
              ]
            }
          ]
        },
        {
          "name" : "SetObservationCategory",
          "source" : [
            {
              "context" : "src"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "category",
              "transform" : "cc",
              "parameter" : [
                {
                  "valueString" : "http://terminology.hl7.org/CodeSystem/observation-category"
                },
                {
                  "valueString" : "exam"
                }
              ]
            }
          ]
        },
        {
          "name" : "SetObservationSubjectReference",
          "source" : [
            {
              "context" : "src",
              "element" : "subject",
              "variable" : "patient"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "subject",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "patient"
                }
              ]
            }
          ]
        },
        {
          "name" : "SetObservationPerfomerReference",
          "source" : [
            {
              "context" : "src",
              "element" : "author",
              "variable" : "author"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "performer",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "author"
                }
              ]
            }
          ]
        },
        {
          "name" : "SetObservationEncounterReference",
          "source" : [
            {
              "context" : "src",
              "element" : "encounter",
              "variable" : "encounter"
            }
          ],
          "target" : [
            {
              "context" : "tgt",
              "contextType" : "variable",
              "element" : "encounter",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueId" : "encounter"
                }
              ]
            }
          ]
        },
        {
          "name" : "item",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "(linkId = '1.1')"
            }
          ],
          "rule" : [
            {
              "name" : "answer",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "listMode" : "first",
                  "variable" : "ans"
                }
              ],
              "rule" : [
                {
                  "name" : "valueCoding",
                  "source" : [
                    {
                      "context" : "ans",
                      "type" : "Coding",
                      "element" : "value",
                      "variable" : "breastfeeding"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "value",
                      "variable" : "obsValue",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "CodeableConcept"
                        }
                      ]
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "SetObservationValueCoding",
                      "source" : [
                        {
                          "context" : "breastfeeding"
                        }
                      ],
                      "target" : [
                        {
                          "context" : "obsValue",
                          "contextType" : "variable",
                          "element" : "coding",
                          "variable" : "coding",
                          "transform" : "create",
                          "parameter" : [
                            {
                              "valueString" : "Coding"
                            }
                          ]
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "SetObservationValueCodingSystem",
                          "source" : [
                            {
                              "context" : "breastfeeding"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "coding",
                              "contextType" : "variable",
                              "element" : "system",
                              "transform" : "translate",
                              "parameter" : [
                                {
                                  "valueId" : "breastfeeding"
                                },
                                {
                                  "valueString" : "http://jembi.org/fhir/ConceptMap/LOINCCodesToProprietary"
                                },
                                {
                                  "valueString" : "system"
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name" : "SetObservationValueCodingCode",
                          "source" : [
                            {
                              "context" : "breastfeeding"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "coding",
                              "contextType" : "variable",
                              "element" : "code",
                              "transform" : "translate",
                              "parameter" : [
                                {
                                  "valueId" : "breastfeeding"
                                },
                                {
                                  "valueString" : "http://jembi.org/fhir/ConceptMap/LOINCCodesToProprietary"
                                },
                                {
                                  "valueString" : "code"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}