{
  "resourceType": "StructureDefinition",
  "id": "profile-Observation-income",
  "url": "https://bpcs.exchange/fhir/StructureDefinition/profile-Observation-income",
  "name": "ObservationIncome",
  "title": "Observation Income Profile",
  "status": "active",
  "experimental": false,
  "description": "An observation that reports the income for a specified subject",
  "fhirVersion": "5.0.0",
  "mapping": [
    {
      "identity": "BPCS",
      "name": "Internal BPCS API"
    }
  ],
  "kind": "resource",
  "abstract": false,
  "type": "Observation",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Observation",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Observation.meta",
        "path": "Observation.meta",
        "mustSupport": true
      },
      {
        "id": "Observation.meta.tag",
        "path": "Observation.meta.tag",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "$this"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "Observation.meta.tag:readOnly",
        "path": "Observation.meta.tag",
        "sliceName": "readOnly",
        "comment": "This tag will be present if the income is not allowed to be overridden.  It will be absent if the income is overrideable.",
        "max": "1",
        "patternCoding": {
          "system": "https://bpcs.exchange/fhir/CodeSystem/cs-MetaTags",
          "code": "readOnly"
        },
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "FamilyMemberDTO.incomeOverride (if true, then incomeOverride is false)"
          }
        ]
      },
      {
        "id": "Observation.meta.extension",
        "path": "Observation.meta.extension",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Observation.meta.extension:effectiveDate",
        "path": "Observation.meta.extension",
        "sliceName": "effectiveDate",
        "comment": "This associates the income information to the verson of the Trillium insurance application the income information is associated with.",
        "min": 1,
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/ext-Meta-effectiveDate"
            ]
          }
        ],
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "RecipientInsuranceDTO.recEffDate, FamilyMemberHistoryDTO.recEffDate"
          }
        ]
      },
      {
        "id": "Observation.status",
        "path": "Observation.status",
        "patternCode": "final",
        "mustSupport": true
      },
      {
        "id": "Observation.code",
        "path": "Observation.code",
        "patternCodeableConcept": {
          "coding": [
            {
              "system": "https://bpcs.exchange/fhir/CodeSystem/cs-ObservationTypes",
              "code": "income",
              "display": "Annual Income"
            }
          ]
        },
        "mustSupport": true
      },
      {
        "id": "Observation.subject",
        "path": "Observation.subject",
        "type": [
          {
            "code": "Reference",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Reference-rest"
            ],
            "targetProfile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Group",
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Patient-search"
            ]
          }
        ],
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "RecipientInsuranceDTO.odbNum, FamilyMemberDTO.odbNum, FamilyMemberHistory.odbNum"
          }
        ]
      },
      {
        "id": "Observation.subject.identifier",
        "path": "Observation.subject.identifier",
        "short": "Social Insurance Number",
        "comment": "The SIN is sent alongside the RESTful reference to the patient because SIN is only maintained as part of the income observation, not as part of the general recipient demographics",
        "mustSupport": true
      },
      {
        "id": "Observation.subject.identifier.type",
        "path": "Observation.subject.identifier.type",
        "patternCodeableConcept": {
          "coding": [
            {
              "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
              "code": "SB"
            }
          ]
        }
      },
      {
        "id": "Observation.subject.identifier.system",
        "path": "Observation.subject.identifier.system",
        "short": "This is the Canada Social Insurance Number URI",
        "patternUri": "https://fhir.infoway-inforoute.ca/NamingSystem/ca-social-insurance-number",
        "mustSupport": true
      },
      {
        "id": "Observation.subject.identifier.value",
        "path": "Observation.subject.identifier.value",
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "RecipientInsuranceDTO.sin, FamilyMemberDTO.sin, FamilyMemberHistory.sin"
          }
        ]
      },
      {
        "id": "Observation.effective[x]",
        "path": "Observation.effective[x]",
        "definition": "The income tax year (i.e. calendar year) associated with net income of package size as recorded against an individual.",
        "type": [
          {
            "code": "dateTime",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-dateTime-year"
            ]
          }
        ],
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "RecipientInsuranceDTO.taxYear, FamilyMemberDTO.taxYear, FamilyMemberHistory.taxYear"
          }
        ]
      },
      {
        "id": "Observation.issued",
        "path": "Observation.issued",
        "min": 1,
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "RecipientInsuranceDTO.recCreateCustomTimestamp, FamilyMemberHistory.recCreateCustomTimestamp"
          }
        ]
      },
      {
        "id": "Observation.performer",
        "path": "Observation.performer",
        "min": 1,
        "max": "1",
        "patternReference": {
          "display": "CRA"
        }
      },
      {
        "id": "Observation.value[x]",
        "path": "Observation.value[x]",
        "short": "incomeAmt/netIncome",
        "definition": "RM - Income of recipient.\r\nAM - For families, the total net family income calculated by summing the net income of all family members. For individuals, the net personal income of an individual as obtained through income testing or as determined by special review.",
        "comment": "Income of recipient.",
        "min": 1,
        "type": [
          {
            "code": "Quantity"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Observation.value[x].value",
        "path": "Observation.value[x].value",
        "min": 1,
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "RecipientInsuranceDTO.incomeAmount, FamilyMemberDTO.netIncome, FamilyMemberDTO.zeroIncomeFlag, FamilyMemberHistoryDTO.netIncome, FamilyMemberHistoryDTO.zeroIncomeFlag (If incomeAmount is 0 and zeroIncomeFlag is false, we'll suppress the whole Observation)"
          }
        ]
      },
      {
        "id": "Observation.value[x].system",
        "path": "Observation.value[x].system",
        "min": 1,
        "patternUri": "urn:iso:std:iso:4217",
        "mustSupport": true
      },
      {
        "id": "Observation.value[x].code",
        "path": "Observation.value[x].code",
        "min": 1,
        "patternCode": "CAD",
        "mustSupport": true
      },
      {
        "id": "Observation.component",
        "path": "Observation.component",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "code"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "Observation.component:noa",
        "path": "Observation.component",
        "sliceName": "noa",
        "definition": "Information about whether there is a notice of assessment on file",
        "comment": "This is only relevant (and will only be retained) for members enrolled in the Seniors Drug Program",
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Observation.component:noa.code",
        "path": "Observation.component.code",
        "patternCodeableConcept": {
          "coding": [
            {
              "system": "https://bpcs.exchange/fhir/CodeSystem/cs-ObservationTypes",
              "code": "noa"
            }
          ]
        }
      },
      {
        "id": "Observation.component:noa.value[x]",
        "path": "Observation.component.value[x]",
        "min": 1,
        "type": [
          {
            "code": "boolean"
          }
        ],
        "mustSupport": true
      }
    ]
  }
}