{
  "resourceType": "StructureDefinition",
  "id": "profile-Patient-search",
  "url": "https://bpcs.exchange/fhir/StructureDefinition/profile-Patient-search",
  "name": "PatientSearch",
  "title": "Recipient Search Result Profile",
  "status": "active",
  "experimental": false,
  "description": "Data elements returned about a recipient when performing a search",
  "fhirVersion": "5.0.0",
  "mapping": [
    {
      "identity": "BPCS",
      "name": "Internal BPCS API"
    }
  ],
  "kind": "resource",
  "abstract": false,
  "type": "Patient",
  "baseDefinition": "https://bpcs.exchange/fhir/StructureDefinition/profile-Patient-base",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Patient.id",
        "path": "Patient.id",
        "comment": "This should be the same as the ODB Number",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Patient.meta",
        "path": "Patient.meta",
        "mustSupport": true
      },
      {
        "id": "Patient.meta.lastUpdated",
        "path": "Patient.meta.lastUpdated",
        "min": 1,
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "RecipientDTO.recCreateCustomTimestamp (combine components into FHIR timestamp syntax - YYYY-MM-DDThh:mm:ss.ssssss)"
          }
        ]
      },
      {
        "id": "Patient.contained",
        "path": "Patient.contained",
        "slicing": {
          "discriminator": [
            {
              "type": "profile",
              "path": "$this"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "Patient.contained:provenance",
        "path": "Patient.contained",
        "sliceName": "provenance",
        "type": [
          {
            "code": "Provenance",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Provenance"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Patient.extension:applicationMember",
        "path": "Patient.extension",
        "sliceName": "applicationMember",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/ext-Patient-ApplicationMemberFlag"
            ]
          }
        ],
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "RecipientDTO.applicationMember"
          }
        ]
      },
      {
        "id": "Patient.extension:seniorFlag",
        "path": "Patient.extension",
        "sliceName": "seniorFlag",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/ext-Patient-SeniorFlag"
            ]
          }
        ],
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "RecipientDTO.senior"
          }
        ]
      },
      {
        "id": "Patient.extension:problemCode",
        "path": "Patient.extension",
        "sliceName": "problemCode",
        "comment": "Problem codes will only be shown when exposing members in the context of a family coverage application",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/ext-Resource-ProblemCode"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Patient.extension:problemCode.value[x]",
        "path": "Patient.extension.value[x]",
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "valueSet": "https://bpcs.exchange/fhir/ValueSet/vs-Problem-patient"
        }
      },
      {
        "id": "Patient.identifier:odbNum",
        "path": "Patient.identifier",
        "sliceName": "odbNum",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Patient.identifier:odbNum.extension:ODBVersion",
        "path": "Patient.identifier.extension",
        "sliceName": "ODBVersion",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://hl7canada.ca/ig/baseline/StructureDefinition/ext-identifierversion"
            ]
          }
        ],
        "mustSupport": true,
        "isModifier": false,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "RecipientDTO.healthCardVersion"
          }
        ]
      },
      {
        "id": "Patient.active",
        "path": "Patient.active",
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "RecipientDTO.recInactiveCustomTimestamp - if not null, set 'active' to 'false', otherwise, omit 'active'."
          }
        ]
      },
      {
        "id": "Patient.address:mailing.extension:municipalityCode",
        "path": "Patient.address.extension",
        "sliceName": "municipalityCode",
        "comment": "The binding is extensible to allow for the addition of new codes.  Codes will always be found in the current expansion of the value set.",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/ext-Address-MunicipalityCode"
            ]
          }
        ],
        "mustSupport": true,
        "binding": {
          "strength": "extensible",
          "valueSet": "https://bpcs.exchange/fhir/ValueSet/vs-Municipality"
        },
        "mapping": [
          {
            "identity": "BPCS",
            "map": "RecipientAddress.municipleCd"
          }
        ]
      }
    ]
  }
}