Structured Data Capture
3.0.0 - STU 3 International flag

Structured Data Capture, published by HL7 International / FHIR Infrastructure. This guide is not an authorized publication; it is the continuous build for version 3.0.0 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/HL7/sdc/ and changes regularly. See the Directory of published versions

: SDC Map population StructureMap example - TTL Representation

Page standards status: Informative

Raw ttl | Download

@prefix fhir: <http://hl7.org/fhir/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

# - resource -------------------------------------------------------------------

 a fhir:StructureMap ;
  fhir:nodeRole fhir:treeRoot ;
  fhir:id [ fhir:v "questionnaire-population-transform"] ; # 
  fhir:text [
fhir:status [ fhir:v "generated" ] ;
fhir:div "<div xmlns=\"http://www.w3.org/1999/xhtml\"><pre class=\"fml\">\r\n<b>map</b><span style=\"color: navy\"> &quot;</span>http://hl7.org/fhir/uv/sdc/StructureMap/questionnaire-population-transform<span style=\"color: navy\">&quot; = &quot;</span>QuestionnairePopulationTransform<span style=\"color: navy\">&quot;\r\n\r\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">Sample structure map showing process for auto-populating a QuestionnaireResponse from a query bundle</span>\r\n\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>as </b><b>source</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>as </b><b>target</b>\r\n\r\n<b>group </b>main<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">src</span><span style=\"color: navy\"> : </span>Bundle, <b>target</b> <span style=\"color: maroon\">qr</span><span style=\"color: navy\"> : </span>QuestionnaireResponse<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span>  src<span style=\"color: navy\"><b> -&gt; </b></span>qr.questionnaire = <span style=\"color: blue\">'http://hl7.org/fhir/uv/sdc/Questionnaire/questionnaire-sdc-test-fhirpath-prepop-source-query'</span> <i>&quot;questionnaire&quot;</i><span style=\"color: navy\">;</span>\r\n  src<span style=\"color: navy\"><b> -&gt; </b></span>qr.status = <span style=\"color: blue\">'in-progress'</span> <i>&quot;status&quot;</i><span style=\"color: navy\">;</span>\r\n  src<span style=\"color: navy\"><b> -&gt; </b></span>qr.authored = <span style=\"color: navy\">(</span>now()<span style=\"color: navy\">)</span> <i>&quot;authored&quot;</i><span style=\"color: navy\">;</span>\r\n  src.entry first<b> as </b><span style=\"color: maroon\">patient</span><span style=\"color: navy\"><b> -&gt; </b></span> qr.subject<b> as </b><span style=\"color: maroon\">subject</span><span style=\"color: navy\">, </span> subject.reference = <span style=\"color: navy\">(</span>patient.resource.entry.fullUrl<span style=\"color: navy\">)</span> <i>&quot;subject&quot;</i><span style=\"color: navy\">;</span>\r\n  src<span style=\"color: navy\"><b> -&gt; </b></span> qr.item<b> as </b><span style=\"color: maroon\">grp</span><span style=\"color: navy\">, </span> grp.linkId = <span style=\"color: blue\">'grp'</span><b> then</b><span style=\"color: navy\"> {\r\n</span>    src<span style=\"color: navy\"><b> -&gt; </b></span> grp.item<b> as </b><span style=\"color: maroon\">partDetails</span><span style=\"color: navy\">, </span> partDetails.linkId = <span style=\"color: blue\">'part-details'</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      src.entry first<b> as </b><span style=\"color: maroon\">patient</span><span style=\"color: navy\"><b> -&gt; </b></span><span style=\"color: maroon\">partDetails</span><b> then</b><span style=\"color: navy\"> {\r\n</span>        patient.resource<b> as </b><span style=\"color: maroon\">patientRes</span><span style=\"color: navy\"><b> -&gt; </b></span> partDetails.item<b> as </b><span style=\"color: maroon\">participantId</span><span style=\"color: navy\">, </span> participantId.linkId = <span style=\"color: blue\">'participant-id'</span><b> then</b><span style=\"color: navy\"> {\r\n</span>          patientRes.entry<b> as </b><span style=\"color: maroon\">patientResEntry</span><span style=\"color: navy\"><b> -&gt; </b></span> participantId.answer<b> as </b><span style=\"color: maroon\">participantIdAnswer</span><span style=\"color: navy\">, </span> participantIdAnswer.value = <span style=\"color: navy\">(</span>patientResEntry.resource.id<span style=\"color: navy\">)</span> <i>&quot;participantIdValue&quot;</i><span style=\"color: navy\">;</span>\r\n        <span style=\"color: navy\">}</span> <i>&quot;participantId&quot;</i><span style=\"color: navy\">;</span>\r\n        patient.resource<b> as </b><span style=\"color: maroon\">patientRes</span><span style=\"color: navy\"><b> -&gt; </b></span> partDetails.item<b> as </b><span style=\"color: maroon\">familyName</span><span style=\"color: navy\">, </span> familyName.linkId = <span style=\"color: blue\">'family-name'</span><b> then</b><span style=\"color: navy\"> {\r\n</span>          patientRes.entry<b> as </b><span style=\"color: maroon\">patientResEntry</span><span style=\"color: navy\"><b> -&gt; </b></span> familyName.answer<b> as </b><span style=\"color: maroon\">familyNameAnswer</span><span style=\"color: navy\">, </span> familyNameAnswer.value = <span style=\"color: navy\">(</span>patientResEntry.resource.name.first().family<span style=\"color: navy\">)</span> <i>&quot;familyNameValue&quot;</i><span style=\"color: navy\">;</span>\r\n        <span style=\"color: navy\">}</span> <i>&quot;familyName&quot;</i><span style=\"color: navy\">;</span>\r\n        patient.resource<b> as </b><span style=\"color: maroon\">patientRes</span><span style=\"color: navy\"><b> -&gt; </b></span> partDetails.item<b> as </b><span style=\"color: maroon\">givenName</span><span style=\"color: navy\">, </span> givenName.linkId = <span style=\"color: blue\">'given-name'</span><b> then</b><span style=\"color: navy\"> {\r\n</span>          patientRes.entry<b> as </b><span style=\"color: maroon\">patientResEntry</span><span style=\"color: navy\"><b> -&gt; </b></span> givenName.answer<b> as </b><span style=\"color: maroon\">givenNameAnswer</span><span style=\"color: navy\">, </span> givenNameAnswer.value = <span style=\"color: navy\">(</span>patientResEntry.resource.name.first().given.aggregate(iif($total.empty(), $this, $total &amp; ' ' &amp; $this))<span style=\"color: navy\">)</span> <i>&quot;givenNameValue&quot;</i><span style=\"color: navy\">;</span>\r\n        <span style=\"color: navy\">}</span> <i>&quot;givenName&quot;</i><span style=\"color: navy\">;</span>\r\n        patient.resource<b> as </b><span style=\"color: maroon\">patientRes</span><span style=\"color: navy\"><b> -&gt; </b></span> partDetails.item<b> as </b><span style=\"color: maroon\">dob</span><span style=\"color: navy\">, </span> dob.linkId = <span style=\"color: blue\">'dob'</span><b> then</b><span style=\"color: navy\"> {\r\n</span>          patientRes.entry<b> as </b><span style=\"color: maroon\">patientResEntry</span><span style=\"color: navy\"><b> -&gt; </b></span> dob.answer<b> as </b><span style=\"color: maroon\">dobAnswer</span><span style=\"color: navy\">, </span> dobAnswer.value = <span style=\"color: navy\">(</span>patientResEntry.resource.birthDate<span style=\"color: navy\">)</span> <i>&quot;dobValue&quot;</i><span style=\"color: navy\">;</span>\r\n        <span style=\"color: navy\">}</span> <i>&quot;dob&quot;</i><span style=\"color: navy\">;</span>\r\n      <span style=\"color: navy\">}</span> <i>&quot;patientDetails&quot;</i><span style=\"color: navy\">;</span>\r\n      src.entry<b> as </b><span style=\"color: maroon\">conditions</span><b> where </b>(resource.link.url.contains('/Condition?'))<span style=\"color: navy\"><b> -&gt; </b></span> partDetails.item<b> as </b><span style=\"color: maroon\">conditionItem</span><span style=\"color: navy\">, </span> conditionItem.linkId = <span style=\"color: blue\">'condition-count'</span><b> then</b><span style=\"color: navy\"> {\r\n</span>        conditions<span style=\"color: navy\"><b> -&gt; </b></span> conditionItem.answer<b> as </b><span style=\"color: maroon\">conditionCountAnswer</span><span style=\"color: navy\">, </span> conditionCountAnswer.value = <span style=\"color: navy\">(</span>conditions.resource.entry.count()<span style=\"color: navy\">)</span> <i>&quot;conditionCountAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n      <span style=\"color: navy\">}</span> <i>&quot;condition-count&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;part-details&quot;</i><span style=\"color: navy\">;</span>\r\n    src.entry<b> as </b><span style=\"color: maroon\">medications</span><b> where </b>(resource.link.url.contains('/MedicationStatement?'))<span style=\"color: navy\"><b> -&gt; </b></span><span style=\"color: maroon\">grp</span><b> then</b><span style=\"color: navy\"> {\r\n</span>      medications.resource<b> as </b><span style=\"color: maroon\">medRes</span><span style=\"color: navy\"><b> -&gt; </b></span><span style=\"color: maroon\">grp</span><b> then</b><span style=\"color: navy\"> {\r\n</span>        medRes.entry<b> as </b><span style=\"color: maroon\">med</span><b> where </b>(resource is MedicationStatement)<span style=\"color: navy\"><b> -&gt; </b></span> grp.item<b> as </b><span style=\"color: maroon\">medsItem</span><span style=\"color: navy\">, </span> medsItem.linkId = <span style=\"color: blue\">'meds'</span><b> then</b><span style=\"color: navy\"> {\r\n</span>          med.resource<b> as </b><span style=\"color: maroon\">medResource</span><span style=\"color: navy\"><b> -&gt; </b></span> medsItem.item<b> as </b><span style=\"color: maroon\">medsName</span><span style=\"color: navy\">, </span> medsName.linkId = <span style=\"color: blue\">'meds-name'</span><b> then</b><span style=\"color: navy\"> {\r\n</span>            medResource.medication<b> as </b><span style=\"color: maroon\">medMedication</span><span style=\"color: navy\"><b> -&gt; </b></span> medsName.answer<b> as </b><span style=\"color: maroon\">medsNameAnswer</span><span style=\"color: navy\">, </span> medsNameAnswer.value = <span style=\"color: navy\">(</span>medMedication.select(iif(text, text, coding.display.first()))<span style=\"color: navy\">)</span> <i>&quot;medsNameAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n          <span style=\"color: navy\">}</span> <i>&quot;medsName&quot;</i><span style=\"color: navy\">;</span>\r\n          med.resource<b> as </b><span style=\"color: maroon\">medResource</span><span style=\"color: navy\"><b> -&gt; </b></span> medsItem.item<b> as </b><span style=\"color: maroon\">medsStatus</span><span style=\"color: navy\">, </span> medsStatus.linkId = <span style=\"color: blue\">'med-status'</span><b> then</b><span style=\"color: navy\"> {\r\n</span>            medResource.medication<b> as </b><span style=\"color: maroon\">medsMedication</span><span style=\"color: navy\"><b> -&gt; </b></span> medsStatus.answer<b> as </b><span style=\"color: maroon\">medsStatusAnswer</span><span style=\"color: navy\">, </span> medsStatusAnswer.value = <span style=\"color: navy\">(</span>medResource.status<span style=\"color: navy\">)</span> <i>&quot;medsStatusAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n          <span style=\"color: navy\">}</span> <i>&quot;medsStatus&quot;</i><span style=\"color: navy\">;</span>\r\n          med.resource<b> as </b><span style=\"color: maroon\">medResource</span><b> where </b>(category.coding.where(system = 'http://terminology.hl7.org/CodeSystem/medicationrequest-category').exists())<span style=\"color: navy\"><b> -&gt; </b></span> medsItem.item<b> as </b><span style=\"color: maroon\">medsCategory</span><span style=\"color: navy\">, </span> medsCategory.linkId = <span style=\"color: blue\">'meds-category'</span><b> then</b><span style=\"color: navy\"> {\r\n</span>            medResource<span style=\"color: navy\"><b> -&gt; </b></span> medsCategory.answer<b> as </b><span style=\"color: maroon\">medsCategoryAnswer</span><span style=\"color: navy\">, </span> medsCategoryAnswer.value = <span style=\"color: navy\">(</span>medResource.category.coding.where(system = 'http://terminology.hl7.org/CodeSystem/medicationrequest-category').code.aggregate(iif($total.empty(), $this, $total &amp; ' ' &amp; $this))<span style=\"color: navy\">)</span> <i>&quot;medsCategoryAnswer&quot;</i><span style=\"color: navy\">;</span>\r\n          <span style=\"color: navy\">}</span> <i>&quot;medsCategory&quot;</i><span style=\"color: navy\">;</span>\r\n        <span style=\"color: navy\">}</span> <i>&quot;medItem&quot;</i><span style=\"color: navy\">;</span>\r\n      <span style=\"color: navy\">}</span> <i>&quot;medEntry&quot;</i><span style=\"color: navy\">;</span>\r\n    <span style=\"color: navy\">}</span> <i>&quot;meds&quot;</i><span style=\"color: navy\">;</span>\r\n  <span style=\"color: navy\">}</span> <i>&quot;grp&quot;</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span></pre></div>"
  ] ; # 
  fhir:extension ( [
fhir:url [ fhir:v "http://hl7.org/fhir/StructureDefinition/structuredefinition-wg"^^xsd:anyURI ] ;
fhir:value [ fhir:v "fhir" ]
  ] ) ; # 
  fhir:url [ fhir:v "http://hl7.org/fhir/uv/sdc/StructureMap/questionnaire-population-transform"^^xsd:anyURI] ; # 
  fhir:version [ fhir:v "3.0.0"] ; # 
  fhir:name [ fhir:v "QuestionnairePopulationTransform"] ; # 
  fhir:title [ fhir:v "Questionnaire Population Transform"] ; # 
  fhir:status [ fhir:v "draft"] ; # 
  fhir:experimental [ fhir:v "true"^^xsd:boolean] ; # 
  fhir:date [ fhir:v "2023-12-07T23:07:45+00:00"^^xsd:dateTime] ; # 
  fhir:publisher [ fhir:v "HL7 International / FHIR Infrastructure"] ; # 
  fhir:contact ( [
fhir:name [ fhir:v "HL7 International / FHIR Infrastructure" ] ;
    ( fhir:telecom [
fhir:system [ fhir:v "url" ] ;
fhir:value [ fhir:v "http://www.hl7.org/Special/committees/fiwg" ]     ] )
  ] [
    ( fhir:telecom [
fhir:system [ fhir:v "url" ] ;
fhir:value [ fhir:v "http://www.hl7.org/Special/committees/fiwg" ]     ] )
  ] ) ; # 
  fhir:description [ fhir:v "Sample structure map showing process for auto-populating a QuestionnaireResponse from a query bundle"] ; # 
  fhir:jurisdiction ( [
    ( fhir:coding [
fhir:system [ fhir:v "http://unstats.un.org/unsd/methods/m49/m49.htm"^^xsd:anyURI ] ;
fhir:code [ fhir:v "001" ] ;
fhir:display [ fhir:v "World" ]     ] )
  ] ) ; # 
  fhir:structure ( [
fhir:url [
fhir:v "http://hl7.org/fhir/StructureDefinition/Bundle"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/StructureDefinition/Bundle>     ] ;
fhir:mode [ fhir:v "source" ]
  ] [
fhir:url [
fhir:v "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse"^^xsd:anyURI ;
fhir:link <http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse>     ] ;
fhir:mode [ fhir:v "target" ]
  ] ) ; # 
  fhir:group ( [
fhir:name [ fhir:v "main" ] ;
fhir:typeMode [ fhir:v "none" ] ;
    ( fhir:input [
fhir:name [ fhir:v "src" ] ;
fhir:type [ fhir:v "Bundle" ] ;
fhir:mode [ fhir:v "source" ]     ] [
fhir:name [ fhir:v "qr" ] ;
fhir:type [ fhir:v "QuestionnaireResponse" ] ;
fhir:mode [ fhir:v "target" ]     ] ) ;
    ( fhir:rule [
fhir:name [ fhir:v "questionnaire" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "qr" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "questionnaire" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "http://hl7.org/fhir/uv/sdc/Questionnaire/questionnaire-sdc-test-fhirpath-prepop-source-query" ]         ] )       ] )     ] [
fhir:name [ fhir:v "status" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "qr" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "status" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "in-progress" ]         ] )       ] )     ] [
fhir:name [ fhir:v "authored" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "qr" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "authored" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "now()" ]         ] )       ] )     ] [
fhir:name [ fhir:v "subject" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:listMode [ fhir:v "first" ] ;
fhir:variable [ fhir:v "patient" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "qr" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "subject" ] ;
fhir:variable [ fhir:v "subject" ]       ] [
fhir:context [ fhir:v "subject" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "reference" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "patient.resource.entry.fullUrl" ]         ] )       ] )     ] [
fhir:name [ fhir:v "grp" ] ;
      ( fhir:source [
fhir:context [ fhir:v "src" ]       ] ) ;
      ( fhir:target [
fhir:context [ fhir:v "qr" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "grp" ]       ] [
fhir:context [ fhir:v "grp" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "linkId" ] ;
fhir:transform [ fhir:v "copy" ] ;
        ( fhir:parameter [
fhir:value [ fhir:v "grp" ]         ] )       ] ) ;
      ( fhir:rule [
fhir:name [ fhir:v "part-details" ] ;
        ( fhir:source [
fhir:context [ fhir:v "src" ]         ] ) ;
        ( fhir:target [
fhir:context [ fhir:v "grp" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "partDetails" ]         ] [
fhir:context [ fhir:v "partDetails" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "linkId" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "part-details" ]           ] )         ] ) ;
        ( fhir:rule [
fhir:name [ fhir:v "patientDetails" ] ;
          ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:listMode [ fhir:v "first" ] ;
fhir:variable [ fhir:v "patient" ]           ] ) ;
          ( fhir:target [
fhir:contextType [ fhir:v "variable" ] ;
fhir:transform [ fhir:v "copy" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "partDetails" ]             ] )           ] ) ;
          ( fhir:rule [
fhir:name [ fhir:v "participantId" ] ;
            ( fhir:source [
fhir:context [ fhir:v "patient" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "patientRes" ]             ] ) ;
            ( fhir:target [
fhir:context [ fhir:v "partDetails" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "participantId" ]             ] [
fhir:context [ fhir:v "participantId" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "linkId" ] ;
fhir:transform [ fhir:v "copy" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "participant-id" ]               ] )             ] ) ;
            ( fhir:rule [
fhir:name [ fhir:v "participantIdValue" ] ;
              ( fhir:source [
fhir:context [ fhir:v "patientRes" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "patientResEntry" ]               ] ) ;
              ( fhir:target [
fhir:context [ fhir:v "participantId" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "answer" ] ;
fhir:variable [ fhir:v "participantIdAnswer" ]               ] [
fhir:context [ fhir:v "participantIdAnswer" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
                ( fhir:parameter [
fhir:value [ fhir:v "patientResEntry.resource.id" ]                 ] )               ] )             ] )           ] [
fhir:name [ fhir:v "familyName" ] ;
            ( fhir:source [
fhir:context [ fhir:v "patient" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "patientRes" ]             ] ) ;
            ( fhir:target [
fhir:context [ fhir:v "partDetails" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "familyName" ]             ] [
fhir:context [ fhir:v "familyName" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "linkId" ] ;
fhir:transform [ fhir:v "copy" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "family-name" ]               ] )             ] ) ;
            ( fhir:rule [
fhir:name [ fhir:v "familyNameValue" ] ;
              ( fhir:source [
fhir:context [ fhir:v "patientRes" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "patientResEntry" ]               ] ) ;
              ( fhir:target [
fhir:context [ fhir:v "familyName" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "answer" ] ;
fhir:variable [ fhir:v "familyNameAnswer" ]               ] [
fhir:context [ fhir:v "familyNameAnswer" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
                ( fhir:parameter [
fhir:value [ fhir:v "patientResEntry.resource.name.first().family" ]                 ] )               ] )             ] )           ] [
fhir:name [ fhir:v "givenName" ] ;
            ( fhir:source [
fhir:context [ fhir:v "patient" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "patientRes" ]             ] ) ;
            ( fhir:target [
fhir:context [ fhir:v "partDetails" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "givenName" ]             ] [
fhir:context [ fhir:v "givenName" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "linkId" ] ;
fhir:transform [ fhir:v "copy" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "given-name" ]               ] )             ] ) ;
            ( fhir:rule [
fhir:name [ fhir:v "givenNameValue" ] ;
              ( fhir:source [
fhir:context [ fhir:v "patientRes" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "patientResEntry" ]               ] ) ;
              ( fhir:target [
fhir:context [ fhir:v "givenName" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "answer" ] ;
fhir:variable [ fhir:v "givenNameAnswer" ]               ] [
fhir:context [ fhir:v "givenNameAnswer" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
                ( fhir:parameter [
fhir:value [ fhir:v "patientResEntry.resource.name.first().given.aggregate(iif($total.empty(), $this, $total & ' ' & $this))" ]                 ] )               ] )             ] )           ] [
fhir:name [ fhir:v "dob" ] ;
            ( fhir:source [
fhir:context [ fhir:v "patient" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "patientRes" ]             ] ) ;
            ( fhir:target [
fhir:context [ fhir:v "partDetails" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "dob" ]             ] [
fhir:context [ fhir:v "dob" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "linkId" ] ;
fhir:transform [ fhir:v "copy" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "dob" ]               ] )             ] ) ;
            ( fhir:rule [
fhir:name [ fhir:v "dobValue" ] ;
              ( fhir:source [
fhir:context [ fhir:v "patientRes" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "patientResEntry" ]               ] ) ;
              ( fhir:target [
fhir:context [ fhir:v "dob" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "answer" ] ;
fhir:variable [ fhir:v "dobAnswer" ]               ] [
fhir:context [ fhir:v "dobAnswer" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
                ( fhir:parameter [
fhir:value [ fhir:v "patientResEntry.resource.birthDate" ]                 ] )               ] )             ] )           ] )         ] [
fhir:name [ fhir:v "condition-count" ] ;
          ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "conditions" ] ;
