Builds · X-Ray Mobile Texas · 2026
Invoicing engine closes itself.
Direct billing closes itself: about $40K a month at $0 variance. Its test suite caught a defect that would have silently dropped 91 billable visits in a single month.
The problem
Every month the billing team exported completed visits and built facility invoices in Square by hand. It took about four hours, and nothing checked the result against the work the team had actually done in the field.
An audit of February found 58 completed exams tagged "Do Not Send" that should have been billed.
What I built
An engine that pulls completed work, applies each facility's contract rates, drafts the invoices in Square, and reads every draft back from Square to verify it. A person still reviews and sends.
- Fee rules encoded from every signed facility contract
- Approvals bound to the exact plan the reviewer saw, and expiring within 24 hours
- A privacy guard that makes it impossible to put a patient's full name on invoices for a customer that requires initials
What it caught
- 91 hidden visits in one month. Staff had started tagging facility-billable exams "Do Not Send", and the old logic skipped them. A "clean" run looked like about 27% of a normal month.
- A dry run three days before close that reported zero errors while underbilling by about 85%
- Four systematic underbilling patterns, each now covered by a regression test: ultrasound billed at the X-ray rate, multi-exam flat rates charging only the first exam, a dropped per-patient fee, and bilateral exams collapsed into one
- Orders entered after the monthly run, recovered in about 45 minutes end to end
Results
The first fully automated month closed with Square matching the release log exactly. The biller's hand edits are treated as the spec: each one is traced, and the ones that reveal a missing rule become code.
How I built it
With my agentic team, tested against business outcomes rather than just working code: does every completed visit become an invoice line, and does the total match the work done in the field? HIPAA is part of the design: patient data minimized, access role-based at the API layer, and a person reviews before anything goes live.
One of six systems I built at X-Ray Mobile Texas, my family's mobile diagnostics company, during its turnaround. Shared with the owners' permission; patient, staff, client and vendor details are withheld. More operational case studies from my practice are at actional.us.