CH RAD-Order (R4)
0.1.0 - STU 1 Ballot

CH RAD-Order (R4), published by HL7 Switzerland. This is not an authorized publication; it is the continuous build for version 0.1.0). This version is based on the current content of https://github.com/hl7ch/ch-rad-order/ and changes regularly. See the Directory of published versions

: RadOrderQrToBundle - XML Representation

Raw xml | Download



<StructureMap xmlns="http://hl7.org/fhir">
  <id value="RadOrderQrToBundle"/>
  <meta>
    <versionId value="4"/>
    <lastUpdated value="2022-01-03T15:58:34.931+00:00"/>
  </meta>
  <text>
    <status value="generated"/>
    <div xmlns="http://www.w3.org/1999/xhtml">
         <pre>map &quot;http://fhir.ch/ig/ch-rad-order/StructureMap/RadOrderQrToBundle&quot; = &quot;RadOrderQrToBundle&quot;

// Radiologoy QuestionnaireResponse to Bundle

uses &quot;http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse&quot; alias QuestionnaireResponse as source
uses &quot;http://hl7.org/fhir/StructureDefinition/Bundle&quot; alias Bundle as target
uses &quot;http://hl7.org/fhir/StructureDefinition/Patient&quot; alias Patient as target
uses &quot;http://hl7.org/fhir/StructureDefinition/Organization&quot; alias Organization as target
uses &quot;http://hl7.org/fhir/StructureDefinition/Practitioner&quot; alias Practitioner as target
uses &quot;http://hl7.org/fhir/StructureDefinition/PractitionerRole&quot; alias PractitionerRole as target
uses &quot;http://hl7.org/fhir/StructureDefinition/ServiceRequest&quot; alias ServiceRequest as target
uses &quot;http://hl7.org/fhir/StructureDefinition/BackboneElement&quot; alias BackboneElement as target

imports &quot;http://fhir.ch/ig/ch-orf/StructureMap/OrfQrToBundle&quot;

group RadOrderQrToBundle(source qr : QuestionnaireResponse, target bundle : Bundle) {
  qr -&gt;  bundle.identifier as documentIdentifier,  documentIdentifier.system = 'urn:ietf:rfc:3986',  uuid() as uuidDoc,  documentIdentifier.value = ('urn:uuid:' + uuidDoc) &quot;documentIdentifier&quot;;
  qr as qrcp -&gt;  bundle.entry as e,  e.resource = create('Composition') as composition,  composition.id = uuid() as uuid,  e.fullUrl = ('urn:uuid:' + uuid),  bundle.entry as e2,  bundle.timestamp = (now()) as timestamp,  composition.date = timestamp,  e2.resource = create('Patient') as patient,  patient.id = uuid() as uuid2,  e2.fullUrl = ('urn:uuid:' + uuid2),  bundle.entry as e4,  e4.resource = qrcp as questionnaireresp,  questionnaireresp.id = uuid() as uuid4,  e4.fullUrl = ('urn:uuid:' + uuid4),  bundle.entry as e5,  e5.resource = create('ServiceRequest') as servicerequest,  servicerequest.id = uuid() as uuid5,  e5.fullUrl = ('urn:uuid:' + uuid5) then {
    qr.questionnaire as can -&gt;  bundle.entry as e6,  e6.resource = (can.resolve()) as q,  q.id = uuid() as uuid6,  e6.fullUrl = append('urn:uuid:', uuid6) then QrToBundle(qr, q, patient, questionnaireresp, servicerequest, composition, bundle) &quot;orfbundle&quot;;
    qr then RadOrderQrToServiceRequest(qr, patient, bundle, composition, servicerequest) &quot;servicerequest&quot;;
  } &quot;orfbundle&quot;;
}

group RadOrderQrToServiceRequest(source qr : QuestionnaireResponse, target patient : Patient, target bundle : Bundle, target composition : Composition, target serviceRequest : ServiceRequest) {
  qr.item as grp where linkId = 'requestedService' then RequestedServiceItems(grp, serviceRequest) &quot;requestedService&quot;;
  qr.item as grp where linkId = 'reason' then ReasonServiceItems(grp, serviceRequest) &quot;reason&quot;;
  qr.item as grp where linkId = 'imagingService' then ImagingServiceItems(grp, serviceRequest) &quot;imagingService&quot;;
  qr.item as grp where linkId = 'orderDetail' then OrderDetailServiceItems(grp, serviceRequest) &quot;orderDetail&quot;;
  qr.item as grp where linkId = 'desiredRadiologist' then DesiredRadiologistServiceItems(grp, bundle, serviceRequest) &quot;desiredRadiologist&quot;;
  qr.item as grp where linkId = 'diagnosisList' then DiagnosisListServiceItems(grp, patient, bundle, serviceRequest) &quot;diagnosisList&quot;;
  qr.item as grp where linkId = 'caveat' then CaveatServiceItems(grp, patient, bundle, serviceRequest) &quot;Caveat&quot;;
  qr.item as grp where linkId = 'previousResults' then PreviousImagingStudyResults(grp, bundle, serviceRequest, patient) &quot;previousResults&quot;;
}

group RequestedServiceItems(source src : BackboneElement, target serviceRequest : ServiceRequest) {
  src.item as item where ((linkId.value = 'requestedService.service') and answer.exists()) then {
    item.answer as answer then {
      answer.value : Coding as coding -&gt;  serviceRequest.category as cc,  cc.coding = coding &quot;service&quot;;
    } &quot;valueCoding&quot;;
  } &quot;answer&quot;;
}

group ReasonServiceItems(source src : BackboneElement, target serviceRequest : ServiceRequest) {
  src.item as item where ((linkId.value = 'reason.question') and answer.exists()) then {
    item.answer as answer then {
      answer.value : string as value -&gt;  serviceRequest.reasonCode as reasonCode,  reasonCode.text = value &quot;question&quot;;
    } &quot;valueString&quot;;
  } &quot;answer&quot;;
}

group ImagingServiceItems(source src : BackboneElement, target serviceRequest : ServiceRequest) {
  src.item as item where ((linkId.value = 'imagingService.type') and answer.exists()) then {
    item.answer as answer then {
      answer.value : Coding as coding -&gt;  serviceRequest.code as code,  code.coding = coding &quot;service&quot;;
    } &quot;valueCoding&quot;;
  } &quot;answer&quot;;
}

group OrderDetailServiceItems(source src : BackboneElement, target serviceRequest : ServiceRequest) {
  src.item as item where ((linkId.value = 'orderDetail.imagingRegion') and answer.exists()) then {
    item.answer as answer then {
      answer.value : Coding as coding -&gt;  serviceRequest.orderDetail as cc,  cc.extension as ext,  ext.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-order-detail-type',  ext.value = create('Coding') as coding,  coding.system = 'http://fhir.ch/ig/ch-rad-order/CodeSystem/ch-rad-order-order-detail-type',  coding.code = 'imagingRegion',  cc.coding = coding &quot;imagingRegion&quot;;
    } &quot;valueCoding&quot;;
  } &quot;answer&quot;;
  src.item as item where ((linkId.value = 'orderDetail.imagingFocus') and answer.exists()) then {
    item.answer as answer then {
      answer.value : Coding as coding -&gt;  serviceRequest.bodySite as cc,  cc.coding = coding &quot;imagingFocus&quot;;
    } &quot;valueCoding&quot;;
  } &quot;answer&quot;;
  src.item as item where ((linkId.value = 'orderDetail.laterality') and answer.exists()) then {
    item.answer as answer then {
      answer.value : Coding as coding -&gt;  serviceRequest.orderDetail as cc,  cc.extension as ext,  ext.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-order-detail-type',  ext.value = create('Coding') as coding,  coding.system = 'http://fhir.ch/ig/ch-rad-order/CodeSystem/ch-rad-order-order-detail-type',  coding.code = 'laterality',  cc.coding = coding &quot;laterality&quot;;
    } &quot;valueCoding&quot;;
  } &quot;answer&quot;;
  src.item as item where ((linkId.value = 'orderDetail.viewType') and answer.exists()) then {
    item.answer as answer then {
      answer.value : Coding as coding -&gt;  serviceRequest.orderDetail as cc,  cc.extension as ext,  ext.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-order-detail-type',  ext.value = create('Coding') as coding,  coding.system = 'http://fhir.ch/ig/ch-rad-order/CodeSystem/ch-rad-order-order-detail-type',  coding.code = 'viewType',  cc.coding = coding &quot;viewType&quot;;
    } &quot;valueCoding&quot;;
  } &quot;answer&quot;;
  src.item as item where ((linkId.value = 'orderDetail.maneuverType') and answer.exists()) then {
    item.answer as answer then {
      answer.value : Coding as coding -&gt;  serviceRequest.orderDetail as cc,  cc.extension as ext,  ext.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-order-detail-type',  ext.value = create('Coding') as coding,  coding.system = 'http://fhir.ch/ig/ch-rad-order/CodeSystem/ch-rad-order-order-detail-type',  coding.code = 'maneuverType',  cc.coding = coding &quot;maneuverType&quot;;
    } &quot;valueCoding&quot;;
  } &quot;answer&quot;;
  src.item as item where ((linkId.value = 'orderDetail.guidanceForAction') and answer.exists()) then {
    item.answer as answer then {
      answer.value : Coding as coding -&gt;  serviceRequest.orderDetail as cc,  cc.extension as ext,  ext.url = 'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-order-detail-type',  ext.value = create('Coding') as coding,  coding.system = 'http://fhir.ch/ig/ch-rad-order/CodeSystem/ch-rad-order-order-detail-type',  coding.code = 'guidanceForAction',  cc.coding = coding &quot;guidanceForAction&quot;;
    } &quot;valueCoding&quot;;
  } &quot;answer&quot;;
}

group DesiredRadiologistServiceItems(source src : BackboneElement, target bundle : Bundle, target serviceRequest : ServiceRequest) {
  src -&gt;  bundle.entry as e,  e.resource = create('Practitioner') as practitioner,  practitioner.id = uuid() as uuid,  serviceRequest.performer as performer,  performer.reference = ('urn:uuid:' + uuid),  e.fullUrl = ('urn:uuid:' + uuid) then {
    src.item as item where ((linkId.value = 'desiredRadiologist.familyName') and answer.exists()) -&gt;  practitioner.name as name share name,  name.family = (item.answer.value);
    src.item as item where ((linkId.value = 'desiredRadiologist.givenName') and answer.exists()) -&gt;  practitioner.name as name share name,  name.given = (item.answer.value);
  } &quot;performer&quot;;
}

