{
  "resourceType": "StructureDefinition",
  "id": "profile-ExplanationOfBenefit-duplicate",
  "url": "https://bpcs.exchange/fhir/StructureDefinition/profile-ExplanationOfBenefit-duplicate",
  "name": "ExplanationOfBenefitExpenses",
  "title": "Recipient Expenses",
  "status": "active",
  "experimental": false,
  "description": "A profile on the EOB resources that allows providing information about potentially duplicate receipts as part of a ClaimResponse",
  "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.id",
        "path": "ExplanationOfBenefit.id",
        "comment": "Used to point to the receipt collection from the relevant ClaimResponseItem",
        "min": 1,
        "patternId": "dups"
      },
      {
        "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-group-or-patient"
            ],
            "targetProfile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Patient-search"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "ExplanationOfBenefit.created",
        "path": "ExplanationOfBenefit.created",
        "comment": "This will be the date/time the ClaimResponse was returned",
        "mustSupport": true
      },
      {
        "id": "ExplanationOfBenefit.insurer",
        "path": "ExplanationOfBenefit.insurer",
        "patternReference": {
          "reference": "Organization/bpcs"
        }
      },
      {
        "id": "ExplanationOfBenefit.outcome",
        "path": "ExplanationOfBenefit.outcome",
        "patternCode": "complete"
      },
      {
        "id": "ExplanationOfBenefit.supportingInfo",
        "path": "ExplanationOfBenefit.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": "ExplanationOfBenefit.supportingInfo:dispense",
        "path": "ExplanationOfBenefit.supportingInfo",
        "sliceName": "dispense",
        "comment": "Pointed to by item.informationSequence",
        "mustSupport": true
      },
      {
        "id": "ExplanationOfBenefit.supportingInfo:dispense.category",
        "path": "ExplanationOfBenefit.supportingInfo.category",
        "patternCodeableConcept": {
          "coding": [
            {
              "system": "http://terminology.hl7.org/CodeSystem/claiminformationcategory",
              "code": "info"
            }
          ]
        }
      },
      {
        "id": "ExplanationOfBenefit.supportingInfo:dispense.value[x]",
        "path": "ExplanationOfBenefit.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
      },
      {
        "id": "ExplanationOfBenefit.item",
        "path": "ExplanationOfBenefit.item",
        "mustSupport": true
      },
      {
        "id": "ExplanationOfBenefit.item.extension",
        "path": "ExplanationOfBenefit.item.extension",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "ExplanationOfBenefit.item.extension:patient",
        "path": "ExplanationOfBenefit.item.extension",
        "sliceName": "patient",
        "comment": "This will only be present if the search was performed on a family rather than an individual recipient",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/ext-Claim-ReceiptPatient"
            ]
          }
        ],
        "condition": [
          "BPCS-EOB-1a",
          "BPCS-EOB-1b"
        ],
        "mustSupport": true
      },
      {
        "id": "ExplanationOfBenefit.item.extension:duplicateVersion",
        "path": "ExplanationOfBenefit.item.extension",
        "sliceName": "duplicateVersion",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/ext-Claim-DuplicateVersion"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "ExplanationOfBenefit.item.extension:insurancePlan",
        "path": "ExplanationOfBenefit.item.extension",
        "sliceName": "insurancePlan",
        "min": 1,
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/ext-Resource-ReceiptPlan"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "ExplanationOfBenefit.item.extension:deductibleStatus",
        "path": "ExplanationOfBenefit.item.extension",
        "sliceName": "deductibleStatus",
        "comment": "This will only be present for Trillium pre-registration claims",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/ext-Resource-DeductibleStatus"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "ExplanationOfBenefit.item.sequence",
        "path": "ExplanationOfBenefit.item.sequence",
        "comment": "The sequence number here won't necessarily be the same as it was in the original claim",
        "mustSupport": true
      },
      {
        "id": "ExplanationOfBenefit.item.informationSequence",
        "path": "ExplanationOfBenefit.item.informationSequence",
        "comment": "This will, at minimum point to the the dispense associated with the duplicate receipt",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "ExplanationOfBenefit.item.productOrService",
        "path": "ExplanationOfBenefit.item.productOrService",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "ExplanationOfBenefit.item.productOrService.coding",
        "path": "ExplanationOfBenefit.item.productOrService.coding",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "system"
            }
          ],
          "rules": "open"
        },
        "min": 2,
        "mustSupport": true
      },
      {
        "id": "ExplanationOfBenefit.item.productOrService.coding:claimDinPin",
        "path": "ExplanationOfBenefit.item.productOrService.coding",
        "sliceName": "claimDinPin",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "ExplanationOfBenefit.item.productOrService.coding:claimDinPin.system",
        "path": "ExplanationOfBenefit.item.productOrService.coding.system",
        "min": 1,
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "valueSet": "https://bpcs.exchange/fhir/ValueSet/vs-DinPinSystem"
        }
      },
      {
        "id": "ExplanationOfBenefit.item.productOrService.coding:claimDinPin.code",
        "path": "ExplanationOfBenefit.item.productOrService.coding.code",
        "min": 1,
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "DuplicateClaimDTO.dinPin"
          }
        ]
      },
      {
        "id": "ExplanationOfBenefit.item.productOrService.coding:claimDinPin.display",
        "path": "ExplanationOfBenefit.item.productOrService.coding.display",
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "DuplicateClaimDTO.dinDesc"
          }
        ]
      },
      {
        "id": "ExplanationOfBenefit.item.productOrService.coding:generic",
        "path": "ExplanationOfBenefit.item.productOrService.coding",
        "sliceName": "generic",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "ExplanationOfBenefit.item.productOrService.coding:generic.system",
        "path": "ExplanationOfBenefit.item.productOrService.coding.system",
        "min": 1,
        "patternUri": "http://terminology.hl7.org/CodeSystem/hc-CCDD"
      },
      {
        "id": "ExplanationOfBenefit.item.productOrService.coding:generic.display",
        "path": "ExplanationOfBenefit.item.productOrService.coding.display",
        "min": 1,
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "DuplicateClaimDTO.genName"
          }
        ]
      },
      {
        "id": "ExplanationOfBenefit.item.productOrService.coding:dummyPIN",
        "path": "ExplanationOfBenefit.item.productOrService.coding",
        "sliceName": "dummyPIN",
        "mustSupport": true
      },
      {
        "id": "ExplanationOfBenefit.item.productOrService.coding:dummyPIN.system",
        "path": "ExplanationOfBenefit.item.productOrService.coding.system",
        "min": 1,
        "patternUri": "https://bpcs.exchange/fhir/CodeSystem/cs-DummyPIN"
      },
      {
        "id": "ExplanationOfBenefit.item.productOrService.coding:dummyPIN.display",
        "path": "ExplanationOfBenefit.item.productOrService.coding.display",
        "min": 1,
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "DrugDTO.dummyPIN"
          }
        ]
      },
      {
        "id": "ExplanationOfBenefit.item.modifier",
        "path": "ExplanationOfBenefit.item.modifier",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "$this"
            }
          ],
          "rules": "open"
        },
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "valueSet": "https://bpcs.exchange/fhir/ValueSet/vs-ClaimResponse-AllowedModifier"
        }
      },
      {
        "id": "ExplanationOfBenefit.item.modifier:medicalReason",
        "path": "ExplanationOfBenefit.item.modifier",
        "sliceName": "medicalReason",
        "short": "Medical reason",
        "max": "1",
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "valueSet": "https://bpcs.exchange/fhir/ValueSet/vs-MedicalReason"
        },
        "mapping": [
          {
            "identity": "BPCS",
            "map": "DuplicateClaimDTO.medCond, ReceiptDTO.medCond"
          }
        ]
      },
      {
        "id": "ExplanationOfBenefit.item.patientPaid",
        "path": "ExplanationOfBenefit.item.patientPaid",
        "min": 1,
        "type": [
          {
            "code": "Money",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Money-CAD"
            ]
          }
        ],
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "Net - ReceiptDTO.prevPd (drug submitted + fee submitted - patientPaid)"
          }
        ]
      },
      {
        "id": "ExplanationOfBenefit.item.reviewOutcome",
        "path": "ExplanationOfBenefit.item.reviewOutcome",
        "mustSupport": true
      },
      {
        "id": "ExplanationOfBenefit.item.reviewOutcome.decision",
        "path": "ExplanationOfBenefit.item.reviewOutcome.decision",
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "valueSet": "https://bpcs.exchange/fhir/ValueSet/vs-Receipt-status"
        },
        "mapping": [
          {
            "identity": "BPCS",
            "map": "ReceiptDTO.currStat (denied=R, paid=P, pending=H, reversed=V, acceptedReversed=C)"
          }
        ]
      },
      {
        "id": "ExplanationOfBenefit.item.adjudication",
        "path": "ExplanationOfBenefit.item.adjudication",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "category"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "ExplanationOfBenefit.item.adjudication:benefit",
        "path": "ExplanationOfBenefit.item.adjudication",
        "sliceName": "benefit",
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "ExplanationOfBenefit.item.adjudication:benefit.category",
        "path": "ExplanationOfBenefit.item.adjudication.category",
        "patternCodeableConcept": {
          "coding": [
            {
              "system": "http://terminology.hl7.org/CodeSystem/adjudication",
              "code": "benefit"
            }
          ]
        }
      },
      {
        "id": "ExplanationOfBenefit.item.adjudication:benefit.amount",
        "path": "ExplanationOfBenefit.item.adjudication.amount",
        "min": 1,
        "type": [
          {
            "code": "Money",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Money-CAD"
            ]
          }
        ],
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "DuplicateClaimDTO.totAmtPd"
          }
        ]
      },
      {
        "id": "ExplanationOfBenefit.item.adjudication:deductible",
        "path": "ExplanationOfBenefit.item.adjudication",
        "sliceName": "deductible",
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "ExplanationOfBenefit.item.adjudication:deductible.category",
        "path": "ExplanationOfBenefit.item.adjudication.category",
        "patternCodeableConcept": {
          "coding": [
            {
              "system": "http://terminology.hl7.org/CodeSystem/adjudication",
              "code": "deductible"
            }
          ]
        }
      },
      {
        "id": "ExplanationOfBenefit.item.adjudication:deductible.amount",
        "path": "ExplanationOfBenefit.item.adjudication.amount",
        "min": 1,
        "type": [
          {
            "code": "Money",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Money-CAD"
            ]
          }
        ],
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "ReceiptDTO.deductToCollect"
          }
        ]
      },
      {
        "id": "ExplanationOfBenefit.item.detail",
        "path": "ExplanationOfBenefit.item.detail",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "productOrService"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "ExplanationOfBenefit.item.detail:drugCost",
        "path": "ExplanationOfBenefit.item.detail",
        "sliceName": "drugCost",
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "ExplanationOfBenefit.item.detail:drugCost.sequence",
        "path": "ExplanationOfBenefit.item.detail.sequence",
        "comment": "A unique number within the scope of the item.  Typically '1'.",
        "mustSupport": true
      },
      {
        "id": "ExplanationOfBenefit.item.detail:drugCost.productOrService",
        "path": "ExplanationOfBenefit.item.detail.productOrService",
        "min": 1,
        "patternCodeableConcept": {
          "coding": [
            {
              "system": "https://bpcs.exchange/fhir/CodeSystem/cs-CostFee",
              "code": "drugCost"
            }
          ]
        }
      },
      {
        "id": "ExplanationOfBenefit.item.detail:drugCost.adjudication",
        "path": "ExplanationOfBenefit.item.detail.adjudication",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "category"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "ExplanationOfBenefit.item.detail:drugCost.adjudication:submitted",
        "path": "ExplanationOfBenefit.item.detail.adjudication",
        "sliceName": "submitted",
        "mustSupport": true
      },
      {
        "id": "ExplanationOfBenefit.item.detail:drugCost.adjudication:submitted.category",
        "path": "ExplanationOfBenefit.item.detail.adjudication.category",
        "patternCodeableConcept": {
          "coding": [
            {
              "system": "http://terminology.hl7.org/CodeSystem/adjudication",
              "code": "submitted"
            }
          ]
        }
      },
      {
        "id": "ExplanationOfBenefit.item.detail:drugCost.adjudication:submitted.amount",
        "path": "ExplanationOfBenefit.item.detail.adjudication.amount",
        "min": 1,
        "type": [
          {
            "code": "Money",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Money-CAD"
            ]
          }
        ],
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "DuplicateClaimDTO.inputTotal"
          }
        ]
      },
      {
        "id": "ExplanationOfBenefit.item.detail:drugCost.adjudication:eligible",
        "path": "ExplanationOfBenefit.item.detail.adjudication",
        "sliceName": "eligible",
        "mustSupport": true
      },
      {
        "id": "ExplanationOfBenefit.item.detail:drugCost.adjudication:eligible.category",
        "path": "ExplanationOfBenefit.item.detail.adjudication.category",
        "patternCodeableConcept": {
          "coding": [
            {
              "system": "http://terminology.hl7.org/CodeSystem/adjudication",
              "code": "eligible"
            }
          ]
        }
      },
      {
        "id": "ExplanationOfBenefit.item.detail:drugCost.adjudication:eligible.amount",
        "path": "ExplanationOfBenefit.item.detail.adjudication.amount",
        "min": 1,
        "type": [
          {
            "code": "Money",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Money-CAD"
            ]
          }
        ],
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "DuplicateClaimDTO.outputTotal"
          }
        ]
      },
      {
        "id": "ExplanationOfBenefit.item.detail:pharmacistFee",
        "path": "ExplanationOfBenefit.item.detail",
        "sliceName": "pharmacistFee",
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "ExplanationOfBenefit.item.detail:pharmacistFee.sequence",
        "path": "ExplanationOfBenefit.item.detail.sequence",
        "comment": "A unique number within the scope of the item.  Typically '2'.",
        "mustSupport": true
      },
      {
        "id": "ExplanationOfBenefit.item.detail:pharmacistFee.productOrService",
        "path": "ExplanationOfBenefit.item.detail.productOrService",
        "min": 1,
        "patternCodeableConcept": {
          "coding": [
            {
              "system": "https://bpcs.exchange/fhir/CodeSystem/cs-CostFee",
              "code": "pharmacistFee"
            }
          ]
        }
      },
      {
        "id": "ExplanationOfBenefit.item.detail:pharmacistFee.adjudication",
        "path": "ExplanationOfBenefit.item.detail.adjudication",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "category"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "ExplanationOfBenefit.item.detail:pharmacistFee.adjudication:submitted",
        "path": "ExplanationOfBenefit.item.detail.adjudication",
        "sliceName": "submitted",
        "mustSupport": true
      },
      {
        "id": "ExplanationOfBenefit.item.detail:pharmacistFee.adjudication:submitted.category",
        "path": "ExplanationOfBenefit.item.detail.adjudication.category",
        "patternCodeableConcept": {
          "coding": [
            {
              "system": "http://terminology.hl7.org/CodeSystem/adjudication",
              "code": "submitted"
            }
          ]
        }
      },
      {
        "id": "ExplanationOfBenefit.item.detail:pharmacistFee.adjudication:submitted.amount",
        "path": "ExplanationOfBenefit.item.detail.adjudication.amount",
        "min": 1,
        "type": [
          {
            "code": "Money",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Money-CAD"
            ]
          }
        ],
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "DuplicateClaimDTO.fee"
          }
        ]
      },
      {
        "id": "ExplanationOfBenefit.item.detail:pharmacistFee.adjudication:eligible",
        "path": "ExplanationOfBenefit.item.detail.adjudication",
        "sliceName": "eligible",
        "mustSupport": true
      },
      {
        "id": "ExplanationOfBenefit.item.detail:pharmacistFee.adjudication:eligible.category",
        "path": "ExplanationOfBenefit.item.detail.adjudication.category",
        "patternCodeableConcept": {
          "coding": [
            {
              "system": "http://terminology.hl7.org/CodeSystem/adjudication",
              "code": "eligible"
            }
          ]
        }
      },
      {
        "id": "ExplanationOfBenefit.item.detail:pharmacistFee.adjudication:eligible.amount",
        "path": "ExplanationOfBenefit.item.detail.adjudication.amount",
        "min": 1,
        "type": [
          {
            "code": "Money",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Money-CAD"
            ]
          }
        ],
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "DuplicateClaimDTO.alldFee"
          }
        ]
      }
    ]
  }
}