# Convert Insurance Claims to FHIR Clinical Resources

Flexpa's claims to clinical turns each eligible ExplanationOfBenefit into US Core 6.1 clinical resources: one Encounter per non-pharmacy claim, Conditions from its diagnosis codes and Procedures from its procedure codes, plus a Provenance resource linking everything back to the source claim. It runs inside Flexpa's sync pipeline on supported endpoints, keeps the original EOB, and gives generated resources deterministic IDs so re-syncs don't create duplicates.

How it works: ExplanationOfBenefit -> Claims to clinical -> Encounter, Condition, Procedure -> Provenance. Generated resources carry a claims-derived extension and link to the source claim.

## What it generates

- **Encounter:** One per non-pharmacy EOB, unless a matching Encounter already exists. Class (ambulatory, inpatient, emergency, home health, field) comes from place of service, revenue codes, bill type and CPT ranges.
- **Condition:** One per distinct diagnosis code on the claim, using the US Core Condition Encounter Diagnosis profile and categorized as encounter-diagnosis. A code listed twice, for example as principal and secondary diagnosis, produces one Condition.
- **Procedure:** Every entry in eob.procedure[] becomes a Procedure. Procedural item codes (CPT, HCPCS, ICD-10-PCS, CDT) are deduplicated by base code and service date, so the same code on two dates gives two Procedures and on the same date gives one, unless distinct-procedure modifiers or different body sites mark them as separate.
- **Provenance:** One per EOB, linking all generated resources to the source claim.

## How it behaves

- Cancelled, draft and entered-in-error claims are skipped. Pharmacy claims produce no Encounter, so their Conditions and Procedures are discarded.
- IDs are deterministic UUIDv5 hashes, so the same claim yields the same resource IDs on every re-sync. Condition IDs use the payer’s diagnosis sequence number and fall back to array position when there is none, so if a payer reorders unsequenced diagnoses, a Condition ID can point to a different diagnosis.
- Every generated resource carries the claims-derived extension, so you can tell it apart from EHR-sourced data.
- Encounter periods use the admission period for inpatient claims and the billable period for outpatient claims, fall back to line-item service dates, and drop sentinel dates.

## Example

### Generated Encounter (trimmed)

```json
{
  "resourceType": "Encounter",
  "meta": {
    "profile": ["http://hl7.org/fhir/us/core/StructureDefinition/us-core-encounter"]
  },
  "extension": [
    {
      "url": "https://api.flexpa.com/fhir/StructureDefinition/claims-derived",
      "valueBoolean": true
    }
  ],
  "status": "finished",
  "class": { "code": "AMB", "display": "ambulatory" },
  "reasonReference": [{ "reference": "Condition/cond-1" }]
}
```

## Questions

**How do I convert health insurance claims (ExplanationOfBenefit) into FHIR Condition, Procedure and Encounter resources?** Use Flexpa's claims to clinical. It generates US Core 6.1 Encounter, Condition and Procedure resources from eligible ExplanationOfBenefit claims on supported endpoints, keeps the original claim, and links each generated resource back to it with FHIR Provenance. It is included from the Scale tier and is a $5,000 a year add-on below it.

**Which claims are skipped?** Cancelled, draft and entered-in-error claims. Pharmacy claims produce no Encounter, so any Conditions and Procedures generated from them are discarded.

**Will re-syncing create duplicate resources?** No. Generated resources get deterministic IDs computed from the patient namespace, resource type, source EOB ID and key, so re-syncs produce the same IDs. Condition IDs fall back to array position when the payer sends no diagnosis sequence, so a reordering of unsequenced diagnoses can shift which diagnosis an ID refers to.

**How do I tell claims-derived data from EHR data?** Generated resources carry the extension https://api.flexpa.com/fhir/StructureDefinition/claims-derived with valueBoolean true, an identifier pointing at the source EOB, and a Provenance resource linking them to it.

**Can a payer use this on its own claims?** Flexpa's docs say the engine is available as a standalone transformer for payers implementing the Da Vinci PDex mappings; contact Flexpa.

## More

- [Claims to clinical (docs)](https://www.flexpa.com/docs/records/claims-to-clinical)
- [FHIR claims API](https://www.flexpa.com/fhir-claims-api)
- [Claims vs medical records](https://www.flexpa.com/claims-vs-medical-records)
- [Pricing](https://www.flexpa.com/pricing)
- [How Flexpa compares with other patient data APIs](https://www.flexpa.com/why-flexpa)

Last updated 2026-11-22.
