Technical details

Workflow architecture, validation, runtime and governance.

A technical view for developers, academics, researchers and practitioners assessing implementation, temporal correctness and operating reliability.

Progressive path

From visible output to implementation.

Each level adds detail without forcing the reader to restart: enter at the most useful point and continue progressively.

Methods added to the laboratory

World Economy Engine and Etna Sentinel: two different calculation families.

WF-10 · Simplified physical model

Hourly kinematic advection at 700/500 hPa, Haversine distance to transport assets and alignment bands. It is not an ash or concentration model.

WF-10 · ML, RPA and gates

Isolation Forest only characterises wind-context anomaly; GitHub Actions, the VONA source gate, deduplication and AT Protocol/XRPC implement fail-closed orchestration.

WF-11/12 · Chemical balances + economics

HHV/LHV balances, SMR/CCS/electrolysis routes, the NH₃→urea chain, break-even and sensitivities; Ridge/Gradient Boosting adds the M+1 forecast while keeping it separate from the physical calculation.

WF-13 · Point-in-time renewables forecast

Capacity factor, ECMWF weather, 1/24/168h lags, clear-sky and Gradient Boosting with empirical intervals. The zero-secret proxy remains separate from observed actuals.

WF-14/15 · Controlled process AI

PCA T²/Q, process residuals, CUSUM and voting for anomaly detection; PLS/Ridge/Random Forest/Gradient Boosting, split-conformal and Isolation Forest OOD for the soft sensor.

WF-16 · Operations research

HP/MP/LP balances, HiGHS LP/MILP, min-load, startup cost and perturb/re-opt marginal values without mislabelling MILP values as duals.

Packages: WF-9 uses NumPy, pandas, scikit-learn, NetworkX, SciPy, Matplotlib, SQLite, PyYAML, requests, ReportLab/openpyxl. WF-10 uses pandas, NumPy, scikit-learn, Matplotlib, Pillow, BeautifulSoup, pypdf, pydantic, requests and Bluesky integration. WF-11–16 add SciPy HiGHS, scikit-learn Gradient Boosting/PLS/Isolation Forest, SQLite and PyYAML.

Before the technical matrix

Five questions for evaluating a workflow rigorously.

  1. Was the data actually available when the result was produced?
  2. Is the system compared with a simpler method?
  3. Are error and uncertainty measured?
  4. Does behaviour change over time?
  5. Can the result be reconstructed?

Point-in-time

A forecast made on Monday cannot use data published on Tuesday.

Baseline

A complex model should be compared with a simple rule, such as “tomorrow will be similar to today”.

Calibration

If many events receive 70% probability, about seven in ten should occur over time.

Data drift

A model may lose reliability when data, context or relationships change.

Ablation

A source or variable is removed to test whether it genuinely contributes.

Failure mode

Describe in advance how the system may fail, stop or become misleading.

Architecture map

Ten layers separate sources, inference and publication.

01Source adaptersAPI, feed, file, HTML/PDF
02Data contractschema, units, timezone, licence
03Quality layerfreshness, ranges, missing, duplicates
08Decision gatepublish, skip, block, degraded
09Renderingcards, alt text, watermark, metadata
10DeliveryActions, artifacts, Bluesky, website

Data engineering

Data correctness before model complexity.

Time and point-in-time

  • separate source, acquisition, run and publication timestamps;
  • normalise to UTC and use local time only for presentation;
  • features use only information available at prediction time;
  • explicit as-of joins and lags reduce leakage.

Contract and lineage

  • expected schema and units for each adapter;
  • source identifier and provenance URL;
  • parser version and numeric fingerprint;
  • cache state and fallback rationale.

Missing data

  • distinguish observed zero from missing information;
  • missing masks when coverage matters to the model;
  • graceful degradation only when semantically safe;
  • fail closed for official gates or critical sources.

Persistence

  • CSV/JSON/Parquet selected for audit, volume and compatibility;
  • atomic writes and deterministic names;
  • ex-ante history separated from matured outcomes;
  • anti-duplicate state separated from temporary artifacts.

Software ecosystem

Frameworks, libraries and protocols by architectural layer.

Data layer

