Side-by-side CPT code pricing comparison for healthcare payer data — load, compare, export.
CPT Studio is a Flask web application for comparing CPT (Current Procedural Terminology) code pricing across healthcare insurance payers. It ingests payer "Transparency in Coverage" Machine-Readable Files (MRFs), Excel fee schedules, and CSV price lists, normalizes the negotiated rates, and produces a clean side-by-side comparison that highlights price deltas, savings, and outliers.
The tool is built to handle the realities of payer data: deeply nested JSON, gzipped in-network rate files, and exports large enough (300 MB+) that they have to be streamed or processed in split parts rather than loaded into memory all at once.
- Multiple ingestion paths — upload JSON / Excel (
.xlsx/.xls) / CSV files, paste a direct payer URL, or load bundled demo data. - Index-file parsing — extracts the list of in-network rate files from a payer Transparency-in-Coverage index, then fetches and decompresses the selected gzipped JSON on demand.
- Smart column detection — auto-detects CPT code, price, and description columns when loading Excel/CSV fee schedules.
- Large-file handling — streams files over 300 MB, supports paginated loading, and accepts multi-part (split) uploads stitched together as a single stream.
- Configurable comparison rules — compare by
max,min,median, average, by billing class, or per-occurrence, with optional filtering by negotiated type and exclusion of expired rates (as-of a given date). - Incremental comparison sessions — compare a streamed/multi-part source against a baseline part-by-part, with live status reporting.
- Local caching — downloaded MRF files are cached so repeated fetches of the same URL load almost instantly.
- CSV export — one-click export of a single source, a full comparison, or an incremental comparison result.
- Resilient error handling — detects and clearly reports expired signed payer URLs instead of failing silently.
- Backend: Python 3.12, Flask
- Data: pandas, openpyxl (Excel), ijson (streaming JSON parsing), gzip
- HTTP: requests
- Frontend: Server-rendered Jinja template (single-page UI, vanilla JS, custom CSS)
- Serving / Deploy: gunicorn; deployable to Render (
render.yaml) or Vercel (vercel.json+api/index.py)
# 1. Clone
git clone https://github.com/ube09/PayerPrice-Compare.git
cd PayerPrice-Compare
# 2. (Optional) create a virtual environment
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
# 3. Install dependencies
pip install -r requirements.txt
# 4. Run
python app.pyThen open http://localhost:5000.
- Load Source 1 — upload a payer index JSON (or paste its URL), then click an in-network file to fetch its CPT pricing. For very large exports, use the split-parts uploader.
- Load Source 2 — upload an Excel or CSV fee schedule (columns like
CPT Code/Code,Price/Rate/Amount, optionalDescription). - Compare — choose a comparison rule and view deltas, savings, and outliers side by side.
- Export — download the comparison (or a single source) as CSV.
No live payer file? Click Load Test Insurance Data to load the bundled sample (
test_pricing_data.json) and try the comparison flow immediately. A sample Excel/CSV fee schedule is included (sample_cpt_pricing.xlsx/sample_cpt_pricing.csv).
| Method | Endpoint | Purpose |
|---|---|---|
GET |
/ |
Main interface |
POST |
/upload |
Upload a JSON/Excel/CSV file or a URL |
POST |
/fetch_pricing |
Fetch & parse a gzipped in-network rate file |
POST |
/load_test_data |
Load bundled demo data |
POST |
/compare |
Compare two loaded sources |
POST |
/stream_compare_upload |
Stream-compare a large file vs a baseline |
POST |
/upload_multipart_part / /finalize_multipart |
Split-part upload handling |
POST |
/load_paginated / /compare_paginated |
Page-by-page loading & comparison |
GET |
/export_source_csv / /export_comparison_csv / /export_incremental_comparison_csv |
CSV exports |
GET |
/sources |
List loaded sources |
- Payer signed URLs include
Expires/Signatureparameters and stop working once expired — download a fresh index file from the payer site if a link fails. - CPT® is a registered trademark of the American Medical Association; this project is an independent analysis tool.
Usama Bin Ejaz — AI/ML Engineer · Data Scientist · Founder, UBE Labs ("AI that ships.") GitHub: github.com/ube09 · Website: usamabinejaz.com
MIT