Scenarios
A renovation scenario within a project , representing one possible approach to renovating a building . Multiple scenarios can be compared before selecting one for execution.
Source Files
Layer Path Schema backend/src/db/schema.ts (line ~923)Routes backend/src/routes/scenarios.ts, backend/src/routes/scenario-measures.tsPages frontend/src/pages/ScenarioDetail.tsxQueries frontend/src/lib/queries/scenarioQueries.ts
Database Tables
Table Purpose scenariosMain entity — name, costs, savings, energy score, active/selected flags scenario_measuresRenovation measures linked to a scenario — see Measures
Key Fields
Field Type Notes projectIduuid FK Parent project (cascade delete) namevarchar(200) Scenario name scenarioNumberinteger Display order within project isActiveboolean Whether the scenario is still under consideration isSelectedboolean Chosen for execution planning totalEstimatedCostreal Sum of all measure costs totalEstimatedSavingsreal Projected annual savings energyImprovementScoreinteger 0-100 score for energy improvement assumptionsjsonb Underlying assumptions for calculations createdByuuid FK User who created the scenario
Relationships
Scenario *──1 Project
Scenario 1──* Scenario Measures (Measures)
Scenario 1──* Funding Applications
Scenario *──1 Users (creator)
A project’s selectedScenarioId points to the winning scenario.
Scenario Measures
Each measure in scenario_measures represents a specific renovation action:
Field Type Notes measureTypeenum roof, facade, windows, doors, heating, ventilation, solar_panels, insulation, electrical, plumbing, otherpriorityenum low, medium, high, criticalstatusenum draft → planned → approved → in_progress → completed / cancelledisLockedboolean Locked when moving to execution phase buildingComponentIduuid FK Links to Building Components currentStatejsonb Current parameters (costs, specs, etc.)
Frontend Components
Component Purpose ScenarioFormCreate/edit scenario details ScenarioComparisonSide-by-side comparison of scenarios ScenarioPlanningPlanning view for measure management ScenarioMeasuresList/manage Measures within a scenario
Features
Scenario comparison — side-by-side view of cost, savings, energy impact
Measure management with status lifecycle and locking for execution
Energy Calculations — energy improvement scoring per scenario
Scenario Planning — planning interface for renovation strategy
Selection flow — chosen scenario links to project’s selectedScenarioId
Access control via RBAC Authorization (verifyScenarioAccess())
Related Pages
Projects | Buildings | Measures | Building Components | Funding Applications | Energy Calculations | Scenario Planning | Financial Calculations | RBAC Authorization