From 713437e9ec6ab8ad2f3c371b4c2b26c1951569db Mon Sep 17 00:00:00 2001 From: willwheeler Date: Thu, 18 Jun 2026 21:32:21 +0000 Subject: [PATCH] Update forecast_output.json --- forecast_output.json.md | 96 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 95 insertions(+), 1 deletion(-) diff --git a/forecast_output.json.md b/forecast_output.json.md index 27a17fc..5f718cc 100644 --- a/forecast_output.json.md +++ b/forecast_output.json.md @@ -1 +1,95 @@ -<-- [[Home]] \ No newline at end of file +<-- [[Home]] +# forecast_output.json + +Chart-ready forecast output from **`forecast.py`**. Loaded by **`test.php`** when you click **Load forecast** or use `?forecast=1`. + +[[Forecast]] · [[test.php]] · [[Home]] + +--- + +## What it is + +| | | +|---|---| +| **Created by** | `python forecast.py` | +| **Location** | Project root (next to `forecast.py`) | +| **Format** | JSON object, one key per BACnet point | +| **Not** | Live data — static file until you re-run the script | + +--- + +## Schema + +Each **top-level key** = point name (e.g. `"P"`, `"Ia"`). + +Each value: + +| Field | Type | Meaning | +|-------|------|---------| +| `mae` | number | Mean absolute error on the **last 20%** backtest (same units as the point) | +| `future` | array | Predicted readings **after** the last sample in training data | + +Each item in `future`: + +| Field | Type | Meaning | +|-------|------|---------| +| `x` | integer | Unix time in **milliseconds** (matches sample JS / `getData`) | +| `y` | number | Predicted value (2 decimals) | + +### Example + + { + "P": { + "mae": 11.17, + "future": [ + { "x": 1781713080000, "y": 19.05 }, + { "x": 1781713200000, "y": 19.04 } + ] + } + } + +--- + +## Default keys (current `JOBS`) + +| Key | From | Dashboard | +|-----|------|-----------| +| `P` | veris-sample.js | Line P (+ dashed forecast) | +| `Ia`, `Ib`, `Ic` | veris-sample.js | Phase compare (+ forecast) | +| `ServRmTmp` | rtu-sample.js | In file; RTU overlay not wired yet | + +Add points in `forecast.py` → `JOBS`, re-run, refresh forecast in browser. + +--- + +## How test.php uses it + +1. `fetch("forecast_output.json")` +2. `basForecastSeries(actualSeries, pointName)` → last real `{x,y}` + `future` array +3. Dashed red line on **Line P** and **Phase compare** only + +Point name in JSON must **match** the series key on the chart (e.g. `P`, not `Demand`, unless that is the actual key in your data). + +`mae` is stored but **not shown in the UI** yet. + +--- + +## Refresh + + python forecast.py + +Then **Load forecast** in test.php (or reload with `?forecast=1`). + +--- + +## Troubleshooting + +| Issue | Fix | +|-------|-----| +| File missing | Run `forecast.py` from project root | +| No dashed line | JSON key must match chart point; load sample/live data first | +| Stale forecast | Re-run `forecast.py` after sample JS changes | + +--- + +*forecast_output.json — output contract for the forecast pipeline.* \ No newline at end of file