group DiagnosisListServiceItems(source src : BackboneElement, target patient : Patient, target bundle : Bundle, target serviceRequest : ServiceRequest) {
  src.item as item where ((linkId.value = 'diagnosisList.secondaryDiagnosis') and answer.exists()) then {
    item.answer as answer then {
      answer.value : string as value -&gt;  bundle.entry as e,  e.resource = create('Condition') as condition,  condition.id = uuid() as uuid,  e.fullUrl = ('urn:uuid:' + uuid),  serviceRequest.supportingInfo as supportingInfo,  supportingInfo.reference = ('urn:uuid:' + uuid),  condition.category as category,  category.coding as coding,  coding.code = 'problem-list-item',  coding.system = 'http://terminology.hl7.org/CodeSystem/condition-category',  coding.display = 'Problem List Item',  condition.code as code,  code.text = value,  condition.subject as subject,  subject.reference = ('urn:uuid:' + patient.id) &quot;secondaryDiagnosis&quot;;
    } &quot;valueString&quot;;
  } &quot;answer&quot;;
}

group CaveatServiceItems(source src : BackboneElement, target patient : Patient, target bundle : Bundle, target serviceRequest : ServiceRequest) {
  src.item as item where ((linkId.value = 'caveat.bloodCoagulation') and answer.exists()) then {
    item.answer as answer then {
      answer.value : boolean as value where answer.valueBoolean -&gt;  bundle.entry as e,  e.resource = create('Condition') as condition,  condition.id = uuid() as uuid,  e.fullUrl = ('urn:uuid:' + uuid),  serviceRequest.supportingInfo as supportingInfo,  supportingInfo.reference = ('urn:uuid:' + uuid),  condition.category as category,  category.coding as coding,  coding.code = 'problem-list-item',  coding.system = 'http://terminology.hl7.org/CodeSystem/condition-category',  coding.display = 'Problem List Item',  condition.code as code,  code.coding as coding2,  coding2.code = '64779008',  coding2.system = 'http://snomed.info/sct',  coding2.display = 'Blood coagulation disorder (disorder)',  condition.subject as subject,  subject.reference = ('urn:uuid:' + patient.id) &quot;bloodCoagulation&quot;;
    } &quot;valueString&quot;;
  } &quot;answer&quot;;
  src.item as item where ((linkId.value = 'caveat.renalInsufficiency') and answer.exists()) then {
    item.answer as answer then {
      answer.value : boolean as value where answer.valueBoolean -&gt;  bundle.entry as e,  e.resource = create('Condition') as condition,  condition.id = uuid() as uuid,  e.fullUrl = ('urn:uuid:' + uuid),  serviceRequest.supportingInfo as supportingInfo,  supportingInfo.reference = ('urn:uuid:' + uuid),  condition.category as category,  category.coding as coding,  coding.code = 'problem-list-item',  coding.system = 'http://terminology.hl7.org/CodeSystem/condition-category',  coding.display = 'Problem List Item',  condition.code as code,  code.coding as coding2,  coding2.code = '723188008',  coding2.system = 'http://snomed.info/sct',  coding2.display = 'Renal insufficiency (disorder)',  condition.subject as subject,  subject.reference = ('urn:uuid:' + patient.id) then {
        // FIXME TODO answer.item as item2 where (linkId.value = 'caveat.renalInsufficiency.creatinineClearance') then RenalInsufficiencyCreatinineServiceItems(item2, patient, bundle, serviceRequest, condition) &quot;RenalInsufficiencyCreatinineServiceItems&quot;;
        answer.item as item2 where (linkId.value = 'caveat.renalInsufficiency.creatinine') then RenalInsufficiencyCreatinineServiceItems(item2, patient, bundle, serviceRequest, condition) &quot;RenalInsufficiencyCreatinineServiceItems&quot;;
      } &quot;renalInsufficiency&quot;;
    } &quot;valueString&quot;;
  } &quot;answer&quot;;
  src.item as item where ((linkId.value = 'caveat.claustrophobia') and answer.exists()) then {
    item.answer as answer then {
      answer.value : boolean as value where answer.valueBoolean -&gt;  bundle.entry as e,  e.resource = create('Condition') as condition,  condition.id = uuid() as uuid,  e.fullUrl = ('urn:uuid:' + uuid),  serviceRequest.supportingInfo as supportingInfo,  supportingInfo.reference = ('urn:uuid:' + uuid),  condition.category as category,  category.coding as coding,  coding.code = 'problem-list-item',  coding.system = 'http://terminology.hl7.org/CodeSystem/condition-category',  coding.display = 'Problem List Item',  condition.code as code,  code.coding as coding2,  coding2.code = '19887002',  coding2.system = 'http://snomed.info/sct',  coding2.display = 'Claustrophobia (finding)',  condition.subject as subject,  subject.reference = ('urn:uuid:' + patient.id) &quot;claustrophobia&quot;;
    } &quot;valueString&quot;;
  } &quot;answer&quot;;
  src.item as item where ((linkId.value = 'caveat.bodyPiercing') and answer.exists()) then {
    item.answer as answer then {
      answer.value : boolean as value where answer.valueBoolean -&gt;  bundle.entry as e,  e.resource = create('Condition') as condition,  condition.id = uuid() as uuid,  e.fullUrl = ('urn:uuid:' + uuid),  serviceRequest.supportingInfo as supportingInfo,  supportingInfo.reference = ('urn:uuid:' + uuid),  condition.category as category,  category.coding as coding,  coding.code = 'problem-list-item',  coding.system = 'http://terminology.hl7.org/CodeSystem/condition-category',  coding.display = 'Problem List Item',  condition.code as code,  code.coding as coding2,  coding2.code = '879862001',  coding2.system = 'http://snomed.info/sct',  coding2.display = 'Body piercing (finding)',  condition.subject as subject,  subject.reference = ('urn:uuid:' + patient.id) &quot;bodyPiercing&quot;;
    } &quot;valueString&quot;;
  } &quot;answer&quot;;
  src.item as item where ((linkId.value = 'caveat.device') and answer.exists()) then {
    item.answer as answer then {
      answer.value : string as value -&gt;  bundle.entry as e,  e.resource = create('Condition') as condition,  condition.id = uuid() as uuid,  e.fullUrl = ('urn:uuid:' + uuid),  serviceRequest.supportingInfo as supportingInfo,  supportingInfo.reference = ('urn:uuid:' + uuid),  condition.category as category,  category.coding as coding,  coding.code = 'problem-list-item',  coding.system = 'http://terminology.hl7.org/CodeSystem/condition-category',  coding.display = 'Problem List Item',  condition.code as code,  code.coding as coding2,  coding2.code = '397578001',  coding2.system = 'http://snomed.info/sct',  coding2.display = 'Device in situ (finding)',  condition.subject as subject,  subject.reference = ('urn:uuid:' + patient.id),  condition.note as note,  note.text = value &quot;device&quot;;
    } &quot;valueString&quot;;
  } &quot;answer&quot;;
  src.item as item where ((linkId.value = 'caveat.hyperthyroidism') and answer.exists()) then {
    item.answer as answer then {
      answer.value : boolean as value where answer.valueBoolean -&gt;  bundle.entry as e,  e.resource = create('Condition') as condition,  condition.id = uuid() as uuid,  e.fullUrl = ('urn:uuid:' + uuid),  serviceRequest.supportingInfo as supportingInfo,  supportingInfo.reference = ('urn:uuid:' + uuid),  condition.category as category,  category.coding as coding,  coding.code = 'problem-list-item',  coding.system = 'http://terminology.hl7.org/CodeSystem/condition-category',  coding.display = 'Problem List Item',  condition.code as code,  code.coding as coding2,  coding2.code = '34486009',  coding2.system = 'http://snomed.info/sct',  coding2.display = 'Hyperthyroidism (disorder)',  condition.subject as subject,  subject.reference = ('urn:uuid:' + patient.id) &quot;hyperthyroidism&quot;;
    } &quot;valueString&quot;;
  } &quot;answer&quot;;
  src.item as item where ((linkId.value = 'caveat.diabetes') and answer.exists()) then {
    item.answer as answer then {
      answer.value : boolean as value where answer.valueBoolean -&gt;  bundle.entry as e,  e.resource = create('Condition') as condition,  condition.id = uuid() as uuid,  e.fullUrl = ('urn:uuid:' + uuid),  serviceRequest.supportingInfo as supportingInfo,  supportingInfo.reference = ('urn:uuid:' + uuid),  condition.category as category,  category.coding as coding,  coding.code = 'problem-list-item',  coding.system = 'http://terminology.hl7.org/CodeSystem/condition-category',  coding.display = 'Problem List Item',  condition.code as code,  code.coding as coding2,  coding2.code = '73211009',  coding2.system = 'http://snomed.info/sct',  coding2.display = 'Diabetes mellitus (disorder)',  condition.subject as subject,  subject.reference = ('urn:uuid:' + patient.id) &quot;diabetes&quot;;
    } &quot;valueString&quot;;
  } &quot;answer&quot;;
  src.item as item where ((linkId.value = 'caveat.gravida') and answer.exists()) then {
    item.answer as answer then {
      answer.value : boolean as value where answer.valueBoolean -&gt;  bundle.entry as e,  e.resource = create('Condition') as condition,  condition.id = uuid() as uuid,  e.fullUrl = ('urn:uuid:' + uuid),  serviceRequest.supportingInfo as supportingInfo,  supportingInfo.reference = ('urn:uuid:' + uuid),  condition.category as category,  category.coding as coding,  coding.code = 'problem-list-item',  coding.system = 'http://terminology.hl7.org/CodeSystem/condition-category',  coding.display = 'Problem List Item',  condition.code as code,  code.coding as coding2,  coding2.code = '366321006',  coding2.system = 'http://snomed.info/sct',  coding2.display = 'Finding of gravida (finding)',  condition.subject as subject,  subject.reference = ('urn:uuid:' + patient.id) &quot;gravida&quot;;
    } &quot;valueString&quot;;
  } &quot;answer&quot;;
  src.item as item where ((linkId.value = 'caveat.contrastMediaAllergy') and answer.exists()) then {
    item.answer as answer then {
      answer.value : boolean as value where answer.valueBoolean -&gt;  bundle.entry as e,  e.resource = create('Condition') as condition,  condition.id = uuid() as uuid,  e.fullUrl = ('urn:uuid:' + uuid),  serviceRequest.supportingInfo as supportingInfo,  supportingInfo.reference = ('urn:uuid:' + uuid),  condition.category as category,  category.coding as coding,  coding.code = 'problem-list-item',  coding.system = 'http://terminology.hl7.org/CodeSystem/condition-category',  coding.display = 'Problem List Item',  condition.code as code,  code.coding as coding2,  coding2.code = '293637006',  coding2.system = 'http://snomed.info/sct',  coding2.display = 'Allergy to contrast media (finding)',  condition.subject as subject,  subject.reference = ('urn:uuid:' + patient.id) &quot;contrastMediaAllergy&quot;;
    } &quot;valueString&quot;;
  } &quot;answer&quot;;
  src.item as item where ((linkId.value = 'caveat.drugPrescription') and answer.exists()) then {
    item.answer as answer then {
      answer.value : string as value -&gt;  bundle.entry as e,  e.resource = create('Condition') as condition,  condition.id = uuid() as uuid,  e.fullUrl = ('urn:uuid:' + uuid),  serviceRequest.supportingInfo as supportingInfo,  supportingInfo.reference = ('urn:uuid:' + uuid),  condition.category as category,  category.coding as coding,  coding.code = 'problem-list-item',  coding.system = 'http://terminology.hl7.org/CodeSystem/condition-category',  coding.display = 'Problem List Item',  condition.code as code,  code.coding as coding2,  coding2.code = '182817000',  coding2.system = 'http://snomed.info/sct',  coding2.display = 'Drug prescription (situation)',  condition.subject as subject,  subject.reference = ('urn:uuid:' + patient.id),  condition.note as note,  note.text = value &quot;drugPrescription&quot;;
    } &quot;valueString&quot;;
  } &quot;answer&quot;;
}

