22
33Weatherman is an open-source forecasting project with ** two separate parts in one repo** :
44
5- - ` weatherman/ ` → Python forecasting library (Nixtla StatsForecast first)
6- - ` site/ ` → Astro website for landing page + per-run HTML reports
5+ - ` weatherman/ ` → Python forecasting engine (Nixtla StatsForecast first)
6+ - ` site/ ` → Astro + Tailwind web app (submit payloads, track jobs, view reports)
77
88## Architecture
99
1010### 1) Python forecasting package (` weatherman/ ` )
11- Input payload stays small :
12- - ` start_datetime ` (first point timestamp)
13- - ` granularity ` ( ` 15m ` , ` 1h ` , ` 1d ` , ...)
14- - ` series ` (numeric values only)
11+ Input payload is compact :
12+ - ` run_name_root `
13+ - ` start_datetime `
14+ - ` granularity `
1515- ` horizon `
16+ - ` series_names ` (list)
17+ - ` series ` (single list or list-of-lists)
18+ - ` n_series `
19+ - ` backtest_windows `
1620
17- The library builds a continuous datetime index (no gaps), maps values to generated dates, trains models, and forecasts future points .
21+ The engine builds continuous timestamps (no gaps), trains models, and forecasts after the last point .
1822
19- Initial backend: ** Nixtla StatsForecast** (AutoARIMA + ETS), including ** rolling backtests ** with SMAPE.
23+ Current backend: ** Nixtla StatsForecast** (AutoARIMA + AutoETS) with rolling backtesting + SMAPE.
2024
2125### 2) Astro website (` site/ ` )
22- - Landing page (` / ` ) lists all submitted forecast requests from ` site/src/data/forecast-index.json `
23- - Report page (` /forecasts/[slug] ` ) renders each run from ` site/src/data/forecasts/<slug>.json `
24- - Report shows actual vs forecast chart (Chart.js) + run metadata
25-
26- ## GitHub Actions submission flow
27-
28- Run workflow: ** Forecast Request** (` workflow_dispatch ` ) with:
29- - ` slug `
30- - ` payload ` (JSON)
31-
32- The action:
33- 1 . Runs Python forecast generation
34- 2 . Writes ` site/src/data/forecasts/<slug>.json `
35- 3 . Updates ` site/src/data/forecast-index.json `
36- 4 . Commits and pushes
37-
38- Astro then builds static pages from those artifacts.
39-
40- ## Example payload
41-
42- ``` json
43- {
44- "start_datetime" : " 2026-01-01T17:15:00" ,
45- "granularity" : " 1h" ,
46- "series_name" : " demo_hourly" ,
47- "horizon" : 24 ,
48- "model" : " nixtla" ,
49- "series" : [100 , 102 , 99 , 101 , 103 , 104 , 106 , 108 , 110 , 111 ]
50- }
26+ - Landing page (` / ` ) for payload submission + run status
27+ - Forecast pages (` /forecasts/[slug] ` ) generated from JSON artifacts
28+ - Per-series charts + backfill accuracy views
29+
30+ ---
31+
32+ ## Environment setup
33+
34+ Create local env file from template:
35+
36+ ``` bash
37+ cp .env.example .env.local
5138```
5239
40+ Fill values in ` .env.local ` (never commit real secrets).
41+
42+ ---
43+
5344## Local usage
5445
5546### Python
@@ -66,3 +57,43 @@ cd site
6657npm install
6758npm run build
6859```
60+
61+ ---
62+
63+ ## Deploy (GitHub + Cloudflare Pages)
64+
65+ ### 1) Push repo
66+ ``` bash
67+ git push origin main
68+ ```
69+
70+ ### 2) Create Cloudflare Pages project
71+ Project name used here: ` weatherman `
72+
73+ ### 3) Set GitHub repo secrets
74+ In ` bryanwhiting/weatherman ` → Settings → Secrets and variables → Actions:
75+
76+ - ` CLOUDFLARE_API_TOKEN `
77+ - ` CLOUDFLARE_ACCOUNT_ID `
78+
79+ ### 4) Set Cloudflare Pages Function secrets
80+ In Cloudflare Pages project (` weatherman ` ) → Settings → Environment variables / secrets:
81+
82+ - ` GITHUB_TOKEN ` (PAT with repo/workflow permissions)
83+ - ` ALLOWED_REPO ` (e.g. ` bryanwhiting/weatherman ` )
84+
85+ ### 5) Enable workflows
86+ Workflows used:
87+ - ` Forecast Request ` (build artifacts + commit + deploy)
88+ - ` Deploy Astro site to GitHub Pages ` (optional if you keep GH Pages as mirror)
89+
90+ ### 6) Trigger a forecast
91+ Use app UI or run workflow dispatch with payload.
92+
93+ ---
94+
95+ ## Notes
96+
97+ - ` demo_mode_m5 ` is reserved for demo runs.
98+ - Backtests require enough history (` horizon * windows + train span ` ).
99+ - For concurrent runs, workflow uses retry + rebase push logic.
0 commit comments