link-claim-response
Pure data transformation that links a matched ClaimResponse to its Claim. Sets the request reference, copies patient/insurer/requestor from the Claim, matches service lines by CPT code and modifiers, removes contained resources (replaced by external refs), and sets the match status to matched.
Script path: @aidbox-billing/fhir/link-claim-response
Input
| Parameter | Type | Description |
|---|---|---|
claimResponse | object | The draft ClaimResponse resource to link |
claim | object | The matched Claim resource |
Output
| Field | Type | Description |
|---|---|---|
bundle | Bundle | FHIR transaction bundle with the updated (linked) ClaimResponse |
What it does
- Sets
ClaimResponse.requestto reference the matched Claim. - Copies
patient,insurer, andrequestorfrom the Claim (replacing contained resource refs with external refs). - Matches each
addItemin the ClaimResponse to aitemin the Claim by CPT code and modifiers. - Removes contained resources (since external refs now replace them).
- Sets
statustoactiveand thematch-statusextension tomatched.
Usage in workflow YAML
- id: link-match
script: "@aidbox-billing/fhir/link-claim-response"
applicability:
- $activities.try-pcn-match.output.matched
params:
claimResponse: $activities.fetch.output.claimResponse
claim: $activities.try-pcn-match.output.claim
children: [save-match]