{
  "resourceType": "StructureDefinition",
  "id": "profile-Claim-base",
  "url": "https://bpcs.exchange/fhir/StructureDefinition/profile-Claim-base",
  "name": "ClaimBase",
  "title": "Claim Base",
  "status": "active",
  "experimental": false,
  "description": "A common set of information used when representing Claim information, regardless of context",
  "fhirVersion": "5.0.0",
  "mapping": [
    {
      "identity": "BPCS",
      "name": "Internal BPCS API"
    }
  ],
  "kind": "resource",
  "abstract": true,
  "type": "Claim",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Claim",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Claim.contained",
        "path": "Claim.contained",
        "slicing": {
          "discriminator": [
            {
              "type": "profile",
              "path": "$this"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "Claim.contained:dispenses",
        "path": "Claim.contained",
        "sliceName": "dispenses",
        "type": [
          {
            "code": "MedicationDispense",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-MedicationDispense"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Claim.status",
        "path": "Claim.status",
        "short": "draft | active",
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "valueSet": "https://bpcs.exchange/fhir/ValueSet/vs-FinancialStatus"
        },
        "mapping": [
          {
            "identity": "BPCS",
            "map": "BatchRecordDTO.batchStatus"
          }
        ]
      },
      {
        "id": "Claim.type",
        "path": "Claim.type",
        "patternCodeableConcept": {
          "coding": [
            {
              "system": "http://terminology.hl7.org/CodeSystem/claim-type",
              "code": "pharmacy"
            }
          ]
        }
      },
      {
        "id": "Claim.use",
        "path": "Claim.use",
        "patternCode": "claim"
      },
      {
        "id": "Claim.patient",
        "path": "Claim.patient",
        "comment": "If the patient has Trillium coverage, the Claim must be submitted as a 'group' Claim, tied to the family (possibly including receipts from multiple family members).  In all other cases, the Claim must be submitted as an individual Claim, tied to a single Patient",
        "type": [
          {
            "code": "Reference",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Reference-group-or-patient"
            ],
            "targetProfile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Patient-create"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Claim.created",
        "path": "Claim.created",
        "comment": "This is set to the current date",
        "mustSupport": true
      },
      {
        "id": "Claim.insurer",
        "path": "Claim.insurer",
        "patternReference": {
          "reference": "Organization/bpcs"
        }
      },
      {
        "id": "Claim.supportingInfo",
        "path": "Claim.supportingInfo",
        "slicing": {
          "discriminator": [
            {
              "type": "type",
              "path": "category"
            },
            {
              "type": "type",
              "path": "value"
            },
            {
              "type": "profile",
              "path": "value.resolve()"
            }
          ],
          "rules": "open"
        },
        "comment": "There will be at least one supportingInformation for each receipt containing the dispense information associated with that receipt",
        "mustSupport": true
      },
      {
        "id": "Claim.supportingInfo.sequence",
        "path": "Claim.supportingInfo.sequence",
        "comment": "This is a unique sequential integer (starting with 1) - one per dispense",
        "mustSupport": true
      },
      {
        "id": "Claim.supportingInfo:dispense",
        "path": "Claim.supportingInfo",
        "sliceName": "dispense",
        "comment": "Pointed to by item.informationSequence",
        "mustSupport": true
      },
      {
        "id": "Claim.supportingInfo:dispense.category",
        "path": "Claim.supportingInfo.category",
        "patternCodeableConcept": {
          "coding": [
            {
              "system": "http://terminology.hl7.org/CodeSystem/claiminformationcategory",
              "code": "info"
            }
          ]
        }
      },
      {
        "id": "Claim.supportingInfo:dispense.value[x]",
        "path": "Claim.supportingInfo.value[x]",
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Reference-rest"
            ],
            "targetProfile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-MedicationDispense"
            ],
            "aggregation": [
              "contained"
            ]
          }
        ],
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "ReceiptDTO.drug"
          }
        ]
      }
    ]
  }
}