A modular Python framework for endβtoβend conflict forecasting: data ingestion, transformation, drift monitoring, model and ensemble management, evaluation, reconciliation, mapping, reporting, packaging, and artifact governance.
Caution
As of February 2026, the pipeline enforces Explicit Intent Declaration. Legacy keys (targets, metrics) are deprecated and will trigger large warning banners.
1. Targets are MANDATORY: You must declare at least one target or the pipeline will hard-stop.
2. Be Explicit: Use task-specific prefixes (regression_ or classification_).
3. Split Metrics: Clearly separate Point metrics from Sample-based (Uncertainty) metrics.
| Category | Tier 3: Best Practice (Explicit) | Legacy (Deprecated) |
|---|---|---|
| Targets | regression_targets, classification_targets |
targets |
| Metrics | regression_point_metricsregression_sample_metricsclassification_point_metricsclassification_sample_metrics |
regression_metricsclassification_metricsmetrics |
Misspelled or unrecognized keys (e.g., regression_target without the 's') will trigger a hard stop with helpful hints.
- Conceptual Overview
- HighβLevel Architecture
- Core Pipeline Stages
- Managers (Orchestration Layer)
- Modules (Functional Layer)
- Data Layer & Querysets
- Evaluation & Metrics
- Reconciliation (Hierarchical Consistency)
- Reporting & Mapping
- CLI & Argument System
- Configuration & Partitioning
- Package Management
- Logging & Monitoring
- Development Workflow
- Quick Start
- FAQ
The pipeline transforms raw geoβtemporal data into validated, reconciled, and documented forecasts. Key features include:
- Deterministic data preparation (queryset + transformation replay)
- Strict naming & artifact conventions
- Partition-aware evaluation (calibration/validation/forecasting)
- Multi-model ensembling & hierarchical reconciliation
- Automated HTML reporting and spatial visualization
- Reproducible configuration merging and logging
- Optional integration with Weights & Biases (WandB) and prediction store
ββββββββββββββββββββββββββββββββββββββββββ
β ConfigurationManager β
β (deployment + hyperparameters + meta) β
βββββββββββββββββ¬βββββββββββββββββββββββββ
β
ββββββββββββββββββββββββββΌββββββββββββββββββββββββββ
β ViewsDataLoader β
β Queryset β Raw Fetch β Drift Check β Update β
β β Transformation Replay β Partition Slice β
βββββββββββββββββ¬βββββββββββββββββββββββββββββββββββ
β DataFrame (month_id, entity_id)
βΌ
βββββββββββββββββββββββββββββββββββββββββββ
β ForecastingModelManager (thin faΓ§ade) β
β Routes to independently testable stagesβ
β β
β βββββββββββββββ ββββββββββββββββββββ β
β βTrainingStageβ β EvaluationStage β β
β βββββββββββββββ ββββββββββββββββββββ β
β βββββββββββββββββ ββββββββββββββββββ β
β βForecastingStageβ βReportingStage β β
β βββββββββββββββββ ββββββββββββββββββ β
β βββββββββββββββββββββββββ β
β β PredictionIOManager β β
β βββββββββββββββββββββββββ β
ββββββββββββββ¬βββββββββββββββββββββββββββββ
β Predictions
βΌ
ββββββββββββββββββββββββββ
β ReconciliationModule β
β (Country β Priogrid) β
ββββββββββββββ¬ββββββββββββ
β Reconciled Predictions
βΌ
βββββββββββββββββββββββββββββ
β Reporting & Mapping β
β HTML, Tables, Choropleths β
βββββββββββββββββββββββββββββ
Architecture note (April 2026):
ForecastingModelManagerhas been decomposed from a 3049-LOC monolith into a ~1960-LOC thin faΓ§ade that delegates to 5 independently testable stage classes. Each stage receives a frozen context object (immutable dataclass) rather than reaching into the manager's internals.ModelPathManagerhas been relocated frommanagers/todata/to fix dependency inversion. All existing import paths continue to work via re-export shims. See ADR-045 for the full design rationale.
| Stage | Output | Key Component |
|---|---|---|
| Data Fetch | Partitioned feature/target frame | ViewsDataLoader |
| Train | Artifact (model file) | TrainingStage (via ForecastingModelManager / EnsembleManager) |
| Evaluate | Metrics + eval predictions | EvaluationStage (via ForecastingModelManager) |
| Forecast | Future horizon predictions | ForecastingStage (via ForecastingModelManager) |
| Reconcile | Grid β country consistency | ReconciliationModule |
| Report | HTML summaries | ReportingStage (via ForecastingModelManager) |
| Package | Poetry-compliant project | PackageManager |
| Manager / Stage | Purpose |
|---|---|
| ModelPathManager | Path + artifact resolution for a model (canonical location: data/) |
| ModelManager | Abstract training/evaluation/forecast flow control |
| ForecastingModelManager | Thin faΓ§ade β routes to pipeline stages below |
| EvaluationStage | Metrics orchestration (DF + PF paths, step mappings, evaluator integration) |
| ReportingStage | Forecast + evaluation HTML report generation |
| ForecastingStage | Post-processing, validation, and persistence of forecast predictions |
| TrainingStage | Training log creation and WandB alerts |
| PredictionIOManager | Save/load predictions, evaluations, and evaluation tables |
| EnsemblePathManager | Paths for multi-model ensemble |
| EnsembleManager | Aggregation + optional reconciliation |
| ExtractorPathManager | External raw data ingestion paths |
| ExtractorManager | Download β preprocess β save for external datasets |
| PostprocessorPathManager | Downstream transformation stage paths |
| PostprocessorManager | Read β transform β validate β save |
| PackageManager | Create/validate Poetry packages |
| ConfigurationManager | Merge + validate layered configuration |
Each stage receives an immutable frozen context object and is independently unit-testable. See ADR-045 for architecture details.
| Module | Role |
|---|---|
| dataloaders | Partition-aware data retrieval + drift detection + incremental update |
| transformations | Dataset transformation undo/management (extracted to views-reporting, ADR-054) |
| reconciliation | Hierarchical grid β country alignment (extracted to views-reporting, ADR-054) |
| reports | Tailwind-styled HTML evaluation/forecast report generation (extracted to views-reporting, ADR-054) |
| mapping | Static + interactive choropleth maps (extracted to views-reporting, ADR-054) |
| visualizations | Historical line graphs & distribution plots (extracted to views-reporting, ADR-054) |
| logging | Central logging configuration injection |
| statistics | Posterior distribution analysis & forecast reconciliation (extracted to views-reporting, ADR-054) |
| wandb | Alerts, artifact logging, run lifecycle |
| model validation | Structural & logical integrity checks (sniffer pattern, ADR-041) |
| ensemble validation | Structural & logical integrity checks |
| Module | Role |
|---|---|
| cli | CLI parsing and validation |
| dataset | Spatio-temporal dataset handler with country and priogrid level support |
- Querysets define feature/target extraction logic + transformation chains.
- Incremental updates replace raw slices (GED / ACLED) and replay transformations (UpdateViewser).
- MultiIndex structure:
(month_id, entity_id)for time-spatial operations. - Data types normalized (
float64for numeric integrity). - Partitions defined via month ranges (train/test or forecast horizon).
Evaluation produces:
- Step-wise metrics (per forecast horizon)
- Month-wise metrics (temporal slices)
- Time-series metrics (sequence performance trajectory)
Conflict type auto-inferred from target tokens (sb / ns / os). Files named per ADR conventions (artifact/output naming).
Ensures priogrid sums align with authoritative country totals while preserving relative spatial pattern and zero inflation. Parallelizable across countries Γ time Γ targets. Integrated into ensembles or model forecast postprocessing.
| Component | Feature |
|---|---|
| ReportModule | Headings, paragraphs, Markdown, tables, images, grids |
| MappingModule | Country & priogrid choropleths (static + interactive animation) |
| Templates | Forecast + evaluation report skeletons |
| CSS | Tailwind subset embedded for portability |
Reports embed:
- Metrics tables
- Keyβvalue configuration summaries
- Spatial animations (Plotly)
- Artifact provenance (timestamps, versions)
Dataclass-driven (ForecastingModelArgs):
- Flags:
--train,--evaluate,--forecast,--report,--sweep,--prediction_store,--monthly - Validation prevents illegal combinations (e.g., evaluate with forecasting run type).
- Monthly shortcut auto-configures production cycle.
ConfigurationManager merges:
- Deployment
- Hyperparameters
- Meta
- Partition dictionary
- Runtime overrides (highest priority)
Forecast partitions dynamically adjusted by override_timestep. Validation enforces structural integrity and target specification.
PackageManager:
- Validates naming (
organization-prefix-*) - Creates Poetry skeleton (Python version constraint)
- Adds dependencies (including views-pipeline-core)
- Fetches latest release (tags or GitHub API)
- Runs
poetry check
- YAML-driven configuration (handlers, levels, formatters).
- Dedicated model/ensemble logging directories.
- Standard separation: main log, error log.
- WandB alerts for stage transitions, failures, reconciliation completeness.
| Task | Command |
|---|---|
| Run model | ./run.sh --run_type calibration --train --evaluate --report --saved |
| Run ensemble | ./run.sh --ensemble hybrid_lynx --forecast --report |
| Update raw data | Use --update_viewser |
| Generate report only | Use --evaluate --report or --forecast --report |
Refer to documentation/development_guidelines.md for coding standards and docstring_guidelines.md for formatting.
-
Run
build_model_scaffold.pyorbuild_ensemble_scaffold.pyfound in theviews-modelsrepository. -
Update
config_deployment.py,config_hyperparameters.py,config_queryset.py,config_meta.py. -
Run calibration:
python main.py --run_type calibration --train --evaluate --report
-
Run forecasting:
python main.py --run_type forecasting --train --forecast --report
-
View artifacts:
models/<name>/artifacts/
| Question | Answer |
|---|---|
| Do I need WandB? | Optional; disable notifications to run offline. |
| Can I reconcile single-model forecasts? | Yesβapply ReconciliationModule manually after forecast stage. |
| How do I add a new transformation? | Register callable in transformation mapping and ensure replay compatibility. |
| Are forecasts stored transformed or raw? | Temporarily reversed to raw scale before saving (pending ADR finalization). |
| Can I aggregate probabilistic outputs? | Current ensemble aggregation expects scalar or single-element lists. |

