HERON (GEK TERNA Group)
Energy Tariff Recommendation Platform
Summary
The customer-facing tariff recommendation API, the authoring/publication API behind it, and the internal sales portal. A short questionnaire returns the best-matching tariff; pricing analysts publish the catalog through row-level validated Excel uploads.
Architecture
- Publication is a two phase dry run then commit through a single endpoint, driven by a query flag. The portal only reveals the submit action after validation passes, so an analyst can iterate on a broken spreadsheet without ever touching the live catalog.
- Errors are addressed to a specific spreadsheet cell, not a row number. A helper converts the column position to its letter and offsets the row for the header, producing references an analyst can act on directly. Errors accumulate across every row rather than failing on the first, which is the point of collecting them.
- Matching is a deterministic rules engine, not scoring or a model. A boolean filter narrows candidates on commodity, customer type, consumption band and several conditional constraints, then a lexicographic sort takes the first result, so the same answers always return the same tariff and the outcome is explainable to a customer.
- The two read endpoints treat freshness differently on purpose. The recommendation call reads the catalog on every request, while the questionnaire options are memoized once at application startup with a single entry cache, trading staleness for a guaranteed warm first response.
Highlights
- Commercial matching logic isolated as pure, I/O-free predicates, unit-testable and reviewable by non-engineers.
- Deterministic recommendations via two-level sort (computed annual cost, then tariff validity date).
- Validation errors reported against real spreadsheet cell references, accumulated per attempt, a tool business users can actually operate.
- The pricing formula lives in exactly one auditable function shared conceptually across both services.
- Serverless cold-start mitigation on the customer path: scheduled warm-up plus in-process async caching.
Technologies
- Python
- FastAPI
- Azure Functions
- Azure Blob Storage
- React 19
- TypeScript
- Microsoft Entra ID