{
  "resourceType": "StructureDefinition",
  "id": "profile-ClaimResponse",
  "url": "https://bpcs.exchange/fhir/StructureDefinition/profile-ClaimResponse",
  "name": "ClaimResponse",
  "title": "Claim Response",
  "status": "active",
  "experimental": false,
  "description": "The information returned by BPCS in response to a claims submission",
  "fhirVersion": "5.0.0",
  "mapping": [
    {
      "identity": "BPCS",
      "name": "Internal BPCS API"
    }
  ],
  "kind": "resource",
  "abstract": true,
  "type": "ClaimResponse",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/ClaimResponse",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "ClaimResponse.contained",
        "path": "ClaimResponse.contained",
        "slicing": {
          "discriminator": [
            {
              "type": "profile",
              "path": "$this"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "ClaimResponse.contained:duplicates",
        "path": "ClaimResponse.contained",
        "sliceName": "duplicates",
        "max": "1",
        "type": [
          {
            "code": "ExplanationOfBenefit",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-ExplanationOfBenefit-duplicate"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "ClaimResponse.contained:dispenses",
        "path": "ClaimResponse.contained",
        "sliceName": "dispenses",
        "type": [
          {
            "code": "MedicationDispense",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-MedicationDispense"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "ClaimResponse.status",
        "path": "ClaimResponse.status",
        "short": "draft | active",
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "valueSet": "https://bpcs.exchange/fhir/ValueSet/vs-FinancialStatus"
        },
        "mapping": [
          {
            "identity": "BPCS",
            "map": "BatchRecordDTO.batchStatus"
          }
        ]
      },
      {
        "id": "ClaimResponse.type",
        "path": "ClaimResponse.type",
        "patternCodeableConcept": {
          "coding": [
            {
              "system": "http://terminology.hl7.org/CodeSystem/claim-type",
              "code": "pharmacy"
            }
          ]
        }
      },
      {
        "id": "ClaimResponse.use",
        "path": "ClaimResponse.use",
        "patternCode": "claim"
      },
      {
        "id": "ClaimResponse.patient",
        "path": "ClaimResponse.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": "ClaimResponse.created",
        "path": "ClaimResponse.created",
        "comment": "This is the 'current' date when the ClaimResponse is produced",
        "mustSupport": true
      },
      {
        "id": "ClaimResponse.insurer",
        "path": "ClaimResponse.insurer",
        "patternReference": {
          "reference": "Organization/bpcs"
        }
      },
      {
        "id": "ClaimResponse.request",
        "path": "ClaimResponse.request",
        "comment": "References SHALL be a reference to an actual FHIR resource, and SHALL be resolvable (allowing for access control, temporary unavailability, etc.). Resolution can be either by retrieval from the URL, or, where applicable by resource type, by treating an absolute reference as a canonical URL and looking it up in a local registry/repository.\r\n  This will only be present if the submitted Claim has an id (because the Claim has previously been held)",
        "type": [
          {
            "code": "Reference",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Reference-rest"
            ],
            "targetProfile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Claim-create"
            ]
          }
        ],
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "BatchRecordDTO.dateReceived (second-last component of id), BatchRecordDTO.batchSeqNum (last component of id)"
          }
        ]
      },
      {
        "id": "ClaimResponse.outcome",
        "path": "ClaimResponse.outcome",
        "mustSupport": true
      },
      {
        "id": "ClaimResponse.item",
        "path": "ClaimResponse.item",
        "comment": "There will be a ClaimResponse.item for each item in the associated claim submission",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "ClaimResponse.item.extension",
        "path": "ClaimResponse.item.extension",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "ClaimResponse.item.extension:receiptPlan",
        "path": "ClaimResponse.item.extension",
        "sliceName": "receiptPlan",
        "min": 1,
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/ext-Resource-ReceiptPlan"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "ClaimResponse.item.extension:presetModifier",
        "path": "ClaimResponse.item.extension",
        "sliceName": "presetModifier",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/ext-ClaimResponse-PresetModifier"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "ClaimResponse.item.itemSequence",
        "path": "ClaimResponse.item.itemSequence",
        "comment": "This will match the Claim.item.sequence of the corresponding repetition in the associated Claim submission",
        "mustSupport": true
      },
      {
        "id": "ClaimResponse.item.reviewOutcome",
        "path": "ClaimResponse.item.reviewOutcome",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "ClaimResponse.item.reviewOutcome.extension:info",
        "path": "ClaimResponse.item.reviewOutcome.extension",
        "sliceName": "info",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/ext-ClaimResponse-Info"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "ClaimResponse.item.reviewOutcome.decision",
        "path": "ClaimResponse.item.reviewOutcome.decision",
        "min": 1,
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "valueSet": "https://bpcs.exchange/fhir/ValueSet/vs-Receipt-status"
        }
      },
      {
        "id": "ClaimResponse.item.reviewOutcome.reason",
        "path": "ClaimResponse.item.reviewOutcome.reason",
        "comment": "If multiple issues are identified, there is no specific order in which they should be displayed or addressed.  In some cases, a UI might display and allow addressing all issues at once.",
        "mustSupport": true,
        "binding": {
          "strength": "extensible",
          "valueSet": "https://bpcs.exchange/fhir/ValueSet/vs-ClaimResponse"
        },
        "mapping": [
          {
            "identity": "BPCS",
            "map": "AssessContext.responseCodes, AssessmentFlag.(various EFlags)"
          }
        ]
      },
      {
        "id": "ClaimResponse.item.reviewOutcome.reason.extension:allowedModifier",
        "path": "ClaimResponse.item.reviewOutcome.reason.extension",
        "sliceName": "allowedModifier",
        "comment": "Indicates modifier codes permitted to override for this response code (if any).",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/ext-ClaimResponse-AllowedModifier"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "ClaimResponse.item.reviewOutcome.reason.extension:allowedModifier.value[x]",
        "path": "ClaimResponse.item.reviewOutcome.reason.extension.value[x]"
      },
      {
        "id": "ClaimResponse.item.reviewOutcome.reason.extension:allowedModifier.value[x].extension:default",
        "path": "ClaimResponse.item.reviewOutcome.reason.extension.value[x].extension",
        "sliceName": "default",
        "comment": "May only be present on one modifier within a reason.",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/ext-ClaimResponse-AllowedModifierDefault"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "ClaimResponse.item.reviewOutcome.reason.extension:allowedModifier.value[x].extension:preExistingCondition",
        "path": "ClaimResponse.item.reviewOutcome.reason.extension.value[x].extension",
        "sliceName": "preExistingCondition",
        "comment": "Only allowed where an 'allowed modifier' is a health condition.",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/ext-ClaimResponse-PreExistingCondition"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "ClaimResponse.item.reviewOutcome.reason.extension:duplicate",
        "path": "ClaimResponse.item.reviewOutcome.reason.extension",
        "sliceName": "duplicate",
        "comment": "This will only be present if the reason code is ED and then only if there is not an exact match.  If present, the user must identify which of the submitted claims from the pharmacy point of service correspond to the manually submitted receipt.  This allows information such as coverage from other payers to be taken into account when adjudicating the paper claim.  The selected duplicate will then be conveyed in the 'duplicateVersion' extension when re-adjudicating the receipt.",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/ext-ClaimResponse-DuplicateReceipts"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "ClaimResponse.item.adjudication",
        "path": "ClaimResponse.item.adjudication",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "category"
            }
          ],
          "rules": "open"
        },
        "min": 2,
        "mustSupport": true
      },
      {
        "id": "ClaimResponse.item.adjudication:eligible",
        "path": "ClaimResponse.item.adjudication",
        "sliceName": "eligible",
        "short": "Eligible amount",
        "min": 1,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "ClaimResponse.item.adjudication:eligible.category",
        "path": "ClaimResponse.item.adjudication.category",
        "patternCodeableConcept": {
          "coding": [
            {
              "system": "http://terminology.hl7.org/CodeSystem/adjudication",
              "code": "eligible"
            }
          ]
        }
      },
      {
        "id": "ClaimResponse.item.adjudication:eligible.amount",
        "path": "ClaimResponse.item.adjudication.amount",
        "min": 1,
        "type": [
          {
            "code": "Money",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Money-CAD-NonNeg"
            ]
          }
        ],
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "ReceiptDTO.allowedRxExp"
          }
        ]
      },
      {
        "id": "ClaimResponse.item.adjudication:benefit",
        "path": "ClaimResponse.item.adjudication",
        "sliceName": "benefit",
        "short": "Benefit amount",
        "min": 1,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "ClaimResponse.item.adjudication:benefit.category",
        "path": "ClaimResponse.item.adjudication.category",
        "patternCodeableConcept": {
          "coding": [
            {
              "system": "http://terminology.hl7.org/CodeSystem/adjudication",
              "code": "benefit"
            }
          ]
        }
      },
      {
        "id": "ClaimResponse.item.adjudication:benefit.amount",
        "path": "ClaimResponse.item.adjudication.amount",
        "min": 1,
        "type": [
          {
            "code": "Money",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Money-CAD-NonNeg"
            ]
          }
        ],
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "ReceiptDTO.reimbAmt"
          }
        ]
      }
    ]
  }
}