Room rental billing tool
Turns a 200-page clinic-list PDF into a charge-ready rent report, without leaving the browser
- Role
- Operations and revenue analysis
- When
- 2026
- Built with
- JavaScript, pdf.js, pdf-lib
- Format
- Live replica
A monthly job done by hand
Consultants pay for the consulting rooms by the quarter hour. Every month the billing team took the scheduling system’s clinic list, a PDF running to a couple of hundred pages, and worked out by hand who to charge, for how many minutes, and which sessions to leave out. It was slow, and the mistakes were easy to make and hard to spot.
Reading a PDF that only looks like a table
Underneath, the export is loose text placed at coordinates, so the tool collects every fragment on a page, groups the ones that share a line and rebuilds each row from left to right. The consultant’s name is the line under “CLINIC LIST”; the date comes from the session header.
A row only counts as an appointment if it carries a patient detail, meaning a phone number, a sex and date of birth, or a patient number. That one check keeps “Blocked” and “cons na” slots off the bill without anyone having to list every filler the system might print. Minor operations stay on the page but count as zero minutes.
Exclusions run in a fixed order. An “always keep” list overrides everything, and after it come names starting with “z” (radiology and the technicians), exact names, “name contains” and “first word is”, which between them drop diagnostics and anyone who doesn’t pay rent.
From minutes to a bill
Sessions are grouped by consultant and day, so one that spills over three pages is billed once, and empty ones disappear. Rent is worked out per page, per session and per day. When a session’s minutes divide into 15s, its page gets the charge code and how many times to apply it.
If every appointment a consultant had that day was a remote follow-up, they probably weren’t in a room, so the day is flagged in red for someone to confirm and left out of the totals.
What comes back is the original pages, sorted by consultant and then date, with the totals stamped at the bottom of each, plus a CSV to charge from. Nothing is uploaded anywhere.
Built to be handed over
The rate, the charge code and every exclusion list live in a Rules panel, and “Save rules” writes them into the HTML file itself; whoever opens the file next gets the same rules. There’s a changelog at the bottom of the page, and the instructions in the code tell anyone editing it, an AI assistant included, to log the change and check the totals against an earlier run.
Run it
Press Run the sample clinic list in the replica. On the invented week it keeps 22 of 31 pages, charges 2,920 minutes (£1,245.87) and flags one remote-only day. Downloads only work on the live site.
About the dataHospital X is fictional, and so is everything in the sample clinic list: consultants, patients, phone numbers, patient numbers, the rent rate and the charge code. The tool's code is the real one; I only replaced its saved rules and its branding.