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

LayerPath
Schemabackend/src/db/schema.ts (line ~923)
Routesbackend/src/routes/scenarios.ts, backend/src/routes/scenario-measures.ts
Pagesfrontend/src/pages/ScenarioDetail.tsx
Queriesfrontend/src/lib/queries/scenarioQueries.ts

Database Tables

TablePurpose
scenariosMain entity — name, costs, savings, energy score, active/selected flags
scenario_measuresRenovation measures linked to a scenario — see Measures

Key Fields

FieldTypeNotes
projectIduuid FKParent project (cascade delete)
namevarchar(200)Scenario name
scenarioNumberintegerDisplay order within project
isActivebooleanWhether the scenario is still under consideration
isSelectedbooleanChosen for execution planning
totalEstimatedCostrealSum of all measure costs
totalEstimatedSavingsrealProjected annual savings
energyImprovementScoreinteger0-100 score for energy improvement
assumptionsjsonbUnderlying assumptions for calculations
createdByuuid FKUser 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:

FieldTypeNotes
measureTypeenumroof, facade, windows, doors, heating, ventilation, solar_panels, insulation, electrical, plumbing, other
priorityenumlow, medium, high, critical
statusenumdraft planned approved in_progress completed / cancelled
isLockedbooleanLocked when moving to execution phase
buildingComponentIduuid FKLinks to Building Components
currentStatejsonbCurrent parameters (costs, specs, etc.)

Frontend Components

ComponentPurpose
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())

Projects | Buildings | Measures | Building Components | Funding Applications | Energy Calculations | Scenario Planning | Financial Calculations | RBAC Authorization