- Introduced multiple architecture documentation files covering building block view, runtime view, deployment view, concepts, architecture decisions, quality requirements, technical risks, glossary, UI and styling, testing, CI, and development setup. - Migrated existing content from `architecture_overview.md` and `implementation_plan.md` into structured documentation. - Created scripts for checking broken links in documentation and formatting Markdown files for consistency. - Updated quickstart guide to provide clearer setup instructions and usage overview. - Removed outdated MVP features and testing strategy documents to streamline documentation.
2.2 KiB
2.2 KiB
06 — Runtime View
Status: skeleton
Describe runtime aspects: request flows, lifecycle of key interactions, and runtime components.
Reporting Pipeline and UI Integration
-
Data Sources
- Scenario-linked calculations (costs, consumption, production) produce raw figures stored in dedicated tables (
capex,opex,consumption,production_output). - Monte Carlo simulations (currently transient) generate arrays of
{ "result": float }tuples that the dashboard or downstream tooling passes directly to reporting endpoints.
- Scenario-linked calculations (costs, consumption, production) produce raw figures stored in dedicated tables (
-
API Contract
POST /api/reporting/summaryaccepts a JSON array of result objects and validates shape through_validate_payloadinroutes/reporting.py.- On success it returns a structured payload (
ReportSummary) containing count, mean, median, min/max, standard deviation, and percentile values, all as floats.
-
Service Layer
services/reporting.generate_reportconverts the sanitized payload into descriptive statistics using Python’s standard library (statisticsmodule) to avoid external dependencies.- The service remains stateless; no database read/write occurs, which keeps summary calculations deterministic and idempotent.
- Extended KPIs (surfaced in the API and dashboard):
variance: population variance computed as the square of the population standard deviation.percentile_5andpercentile_95: lower and upper tail interpolated percentiles for sensitivity bounds.value_at_risk_95: 5th percentile threshold representing the minimum outcome within a 95% confidence band.expected_shortfall_95: mean of all outcomes at or below thevalue_at_risk_95, highlighting tail exposure.
-
UI Consumption
templates/Dashboard.htmlposts the user-provided dataset to the summary endpoint, renders metric cards for each field, and charts the distribution using Chart.js.SUMMARY_FIELDSnow includes variance, 5th/10th/90th/95th percentiles, and tail-risk metrics (VaR/Expected Shortfall at 95%); tooltip annotations surface the tail metrics alongside the percentile line chart.- Error handling surfaces HTTP failures inline so users can address malformed JSON or backend availability issues without leaving the page.