# ABDM health records (ABHA) through the bridge

CarePulse prepares FHIR R4 **document bundles** following the NRCeS ABDM implementation guide and hands them to the hospital's ABDM
bridge (Caresoft bridge or the HIS's own HIP service). The bridge does what ABDM requires of a HIP: care-context linking to the ABHA,
consent artefacts, encrypted data transfer to the HIU. CarePulse never calls the ABDM gateway itself.

## Records
| Record | When | Contents |
|---|---|---|
| `WellnessRecord` | Weekly (Monday, last week) for patients with an ABHA; or "Share to ABHA" on the patient page for any period | Composition (profile WellnessRecord, type text "Wellness Record") with sections Vital Signs, Body Measurement, Physical Activity, Other Observations; Observations with LOINC where known; CGM summarised as one daily mean per day (max 600 observations). |
| `OPConsultation` | When a teleconsult is completed (setting) | Composition (profile OPConsultRecord, SNOMED 371530004 Clinical consultation report): Chief complaints (Condition), Physical examination (latest readings + findings), Plan / advice (CarePlan), Follow up (Appointment); Encounter class `VR` (virtual); Practitioner with registration number. |

Care-context reference: `CP-<CLIENT>-W<patient>-<from>-<to>` or `CP-<CLIENT>-C<consult>` (unique). Patients without ABHA number / address are stored as **skipped**; add the ABHA and press Retry.

## Bridge contract (CarePulse → bridge)
`POST {abdm_bridge_url}{abdm_push_path}` (default `/api/abdm/health-records`), headers `Authorization: Bearer {abdm_bridge_key}`, `X-Client-Code`.
```json
{"hip_id":"IN09…","client":"SHIVA",
 "patient":{"abha_number":"91…","abha_address":"name@abdm","uhid":"UH123","name":"…","gender":"M","year_of_birth":1958,"mobile":"…"},
 "care_context":{"reference":"CP-SHIVA-W12-20261109-20261115","display":"Home monitoring 09 Nov – 15 Nov 2026"},
 "hi_type":"WellnessRecord","record_date":"2026-11-15T23:59:59+05:30","bundle":{ …FHIR document Bundle… }}
```
2xx = accepted (CarePulse marks *sent* and stores the reply's `status`). Errors are retried up to 8 times, then *failed* (Retry button).

The bridge team should: link the care context (HIP-initiated linking with the patient's consent, or on discovery), store the bundle
against it, serve it on a consent-approved data request, and **validate it in the ABDM sandbox** – NRCeS profiles change between IG
releases, so expect small mapping changes during certification. Caresoft's bridge: CSP_001 (`https://myapp.appdoc.in`).
