Polar Flow
Replaced a 130,000-formula Excel workbook with a verified Python pricing engine for casino comp cruise fares.
The problem
The casino team at Holland America Line prices complimentary cruise fares for VIP guests out of a spreadsheet. The workbook has around 130,000 formulas, 20 sheets, and 7 database connections. To run a single pricing cycle, an analyst opens the file, waits for every query to refresh, walks through the workflow by hand, and hopes nothing changed in the inputs since last time. It is the kind of system that works because one person understands it, and breaks when that person is in a meeting.
What I built
Polar Flow is a Django web application that replicates the full 16-step pricing pipeline the Excel file performs. It pulls reference data from Snowflake or Oracle, runs the same calculations that the spreadsheet formulas produce, and writes results back in three export formats: Excel ship tabs, XML for the Polar Reservation System, and a staircase output format.
The engine itself is pure Python and has no Django or Streamlit dependencies. Anything specific to a UI lives at the edges. That made it easy to migrate the project from Streamlit to Django when we needed multi-user auth and a shared deployment, without touching the math.
A few design decisions I care about:
- The engine is a function of its inputs. Every pricing calculation takes a voyage plus configuration and returns a fare. No global state, no hidden caches.
- Reference data (rate grids, offer types, promo presets, refund rates) lives in seven Snowflake tables with a small CRUD UI on top. Analysts can change pricing assumptions without a deploy.
- Results are serialized into the Django session as plain dicts, not dataclasses. This keeps the session layer boring and avoids a family of subtle bugs with pickled instances.
Outcome
Verified against the original workbook across 145 voyages and 8 workbook variants. Zero mismatches. The team runs pricing out of Polar Flow now instead of the spreadsheet.
What’s next
Two directions worth picking up:
- Let analysts compare “what-if” pricing scenarios side by side without editing the main config tables.
- Add a small approvals step before an export leaves the app, so the engine-verified price is what the Polar system actually ingests.