{
  "resourceType" : "StructureMap",
  "resourceDefinition" : "http://hl7.org/fhir/StructureDefinition/StructureMap|0.1.0",
  "text" : {
    "status" : "generated",
    "div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p class=\"res-header-id\"><b>Generated Narrative: StructureMap TransformReference</b></p><a name=\"TransformReference\"> </a><a name=\"hcTransformReference\"> </a><p><b>url</b>: <a href=\"http://hl7.org/fhir/uv/fml/StructureMap/TransformReference\">http://hl7.org/fhir/uv/fml/StructureMap/TransformReference</a></p><p><b>name</b>: TransformReference</p><p><b>status</b>: Active</p><p><b>description</b>: </p><div><p>Example demonstrating the reference transform to generate a resource reference</p>\n</div><blockquote><p><b>structure</b></p><p><b>url</b>: <a href=\"http://hl7.org/fhir/R5/patient.html\">Patient</a></p><p><b>mode</b>: Source Structure Definition</p></blockquote><blockquote><p><b>structure</b></p><p><b>url</b>: <a href=\"http://hl7.org/fhir/R5/bundle.html\">Bundle</a></p><p><b>mode</b>: Target Structure Definition</p></blockquote><blockquote><p><b>structure</b></p><p><b>url</b>: <a href=\"http://hl7.org/fhir/R5/encounter.html\">Encounter</a></p><p><b>mode</b>: Produced Structure Definition</p></blockquote><blockquote><p><b>group</b></p><p><b>name</b>: TransformReference</p><blockquote><p><b>input</b></p><p><b>mode</b>: Source Instance</p><p><b>name</b>: src</p><p><b>type</b>: Patient</p></blockquote><blockquote><p><b>input</b></p><p><b>mode</b>: Target Instance</p><p><b>name</b>: tgt</p><p><b>type</b>: Bundle</p></blockquote><blockquote><p><b>rule</b></p><h3>Sources</h3><table class=\"grid\"><tr><td style=\"display: none\">-</td><td><b>Context</b></td></tr><tr><td style=\"display: none\">*</td><td>src</td></tr></table><blockquote><p><b>target</b></p><p><b>transform</b>: create</p><h3>Parameters</h3><table class=\"grid\"><tr><td style=\"display: none\">-</td><td><b>Value[x]</b></td></tr><tr><td style=\"display: none\">*</td><td>Encounter</td></tr></table><p><b>variable</b>: enc</p></blockquote><blockquote><p><b>target</b></p><p><b>context</b>: tgt</p><p><b>element</b>: entry</p><p><b>variable</b>: entry</p></blockquote><blockquote><p><b>rule</b></p><h3>Sources</h3><table class=\"grid\"><tr><td style=\"display: none\">-</td><td><b>Context</b></td></tr><tr><td style=\"display: none\">*</td><td>src</td></tr></table><blockquote><p><b>target</b></p><p><b>context</b>: entry</p><p><b>element</b>: resource</p><p><b>transform</b>: copy</p><h3>Parameters</h3><table class=\"grid\"><tr><td style=\"display: none\">-</td><td><b>Value[x]</b></td></tr><tr><td style=\"display: none\">*</td><td>enc</td></tr></table></blockquote><p><b>name</b>: r1</p></blockquote><blockquote><p><b>rule</b></p><h3>Sources</h3><table class=\"grid\"><tr><td style=\"display: none\">-</td><td><b>Context</b></td><td><b>Element</b></td><td><b>Variable</b></td></tr><tr><td style=\"display: none\">*</td><td>src</td><td>id</td><td>v</td></tr></table><blockquote><p><b>target</b></p><p><b>context</b>: enc</p><p><b>element</b>: subject</p><p><b>transform</b>: reference</p><h3>Parameters</h3><table class=\"grid\"><tr><td style=\"display: none\">-</td><td><b>Value[x]</b></td></tr><tr><td style=\"display: none\">*</td><td>src</td></tr></table></blockquote><p><b>name</b>: r2</p></blockquote><p><b>name</b>: referenceTest</p></blockquote></blockquote></div>"
  },
  "url" : "http://hl7.org/fhir/uv/fml/StructureMap/TransformReference",
  "name" : "TransformReference",
  "status" : "active",
  "description" : "Example demonstrating the reference transform to generate a resource reference",
  "structure" : [{
    "url" : "http://hl7.org/fhir/StructureDefinition/Patient",
    "mode" : "source"
  },
  {
    "url" : "http://hl7.org/fhir/StructureDefinition/Bundle",
    "mode" : "target"
  },
  {
    "url" : "http://hl7.org/fhir/StructureDefinition/Encounter",
    "mode" : "produced"
  }],
  "group" : [{
    "name" : "TransformReference",
    "input" : [{
      "mode" : "source",
      "name" : "src",
      "type" : "Patient"
    },
    {
      "mode" : "target",
      "name" : "tgt",
      "type" : "Bundle"
    }],
    "rule" : [{
      "source" : [{
        "context" : "src"
      }],
      "target" : [{
        "transform" : "create",
        "parameter" : [{
          "valueString" : "Encounter"
        }],
        "variable" : "enc"
      },
      {
        "context" : "tgt",
        "element" : ["entry"],
        "variable" : "entry"
      }],
      "rule" : [{
        "source" : [{
          "context" : "src"
        }],
        "target" : [{
          "context" : "entry",
          "element" : ["resource"],
          "transform" : "copy",
          "parameter" : [{
            "valueId" : "enc"
          }]
        }],
        "name" : "r1"
      },
      {
        "source" : [{
          "context" : "src",
          "element" : ["id"],
          "variable" : "v"
        }],
        "target" : [{
          "context" : "enc",
          "element" : ["subject"],
          "transform" : "reference",
          "parameter" : [{
            "valueId" : "src"
          }]
        }],
        "name" : "r2"
      }],
      "name" : "referenceTest"
    }]
  }],
  "id" : "TransformReference"
}