pandas, NumPy, SciPy, PyArrow, Pydantic, SQLite, JSON, CSV and Parquet support normalisation, typing, timestamps, snapshots and audit.

Source layer

requests, httpx, pandas-datareader, Beautiful Soup, lxml, pypdf, yfinance and optional ObsPy integrate APIs, pages, PDFs and public series with retries and timeouts.

Presentation layer

Matplotlib, Pillow, Chart.js, Jinja2, ReportLab, openpyxl, HTML5, CSS and JavaScript generate accessible cards, dashboards and responsive galleries.

Automation layer

GitHub Actions, cron, workflow_dispatch, pytest, Ruff, uv and Hatch orchestrate runs, tests, packaging and artifacts.

Publishing layer

AT Protocol/XRPC, TID, Bluesky, Cloudflare Pages and Workers handle standalone posts, static delivery and language routing.

Implementation patterns

Four contracts reduce runtime ambiguity.

Adapter contract

fetch(source_date) -> RawPayload
parse(payload) -> TypedRecord
validate(record) -> QualityReport

Acquisition, parsing and validation remain separate and testable.

Outcome state

PUBLISHED | DRY_RUN
SKIPPED | BLOCKED
DEGRADED | FAILED

A green run is not confused with an actual publication.

Point-in-time

feature_time <= prediction_time
source_time <= run_cutoff
outcome_time > prediction_time

Explicit timestamps and lags reduce leakage and look-ahead.

Idempotency key

key = hash(event_id,
           source_time,
           language,
           content_version)

Fingerprints and deterministic record keys make retries safe.

MLOps and observability

The lifecycle includes data, model, execution and publication.

Versioning

  • Git for code, configuration and documentation;
  • package version and release contract;
  • data and card hashes;
  • ex-ante records separated from matured outcomes.

Reproducibility

  • pyproject.toml and lockfiles;
  • offline fixtures and seeds where applicable;
  • input and configuration snapshots;
  • downloadable run artifacts.

Observability

  • run_summary.json and provenance;
  • source, run and publication timestamps;
  • record URIs and persistent state;
  • explicit messages for skip, block and degraded states.

Outside the current scope

  • OCI/Docker containers and registries;
  • DVC or MLflow for experimental lineage;
  • OpenTelemetry and Prometheus/Grafana;
  • FastAPI for controlled services.

NOT PRESENTED AS IMPLEMENTED

Model risk and validation

A complex model must beat a relevant baseline out of sample.

Evaluation protocol
AreaExpected implementationError avoidedEvidence
Temporal splitordered train/validation/test with gap or purge where neededlook-ahead and contaminationdates and fold counts
Baselinenaïve, climatology, persistence or simple modelapparent skill without incremental valuemodel-minus-baseline metric
CalibrationBrier, reliability curve, coverage or error bandsoverconfident probabilitiesmatured sample and period
Ablationremove feature groups or modalitiesunjustified complexitymetric delta and stability
Robustnessbootstrap, period analysis, sensitivityresult driven by few episodesintervals and worst period
Driftmonitor distributions, errors and coverageobsolete model left undetectedhistory and thresholds

Software and runtime

Operating reliability is part of the result.

Modularity

Adapters, processing, modelling, rendering and publishing remain separate and testable. Configuration is not scattered through code.

Idempotency

Event IDs, source dates, fingerprints and visual hashes prevent duplicate posts and accidental reuse of old cards.

State machine

Outcomes distinguish published, dry run, skipped, blocked and failed; a green run does not necessarily mean a post.

CI/CD

Lint, unit tests, offline integration tests, structural contracts and artifacts precede scheduled execution.

Secrets and security

Credentials live in protected environments with least privilege, log redaction and staging/production separation.

Observability

run_summary.json, provenance, versions, timestamps and publication URIs support diagnosis and audit.

Workflow matrix

Implemented methods and project-specific criteria.