group RenalInsufficiencyCreatinineServiceItems(source src : BackboneElement, target patient : Patient, target bundle : Bundle, target serviceRequest : ServiceRequest, target condition : Condition) {
  src -&gt;  bundle.entry as e,  e.resource = create('Observation') as observation,  observation.id = uuid() as uuid,  e.fullUrl = ('urn:uuid:' + uuid),  observation.status = 'final',  observation.code as code,  code.coding as coding2,  coding2.code = '723188008',  coding2.system = 'http://snomed.info/sct',  coding2.display = 'Renal insufficiency (disorder)',  condition.evidence as evidence,  evidence.detail as detail,  detail.reference = ('urn:uuid:' + uuid),  observation.subject as subject,  subject.reference = ('urn:uuid:' + patient.id) then {
    src.item as item where ((linkId.value = 'caveat.renalInsufficiency.creatinine.quantity') and answer.exists()) then {
      item.answer as answer then {
        answer.value : Quantity as value -&gt; observation.value = value;
      };
    } &quot;quantity&quot;;
    src.item as item where ((linkId.value = 'caveat.renalInsufficiency.creatinine.dateTime') and answer.exists()) then {
      item.answer as answer then {
        answer.value : dateTime as value -&gt; observation.effective = value;
      };
    } &quot;dateTime&quot;;
  } &quot;observation&quot;;
}

group PreviousImagingStudyResults(source grp : BackboneElement, target bundle : Bundle, target serviceRequest : ServiceRequest, target patient : Patient) {
  grp.item as item where (linkId.value = 'previousResults.imagingStudy') -&gt;  bundle.entry as e,  e.resource = create('ImagingStudy') as imagingStudy,  imagingStudy.id = uuid() as uuid,  imagingStudy.status = 'available',  imagingStudy.subject as subject,  subject.reference = ('urn:uuid:' + patient.id),  e.fullUrl = append('urn:uuid:', uuid),  serviceRequest.subject as subject,  subject.reference = ('urn:uuid:' + patient.id),  serviceRequest.supportingInfo as supportingInfo,  supportingInfo.reference = ('urn:uuid:' + uuid) then {
    item.item as dictomitem where ((linkId.value = 'previousResults.imagingStudy.uid') and answer.exists()) -&gt;  imagingStudy.identifier as uid,  uid.system = 'urn:dicom:uid',  uid.use = 'official',  uid.value = ('urn:oid:' + dictomitem.answer.value) &quot;uid&quot;;
    item.item as dictomitem where ((linkId.value = 'previousResults.imagingStudy.acsn') and answer.exists()) -&gt;  imagingStudy.identifier as acsn,  acsn.type as type,  type.coding as coding,  coding.system = 'http://terminology.hl7.org/CodeSystem/v2-0203',  coding.code = 'ACSN',  acsn.use = 'usual',  acsn.value = (dictomitem.answer.value) &quot;acsn&quot;;
  } &quot;imagingStudy&quot;;
}

