<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="hspc-sexLastTwelveMonths" />
  <url value="http://fhir.org/guides/hspc/StructureDefinition/hspc-sexLastTwelveMonths" />
  <version value="1.0.0" />
  <name value="HSPC Sex Last Twelve Months Profile" />
  <status value="draft" />
  <date value="2017-05-11" />
  <publisher value="HSPC" />
  <contact>
    <telecom>
      <system value="url" />
      <value value="http://healthcaresoa.org" />
    </telecom>
  </contact>
  <fhirVersion value="3.0.0" />
  <mapping>
    <identity value="argonaut-dq-dstu2" />
    <uri value="http://unknown.org/Argonaut DQ DSTU2" />
    <name value="Argonaut DQ DSTU2" />
  </mapping>
  <mapping>
    <identity value="workflow" />
    <uri value="http://hl7.org/fhir/workflow" />
    <name value="Workflow Mapping" />
  </mapping>
  <mapping>
    <identity value="sct-concept" />
    <uri value="http://snomed.info/conceptdomain" />
    <name value="SNOMED CT Concept Domain Binding" />
  </mapping>
  <mapping>
    <identity value="v2" />
    <uri value="http://hl7.org/v2" />
    <name value="HL7 v2 Mapping" />
  </mapping>
  <mapping>
    <identity value="rim" />
    <uri value="http://hl7.org/v3" />
    <name value="RIM Mapping" />
  </mapping>
  <mapping>
    <identity value="w5" />
    <uri value="http://hl7.org/fhir/w5" />
    <name value="W5 Mapping" />
  </mapping>
  <mapping>
    <identity value="sct-attr" />
    <uri value="http://snomed.info/sct" />
    <name value="SNOMED CT Attribute Binding" />
  </mapping>
  <kind value="resource" />
  <abstract value="false" />
  <type value="Observation" />
  <baseDefinition value="http://hl7.org/fhir/us/core/StructureDefinition/us-core-observationresults" />
  <derivation value="constraint" />
  <differential>
    <element id="Observation:hspcsexlasttwelvemonths">
      <path value="Observation" />
      <sliceName value="hspcsexlasttwelvemonths" />
      <short value="HSPC Sex Last Twelve Months Profile" />
      <definition value="The HSPC Sex Last Twelve Months Profile is based on the US Core Result Observation profile." />
      <comment value="Used specifically to capture if a client self-reports of sexual intercourse in the last 12 months." />
      <alias value="Obs" />
      <constraint>
        <key value="us-core-2" />
        <severity value="error" />
        <human value="If there is no component or related element then either a value[x] or a data absent reason must be present" />
        <expression value="(component.empty() and related.empty()) implies (dataAbsentReason or value)" />
        <xpath value="exists(f:component) or exists(f:related) or exists(f:*[starts-with(local-name(.), 'value)]) or exists(f:dataAbsentReason)" />
      </constraint>
      <mustSupport value="false" />
      <isModifier value="false" />
      <mapping>
        <identity value="argonaut-dq-dstu2" />
        <map value="Observation" />
      </mapping>
    </element>
    <element id="Observation:hspcsexlasttwelvemonths.code">
      <path value="Observation.code" />
      <short value="Laboratory Test Name" />
      <definition value="The test that was performed.  A LOINC **SHALL** be used if the concept is present in LOINC." />
      <comment value="The typical patterns for codes are:  1)  a LOINC code either as a  translation from a &quot;local&quot; code or as a primary code, or 2)  a local code only if no suitable LOINC exists,  or 3)  both the local and the LOINC translation.   Systems SHALL be capable of sending the local code if one exists.  When using LOINC , Use either the SHORTNAME or LONG_COMMON_NAME field for the display." />
      <alias value="Test Name" />
      <alias value="Observation Identifer" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="CodeableConcept" />
      </type>
      <mustSupport value="true" />
      <isModifier value="false" />
      <isSummary value="false" />
    </element>
    <element id="Observation:hspcsexlasttwelvemonths.subject">
      <path value="Observation.subject" />
      <short value="Who and/or what this is about" />
      <definition value="The patient, or group of patients, location, or device whose characteristics (direct or indirect) are described by the observation and into whose record the observation is placed.  Comments: Indirect characteristics may be those of a specimen, fetus, donor,  other observer (for example a relative or EMT), or any observation made about the subject." />
      <comment value="One would expect this element to be a cardinality  of 1..1.  The only circumstance in which the subject can be missing is when the observation is made by a device that does not know the patient. In this case, the observation SHALL be matched to a patient through some context/channel matching technique, and at this point, the observation should be updated.&#xD;&#xD;If the target of the observation is different than the subject, the general extension [observation-focal-subject](extension-observation-focal-subject.html).  may be used.  However, the distinction between the patient's own value for an observation versus that of the fetus, or the donor or blood product unit, etc., are often specified in the observation code." />
      <requirements value="Observations have no value if you don't know who or what they're about." />
      <min value="1" />
      <max value="1" />
      <base>
        <path value="Observation.subject" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="Reference" />
        <targetProfile value="http://fhir.org/guides/hspc/StructureDefinition/hspc-patient" />
      </type>
      <mustSupport value="true" />
      <isSummary value="true" />
      <mapping>
        <identity value="workflow" />
        <map value="Event.subject" />
      </mapping>
      <mapping>
        <identity value="v2" />
        <map value="PID-3" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="participation[typeCode=SBJ]" />
      </mapping>
      <mapping>
        <identity value="w5" />
        <map value="who.focus" />
      </mapping>
      <mapping>
        <identity value="argonaut-dq-dstu2" />
        <map value="Observation.subject" />
      </mapping>
    </element>
    <element id="Observation:hspcsexlasttwelvemonths.effectivePeriod">
      <path value="Observation.effective[x]" />
      <short value="Clinically relevant time/time-period for observation" />
      <definition value="For lab tests this is the specimen collection date.  For Ask at Order Entry Questions (AOE)'s this is the date the question was asked." />
      <comment value="At least a date should be present unless this observation is a historical report." />
      <requirements value="Knowing when an observation was deemed true is important to its relevance as well as determining trends." />
      <alias value="Occurrence" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="Observation.effective[x]" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="Period" />
      </type>
      <constraint>
        <key value="us-core-1" />
        <severity value="error" />
        <human value="Datetime must be at least to day." />
        <expression value="($this as dateTime).toString().length() &gt;= 8" />
        <xpath value="f:matches(effectiveDateTime,/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)/)" />
      </constraint>
      <mustSupport value="true" />
      <isSummary value="true" />
      <mapping>
        <identity value="workflow" />
        <map value="Event.occurrence[x]" />
      </mapping>
      <mapping>
        <identity value="v2" />
        <map value="OBX-14, and/or OBX-19 after v2.4  (depends on who observation made)" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="effectiveTime" />
      </mapping>
      <mapping>
        <identity value="w5" />
        <map value="when.done" />
      </mapping>
      <mapping>
        <identity value="argonaut-dq-dstu2" />
        <map value="Observation.effective[x]" />
      </mapping>
    </element>
    <element id="Observation:hspcsexlasttwelvemonths.performer">
      <path value="Observation.performer" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Reference" />
        <profile value="http://fhir.org/guides/hspc/StructureDefinition/hspc-provpract" />
      </type>
      <type>
        <code value="Reference" />
        <profile value="http://fhir.org/guides/hspc/StructureDefinition/hspc-organization" />
      </type>
      <type>
        <code value="Reference" />
        <profile value="http://fhir.org/guides/hspc/StructureDefinition/hspc-patient" />
      </type>
      <type>
        <code value="Reference" />
        <profile value="http://hl7.org/fhir/StructureDefinition/RelatedPerson" />
      </type>
      <mustSupport value="false" />
      <isModifier value="false" />
      <isSummary value="false" />
    </element>
    <element id="Observation:hspcsexlasttwelvemonths.valueCodeableConcept">
      <path value="Observation.valueCodeableConcept" />
      <short value="A coded concept that represents the value of the observation" />
      <min value="1" />
      <max value="1" />
      <base>
        <path value="Observation.value[x]" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="CodeableConcept" />
      </type>
      <mustSupport value="true" />
      <isSummary value="true" />
      <binding>
        <strength value="preferred" />
        <valueSetReference>
          <reference value="http://fhir.org/guides/hspc/ValueSet/hspc-yesNo" />
        </valueSetReference>
      </binding>
      <mapping>
        <identity value="argonaut-dq-dstu2" />
        <map value="Observation.value[x]" />
      </mapping>
    </element>
    <element id="Observation:hspcsexlasttwelvemonths.bodySite">
      <path value="Observation.bodySite" />
      <min value="0" />
      <max value="0" />
      <mustSupport value="false" />
      <isModifier value="false" />
      <isSummary value="false" />
    </element>
    <element id="Observation:hspcsexlasttwelvemonths.method">
      <path value="Observation.method" />
      <min value="0" />
      <max value="0" />
      <mustSupport value="false" />
      <isModifier value="false" />
      <isSummary value="false" />
    </element>
    <element id="Observation:hspcsexlasttwelvemonths.specimen">
      <path value="Observation.specimen" />
      <min value="0" />
      <max value="0" />
      <mustSupport value="false" />
      <isModifier value="false" />
      <isSummary value="false" />
    </element>
    <element id="Observation:hspcsexlasttwelvemonths.device">
      <path value="Observation.device" />
      <min value="0" />
      <max value="0" />
      <mustSupport value="false" />
      <isModifier value="false" />
      <isSummary value="false" />
    </element>
    <element id="Observation:hspcsexlasttwelvemonths.related">
      <path value="Observation.related" />
      <min value="0" />
      <max value="0" />
      <isSummary value="true" />
    </element>
    <element id="Observation:hspcsexlasttwelvemonths.component">
      <path value="Observation.component" />
      <min value="0" />
      <max value="0" />
      <isSummary value="true" />
    </element>
    <element id="Observation:hspcsexlasttwelvemonths.referenceRange">
      <path value="Observation.referenceRange" />
      <min value="0" />
      <max value="0" />
      <isSummary value="true" />
    </element>
    <element id="Observation:hspcsexlasttwelvemonths.interpretation">
      <path value="Observation.interpretation" />
      <min value="0" />
      <max value="0" />
    </element>
  </differential>
</StructureDefinition>