{
  "resourceType": "StructureDefinition",
  "id": "hspc-sexLastThreeMonths",
  "url": "http://fhir.org/guides/hspc/StructureDefinition/hspc-sexLastThreeMonths",
  "version": "1.0.0",
  "name": "HSPC Sex Last Three Months Profile",
  "status": "draft",
  "date": "2017-05-11",
  "publisher": "HSPC",
  "contact": [
    {
      "telecom": [
        {
          "system": "url",
          "value": "http://healthcaresoa.org"
        }
      ]
    }
  ],
  "fhirVersion": "3.0.0",
  "mapping": [
    {
      "identity": "argonaut-dq-dstu2",
      "uri": "http://unknown.org/Argonaut DQ DSTU2",
      "name": "Argonaut DQ DSTU2"
    },
    {
      "identity": "workflow",
      "uri": "http://hl7.org/fhir/workflow",
      "name": "Workflow Mapping"
    },
    {
      "identity": "sct-concept",
      "uri": "http://snomed.info/conceptdomain",
      "name": "SNOMED CT Concept Domain Binding"
    },
    {
      "identity": "v2",
      "uri": "http://hl7.org/v2",
      "name": "HL7 v2 Mapping"
    },
    {
      "identity": "rim",
      "uri": "http://hl7.org/v3",
      "name": "RIM Mapping"
    },
    {
      "identity": "w5",
      "uri": "http://hl7.org/fhir/w5",
      "name": "W5 Mapping"
    },
    {
      "identity": "sct-attr",
      "uri": "http://snomed.info/sct",
      "name": "SNOMED CT Attribute Binding"
    }
  ],
  "kind": "resource",
  "abstract": false,
  "type": "Observation",
  "baseDefinition": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-observationresults",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Observation:hspcsexlastthreemonths",
        "path": "Observation",
        "sliceName": "hspcsexlastthreemonths",
        "short": "HSPC Sex Last Three Months Profile",
        "definition": "The HSPC Sex Last Three Months Profile is based on the US Core Result Observation profile.",
        "comment": "Used specifically to capture if a client self-reports of sexual intercourse in the last 3 months.",
        "alias": [
          "Obs"
        ],
        "constraint": [
          {
            "key": "us-core-2",
            "severity": "error",
            "human": "If there is no component or related element then either a value[x] or a data absent reason must be present",
            "expression": "(component.empty() and related.empty()) implies (dataAbsentReason or value)",
            "xpath": "exists(f:component) or exists(f:related) or exists(f:*[starts-with(local-name(.), 'value)]) or exists(f:dataAbsentReason)"
          }
        ],
        "mustSupport": false,
        "isModifier": false,
        "mapping": [
          {
            "identity": "argonaut-dq-dstu2",
            "map": "Observation"
          }
        ]
      },
      {
        "id": "Observation:hspcsexlastthreemonths.code",
        "path": "Observation.code",
        "short": "Laboratory Test Name",
        "definition": "The test that was performed.  A LOINC **SHALL** be used if the concept is present in LOINC.",
        "comment": "The typical patterns for codes are:  1)  a LOINC code either as a  translation from a \"local\" 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": [
          "Test Name",
          "Observation Identifer"
        ],
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "CodeableConcept"
          }
        ],
        "mustSupport": true,
        "isModifier": false,
        "isSummary": false
      },
      {
        "id": "Observation:hspcsexlastthreemonths.subject",
        "path": "Observation.subject",
        "short": "Who and/or what this is about",
        "definition": "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": "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.\r\rIf 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": "Observations have no value if you don't know who or what they're about.",
        "min": 1,
        "max": "1",
        "base": {
          "path": "Observation.subject",
          "min": 0,
          "max": "1"
        },
        "type": [
          {
            "code": "Reference",
            "targetProfile": "http://fhir.org/guides/hspc/StructureDefinition/hspc-patient"
          }
        ],
        "mustSupport": true,
        "isSummary": true,
        "mapping": [
          {
            "identity": "workflow",
            "map": "Event.subject"
          },
          {
            "identity": "v2",
            "map": "PID-3"
          },
          {
            "identity": "rim",
            "map": "participation[typeCode=SBJ]"
          },
          {
            "identity": "w5",
            "map": "who.focus"
          },
          {
            "identity": "argonaut-dq-dstu2",
            "map": "Observation.subject"
          }
        ]
      },
      {
        "id": "Observation:hspcsexlastthreemonths.effectivePeriod",
        "path": "Observation.effective[x]",
        "short": "Clinically relevant time/time-period for observation",
        "definition": "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": "At least a date should be present unless this observation is a historical report.",
        "requirements": "Knowing when an observation was deemed true is important to its relevance as well as determining trends.",
        "alias": [
          "Occurrence"
        ],
        "min": 0,
        "max": "1",
        "base": {
          "path": "Observation.effective[x]",
          "min": 0,
          "max": "1"
        },
        "type": [
          {
            "code": "Period"
          }
        ],
        "constraint": [
          {
            "key": "us-core-1",
            "severity": "error",
            "human": "Datetime must be at least to day.",
            "expression": "($this as dateTime).toString().length() >= 8",
            "xpath": "f:matches(effectiveDateTime,/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d([+-][0-2]\\d:[0-5]\\d|Z)/)"
          }
        ],
        "mustSupport": true,
        "isSummary": true,
        "mapping": [
          {
            "identity": "workflow",
            "map": "Event.occurrence[x]"
          },
          {
            "identity": "v2",
            "map": "OBX-14, and/or OBX-19 after v2.4  (depends on who observation made)"
          },
          {
            "identity": "rim",
            "map": "effectiveTime"
          },
          {
            "identity": "w5",
            "map": "when.done"
          },
          {
            "identity": "argonaut-dq-dstu2",
            "map": "Observation.effective[x]"
          }
        ]
      },
      {
        "id": "Observation:hspcsexlastthreemonths.performer",
        "path": "Observation.performer",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Reference",
            "profile": "http://fhir.org/guides/hspc/StructureDefinition/hspc-provpract"
          },
          {
            "code": "Reference",
            "profile": "http://fhir.org/guides/hspc/StructureDefinition/hspc-organization"
          },
          {
            "code": "Reference",
            "profile": "http://fhir.org/guides/hspc/StructureDefinition/hspc-patient"
          },
          {
            "code": "Reference",
            "profile": "http://hl7.org/fhir/StructureDefinition/RelatedPerson"
          }
        ],
        "mustSupport": false,
        "isModifier": false,
        "isSummary": false
      },
      {
        "id": "Observation:hspcsexlastthreemonths.valueCodeableConcept",
        "path": "Observation.valueCodeableConcept",
        "short": "A coded concept that represents the value of the observation",
        "min": 1,
        "max": "1",
        "base": {
          "path": "Observation.value[x]",
          "min": 0,
          "max": "1"
        },
        "type": [
          {
            "code": "CodeableConcept"
          }
        ],
        "mustSupport": true,
        "isSummary": true,
        "binding": {
          "strength": "preferred",
          "valueSetReference": {
            "reference": "http://fhir.org/guides/hspc/ValueSet/hspc-yesNo"
          }
        },
        "mapping": [
          {
            "identity": "argonaut-dq-dstu2",
            "map": "Observation.value[x]"
          }
        ]
      },
      {
        "id": "Observation:hspcsexlastthreemonths.bodySite",
        "path": "Observation.bodySite",
        "min": 0,
        "max": "0",
        "mustSupport": false,
        "isModifier": false,
        "isSummary": false
      },
      {
        "id": "Observation:hspcsexlastthreemonths.method",
        "path": "Observation.method",
        "min": 0,
        "max": "0",
        "mustSupport": false,
        "isModifier": false,
        "isSummary": false
      },
      {
        "id": "Observation:hspcsexlastthreemonths.specimen",
        "path": "Observation.specimen",
        "min": 0,
        "max": "0",
        "mustSupport": false,
        "isModifier": false,
        "isSummary": false
      },
      {
        "id": "Observation:hspcsexlastthreemonths.device",
        "path": "Observation.device",
        "min": 0,
        "max": "0",
        "mustSupport": false,
        "isModifier": false,
        "isSummary": false
      },
      {
        "id": "Observation:hspcsexlastthreemonths.related",
        "path": "Observation.related",
        "min": 0,
        "max": "0",
        "isSummary": true
      },
      {
        "id": "Observation:hspcsexlastthreemonths.component",
        "path": "Observation.component",
        "min": 0,
        "max": "0",
        "isSummary": true
      },
      {
        "id": "Observation:hspcsexlastthreemonths.referenceRange",
        "path": "Observation.referenceRange",
        "min": 0,
        "max": "0",
        "isSummary": true
      },
      {
        "id": "Observation:hspcsexlastthreemonths.interpretation",
        "path": "Observation.interpretation",
        "min": 0,
        "max": "0"
      }
    ]
  }
}