Architecture and methods by workflow
WFData and featuresInferenceValidationCharacteristic stackFailure mode
WF-1multi-city forecasts; range, wind, humidity, rain and pressurerule-based index with capped contributionsconsistency checks and sensitivity analysis; no clinical validationPython, pandas, Open-Meteo, Pillow/Matplotlibtreating an educational index as individual prediction
WF-2energy futures, FX, lags and rolling features; 3-2-1 crack KPItree models and multi-horizon forecasttemporal splits, baselines, MAE/bias, error bootstrappandas, scikit-learn/XGBoost, Parquet, HTML reportsincomplete margin proxy and unstable relationships
WF-3cross-asset series, returns, volatility, breadth and spreadsregime, directional classifier, Isolation Forest, composite indexwalk-forward, baseline comparison, period stabilityyfinance, pandas, scikit-learn, Chart.jsoversimplifying shocks and non-stationary dependencies
WF-4AI-chain baskets, z-scores, networks and simulation parameterscomposite index, 30-day outlook, bootstrap, network analyticsmodel-vs-naïve, matured errors and basket stabilityNumPy/pandas, scikit-learn, NetworkX, Matplotlibfinancial proxies do not equal real industrial capacity
WF-5GVP event, INGV gate, earthquakes, FIRMS, 700/500 hPa windsLagrangian advection, regime MLP, DBSCAN and optional anomaly scoresynthetic tests, freshness gate, duplicate guards, official fail-closedrequests/httpx, BeautifulSoup, pypdf, Pydantic, scikit-learn, optional PyTorchmistaking wind trajectories for concentration or hazard
WF-6Brent, TTF, volatility, spreads, rates, fertilisers and shipping/proxies; z-scores and confidenceweighted 0–100 index, EWM, ridge forecast and state machinewalk-forward OOS, Dynamic versus Static, subperiods, stress windows and risk analyticspandas, SciPy, scikit-learn, statsmodels, SQLite, Jinja2/ReportLabmistaking market proxies for physical availability or an operating signal
WF-7INGV events, FDSN seismicity, FIRMS, tremor and clouds; point-in-time and censoring featuresLightGBM by modality, climatology/persistence/Hawkes baselines, blend and modality gatepurged walk-forward, embargo, holdout, Brier, calibration and matured scorecardpandas, PyArrow, SciPy, scikit-learn, LightGBM, pypdf, optional ObsPymistaking educational probabilities for alerts; hiding incomplete modalities
WF-8RSS/API feeds, source registry, independence groups, text and provenance metadatasentiment and topic/entity/event classification, lexical similarity, event cluster or theme bundle, facts-only templatingsource gates, 5-gram overlap threshold, communicability, idempotency, PDS/AppView verification and audit receiptsrequests, transformers, PyTorch, pandas/NumPy, Pillow, regex, AT Protocol/XRPC, GitHub Actionsnon-independent or non-admitted sources, generic content, excessive reuse, or one language not being published
WF-9World Bank WDI, FRED and OECD; release lags, lags/differences/rolling features, robust z-scores, Global Pulse components and graph-propagated featuresRidge, Elastic Net, Huber, PCA+Ridge, HistGradientBoosting, Random Forest; robust ensemble; 3-state GMM; damped graph-propagation scenariosexpanding backtest with purge gap, prequential selection, naive benchmark, bootstrap skill, 90% conformal intervals, graph ablation and anti-leakage/vintage auditPython, NumPy, pandas, scikit-learn, NetworkX, SciPy, Matplotlib, SQLite, PyYAML, requests, ReportLab/openpyxlmistaking an expert-hypothesis graph for proven causality; macro revisions, small OOS, structural breaks or experimental forecasts treated as advice
WF-10INGV VONA, Open-Meteo 700/500 hPa winds, FIRMS and GIBS VIIRS; airport/road/rail/port geometries and provenancehourly 12h kinematic advection, Haversine distance and alignment bands; Isolation Forest on wind context; rule-based VONA relayunit/end-to-end tests, data-quality and disclosure gates, deduplication/idempotency, fail-closed on uncertain/positive official status and immutable historyPython, pandas, NumPy, scikit-learn, Matplotlib, Pillow, BeautifulSoup, pypdf, pydantic, requests, GitHub Actions, AT Protocol/XRPCinterpreting direction/proximity as plume, concentration, impact or disruption probability; source latency or unavailability
WF-11EEX→BFE TTF with quality/provenance gate, Italian bidding-zone day-ahead power via Energy-Charts→euenergy/ENTSO-E, EUA and grid-carbon-intensity scenario; typed HHV/LHV SMR/CCS/electrolysis parametersdeterministic calculation; Current Variable Cost and LCOH; state-aware break-evenphysical/dimensional invariants, sourcing coherence, lineage, snapshot replayPython, NumPy, pandas, SciPy, Matplotlib, SQLite, PyYAMLmistaking PPA scenarios or mismatched emissions boundaries for observed facts
WF-12TTF, World Bank Pink Sheet, ECB FX, lags/seasonality; explicit HHV/LHVdeterministic NH₃/urea chain + Ridge/Gradient Boosting M+1 forecastwalk-forward, persistence, seasonality, gas-only and physical baselines; MAE/RMSE/bias/coverage/skillPython, pandas, scikit-learn, SQLite, Matplotlibmistaking a global benchmark for European cost or mixing nowcast and forecast
WF-13Terna Public API primary and ENTSO-E fallback for observed generation/capacity; without credentials, a non-publishable Open-Meteo proxy using declared 100 m wind nodes, local power curves before weighted aggregation, ECMWF D+1; 1/24/168h lags, seasonality and clear-skyGradient Boosting on capacity factor; empirical intervalstime split and persistence; proxy separated from actuals and never matured as a real forecast; prospective ENTSO-E A69 baseline when available; nMAE/RMSE/bias/coverage/skillPython, pandas, scikit-learn, requests, SQLite, Matplotlibmistaking the weather/capacity proxy for observed generation, missing forecast vintages or installed-capacity growth mistaken for skill
WF-14generic CSTR multivariate sensors, noise, missing data, step/drift/intermittent faultsdrift-aware ensemble: high-specificity PCA T²/Q + steam, cooling and reaction residuals + slow steam-residual CUSUM; Isolation Forest/autoencoder as comparators; fault classifierparameters frozen on a separate development simulation; same frozen 28-day synthetic benchmark; event recall, missed rate, false-alarm episodes/24h, P50/P90 delay, v1.4.16 ensemble comparison and anti-leakagePython, NumPy, pandas, scikit-learn, SQLite, Matplotlibperformance applies only to the simulator; test-bed-specific process residuals and an uncalibrated classifier require validation before real-plant transfer
WF-15process sensors + delayed laboratory with noise/QCLinear, PLS, Ridge, Random Forest, Gradient Boosting; Isolation Forest OODRMSE/MAE/bias/coverage, skill versus last lab, split-conformal and truth-vs-lab; risk-coverage diagnostic onlyPython, pandas, scikit-learn, SQLite, Matplotlibleakage from true values or a soft sensor answering outside its domain
WF-16synthetic steam demand, capacities/efficiencies, EEX TTF, licence-checked Energy-Charts Italian bidding-zone day-ahead power, EUAHiGHS LP and MILP; dispatch and perturb/re-optfeasibility, balances, optimality, solve time, stability and reference policyPython, SciPy HiGHS, NumPy, pandas, SQLite, Matplotlibcalling MILP marginal values duals or presenting simulated savings as measured savings

Academic and technical assessment

Useful questions for independent review.

  • Can every source timestamp be reconstructed?
  • Do features respect point-in-time availability?
  • Is the baseline appropriate?
  • Are hyperparameters selected without contaminating test data?
  • Is the matured-outcome sample sufficient?
  • Do metrics include denominator and period?
  • Do missing data cause an explicit block or degradation?
  • Are results reproducible from configuration and version?
  • Are failure modes tested or only described?
  • Is publication idempotent and auditable?
  • Do source licences allow the intended reuse?
  • Is implemented functionality separated from research extensions?

Multi-source method for Bluesky

Technical components of workflow WF-8.

Source policy and copyright

  • domain registry with source_class, risk_tier and reuse_mode;
  • communicable facts only and locally rendered images;
  • anti-reuse gate with 5-gram overlap checks.

NLP and comparison

Templating and publication

  • facts-only templates for title, takeaway, why-it-matters and technical lens;
  • separate Italian and English root posts;
  • facets to sources, no reply_to, multiple images per post.

Packages used

  • requests for feed and API collection;
  • transformers and torch for NLP enrichment;
  • Pillow, matplotlib, pandas, numpy, regex for rendering, data and Bluesky limits.