docs: add session handover for ABDM IPD discharge summary lifecycle
This commit is contained in:
parent
ab4b68b968
commit
9272bb5a9c
83
ABDM_IPD_DISCHARGE_SUMMARY_LIFECYCLE_SESSION.md
Normal file
83
ABDM_IPD_DISCHARGE_SUMMARY_LIFECYCLE_SESSION.md
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
# Session Handover: ABDM IPD Discharge Summary Lifecycle & Clinical Observations Integration
|
||||
|
||||
**Date:** October 17, 2026
|
||||
**Status:** ✅ Complete, Committed, Pushed & Verified on Live Environment
|
||||
**Target Repository:** `HMS_CI4_OLD` (`origin/main`)
|
||||
**Live Server:** `hms-live` (`root@159.89.175.190`, `/var/www/html/hms_etria`)
|
||||
|
||||
---
|
||||
|
||||
## 1. Problem Statement & User Feedback
|
||||
|
||||
1. **Premature FHIR Generation on Intermediate Save Buttons**:
|
||||
- The IPD Discharge Summary editor (`Ipd_discharge::ipd_select`) has numerous independent save buttons (`add_complaint`, `save_main`, `dietary_autosave`, `add_drug`, etc.).
|
||||
- Previously, intermediate clicks triggered `enqueueIpdDischargeSync` immediately while the patient was still admitted (`discarge_patient_status == 0`, no discharge date).
|
||||
- This generated an incomplete, draft FHIR DocumentBundle and queued it in `health_records` and `abdm_sync_outbox`.
|
||||
|
||||
2. **Missing FHIR Trigger in Billing Department Discharge**:
|
||||
- While ABDM care context discovery correctly requires an official discharge date, the Billing discharge action (`Billing\Ipd::updateDischargeStatus`) did **not** trigger FHIR bundle regeneration.
|
||||
- When the patient was officially discharged in billing, the old premature draft bundle remained in `health_records` without the final discharge date, final discharge status, or subsequent clinical sections.
|
||||
|
||||
3. **Missing Physical Examination & Vitals in FHIR Records (Screenshot 1 vs Screenshot 2)**:
|
||||
- In Screenshot 1 (Discharge Summary PDF), comprehensive General Examination on Admission and Examination on Discharge were present:
|
||||
- `Pulse : 40/min`, `Respiration : 25/min`, `Pallor : Negative`, `Jaundice : Negative`, `Cyanosis : Negative`, `Clubbing : Negative`, `Edema : Negative`, `JVP : Normal`
|
||||
- In Screenshot 2 (PHR App `abdm_etria`), only **Chief complaints** and **DocumentReference** were visible.
|
||||
- Examination was missing because `DischargeFhirGenerator.php` lacked the code to transform `$source['ui_physical_exam']` / `$source['observations']` into FHIR `Observation` resources and `Composition.section` entries.
|
||||
|
||||
4. **Missing Comorbidities (`cerebral vascular accident (CVA)`)**:
|
||||
- Comorbidities entered in the UI were saved in `opd_prescription.Prescriber_Remarks` via NABH history, but `enqueueIpdDischargeFhirSync` and `AbdmGateway` only checked `ipd_discharge_instructions.comp_report`, failing to load CVA as a FHIR `Condition`.
|
||||
|
||||
---
|
||||
|
||||
## 2. Technical Implementation Details
|
||||
|
||||
### A. Physical Examination & Vital Signs FHIR Observation Generation
|
||||
- **File**: `app/Libraries/Abdm/Fhir/Generators/DischargeFhirGenerator.php`
|
||||
- Iterates over `$source['ui_physical_exam']` and `$source['observations']`.
|
||||
- Maps parameters (Pulse, Respiration, Pallor, Jaundice, Cyanosis, Clubbing, Edema, JVP, BP, Temperature, $\text{SpO}_2$) to SNOMED CT and LOINC concept codes.
|
||||
- Generates FHIR `Observation` resources with profile `https://nrces.in/ndhm/fhir/r4/StructureDefinition/Observation`.
|
||||
- Assigns categories (`vital-signs` or `exam`) and stores numeric values (`valueQuantity`) or clinical descriptions (`valueString`).
|
||||
- Added **Physical Examination Section** (SNOMED `425044008`, `Physical examination section`) to `Composition.section`, referencing all examination observations.
|
||||
- Updated narrative generator to render examination observations in the human-readable summary.
|
||||
|
||||
### B. Comorbidities (`CVA`) Extraction & Mapping
|
||||
- **Files**:
|
||||
- `app/Controllers/Ipd_discharge.php` (`enqueueIpdDischargeFhirSync`)
|
||||
- `app/Controllers/AbdmGateway.php` (`buildIpdDischargeGatewayPayload`)
|
||||
- Added fallback lookup to `opd_prescription` / NABH history (`Prescriber_Remarks` using `hydrateNabhFieldsFromOpdRow`) when `ipd_discharge_instructions` does not contain comorbidities.
|
||||
- Splits comma/newline delimited comorbidities and maps each into a FHIR `Condition` resource under the **Medical History / Problems** section.
|
||||
|
||||
### C. Gated Discharge Lifecycle & Billing Trigger
|
||||
- **File**: `app/Controllers/Ipd_discharge.php` (`enqueueIpdDischargeSync`)
|
||||
- Gated ABDM sync: verifies that `discarge_patient_status > 0` and `discharge_date` is non-empty before enqueuing or updating ABDM FHIR bundles.
|
||||
- Draft section saves while patient is admitted save locally to HMS MySQL tables only.
|
||||
- **File**: `app/Controllers/Billing/Ipd.php` (`updateDischargeStatus`)
|
||||
- Hooked official patient discharge event: triggers `$dischargeCtrl->enqueueIpdDischargeSync($ipdId, $patientId, 'final_discharge')`.
|
||||
- Compiles the final, complete FHIR DocumentBundle with discharge date, disposition, complaints, comorbidities, examinations, medications, advice, and attached PDF.
|
||||
|
||||
### D. Test Coverage
|
||||
- **File**: `tests/unit/Abdm/FhirGeneratorsTest.php`
|
||||
- Updated `testDischargeSummaryGeneratorCreatesFullSectionsAndComponents` to assert `Observation` resource inclusion and `Physical Examination` composition section.
|
||||
- All discharge unit tests passing (4/4 tests, 187 assertions).
|
||||
|
||||
---
|
||||
|
||||
## 3. Deployment & Live Verification
|
||||
|
||||
1. **Git Commit & Push**:
|
||||
- Branch: `origin/main`
|
||||
- Commits: `fdd188d` & `ab4b68b`
|
||||
2. **Live Server Deployment (`hms-live`)**:
|
||||
- Directory: `/var/www/html/hms_etria`
|
||||
- Pulled `origin/main` and cleared cache via `php spark cache:clear`.
|
||||
3. **Live Server Record Verification (Janvi Bisht - IPD 3224)**:
|
||||
- Command: `php spark abdm:resync-discharge 3224`
|
||||
- Output Verified in Gateway DB (`abdm_health_records` ID 616, Ref: `DISCHARGE-3224-20261017`):
|
||||
- **Composition**: 1
|
||||
- **Patient**: 1, **Practitioner**: 1, **Organization**: 1, **Encounter**: 1
|
||||
- **Conditions (3)**: `Abdominal Pain`, `Headache`, `cerebral vascular accident (CVA)`
|
||||
- **Observations (17)**: 16 Admission & Discharge Vitals/Exam + 1 Lab
|
||||
- **MedicationRequest (1)**: `DOZPANTA DSR`
|
||||
- **CarePlan (2)**: `Dietary Advice`, `Follow Up Review after 5 days`
|
||||
- **DocumentReference (1)**: Full Discharge Summary PDF (185 KB)
|
||||
- **AllergyIntolerance (1)**
|
||||
Loading…
Reference in New Issue
Block a user