Registration Service — Migration Plan
Status: populated Owner: TBD Last updated: 2026-04-17 Companion: Service Template
1. Migration Scenarios
Scenario A: Greenfield deployment (no prior system)
- Run DB migrations (
drizzle-kit migrate) — creates all tables and indexes. - Seed kin relationship type catalog via admin API or seed script.
- Optionally load standard extension schemas (
employment,marital,appearance) viaPOST /v1/extension-schemas. - Configure tenant required-fields via
REGISTRATION_REQUIRED_FIELDS_JSONenv. - Begin patient registration via REST or FHIR API.
Scenario B: Migration from legacy "Ghasi EHR" flat patient tables
| Step | Action |
|---|---|
| 1 | Export legacy patients to CSV / JSON with all identifiers |
| 2 | Map legacy fields to PatientName, PatientIdentifier, PatientTelecom schema |
| 3 | Assign MRNs (if not already present) or carry forward existing MRNs as system: legacy-mrn identifiers |
| 4 | Run MPI pre-check on legacy dataset to identify existing duplicates before import |
| 5 | Import via bulk-insert migration script (not public API) with idempotency keys |
| 6 | Verify row counts, identifier uniqueness constraints |
| 7 | Run MPI calibration pass to flag candidate duplicates for review |
Scenario C: Interoperating with existing HMIS (HL7 ADT feed)
- Configure
interop-servicewith ADT feed endpoint and credential. - Deploy HL7 ADT adapter mapping (A01/A04/A08/A40/A03).
- Enable idempotency on ADT ingest (deduplication by message control ID).
- Run shadow mode for 1 week: compare ADT-imported patients vs existing patients.
- Flip live when reconciliation is satisfactory.
2. Rollback Plan
| Phase | Rollback action |
|---|---|
| Schema migration | Drizzle rollback script (down migrations for each step) |
| Data import | Truncate migrated rows (import uses separate import_batch_id column for tracking) |
| ADT feed | Disable adapter in interop-service; stop ADT ingest |
3. Phased Delivery Alignment
| Phase | Features |
|---|---|
| A | Core REST/FHIR Patient + Encounter; MPI; search; merge; events; licensing |
| B | Vital status/deceased; provisional patient; newborn linkage |
| C | Interop hardening (HL7 ADT, PIX/PDQ); FHIR conformance; offline-first alignment |
| D | Merge governance; extensions; analytics boundary with population-health-service |
| E | National enterprise identity: alternate IDs, unidentified intake, portrait, extensible metadata, family graph |