How bentheexpert/voltrack-esz works
1. Repository shape
- This repo is a mix of a production Streamlit dashboard and a shared analysis library.
- app/ contains the user-facing app and persistence for interactive runs.
- src/ contains reusable computation, weather, scheduling, and export modules used by the app and by batch/automation paths.
- Portfolio/ holds static portfolio datasets and schema documentation; Implementation Plans/ is design/documentation only.
2. Primary user-facing system
- The main entrypoint is app/app.py, a Streamlit application that orchestrates the full flow: read configuration, fetch weather data, compute uncertainty scores, calculate risk, visualize results, and store the session.
- app/ui_config.py provides the sidebar controls that define the analysis scope, such as hubs, model weights, and forecast horizon.
- app/viz.py renders the main dashboard views, combining Matplotlib and Plotly.
3. Authentication and deployment boundary
- app/auth.py handles login via streamlit-authenticator.
- Credentials are read from local config for development and from Streamlit secrets in hosted deployment.
- The repo is designed for Streamlit Community Cloud as well as local/Docker-based execution, with .devcontainer/ and Dockerfile supporting reproducible development/runtime environments.
4. Core analytical engine
- app/nui_engine.py is the main ESZ/uncertainty engine.
- It computes forecast spread from multiple weather models and ensemble dispersion, then normalizes that into the 0–100 ESZ scale.
- app/misschedule.py converts ESZ plus production KPI context into FMV, the probability of mis-scheduling/imbalance.
- These two modules are the heart of the business logic and are the main boundary between raw weather data and operational risk output.
5. Weather ingestion subsystem
- src/weather/ is a dedicated weather integration package.
- src/weather/providers/ contains provider adapters for different forecast sources, including Open-Meteo, ECMWF/CDS, Tomorrow, and Visual Crossing.
- The repo’s main dashboard path emphasizes Open-Meteo’s deterministic models plus ensemble spread, but the provider abstraction makes the weather source interchangeable.
- src/weather/forecast_cache.py and src/weather/loader.py indicate caching/loading layers to avoid recomputing or refetching forecasts unnecessarily.
6. Data flow through a run
- User input from the sidebar selects portfolio/hub parameters and forecast settings.
- Weather data is fetched from the external provider API.
- The engine calculates inter-model variance and intra-ensemble variance.
- ESZ is derived from those variance components.
- FMV is calculated from ESZ and historical/statistical context.
- The visualization layer renders the result, and the persistence layer archives the run for later restoration.
7. Persistence and replay
- app/history.py stores per-run artifacts and restores prior sessions.
- The persistence model is two-tier: Parquet + metadata for run history, and pickle snapshots for full session restore.
- The dashboard can therefore reopen the last analysis state and support historical comparison without re-entering inputs.
- app/backfill.py supports re-running historical dates, which is important for calibration and retrospective analysis.
8. Batch/export and offline outputs
- app/excel_export.py and api_data_exporter/generate_nui_excel.py provide branded spreadsheet exports.
- app/output/ is the implied artifact boundary for generated reports/history.
- This makes the system not just interactive, but also able to produce operational outputs for offline review or sharing.
9. Related analytical subsystems in src/
- src/analysis_engine.py, src/pipeline.py, src/market_offers_pipeline.py, src/own_offers_loader.py, and src/own_activations_loader.py suggest a broader analytics pipeline around offers, activations, and market behavior.
- src/weather_price_analysis.py and src/weather_activation_analysis.py extend the weather/risk concept into market and activation analysis.
- src/scheduling/ contains strategy loading and a strategy engine, which indicates a separate scheduling-analysis boundary used by the overall domain model.
10. External integrations
- Weather forecasts come from external weather APIs, primarily Open-Meteo through openmeteo-requests / openmeteo-sdk.
- Market data integration is supported via ENTSO-E tooling (entsoe-py), which matters for price/activation-related analysis.
- The app uses Streamlit as the UI/runtime layer and streamlit-authenticator for access control.
11. Special integration surface
- src/nui_mcp/server.py exposes ESZ-related functionality through an MCP server, which is an integration boundary for AI/agent consumers.
- This means the analytics core is not only consumed by the Streamlit UI; it can also be queried programmatically by external agent tooling.
12. Domain data and documentation
- Portfolio/ contains the portfolio-specific device/unit profiles and schema docs that ground the calculations in real assets.
- app/docs/white_paper_fmv.tex documents the FMV methodology, signaling that the risk model is a formalized analytical process rather than an ad hoc formula.
- The many Implementation Plans/ files indicate an evolving architecture with planned extensions, but they are not runtime components.
13. Architectural takeaway
- The repo is centered on a data-to-risk pipeline: portfolio and weather inputs flow into uncertainty scoring, then into mis-scheduling probability, then into visual and exportable operational outputs.
- The main architectural boundary is between external data acquisition and internal scoring/decision logic, with Streamlit serving as the orchestration and presentation layer.
Main entry points: app.py App entry · weather Weather package · pipeline.py Pipeline · analysis_engine.py Analysis core
Components 22
Streamlit app
User-facing dashboard, orchestration, persistence, and exports.
- App entry · Main dashboard flow that orchestrates configuration, weather fetches, scoring, visualization, and storage.
app/app.py - Controls · Sidebar controls for hubs, weights, horizons, and analysis scope.
app/ui_config.py - Auth · Login boundary using streamlit-authenticator with local config or hosted secrets.
app/auth.py - Dashboard · Renders the main result views using plotting libraries.
app/viz.py - ESZ engine · Computes forecast spread and normalizes it into the ESZ uncertainty scale.
app/nui_engine.py - FMV model · Converts ESZ and production context into mis-scheduling probability.
app/misschedule.py - History store · Stores run artifacts and restores prior sessions for replay and comparison.
app/history.py - Backfill · Replays historical dates for calibration and retrospective analysis.
app/backfill.py - Excel export · Builds branded spreadsheet outputs for offline review and sharing.
app/excel_export.py
Shared analytics
Reusable computation, scheduling, weather, and integration modules.
- Analysis core · Broader analytics layer for portfolio, market, and weather-driven analysis.
src/analysis_engine.py - Pipeline · Coordinates the shared analytical workflow across loaders and downstream analysis.
src/pipeline.py - Scheduling · Loads and executes scheduling strategies used by the domain model.
src/scheduling/strategy_engine.py - Market offers · Processes market offers and related operational inputs.
src/market_offers_pipeline.py - MCP server · Exposes ESZ-related functionality for programmatic agent consumers.
src/nui_mcp/server.py
Weather stack
Forecast ingestion, caching, and provider adapters.
- Weather package · Shared weather integration package with loading, caching, and provider abstraction.
src/weather - Open-Meteo · Primary deterministic and ensemble weather source used by the dashboard path.
src/weather/providers/openmeteo.py - CDS/ECMWF · Forecast provider adapter for ECMWF/CDS-based data sources.
src/weather/providers/cds.py - Tomorrow · Forecast provider adapter for Tomorrow.io data.
src/weather/providers/tomorrow.py - Visual Crossing · Forecast provider adapter for Visual Crossing data.
src/weather/providers/visualcrossing.py - Forecast cache · Caches forecasts to avoid unnecessary refetches and recomputation.
src/weather/forecast_cache.py
Domain data
Portfolio datasets and methodology documentation.
- Portfolio data · Device, unit, and schema assets that ground calculations in real portfolios.
Portfolio - FMV docs · White paper and design docs describing the FMV methodology and system design.
app/docs/white_paper_fmv.tex
Connections 23
- Auth → App entry: protects · Authenticates access before the dashboard runs.
- Controls → App entry: configures · Defines the analysis scope and scenario inputs.
- App entry → Weather package: fetches · Pulls forecast data for the selected scope.
- Weather package → Open-Meteo: uses · Primary forecast source for the main dashboard path.
- Weather package → CDS/ECMWF: uses · Alternate weather source adapter.
- Weather package → Tomorrow: uses · Alternate weather source adapter.
- Weather package → Visual Crossing: uses · Alternate weather source adapter.
- Weather package → Forecast cache: caches · Stores and reuses forecast results.
- App entry → ESZ engine: scores · Computes ESZ from weather spread and ensemble dispersion.
- ESZ engine → FMV model: feeds · ESZ and context are converted into FMV risk.
- App entry → Dashboard: renders · Displays the dashboard outputs and charts.
- App entry → History store: stores · Persists run artifacts and session state.
- History store → Backfill: supports · Enables historical reruns and comparison workflows.
- App entry → Excel export: exports · Generates spreadsheet reports from the analysis run.
- Pipeline → Analysis core: orchestrates · Coordinates shared analytical execution.
- Pipeline → Market offers: loads · Processes market offer inputs in the broader workflow.
- Pipeline → Scheduling: applies · Uses scheduling strategies during analysis.
- Analysis core → Weather package: consumes · Weather-driven analysis reuses the shared forecast stack.
- Analysis core → Portfolio data: analyzes · Uses portfolio context and asset profiles.
- MCP server → ESZ engine: exposes · Makes ESZ functionality available to external agents.
- MCP server → FMV model: exposes · Makes FMV-related functionality available to external agents.
- FMV docs → FMV model: documents · Captures the formal FMV methodology.
- Portfolio data → App entry: grounds · Provides asset and unit context for the dashboard.