{
  "resourceType": "StructureDefinition",
  "id": "ConditionPSAB",
  "url": "https://www.alberta.ca/fhir/psab/StructureDefinition/ConditionPSAB",
  "version": "1.2.0",
  "name": "ConditionPSAB",
  "title": "Condition (PS-AB)",
  "status": "draft",
  "description": "This profile defines a set of constraints to the FHIR Condition resource for use in Alberta Patient Summaries (PS-AB). It re-profiles the PS-CA Condition profile and refines constraints applied to the Condition resource by the PS-CA project to represent the minimum expectations for the Condition resource when used in the PS-AB Composition profile.",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "Condition",
  "baseDefinition": "http://fhir.infoway-inforoute.ca/io/psca/StructureDefinition/condition-ca-ps",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Condition",
        "path": "Condition",
        "comment": "Condition resources included in Alberta Patient Summary Document Bundles have rules that certain attributes are not to be contained in Condition resource. These are mechanically enforced through invariants at the PS-AB Bundle level."
      },
      {
        "id": "Condition.clinicalStatus",
        "path": "Condition.clinicalStatus",
        "comment": "This element is optional. Only include clinicalStatus codes if they are captured in the clinical workflow and map to one of the required codes in the FHIR valueSet. If no codes in the required valueSet match the status captured clinically - then this element SHALL NOT be be populated"
      },
      {
        "id": "Condition.category",
        "path": "Condition.category",
        "slicing": {
          "discriminator": [
            {
              "type": "pattern",
              "path": "coding.code"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "Condition.category:problemListItem",
        "path": "Condition.category",
        "sliceName": "problemListItem",
        "comment": "Codeable concept: 'Problem-list-item' allowed in PS-AB",
        "min": 0,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Condition.category:problemListItem.coding.system",
        "path": "Condition.category.coding.system",
        "patternUri": "http://terminology.hl7.org/CodeSystem/condition-category"
      },
      {
        "id": "Condition.category:problemListItem.coding.code",
        "path": "Condition.category.coding.code",
        "min": 1,
        "patternCode": "problem-list-item"
      },
      {
        "id": "Condition.code.coding",
        "path": "Condition.code.coding",
        "comment": "Coding is optional, if coding is sent there shall at least be one coding from the ICD9-CM, ICD-10-CA or SNOMED CT code system"
      },
      {
        "id": "Condition.code.text",
        "path": "Condition.code.text",
        "comment": "Required for each submitted problem or condition String: Max Character length (100)",
        "min": 1
      },
      {
        "id": "Condition.subject",
        "path": "Condition.subject",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://www.alberta.ca/fhir/psab/StructureDefinition/PatientPSAB"
            ]
          }
        ]
      },
      {
        "id": "Condition.onset[x]",
        "path": "Condition.onset[x]",
        "min": 1
      },
      {
        "id": "Condition.onset[x]:onsetDateTime",
        "path": "Condition.onset[x]",
        "sliceName": "onsetDateTime",
        "comment": "YYYY-MM-DD format. Partial dates (YYYY only or YYYY-MM only) are accepted.",
        "type": [
          {
            "code": "dateTime"
          }
        ]
      },
      {
        "id": "Condition.note",
        "path": "Condition.note",
        "comment": "Optional String: Max Character length (2000)"
      }
    ]
  }
}