CH RAD-Order (R4)
2.0.0 - trial-use Switzerland flag

This page is part of the CH RAD-Order (R4) (v2.0.0: STU 2) based on FHIR (HL7® FHIR® Standard) R4. This is the current published version. For a full list of available versions, see the Directory of published versions

: RadOrderQrToBundle - JSON Representation

Draft as of 2024-12-18

Raw json | Download

{
  "resourceType" : "StructureMap",
  "id" : "RadOrderQrToBundle",
  "text" : {
    "status" : "generated",
    "div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p class=\"res-header-id\"><b>Generated Narrative: StructureMap RadOrderQrToBundle</b></p><a name=\"RadOrderQrToBundle\"> </a><a name=\"hcRadOrderQrToBundle\"> </a><a name=\"RadOrderQrToBundle-en-US\"> </a><pre class=\"fml\">\r\n<b>map</b><span style=\"color: navy\"> &quot;</span>http://fhir.ch/ig/ch-rad-order/StructureMap/RadOrderQrToBundle<span style=\"color: navy\">&quot; = &quot;</span>RadOrderQrToBundle<span style=\"color: navy\">&quot;\r\n\r\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">Radiologoy QuestionnaireResponse to Bundle</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">Derived from ORF QuestionnaireResponse to Bundle</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">2021-01-11 Oliver Egger, copyright ahdis ag, Apache License</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">QRF Questionnaire: http://fhir.ch/ig/ch-orf/Questionnaire-order-referral-form.html</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">QRF QuestionnaireResponse: http://fhir.ch/ig/ch-orf/QuestionnaireResponse-order-referral-form.xml.html</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">Bundle: http://fhir.ch/ig/ch-orf/StructureDefinition-ch-orf-document.html</span>\r\n\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/questionnaireresponse.html\" title=\"QuestionnaireResponse\">http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse</a><span style=\"color: navy\">&quot; </span><b>alias </b>QuestionnaireResponse <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/bundle.html\" title=\"Bundle\">http://hl7.org/fhir/StructureDefinition/Bundle</a><span style=\"color: navy\">&quot; </span><b>alias </b>Bundle <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/composition.html\" title=\"Composition\">http://hl7.org/fhir/StructureDefinition/Composition</a><span style=\"color: navy\">&quot; </span><b>alias </b>Composition <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/patient.html\" title=\"Patient\">http://hl7.org/fhir/StructureDefinition/Patient</a><span style=\"color: navy\">&quot; </span><b>alias </b>Patient <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/relatedperson.html\" title=\"RelatedPerson\">http://hl7.org/fhir/StructureDefinition/RelatedPerson</a><span style=\"color: navy\">&quot; </span><b>alias </b>RelatedPerson <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/organization.html\" title=\"Organization\">http://hl7.org/fhir/StructureDefinition/Organization</a><span style=\"color: navy\">&quot; </span><b>alias </b>Organization <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/practitioner.html\" title=\"Practitioner\">http://hl7.org/fhir/StructureDefinition/Practitioner</a><span style=\"color: navy\">&quot; </span><b>alias </b>Practitioner <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/practitionerrole.html\" title=\"PractitionerRole\">http://hl7.org/fhir/StructureDefinition/PractitionerRole</a><span style=\"color: navy\">&quot; </span><b>alias </b>PractitionerRole <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/servicerequest.html\" title=\"ServiceRequest\">http://hl7.org/fhir/StructureDefinition/ServiceRequest</a><span style=\"color: navy\">&quot; </span><b>alias </b>ServiceRequest <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/extensibility.html#Extension\" title=\"Extension\">http://hl7.org/fhir/StructureDefinition/Extension</a><span style=\"color: navy\">&quot; </span><b>alias </b>Extension <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/episodeofcare.html\" title=\"EpisodeOfCare\">http://hl7.org/fhir/StructureDefinition/EpisodeOfCare</a><span style=\"color: navy\">&quot; </span><b>alias </b>EpisodeOfCare <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/questionnaireresponse.html\" title=\"QuestionnaireResponse\">http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse</a><span style=\"color: navy\">&quot; </span><b>alias </b>QuestionnaireResponseTarget <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/questionnaireresponse.html\" title=\"QuestionnaireResponse\">http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse</a><span style=\"color: navy\">&quot; </span><b>alias </b>QuestionnaireResponse <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/bundle.html\" title=\"Bundle\">http://hl7.org/fhir/StructureDefinition/Bundle</a><span style=\"color: navy\">&quot; </span><b>alias </b>Bundle <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/patient.html\" title=\"Patient\">http://hl7.org/fhir/StructureDefinition/Patient</a><span style=\"color: navy\">&quot; </span><b>alias </b>Patient <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/organization.html\" title=\"Organization\">http://hl7.org/fhir/StructureDefinition/Organization</a><span style=\"color: navy\">&quot; </span><b>alias </b>Organization <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/practitioner.html\" title=\"Practitioner\">http://hl7.org/fhir/StructureDefinition/Practitioner</a><span style=\"color: navy\">&quot; </span><b>alias </b>Practitioner <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/practitionerrole.html\" title=\"PractitionerRole\">http://hl7.org/fhir/StructureDefinition/PractitionerRole</a><span style=\"color: navy\">&quot; </span><b>alias </b>PractitionerRole <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> &quot;</span><a href=\"http://hl7.org/fhir/R4/servicerequest.html\" title=\"ServiceRequest\">http://hl7.org/fhir/StructureDefinition/ServiceRequest</a><span style=\"color: navy\">&quot; </span><b>alias </b>ServiceRequest <b>as </b><b>target</b>\r\n\r\n<b>imports</b><span style=\"color: navy\"> &quot;</span><a href=\"http://fhir.ch/ig/ch-orf/3.0.0/StructureMap-OrfQrToBundle.html\" title=\"OrfQrToBundle\">http://fhir.ch/ig/ch-orf/StructureMap/OrfQrToBundle</a><span style=\"color: navy\">&quot;\r\n</span>\r\n<b>group </b>RadOrderQrToBundle<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">qr</span><span style=\"color: navy\"> : </span>QuestionnaireResponse, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  qr<span style=\"color: navy\"><b> -&gt; </b></span> bundle.identifier<b> as </b><span style=\"color: maroon\">documentIdentifier</span><span style=\"color: navy\">, </span> documentIdentifier.system = <span style=\"color: blue\">'urn:ietf:rfc:3986'</span><span style=\"color: navy\">, </span> <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuidDoc</span><span style=\"color: navy\">, </span> documentIdentifier.value = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuidDoc</span><span style=\"color: navy\">)</span> <i>&quot;documentIdentifier&quot;</i><span style=\"color: navy\">;</span>\r\n  qr<b> as </b><span style=\"color: maroon\">qrcp</span><span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Composition'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span> composition.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> composition.title = <span style=\"color: blue\">'Radiologieauftrag'</span><span style=\"color: navy\">, </span> composition.type<b> as </b><span style=\"color: maroon\">type</span><span style=\"color: navy\">, </span> type.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'2161000195103'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'urn:oid:2.16.756.5.30.1.127.3.4'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Imaging order (record artifact)'</span><span style=\"color: navy\">, </span> composition.category<b> as </b><span style=\"color: maroon\">category</span><span style=\"color: navy\">, </span> category.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'721963009'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Order (record artifact)'</span><span style=\"color: navy\">, </span> bundle.entry<b> as </b><span style=\"color: maroon\">e2</span><span style=\"color: navy\">, </span> bundle.timestamp = <span style=\"color: navy\">(</span>now()<span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">timestamp</span><span style=\"color: navy\">, </span> bundle.type = <span style=\"color: blue\">'document'</span><span style=\"color: navy\">, </span> composition.date = <span style=\"color: maroon\">timestamp</span><span style=\"color: navy\">, </span> e2.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Patient'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span> patient.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid2</span><span style=\"color: navy\">, </span> e2.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid2<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> bundle.entry<b> as </b><span style=\"color: maroon\">e4</span><span style=\"color: navy\">, </span> e4.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'QuestionnaireResponse'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">questionnaireresp</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    qr<b> then </b>QuestionnaireResponseMap<span style=\"color: navy\">(</span><span style=\"color: maroon\">qr</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">questionnaireresp</span><span style=\"color: navy\">)</span> <i>&quot;questionnaireresp&quot;</i><span style=\"color: navy\">;</span>\r\n    qr<span style=\"color: navy\"><b> -&gt; </b></span> questionnaireresp.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">, </span> e4.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid4</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> bundle.entry<b> as </b><span style=\"color: maroon\">e5</span><span style=\"color: navy\">, </span> e5.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'ServiceRequest'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">servicerequest</span><span style=\"color: navy\">, </span> servicerequest.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid5</span><span style=\"color: navy\">, </span> e5.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid5<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      qr<b> then </b>OrfComposition<span style=\"color: navy\">(</span><span style=\"color: maroon\">qr</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">questionnaireresp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">servicerequest</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">)</span> <i>&quot;composition&quot;</i><span style=\"color: navy\">;</span>\r\n      qr<b> then </b>QrToGroups<span style=\"color: navy\">(</span><span style=\"color: maroon\">questionnaireresp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">servicerequest</span><span style=\"color: navy\">)</span> <i>&quot;orf&quot;</i><span style=\"color: navy\">;</span>\r\n      qr<b> then </b>RadOrderQrToServiceRequest<span style=\"color: navy\">(</span><span style=\"color: maroon\">questionnaireresp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">composition</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">servicerequest</span><span style=\"color: navy\">)</span> <i>&quot;servicerequest&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;servicerequest&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;orfbundle&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>RadOrderQrToServiceRequest<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">qr</span><span style=\"color: navy\"> : </span>QuestionnaireResponse, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">composition</span><span style=\"color: navy\"> : </span>Composition, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'requestedService'<b> then </b>RequestedServiceItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span> <i>&quot;requestedService&quot;</i><span style=\"color: navy\">;</span>\r\n  qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'reason'<b> then </b>ReasonServiceItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span> <i>&quot;reason&quot;</i><span style=\"color: navy\">;</span>\r\n  qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'imagingService'<b> then </b>ImagingServiceItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span> <i>&quot;imagingService&quot;</i><span style=\"color: navy\">;</span>\r\n  qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'orderDetail'<b> then </b>OrderDetailServiceItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span> <i>&quot;orderDetail&quot;</i><span style=\"color: navy\">;</span>\r\n  qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'desiredRadiologist'<b> then </b>DesiredRadiologistServiceItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span> <i>&quot;desiredRadiologist&quot;</i><span style=\"color: navy\">;</span>\r\n  qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'diagnosisList'<b> then </b>DiagnosisListServiceItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span> <i>&quot;diagnosisList&quot;</i><span style=\"color: navy\">;</span>\r\n  qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'caveat'<b> then </b>CaveatServiceItems<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">)</span> <i>&quot;Caveat&quot;</i><span style=\"color: navy\">;</span>\r\n  qr.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'previousResults'<b> then</b><span style=\"color: navy\"> {\r\n</span>    grp.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'attachedFile'<b> then </b>PreviousImagingStudyResultsNonDicom<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">)</span> <i>&quot;attachment&quot;</i><span style=\"color: navy\">;</span>\r\n    grp.item<b> as </b><span style=\"color: maroon\">grp</span><b> where </b>linkId = 'dicomObject'<b> then </b>PreviousImagingStudyResults<span style=\"color: navy\">(</span><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">)</span> <i>&quot;attachment&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;previousResults&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>RequestedServiceItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'requestedService.service') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\"><b> -&gt; </b></span> serviceRequest.category<b> as </b><span style=\"color: maroon\">cc</span><span style=\"color: navy\">, </span> cc.coding = <span style=\"color: maroon\">coding</span> <i>&quot;requestedServiceService&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;answerCalueCoding&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;itemAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ReasonServiceItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'reason.question') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      answer.value<span style=\"color: navy\"> : </span>string<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span> serviceRequest.reasonCode<b> as </b><span style=\"color: maroon\">reasonCode</span><span style=\"color: navy\">, </span> reasonCode.text = <span style=\"color: maroon\">value</span> <i>&quot;reasonQuestion&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;answerValueString&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;itemAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>ImagingServiceItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'imagingService.type') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\"><b> -&gt; </b></span> serviceRequest.code<b> as </b><span style=\"color: maroon\">code</span><span style=\"color: navy\">, </span> code.coding = <span style=\"color: maroon\">coding</span> <i>&quot;requestedServiceService&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;answerValueCoding&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;itemAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>OrderDetailServiceItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'orderDetail.imagingRegion') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\"><b> -&gt; </b></span> serviceRequest.orderDetail<b> as </b><span style=\"color: maroon\">cc</span><span style=\"color: navy\">, </span> cc.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-order-detail-type'</span><span style=\"color: navy\">, </span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/CodeSystem/ch-rad-order-order-detail-type'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'imagingRegion'</span><span style=\"color: navy\">, </span> cc.coding = <span style=\"color: maroon\">coding</span> <i>&quot;orderDetailImagingRegion&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;answerValueCoding&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;itemAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'orderDetail.imagingFocus') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\"><b> -&gt; </b></span> serviceRequest.bodySite<b> as </b><span style=\"color: maroon\">cc</span><span style=\"color: navy\">, </span> cc.coding = <span style=\"color: maroon\">coding</span> <i>&quot;orderDetailImagingFocus&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;answerValueCoding&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;itemAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'orderDetail.laterality') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\"><b> -&gt; </b></span> serviceRequest.orderDetail<b> as </b><span style=\"color: maroon\">cc</span><span style=\"color: navy\">, </span> cc.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-order-detail-type'</span><span style=\"color: navy\">, </span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/CodeSystem/ch-rad-order-order-detail-type'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'laterality'</span><span style=\"color: navy\">, </span> cc.coding = <span style=\"color: maroon\">coding</span> <i>&quot;orderDetailLaterality&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;answerValueCoding&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;itemAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'orderDetail.viewType') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\"><b> -&gt; </b></span> serviceRequest.orderDetail<b> as </b><span style=\"color: maroon\">cc</span><span style=\"color: navy\">, </span> cc.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-order-detail-type'</span><span style=\"color: navy\">, </span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/CodeSystem/ch-rad-order-order-detail-type'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'viewType'</span><span style=\"color: navy\">, </span> cc.coding = <span style=\"color: maroon\">coding</span> <i>&quot;orderDetailViewType&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;answerValueCoding&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;itemAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'orderDetail.maneuverType') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\"><b> -&gt; </b></span> serviceRequest.orderDetail<b> as </b><span style=\"color: maroon\">cc</span><span style=\"color: navy\">, </span> cc.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-order-detail-type'</span><span style=\"color: navy\">, </span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/CodeSystem/ch-rad-order-order-detail-type'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'maneuverType'</span><span style=\"color: navy\">, </span> cc.coding = <span style=\"color: maroon\">coding</span> <i>&quot;orderDetailManeuverType&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;answerValueCoding&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;itemAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'orderDetail.guidanceForAction') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\"><b> -&gt; </b></span> serviceRequest.orderDetail<b> as </b><span style=\"color: maroon\">cc</span><span style=\"color: navy\">, </span> cc.extension<b> as </b><span style=\"color: maroon\">ext</span><span style=\"color: navy\">, </span> ext.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-order-detail-type'</span><span style=\"color: navy\">, </span> ext.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/CodeSystem/ch-rad-order-order-detail-type'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'guidanceForAction'</span><span style=\"color: navy\">, </span> cc.coding = <span style=\"color: maroon\">coding</span> <i>&quot;orderDetailGuidanceForAction&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;answerValueCoding&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;itemAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>DesiredRadiologistServiceItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Practitioner'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">practitioner</span><span style=\"color: navy\">, </span> practitioner.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> serviceRequest.performer<b> as </b><span style=\"color: maroon\">performer</span><span style=\"color: navy\">, </span> performer.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'desiredRadiologist.familyName') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>name</b><span style=\"color: navy\">, </span> name.family = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n    src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'desiredRadiologist.givenName') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span> practitioner.name<b> as </b><span style=\"color: maroon\">name</span> <b>share</b> <b>name</b><span style=\"color: navy\">, </span> name.given = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;serviceRequestPerformer&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>DiagnosisListServiceItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'diagnosisList.primaryDiagnosis') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      answer.value<span style=\"color: navy\"> : </span>string<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Condition'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">condition</span><span style=\"color: navy\">, </span> condition.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.reasonReference<b> as </b><span style=\"color: maroon\">reasonReference</span><span style=\"color: navy\">, </span> reasonReference.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> condition.category<b> as </b><span style=\"color: maroon\">category</span><span style=\"color: navy\">, </span> category.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'problem-list-item'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/condition-category'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Problem List Item'</span><span style=\"color: navy\">, </span> condition.code<b> as </b><span style=\"color: maroon\">code</span><span style=\"color: navy\">, </span> code.text = <span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> condition.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span> <i>&quot;diagnosisListPrimaryDiagnosis&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;answerValueString&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;itemAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'diagnosisList.secondaryDiagnosis') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      answer.value<span style=\"color: navy\"> : </span>string<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Condition'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">condition</span><span style=\"color: navy\">, </span> condition.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.supportingInfo<b> as </b><span style=\"color: maroon\">supportingInfo</span><span style=\"color: navy\">, </span> supportingInfo.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> condition.category<b> as </b><span style=\"color: maroon\">category</span><span style=\"color: navy\">, </span> category.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'problem-list-item'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/condition-category'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Problem List Item'</span><span style=\"color: navy\">, </span> condition.code<b> as </b><span style=\"color: maroon\">code</span><span style=\"color: navy\">, </span> code.text = <span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> condition.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span> <i>&quot;diagnosisListSecondaryDiagnosis&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;answerValueString&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;itemAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'diagnosisList.bodyHeight') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      answer.value<span style=\"color: navy\"> : </span>Quantity<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Observation'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">observation</span><span style=\"color: navy\">, </span> observation.status = <span style=\"color: blue\">'final'</span><span style=\"color: navy\">, </span> observation.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> observation.status = <span style=\"color: blue\">'final'</span><span style=\"color: navy\">, </span> serviceRequest.supportingInfo<b> as </b><span style=\"color: maroon\">supportingInfo</span><span style=\"color: navy\">, </span> supportingInfo.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> observation.category<b> as </b><span style=\"color: maroon\">category</span><span style=\"color: navy\">, </span> category.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'vital-signs'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/observation-category'</span><span style=\"color: navy\">, </span> observation.value = <span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> observation.code<b> as </b><span style=\"color: maroon\">cc</span><span style=\"color: navy\">, </span> cc.coding<b> as </b><span style=\"color: maroon\">c</span><span style=\"color: navy\">, </span> c.system = <span style=\"color: blue\">'http://loinc.org'</span><span style=\"color: navy\">, </span> c.code = <span style=\"color: blue\">'8302-2'</span><span style=\"color: navy\">, </span> observation.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span> <i>&quot;observationBodyHeight&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;answerValueString&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;itemAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'diagnosisList.bodyWeight') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      answer.value<span style=\"color: navy\"> : </span>Quantity<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Observation'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">observation</span><span style=\"color: navy\">, </span> observation.status = <span style=\"color: blue\">'final'</span><span style=\"color: navy\">, </span> observation.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> observation.status = <span style=\"color: blue\">'final'</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.supportingInfo<b> as </b><span style=\"color: maroon\">supportingInfo</span><span style=\"color: navy\">, </span> supportingInfo.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> observation.category<b> as </b><span style=\"color: maroon\">category</span><span style=\"color: navy\">, </span> category.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'vital-signs'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/observation-category'</span><span style=\"color: navy\">, </span> observation.value = <span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> observation.code<b> as </b><span style=\"color: maroon\">cc</span><span style=\"color: navy\">, </span> cc.coding<b> as </b><span style=\"color: maroon\">c</span><span style=\"color: navy\">, </span> c.system = <span style=\"color: blue\">'http://loinc.org'</span><span style=\"color: navy\">, </span> c.code = <span style=\"color: blue\">'29463-7'</span><span style=\"color: navy\">, </span> observation.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span> <i>&quot;observationBbodyWeight&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;answerValueString&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;itemAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>CaveatServiceItems<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'caveatList.bloodCoagulation') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Condition'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">condition</span><span style=\"color: navy\">, </span> condition.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.supportingInfo<b> as </b><span style=\"color: maroon\">supportingInfo</span><span style=\"color: navy\">, </span> supportingInfo.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext1</span><span style=\"color: navy\">, </span> ext1.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type'</span><span style=\"color: navy\">, </span> ext1.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'64779008'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Blood coagulation disorder (disorder)'</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext2</span><span style=\"color: navy\">, </span> ext2.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value'</span><span style=\"color: navy\">, </span> ext2.value = <span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> condition.category<b> as </b><span style=\"color: maroon\">category</span><span style=\"color: navy\">, </span> category.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'problem-list-item'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/condition-category'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Problem List Item'</span><span style=\"color: navy\">, </span> condition.code<b> as </b><span style=\"color: maroon\">code</span><span style=\"color: navy\">, </span> code.coding<b> as </b><span style=\"color: maroon\">coding2</span><span style=\"color: navy\">, </span> coding2.code = <span style=\"color: blue\">'64779008'</span><span style=\"color: navy\">, </span> coding2.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding2.display = <span style=\"color: blue\">'Blood coagulation disorder (disorder)'</span><span style=\"color: navy\">, </span> condition.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span>        answer.item<b> as </b><span style=\"color: maroon\">subitem</span><b> where </b>(linkId.value = 'caveatList.bloodCoagulation.INR')<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Observation'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">observation</span><span style=\"color: navy\">, </span> observation.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> observation.status = <span style=\"color: blue\">'final'</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> condition.evidence<b> as </b><span style=\"color: maroon\">evidence</span><span style=\"color: navy\">, </span> evidence.detail<b> as </b><span style=\"color: maroon\">detail</span><span style=\"color: navy\">, </span> detail.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> observation.code<b> as </b><span style=\"color: maroon\">cc</span><span style=\"color: navy\">, </span> cc.coding<b> as </b><span style=\"color: maroon\">c</span><span style=\"color: navy\">, </span> c.system = <span style=\"color: blue\">'http://loinc.org'</span><span style=\"color: navy\">, </span> c.code = <span style=\"color: blue\">'34714-6'</span><span style=\"color: navy\">, </span> observation.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span>          subitem.item<b> as </b><span style=\"color: maroon\">quantityitem</span><b> where </b>((linkId.value = 'caveatList.bloodCoagulation.INR.quantity') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span>            quantityitem.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>              answer.value<span style=\"color: navy\"> : </span>Quantity<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span>observation.value = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n            <span style=\"color: navy\">}</span> <i>&quot;caveatBloodCoagulationINRQuantityValue&quot;</i><span style=\"color: navy\">;</span>\r\n          <span style=\"color: navy\">}</span> <i>&quot;caveatBloodCoagulationINRQuantity&quot;</i><span style=\"color: navy\">;</span>\r\n          subitem.item<b> as </b><span style=\"color: maroon\">datetimeitem</span><b> where </b>((linkId.value = 'caveatList.bloodCoagulation.INR.dateTime') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span>            datetimeitem.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>              answer.value<span style=\"color: navy\"> : </span>dateTime<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span>observation.effective = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n            <span style=\"color: navy\">}</span> <i>&quot;caveatBloodCoagulationINRDateTimeValue&quot;</i><span style=\"color: navy\">;</span>\r\n          <span style=\"color: navy\">}</span> <i>&quot;caveatBloodCoagulationINRDateTime&quot;</i><span style=\"color: navy\">;</span>\r\n        <span style=\"color: navy\">}</span> <i>&quot;caveatBloodCoagulationINR&quot;</i><span style=\"color: navy\">;</span>\r\n        answer.item<b> as </b><span style=\"color: maroon\">subitem</span><b> where </b>(linkId.value = 'caveatList.bloodCoagulation.platelets')<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Observation'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">observation</span><span style=\"color: navy\">, </span> observation.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> observation.status = <span style=\"color: blue\">'final'</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> condition.evidence<b> as </b><span style=\"color: maroon\">evidence</span><span style=\"color: navy\">, </span> evidence.detail<b> as </b><span style=\"color: maroon\">detail</span><span style=\"color: navy\">, </span> detail.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> observation.code<b> as </b><span style=\"color: maroon\">cc</span><span style=\"color: navy\">, </span> cc.coding<b> as </b><span style=\"color: maroon\">c</span><span style=\"color: navy\">, </span> c.system = <span style=\"color: blue\">'http://loinc.org'</span><span style=\"color: navy\">, </span> c.code = <span style=\"color: blue\">'26515-7'</span><span style=\"color: navy\">, </span> observation.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span>          subitem.item<b> as </b><span style=\"color: maroon\">quantityitem</span><b> where </b>((linkId.value = 'caveatList.bloodCoagulation.platelets.quantity') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span>            quantityitem.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>              answer.value<span style=\"color: navy\"> : </span>Quantity<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span>observation.value = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n            <span style=\"color: navy\">}</span> <i>&quot;caveatBloodCoagulationINRPlateletsValue&quot;</i><span style=\"color: navy\">;</span>\r\n          <span style=\"color: navy\">}</span> <i>&quot;caveatBloodCoagulationINRPlatelets&quot;</i><span style=\"color: navy\">;</span>\r\n          subitem.item<b> as </b><span style=\"color: maroon\">datetimeitem</span><b> where </b>((linkId.value = 'caveatList.bloodCoagulation.platelets.dateTime') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span>            datetimeitem.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>              answer.value<span style=\"color: navy\"> : </span>dateTime<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span>observation.effective = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n            <span style=\"color: navy\">}</span> <i>&quot;caveatBloodCoagulationINRPlateletsValue&quot;</i><span style=\"color: navy\">;</span>\r\n          <span style=\"color: navy\">}</span> <i>&quot;caveatBloodCoagulationINRPlatelets&quot;</i><span style=\"color: navy\">;</span>\r\n        <span style=\"color: navy\">}</span> <i>&quot;caveatBloodCoagulationINR&quot;</i><span style=\"color: navy\">;</span>\r\n      <span style=\"color: navy\">}</span> <i>&quot;bloodCoagulation&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;answerValueString&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;itemAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'caveatList.renalInsufficiency') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Condition'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">condition</span><span style=\"color: navy\">, </span> condition.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.supportingInfo<b> as </b><span style=\"color: maroon\">supportingInfo</span><span style=\"color: navy\">, </span> supportingInfo.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext1</span><span style=\"color: navy\">, </span> ext1.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type'</span><span style=\"color: navy\">, </span> ext1.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'723188008'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Renal insufficiency (disorder)'</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext2</span><span style=\"color: navy\">, </span> ext2.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value'</span><span style=\"color: navy\">, </span> ext2.value = <span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> condition.category<b> as </b><span style=\"color: maroon\">category</span><span style=\"color: navy\">, </span> category.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'problem-list-item'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/condition-category'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Problem List Item'</span><span style=\"color: navy\">, </span> condition.code<b> as </b><span style=\"color: maroon\">code</span><span style=\"color: navy\">, </span> code.coding<b> as </b><span style=\"color: maroon\">coding2</span><span style=\"color: navy\">, </span> coding2.code = <span style=\"color: blue\">'723188008'</span><span style=\"color: navy\">, </span> coding2.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding2.display = <span style=\"color: blue\">'Renal insufficiency (disorder)'</span><span style=\"color: navy\">, </span> condition.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span>        answer.item<b> as </b><span style=\"color: maroon\">subitem</span><b> where </b>(linkId.value = 'caveatList.renalInsufficiency.creatinineClearance')<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Observation'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">observation</span><span style=\"color: navy\">, </span> observation.status = <span style=\"color: blue\">'final'</span><span style=\"color: navy\">, </span> observation.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> condition.evidence<b> as </b><span style=\"color: maroon\">evidence</span><span style=\"color: navy\">, </span> evidence.detail<b> as </b><span style=\"color: maroon\">detail</span><span style=\"color: navy\">, </span> detail.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> observation.code<b> as </b><span style=\"color: maroon\">cc</span><span style=\"color: navy\">, </span> cc.coding<b> as </b><span style=\"color: maroon\">c</span><span style=\"color: navy\">, </span> c.system = <span style=\"color: blue\">'http://loinc.org'</span><span style=\"color: navy\">, </span> c.code = <span style=\"color: blue\">'33558-8'</span><span style=\"color: navy\">, </span> observation.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span>          subitem.item<b> as </b><span style=\"color: maroon\">quantityitem</span><b> where </b>((linkId.value = 'caveatList.renalInsufficiency.creatinineClearance.quantity') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span>            quantityitem.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>              answer.value<span style=\"color: navy\"> : </span>Quantity<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span>observation.value = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n            <span style=\"color: navy\">}</span> <i>&quot;caveatListRenalInsufficiencyCreatinineClearanceQuantityValue&quot;</i><span style=\"color: navy\">;</span>\r\n          <span style=\"color: navy\">}</span> <i>&quot;caveatListRenalInsufficiencyCreatinineClearanceQuantity&quot;</i><span style=\"color: navy\">;</span>\r\n          subitem.item<b> as </b><span style=\"color: maroon\">datetimeitem</span><b> where </b>((linkId.value = 'caveatList.renalInsufficiency.creatinineClearance.dateTime') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span>            datetimeitem.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>              answer.value<span style=\"color: navy\"> : </span>dateTime<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span>observation.effective = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n            <span style=\"color: navy\">}</span> <i>&quot;caveatListRenalInsufficiencyCreatinineClearanceDateTimeValue&quot;</i><span style=\"color: navy\">;</span>\r\n          <span style=\"color: navy\">}</span> <i>&quot;caveatListRenalInsufficiencyCreatinineClearancedateTime&quot;</i><span style=\"color: navy\">;</span>\r\n        <span style=\"color: navy\">}</span> <i>&quot;caveatListRenalInsufficiencyCreatinineClearanceINR&quot;</i><span style=\"color: navy\">;</span>\r\n        answer.item<b> as </b><span style=\"color: maroon\">subitem</span><b> where </b>(linkId.value = 'caveatList.renalInsufficiency.creatinine')<span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Observation'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">observation</span><span style=\"color: navy\">, </span> observation.status = <span style=\"color: blue\">'final'</span><span style=\"color: navy\">, </span> observation.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> condition.evidence<b> as </b><span style=\"color: maroon\">evidence</span><span style=\"color: navy\">, </span> evidence.detail<b> as </b><span style=\"color: maroon\">detail</span><span style=\"color: navy\">, </span> detail.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> observation.code<b> as </b><span style=\"color: maroon\">cc</span><span style=\"color: navy\">, </span> cc.coding<b> as </b><span style=\"color: maroon\">c</span><span style=\"color: navy\">, </span> c.system = <span style=\"color: blue\">'http://loinc.org'</span><span style=\"color: navy\">, </span> c.code = <span style=\"color: blue\">'77140-2'</span><span style=\"color: navy\">, </span> observation.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span>          subitem.item<b> as </b><span style=\"color: maroon\">quantityitem</span><b> where </b>((linkId.value = 'caveatList.renalInsufficiency.creatinine.quantity') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span>            quantityitem.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>              answer.value<span style=\"color: navy\"> : </span>Quantity<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span>observation.value = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n            <span style=\"color: navy\">}</span> <i>&quot;caveatListRenalInsufficiencyCreatinineValue&quot;</i><span style=\"color: navy\">;</span>\r\n          <span style=\"color: navy\">}</span> <i>&quot;caveatListRenalInsufficiencyCreatinine&quot;</i><span style=\"color: navy\">;</span>\r\n          subitem.item<b> as </b><span style=\"color: maroon\">datetimeitem</span><b> where </b>((linkId.value = 'caveatList.renalInsufficiency.creatinine.dateTime') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span>            datetimeitem.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>              answer.value<span style=\"color: navy\"> : </span>dateTime<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span>observation.effective = <span style=\"color: maroon\">value</span><span style=\"color: navy\">;</span>\r\n            <span style=\"color: navy\">}</span> <i>&quot;caveatListRenalInsufficiencyCreatininevalue&quot;</i><span style=\"color: navy\">;</span>\r\n          <span style=\"color: navy\">}</span> <i>&quot;caveatBloodCoagulationINRPlatelets&quot;</i><span style=\"color: navy\">;</span>\r\n        <span style=\"color: navy\">}</span> <i>&quot;caveatListRenalInsufficiencyCreatinine&quot;</i><span style=\"color: navy\">;</span>\r\n      <span style=\"color: navy\">}</span> <i>&quot;bloodCoagulation&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;answerValueString&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;itemAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'caveatList.claustrophobia') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Condition'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">condition</span><span style=\"color: navy\">, </span> condition.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.supportingInfo<b> as </b><span style=\"color: maroon\">supportingInfo</span><span style=\"color: navy\">, </span> supportingInfo.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext1</span><span style=\"color: navy\">, </span> ext1.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type'</span><span style=\"color: navy\">, </span> ext1.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'19887002'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Claustrophobia (finding)'</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext2</span><span style=\"color: navy\">, </span> ext2.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value'</span><span style=\"color: navy\">, </span> ext2.value = <span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> condition.category<b> as </b><span style=\"color: maroon\">category</span><span style=\"color: navy\">, </span> category.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'problem-list-item'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/condition-category'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Problem List Item'</span><span style=\"color: navy\">, </span> condition.code<b> as </b><span style=\"color: maroon\">code</span><span style=\"color: navy\">, </span> code.coding<b> as </b><span style=\"color: maroon\">coding2</span><span style=\"color: navy\">, </span> coding2.code = <span style=\"color: blue\">'19887002'</span><span style=\"color: navy\">, </span> coding2.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding2.display = <span style=\"color: blue\">'Claustrophobia (finding)'</span><span style=\"color: navy\">, </span> condition.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span> <i>&quot;caveatListClaustrophobia&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;answerValueString&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;itemAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'caveatList.bodyPiercing') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Condition'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">condition</span><span style=\"color: navy\">, </span> condition.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.supportingInfo<b> as </b><span style=\"color: maroon\">supportingInfo</span><span style=\"color: navy\">, </span> supportingInfo.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext1</span><span style=\"color: navy\">, </span> ext1.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type'</span><span style=\"color: navy\">, </span> ext1.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'879862001'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Body piercing (finding)'</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext2</span><span style=\"color: navy\">, </span> ext2.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value'</span><span style=\"color: navy\">, </span> ext2.value = <span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> condition.category<b> as </b><span style=\"color: maroon\">category</span><span style=\"color: navy\">, </span> category.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'problem-list-item'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/condition-category'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Problem List Item'</span><span style=\"color: navy\">, </span> condition.code<b> as </b><span style=\"color: maroon\">code</span><span style=\"color: navy\">, </span> code.coding<b> as </b><span style=\"color: maroon\">coding2</span><span style=\"color: navy\">, </span> coding2.code = <span style=\"color: blue\">'879862001'</span><span style=\"color: navy\">, </span> coding2.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding2.display = <span style=\"color: blue\">'Body piercing (finding)'</span><span style=\"color: navy\">, </span> condition.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span> <i>&quot;caveatListBodyPiercing&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;answerValueString&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;itemAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'caveatList.device') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Condition'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">condition</span><span style=\"color: navy\">, </span> condition.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.supportingInfo<b> as </b><span style=\"color: maroon\">supportingInfo</span><span style=\"color: navy\">, </span> supportingInfo.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext1</span><span style=\"color: navy\">, </span> ext1.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type'</span><span style=\"color: navy\">, </span> ext1.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'397578001'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Device in situ (finding)'</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext2</span><span style=\"color: navy\">, </span> ext2.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value'</span><span style=\"color: navy\">, </span> ext2.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'52101004'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Present (qualifier value)'</span><span style=\"color: navy\">, </span> condition.category<b> as </b><span style=\"color: maroon\">category</span><span style=\"color: navy\">, </span> category.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'problem-list-item'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/condition-category'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Problem List Item'</span><span style=\"color: navy\">, </span> condition.code<b> as </b><span style=\"color: maroon\">code</span><span style=\"color: navy\">, </span> code.coding = <span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> condition.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span> <i>&quot;caveatListDevice&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;answerValueString&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;itemAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'caveatList.hyperthyroidism') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Condition'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">condition</span><span style=\"color: navy\">, </span> condition.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.supportingInfo<b> as </b><span style=\"color: maroon\">supportingInfo</span><span style=\"color: navy\">, </span> supportingInfo.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext1</span><span style=\"color: navy\">, </span> ext1.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type'</span><span style=\"color: navy\">, </span> ext1.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'34486009'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Hyperthyroidism (disorder)'</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext2</span><span style=\"color: navy\">, </span> ext2.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value'</span><span style=\"color: navy\">, </span> ext2.value = <span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> condition.category<b> as </b><span style=\"color: maroon\">category</span><span style=\"color: navy\">, </span> category.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'problem-list-item'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/condition-category'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Problem List Item'</span><span style=\"color: navy\">, </span> condition.code<b> as </b><span style=\"color: maroon\">code</span><span style=\"color: navy\">, </span> code.coding<b> as </b><span style=\"color: maroon\">coding2</span><span style=\"color: navy\">, </span> coding2.code = <span style=\"color: blue\">'34486009'</span><span style=\"color: navy\">, </span> coding2.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding2.display = <span style=\"color: blue\">'Hyperthyroidism (disorder)'</span><span style=\"color: navy\">, </span> condition.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span> <i>&quot;caveatListHyperthyroidism&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;answerValueString&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;itemAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'caveatList.diabetes') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Condition'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">condition</span><span style=\"color: navy\">, </span> condition.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.supportingInfo<b> as </b><span style=\"color: maroon\">supportingInfo</span><span style=\"color: navy\">, </span> supportingInfo.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext1</span><span style=\"color: navy\">, </span> ext1.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type'</span><span style=\"color: navy\">, </span> ext1.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'73211009'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Diabetes mellitus (disorder)'</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext2</span><span style=\"color: navy\">, </span> ext2.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value'</span><span style=\"color: navy\">, </span> ext2.value = <span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> condition.category<b> as </b><span style=\"color: maroon\">category</span><span style=\"color: navy\">, </span> category.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'problem-list-item'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/condition-category'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Problem List Item'</span><span style=\"color: navy\">, </span> condition.code<b> as </b><span style=\"color: maroon\">code</span><span style=\"color: navy\">, </span> code.coding<b> as </b><span style=\"color: maroon\">coding2</span><span style=\"color: navy\">, </span> coding2.code = <span style=\"color: blue\">'73211009'</span><span style=\"color: navy\">, </span> coding2.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding2.display = <span style=\"color: blue\">'Diabetes mellitus (disorder)'</span><span style=\"color: navy\">, </span> condition.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span> <i>&quot;caveatListDiabetes&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;answerValueString&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;itemAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'caveatList.gravida') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Condition'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">condition</span><span style=\"color: navy\">, </span> condition.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.supportingInfo<b> as </b><span style=\"color: maroon\">supportingInfo</span><span style=\"color: navy\">, </span> supportingInfo.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext1</span><span style=\"color: navy\">, </span> ext1.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type'</span><span style=\"color: navy\">, </span> ext1.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'366321006'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Finding of gravida (finding)'</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext2</span><span style=\"color: navy\">, </span> ext2.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value'</span><span style=\"color: navy\">, </span> ext2.value = <span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> condition.category<b> as </b><span style=\"color: maroon\">category</span><span style=\"color: navy\">, </span> category.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'problem-list-item'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/condition-category'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Problem List Item'</span><span style=\"color: navy\">, </span> condition.code<b> as </b><span style=\"color: maroon\">code</span><span style=\"color: navy\">, </span> code.coding<b> as </b><span style=\"color: maroon\">coding2</span><span style=\"color: navy\">, </span> coding2.code = <span style=\"color: blue\">'366321006'</span><span style=\"color: navy\">, </span> coding2.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding2.display = <span style=\"color: blue\">'Finding of gravida (finding)'</span><span style=\"color: navy\">, </span> condition.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span> <i>&quot;caveatListGravida&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;answerValueString&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;itemAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>((linkId.value = 'caveatList.contrastMediaAllergy') and answer.exists())<b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Condition'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">condition</span><span style=\"color: navy\">, </span> condition.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.supportingInfo<b> as </b><span style=\"color: maroon\">supportingInfo</span><span style=\"color: navy\">, </span> supportingInfo.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext1</span><span style=\"color: navy\">, </span> ext1.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type'</span><span style=\"color: navy\">, </span> ext1.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'293637006'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Allergy to contrast media (finding)'</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext2</span><span style=\"color: navy\">, </span> ext2.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value'</span><span style=\"color: navy\">, </span> ext2.value = <span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> condition.category<b> as </b><span style=\"color: maroon\">category</span><span style=\"color: navy\">, </span> category.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'problem-list-item'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/condition-category'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Problem List Item'</span><span style=\"color: navy\">, </span> condition.code<b> as </b><span style=\"color: maroon\">code</span><span style=\"color: navy\">, </span> code.coding<b> as </b><span style=\"color: maroon\">coding2</span><span style=\"color: navy\">, </span> coding2.code = <span style=\"color: blue\">'293637006'</span><span style=\"color: navy\">, </span> coding2.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding2.display = <span style=\"color: blue\">'Allergy to contrast media (finding)'</span><span style=\"color: navy\">, </span> condition.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span> <i>&quot;caveatListContrastMediaAllergy&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;answerValueString&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;itemAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">// </span><span style=\"color: green\">&quot;caveatListDrugPrescription.metformin&quot;</span>\r\n  <span style=\"color: navy\">// </span><span style=\"color: green\">caveatList.drugPrescription.betaBlocke</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'caveatList.drugPrescription')<b> then </b>DesiredRadiologistServiceItemsDrugDescription<span style=\"color: navy\">(</span><span style=\"color: maroon\">item</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">bundle</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">patient</span><span style=\"color: navy\">)</span> <i>&quot;DrugPrescription&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>DesiredRadiologistServiceItemsDrugDescription<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'caveatList.drugPrescription.metformin')<b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Condition'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">condition</span><span style=\"color: navy\">, </span> condition.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.supportingInfo<b> as </b><span style=\"color: maroon\">supportingInfo</span><span style=\"color: navy\">, </span> supportingInfo.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext1</span><span style=\"color: navy\">, </span> ext1.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type'</span><span style=\"color: navy\">, </span> ext1.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'182817000'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Drug prescription (situation)'</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext2</span><span style=\"color: navy\">, </span> ext2.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value'</span><span style=\"color: navy\">, </span> ext2.value = <span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> condition.category<b> as </b><span style=\"color: maroon\">category</span><span style=\"color: navy\">, </span> category.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'problem-list-item'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/condition-category'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Problem List Item'</span><span style=\"color: navy\">, </span> condition.code<b> as </b><span style=\"color: maroon\">code</span><span style=\"color: navy\">, </span> code.coding<b> as </b><span style=\"color: maroon\">coding2</span><span style=\"color: navy\">, </span> coding2.code = <span style=\"color: blue\">'372567009'</span><span style=\"color: navy\">, </span> coding2.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding2.display = <span style=\"color: blue\">'Metformin (substance)'</span><span style=\"color: navy\">, </span> condition.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span> <i>&quot;caveatListDrugPrescription&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;answerValueString&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;caveatListDrugPrescriptionMetformin&quot;</i><span style=\"color: navy\">;</span>\r\n  src.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'caveatList.drugPrescription.betaBlocker')<b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      answer.value<span style=\"color: navy\"> : </span>Coding<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Condition'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">condition</span><span style=\"color: navy\">, </span> condition.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> e.fullUrl = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.supportingInfo<b> as </b><span style=\"color: maroon\">supportingInfo</span><span style=\"color: navy\">, </span> supportingInfo.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext1</span><span style=\"color: navy\">, </span> ext1.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type'</span><span style=\"color: navy\">, </span> ext1.value = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Coding'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'182817000'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Drug prescription (situation)'</span><span style=\"color: navy\">, </span> condition.extension<b> as </b><span style=\"color: maroon\">ext2</span><span style=\"color: navy\">, </span> ext2.url = <span style=\"color: blue\">'http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value'</span><span style=\"color: navy\">, </span> ext2.value = <span style=\"color: maroon\">value</span><span style=\"color: navy\">, </span> condition.category<b> as </b><span style=\"color: maroon\">category</span><span style=\"color: navy\">, </span> category.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'problem-list-item'</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/condition-category'</span><span style=\"color: navy\">, </span> coding.display = <span style=\"color: blue\">'Problem List Item'</span><span style=\"color: navy\">, </span> condition.code<b> as </b><span style=\"color: maroon\">code</span><span style=\"color: navy\">, </span> code.coding<b> as </b><span style=\"color: maroon\">coding2</span><span style=\"color: navy\">, </span> coding2.code = <span style=\"color: blue\">'373254001'</span><span style=\"color: navy\">, </span> coding2.system = <span style=\"color: blue\">'http://snomed.info/sct'</span><span style=\"color: navy\">, </span> coding2.display = <span style=\"color: blue\">'Substance with beta adrenergic receptor antagonist mechanism of action (substance)'</span><span style=\"color: navy\">, </span> condition.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span> <i>&quot;caveatListDrugPrescription&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;answerValueString&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;caveatListDrugPrescriptionBetaBlocker&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>PreviousImagingStudyResultsNonDicom<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">item</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  item<b> as </b><span style=\"color: maroon\">item</span><span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'DocumentReference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">documentReference</span><span style=\"color: navy\">, </span> documentReference.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> documentReference.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> e.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> documentReference.status = <span style=\"color: blue\">'current'</span><span style=\"color: navy\">, </span> serviceRequest.supportingInfo<b> as </b><span style=\"color: maroon\">supportingInfo</span><span style=\"color: navy\">, </span> supportingInfo.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><span style=\"color: navy\"><b> -&gt; </b></span> documentReference.content<b> as </b><span style=\"color: maroon\">content</span><span style=\"color: navy\">, </span> content.attachment = <span style=\"color: navy\">(</span>%answer.value<span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">attachment</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      answer.item<b> as </b><span style=\"color: maroon\">dictomitem</span><b> where </b>((linkId.value = 'attachedFile.description') and answer.exists())<span style=\"color: navy\"><b> -&gt; </b></span>documentReference.description = <span style=\"color: navy\">(</span>%dictomitem.answer.value<span style=\"color: navy\">)</span> <i>&quot;description&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;answerValueString&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;itemAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>PreviousImagingStudyResults<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">item</span>, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">serviceRequest</span><span style=\"color: navy\"> : </span>ServiceRequest, <b>target</b> <span style=\"color: maroon\">patient</span><span style=\"color: navy\"> : </span>Patient<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  item<b> as </b><span style=\"color: maroon\">item</span><span style=\"color: navy\"><b> -&gt; </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">e</span><span style=\"color: navy\">, </span> e.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'ImagingStudy'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">imagingStudy</span><span style=\"color: navy\">, </span> imagingStudy.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">, </span> imagingStudy.status = <span style=\"color: blue\">'available'</span><span style=\"color: navy\">, </span> imagingStudy.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> e.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'urn:uuid:'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">uuid</span><span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %patient.id<span style=\"color: navy\">)</span><span style=\"color: navy\">, </span> serviceRequest.supportingInfo<b> as </b><span style=\"color: maroon\">supportingInfo</span><span style=\"color: navy\">, </span> imagingStudy.series<b> as </b><span style=\"color: maroon\">series</span><span style=\"color: navy\">, </span> series.instance<b> as </b><span style=\"color: maroon\">instance</span><span style=\"color: navy\">, </span> supportingInfo.reference = <span style=\"color: navy\">(</span>'urn:uuid:' + %uuid<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    item.answer<b> as </b><span style=\"color: maroon\">answer</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      answer.value<span style=\"color: navy\"> : </span>string<b> as </b><span style=\"color: maroon\">value</span><span style=\"color: navy\"><b> -&gt; </b></span>imagingStudy.description = <span style=\"color: maroon\">value</span> <i>&quot;description&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;answerValueString&quot;</i><span style=\"color: navy\">;</span>\r\n    item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'dicomObject.sopInstanceUid') and answer.exists()<span style=\"color: navy\"><b> -&gt; </b></span>instance.uid = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;uid&quot;</i><span style=\"color: navy\">;</span>\r\n    item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'dicomObject.modality') and answer.exists()<span style=\"color: navy\"><b> -&gt; </b></span> series.modality<b> as </b><span style=\"color: maroon\">modality</span><span style=\"color: navy\">, </span> modality.code = <span style=\"color: navy\">(</span>%item.answer.value.code<span style=\"color: navy\">)</span> <i>&quot;modality&quot;</i><span style=\"color: navy\">;</span>\r\n    item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'dicomObject.studyInstanceUid') and answer.exists()<span style=\"color: navy\"><b> -&gt; </b></span> imagingStudy.identifier<b> as </b><span style=\"color: maroon\">uid</span><span style=\"color: navy\">, </span> uid.type<b> as </b><span style=\"color: maroon\">type</span><span style=\"color: navy\">, </span> type.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'urn:dicom:uid'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'PLAC'</span><span style=\"color: navy\">, </span> uid.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;uid&quot;</i><span style=\"color: navy\">;</span>\r\n    item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'dicomObject.SeriesInstanceUid') and answer.exists()<span style=\"color: navy\"><b> -&gt; </b></span>series.uid = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;attachmentdicomSeriesInstanceUid&quot;</i><span style=\"color: navy\">;</span>\r\n    item.item<b> as </b><span style=\"color: maroon\">item</span><b> where </b>(linkId.value = 'dicomObject.acsn') and answer.exists()<span style=\"color: navy\"><b> -&gt; </b></span> imagingStudy.identifier<b> as </b><span style=\"color: maroon\">acsn</span><span style=\"color: navy\">, </span> acsn.type<b> as </b><span style=\"color: maroon\">type</span><span style=\"color: navy\">, </span> type.coding<b> as </b><span style=\"color: maroon\">coding</span><span style=\"color: navy\">, </span> coding.system = <span style=\"color: blue\">'http://terminology.hl7.org/CodeSystem/v2-0203'</span><span style=\"color: navy\">, </span> coding.code = <span style=\"color: blue\">'ACSN'</span><span style=\"color: navy\">, </span> acsn.value = <span style=\"color: navy\">(</span>%item.answer.value<span style=\"color: navy\">)</span> <i>&quot;acsn&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;supportingInfo&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span></pre></div>"
  },
  "url" : "http://fhir.ch/ig/ch-rad-order/StructureMap/RadOrderQrToBundle",
  "version" : "2.0.0",
  "name" : "RadOrderQrToBundle",
  "status" : "draft",
  "date" : "2024-12-18T10:05:02+00:00",
  "publisher" : "HL7 Switzerland",
  "contact" : [
    {
      "name" : "Juerg P. Bleuer",
      "telecom" : [
        {
          "system" : "url",
          "value" : "https://www.hl7.ch"
        }
      ]
    }
  ],
  "description" : "Radiologoy QuestionnaireResponse to Bundle\r\nDerived from ORF QuestionnaireResponse to Bundle\r\n2021-01-11 Oliver Egger, copyright ahdis ag, Apache License\r\nQRF Questionnaire: http://fhir.ch/ig/ch-orf/Questionnaire-order-referral-form.html\r\nQRF QuestionnaireResponse: http://fhir.ch/ig/ch-orf/QuestionnaireResponse-order-referral-form.xml.html\r\nBundle: http://fhir.ch/ig/ch-orf/StructureDefinition-ch-orf-document.html",
  "jurisdiction" : [
    {
      "coding" : [
        {
          "system" : "urn:iso:std:iso:3166",
          "code" : "CH"
        }
      ]
    }
  ],
  "copyright" : "CC0-1.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/Composition",
      "mode" : "target",
      "alias" : "Composition"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/Patient",
      "mode" : "target",
      "alias" : "Patient"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/RelatedPerson",
      "mode" : "target",
      "alias" : "RelatedPerson"
    },
    {
      "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/Extension",
      "mode" : "target",
      "alias" : "Extension"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/EpisodeOfCare",
      "mode" : "target",
      "alias" : "EpisodeOfCare"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse",
      "mode" : "target",
      "alias" : "QuestionnaireResponseTarget"
    },
    {
      "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"
    }
  ],
  "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" : "append",
              "parameter" : [
                {
                  "valueString" : "urn:uuid:"
                },
                {
                  "valueId" : "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" : "composition",
              "contextType" : "variable",
              "element" : "title",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "Radiologieauftrag"
                }
              ]
            },
            {
              "context" : "composition",
              "contextType" : "variable",
              "element" : "type",
              "variable" : "type"
            },
            {
              "context" : "type",
              "contextType" : "variable",
              "element" : "coding",
              "variable" : "coding"
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "code",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "2161000195103"
                }
              ]
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "urn:oid:2.16.756.5.30.1.127.3.4"
                }
              ]
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "display",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "Imaging order (record artifact)"
                }
              ]
            },
            {
              "context" : "composition",
              "contextType" : "variable",
              "element" : "category",
              "variable" : "category"
            },
            {
              "context" : "category",
              "contextType" : "variable",
              "element" : "coding",
              "variable" : "coding"
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "code",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "721963009"
                }
              ]
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "system",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "http://snomed.info/sct"
                }
              ]
            },
            {
              "context" : "coding",
              "contextType" : "variable",
              "element" : "display",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "Order (record artifact)"
                }
              ]
            },
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e2"
            },
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "timestamp",
              "variable" : "timestamp",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "now()"
                }
              ]
            },
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "type",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "document"
                }
              ]
            },
            {
              "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" : "create",
              "parameter" : [
                {
                  "valueString" : "QuestionnaireResponse"
                }
              ]
            }
          ],
          "rule" : [
            {
              "name" : "questionnaireresp",
              "source" : [
                {
                  "context" : "qr"
                }
              ],
              "dependent" : [
                {
                  "name" : "QuestionnaireResponseMap",
                  "variable" : [
                    "qr",
                    "questionnaireresp"
                  ]
                }
              ]
            },
            {
              "name" : "servicerequest",
              "source" : [
                {
                  "context" : "qr"
                }
              ],
              "target" : [
                {
                  "context" : "questionnaireresp",
                  "contextType" : "variable",
                  "element" : "id",
                  "variable" : "uuid4",
                  "transform" : "uuid"
                },
                {
                  "context" : "e4",
                  "contextType" : "variable",
                  "element" : "fullUrl",
                  "transform" : "append",
                  "parameter" : [
                    {
                      "valueString" : "urn:uuid:"
                    },
                    {
                      "valueId" : "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" : "composition",
                  "source" : [
                    {
                      "context" : "qr"
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "OrfComposition",
                      "variable" : [
                        "qr",
                        "composition",
                        "patient",
                        "questionnaireresp",
                        "servicerequest",
                        "bundle"
                      ]
                    }
                  ]
                },
                {
                  "name" : "orf",
                  "source" : [
                    {
                      "context" : "qr"
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "QrToGroups",
                      "variable" : [
                        "questionnaireresp",
                        "patient",
                        "bundle",
                        "composition",
                        "servicerequest"
                      ]
                    }
                  ]
                },
                {
                  "name" : "servicerequest",
                  "source" : [
                    {
                      "context" : "qr"
                    }
                  ],
                  "dependent" : [
                    {
                      "name" : "RadOrderQrToServiceRequest",
                      "variable" : [
                        "questionnaireresp",
                        "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'"
            }
          ],
          "rule" : [
            {
              "name" : "attachment",
              "source" : [
                {
                  "context" : "grp",
                  "element" : "item",
                  "variable" : "grp",
                  "condition" : "linkId = 'attachedFile'"
                }
              ],
              "dependent" : [
                {
                  "name" : "PreviousImagingStudyResultsNonDicom",
                  "variable" : [
                    "grp",
                    "bundle",
                    "serviceRequest",
                    "patient"
                  ]
                }
              ]
            },
            {
              "name" : "attachment",
              "source" : [
                {
                  "context" : "grp",
                  "element" : "item",
                  "variable" : "grp",
                  "condition" : "linkId = 'dicomObject'"
                }
              ],
              "dependent" : [
                {
                  "name" : "PreviousImagingStudyResults",
                  "variable" : [
                    "grp",
                    "bundle",
                    "serviceRequest",
                    "patient"
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "RequestedServiceItems",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "mode" : "source"
        },
        {
          "name" : "serviceRequest",
          "type" : "ServiceRequest",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "itemAnswer",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'requestedService.service') and answer.exists())"
            }
          ],
          "rule" : [
            {
              "name" : "answerCalueCoding",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "rule" : [
                {
                  "name" : "requestedServiceService",
                  "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",
          "mode" : "source"
        },
        {
          "name" : "serviceRequest",
          "type" : "ServiceRequest",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "itemAnswer",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'reason.question') and answer.exists())"
            }
          ],
          "rule" : [
            {
              "name" : "answerValueString",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "rule" : [
                {
                  "name" : "reasonQuestion",
                  "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",
          "mode" : "source"
        },
        {
          "name" : "serviceRequest",
          "type" : "ServiceRequest",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "itemAnswer",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'imagingService.type') and answer.exists())"
            }
          ],
          "rule" : [
            {
              "name" : "answerValueCoding",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "rule" : [
                {
                  "name" : "requestedServiceService",
                  "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",
          "mode" : "source"
        },
        {
          "name" : "serviceRequest",
          "type" : "ServiceRequest",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "itemAnswer",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'orderDetail.imagingRegion') and answer.exists())"
            }
          ],
          "rule" : [
            {
              "name" : "answerValueCoding",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "rule" : [
                {
                  "name" : "orderDetailImagingRegion",
                  "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" : "itemAnswer",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'orderDetail.imagingFocus') and answer.exists())"
            }
          ],
          "rule" : [
            {
              "name" : "answerValueCoding",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "rule" : [
                {
                  "name" : "orderDetailImagingFocus",
                  "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" : "itemAnswer",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'orderDetail.laterality') and answer.exists())"
            }
          ],
          "rule" : [
            {
              "name" : "answerValueCoding",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "rule" : [
                {
                  "name" : "orderDetailLaterality",
                  "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" : "itemAnswer",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'orderDetail.viewType') and answer.exists())"
            }
          ],
          "rule" : [
            {
              "name" : "answerValueCoding",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "rule" : [
                {
                  "name" : "orderDetailViewType",
                  "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" : "itemAnswer",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'orderDetail.maneuverType') and answer.exists())"
            }
          ],
          "rule" : [
            {
              "name" : "answerValueCoding",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "rule" : [
                {
                  "name" : "orderDetailManeuverType",
                  "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" : "itemAnswer",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'orderDetail.guidanceForAction') and answer.exists())"
            }
          ],
          "rule" : [
            {
              "name" : "answerValueCoding",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "rule" : [
                {
                  "name" : "orderDetailGuidanceForAction",
                  "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",
          "mode" : "source"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        },
        {
          "name" : "serviceRequest",
          "type" : "ServiceRequest",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "serviceRequestPerformer",
          "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",
          "mode" : "source"
        },
        {
          "name" : "patient",
          "type" : "Patient",
          "mode" : "target"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        },
        {
          "name" : "serviceRequest",
          "type" : "ServiceRequest",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "itemAnswer",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'diagnosisList.primaryDiagnosis') and answer.exists())"
            }
          ],
          "rule" : [
            {
              "name" : "answerValueString",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "rule" : [
                {
                  "name" : "diagnosisListPrimaryDiagnosis",
                  "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" : "reasonReference",
                      "variable" : "reasonReference"
                    },
                    {
                      "context" : "reasonReference",
                      "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" : "itemAnswer",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'diagnosisList.secondaryDiagnosis') and answer.exists())"
            }
          ],
          "rule" : [
            {
              "name" : "answerValueString",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "rule" : [
                {
                  "name" : "diagnosisListSecondaryDiagnosis",
                  "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" : "itemAnswer",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'diagnosisList.bodyHeight') and answer.exists())"
            }
          ],
          "rule" : [
            {
              "name" : "answerValueString",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "rule" : [
                {
                  "name" : "observationBodyHeight",
                  "source" : [
                    {
                      "context" : "answer",
                      "type" : "Quantity",
                      "element" : "value",
                      "variable" : "value"
                    }
                  ],
                  "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" : "status",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "final"
                        }
                      ]
                    },
                    {
                      "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" : "serviceRequest",
                      "contextType" : "variable",
                      "element" : "supportingInfo",
                      "variable" : "supportingInfo"
                    },
                    {
                      "context" : "supportingInfo",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'urn:uuid:' + %uuid"
                        }
                      ]
                    },
                    {
                      "context" : "observation",
                      "contextType" : "variable",
                      "element" : "category",
                      "variable" : "category"
                    },
                    {
                      "context" : "category",
                      "contextType" : "variable",
                      "element" : "coding",
                      "variable" : "coding"
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "code",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "vital-signs"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "system",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://terminology.hl7.org/CodeSystem/observation-category"
                        }
                      ]
                    },
                    {
                      "context" : "observation",
                      "contextType" : "variable",
                      "element" : "value",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "value"
                        }
                      ]
                    },
                    {
                      "context" : "observation",
                      "contextType" : "variable",
                      "element" : "code",
                      "variable" : "cc"
                    },
                    {
                      "context" : "cc",
                      "contextType" : "variable",
                      "element" : "coding",
                      "variable" : "c"
                    },
                    {
                      "context" : "c",
                      "contextType" : "variable",
                      "element" : "system",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://loinc.org"
                        }
                      ]
                    },
                    {
                      "context" : "c",
                      "contextType" : "variable",
                      "element" : "code",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "8302-2"
                        }
                      ]
                    },
                    {
                      "context" : "observation",
                      "contextType" : "variable",
                      "element" : "subject",
                      "variable" : "subject"
                    },
                    {
                      "context" : "subject",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'urn:uuid:' + %patient.id"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "itemAnswer",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'diagnosisList.bodyWeight') and answer.exists())"
            }
          ],
          "rule" : [
            {
              "name" : "answerValueString",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "rule" : [
                {
                  "name" : "observationBbodyWeight",
                  "source" : [
                    {
                      "context" : "answer",
                      "type" : "Quantity",
                      "element" : "value",
                      "variable" : "value"
                    }
                  ],
                  "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" : "status",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "final"
                        }
                      ]
                    },
                    {
                      "context" : "observation",
                      "contextType" : "variable",
                      "element" : "id",
                      "variable" : "uuid",
                      "transform" : "uuid"
                    },
                    {
                      "context" : "observation",
                      "contextType" : "variable",
                      "element" : "status",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "final"
                        }
                      ]
                    },
                    {
                      "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" : "observation",
                      "contextType" : "variable",
                      "element" : "category",
                      "variable" : "category"
                    },
                    {
                      "context" : "category",
                      "contextType" : "variable",
                      "element" : "coding",
                      "variable" : "coding"
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "code",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "vital-signs"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "system",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://terminology.hl7.org/CodeSystem/observation-category"
                        }
                      ]
                    },
                    {
                      "context" : "observation",
                      "contextType" : "variable",
                      "element" : "value",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "value"
                        }
                      ]
                    },
                    {
                      "context" : "observation",
                      "contextType" : "variable",
                      "element" : "code",
                      "variable" : "cc"
                    },
                    {
                      "context" : "cc",
                      "contextType" : "variable",
                      "element" : "coding",
                      "variable" : "c"
                    },
                    {
                      "context" : "c",
                      "contextType" : "variable",
                      "element" : "system",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://loinc.org"
                        }
                      ]
                    },
                    {
                      "context" : "c",
                      "contextType" : "variable",
                      "element" : "code",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "29463-7"
                        }
                      ]
                    },
                    {
                      "context" : "observation",
                      "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",
          "mode" : "source"
        },
        {
          "name" : "patient",
          "type" : "Patient",
          "mode" : "target"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        },
        {
          "name" : "serviceRequest",
          "type" : "ServiceRequest",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "itemAnswer",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'caveatList.bloodCoagulation') and answer.exists())"
            }
          ],
          "rule" : [
            {
              "name" : "answerValueString",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "rule" : [
                {
                  "name" : "bloodCoagulation",
                  "source" : [
                    {
                      "context" : "answer",
                      "type" : "Coding",
                      "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" : "extension",
                      "variable" : "ext1"
                    },
                    {
                      "context" : "ext1",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type"
                        }
                      ]
                    },
                    {
                      "context" : "ext1",
                      "contextType" : "variable",
                      "element" : "value",
                      "variable" : "coding",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Coding"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "code",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "64779008"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "system",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://snomed.info/sct"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "display",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "Blood coagulation disorder (disorder)"
                        }
                      ]
                    },
                    {
                      "context" : "condition",
                      "contextType" : "variable",
                      "element" : "extension",
                      "variable" : "ext2"
                    },
                    {
                      "context" : "ext2",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value"
                        }
                      ]
                    },
                    {
                      "context" : "ext2",
                      "contextType" : "variable",
                      "element" : "value",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "value"
                        }
                      ]
                    },
                    {
                      "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"
                        }
                      ]
                    }
                  ],
                  "rule" : [
                    {
                      "name" : "caveatBloodCoagulationINR",
                      "source" : [
                        {
                          "context" : "answer",
                          "element" : "item",
                          "variable" : "subitem",
                          "condition" : "(linkId.value = 'caveatList.bloodCoagulation.INR')"
                        }
                      ],
                      "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" : "observation",
                          "contextType" : "variable",
                          "element" : "status",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "final"
                            }
                          ]
                        },
                        {
                          "context" : "e",
                          "contextType" : "variable",
                          "element" : "fullUrl",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "'urn:uuid:' + %uuid"
                            }
                          ]
                        },
                        {
                          "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" : "code",
                          "variable" : "cc"
                        },
                        {
                          "context" : "cc",
                          "contextType" : "variable",
                          "element" : "coding",
                          "variable" : "c"
                        },
                        {
                          "context" : "c",
                          "contextType" : "variable",
                          "element" : "system",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "http://loinc.org"
                            }
                          ]
                        },
                        {
                          "context" : "c",
                          "contextType" : "variable",
                          "element" : "code",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "34714-6"
                            }
                          ]
                        },
                        {
                          "context" : "observation",
                          "contextType" : "variable",
                          "element" : "subject",
                          "variable" : "subject"
                        },
                        {
                          "context" : "subject",
                          "contextType" : "variable",
                          "element" : "reference",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "'urn:uuid:' + %patient.id"
                            }
                          ]
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "caveatBloodCoagulationINRQuantity",
                          "source" : [
                            {
                              "context" : "subitem",
                              "element" : "item",
                              "variable" : "quantityitem",
                              "condition" : "((linkId.value = 'caveatList.bloodCoagulation.INR.quantity') and answer.exists())"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "caveatBloodCoagulationINRQuantityValue",
                              "source" : [
                                {
                                  "context" : "quantityitem",
                                  "element" : "answer",
                                  "variable" : "answer"
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "value",
                                  "source" : [
                                    {
                                      "context" : "answer",
                                      "type" : "Quantity",
                                      "element" : "value",
                                      "variable" : "value"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "observation",
                                      "contextType" : "variable",
                                      "element" : "value",
                                      "transform" : "copy",
                                      "parameter" : [
                                        {
                                          "valueId" : "value"
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name" : "caveatBloodCoagulationINRDateTime",
                          "source" : [
                            {
                              "context" : "subitem",
                              "element" : "item",
                              "variable" : "datetimeitem",
                              "condition" : "((linkId.value = 'caveatList.bloodCoagulation.INR.dateTime') and answer.exists())"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "caveatBloodCoagulationINRDateTimeValue",
                              "source" : [
                                {
                                  "context" : "datetimeitem",
                                  "element" : "answer",
                                  "variable" : "answer"
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "value",
                                  "source" : [
                                    {
                                      "context" : "answer",
                                      "type" : "dateTime",
                                      "element" : "value",
                                      "variable" : "value"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "observation",
                                      "contextType" : "variable",
                                      "element" : "effective",
                                      "transform" : "copy",
                                      "parameter" : [
                                        {
                                          "valueId" : "value"
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "caveatBloodCoagulationINR",
                      "source" : [
                        {
                          "context" : "answer",
                          "element" : "item",
                          "variable" : "subitem",
                          "condition" : "(linkId.value = 'caveatList.bloodCoagulation.platelets')"
                        }
                      ],
                      "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" : "observation",
                          "contextType" : "variable",
                          "element" : "status",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "final"
                            }
                          ]
                        },
                        {
                          "context" : "e",
                          "contextType" : "variable",
                          "element" : "fullUrl",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "'urn:uuid:' + %uuid"
                            }
                          ]
                        },
                        {
                          "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" : "code",
                          "variable" : "cc"
                        },
                        {
                          "context" : "cc",
                          "contextType" : "variable",
                          "element" : "coding",
                          "variable" : "c"
                        },
                        {
                          "context" : "c",
                          "contextType" : "variable",
                          "element" : "system",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "http://loinc.org"
                            }
                          ]
                        },
                        {
                          "context" : "c",
                          "contextType" : "variable",
                          "element" : "code",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "26515-7"
                            }
                          ]
                        },
                        {
                          "context" : "observation",
                          "contextType" : "variable",
                          "element" : "subject",
                          "variable" : "subject"
                        },
                        {
                          "context" : "subject",
                          "contextType" : "variable",
                          "element" : "reference",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "'urn:uuid:' + %patient.id"
                            }
                          ]
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "caveatBloodCoagulationINRPlatelets",
                          "source" : [
                            {
                              "context" : "subitem",
                              "element" : "item",
                              "variable" : "quantityitem",
                              "condition" : "((linkId.value = 'caveatList.bloodCoagulation.platelets.quantity') and answer.exists())"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "caveatBloodCoagulationINRPlateletsValue",
                              "source" : [
                                {
                                  "context" : "quantityitem",
                                  "element" : "answer",
                                  "variable" : "answer"
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "value",
                                  "source" : [
                                    {
                                      "context" : "answer",
                                      "type" : "Quantity",
                                      "element" : "value",
                                      "variable" : "value"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "observation",
                                      "contextType" : "variable",
                                      "element" : "value",
                                      "transform" : "copy",
                                      "parameter" : [
                                        {
                                          "valueId" : "value"
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name" : "caveatBloodCoagulationINRPlatelets",
                          "source" : [
                            {
                              "context" : "subitem",
                              "element" : "item",
                              "variable" : "datetimeitem",
                              "condition" : "((linkId.value = 'caveatList.bloodCoagulation.platelets.dateTime') and answer.exists())"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "caveatBloodCoagulationINRPlateletsValue",
                              "source" : [
                                {
                                  "context" : "datetimeitem",
                                  "element" : "answer",
                                  "variable" : "answer"
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "value",
                                  "source" : [
                                    {
                                      "context" : "answer",
                                      "type" : "dateTime",
                                      "element" : "value",
                                      "variable" : "value"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "observation",
                                      "contextType" : "variable",
                                      "element" : "effective",
                                      "transform" : "copy",
                                      "parameter" : [
                                        {
                                          "valueId" : "value"
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "itemAnswer",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'caveatList.renalInsufficiency') and answer.exists())"
            }
          ],
          "rule" : [
            {
              "name" : "answerValueString",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "rule" : [
                {
                  "name" : "bloodCoagulation",
                  "source" : [
                    {
                      "context" : "answer",
                      "type" : "Coding",
                      "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" : "extension",
                      "variable" : "ext1"
                    },
                    {
                      "context" : "ext1",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type"
                        }
                      ]
                    },
                    {
                      "context" : "ext1",
                      "contextType" : "variable",
                      "element" : "value",
                      "variable" : "coding",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Coding"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "code",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "723188008"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "system",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://snomed.info/sct"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "display",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "Renal insufficiency (disorder)"
                        }
                      ]
                    },
                    {
                      "context" : "condition",
                      "contextType" : "variable",
                      "element" : "extension",
                      "variable" : "ext2"
                    },
                    {
                      "context" : "ext2",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value"
                        }
                      ]
                    },
                    {
                      "context" : "ext2",
                      "contextType" : "variable",
                      "element" : "value",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "value"
                        }
                      ]
                    },
                    {
                      "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" : "caveatListRenalInsufficiencyCreatinineClearanceINR",
                      "source" : [
                        {
                          "context" : "answer",
                          "element" : "item",
                          "variable" : "subitem",
                          "condition" : "(linkId.value = 'caveatList.renalInsufficiency.creatinineClearance')"
                        }
                      ],
                      "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" : "status",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "final"
                            }
                          ]
                        },
                        {
                          "context" : "observation",
                          "contextType" : "variable",
                          "element" : "id",
                          "variable" : "uuid",
                          "transform" : "uuid"
                        },
                        {
                          "context" : "e",
                          "contextType" : "variable",
                          "element" : "fullUrl",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "'urn:uuid:' + %uuid"
                            }
                          ]
                        },
                        {
                          "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" : "code",
                          "variable" : "cc"
                        },
                        {
                          "context" : "cc",
                          "contextType" : "variable",
                          "element" : "coding",
                          "variable" : "c"
                        },
                        {
                          "context" : "c",
                          "contextType" : "variable",
                          "element" : "system",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "http://loinc.org"
                            }
                          ]
                        },
                        {
                          "context" : "c",
                          "contextType" : "variable",
                          "element" : "code",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "33558-8"
                            }
                          ]
                        },
                        {
                          "context" : "observation",
                          "contextType" : "variable",
                          "element" : "subject",
                          "variable" : "subject"
                        },
                        {
                          "context" : "subject",
                          "contextType" : "variable",
                          "element" : "reference",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "'urn:uuid:' + %patient.id"
                            }
                          ]
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "caveatListRenalInsufficiencyCreatinineClearanceQuantity",
                          "source" : [
                            {
                              "context" : "subitem",
                              "element" : "item",
                              "variable" : "quantityitem",
                              "condition" : "((linkId.value = 'caveatList.renalInsufficiency.creatinineClearance.quantity') and answer.exists())"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "caveatListRenalInsufficiencyCreatinineClearanceQuantityValue",
                              "source" : [
                                {
                                  "context" : "quantityitem",
                                  "element" : "answer",
                                  "variable" : "answer"
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "value",
                                  "source" : [
                                    {
                                      "context" : "answer",
                                      "type" : "Quantity",
                                      "element" : "value",
                                      "variable" : "value"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "observation",
                                      "contextType" : "variable",
                                      "element" : "value",
                                      "transform" : "copy",
                                      "parameter" : [
                                        {
                                          "valueId" : "value"
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name" : "caveatListRenalInsufficiencyCreatinineClearancedateTime",
                          "source" : [
                            {
                              "context" : "subitem",
                              "element" : "item",
                              "variable" : "datetimeitem",
                              "condition" : "((linkId.value = 'caveatList.renalInsufficiency.creatinineClearance.dateTime') and answer.exists())"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "caveatListRenalInsufficiencyCreatinineClearanceDateTimeValue",
                              "source" : [
                                {
                                  "context" : "datetimeitem",
                                  "element" : "answer",
                                  "variable" : "answer"
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "value",
                                  "source" : [
                                    {
                                      "context" : "answer",
                                      "type" : "dateTime",
                                      "element" : "value",
                                      "variable" : "value"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "observation",
                                      "contextType" : "variable",
                                      "element" : "effective",
                                      "transform" : "copy",
                                      "parameter" : [
                                        {
                                          "valueId" : "value"
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "name" : "caveatListRenalInsufficiencyCreatinine",
                      "source" : [
                        {
                          "context" : "answer",
                          "element" : "item",
                          "variable" : "subitem",
                          "condition" : "(linkId.value = 'caveatList.renalInsufficiency.creatinine')"
                        }
                      ],
                      "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" : "status",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "final"
                            }
                          ]
                        },
                        {
                          "context" : "observation",
                          "contextType" : "variable",
                          "element" : "id",
                          "variable" : "uuid",
                          "transform" : "uuid"
                        },
                        {
                          "context" : "e",
                          "contextType" : "variable",
                          "element" : "fullUrl",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "'urn:uuid:' + %uuid"
                            }
                          ]
                        },
                        {
                          "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" : "code",
                          "variable" : "cc"
                        },
                        {
                          "context" : "cc",
                          "contextType" : "variable",
                          "element" : "coding",
                          "variable" : "c"
                        },
                        {
                          "context" : "c",
                          "contextType" : "variable",
                          "element" : "system",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "http://loinc.org"
                            }
                          ]
                        },
                        {
                          "context" : "c",
                          "contextType" : "variable",
                          "element" : "code",
                          "transform" : "copy",
                          "parameter" : [
                            {
                              "valueString" : "77140-2"
                            }
                          ]
                        },
                        {
                          "context" : "observation",
                          "contextType" : "variable",
                          "element" : "subject",
                          "variable" : "subject"
                        },
                        {
                          "context" : "subject",
                          "contextType" : "variable",
                          "element" : "reference",
                          "transform" : "evaluate",
                          "parameter" : [
                            {
                              "valueString" : "'urn:uuid:' + %patient.id"
                            }
                          ]
                        }
                      ],
                      "rule" : [
                        {
                          "name" : "caveatListRenalInsufficiencyCreatinine",
                          "source" : [
                            {
                              "context" : "subitem",
                              "element" : "item",
                              "variable" : "quantityitem",
                              "condition" : "((linkId.value = 'caveatList.renalInsufficiency.creatinine.quantity') and answer.exists())"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "caveatListRenalInsufficiencyCreatinineValue",
                              "source" : [
                                {
                                  "context" : "quantityitem",
                                  "element" : "answer",
                                  "variable" : "answer"
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "value",
                                  "source" : [
                                    {
                                      "context" : "answer",
                                      "type" : "Quantity",
                                      "element" : "value",
                                      "variable" : "value"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "observation",
                                      "contextType" : "variable",
                                      "element" : "value",
                                      "transform" : "copy",
                                      "parameter" : [
                                        {
                                          "valueId" : "value"
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        },
                        {
                          "name" : "caveatBloodCoagulationINRPlatelets",
                          "source" : [
                            {
                              "context" : "subitem",
                              "element" : "item",
                              "variable" : "datetimeitem",
                              "condition" : "((linkId.value = 'caveatList.renalInsufficiency.creatinine.dateTime') and answer.exists())"
                            }
                          ],
                          "rule" : [
                            {
                              "name" : "caveatListRenalInsufficiencyCreatininevalue",
                              "source" : [
                                {
                                  "context" : "datetimeitem",
                                  "element" : "answer",
                                  "variable" : "answer"
                                }
                              ],
                              "rule" : [
                                {
                                  "name" : "value",
                                  "source" : [
                                    {
                                      "context" : "answer",
                                      "type" : "dateTime",
                                      "element" : "value",
                                      "variable" : "value"
                                    }
                                  ],
                                  "target" : [
                                    {
                                      "context" : "observation",
                                      "contextType" : "variable",
                                      "element" : "effective",
                                      "transform" : "copy",
                                      "parameter" : [
                                        {
                                          "valueId" : "value"
                                        }
                                      ]
                                    }
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "itemAnswer",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'caveatList.claustrophobia') and answer.exists())"
            }
          ],
          "rule" : [
            {
              "name" : "answerValueString",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "rule" : [
                {
                  "name" : "caveatListClaustrophobia",
                  "source" : [
                    {
                      "context" : "answer",
                      "type" : "Coding",
                      "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" : "extension",
                      "variable" : "ext1"
                    },
                    {
                      "context" : "ext1",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type"
                        }
                      ]
                    },
                    {
                      "context" : "ext1",
                      "contextType" : "variable",
                      "element" : "value",
                      "variable" : "coding",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Coding"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "code",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "19887002"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "system",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://snomed.info/sct"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "display",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "Claustrophobia (finding)"
                        }
                      ]
                    },
                    {
                      "context" : "condition",
                      "contextType" : "variable",
                      "element" : "extension",
                      "variable" : "ext2"
                    },
                    {
                      "context" : "ext2",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value"
                        }
                      ]
                    },
                    {
                      "context" : "ext2",
                      "contextType" : "variable",
                      "element" : "value",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "value"
                        }
                      ]
                    },
                    {
                      "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" : "itemAnswer",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'caveatList.bodyPiercing') and answer.exists())"
            }
          ],
          "rule" : [
            {
              "name" : "answerValueString",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "rule" : [
                {
                  "name" : "caveatListBodyPiercing",
                  "source" : [
                    {
                      "context" : "answer",
                      "type" : "Coding",
                      "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" : "extension",
                      "variable" : "ext1"
                    },
                    {
                      "context" : "ext1",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type"
                        }
                      ]
                    },
                    {
                      "context" : "ext1",
                      "contextType" : "variable",
                      "element" : "value",
                      "variable" : "coding",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Coding"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "code",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "879862001"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "system",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://snomed.info/sct"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "display",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "Body piercing (finding)"
                        }
                      ]
                    },
                    {
                      "context" : "condition",
                      "contextType" : "variable",
                      "element" : "extension",
                      "variable" : "ext2"
                    },
                    {
                      "context" : "ext2",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value"
                        }
                      ]
                    },
                    {
                      "context" : "ext2",
                      "contextType" : "variable",
                      "element" : "value",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "value"
                        }
                      ]
                    },
                    {
                      "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" : "itemAnswer",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'caveatList.device') and answer.exists())"
            }
          ],
          "rule" : [
            {
              "name" : "answerValueString",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "rule" : [
                {
                  "name" : "caveatListDevice",
                  "source" : [
                    {
                      "context" : "answer",
                      "type" : "Coding",
                      "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" : "extension",
                      "variable" : "ext1"
                    },
                    {
                      "context" : "ext1",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type"
                        }
                      ]
                    },
                    {
                      "context" : "ext1",
                      "contextType" : "variable",
                      "element" : "value",
                      "variable" : "coding",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Coding"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "code",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "397578001"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "system",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://snomed.info/sct"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "display",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "Device in situ (finding)"
                        }
                      ]
                    },
                    {
                      "context" : "condition",
                      "contextType" : "variable",
                      "element" : "extension",
                      "variable" : "ext2"
                    },
                    {
                      "context" : "ext2",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value"
                        }
                      ]
                    },
                    {
                      "context" : "ext2",
                      "contextType" : "variable",
                      "element" : "value",
                      "variable" : "coding",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Coding"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "code",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "52101004"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "system",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://snomed.info/sct"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "display",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "Present (qualifier value)"
                        }
                      ]
                    },
                    {
                      "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",
                      "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" : "itemAnswer",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'caveatList.hyperthyroidism') and answer.exists())"
            }
          ],
          "rule" : [
            {
              "name" : "answerValueString",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "rule" : [
                {
                  "name" : "caveatListHyperthyroidism",
                  "source" : [
                    {
                      "context" : "answer",
                      "type" : "Coding",
                      "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" : "extension",
                      "variable" : "ext1"
                    },
                    {
                      "context" : "ext1",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type"
                        }
                      ]
                    },
                    {
                      "context" : "ext1",
                      "contextType" : "variable",
                      "element" : "value",
                      "variable" : "coding",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Coding"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "code",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "34486009"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "system",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://snomed.info/sct"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "display",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "Hyperthyroidism (disorder)"
                        }
                      ]
                    },
                    {
                      "context" : "condition",
                      "contextType" : "variable",
                      "element" : "extension",
                      "variable" : "ext2"
                    },
                    {
                      "context" : "ext2",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value"
                        }
                      ]
                    },
                    {
                      "context" : "ext2",
                      "contextType" : "variable",
                      "element" : "value",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "value"
                        }
                      ]
                    },
                    {
                      "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" : "itemAnswer",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'caveatList.diabetes') and answer.exists())"
            }
          ],
          "rule" : [
            {
              "name" : "answerValueString",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "rule" : [
                {
                  "name" : "caveatListDiabetes",
                  "source" : [
                    {
                      "context" : "answer",
                      "type" : "Coding",
                      "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" : "extension",
                      "variable" : "ext1"
                    },
                    {
                      "context" : "ext1",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type"
                        }
                      ]
                    },
                    {
                      "context" : "ext1",
                      "contextType" : "variable",
                      "element" : "value",
                      "variable" : "coding",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Coding"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "code",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "73211009"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "system",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://snomed.info/sct"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "display",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "Diabetes mellitus (disorder)"
                        }
                      ]
                    },
                    {
                      "context" : "condition",
                      "contextType" : "variable",
                      "element" : "extension",
                      "variable" : "ext2"
                    },
                    {
                      "context" : "ext2",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value"
                        }
                      ]
                    },
                    {
                      "context" : "ext2",
                      "contextType" : "variable",
                      "element" : "value",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "value"
                        }
                      ]
                    },
                    {
                      "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" : "itemAnswer",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'caveatList.gravida') and answer.exists())"
            }
          ],
          "rule" : [
            {
              "name" : "answerValueString",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "rule" : [
                {
                  "name" : "caveatListGravida",
                  "source" : [
                    {
                      "context" : "answer",
                      "type" : "Coding",
                      "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" : "extension",
                      "variable" : "ext1"
                    },
                    {
                      "context" : "ext1",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type"
                        }
                      ]
                    },
                    {
                      "context" : "ext1",
                      "contextType" : "variable",
                      "element" : "value",
                      "variable" : "coding",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Coding"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "code",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "366321006"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "system",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://snomed.info/sct"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "display",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "Finding of gravida (finding)"
                        }
                      ]
                    },
                    {
                      "context" : "condition",
                      "contextType" : "variable",
                      "element" : "extension",
                      "variable" : "ext2"
                    },
                    {
                      "context" : "ext2",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value"
                        }
                      ]
                    },
                    {
                      "context" : "ext2",
                      "contextType" : "variable",
                      "element" : "value",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "value"
                        }
                      ]
                    },
                    {
                      "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" : "itemAnswer",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "((linkId.value = 'caveatList.contrastMediaAllergy') and answer.exists())"
            }
          ],
          "rule" : [
            {
              "name" : "answerValueString",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "rule" : [
                {
                  "name" : "caveatListContrastMediaAllergy",
                  "source" : [
                    {
                      "context" : "answer",
                      "type" : "Coding",
                      "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" : "extension",
                      "variable" : "ext1"
                    },
                    {
                      "context" : "ext1",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type"
                        }
                      ]
                    },
                    {
                      "context" : "ext1",
                      "contextType" : "variable",
                      "element" : "value",
                      "variable" : "coding",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Coding"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "code",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "293637006"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "system",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://snomed.info/sct"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "display",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "Allergy to contrast media (finding)"
                        }
                      ]
                    },
                    {
                      "context" : "condition",
                      "contextType" : "variable",
                      "element" : "extension",
                      "variable" : "ext2"
                    },
                    {
                      "context" : "ext2",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value"
                        }
                      ]
                    },
                    {
                      "context" : "ext2",
                      "contextType" : "variable",
                      "element" : "value",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "value"
                        }
                      ]
                    },
                    {
                      "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" : "DrugPrescription",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "(linkId.value = 'caveatList.drugPrescription')"
            }
          ],
          "dependent" : [
            {
              "name" : "DesiredRadiologistServiceItemsDrugDescription",
              "variable" : [
                "item",
                "bundle",
                "serviceRequest",
                "patient"
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "DesiredRadiologistServiceItemsDrugDescription",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "src",
          "mode" : "source"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        },
        {
          "name" : "serviceRequest",
          "type" : "ServiceRequest",
          "mode" : "target"
        },
        {
          "name" : "patient",
          "type" : "Patient",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "caveatListDrugPrescriptionMetformin",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "(linkId.value = 'caveatList.drugPrescription.metformin')"
            }
          ],
          "rule" : [
            {
              "name" : "answerValueString",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "rule" : [
                {
                  "name" : "caveatListDrugPrescription",
                  "source" : [
                    {
                      "context" : "answer",
                      "type" : "Coding",
                      "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" : "extension",
                      "variable" : "ext1"
                    },
                    {
                      "context" : "ext1",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type"
                        }
                      ]
                    },
                    {
                      "context" : "ext1",
                      "contextType" : "variable",
                      "element" : "value",
                      "variable" : "coding",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Coding"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "code",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "182817000"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "system",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://snomed.info/sct"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "display",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "Drug prescription (situation)"
                        }
                      ]
                    },
                    {
                      "context" : "condition",
                      "contextType" : "variable",
                      "element" : "extension",
                      "variable" : "ext2"
                    },
                    {
                      "context" : "ext2",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value"
                        }
                      ]
                    },
                    {
                      "context" : "ext2",
                      "contextType" : "variable",
                      "element" : "value",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "value"
                        }
                      ]
                    },
                    {
                      "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" : "372567009"
                        }
                      ]
                    },
                    {
                      "context" : "coding2",
                      "contextType" : "variable",
                      "element" : "system",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://snomed.info/sct"
                        }
                      ]
                    },
                    {
                      "context" : "coding2",
                      "contextType" : "variable",
                      "element" : "display",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "Metformin (substance)"
                        }
                      ]
                    },
                    {
                      "context" : "condition",
                      "contextType" : "variable",
                      "element" : "subject",
                      "variable" : "subject"
                    },
                    {
                      "context" : "subject",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'urn:uuid:' + %patient.id"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "name" : "caveatListDrugPrescriptionBetaBlocker",
          "source" : [
            {
              "context" : "src",
              "element" : "item",
              "variable" : "item",
              "condition" : "(linkId.value = 'caveatList.drugPrescription.betaBlocker')"
            }
          ],
          "rule" : [
            {
              "name" : "answerValueString",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "rule" : [
                {
                  "name" : "caveatListDrugPrescription",
                  "source" : [
                    {
                      "context" : "answer",
                      "type" : "Coding",
                      "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" : "extension",
                      "variable" : "ext1"
                    },
                    {
                      "context" : "ext1",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-caveat-type"
                        }
                      ]
                    },
                    {
                      "context" : "ext1",
                      "contextType" : "variable",
                      "element" : "value",
                      "variable" : "coding",
                      "transform" : "create",
                      "parameter" : [
                        {
                          "valueString" : "Coding"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "code",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "182817000"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "system",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://snomed.info/sct"
                        }
                      ]
                    },
                    {
                      "context" : "coding",
                      "contextType" : "variable",
                      "element" : "display",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "Drug prescription (situation)"
                        }
                      ]
                    },
                    {
                      "context" : "condition",
                      "contextType" : "variable",
                      "element" : "extension",
                      "variable" : "ext2"
                    },
                    {
                      "context" : "ext2",
                      "contextType" : "variable",
                      "element" : "url",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://fhir.ch/ig/ch-rad-order/StructureDefinition/ch-rad-order-qualifier-value"
                        }
                      ]
                    },
                    {
                      "context" : "ext2",
                      "contextType" : "variable",
                      "element" : "value",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "value"
                        }
                      ]
                    },
                    {
                      "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" : "373254001"
                        }
                      ]
                    },
                    {
                      "context" : "coding2",
                      "contextType" : "variable",
                      "element" : "system",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "http://snomed.info/sct"
                        }
                      ]
                    },
                    {
                      "context" : "coding2",
                      "contextType" : "variable",
                      "element" : "display",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueString" : "Substance with beta adrenergic receptor antagonist mechanism of action (substance)"
                        }
                      ]
                    },
                    {
                      "context" : "condition",
                      "contextType" : "variable",
                      "element" : "subject",
                      "variable" : "subject"
                    },
                    {
                      "context" : "subject",
                      "contextType" : "variable",
                      "element" : "reference",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "'urn:uuid:' + %patient.id"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "PreviousImagingStudyResultsNonDicom",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "item",
          "mode" : "source"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        },
        {
          "name" : "serviceRequest",
          "type" : "ServiceRequest",
          "mode" : "target"
        },
        {
          "name" : "patient",
          "type" : "Patient",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "itemAnswer",
          "source" : [
            {
              "context" : "item",
              "variable" : "item"
            }
          ],
          "target" : [
            {
              "context" : "bundle",
              "contextType" : "variable",
              "element" : "entry",
              "variable" : "e"
            },
            {
              "context" : "e",
              "contextType" : "variable",
              "element" : "resource",
              "variable" : "documentReference",
              "transform" : "create",
              "parameter" : [
                {
                  "valueString" : "DocumentReference"
                }
              ]
            },
            {
              "context" : "documentReference",
              "contextType" : "variable",
              "element" : "id",
              "variable" : "uuid",
              "transform" : "uuid"
            },
            {
              "context" : "documentReference",
              "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" : "documentReference",
              "contextType" : "variable",
              "element" : "status",
              "transform" : "copy",
              "parameter" : [
                {
                  "valueString" : "current"
                }
              ]
            },
            {
              "context" : "serviceRequest",
              "contextType" : "variable",
              "element" : "supportingInfo",
              "variable" : "supportingInfo"
            },
            {
              "context" : "supportingInfo",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %uuid"
                }
              ]
            }
          ],
          "rule" : [
            {
              "name" : "answerValueString",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "target" : [
                {
                  "context" : "documentReference",
                  "contextType" : "variable",
                  "element" : "content",
                  "variable" : "content"
                },
                {
                  "context" : "content",
                  "contextType" : "variable",
                  "element" : "attachment",
                  "variable" : "attachment",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "%answer.value"
                    }
                  ]
                }
              ],
              "rule" : [
                {
                  "name" : "description",
                  "source" : [
                    {
                      "context" : "answer",
                      "element" : "item",
                      "variable" : "dictomitem",
                      "condition" : "((linkId.value = 'attachedFile.description') and answer.exists())"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "documentReference",
                      "contextType" : "variable",
                      "element" : "description",
                      "transform" : "evaluate",
                      "parameter" : [
                        {
                          "valueString" : "%dictomitem.answer.value"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "name" : "PreviousImagingStudyResults",
      "typeMode" : "none",
      "input" : [
        {
          "name" : "item",
          "mode" : "source"
        },
        {
          "name" : "bundle",
          "type" : "Bundle",
          "mode" : "target"
        },
        {
          "name" : "serviceRequest",
          "type" : "ServiceRequest",
          "mode" : "target"
        },
        {
          "name" : "patient",
          "type" : "Patient",
          "mode" : "target"
        }
      ],
      "rule" : [
        {
          "name" : "supportingInfo",
          "source" : [
            {
              "context" : "item",
              "variable" : "item"
            }
          ],
          "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" : "imagingStudy",
              "contextType" : "variable",
              "element" : "series",
              "variable" : "series"
            },
            {
              "context" : "series",
              "contextType" : "variable",
              "element" : "instance",
              "variable" : "instance"
            },
            {
              "context" : "supportingInfo",
              "contextType" : "variable",
              "element" : "reference",
              "transform" : "evaluate",
              "parameter" : [
                {
                  "valueString" : "'urn:uuid:' + %uuid"
                }
              ]
            }
          ],
          "rule" : [
            {
              "name" : "answerValueString",
              "source" : [
                {
                  "context" : "item",
                  "element" : "answer",
                  "variable" : "answer"
                }
              ],
              "rule" : [
                {
                  "name" : "description",
                  "source" : [
                    {
                      "context" : "answer",
                      "type" : "string",
                      "element" : "value",
                      "variable" : "value"
                    }
                  ],
                  "target" : [
                    {
                      "context" : "imagingStudy",
                      "contextType" : "variable",
                      "element" : "description",
                      "transform" : "copy",
                      "parameter" : [
                        {
                          "valueId" : "value"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "name" : "uid",
              "source" : [
                {
                  "context" : "item",
                  "element" : "item",
                  "variable" : "item",
                  "condition" : "(linkId.value = 'dicomObject.sopInstanceUid') and answer.exists()"
                }
              ],
              "target" : [
                {
                  "context" : "instance",
                  "contextType" : "variable",
                  "element" : "uid",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "%item.answer.value"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "modality",
              "source" : [
                {
                  "context" : "item",
                  "element" : "item",
                  "variable" : "item",
                  "condition" : "(linkId.value = 'dicomObject.modality') and answer.exists()"
                }
              ],
              "target" : [
                {
                  "context" : "series",
                  "contextType" : "variable",
                  "element" : "modality",
                  "variable" : "modality"
                },
                {
                  "context" : "modality",
                  "contextType" : "variable",
                  "element" : "code",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "%item.answer.value.code"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "uid",
              "source" : [
                {
                  "context" : "item",
                  "element" : "item",
                  "variable" : "item",
                  "condition" : "(linkId.value = 'dicomObject.studyInstanceUid') and answer.exists()"
                }
              ],
              "target" : [
                {
                  "context" : "imagingStudy",
                  "contextType" : "variable",
                  "element" : "identifier",
                  "variable" : "uid"
                },
                {
                  "context" : "uid",
                  "contextType" : "variable",
                  "element" : "type",
                  "variable" : "type"
                },
                {
                  "context" : "type",
                  "contextType" : "variable",
                  "element" : "coding",
                  "variable" : "coding"
                },
                {
                  "context" : "coding",
                  "contextType" : "variable",
                  "element" : "system",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "urn:dicom:uid"
                    }
                  ]
                },
                {
                  "context" : "coding",
                  "contextType" : "variable",
                  "element" : "code",
                  "transform" : "copy",
                  "parameter" : [
                    {
                      "valueString" : "PLAC"
                    }
                  ]
                },
                {
                  "context" : "uid",
                  "contextType" : "variable",
                  "element" : "value",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "%item.answer.value"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "attachmentdicomSeriesInstanceUid",
              "source" : [
                {
                  "context" : "item",
                  "element" : "item",
                  "variable" : "item",
                  "condition" : "(linkId.value = 'dicomObject.SeriesInstanceUid') and answer.exists()"
                }
              ],
              "target" : [
                {
                  "context" : "series",
                  "contextType" : "variable",
                  "element" : "uid",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "%item.answer.value"
                    }
                  ]
                }
              ]
            },
            {
              "name" : "acsn",
              "source" : [
                {
                  "context" : "item",
                  "element" : "item",
                  "variable" : "item",
                  "condition" : "(linkId.value = 'dicomObject.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" : "value",
                  "transform" : "evaluate",
                  "parameter" : [
                    {
                      "valueString" : "%item.answer.value"
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}