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 - JSON Representation

Raw json | Download


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