{
  "resourceType" : "StructureMap",
  "id" : "IMMZ.C4.QRToPatient",
  "text" : {
    "status" : "generated",
    "div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p class=\"res-header-id\"><b>Generated Narrative: StructureMap IMMZ.C4.QRToPatient</b></p><a name=\"IMMZ.C4.QRToPatient\"> </a><a name=\"hcIMMZ.C4.QRToPatient\"> </a><pre class=\"fml\">\r\n<b>map</b><span style=\"color: navy\"> &quot;</span>http://smart.who.int/immunizations/StructureMap/IMMZ.C4.QRToPatient<span style=\"color: navy\">&quot; = &quot;</span>IMMZ.C4.QRToPatient<span style=\"color: navy\">&quot;\r\n\r\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">Immunization Client Registry - Transform QuestionnaireResponse to Patient resources</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>QResp <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"StructureDefinition-IMMZC4.html\" title=\"IMMZ.C4.Create client record\">http://smart.who.int/immunizations/StructureDefinition/IMMZC4</a><span style=\"color: navy\">&quot; </span><b>alias </b>IMMZC <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/bundle.html\" title=\"Bundle\">http://hl7.org/fhir/StructureDefinition/Bundle</a><span style=\"color: navy\">&quot; </span><b>alias </b>Bundle <b>as </b><b>target</b>\r\n\r\n<b>imports</b><span style=\"color: navy\"> &quot;</span><a href=\"StructureMap-IMMZ.C4.QRToLM.html\" title=\"IMMZ.C4.QRToLM\">http://smart.who.int/immunizations/StructureMap/IMMZ.C4.QRToLM</a><span style=\"color: navy\">&quot;\r\n</span><b>imports</b><span style=\"color: navy\"> &quot;</span><a href=\"StructureMap-IMMZ.C4.LMToPatient.html\" title=\"IMMZ.C4.LMToPatient\">http://smart.who.int/immunizations/StructureMap/IMMZ.C4.LMToPatient</a><span style=\"color: navy\">&quot;\r\n</span>\r\n<b>group </b>QRespToPatient<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">qr</span><span style=\"color: navy\"> : </span>QResp, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  qr<span style=\"color: navy\"><b> -&gt; </b></span><b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'http://smart.who.int/immunizations/StructureDefinition/IMMZC4'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">model</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    qr<span style=\"color: navy\"><b> -&gt; </b></span>model<b> then </b>QRespToIMMZC<span style=\"color: navy\">(</span><span style=\"color: maroon\">qr</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">model</span><span style=\"color: navy\">)</span> <i>&quot;QRtoLM&quot;</i><span style=\"color: navy\">;</span>\r\n    qr<span style=\"color: navy\"><b> -&gt; </b></span>bundle<b> then </b>IMMZCToPatient<span style=\"color: navy\">(</span><span style=\"color: maroon\">model</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>&quot;LMtoPatient&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;QRtoPatient&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span></pre></div>"
  },
  "url" : "http://smart.who.int/immunizations/StructureMap/IMMZ.C4.QRToPatient",
  "version" : "0.2.0",
  "name" : "IMMZ.C4.QRToPatient",
  "status" : "draft",
  "date" : "2025-07-23T20:56:04+00:00",
  "publisher" : "WHO",
  "contact" : [{
    "name" : "WHO",
    "telecom" : [{
      "system" : "url",
      "value" : "http://who.int"
    }]
  }],
  "description" : "Immunization Client Registry - Transform QuestionnaireResponse to Patient resources",
  "structure" : [{
    "url" : "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse",
    "mode" : "source",
    "alias" : "QResp"
  },
  {
    "url" : "http://smart.who.int/immunizations/StructureDefinition/IMMZC4",
    "mode" : "source",
    "alias" : "IMMZC"
  },
  {
    "url" : "http://hl7.org/fhir/StructureDefinition/Bundle",
    "mode" : "target",
    "alias" : "Bundle"
  }],
  "import" : ["http://smart.who.int/immunizations/StructureMap/IMMZ.C4.QRToLM",
  "http://smart.who.int/immunizations/StructureMap/IMMZ.C4.LMToPatient"],
  "group" : [{
    "name" : "QRespToPatient",
    "typeMode" : "none",
    "input" : [{
      "name" : "qr",
      "type" : "QResp",
      "mode" : "source"
    },
    {
      "name" : "bundle",
      "type" : "Bundle",
      "mode" : "target"
    }],
    "rule" : [{
      "name" : "QRtoPatient",
      "source" : [{
        "context" : "qr"
      }],
      "target" : [{
        "contextType" : "variable",
        "variable" : "model",
        "transform" : "create",
        "parameter" : [{
          "valueString" : "http://smart.who.int/immunizations/StructureDefinition/IMMZC4"
        }]
      }],
      "rule" : [{
        "name" : "QRtoLM",
        "source" : [{
          "context" : "qr"
        }],
        "target" : [{
          "context" : "model",
          "contextType" : "variable"
        }],
        "dependent" : [{
          "name" : "QRespToIMMZC",
          "variable" : ["qr",
          "model"]
        }]
      },
      {
        "name" : "LMtoPatient",
        "source" : [{
          "context" : "qr"
        }],
        "target" : [{
          "context" : "bundle",
          "contextType" : "variable"
        }],
        "dependent" : [{
          "name" : "IMMZCToPatient",
          "variable" : ["model",
          "bundle"]
        }]
      }]
    }]
  }]
}