{
  "resourceType": "StructureDefinition",
  "id": "profile-ExplanationOfBenefit-expenses",
  "url": "https://bpcs.exchange/fhir/StructureDefinition/profile-ExplanationOfBenefit-expenses",
  "name": "ExplanationOfBenefitExpenses",
  "title": "Recipient Expenses",
  "status": "active",
  "experimental": false,
  "description": "A profile on the EOB resources that allows reporting the sum total of eligible expenses for a given coverage for specific benefit years",
  "fhirVersion": "5.0.0",
  "mapping": [
    {
      "identity": "BPCS",
      "name": "Internal BPCS API"
    }
  ],
  "kind": "resource",
  "abstract": false,
  "type": "ExplanationOfBenefit",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/ExplanationOfBenefit",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "ExplanationOfBenefit.contained",
        "path": "ExplanationOfBenefit.contained",
        "slicing": {
          "discriminator": [
            {
              "type": "profile",
              "path": "$this"
            }
          ],
          "rules": "open"
        },
        "min": 1
      },
      {
        "id": "ExplanationOfBenefit.contained:provenance",
        "path": "ExplanationOfBenefit.contained",
        "sliceName": "provenance",
        "short": "Creation/Update/etc. Metadata",
        "definition": "Nested Provenance information referring to this resource that describes the creation, and sometimes the most recent update and/or inactivation of the record, specifically who was responsible and when it occurred",
        "min": 1,
        "type": [
          {
            "code": "Provenance",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Provenance"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "ExplanationOfBenefit.status",
        "path": "ExplanationOfBenefit.status",
        "patternCode": "active"
      },
      {
        "id": "ExplanationOfBenefit.type",
        "path": "ExplanationOfBenefit.type",
        "patternCodeableConcept": {
          "coding": [
            {
              "system": "http://terminology.hl7.org/CodeSystem/claim-type",
              "code": "pharmacy"
            }
          ]
        }
      },
      {
        "id": "ExplanationOfBenefit.use",
        "path": "ExplanationOfBenefit.use",
        "patternCode": "claim"
      },
      {
        "id": "ExplanationOfBenefit.patient",
        "path": "ExplanationOfBenefit.patient",
        "type": [
          {
            "code": "Reference",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Reference-rest"
            ],
            "targetProfile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Patient-search"
            ]
          }
        ],
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "RecipientExpensesDTO.odbNum"
          }
        ]
      },
      {
        "id": "ExplanationOfBenefit.created",
        "path": "ExplanationOfBenefit.created",
        "comment": "This will be the date/time the operation was executed",
        "mustSupport": true
      },
      {
        "id": "ExplanationOfBenefit.insurer",
        "path": "ExplanationOfBenefit.insurer",
        "patternReference": {
          "reference": "Organization/bpcs"
        }
      },
      {
        "id": "ExplanationOfBenefit.outcome",
        "path": "ExplanationOfBenefit.outcome",
        "patternCode": "complete"
      },
      {
        "id": "ExplanationOfBenefit.total",
        "path": "ExplanationOfBenefit.total",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "category"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "ExplanationOfBenefit.total:eligible",
        "path": "ExplanationOfBenefit.total",
        "sliceName": "eligible",
        "short": "Total eligible expenses submitted",
        "definition": "This is the total eligible amounts from submitted drug expenses for the specified coverage year",
        "mustSupport": true
      },
      {
        "id": "ExplanationOfBenefit.total:eligible.category",
        "path": "ExplanationOfBenefit.total.category",
        "patternCodeableConcept": {
          "coding": [
            {
              "system": "http://terminology.hl7.org/CodeSystem/adjudication",
              "code": "eligible"
            }
          ]
        },
        "mustSupport": true
      },
      {
        "id": "ExplanationOfBenefit.total:eligible.amount",
        "path": "ExplanationOfBenefit.total.amount",
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "RecipientExpensesDTO.accumulatedAllowedExpenseCurrent or accumulatedAllowedExpensePrevious (depending on benefit year)"
          }
        ]
      },
      {
        "id": "ExplanationOfBenefit.benefitPeriod",
        "path": "ExplanationOfBenefit.benefitPeriod",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "ExplanationOfBenefit.benefitPeriod.start",
        "path": "ExplanationOfBenefit.benefitPeriod.start",
        "definition": "This is the start of the benefit year (always Aug. 1)",
        "min": 1,
        "type": [
          {
            "code": "dateTime",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-dateTime-date"
            ]
          }
        ],
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "RecipientExpensesDTO.benefitYear (Aug. 1)"
          }
        ]
      },
      {
        "id": "ExplanationOfBenefit.benefitPeriod.end",
        "path": "ExplanationOfBenefit.benefitPeriod.end",
        "definition": "This is the end of the benefit year (always Jul 31)",
        "min": 1,
        "type": [
          {
            "code": "dateTime",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-dateTime-date"
            ]
          }
        ],
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "RecipientExpensesDTO.benefitYear + 1 (July 31)"
          }
        ]
      }
    ]
  }
}