fhir:condition [ fhir:v "(resource.link.url.contains('/Condition?'))" ]           ] ) ;
          ( fhir:target [
fhir:context [ fhir:v "partDetails" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "conditionItem" ]           ] [
fhir:context [ fhir:v "conditionItem" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "linkId" ] ;
fhir:transform [ fhir:v "copy" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "condition-count" ]             ] )           ] ) ;
          ( fhir:rule [
fhir:name [ fhir:v "conditionCountAnswer" ] ;
            ( fhir:source [
fhir:context [ fhir:v "conditions" ]             ] ) ;
            ( fhir:target [
fhir:context [ fhir:v "conditionItem" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "answer" ] ;
fhir:variable [ fhir:v "conditionCountAnswer" ]             ] [
fhir:context [ fhir:v "conditionCountAnswer" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "conditions.resource.entry.count()" ]               ] )             ] )           ] )         ] )       ] [
fhir:name [ fhir:v "meds" ] ;
        ( fhir:source [
fhir:context [ fhir:v "src" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "medications" ] ;
fhir:condition [ fhir:v "(resource.link.url.contains('/MedicationStatement?'))" ]         ] ) ;
        ( fhir:target [
fhir:contextType [ fhir:v "variable" ] ;
fhir:transform [ fhir:v "copy" ] ;
          ( fhir:parameter [
fhir:value [ fhir:v "grp" ]           ] )         ] ) ;
        ( fhir:rule [
fhir:name [ fhir:v "medEntry" ] ;
          ( fhir:source [
fhir:context [ fhir:v "medications" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "medRes" ]           ] ) ;
          ( fhir:target [
fhir:contextType [ fhir:v "variable" ] ;
fhir:transform [ fhir:v "copy" ] ;
            ( fhir:parameter [
fhir:value [ fhir:v "grp" ]             ] )           ] ) ;
          ( fhir:rule [
fhir:name [ fhir:v "medItem" ] ;
            ( fhir:source [
fhir:context [ fhir:v "medRes" ] ;
fhir:element [ fhir:v "entry" ] ;
fhir:variable [ fhir:v "med" ] ;
fhir:condition [ fhir:v "(resource is MedicationStatement)" ]             ] ) ;
            ( fhir:target [
fhir:context [ fhir:v "grp" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "medsItem" ]             ] [
fhir:context [ fhir:v "medsItem" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "linkId" ] ;
fhir:transform [ fhir:v "copy" ] ;
              ( fhir:parameter [
fhir:value [ fhir:v "meds" ]               ] )             ] ) ;
            ( fhir:rule [
fhir:name [ fhir:v "medsName" ] ;
              ( fhir:source [
fhir:context [ fhir:v "med" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "medResource" ]               ] ) ;
              ( fhir:target [
fhir:context [ fhir:v "medsItem" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "medsName" ]               ] [
fhir:context [ fhir:v "medsName" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "linkId" ] ;
fhir:transform [ fhir:v "copy" ] ;
                ( fhir:parameter [
fhir:value [ fhir:v "meds-name" ]                 ] )               ] ) ;
              ( fhir:rule [
fhir:name [ fhir:v "medsNameAnswer" ] ;
                ( fhir:source [
fhir:context [ fhir:v "medResource" ] ;
fhir:element [ fhir:v "medication" ] ;
fhir:variable [ fhir:v "medMedication" ]                 ] ) ;
                ( fhir:target [
fhir:context [ fhir:v "medsName" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "answer" ] ;
fhir:variable [ fhir:v "medsNameAnswer" ]                 ] [
fhir:context [ fhir:v "medsNameAnswer" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
                  ( fhir:parameter [
fhir:value [ fhir:v "medMedication.select(iif(text, text, coding.display.first()))" ]                   ] )                 ] )               ] )             ] [
fhir:name [ fhir:v "medsStatus" ] ;
              ( fhir:source [
fhir:context [ fhir:v "med" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "medResource" ]               ] ) ;
              ( fhir:target [
fhir:context [ fhir:v "medsItem" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "medsStatus" ]               ] [
fhir:context [ fhir:v "medsStatus" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "linkId" ] ;
fhir:transform [ fhir:v "copy" ] ;
                ( fhir:parameter [
fhir:value [ fhir:v "med-status" ]                 ] )               ] ) ;
              ( fhir:rule [
fhir:name [ fhir:v "medsStatusAnswer" ] ;
                ( fhir:source [
fhir:context [ fhir:v "medResource" ] ;
fhir:element [ fhir:v "medication" ] ;
fhir:variable [ fhir:v "medsMedication" ]                 ] ) ;
                ( fhir:target [
fhir:context [ fhir:v "medsStatus" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "answer" ] ;
fhir:variable [ fhir:v "medsStatusAnswer" ]                 ] [
fhir:context [ fhir:v "medsStatusAnswer" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
                  ( fhir:parameter [
fhir:value [ fhir:v "medResource.status" ]                   ] )                 ] )               ] )             ] [
fhir:name [ fhir:v "medsCategory" ] ;
              ( fhir:source [
fhir:context [ fhir:v "med" ] ;
fhir:element [ fhir:v "resource" ] ;
fhir:variable [ fhir:v "medResource" ] ;
fhir:condition [ fhir:v "(category.coding.where(system = 'http://terminology.hl7.org/CodeSystem/medicationrequest-category').exists())" ]               ] ) ;
              ( fhir:target [
fhir:context [ fhir:v "medsItem" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "item" ] ;
fhir:variable [ fhir:v "medsCategory" ]               ] [
fhir:context [ fhir:v "medsCategory" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "linkId" ] ;
fhir:transform [ fhir:v "copy" ] ;
                ( fhir:parameter [
fhir:value [ fhir:v "meds-category" ]                 ] )               ] ) ;
              ( fhir:rule [
fhir:name [ fhir:v "medsCategoryAnswer" ] ;
                ( fhir:source [
fhir:context [ fhir:v "medResource" ]                 ] ) ;
                ( fhir:target [
fhir:context [ fhir:v "medsCategory" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "answer" ] ;
fhir:variable [ fhir:v "medsCategoryAnswer" ]                 ] [
fhir:context [ fhir:v "medsCategoryAnswer" ] ;
fhir:contextType [ fhir:v "variable" ] ;
fhir:element [ fhir:v "value" ] ;
fhir:transform [ fhir:v "evaluate" ] ;
                  ( fhir:parameter [
fhir:value [ fhir:v "medResource.category.coding.where(system = 'http://terminology.hl7.org/CodeSystem/medicationrequest-category').code.aggregate(iif($total.empty(), $this, $total & ' ' & $this))" ]                   ] )                 ] )               ] )             ] )           ] )         ] )       ] )     ] )
  ] ) . #