</pre>
      </div>
  </text>
  <url value="http://fhir.ch/ig/ch-rad-order/StructureMap/RadOrderQrToBundle"/>
  <version value="0.1.0"/>
  <name value="RadOrderQrToBundle"/>
  <status value="draft"/>
  <date value="2022-01-22T19:37:11+00:00"/>
  <publisher value="HL7 Switzerland"/>
  <contact>
    <name value="Juerg P. Bleuer"/>
    <telecom>
      <system value="url"/>
      <value value="https://www.hl7.ch"/>
    </telecom>
  </contact>
  <description value="Radiologoy QuestionnaireResponse to Bundle"/>
  <jurisdiction>
    <coding>
      <system value="urn:iso:std:iso:3166"/>
      <code value="CH"/>
    </coding>
  </jurisdiction>
  <copyright value="CC-BY-SA-4.0"/>
  <structure>
    <url value="http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse"/>
    <mode value="source"/>
    <alias value="QuestionnaireResponse"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/StructureDefinition/Bundle"/>
    <mode value="target"/>
    <alias value="Bundle"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/StructureDefinition/Patient"/>
    <mode value="target"/>
    <alias value="Patient"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/StructureDefinition/Organization"/>
    <mode value="target"/>
    <alias value="Organization"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/StructureDefinition/Practitioner"/>
    <mode value="target"/>
    <alias value="Practitioner"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/StructureDefinition/PractitionerRole"/>
    <mode value="target"/>
    <alias value="PractitionerRole"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/StructureDefinition/ServiceRequest"/>
    <mode value="target"/>
    <alias value="ServiceRequest"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/StructureDefinition/BackboneElement"/>
    <mode value="target"/>
    <alias value="BackboneElement"/>
  </structure>
  <import value="http://fhir.ch/ig/ch-orf/StructureMap/OrfQrToBundle"/>
  <group>
    <name value="RadOrderQrToBundle"/>
    <typeMode value="none"/>
    <input>
      <name value="qr"/>
      <type value="QuestionnaireResponse"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="documentIdentifier"/>
      <source>
        <context value="qr"/>
      </source>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="identifier"/>
        <variable value="documentIdentifier"/>
      </target>
      <target>
        <context value="documentIdentifier"/>
        <contextType value="variable"/>
        <element value="system"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="urn:ietf:rfc:3986"/>
        </parameter>
      </target>
      <target>
        <contextType value="variable"/>
        <variable value="uuidDoc"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="documentIdentifier"/>
        <contextType value="variable"/>
        <element value="value"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="&#39;urn:uuid:&#39; + uuidDoc"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="orfbundle"/>
      <source>
        <context value="qr"/>
        <variable value="qrcp"/>
      </source>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="e"/>
      </target>
      <target>
        <context value="e"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="composition"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Composition"/>
        </parameter>
      </target>
      <target>
        <context value="composition"/>
        <contextType value="variable"/>
        <element value="id"/>
        <variable value="uuid"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="e"/>
        <contextType value="variable"/>
        <element value="fullUrl"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="&#39;urn:uuid:&#39; + uuid"/>
        </parameter>
      </target>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="e2"/>
      </target>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="timestamp"/>
        <variable value="timestamp"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="now()"/>
        </parameter>
      </target>
      <target>
        <context value="composition"/>
        <contextType value="variable"/>
        <element value="date"/>
        <transform value="copy"/>
        <parameter>
          <valueId value="timestamp"/>
        </parameter>
      </target>
      <target>
        <context value="e2"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="patient"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Patient"/>
        </parameter>
      </target>
      <target>
        <context value="patient"/>
        <contextType value="variable"/>
        <element value="id"/>
        <variable value="uuid2"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="e2"/>
        <contextType value="variable"/>
        <element value="fullUrl"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="&#39;urn:uuid:&#39; + uuid2"/>
        </parameter>
      </target>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="e4"/>
      </target>
      <target>
        <context value="e4"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="questionnaireresp"/>
        <transform value="copy"/>
        <parameter>
          <valueId value="qrcp"/>
        </parameter>
      </target>
      <target>
        <context value="questionnaireresp"/>
        <contextType value="variable"/>
        <element value="id"/>
        <variable value="uuid4"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="e4"/>
        <contextType value="variable"/>
        <element value="fullUrl"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="&#39;urn:uuid:&#39; + uuid4"/>
        </parameter>
      </target>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="e5"/>
      </target>
      <target>
        <context value="e5"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="servicerequest"/>
        <transform value="create"/>
        <parameter>
          <valueString value="ServiceRequest"/>
        </parameter>
      </target>
      <target>
        <context value="servicerequest"/>
        <contextType value="variable"/>
        <element value="id"/>
        <variable value="uuid5"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="e5"/>
        <contextType value="variable"/>
        <element value="fullUrl"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="&#39;urn:uuid:&#39; + uuid5"/>
        </parameter>
      </target>
      <rule>
        <name value="orfbundle"/>
        <source>
          <context value="qr"/>
          <element value="questionnaire"/>
          <variable value="can"/>
        </source>
        <target>
          <context value="bundle"/>
          <contextType value="variable"/>
          <element value="entry"/>
          <variable value="e6"/>
        </target>
        <target>
          <context value="e6"/>
          <contextType value="variable"/>
          <element value="resource"/>
          <variable value="q"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString value="can.resolve()"/>
          </parameter>
        </target>
        <target>
          <context value="q"/>
          <contextType value="variable"/>
          <element value="id"/>
          <variable value="uuid6"/>
          <transform value="uuid"/>
        </target>
        <target>
          <context value="e6"/>
          <contextType value="variable"/>
          <element value="fullUrl"/>
          <transform value="append"/>
          <parameter>
            <valueString value="urn:uuid:"/>
          </parameter>
          <parameter>
            <valueId value="uuid6"/>
          </parameter>
        </target>
        <dependent>
          <name value="QrToBundle"/>
          <variable value="qr"/>
          <variable value="q"/>
          <variable value="patient"/>
          <variable value="questionnaireresp"/>
          <variable value="servicerequest"/>
          <variable value="composition"/>
          <variable value="bundle"/>
        </dependent>
      </rule>
      <rule>
        <name value="servicerequest"/>
        <source>
          <context value="qr"/>
        </source>
        <dependent>
          <name value="RadOrderQrToServiceRequest"/>
          <variable value="qr"/>
          <variable value="patient"/>
          <variable value="bundle"/>
          <variable value="composition"/>
          <variable value="servicerequest"/>
        </dependent>
      </rule>
    </rule>
  </group>
  <group>
    <name value="RadOrderQrToServiceRequest"/>
    <typeMode value="none"/>
    <input>
      <name value="qr"/>
      <type value="QuestionnaireResponse"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="patient"/>
      <type value="Patient"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="composition"/>
      <type value="Composition"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="serviceRequest"/>
      <type value="ServiceRequest"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="requestedService"/>
      <source>
        <context value="qr"/>
        <element value="item"/>
        <variable value="grp"/>
        <condition value="linkId = &#39;requestedService&#39;"/>
      </source>
      <dependent>
        <name value="RequestedServiceItems"/>
        <variable value="grp"/>
        <variable value="serviceRequest"/>
      </dependent>
    </rule>
    <rule>
      <name value="reason"/>
      <source>
        <context value="qr"/>
        <element value="item"/>
        <variable value="grp"/>
        <condition value="linkId = &#39;reason&#39;"/>
      </source>
      <dependent>
        <name value="ReasonServiceItems"/>
        <variable value="grp"/>
        <variable value="serviceRequest"/>
      </dependent>
    </rule>
    <rule>
      <name value="imagingService"/>
      <source>
        <context value="qr"/>
        <element value="item"/>
        <variable value="grp"/>
        <condition value="linkId = &#39;imagingService&#39;"/>
      </source>
      <dependent>
        <name value="ImagingServiceItems"/>
        <variable value="grp"/>
        <variable value="serviceRequest"/>
      </dependent>
    </rule>
    <rule>
      <name value="orderDetail"/>
      <source>
        <context value="qr"/>
        <element value="item"/>
        <variable value="grp"/>
        <condition value="linkId = &#39;orderDetail&#39;"/>
      </source>
      <dependent>
        <name value="OrderDetailServiceItems"/>
        <variable value="grp"/>
        <variable value="serviceRequest"/>
      </dependent>
    </rule>
    <rule>
      <name value="desiredRadiologist"/>
      <source>
        <context value="qr"/>
        <element value="item"/>
        <variable value="grp"/>
        <condition value="linkId = &#39;desiredRadiologist&#39;"/>
      </source>
      <dependent>
        <name value="DesiredRadiologistServiceItems"/>
        <variable value="grp"/>
        <variable value="bundle"/>
        <variable value="serviceRequest"/>
      </dependent>
    </rule>
    <rule>
      <name value="diagnosisList"/>
      <source>
        <context value="qr"/>
        <element value="item"/>
        <variable value="grp"/>
        <condition value="linkId = &#39;diagnosisList&#39;"/>
      </source>
      <dependent>
        <name value="DiagnosisListServiceItems"/>
        <variable value="grp"/>
        <variable value="patient"/>
        <variable value="bundle"/>
        <variable value="serviceRequest"/>
      </dependent>
    </rule>
    <rule>
      <name value="Caveat"/>
      <source>
        <context value="qr"/>
        <element value="item"/>
        <variable value="grp"/>
        <condition value="linkId = &#39;caveat&#39;"/>
      </source>
      <dependent>
        <name value="CaveatServiceItems"/>
        <variable value="grp"/>
        <variable value="patient"/>
        <variable value="bundle"/>
        <variable value="serviceRequest"/>
      </dependent>
    </rule>
    <rule>
      <name value="previousResults"/>
      <source>
        <context value="qr"/>
        <element value="item"/>
        <variable value="grp"/>
        <condition value="linkId = &#39;previousResults&#39;"/>
      </source>
      <dependent>
        <name value="PreviousImagingStudyResults"/>
        <variable value="grp"/>
        <variable value="bundle"/>
        <variable value="serviceRequest"/>
        <variable value="patient"/>
      </dependent>
    </rule>
  </group>
  <group>
    <name value="RequestedServiceItems"/>
    <typeMode value="none"/>
    <input>
      <name value="src"/>
      <type value="BackboneElement"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="serviceRequest"/>
      <type value="ServiceRequest"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="item.answer"/>
      <source>
        <context value="src"/>
        <element value="item"/>
        <variable value="item"/>
        <condition
                   value="((linkId.value = &#39;requestedService.service&#39;) and answer.exists())"/>
      </source>
      <rule>
        <name value="answer.valueCoding"/>
        <source>
          <context value="item"/>
          <element value="answer"/>
          <variable value="answer"/>
        </source>
        <rule>
          <name value="requestedService.service"/>
          <source>
            <context value="answer"/>
            <type value="Coding"/>
            <element value="value"/>
            <variable value="coding"/>
          </source>
          <target>
            <context value="serviceRequest"/>
            <contextType value="variable"/>
            <element value="category"/>
            <variable value="cc"/>
          </target>
          <target>
            <context value="cc"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="coding"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
  </group>
  <group>
    <name value="ReasonServiceItems"/>
    <typeMode value="none"/>
    <input>
      <name value="src"/>
      <type value="BackboneElement"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="serviceRequest"/>
      <type value="ServiceRequest"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="item.answer"/>
      <source>
        <context value="src"/>
        <element value="item"/>
        <variable value="item"/>
        <condition
                   value="((linkId.value = &#39;reason.question&#39;) and answer.exists())"/>
      </source>
      <rule>
        <name value="answer.valueString"/>
        <source>
          <context value="item"/>
          <element value="answer"/>
          <variable value="answer"/>
        </source>
        <rule>
          <name value="reason.question"/>
          <source>
            <context value="answer"/>
            <type value="string"/>
            <element value="value"/>
            <variable value="value"/>
          </source>
          <target>
            <context value="serviceRequest"/>
            <contextType value="variable"/>
            <element value="reasonCode"/>
            <variable value="reasonCode"/>
          </target>
          <target>
            <context value="reasonCode"/>
            <contextType value="variable"/>
            <element value="text"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="value"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
  </group>
  <group>
    <name value="ImagingServiceItems"/>
    <typeMode value="none"/>
    <input>
      <name value="src"/>
      <type value="BackboneElement"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="serviceRequest"/>
      <type value="ServiceRequest"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="item.answer"/>
      <source>
        <context value="src"/>
        <element value="item"/>
        <variable value="item"/>
        <condition
                   value="((linkId.value = &#39;imagingService.type&#39;) and answer.exists())"/>
      </source>
      <rule>
        <name value="answer.valueCoding"/>
        <source>
          <context value="item"/>
          <element value="answer"/>
          <variable value="answer"/>
        </source>
        <rule>
          <name value="requestedService.service"/>
          <source>
            <context value="answer"/>
            <type value="Coding"/>
            <element value="value"/>
            <variable value="coding"/>
          </source>
          <target>
            <context value="serviceRequest"/>
            <contextType value="variable"/>
            <element value="code"/>
            <variable value="code"/>
          </target>
          <target>
            <context value="code"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="coding"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
  </group>
  <group>
    <name value="OrderDetailServiceItems"/>
    <typeMode value="none"/>
    <input>
      <name value="src"/>
      <type value="BackboneElement"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="serviceRequest"/>
      <type value="ServiceRequest"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="item.answer"/>
      <source>
        <context value="src"/>
        <element value="item"/>
        <variable value="item"/>
        <condition
                   value="((linkId.value = &#39;orderDetail.imagingRegion&#39;) and answer.exists())"/>
      </source>
      <rule>
        <name value="answer.valueCoding"/>
        <source>
          <context value="item"/>
          <element value="answer"/>
          <variable value="answer"/>
        </source>
        <rule>
          <name value="orderDetail.imagingRegion"/>
          <source>
            <context value="answer"/>
            <type value="Coding"/>
            <element value="value"/>
            <variable value="coding"/>
          </source>
          <target>
            <context value="serviceRequest"/>
            <contextType value="variable"/>
            <element value="orderDetail"/>
            <variable value="cc"/>
          </target>
          <target>
            <context value="cc"/>
            <contextType value="variable"/>
            <element value="extension"/>
            <variable value="ext"/>
          </target>
          <target>
            <context value="ext"/>
            <contextType value="variable"/>
            <element value="url"/>
            <transform value="copy"/>
            <parameter>
              <valueString
                           value="http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-order-detail-type"/>
            </parameter>
          </target>
          <target>
            <context value="ext"/>
            <contextType value="variable"/>
            <element value="value"/>
            <variable value="coding"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Coding"/>
            </parameter>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="system"/>
            <transform value="copy"/>
            <parameter>
              <valueString
                           value="http://fhir.ch/ig/ch-rad-order/CodeSystem/ch-rad-order-order-detail-type"/>
            </parameter>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="code"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="imagingRegion"/>
            </parameter>
          </target>
          <target>
            <context value="cc"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="coding"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="item.answer"/>
      <source>
        <context value="src"/>
        <element value="item"/>
        <variable value="item"/>
        <condition
                   value="((linkId.value = &#39;orderDetail.imagingFocus&#39;) and answer.exists())"/>
      </source>
      <rule>
        <name value="answer.valueCoding"/>
        <source>
          <context value="item"/>
          <element value="answer"/>
          <variable value="answer"/>
        </source>
        <rule>
          <name value="orderDetail.imagingFocus"/>
          <source>
            <context value="answer"/>
            <type value="Coding"/>
            <element value="value"/>
            <variable value="coding"/>
          </source>
          <target>
            <context value="serviceRequest"/>
            <contextType value="variable"/>
            <element value="bodySite"/>
            <variable value="cc"/>
          </target>
          <target>
            <context value="cc"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="coding"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="item.answer"/>
      <source>
        <context value="src"/>
        <element value="item"/>
        <variable value="item"/>
        <condition
                   value="((linkId.value = &#39;orderDetail.laterality&#39;) and answer.exists())"/>
      </source>
      <rule>
        <name value="answer.valueCoding"/>
        <source>
          <context value="item"/>
          <element value="answer"/>
          <variable value="answer"/>
        </source>
        <rule>
          <name value="orderDetail.laterality"/>
          <source>
            <context value="answer"/>
            <type value="Coding"/>
            <element value="value"/>
            <variable value="coding"/>
          </source>
          <target>
            <context value="serviceRequest"/>
            <contextType value="variable"/>
            <element value="orderDetail"/>
            <variable value="cc"/>
          </target>
          <target>
            <context value="cc"/>
            <contextType value="variable"/>
            <element value="extension"/>
            <variable value="ext"/>
          </target>
          <target>
            <context value="ext"/>
            <contextType value="variable"/>
            <element value="url"/>
            <transform value="copy"/>
            <parameter>
              <valueString
                           value="http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-order-detail-type"/>
            </parameter>
          </target>
          <target>
            <context value="ext"/>
            <contextType value="variable"/>
            <element value="value"/>
            <variable value="coding"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Coding"/>
            </parameter>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="system"/>
            <transform value="copy"/>
            <parameter>
              <valueString
                           value="http://fhir.ch/ig/ch-rad-order/CodeSystem/ch-rad-order-order-detail-type"/>
            </parameter>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="code"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="laterality"/>
            </parameter>
          </target>
          <target>
            <context value="cc"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="coding"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="item.answer"/>
      <source>
        <context value="src"/>
        <element value="item"/>
        <variable value="item"/>
        <condition
                   value="((linkId.value = &#39;orderDetail.viewType&#39;) and answer.exists())"/>
      </source>
      <rule>
        <name value="answer.valueCoding"/>
        <source>
          <context value="item"/>
          <element value="answer"/>
          <variable value="answer"/>
        </source>
        <rule>
          <name value="orderDetail.viewType"/>
          <source>
            <context value="answer"/>
            <type value="Coding"/>
            <element value="value"/>
            <variable value="coding"/>
          </source>
          <target>
            <context value="serviceRequest"/>
            <contextType value="variable"/>
            <element value="orderDetail"/>
            <variable value="cc"/>
          </target>
          <target>
            <context value="cc"/>
            <contextType value="variable"/>
            <element value="extension"/>
            <variable value="ext"/>
          </target>
          <target>
            <context value="ext"/>
            <contextType value="variable"/>
            <element value="url"/>
            <transform value="copy"/>
            <parameter>
              <valueString
                           value="http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-order-detail-type"/>
            </parameter>
          </target>
          <target>
            <context value="ext"/>
            <contextType value="variable"/>
            <element value="value"/>
            <variable value="coding"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Coding"/>
            </parameter>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="system"/>
            <transform value="copy"/>
            <parameter>
              <valueString
                           value="http://fhir.ch/ig/ch-rad-order/CodeSystem/ch-rad-order-order-detail-type"/>
            </parameter>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="code"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="viewType"/>
            </parameter>
          </target>
          <target>
            <context value="cc"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="coding"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="item.answer"/>
      <source>
        <context value="src"/>
        <element value="item"/>
        <variable value="item"/>
        <condition
                   value="((linkId.value = &#39;orderDetail.maneuverType&#39;) and answer.exists())"/>
      </source>
      <rule>
        <name value="answer.valueCoding"/>
        <source>
          <context value="item"/>
          <element value="answer"/>
          <variable value="answer"/>
        </source>
        <rule>
          <name value="orderDetail.maneuverType"/>
          <source>
            <context value="answer"/>
            <type value="Coding"/>
            <element value="value"/>
            <variable value="coding"/>
          </source>
          <target>
            <context value="serviceRequest"/>
            <contextType value="variable"/>
            <element value="orderDetail"/>
            <variable value="cc"/>
          </target>
          <target>
            <context value="cc"/>
            <contextType value="variable"/>
            <element value="extension"/>
            <variable value="ext"/>
          </target>
          <target>
            <context value="ext"/>
            <contextType value="variable"/>
            <element value="url"/>
            <transform value="copy"/>
            <parameter>
              <valueString
                           value="http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-order-detail-type"/>
            </parameter>
          </target>
          <target>
            <context value="ext"/>
            <contextType value="variable"/>
            <element value="value"/>
            <variable value="coding"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Coding"/>
            </parameter>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="system"/>
            <transform value="copy"/>
            <parameter>
              <valueString
                           value="http://fhir.ch/ig/ch-rad-order/CodeSystem/ch-rad-order-order-detail-type"/>
            </parameter>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="code"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="maneuverType"/>
            </parameter>
          </target>
          <target>
            <context value="cc"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="coding"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="item.answer"/>
      <source>
        <context value="src"/>
        <element value="item"/>
        <variable value="item"/>
        <condition
                   value="((linkId.value = &#39;orderDetail.guidanceForAction&#39;) and answer.exists())"/>
      </source>
      <rule>
        <name value="answer.valueCoding"/>
        <source>
          <context value="item"/>
          <element value="answer"/>
          <variable value="answer"/>
        </source>
        <rule>
          <name value="orderDetail.guidanceForAction"/>
          <source>
            <context value="answer"/>
            <type value="Coding"/>
            <element value="value"/>
            <variable value="coding"/>
          </source>
          <target>
            <context value="serviceRequest"/>
            <contextType value="variable"/>
            <element value="orderDetail"/>
            <variable value="cc"/>
          </target>
          <target>
            <context value="cc"/>
            <contextType value="variable"/>
            <element value="extension"/>
            <variable value="ext"/>
          </target>
          <target>
            <context value="ext"/>
            <contextType value="variable"/>
            <element value="url"/>
            <transform value="copy"/>
            <parameter>
              <valueString
                           value="http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-order-detail-type"/>
            </parameter>
          </target>
          <target>
            <context value="ext"/>
            <contextType value="variable"/>
            <element value="value"/>
            <variable value="coding"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Coding"/>
            </parameter>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="system"/>
            <transform value="copy"/>
            <parameter>
              <valueString
                           value="http://fhir.ch/ig/ch-rad-order/CodeSystem/ch-rad-order-order-detail-type"/>
            </parameter>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="code"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="guidanceForAction"/>
            </parameter>
          </target>
          <target>
            <context value="cc"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="coding"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
  </group>
  <group>
    <name value="DesiredRadiologistServiceItems"/>
    <typeMode value="none"/>
    <input>
      <name value="src"/>
      <type value="BackboneElement"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="serviceRequest"/>
      <type value="ServiceRequest"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="serviceRequest.performer"/>
      <source>
        <context value="src"/>
      </source>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="e"/>
      </target>
      <target>
        <context value="e"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="practitioner"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Practitioner"/>
        </parameter>
      </target>
      <target>
        <context value="practitioner"/>
        <contextType value="variable"/>
        <element value="id"/>
        <variable value="uuid"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="serviceRequest"/>
        <contextType value="variable"/>
        <element value="performer"/>
        <variable value="performer"/>
      </target>
      <target>
        <context value="performer"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="&#39;urn:uuid:&#39; + uuid"/>
        </parameter>
      </target>
      <target>
        <context value="e"/>
        <contextType value="variable"/>
        <element value="fullUrl"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="&#39;urn:uuid:&#39; + uuid"/>
        </parameter>
      </target>
      <rule>
        <name value="item"/>
        <source>
          <context value="src"/>
          <element value="item"/>
          <variable value="item"/>
          <condition
                     value="((linkId.value = &#39;desiredRadiologist.familyName&#39;) and answer.exists())"/>
        </source>
        <target>
          <context value="practitioner"/>
          <contextType value="variable"/>
          <element value="name"/>
          <variable value="name"/>
          <listMode value="share"/>
          <listRuleId value="name"/>
        </target>
        <target>
          <context value="name"/>
          <contextType value="variable"/>
          <element value="family"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString value="item.answer.value"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="item"/>
        <source>
          <context value="src"/>
          <element value="item"/>
          <variable value="item"/>
          <condition
                     value="((linkId.value = &#39;desiredRadiologist.givenName&#39;) and answer.exists())"/>
        </source>
        <target>
          <context value="practitioner"/>
          <contextType value="variable"/>
          <element value="name"/>
          <variable value="name"/>
          <listMode value="share"/>
          <listRuleId value="name"/>
        </target>
        <target>
          <context value="name"/>
          <contextType value="variable"/>
          <element value="given"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString value="item.answer.value"/>
          </parameter>
        </target>
      </rule>
    </rule>
  </group>
  <group>
    <name value="DiagnosisListServiceItems"/>
    <typeMode value="none"/>
    <input>
      <name value="src"/>
      <type value="BackboneElement"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="patient"/>
      <type value="Patient"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="serviceRequest"/>
      <type value="ServiceRequest"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="item.answer"/>
      <source>
        <context value="src"/>
        <element value="item"/>
        <variable value="item"/>
        <condition
                   value="((linkId.value = &#39;diagnosisList.secondaryDiagnosis&#39;) and answer.exists())"/>
      </source>
      <rule>
        <name value="answer.valueString"/>
        <source>
          <context value="item"/>
          <element value="answer"/>
          <variable value="answer"/>
        </source>
        <rule>
          <name value="diagnosisList.secondaryDiagnosis"/>
          <source>
            <context value="answer"/>
            <type value="string"/>
            <element value="value"/>
            <variable value="value"/>
          </source>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="e"/>
          </target>
          <target>
            <context value="e"/>
            <contextType value="variable"/>
            <element value="resource"/>
            <variable value="condition"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Condition"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="id"/>
            <variable value="uuid"/>
            <transform value="uuid"/>
          </target>
          <target>
            <context value="e"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="&#39;urn:uuid:&#39; + uuid"/>
            </parameter>
          </target>
          <target>
            <context value="serviceRequest"/>
            <contextType value="variable"/>
            <element value="supportingInfo"/>
            <variable value="supportingInfo"/>
          </target>
          <target>
            <context value="supportingInfo"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="&#39;urn:uuid:&#39; + uuid"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="category"/>
            <variable value="category"/>
          </target>
          <target>
            <context value="category"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <variable value="coding"/>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="code"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="problem-list-item"/>
            </parameter>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="system"/>
            <transform value="copy"/>
            <parameter>
              <valueString
                           value="http://terminology.hl7.org/CodeSystem/condition-category"/>
            </parameter>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="display"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="Problem List Item"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="code"/>
            <variable value="code"/>
          </target>
          <target>
            <context value="code"/>
            <contextType value="variable"/>
            <element value="text"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="value"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="subject"/>
            <variable value="subject"/>
          </target>
          <target>
            <context value="subject"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="&#39;urn:uuid:&#39; + patient.id"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
  </group>
  <group>
    <name value="CaveatServiceItems"/>
    <typeMode value="none"/>
    <input>
      <name value="src"/>
      <type value="BackboneElement"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="patient"/>
      <type value="Patient"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="serviceRequest"/>
      <type value="ServiceRequest"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="item.answer"/>
      <source>
        <context value="src"/>
        <element value="item"/>
        <variable value="item"/>
        <condition
                   value="((linkId.value = &#39;caveat.bloodCoagulation&#39;) and answer.exists())"/>
      </source>
      <rule>
        <name value="answer.valueString"/>
        <source>
          <context value="item"/>
          <element value="answer"/>
          <variable value="answer"/>
        </source>
        <rule>
          <name value="caveat.bloodCoagulation"/>
          <source>
            <context value="answer"/>
            <type value="boolean"/>
            <element value="value"/>
            <variable value="value"/>
            <condition value="answer.valueBoolean"/>
          </source>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="e"/>
          </target>
          <target>
            <context value="e"/>
            <contextType value="variable"/>
            <element value="resource"/>
            <variable value="condition"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Condition"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="id"/>
            <variable value="uuid"/>
            <transform value="uuid"/>
          </target>
          <target>
            <context value="e"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="&#39;urn:uuid:&#39; + uuid"/>
            </parameter>
          </target>
          <target>
            <context value="serviceRequest"/>
            <contextType value="variable"/>
            <element value="supportingInfo"/>
            <variable value="supportingInfo"/>
          </target>
          <target>
            <context value="supportingInfo"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="&#39;urn:uuid:&#39; + uuid"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="category"/>
            <variable value="category"/>
          </target>
          <target>
            <context value="category"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <variable value="coding"/>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="code"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="problem-list-item"/>
            </parameter>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="system"/>
            <transform value="copy"/>
            <parameter>
              <valueString
                           value="http://terminology.hl7.org/CodeSystem/condition-category"/>
            </parameter>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="display"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="Problem List Item"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="code"/>
            <variable value="code"/>
          </target>
          <target>
            <context value="code"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <variable value="coding2"/>
          </target>
          <target>
            <context value="coding2"/>
            <contextType value="variable"/>
            <element value="code"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="64779008"/>
            </parameter>
          </target>
          <target>
            <context value="coding2"/>
            <contextType value="variable"/>
            <element value="system"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="http://snomed.info/sct"/>
            </parameter>
          </target>
          <target>
            <context value="coding2"/>
            <contextType value="variable"/>
            <element value="display"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="Blood coagulation disorder (disorder)"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="subject"/>
            <variable value="subject"/>
          </target>
          <target>
            <context value="subject"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="&#39;urn:uuid:&#39; + patient.id"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="item.answer"/>
      <source>
        <context value="src"/>
        <element value="item"/>
        <variable value="item"/>
        <condition
                   value="((linkId.value = &#39;caveat.renalInsufficiency&#39;) and answer.exists())"/>
      </source>
      <rule>
        <name value="answer.valueString"/>
        <source>
          <context value="item"/>
          <element value="answer"/>
          <variable value="answer"/>
        </source>
        <rule>
          <name value="caveat.renalInsufficiency"/>
          <source>
            <context value="answer"/>
            <type value="boolean"/>
            <element value="value"/>
            <variable value="value"/>
            <condition value="answer.valueBoolean"/>
          </source>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="e"/>
          </target>
          <target>
            <context value="e"/>
            <contextType value="variable"/>
            <element value="resource"/>
            <variable value="condition"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Condition"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="id"/>
            <variable value="uuid"/>
            <transform value="uuid"/>
          </target>
          <target>
            <context value="e"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="&#39;urn:uuid:&#39; + uuid"/>
            </parameter>
          </target>
          <target>
            <context value="serviceRequest"/>
            <contextType value="variable"/>
            <element value="supportingInfo"/>
            <variable value="supportingInfo"/>
          </target>
          <target>
            <context value="supportingInfo"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="&#39;urn:uuid:&#39; + uuid"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="category"/>
            <variable value="category"/>
          </target>
          <target>
            <context value="category"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <variable value="coding"/>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="code"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="problem-list-item"/>
            </parameter>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="system"/>
            <transform value="copy"/>
            <parameter>
              <valueString
                           value="http://terminology.hl7.org/CodeSystem/condition-category"/>
            </parameter>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="display"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="Problem List Item"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="code"/>
            <variable value="code"/>
          </target>
          <target>
            <context value="code"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <variable value="coding2"/>
          </target>
          <target>
            <context value="coding2"/>
            <contextType value="variable"/>
            <element value="code"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="723188008"/>
            </parameter>
          </target>
          <target>
            <context value="coding2"/>
            <contextType value="variable"/>
            <element value="system"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="http://snomed.info/sct"/>
            </parameter>
          </target>
          <target>
            <context value="coding2"/>
            <contextType value="variable"/>
            <element value="display"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="Renal insufficiency (disorder)"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="subject"/>
            <variable value="subject"/>
          </target>
          <target>
            <context value="subject"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="&#39;urn:uuid:&#39; + patient.id"/>
            </parameter>
          </target>
          <rule>
            <name value="RenalInsufficiencyCreatinineServiceItems"/>
            <source>
              <context value="answer"/>
              <element value="item"/>
              <variable value="item2"/>
              <condition
                         value="(linkId.value = &#39;caveat.renalInsufficiency.creatinine&#39;)"/>
            </source>
            <dependent>
              <name value="RenalInsufficiencyCreatinineServiceItems"/>
              <variable value="item2"/>
              <variable value="patient"/>
              <variable value="bundle"/>
              <variable value="serviceRequest"/>
              <variable value="condition"/>
            </dependent>
            <documentation
                           value="FIXME TODO answer.item as item2 where (linkId.value = &#39;caveat.renalInsufficiency.creatinineClearance&#39;) then RenalInsufficiencyCreatinineServiceItems(item2, patient, bundle, serviceRequest, condition) &quot;RenalInsufficiencyCreatinineServiceItems&quot;;"/>
          </rule>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="item.answer"/>
      <source>
        <context value="src"/>
        <element value="item"/>
        <variable value="item"/>
        <condition
                   value="((linkId.value = &#39;caveat.claustrophobia&#39;) and answer.exists())"/>
      </source>
      <rule>
        <name value="answer.valueString"/>
        <source>
          <context value="item"/>
          <element value="answer"/>
          <variable value="answer"/>
        </source>
        <rule>
          <name value="caveat.claustrophobia"/>
          <source>
            <context value="answer"/>
            <type value="boolean"/>
            <element value="value"/>
            <variable value="value"/>
            <condition value="answer.valueBoolean"/>
          </source>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="e"/>
          </target>
          <target>
            <context value="e"/>
            <contextType value="variable"/>
            <element value="resource"/>
            <variable value="condition"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Condition"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="id"/>
            <variable value="uuid"/>
            <transform value="uuid"/>
          </target>
          <target>
            <context value="e"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="&#39;urn:uuid:&#39; + uuid"/>
            </parameter>
          </target>
          <target>
            <context value="serviceRequest"/>
            <contextType value="variable"/>
            <element value="supportingInfo"/>
            <variable value="supportingInfo"/>
          </target>
          <target>
            <context value="supportingInfo"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="&#39;urn:uuid:&#39; + uuid"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="category"/>
            <variable value="category"/>
          </target>
          <target>
            <context value="category"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <variable value="coding"/>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="code"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="problem-list-item"/>
            </parameter>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="system"/>
            <transform value="copy"/>
            <parameter>
              <valueString
                           value="http://terminology.hl7.org/CodeSystem/condition-category"/>
            </parameter>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="display"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="Problem List Item"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="code"/>
            <variable value="code"/>
          </target>
          <target>
            <context value="code"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <variable value="coding2"/>
          </target>
          <target>
            <context value="coding2"/>
            <contextType value="variable"/>
            <element value="code"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="19887002"/>
            </parameter>
          </target>
          <target>
            <context value="coding2"/>
            <contextType value="variable"/>
            <element value="system"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="http://snomed.info/sct"/>
            </parameter>
          </target>
          <target>
            <context value="coding2"/>
            <contextType value="variable"/>
            <element value="display"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="Claustrophobia (finding)"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="subject"/>
            <variable value="subject"/>
          </target>
          <target>
            <context value="subject"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="&#39;urn:uuid:&#39; + patient.id"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="item.answer"/>
      <source>
        <context value="src"/>
        <element value="item"/>
        <variable value="item"/>
        <condition
                   value="((linkId.value = &#39;caveat.bodyPiercing&#39;) and answer.exists())"/>
      </source>
      <rule>
        <name value="answer.valueString"/>
        <source>
          <context value="item"/>
          <element value="answer"/>
          <variable value="answer"/>
        </source>
        <rule>
          <name value="caveat.bodyPiercing"/>
          <source>
            <context value="answer"/>
            <type value="boolean"/>
            <element value="value"/>
            <variable value="value"/>
            <condition value="answer.valueBoolean"/>
          </source>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="e"/>
          </target>
          <target>
            <context value="e"/>
            <contextType value="variable"/>
            <element value="resource"/>
            <variable value="condition"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Condition"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="id"/>
            <variable value="uuid"/>
            <transform value="uuid"/>
          </target>
          <target>
            <context value="e"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="&#39;urn:uuid:&#39; + uuid"/>
            </parameter>
          </target>
          <target>
            <context value="serviceRequest"/>
            <contextType value="variable"/>
            <element value="supportingInfo"/>
            <variable value="supportingInfo"/>
          </target>
          <target>
            <context value="supportingInfo"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="&#39;urn:uuid:&#39; + uuid"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="category"/>
            <variable value="category"/>
          </target>
          <target>
            <context value="category"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <variable value="coding"/>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="code"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="problem-list-item"/>
            </parameter>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="system"/>
            <transform value="copy"/>
            <parameter>
              <valueString
                           value="http://terminology.hl7.org/CodeSystem/condition-category"/>
            </parameter>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="display"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="Problem List Item"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="code"/>
            <variable value="code"/>
          </target>
          <target>
            <context value="code"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <variable value="coding2"/>
          </target>
          <target>
            <context value="coding2"/>
            <contextType value="variable"/>
            <element value="code"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="879862001"/>
            </parameter>
          </target>
          <target>
            <context value="coding2"/>
            <contextType value="variable"/>
            <element value="system"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="http://snomed.info/sct"/>
            </parameter>
          </target>
          <target>
            <context value="coding2"/>
            <contextType value="variable"/>
            <element value="display"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="Body piercing (finding)"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="subject"/>
            <variable value="subject"/>
          </target>
          <target>
            <context value="subject"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="&#39;urn:uuid:&#39; + patient.id"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="item.answer"/>
      <source>
        <context value="src"/>
        <element value="item"/>
        <variable value="item"/>
        <condition
                   value="((linkId.value = &#39;caveat.device&#39;) and answer.exists())"/>
      </source>
      <rule>
        <name value="answer.valueString"/>
        <source>
          <context value="item"/>
          <element value="answer"/>
          <variable value="answer"/>
        </source>
        <rule>
          <name value="caveat.device"/>
          <source>
            <context value="answer"/>
            <type value="string"/>
            <element value="value"/>
            <variable value="value"/>
          </source>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="e"/>
          </target>
          <target>
            <context value="e"/>
            <contextType value="variable"/>
            <element value="resource"/>
            <variable value="condition"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Condition"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="id"/>
            <variable value="uuid"/>
            <transform value="uuid"/>
          </target>
          <target>
            <context value="e"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="&#39;urn:uuid:&#39; + uuid"/>
            </parameter>
          </target>
          <target>
            <context value="serviceRequest"/>
            <contextType value="variable"/>
            <element value="supportingInfo"/>
            <variable value="supportingInfo"/>
          </target>
          <target>
            <context value="supportingInfo"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="&#39;urn:uuid:&#39; + uuid"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="category"/>
            <variable value="category"/>
          </target>
          <target>
            <context value="category"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <variable value="coding"/>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="code"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="problem-list-item"/>
            </parameter>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="system"/>
            <transform value="copy"/>
            <parameter>
              <valueString
                           value="http://terminology.hl7.org/CodeSystem/condition-category"/>
            </parameter>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="display"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="Problem List Item"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="code"/>
            <variable value="code"/>
          </target>
          <target>
            <context value="code"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <variable value="coding2"/>
          </target>
          <target>
            <context value="coding2"/>
            <contextType value="variable"/>
            <element value="code"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="397578001"/>
            </parameter>
          </target>
          <target>
            <context value="coding2"/>
            <contextType value="variable"/>
            <element value="system"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="http://snomed.info/sct"/>
            </parameter>
          </target>
          <target>
            <context value="coding2"/>
            <contextType value="variable"/>
            <element value="display"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="Device in situ (finding)"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="subject"/>
            <variable value="subject"/>
          </target>
          <target>
            <context value="subject"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="&#39;urn:uuid:&#39; + patient.id"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="note"/>
            <variable value="note"/>
          </target>
          <target>
            <context value="note"/>
            <contextType value="variable"/>
            <element value="text"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="value"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="item.answer"/>
      <source>
        <context value="src"/>
        <element value="item"/>
        <variable value="item"/>
        <condition
                   value="((linkId.value = &#39;caveat.hyperthyroidism&#39;) and answer.exists())"/>
      </source>
      <rule>
        <name value="answer.valueString"/>
        <source>
          <context value="item"/>
          <element value="answer"/>
          <variable value="answer"/>
        </source>
        <rule>
          <name value="caveat.hyperthyroidism"/>
          <source>
            <context value="answer"/>
            <type value="boolean"/>
            <element value="value"/>
            <variable value="value"/>
            <condition value="answer.valueBoolean"/>
          </source>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="e"/>
          </target>
          <target>
            <context value="e"/>
            <contextType value="variable"/>
            <element value="resource"/>
            <variable value="condition"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Condition"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="id"/>
            <variable value="uuid"/>
            <transform value="uuid"/>
          </target>
          <target>
            <context value="e"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="&#39;urn:uuid:&#39; + uuid"/>
            </parameter>
          </target>
          <target>
            <context value="serviceRequest"/>
            <contextType value="variable"/>
            <element value="supportingInfo"/>
            <variable value="supportingInfo"/>
          </target>
          <target>
            <context value="supportingInfo"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="&#39;urn:uuid:&#39; + uuid"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="category"/>
            <variable value="category"/>
          </target>
          <target>
            <context value="category"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <variable value="coding"/>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="code"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="problem-list-item"/>
            </parameter>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="system"/>
            <transform value="copy"/>
            <parameter>
              <valueString
                           value="http://terminology.hl7.org/CodeSystem/condition-category"/>
            </parameter>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="display"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="Problem List Item"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="code"/>
            <variable value="code"/>
          </target>
          <target>
            <context value="code"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <variable value="coding2"/>
          </target>
          <target>
            <context value="coding2"/>
            <contextType value="variable"/>
            <element value="code"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="34486009"/>
            </parameter>
          </target>
          <target>
            <context value="coding2"/>
            <contextType value="variable"/>
            <element value="system"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="http://snomed.info/sct"/>
            </parameter>
          </target>
          <target>
            <context value="coding2"/>
            <contextType value="variable"/>
            <element value="display"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="Hyperthyroidism (disorder)"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="subject"/>
            <variable value="subject"/>
          </target>
          <target>
            <context value="subject"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="&#39;urn:uuid:&#39; + patient.id"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="item.answer"/>
      <source>
        <context value="src"/>
        <element value="item"/>
        <variable value="item"/>
        <condition
                   value="((linkId.value = &#39;caveat.diabetes&#39;) and answer.exists())"/>
      </source>
      <rule>
        <name value="answer.valueString"/>
        <source>
          <context value="item"/>
          <element value="answer"/>
          <variable value="answer"/>
        </source>
        <rule>
          <name value="caveat.diabetes"/>
          <source>
            <context value="answer"/>
            <type value="boolean"/>
            <element value="value"/>
            <variable value="value"/>
            <condition value="answer.valueBoolean"/>
          </source>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="e"/>
          </target>
          <target>
            <context value="e"/>
            <contextType value="variable"/>
            <element value="resource"/>
            <variable value="condition"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Condition"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="id"/>
            <variable value="uuid"/>
            <transform value="uuid"/>
          </target>
          <target>
            <context value="e"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="&#39;urn:uuid:&#39; + uuid"/>
            </parameter>
          </target>
          <target>
            <context value="serviceRequest"/>
            <contextType value="variable"/>
            <element value="supportingInfo"/>
            <variable value="supportingInfo"/>
          </target>
          <target>
            <context value="supportingInfo"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="&#39;urn:uuid:&#39; + uuid"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="category"/>
            <variable value="category"/>
          </target>
          <target>
            <context value="category"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <variable value="coding"/>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="code"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="problem-list-item"/>
            </parameter>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="system"/>
            <transform value="copy"/>
            <parameter>
              <valueString
                           value="http://terminology.hl7.org/CodeSystem/condition-category"/>
            </parameter>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="display"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="Problem List Item"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="code"/>
            <variable value="code"/>
          </target>
          <target>
            <context value="code"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <variable value="coding2"/>
          </target>
          <target>
            <context value="coding2"/>
            <contextType value="variable"/>
            <element value="code"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="73211009"/>
            </parameter>
          </target>
          <target>
            <context value="coding2"/>
            <contextType value="variable"/>
            <element value="system"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="http://snomed.info/sct"/>
            </parameter>
          </target>
          <target>
            <context value="coding2"/>
            <contextType value="variable"/>
            <element value="display"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="Diabetes mellitus (disorder)"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="subject"/>
            <variable value="subject"/>
          </target>
          <target>
            <context value="subject"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="&#39;urn:uuid:&#39; + patient.id"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="item.answer"/>
      <source>
        <context value="src"/>
        <element value="item"/>
        <variable value="item"/>
        <condition
                   value="((linkId.value = &#39;caveat.gravida&#39;) and answer.exists())"/>
      </source>
      <rule>
        <name value="answer.valueString"/>
        <source>
          <context value="item"/>
          <element value="answer"/>
          <variable value="answer"/>
        </source>
        <rule>
          <name value="caveat.gravida"/>
          <source>
            <context value="answer"/>
            <type value="boolean"/>
            <element value="value"/>
            <variable value="value"/>
            <condition value="answer.valueBoolean"/>
          </source>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="e"/>
          </target>
          <target>
            <context value="e"/>
            <contextType value="variable"/>
            <element value="resource"/>
            <variable value="condition"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Condition"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="id"/>
            <variable value="uuid"/>
            <transform value="uuid"/>
          </target>
          <target>
            <context value="e"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="&#39;urn:uuid:&#39; + uuid"/>
            </parameter>
          </target>
          <target>
            <context value="serviceRequest"/>
            <contextType value="variable"/>
            <element value="supportingInfo"/>
            <variable value="supportingInfo"/>
          </target>
          <target>
            <context value="supportingInfo"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="&#39;urn:uuid:&#39; + uuid"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="category"/>
            <variable value="category"/>
          </target>
          <target>
            <context value="category"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <variable value="coding"/>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="code"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="problem-list-item"/>
            </parameter>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="system"/>
            <transform value="copy"/>
            <parameter>
              <valueString
                           value="http://terminology.hl7.org/CodeSystem/condition-category"/>
            </parameter>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="display"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="Problem List Item"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="code"/>
            <variable value="code"/>
          </target>
          <target>
            <context value="code"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <variable value="coding2"/>
          </target>
          <target>
            <context value="coding2"/>
            <contextType value="variable"/>
            <element value="code"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="366321006"/>
            </parameter>
          </target>
          <target>
            <context value="coding2"/>
            <contextType value="variable"/>
            <element value="system"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="http://snomed.info/sct"/>
            </parameter>
          </target>
          <target>
            <context value="coding2"/>
            <contextType value="variable"/>
            <element value="display"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="Finding of gravida (finding)"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="subject"/>
            <variable value="subject"/>
          </target>
          <target>
            <context value="subject"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="&#39;urn:uuid:&#39; + patient.id"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="item.answer"/>
      <source>
        <context value="src"/>
        <element value="item"/>
        <variable value="item"/>
        <condition
                   value="((linkId.value = &#39;caveat.contrastMediaAllergy&#39;) and answer.exists())"/>
      </source>
      <rule>
        <name value="answer.valueString"/>
        <source>
          <context value="item"/>
          <element value="answer"/>
          <variable value="answer"/>
        </source>
        <rule>
          <name value="caveat.contrastMediaAllergy"/>
          <source>
            <context value="answer"/>
            <type value="boolean"/>
            <element value="value"/>
            <variable value="value"/>
            <condition value="answer.valueBoolean"/>
          </source>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="e"/>
          </target>
          <target>
            <context value="e"/>
            <contextType value="variable"/>
            <element value="resource"/>
            <variable value="condition"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Condition"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="id"/>
            <variable value="uuid"/>
            <transform value="uuid"/>
          </target>
          <target>
            <context value="e"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="&#39;urn:uuid:&#39; + uuid"/>
            </parameter>
          </target>
          <target>
            <context value="serviceRequest"/>
            <contextType value="variable"/>
            <element value="supportingInfo"/>
            <variable value="supportingInfo"/>
          </target>
          <target>
            <context value="supportingInfo"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="&#39;urn:uuid:&#39; + uuid"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="category"/>
            <variable value="category"/>
          </target>
          <target>
            <context value="category"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <variable value="coding"/>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="code"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="problem-list-item"/>
            </parameter>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="system"/>
            <transform value="copy"/>
            <parameter>
              <valueString
                           value="http://terminology.hl7.org/CodeSystem/condition-category"/>
            </parameter>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="display"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="Problem List Item"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="code"/>
            <variable value="code"/>
          </target>
          <target>
            <context value="code"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <variable value="coding2"/>
          </target>
          <target>
            <context value="coding2"/>
            <contextType value="variable"/>
            <element value="code"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="293637006"/>
            </parameter>
          </target>
          <target>
            <context value="coding2"/>
            <contextType value="variable"/>
            <element value="system"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="http://snomed.info/sct"/>
            </parameter>
          </target>
          <target>
            <context value="coding2"/>
            <contextType value="variable"/>
            <element value="display"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="Allergy to contrast media (finding)"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="subject"/>
            <variable value="subject"/>
          </target>
          <target>
            <context value="subject"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="&#39;urn:uuid:&#39; + patient.id"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="item.answer"/>
      <source>
        <context value="src"/>
        <element value="item"/>
        <variable value="item"/>
        <condition
                   value="((linkId.value = &#39;caveat.drugPrescription&#39;) and answer.exists())"/>
      </source>
      <rule>
        <name value="answer.valueString"/>
        <source>
          <context value="item"/>
          <element value="answer"/>
          <variable value="answer"/>
        </source>
        <rule>
          <name value="caveat.drugPrescription"/>
          <source>
            <context value="answer"/>
            <type value="string"/>
            <element value="value"/>
            <variable value="value"/>
          </source>
          <target>
            <context value="bundle"/>
            <contextType value="variable"/>
            <element value="entry"/>
            <variable value="e"/>
          </target>
          <target>
            <context value="e"/>
            <contextType value="variable"/>
            <element value="resource"/>
            <variable value="condition"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Condition"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="id"/>
            <variable value="uuid"/>
            <transform value="uuid"/>
          </target>
          <target>
            <context value="e"/>
            <contextType value="variable"/>
            <element value="fullUrl"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="&#39;urn:uuid:&#39; + uuid"/>
            </parameter>
          </target>
          <target>
            <context value="serviceRequest"/>
            <contextType value="variable"/>
            <element value="supportingInfo"/>
            <variable value="supportingInfo"/>
          </target>
          <target>
            <context value="supportingInfo"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="&#39;urn:uuid:&#39; + uuid"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="category"/>
            <variable value="category"/>
          </target>
          <target>
            <context value="category"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <variable value="coding"/>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="code"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="problem-list-item"/>
            </parameter>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="system"/>
            <transform value="copy"/>
            <parameter>
              <valueString
                           value="http://terminology.hl7.org/CodeSystem/condition-category"/>
            </parameter>
          </target>
          <target>
            <context value="coding"/>
            <contextType value="variable"/>
            <element value="display"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="Problem List Item"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="code"/>
            <variable value="code"/>
          </target>
          <target>
            <context value="code"/>
            <contextType value="variable"/>
            <element value="coding"/>
            <variable value="coding2"/>
          </target>
          <target>
            <context value="coding2"/>
            <contextType value="variable"/>
            <element value="code"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="182817000"/>
            </parameter>
          </target>
          <target>
            <context value="coding2"/>
            <contextType value="variable"/>
            <element value="system"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="http://snomed.info/sct"/>
            </parameter>
          </target>
          <target>
            <context value="coding2"/>
            <contextType value="variable"/>
            <element value="display"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="Drug prescription (situation)"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="subject"/>
            <variable value="subject"/>
          </target>
          <target>
            <context value="subject"/>
            <contextType value="variable"/>
            <element value="reference"/>
            <transform value="evaluate"/>
            <parameter>
              <valueString value="&#39;urn:uuid:&#39; + patient.id"/>
            </parameter>
          </target>
          <target>
            <context value="condition"/>
            <contextType value="variable"/>
            <element value="note"/>
            <variable value="note"/>
          </target>
          <target>
            <context value="note"/>
            <contextType value="variable"/>
            <element value="text"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="value"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
  </group>
  <group>
    <name value="RenalInsufficiencyCreatinineServiceItems"/>
    <typeMode value="none"/>
    <input>
      <name value="src"/>
      <type value="BackboneElement"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="patient"/>
      <type value="Patient"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="serviceRequest"/>
      <type value="ServiceRequest"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="condition"/>
      <type value="Condition"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="observation"/>
      <source>
        <context value="src"/>
      </source>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="e"/>
      </target>
      <target>
        <context value="e"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="observation"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Observation"/>
        </parameter>
      </target>
      <target>
        <context value="observation"/>
        <contextType value="variable"/>
        <element value="id"/>
        <variable value="uuid"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="e"/>
        <contextType value="variable"/>
        <element value="fullUrl"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="&#39;urn:uuid:&#39; + uuid"/>
        </parameter>
      </target>
      <target>
        <context value="observation"/>
        <contextType value="variable"/>
        <element value="status"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="final"/>
        </parameter>
      </target>
      <target>
        <context value="observation"/>
        <contextType value="variable"/>
        <element value="code"/>
        <variable value="code"/>
      </target>
      <target>
        <context value="code"/>
        <contextType value="variable"/>
        <element value="coding"/>
        <variable value="coding2"/>
      </target>
      <target>
        <context value="coding2"/>
        <contextType value="variable"/>
        <element value="code"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="723188008"/>
        </parameter>
      </target>
      <target>
        <context value="coding2"/>
        <contextType value="variable"/>
        <element value="system"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="http://snomed.info/sct"/>
        </parameter>
      </target>
      <target>
        <context value="coding2"/>
        <contextType value="variable"/>
        <element value="display"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="Renal insufficiency (disorder)"/>
        </parameter>
      </target>
      <target>
        <context value="condition"/>
        <contextType value="variable"/>
        <element value="evidence"/>
        <variable value="evidence"/>
      </target>
      <target>
        <context value="evidence"/>
        <contextType value="variable"/>
        <element value="detail"/>
        <variable value="detail"/>
      </target>
      <target>
        <context value="detail"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="&#39;urn:uuid:&#39; + uuid"/>
        </parameter>
      </target>
      <target>
        <context value="observation"/>
        <contextType value="variable"/>
        <element value="subject"/>
        <variable value="subject"/>
      </target>
      <target>
        <context value="subject"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="&#39;urn:uuid:&#39; + patient.id"/>
        </parameter>
      </target>
      <rule>
        <name value="caveat.renalInsufficiency.creatinine.quantity"/>
        <source>
          <context value="src"/>
          <element value="item"/>
          <variable value="item"/>
          <condition
                     value="((linkId.value = &#39;caveat.renalInsufficiency.creatinine.quantity&#39;) and answer.exists())"/>
        </source>
        <rule>
          <name value="item.answer"/>
          <source>
            <context value="item"/>
            <element value="answer"/>
            <variable value="answer"/>
          </source>
          <rule>
            <name value="value-Quantity"/>
            <source>
              <context value="answer"/>
              <type value="Quantity"/>
              <element value="value"/>
              <variable value="value"/>
            </source>
            <target>
              <context value="observation"/>
              <contextType value="variable"/>
              <element value="value"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="value"/>
              </parameter>
            </target>
          </rule>
        </rule>
      </rule>
      <rule>
        <name value="caveat.renalInsufficiency.creatinine.dateTime"/>
        <source>
          <context value="src"/>
          <element value="item"/>
          <variable value="item"/>
          <condition
                     value="((linkId.value = &#39;caveat.renalInsufficiency.creatinine.dateTime&#39;) and answer.exists())"/>
        </source>
        <rule>
          <name value="item.answer"/>
          <source>
            <context value="item"/>
            <element value="answer"/>
            <variable value="answer"/>
          </source>
          <rule>
            <name value="value-dateTime"/>
            <source>
              <context value="answer"/>
              <type value="dateTime"/>
              <element value="value"/>
              <variable value="value"/>
            </source>
            <target>
              <context value="observation"/>
              <contextType value="variable"/>
              <element value="effective"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="value"/>
              </parameter>
            </target>
          </rule>
        </rule>
      </rule>
    </rule>
  </group>
  <group>
    <name value="PreviousImagingStudyResults"/>
    <typeMode value="none"/>
    <input>
      <name value="grp"/>
      <type value="BackboneElement"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="bundle"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="serviceRequest"/>
      <type value="ServiceRequest"/>
      <mode value="target"/>
    </input>
    <input>
      <name value="patient"/>
      <type value="Patient"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="imagingStudy"/>
      <source>
        <context value="grp"/>
        <element value="item"/>
        <variable value="item"/>
        <condition
                   value="(linkId.value = &#39;previousResults.imagingStudy&#39;)"/>
      </source>
      <target>
        <context value="bundle"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="e"/>
      </target>
      <target>
        <context value="e"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="imagingStudy"/>
        <transform value="create"/>
        <parameter>
          <valueString value="ImagingStudy"/>
        </parameter>
      </target>
      <target>
        <context value="imagingStudy"/>
        <contextType value="variable"/>
        <element value="id"/>
        <variable value="uuid"/>
        <transform value="uuid"/>
      </target>
      <target>
        <context value="imagingStudy"/>
        <contextType value="variable"/>
        <element value="status"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="available"/>
        </parameter>
      </target>
      <target>
        <context value="imagingStudy"/>
        <contextType value="variable"/>
        <element value="subject"/>
        <variable value="subject"/>
      </target>
      <target>
        <context value="subject"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="&#39;urn:uuid:&#39; + patient.id"/>
        </parameter>
      </target>
      <target>
        <context value="e"/>
        <contextType value="variable"/>
        <element value="fullUrl"/>
        <transform value="append"/>
        <parameter>
          <valueString value="urn:uuid:"/>
        </parameter>
        <parameter>
          <valueId value="uuid"/>
        </parameter>
      </target>
      <target>
        <context value="serviceRequest"/>
        <contextType value="variable"/>
        <element value="subject"/>
        <variable value="subject"/>
      </target>
      <target>
        <context value="subject"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="&#39;urn:uuid:&#39; + patient.id"/>
        </parameter>
      </target>
      <target>
        <context value="serviceRequest"/>
        <contextType value="variable"/>
        <element value="supportingInfo"/>
        <variable value="supportingInfo"/>
      </target>
      <target>
        <context value="supportingInfo"/>
        <contextType value="variable"/>
        <element value="reference"/>
        <transform value="evaluate"/>
        <parameter>
          <valueString value="&#39;urn:uuid:&#39; + uuid"/>
        </parameter>
      </target>
      <rule>
        <name value="uid"/>
        <source>
          <context value="item"/>
          <element value="item"/>
          <variable value="dictomitem"/>
          <condition
                     value="((linkId.value = &#39;previousResults.imagingStudy.uid&#39;) and answer.exists())"/>
        </source>
        <target>
          <context value="imagingStudy"/>
          <contextType value="variable"/>
          <element value="identifier"/>
          <variable value="uid"/>
        </target>
        <target>
          <context value="uid"/>
          <contextType value="variable"/>
          <element value="system"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="urn:dicom:uid"/>
          </parameter>
        </target>
        <target>
          <context value="uid"/>
          <contextType value="variable"/>
          <element value="use"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="official"/>
          </parameter>
        </target>
        <target>
          <context value="uid"/>
          <contextType value="variable"/>
          <element value="value"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString value="&#39;urn:oid:&#39; + dictomitem.answer.value"/>
          </parameter>
        </target>
      </rule>
      <rule>
        <name value="acsn"/>
        <source>
          <context value="item"/>
          <element value="item"/>
          <variable value="dictomitem"/>
          <condition
                     value="((linkId.value = &#39;previousResults.imagingStudy.acsn&#39;) and answer.exists())"/>
        </source>
        <target>
          <context value="imagingStudy"/>
          <contextType value="variable"/>
          <element value="identifier"/>
          <variable value="acsn"/>
        </target>
        <target>
          <context value="acsn"/>
          <contextType value="variable"/>
          <element value="type"/>
          <variable value="type"/>
        </target>
        <target>
          <context value="type"/>
          <contextType value="variable"/>
          <element value="coding"/>
          <variable value="coding"/>
        </target>
        <target>
          <context value="coding"/>
          <contextType value="variable"/>
          <element value="system"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="http://terminology.hl7.org/CodeSystem/v2-0203"/>
          </parameter>
        </target>
        <target>
          <context value="coding"/>
          <contextType value="variable"/>
          <element value="code"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="ACSN"/>
          </parameter>
        </target>
        <target>
          <context value="acsn"/>
          <contextType value="variable"/>
          <element value="use"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="usual"/>
          </parameter>
        </target>
        <target>
          <context value="acsn"/>
          <contextType value="variable"/>
          <element value="value"/>
          <transform value="evaluate"/>
          <parameter>
            <valueString value="dictomitem.answer.value"/>
          </parameter>
        </target>
      </rule>
    </rule>
  </group>
</StructureMap>