{
  "resourceType": "StructureDefinition",
  "id": "profile-Consent",
  "url": "https://bpcs.exchange/fhir/StructureDefinition/profile-Consent",
  "name": "Consent",
  "title": "Consent",
  "status": "active",
  "experimental": false,
  "description": "A record of a recipient's consent (or consent refusal) with respect to automatic income retrieval from CRA",
  "fhirVersion": "5.0.0",
  "mapping": [
    {
      "identity": "BPCS",
      "name": "Internal BPCS API"
    }
  ],
  "kind": "resource",
  "abstract": false,
  "type": "Consent",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Consent",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Consent.id",
        "path": "Consent.id",
        "comment": "This will be the [applicationId] + '.' + [odbNum]",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Consent.status",
        "path": "Consent.status",
        "patternCode": "active"
      },
      {
        "id": "Consent.subject",
        "path": "Consent.subject",
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Reference-rest"
            ],
            "targetProfile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Patient-create"
            ]
          }
        ],
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "ODB number of containing Recipient"
          }
        ]
      },
      {
        "id": "Consent.date",
        "path": "Consent.date",
        "min": 1,
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "ConsentDTO.recordedDate"
          }
        ]
      },
      {
        "id": "Consent.grantor",
        "path": "Consent.grantor",
        "short": "consenter",
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Reference-rest"
            ],
            "targetProfile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-RelatedPerson-consenter"
            ],
            "aggregation": [
              "contained"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Consent.grantee",
        "path": "Consent.grantee",
        "short": "consenter",
        "min": 1,
        "max": "1",
        "patternReference": {
          "reference": "Organization/bpcs"
        },
        "mustSupport": true
      },
      {
        "id": "Consent.policyBasis",
        "path": "Consent.policyBasis",
        "short": "Type of consent",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Consent.policyBasis.url",
        "path": "Consent.policyBasis.url",
        "short": "CRA income permission",
        "definition": "A URL that indicates that the identified recipient has authorized the BPCS program to receive income information direct from CRA",
        "min": 1,
        "patternUrl": "https://bpcs.exchange/fhir/index.html#CRAConsent",
        "mustSupport": true
      },
      {
        "id": "Consent.decision",
        "path": "Consent.decision",
        "min": 1,
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "ConsentDTO.status"
          }
        ]
      }
    ]
  }
}