<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="Registry-Lab" />
  <meta>
    <versionId value="23805448-ff24-4f49-a9ed-34ed0ece50a7" />
    <lastUpdated value="2018-02-21T20:30:24.228-06:00" />
    <profile value="http://hl7.org/fhir/StructureDefinition/StructureDefinition" />
  </meta>
  <url value="http://registry-fhir.mayo.edu/StructureDefinition/Registry-Lab" />
  <version value="1.18.0.0" />
  <name value="Registry-Lab" />
  <publisher value="Mayo Clinical Registries" />
  <code>
    <system value="urn:Mayo:Registries:Profiles" />
    <code value="MasterProfile" />
  </code>
  <status value="active" />
  <fhirVersion value="0.5.0" />
  <mapping>
    <identity value="CDM" />
    <uri value="http://registry.mayo.edu/models/CDM" />
    <name value="Clinical Registries Conceptual Data Model" />
  </mapping>
  <mapping>
    <identity value="EDT" />
    <uri value="http://registry.mayo.edu/models/EDT2.0" />
    <name value="Clinical Registries Conceptual Data Model" />
  </mapping>
  <type value="constraint" />
  <abstract value="false" />
  <base value="http://hl7.org/fhir/StructureDefinition/Observation" />
  <snapshot>
    <element>
      <path value="Observation" />
      <label value="Lab Test" />
      <definition value="A single or composite item that a lab can test to meet a clinical need." />
      <min value="0" />
      <max value="*" />
      <mapping>
        <identity value="CDM" />
        <map value="Lab Test" />
      </mapping>
      <mapping>
        <identity value="EDT" />
        <map value=" :: --MASTER QUERY FOR LABS: SELECT A.* FROM ( SELECT FL.PATIENT_DK, RTRIM(DL.LAB_TEST_CODE) AS ROCLIS_CD, DL.LAB_TEST_DESCRIPTION AS ROCLIS_DISPLAY, CASE WHEN DL.ROW_SOURCE_ID=12274 THEN DL.SOURCE_SYSTEM_KEY END AS XCNCPTID, CASE WHEN DL.STANDARD_LAB_TEST_CODE_SYSTEM = 'LOINC' THEN DL.STANDARD_LAB_TEST_CODE END AS LOINC_CD, CASE WHEN DL.STANDARD_LAB_TEST_CODE_SYSTEM = 'LOINC' THEN DL.STANDARD_LAB_TEST_DESCRIPTION END AS LOINC_DISPLAY, DP.PATIENT_CLINIC_NUMBER, --FL.PRIMARY_PROVIDER_DK, --FL.MASTER_PRIMARY_PROVIDER_DK, FL.LAB_TEST_FPK, FL.LAB_ORDER_DTM, FL.LAB_COLLECTION_DTM, FL.LAB_RESULT_DTM, FL.ENCOUNTER_NUMBER, FL.LAB_COMMENTS, FL.PATIENT_AGE_AT_EVENT, FL.PATIENT_GEO_CODE_AT_EVENT, --FL.LAB_MEMO, -- FL.LAB_MEMO_OVERFLOW_FLAG, FL.LAB_STATUS, FL.NORMAL_RANGE_TXT, FL.ABNORMAL_TEST_TXT, FL.UNIT_OF_MEASURE_TXT, FL.RESULT_TXT, FL.RESULT_VAL, FL.LAB_COUNT, RTRIM(FL.LAB_ACCESSION_NBR) AS LAB_ACCESSION_NBR, RTRIM(FL.LAB_ACCESSION_NBR)|| '~' || RTRIM(DL.LAB_TEST_CODE)|| '~' || VARCHAR_FORMAT(FL.LAB_RESULT_DTM,'YYYYMMDDHH24MISSFF') AS LAB_TEST_UNIQUE_KEY, ROW_NUMBER() OVER(PARTITION BY FL.LAB_ACCESSION_NBR, DL.LAB_TEST_CODE, FL.LAB_RESULT_DTM ORDER BY FL.LAB_ACCESSION_NBR,FL.LAB_RESULT_DTM DESC) AS RN FROM EDTWH.FACT_LAB_TEST FL INNER JOIN EDTWH.DIM_LAB_TEST DL ON FL.LAB_TEST_DK = DL.LAB_TEST_DK INNER JOIN EDTWH.DIM_PATIENT DP ON FL.PATIENT_DK = DP.PATIENT_DK WHERE YEAR (FL.LAB_COLLECTION_DTM)&gt;=2014 )A WHERE RN=1 FOR READ ONLY WITH UR; SELECT * FROM &quot;EDTWH&quot;.&quot;DIM_LAB_TEST&quot; WHERE SOURCE_SYSTEM_KEY='6100996'" />
      </mapping>
    </element>
    <element>
      <path value="Observation.meta" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Meta" />
      </type>
    </element>
    <element>
      <path value="Observation.meta.lastUpdated" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="instant" />
      </type>
    </element>
    <element>
      <path value="Observation.Extension" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://registry-fhir.mayo.edu/StructureDefinition/Observation.OrderedDateTime" />
      </type>
      <mapping>
        <identity value="EDT" />
        <map value=" :: LAB_ORDER_DTM from the master query for Labs." />
      </mapping>
    </element>
    <element>
      <path value="Observation.Extension.valueDateTime" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="dateTime" />
      </type>
    </element>
    <element>
      <path value="Observation.code" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="CodeableConcept" />
      </type>
    </element>
    <element>
      <path value="Observation.code.coding" />
      <slicing>
        <discriminator value="system" />
        <ordered value="false" />
        <rules value="open" />
      </slicing>
    </element>
    <element>
      <path value="Observation.code.coding" />
      <name value="ROCLIS" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Coding" />
      </type>
    </element>
    <element>
      <path value="Observation.code.coding.system" />
      <name value="ROCLIS-system" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="uri" />
      </type>
      <fixedUri value="http://terms.mayo.edu/codesystem/ROCLIS" />
      <mapping>
        <identity value="EDT" />
        <map value=" :: set to &quot;http://terms.mayo.edu/codesystem/ROCLIS&quot;" />
      </mapping>
    </element>
    <element>
      <path value="Observation.code.coding.code" />
      <name value="ROCLIS-code" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="code" />
      </type>
      <mapping>
        <identity value="EDT" />
        <map value=" :: ROCLIS_CD (LAB_TEST_CODE) from master query" />
      </mapping>
    </element>
    <element>
      <path value="Observation.code.coding.display" />
      <name value="ROCLIS-display" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="string" />
      </type>
      <mapping>
        <identity value="EDT" />
        <map value=" :: ROCLIS_DISPLAY (LAB_TEST_DESCRIPTION) from master query for labs" />
      </mapping>
    </element>
    <element>
      <path value="Observation.code.coding.primary" />
      <name value="ROCLIS-primary" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="boolean" />
      </type>
      <mapping>
        <identity value="EDT" />
        <map value=" :: set to &quot;true&quot;" />
      </mapping>
    </element>
    <element>
      <path value="Observation.code.coding" />
      <name value="CERESULT" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Coding" />
      </type>
    </element>
    <element>
      <path value="Observation.code.coding.system" />
      <name value="CERESULT-system" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="uri" />
      </type>
      <fixedUri value="http://terms.mayo.edu/codesystem/CE_RESULT" />
      <mapping>
        <identity value="EDT" />
        <map value=" :: Set to &quot;http://terms.mayo.edu/codesystem/CE_RESULT&quot;" />
      </mapping>
    </element>
    <element>
      <path value="Observation.code.coding.code" />
      <name value="CERESULT-code" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="code" />
      </type>
      <mapping>
        <identity value="EDT" />
        <map value=" :: Direct move from XCNCPTID (SOURCE_SYSTEM_KEY) from master query" />
      </mapping>
    </element>
    <element>
      <path value="Observation.code.coding" />
      <name value="LOINC" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Coding" />
      </type>
    </element>
    <element>
      <path value="Observation.code.coding.system" />
      <name value="LOINC-system" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="uri" />
      </type>
      <fixedUri value="http://loinc.org" />
      <mapping>
        <identity value="EDT" />
        <map value=" :: Set to &quot;http://loinc.org&quot;" />
      </mapping>
    </element>
    <element>
      <path value="Observation.code.coding.code" />
      <name value="LOINC-code" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="code" />
      </type>
      <mapping>
        <identity value="EDT" />
        <map value=" :: Direct move LOINC_CD (STANDAD_LAB_TEST_CODE) from master query." />
      </mapping>
    </element>
    <element>
      <path value="Observation.code.coding.display" />
      <name value="LOINC-display" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="string" />
      </type>
      <mapping>
        <identity value="EDT" />
        <map value=" :: Direct move LOINC_DISPLAY (STANDARD_LAB_TEST_DESCRIPTION) fom master query." />
      </mapping>
    </element>
    <element>
      <path value="Observation.interpretation" />
      <label value="Lab Abnormal Codes" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="CodeableConcept" />
      </type>
      <mapping>
        <identity value="CDM" />
        <map value="Lab Abnormal Codes" />
      </mapping>
    </element>
    <element>
      <path value="Observation.interpretation.coding" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Coding" />
      </type>
    </element>
    <element>
      <path value="Observation.interpretation.coding.system" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="uri" />
      </type>
    </element>
    <element>
      <path value="Observation.interpretation.coding.system.extension" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Extension" />
      </type>
    </element>
    <element>
      <path value="Observation.interpretation.coding.code" />
      <label value="Lab Abnormal Test Code" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="code" />
      </type>
      <mapping>
        <identity value="CDM" />
        <map value="Lab Abnormal Codes.Lab Abnormal Test Code" />
      </mapping>
    </element>
    <element>
      <path value="Observation.interpretation.coding.code.extension" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Extension" />
      </type>
    </element>
    <element>
      <path value="Observation.interpretation.coding.display" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="string" />
      </type>
    </element>
    <element>
      <path value="Observation.interpretation.coding.display.extension" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Extension" />
      </type>
    </element>
    <element>
      <path value="Observation.interpretation.coding.primary" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="boolean" />
      </type>
    </element>
    <element>
      <path value="Observation.interpretation.coding.primary.extension" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Extension" />
      </type>
    </element>
    <element>
      <path value="Observation.interpretation.text" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="string" />
      </type>
      <mapping>
        <identity value="EDT" />
        <map value=" :: Set to LAB_ABNORMAL_DESCRIPTION from master query if NOT NULL" />
      </mapping>
    </element>
    <element>
      <path value="Observation.comments" />
      <label value="Lab Test Comments" />
      <definition value="Unstructured text entered by the lab consultant pertaining to the lab test (e.g. Drawn from arterial line, Performed at the Point of Care)" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="string" />
      </type>
      <mapping>
        <identity value="CDM" />
        <map value="Lab Observation.Lab Test Comments" />
      </mapping>
      <mapping>
        <identity value="EDT" />
        <map value=" :: LAB_COMMENTS from master query for Labs" />
      </mapping>
    </element>
    <element>
      <path value="Observation.issued" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="instant" />
      </type>
      <mapping>
        <identity value="EDT" />
        <map value=" :: LAB_RESULT_DTM from master query for Labs" />
      </mapping>
    </element>
    <element>
      <path value="Observation.status" />
      <label value="Lab Test Status Code" />
      <definition value="Current status of the lab test performed (Values: A - Amended, F - Final, M - Partial, P - Pending or Preliminary)" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="code" />
      </type>
      <mapping>
        <identity value="CDM" />
        <map value="Lab Observation.Lab Test Status Code" />
      </mapping>
      <mapping>
        <identity value="EDT" />
        <map value=" :: &quot;final&quot; when the LAB_STATUS from master query for Labs is &quot;F&quot; and &quot;preliminary&quot; when teh LAB_STATUS from master query for Labs is &quot;P&quot;" />
      </mapping>
    </element>
    <element>
      <path value="Observation.identifier" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Identifier" />
      </type>
    </element>
    <element>
      <path value="Observation.identifier.use" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="code" />
      </type>
      <mapping>
        <identity value="EDT" />
        <map value=" :: set to &quot;official&quot;" />
      </mapping>
    </element>
    <element>
      <path value="Observation.identifier.type" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="CodeableConcept" />
      </type>
    </element>
    <element>
      <path value="Observation.identifier.type.text" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="string" />
      </type>
      <mapping>
        <identity value="EDT" />
        <map value=" :: set to &quot;Lab Accession Number ~ Lab Test Code ~ Lab Result Date/Time&quot; " />
      </mapping>
    </element>
    <element>
      <path value="Observation.identifier.type.text.extension" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Extension" />
      </type>
    </element>
    <element>
      <path value="Observation.identifier.system" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="uri" />
      </type>
      <mapping>
        <identity value="EDT" />
        <map value=" :: set to http://terms.mayo.edu/systemid/registry/lab_observation_id" />
      </mapping>
    </element>
    <element>
      <path value="Observation.identifier.value" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="string" />
      </type>
      <mapping>
        <identity value="EDT" />
        <map value=" :: LAB_TEST_UNIQUE_KEY in master query for LABS" />
      </mapping>
    </element>
    <element>
      <path value="Observation.subject" />
      <label value="Patient Observation" />
      <definition value="Identifies multiple observations that can be observed on one patient" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Reference" />
      </type>
    </element>
    <element>
      <path value="Observation.subject.extension" />
      <slicing>
        <discriminator value="url" />
        <ordered value="false" />
        <rules value="open" />
      </slicing>
    </element>
    <element>
      <path value="Observation.subject.extension" />
      <name value="geo" />
      <label value="Patient Geo Code At Lab Test" />
      <definition value="Represents a 10 digit geographic code containing first 3 digits for country, next 2 digits for state, next 2 digits for county and last 3 digitis for city for the patient's address location at the time when the sample was obtained (e.g. 272200109)" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://registry-fhir.mayo.edu/StructureDefinition/Reference.Geo" />
      </type>
      <mapping>
        <identity value="CDM" />
        <map value="Lab Observation.Patient Geo Code At Lab Test" />
      </mapping>
      <mapping>
        <identity value="EDT" />
        <map value=" :: PATIENT_GEO_CODE_AT_EVENT from master query for LABS." />
      </mapping>
    </element>
    <element>
      <path value="Observation.subject.extension.valueString" />
      <name value="geo-valueString" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="string" />
      </type>
    </element>
    <element>
      <path value="Observation.subject.extension" />
      <name value="ageAtLabTest" />
      <label value="Patient Age At Lab Test Years" />
      <definition value="Age of the patient at the time the sample was collected in years" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://registry-fhir.mayo.edu/StructureDefinition/Reference.AgeAtEvent" />
      </type>
      <mapping>
        <identity value="CDM" />
        <map value="Lab Observation.Patient Age At Lab Test Years" />
      </mapping>
      <mapping>
        <identity value="EDT" />
        <map value=" :: PATIENT_AGE_AT_EVENT from master query for LABS." />
      </mapping>
    </element>
    <element>
      <path value="Observation.subject.extension.valueQuantity" />
      <name value="ageAtLabTest-valueQuantity" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Quantity" />
      </type>
    </element>
    <element>
      <path value="Observation.subject.extension.valueQuantity.value" />
      <name value="ageAtLabTest-valueQuantity-value" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="decimal" />
      </type>
    </element>
    <element>
      <path value="Observation.subject.extension.valueQuantity.comparator" />
      <name value="ageAtLabTest-valueQuantity-comparator" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="code" />
      </type>
    </element>
    <element>
      <path value="Observation.subject.extension.valueQuantity.units" />
      <name value="ageAtLabTest-valueQuantity-units" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="string" />
      </type>
    </element>
    <element>
      <path value="Observation.subject.extension.valueQuantity.system" />
      <name value="ageAtLabTest-valueQuantity-system" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="uri" />
      </type>
    </element>
    <element>
      <path value="Observation.subject.extension.valueQuantity.code" />
      <name value="ageAtLabTest-valueQuantity-code" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="code" />
      </type>
    </element>
    <element>
      <path value="Observation.subject.reference" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="string" />
      </type>
      <mapping>
        <identity value="EDT" />
        <map value=" :: Reference to the patient resource represented by PATIENT_DK from master query for Labs" />
      </mapping>
    </element>
    <element>
      <path value="Observation.specimen" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Reference" />
      </type>
    </element>
    <element>
      <path value="Observation.specimen.reference" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="string" />
      </type>
      <mapping>
        <identity value="EDT" />
        <map value=" :: reference to SPECIMEN profile &quot;Registry-LabSpecimen&quot;" />
      </mapping>
    </element>
    <element>
      <path value="Observation.performer" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Reference" />
      </type>
    </element>
    <element>
      <path value="Observation.performer.extension" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Extension" />
      </type>
    </element>
    <element>
      <path value="Observation.performer.reference" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="string" />
      </type>
    </element>
    <element>
      <path value="Observation.performer.display" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="string" />
      </type>
      <mapping>
        <identity value="EDT" />
        <map value=" :: set to LOCATION_SITE_NAME from master query." />
      </mapping>
    </element>
    <element>
      <path value="Observation.performer.display.extension" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Extension" />
      </type>
    </element>
    <element>
      <path value="Observation.referenceRange" />
      <label value="Lab Test Normal Range Text" />
      <definition value="Unstructured text indicating the result is within normal range" />
      <min value="0" />
      <max value="*" />
      <mapping>
        <identity value="CDM" />
        <map value="Lab Observation.Lab Test Normal Range Text" />
      </mapping>
    </element>
    <element>
      <path value="Observation.referenceRange.low" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Quantity" />
      </type>
      <mapping>
        <identity value="EDT" />
        <map value=" :: IF NORMAL_RANGE_TXT has a value seperated by a hypen (&quot;-&quot;) then Value (trimmed of spaces) before a hyphen (&quot;-&quot;) in the NORMAL_RANGE_TXT. e.g. If NORMAL_RANGE_TXT is 3.2 - 5.6, then the value here is going to be 3.2 ELSE leave this element out. END " />
      </mapping>
    </element>
    <element>
      <path value="Observation.referenceRange.low.value" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="decimal" />
      </type>
    </element>
    <element>
      <path value="Observation.referenceRange.low.comparator" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="code" />
      </type>
    </element>
    <element>
      <path value="Observation.referenceRange.low.units" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="string" />
      </type>
    </element>
    <element>
      <path value="Observation.referenceRange.low.system" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="uri" />
      </type>
    </element>
    <element>
      <path value="Observation.referenceRange.low.code" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="code" />
      </type>
    </element>
    <element>
      <path value="Observation.referenceRange.high" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Quantity" />
      </type>
      <mapping>
        <identity value="EDT" />
        <map value=" :: IF NORMAL_RANGE_TXT has a value seperated by a hypen (&quot;-&quot;) then Value (trimmed of spaces) after a hyphen (&quot;-&quot;) in the NORMAL_RANGE_TXT. e.g. If NORMAL_RANGE_TXT is 3.2 - 5.6, then the value here is going to be 5.6 ELSE leave this element out. END " />
      </mapping>
    </element>
    <element>
      <path value="Observation.referenceRange.high.value" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="decimal" />
      </type>
    </element>
    <element>
      <path value="Observation.referenceRange.high.comparator" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="code" />
      </type>
    </element>
    <element>
      <path value="Observation.referenceRange.high.units" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="string" />
      </type>
    </element>
    <element>
      <path value="Observation.referenceRange.high.system" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="uri" />
      </type>
    </element>
    <element>
      <path value="Observation.referenceRange.high.code" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="code" />
      </type>
    </element>
    <element>
      <path value="Observation.referenceRange.meaning" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="CodeableConcept" />
      </type>
    </element>
    <element>
      <path value="Observation.referenceRange.meaning.coding" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Coding" />
      </type>
    </element>
    <element>
      <path value="Observation.referenceRange.meaning.coding.system" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="uri" />
      </type>
      <mapping>
        <identity value="EDT" />
        <map value=" :: set to &quot;http://hl7.org/fhir/referencerange-meaning&quot;" />
      </mapping>
    </element>
    <element>
      <path value="Observation.referenceRange.meaning.coding.code" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="code" />
      </type>
      <fixedCode value="normal" />
      <mapping>
        <identity value="EDT" />
        <map value=" :: set to &quot;normal&quot;" />
      </mapping>
    </element>
    <element>
      <path value="Observation.referenceRange.meaning.coding.display" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="string" />
      </type>
    </element>
    <element>
      <path value="Observation.referenceRange.meaning.coding.primary" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="boolean" />
      </type>
      <mapping>
        <identity value="EDT" />
        <map value=" :: set to &quot;true&quot;" />
      </mapping>
    </element>
    <element>
      <path value="Observation.valueQuantity" />
      <label value="Lab Result" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Quantity" />
      </type>
    </element>
    <element>
      <path value="Observation.valueQuantity.value" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="decimal" />
      </type>
      <mapping>
        <identity value="EDT" />
        <map value=" :: RESULT_VAL from master query for labs when labs when the value is found. (Value may be null, meaning the result value is text and in such cases, this element will not have a value instead valueString will be populated with value in RESULT_TXT from master query for labs)" />
      </mapping>
    </element>
    <element>
      <path value="Observation.valueQuantity.units" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="string" />
      </type>
      <mapping>
        <identity value="EDT" />
        <map value="EDTWH.FACT_LAB_TEST.UNIT_OF_MEASURE_TXT :: direct move" />
      </mapping>
    </element>
    <element>
      <path value="Observation.valueString" />
      <label value="Lab Result" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="string" />
      </type>
      <mapping>
        <identity value="EDT" />
        <map value=" :: RESULT_TXT from master query for labs when value in RESULT_VAL is NULL. (ie. when the value in RESULT_VAL is NOT NULL, this element will not have a value instead valueQuantity will be populated with value in RESULT_VAL from master query for labs)" />
      </mapping>
    </element>
    <element>
      <path value="Observation.appliesDateTime" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="dateTime" />
      </type>
      <mapping>
        <identity value="EDT" />
        <map value=" :: LAB_COLLECTION_DTM from master query for Labs. direct move if year in the date is between 1900 and 2099, Else discard." />
      </mapping>
    </element>
  </snapshot>
  <differential>
    <element>
      <path value="Observation" />
      <label value="Lab Test" />
      <definition value="A single or composite item that a lab can test to meet a clinical need." />
      <min value="0" />
      <max value="*" />
      <mapping>
        <identity value="CDM" />
        <map value="Lab Test" />
      </mapping>
      <mapping>
        <identity value="EDT" />
        <map value=" :: --MASTER QUERY FOR LABS: SELECT A.* FROM ( SELECT FL.PATIENT_DK, RTRIM(DL.LAB_TEST_CODE) AS ROCLIS_CD, DL.LAB_TEST_DESCRIPTION AS ROCLIS_DISPLAY, CASE WHEN DL.ROW_SOURCE_ID=12274 THEN DL.SOURCE_SYSTEM_KEY END AS XCNCPTID, CASE WHEN DL.STANDARD_LAB_TEST_CODE_SYSTEM = 'LOINC' THEN DL.STANDARD_LAB_TEST_CODE END AS LOINC_CD, CASE WHEN DL.STANDARD_LAB_TEST_CODE_SYSTEM = 'LOINC' THEN DL.STANDARD_LAB_TEST_DESCRIPTION END AS LOINC_DISPLAY, DP.PATIENT_CLINIC_NUMBER, --FL.PRIMARY_PROVIDER_DK, --FL.MASTER_PRIMARY_PROVIDER_DK, FL.LAB_TEST_FPK, FL.LAB_ORDER_DTM, FL.LAB_COLLECTION_DTM, FL.LAB_RESULT_DTM, FL.ENCOUNTER_NUMBER, FL.LAB_COMMENTS, FL.PATIENT_AGE_AT_EVENT, FL.PATIENT_GEO_CODE_AT_EVENT, --FL.LAB_MEMO, -- FL.LAB_MEMO_OVERFLOW_FLAG, FL.LAB_STATUS, FL.NORMAL_RANGE_TXT, FL.ABNORMAL_TEST_TXT, FL.UNIT_OF_MEASURE_TXT, FL.RESULT_TXT, FL.RESULT_VAL, FL.LAB_COUNT, RTRIM(FL.LAB_ACCESSION_NBR) AS LAB_ACCESSION_NBR, RTRIM(FL.LAB_ACCESSION_NBR)|| '~' || RTRIM(DL.LAB_TEST_CODE)|| '~' || VARCHAR_FORMAT(FL.LAB_RESULT_DTM,'YYYYMMDDHH24MISSFF') AS LAB_TEST_UNIQUE_KEY, ROW_NUMBER() OVER(PARTITION BY FL.LAB_ACCESSION_NBR, DL.LAB_TEST_CODE, FL.LAB_RESULT_DTM ORDER BY FL.LAB_ACCESSION_NBR,FL.LAB_RESULT_DTM DESC) AS RN FROM EDTWH.FACT_LAB_TEST FL INNER JOIN EDTWH.DIM_LAB_TEST DL ON FL.LAB_TEST_DK = DL.LAB_TEST_DK INNER JOIN EDTWH.DIM_PATIENT DP ON FL.PATIENT_DK = DP.PATIENT_DK WHERE YEAR (FL.LAB_COLLECTION_DTM)&gt;=2014 )A WHERE RN=1 FOR READ ONLY WITH UR; SELECT * FROM &quot;EDTWH&quot;.&quot;DIM_LAB_TEST&quot; WHERE SOURCE_SYSTEM_KEY='6100996'" />
      </mapping>
    </element>
    <element>
      <path value="Observation.Extension" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://registry-fhir.mayo.edu/StructureDefinition/Observation.OrderedDateTime" />
      </type>
    </element>
    <element>
      <path value="Observation.code" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="CodeableConcept" />
      </type>
    </element>
    <element>
      <path value="Observation.code.coding" />
      <slicing>
        <discriminator value="system" />
        <ordered value="false" />
        <rules value="open" />
      </slicing>
    </element>
    <element>
      <path value="Observation.code.coding" />
      <name value="ROCLIS" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Coding" />
      </type>
    </element>
    <element>
      <path value="Observation.code.coding.system" />
      <name value="ROCLIS-system" />
      <fixedUri value="http://terms.mayo.edu/codesystem/ROCLIS" />
    </element>
    <element>
      <path value="Observation.code.coding" />
      <name value="CERESULT" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Coding" />
      </type>
    </element>
    <element>
      <path value="Observation.code.coding.system" />
      <name value="CERESULT-system" />
      <fixedUri value="http://terms.mayo.edu/codesystem/CE_RESULT" />
    </element>
    <element>
      <path value="Observation.code.coding" />
      <name value="LOINC" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Coding" />
      </type>
    </element>
    <element>
      <path value="Observation.code.coding.system" />
      <name value="LOINC-system" />
      <fixedUri value="http://loinc.org" />
    </element>
    <element>
      <path value="Observation.subject" />
      <label value="Patient Observation" />
      <definition value="Identifies multiple observations that can be observed on one patient" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Reference" />
      </type>
    </element>
    <element>
      <path value="Observation.subject.extension" />
      <slicing>
        <discriminator value="url" />
        <ordered value="false" />
        <rules value="open" />
      </slicing>
    </element>
    <element>
      <path value="Observation.subject.extension" />
      <name value="geo" />
      <label value="Patient Geo Code At Lab Test" />
      <definition value="Represents a 10 digit geographic code containing first 3 digits for country, next 2 digits for state, next 2 digits for county and last 3 digitis for city for the patient's address location at the time when the sample was obtained (e.g. 272200109)" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://registry-fhir.mayo.edu/StructureDefinition/Reference.Geo" />
      </type>
    </element>
    <element>
      <path value="Observation.subject.extension" />
      <name value="ageAtLabTest" />
      <label value="Patient Age At Lab Test Years" />
      <definition value="Age of the patient at the time the sample was collected in years" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://registry-fhir.mayo.edu/StructureDefinition/Reference.AgeAtEvent" />
      </type>
    </element>
  </differential>
</StructureDefinition>