Rhythm Healthcare, 2024
Billing data refactor
Billing moved from JSON objects to a normalized relational schema, with 2M+ legacy records migrated and zero downtime.
80%
fewer manual billing corrections
- JSON billing objects2M+ legacy records
- Migration scriptsvalidated per environment
- Normalized tablesPostgreSQL
- Database triggersdefault billing codes
- Reportsno backend round trip
The problem
Billing data lived in JSON objects, billing codes were filled in by hand on the frontend, and reports made a round trip to the backend just to work out what was billable.
Stack
PostgreSQL, TypeORM, NestJS, React
What I built
- 1Led the refactor from JSON objects to normalized tables, and migrated 2M+ legacy records with zero downtime.
- 2Wrote scripts that validated the migration in every environment.
- 3Updated the API for the new billing logic with stricter validation, and added database triggers that set default billing codes, so nobody enters them by hand.
- 4Retired the old billable logic on the frontend, so reports no longer go back to the backend and load faster.
- 5Documented every breaking change so the rest of the team could move onto the new model quickly.
Why I built it this way
Defaults live next to the data
A trigger sets the default billing code in the database, so every client and every path gets the same answer without frontend code.
Validate in every environment
The migration scripts checked the data in each environment before and after, instead of trusting a single run.
Write down what breaks
A schema change touches everyone. Documenting each breaking change up front kept the transition from stalling other work.