PreNUDGE FHIR® IG for Data Provider / Data from Apps (R4)
0.1.0 - ci-build

PreNUDGE FHIR® IG for Data Provider / Data from Apps (R4) - Local Development build (v0.1.0) built by the FHIR (HL7® FHIR® Standard) Build Tools. See the Directory of published versions

## : Blood Glucose Q to O - JSON Representation

Active as of 2026-06-18

Raw json | Download

    {
      "resourceType" : "StructureMap",
      "id" : "BloodGlucoseQuestionnaireResponseToObservation",
      "text" : {
        "status" : "generated",
        "div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p class=\"res-header-id\"><b>Generated Narrative: StructureMap BloodGlucoseQuestionnaireResponseToObservation</b></p><a name=\"BloodGlucoseQuestionnaireResponseToObservation\"> </a><a name=\"hcBloodGlucoseQuestionnaireResponseToObservation\"> </a><pre class=\"fml\">\r\n<b>map</b><span style=\"color: navy\"> &quot;</span>https://fhir.hl7.at/prenudge/appdata/r4/StructureMap/BloodGlucoseQuestionnaireResponseToObservation<span style=\"color: navy\">&quot; = &quot;</span>BloodGlucoseQuestionnaireResponseToObservation<span style=\"color: navy\">&quot;\r\n\r\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">Blood Glucose Q to O</span>\r\n\r\n<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>alias </b>QR <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/observation.html\" title=\"Observation\">http://hl7.org/fhir/StructureDefinition/Observation</a><span style=\"color: navy\">&quot; </span><b>alias </b>Obs <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/datatypes.html#Quantity\" title=\"Quantity\">http://hl7.org/fhir/StructureDefinition/Quantity</a><span style=\"color: navy\">&quot; </span><b>alias </b>Quantity <b>as </b><b>source</b>\r\n\r\n<b>imports</b><span style=\"color: navy\"> &quot;</span>http://hl7.org/fhir/StructureMap/*<span style=\"color: navy\">&quot;\r\n</span><b>imports</b><span style=\"color: navy\"> &quot;</span><a href=\"StructureMap-QuestionnaireResponseToObservationBase.html\" title=\"Shared base for Q to O\">https://fhir.hl7.at/prenudge/appdata/r4/StructureMap/QuestionnaireResponseToObservationBase</a><span style=\"color: navy\">&quot;\r\n</span>\r\n<b>group </b>BloodGlucoseQuestionnaireResponseToObservation<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span><span style=\"color: navy\"> : </span>QR, <b>target</b> <span style=\"color: maroon\">tgt</span><span style=\"color: navy\"> : </span>Obs<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src<b> then </b>SetObservationBase<span style=\"color: navy\">(</span><span style=\"color: maroon\">src</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">tgt</span><span style=\"color: navy\">)</span> <i>&quot;Base&quot;</i><span style=\"color: navy\">;</span>\r\n  src<span style=\"color: navy\"><b> -&gt; </b></span> tgt.meta = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Meta'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">meta</span><span style=\"color: navy\">, </span> meta.profile = <span style=\"color: blue\">'https://fhir.hl7.at/prenudge/appdata/r4/StructureDefinition/at-prenudge-bloodglucose-observation'</span> <i>&quot;SetProfile&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\">'41653-7'</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'Glucose [Mass/volume] in Capillary blood by Glucometer'</span><span style=\"color: navy\">)</span> <i>&quot;SetCode&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>linkId = 'blood-glucose'<b> then </b>MapBloodGlucose<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">tgt</span><span style=\"color: navy\">)</span> <i>&quot;ProcessItem&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>MapBloodGlucose<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span><span style=\"color: navy\"> : </span>QR, <b>target</b> <span style=\"color: maroon\">tgt</span><span style=\"color: navy\"> : </span>Obs<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  <span style=\"color: navy\">// </span><span style=\"color: green\">Process the answer first to get access to nested items</span>\r\n  src.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    <span style=\"color: navy\">// </span><span style=\"color: green\">effectiveDateTime from nested item</span>\r\n    answer.item<b> as </b><span style=\"color: maroon\">dtItem</span><b> where </b>linkId = 'datetime'<b> then</b><span style=\"color: navy\"> {\r\n</span>      dtItem.answer<b> as </b><span style=\"color: maroon\">dtAns</span><b> then</b><span style=\"color: navy\"> {\r\n</span>        dtAns.valueDateTime<b> as </b><span style=\"color: maroon\">dt</span><span style=\"color: navy\"><b> -&gt; </b></span>tgt.effectiveDateTime = <span style=\"color: maroon\">dt</span> <i>&quot;SetEffectiveFromDatetime&quot;</i><span style=\"color: navy\">;</span>\r\n      <span style=\"color: navy\">}</span> <i>&quot;ExtractDateTime&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;ProcessDatetime&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">// </span><span style=\"color: green\">Meal context → component[mealContext]</span>\r\n    answer.item<b> as </b><span style=\"color: maroon\">mcItem</span><b> where </b>linkId = 'meal-context'<b> then</b><span style=\"color: navy\"> {\r\n</span>      mcItem.answer<b> as </b><span style=\"color: maroon\">mcAns</span><b> then</b><span style=\"color: navy\"> {\r\n</span>        mcAns.valueCoding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\"><b> -&gt; </b></span> tgt.component<b> as </b><span style=\"color: maroon\">comp</span><span style=\"color: navy\">, </span> comp.code = <b>cc</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'309602000'</span><span style=\"color: navy\">, </span><span style=\"color: blue\">'Temporal periods relating to feeding and eating'</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> comp.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\">cc</span><span style=\"color: navy\">, </span> cc.coding = <span style=\"color: maroon\">coding</span> <i>&quot;SetMealContextCoding&quot;</i><span style=\"color: navy\">;</span>\r\n      <span style=\"color: navy\">}</span> <i>&quot;ExtractCoding&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;ProcessMealContext&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">// </span><span style=\"color: green\">Map the blood glucose value</span>\r\n    answer.valueQuantity<b> as </b><span style=\"color: maroon\">srcQty</span><b> then </b>MapBloodGlucoseQuantity<span style=\"color: navy\">(</span><span style=\"color: maroon\">srcQty</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">tgt</span><span style=\"color: navy\">)</span> <i>&quot;MapValueQuantity&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;ProcessAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>MapBloodGlucoseQuantity<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">srcQty</span><span style=\"color: navy\"> : </span>Quantity, <b>target</b> <span style=\"color: maroon\">tgt</span><span style=\"color: navy\"> : </span>Obs<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  srcQty.value<b> as </b><span style=\"color: maroon\">v</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    v.value<b> as </b><span style=\"color: maroon\">numVal</span><span style=\"color: navy\"><b> -&gt; </b></span> tgt.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Quantity'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">qty</span><span style=\"color: navy\">, </span> qty.value = <span style=\"color: maroon\">numVal</span><span style=\"color: navy\">, </span> qty.unit = <span style=\"color: blue\">'mg/dL'</span><span style=\"color: navy\">, </span> qty.system = <span style=\"color: blue\">'http://unitsofmeasure.org'</span><span style=\"color: navy\">, </span> qty.code = <span style=\"color: blue\">'mg/dL'</span> <i>&quot;SetQuantity&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;ExtractValue&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span></pre></div>"
      },
      "url" : "https://fhir.hl7.at/prenudge/appdata/r4/StructureMap/BloodGlucoseQuestionnaireResponseToObservation",
      "version" : "0.1.0",
      "name" : "BloodGlucoseQuestionnaireResponseToObservation",
      "title" : "Blood Glucose Q to O",
      "status" : "active",
      "date" : "2026-06-18T13:38:50+00:00",
      "publisher" : "The PreNUDGE Consortium",
      "contact" : [
        {
          "name" : "The PreNUDGE Consortium",
          "telecom" : [
            {
              "system" : "url",
              "value" : "https://prenudge.at"
            }
          ]
        },
        {
          "name" : "The PreNUDGE Consortium",
          "telecom" : [
            {
              "system" : "url",
              "value" : "https://prenudge.at",
              "use" : "work"
            }
          ]
        }
      ],
      "description" : "Blood Glucose Q to O",
      "structure" : [
        {
          "url" : "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse",
          "mode" : "source",
          "alias" : "QR"
        },
        {
          "url" : "http://hl7.org/fhir/StructureDefinition/Observation",
          "mode" : "target",
          "alias" : "Obs"
        },
        {
          "url" : "http://hl7.org/fhir/StructureDefinition/Quantity",
          "mode" : "source",
          "alias" : "Quantity"
        }
      ],
      "import" : [
        "http://hl7.org/fhir/StructureMap/*"🔗 ,
        "https://fhir.hl7.at/prenudge/appdata/r4/StructureMap/QuestionnaireResponseToObservationBase"
      ],
      "group" : [
        {
          "name" : "BloodGlucoseQuestionnaireResponseToObservation",
          "typeMode" : "none",
          "input" : [
            {
              "name" : "src",
              "type" : "QR",
              "mode" : "source"
            },
            {
              "name" : "tgt",
              "type" : "Obs",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "Base",
              "source" : [
                {
                  "context" : "src"
                }
              ],
              "dependent" : [
                {
                  "name" : "SetObservationBase",
                  "variable" : [
                    "src",
                    "tgt"
                  ]
                }
              ]
            },
            {
              "name" : "SetProfile",
              "source" : [
                {
                  "context" : "src"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "meta",
                  "variable" : "meta",
                  "transform" : "create",
                  "parameter" : [
                    {
                      "valueString" : "Meta"
                    }
                  ]
                },
                {
                  "context" : "meta",
                  "contextType" : "variable",
                  "element" : "profile",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "https://fhir.hl7.at/prenudge/appdata/r4/StructureDefinition/at-prenudge-bloodglucose-observation"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "SetCode",
              "source" : [
                {
                  "context" : "src"
                }
              ],
              "target" : [
                {
                  "context" : "tgt",
                  "contextType" : "variable",
                  "element" : "code",
                  "transform" : "cc",
                  "parameter" : [
                    {
                      "valueString" : "http://loinc.org"
                    },
                    {
                      "valueString" : "41653-7"
                    },
                    {
                      "valueString" : "Glucose [Mass/volume] in Capillary blood by Glucometer"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "ProcessItem",
              "source" : [
                {
                  "context" : "src",
                  "element" : "item",
                  "variable" : "item",
                  "condition" : "linkId = 'blood-glucose'"
                }
              ],
              "dependent" : [
                {
                  "name" : "MapBloodGlucose",
                  "variable" : [
                    "item",
                    "tgt"
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "MapBloodGlucose",
          "typeMode" : "none",
          "input" : [
            {
              "name" : "src",
              "type" : "QR",
              "mode" : "source"
            },
            {
              "name" : "tgt",
              "type" : "Obs",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "ProcessAnswer",
              "source" : [
                {
                  "context" : "src",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "rule" : [
                {
                  "name" : "ProcessDatetime",
                  "source" : [
                    {
                      "context" : "answer",
                      "element" : "item",
                      "variable" : "dtItem",
                      "condition" : "linkId = 'datetime'"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "ExtractDateTime",
                      "source" : [
                        {
                          "context" : "dtItem",
                          "element" : "answer",
                          "variable" : "dtAns"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "SetEffectiveFromDatetime",
                          "source" : [
                            {
                              "context" : "dtAns",
                              "element" : "valueDateTime",
                              "variable" : "dt"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "tgt",
                              "contextType" : "variable",
                              "element" : "effectiveDateTime",
                              "transform" : "copy",
                              "parameter" : [
                                {
                                  "valueId" : "dt"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "ProcessMealContext",
                  "source" : [
                    {
                      "context" : "answer",
                      "element" : "item",
                      "variable" : "mcItem",
                      "condition" : "linkId = 'meal-context'"
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "ExtractCoding",
                      "source" : [
                        {
                          "context" : "mcItem",
                          "element" : "answer",
                          "variable" : "mcAns"
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "SetMealContextCoding",
                          "source" : [
                            {
                              "context" : "mcAns",
                              "element" : "valueCoding",
                              "variable" : "coding"
                            }
                          ],
                          "target" : [
                            {
                              "context" : "tgt",
                              "contextType" : "variable",
                              "element" : "component",
                              "variable" : "comp"
                            },
                            {
                              "context" : "comp",
                              "contextType" : "variable",
                              "element" : "code",
                              "transform" : "cc",
                              "parameter" : [
                                {
                                  "valueString" : "http://snomed.info/sct"
                                },
                                {
                                  "valueString" : "309602000"
                                },
                                {
                                  "valueString" : "Temporal periods relating to feeding and eating"
                                }
                              ]
                            },
                            {
                              "context" : "comp",
                              "contextType" : "variable",
                              "element" : "value",
                              "variable" : "cc",
                              "transform" : "create",
                              "parameter" : [
                                {
                                  "valueString" : "CodeableConcept"
                                }
                              ]
                            },
                            {
                              "context" : "cc",
                              "contextType" : "variable",
                              "element" : "coding",
                              "transform" : "copy",
                              "parameter" : [
                                {
                                  "valueId" : "coding"
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "name" : "MapValueQuantity",
                  "source" : [
                    {
                      "context" : "answer",
                      "element" : "valueQuantity",
                      "variable" : "srcQty"
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "MapBloodGlucoseQuantity",
                      "variable" : [
                        "srcQty",
                        "tgt"
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "MapBloodGlucoseQuantity",
          "typeMode" : "none",
          "input" : [
            {
              "name" : "srcQty",
              "type" : "Quantity",
              "mode" : "source"
            },
            {
              "name" : "tgt",
              "type" : "Obs",
              "mode" : "target"
            }
          ],
          "rule" : [
            {
              "name" : "ExtractValue",
              "source" : [
                {
                  "context" : "srcQty",
                  "element" : "value",
                  "variable" : "v"
                }
              ],
              "rule" : [
                {
                  "name" : "SetQuantity",
                  "source" : [
                    {
                      "context" : "v",
                      "element" : "value",
                      "variable" : "numVal"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "tgt",
                      "contextType" : "variable",
                      "element" : "value",
                      "variable" : "qty",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Quantity"
                        }
                      ]
                    },
                    {
                      "context" : "qty",
                      "contextType" : "variable",
                      "element" : "value",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "numVal"
                        }
                      ]
                    },
                    {
                      "context" : "qty",
                      "contextType" : "variable",
                      "element" : "unit",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "mg/dL"
                        }
                      ]
                    },
                    {
                      "context" : "qty",
                      "contextType" : "variable",
                      "element" : "system",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://unitsofmeasure.org"
                        }
                      ]
                    },
                    {
                      "context" : "qty",
                      "contextType" : "variable",
                      "element" : "code",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "mg/dL"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }