Care Plan Service — Migration Plan
Status: populated Owner: TBD Last updated: 2026-04-18 Companion: Service Template · 03 platform-services · 02 DDD
Context
The care-plan-service is a new service — there is no prior separate microservice to migrate from. However, some tenants may have clinical workflow data stored in external EHR or case management systems, or in legacy flat-file formats, that needs to be ingested.
Migration Scenarios
Scenario 1: Greenfield deployment (most common)
No migration needed. Tenants start creating care plans natively in the platform after the module is licensed and activated.
Steps:
- Enable
ehr.care_plansentitlement for tenant in identity-service. - Provision NATS stream
CARE_PLAN_EVENTSfor tenant. - Notify clinical teams; provide training materials.
Scenario 2: Migration from external EHR care plan export (CSV/HL7 CDA)
For tenants with existing care plans in external systems:
| Phase | Action |
|---|---|
| Extract | Export care plans from source system as CSV, FHIR Bundle, or HL7 CDA |
| Transform | Map to care-plan-service domain model (care plan + goals + activities + team) |
| Load | Use migration batch API (POST /api/v1/admin/care-plans/import) with migrationSource metadata |
| Validate | Compare record counts; verify FHIR read surface returns migrated data |
| Cutover | Disable source system write access; redirect clinical workflow to platform |
Scenario 3: Migration from monolithic EHR module within Ghasi platform
If a previous monolithic EHR module stored care plan data in a shared Postgres schema:
- Run a one-time migration script that reads from the legacy schema and inserts into
care_plans,care_plan_goals,care_plan_activitieswith correcttenant_idand new ULID IDs. - Backfill
version = 1for all migrated records. - Emit
care_plan.care_plan.created.v1events via outbox for each migrated plan so downstream services (chart, portal) are notified. - Verify via integration test that all migrated plans are accessible via FHIR surface.
Rollback Plan
- Migration is additive; original data is not deleted until sign-off.
- If migration fails, disable
ehr.care_plansentitlement to hide the service from clinical UI. - Re-enable source system write access as fallback.
Data Retention Post-Migration
- Legacy source system data retained per tenant policy (typically 12 months post-migration).
- Migration metadata (
migrationSource,migrationDate) stored incare_plans.categoryas a custom extension coding.