Release 5 Ballot

This page is part of the FHIR Specification (v5.0.0-ballot: FHIR R5 Ballot Preview). The current version which supercedes this version is 5.0.0. For a full list of available versions, see the Directory of published versions . Page versions: R5 R4B R4 R3

Example StructureMap/supplyrequest-transform (XML)

FHIR Infrastructure Work GroupMaturity Level: N/AStandards Status: InformativeCompartments: Not linked to any defined compartments

Raw XML (canonical form + also see XML Format Specification)

Jump past Narrative

Transforms an ActivityDefinition to a SupplyRequest (id = "supplyrequest-transform")

<?xml version="1.0" encoding="UTF-8"?>

<StructureMap xmlns="http://hl7.org/fhir">
  <id value="supplyrequest-transform"/> 
  <text> 
    <status value="generated"/> 
    <div xmlns="http://www.w3.org/1999/xhtml">
map &quot;http://hl7.org/fhir/StructureMap/supplyrequest-transform&quot; = supplyRequestTransform

uses &quot;http://hl7.org/fhir/StructureDefinition/ActivityDefinition&quot; as source
uses &quot;http://hl7.org/fhir/StructureDefinition/SupplyRequest&quot; as target

group main
  input &quot;source&quot;: ActivityDefinition as source
  input &quot;target&quot;: SupplyRequest as target

  &quot;status&quot;: for source.id make target.status = 'draft'
  &quot;category&quot;: for source.id make target.category = 'non-stock'
  &quot;priority&quot;: for source.id make target.priority = 'routine'
  &quot;quantity&quot;: for source.quantity make target.orderedItem.quantity
  &quot;item&quot;: for source.code make target.orderedItem.itemCodeableConcept
  &quot;when&quot;: for source.id make target.occurrenceDateTime = Now()
  &quot;authoredOn&quot;: for source.id make target.authoredOn = Now()
    </div> 
  </text> 
  <url value="http://hl7.org/fhir/StructureMap/supplyrequest-transform"/> 
  <identifier> 
    <system value="urn:ietf:rfc:3986"/> 
    <value value="urn:oid:2.16.840.1.113883.4.642.13.1"/> 
  </identifier> 
  <name value="Transform from an ActivityDefinition to a SupplyRequest"/> 
  <status value="draft"/> 
  <structure> 
  <url value="http://hl7.org/fhir/StructureDefinition/activitydefinition"/> 
  <mode value="source"/> 
  </structure> 
  <structure> 
  <url value="http://hl7.org/fhir/StructureDefinition/supplyrequest"/> 
  <mode value="target"/> 
  </structure> 
  <group> 
    <name value="main"/> 
    <input> 
      <name value="source"/> 
      <type value="ActivityDefinition"/> 
      <mode value="source"/> 
    </input>   
    <input> 
    <name value="target"/> 
      <type value="SupplyRequest"/> 
      <mode value="target"/> 
  </input> 
    <rule> 
      <name value="status"/> 
      <source> 
        <context value="source"/> 
        <element value="id"/> 
        <variable value="a"/> 
      </source> 
      <target> 
        <context value="target"/> 
        <element value="status"/> 
        <transform value="evaluate"/> 
        <parameter> 
          <valueString value="'draft'"/> 
        </parameter> 
      </target> 
    </rule> 
    <rule> 
      <name value="category"/> 
      <source> 
        <context value="source"/> 
        <element value="id"/> 
        <variable value="a"/> 
      </source> 
      <target> 
        <context value="target"/> 
        <element value="category"/> 
        <transform value="evaluate"/> 
        <parameter> 
          <valueString value="'non-stock'"/> 
        </parameter> 
      </target> 
    </rule> 
    <rule> 
      <name value="priority"/> 
      <source> 
        <context value="source"/> 
        <element value="id"/> 
        <variable value="a"/> 
      </source> 
      <target> 
        <context value="target"/> 
        <element value="priority"/> 
        <transform value="evaluate"/> 
        <parameter> 
          <valueString value="'routine'"/> 
        </parameter> 
      </target> 
    </rule> 
    <rule> 
      <name value="quantity"/> 
      <source> 
        <context value="source"/> 
        <element value="quantity"/> 
        <variable value="a"/> 
      </source> 
      <target> 
        <context value="target"/> 
        <element value="category"/> 
        <transform value="copy"/> 
      </target> 
    </rule> 
    <rule> 
      <name value="item"/> 
      <source> 
        <context value="source"/> 
        <element value="code"/> 
        <variable value="a"/> 
      </source> 
      <target> 
        <context value="target"/> 
        <element value="orderedItem.itemCodeableConcept"/> 
        <transform value="copy"/> 
      </target> 
    </rule> 
    <rule> 
      <name value="when"/> 
      <source> 
        <context value="source"/> 
        <element value="id"/> 
        <variable value="a"/> 
      </source> 
      <target> 
        <context value="target"/> 
        <element value="occurrenceDateTime"/> 
        <transform value="evaluate"/> 
        <parameter> 
          <valueString value="now()"/> 
        </parameter> 
      </target> 
    </rule> 
    <rule> 
      <name value="authoredOn"/> 
      <source> 
        <context value="source"/> 
        <element value="id"/> 
        <variable value="a"/> 
      </source> 
      <target> 
        <context value="target"/> 
        <element value="authoredOn"/> 
        <transform value="evaluate"/> 
        <parameter> 
          <valueString value="now()"/> 
        </parameter> 
      </target> 
    </rule> 
  </group> 
  
</StructureMap> 

Usage note: every effort has been made to ensure that the examples are correct and useful, but they are not a normative part of the specification.