feat: ci docs #1
No files matched your search
@@ -0,0 +1,9 @@
|
||||
.git
|
||||
.gitignore
|
||||
.nuxt
|
||||
.output
|
||||
node_modules
|
||||
coverage
|
||||
test-results
|
||||
*.log
|
||||
.DS_Store
|
||||
@@ -0,0 +1,25 @@
|
||||
name: ci
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
# Keep cache-free so this also runs where no Actions cache service exists.
|
||||
node-version: 22
|
||||
|
||||
- name: Check
|
||||
run: make check
|
||||
@@ -90,6 +90,7 @@ out
|
||||
|
||||
# Nuxt.js build / generate output
|
||||
.nuxt
|
||||
.output
|
||||
dist
|
||||
|
||||
# Gatsby files
|
||||
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
# Multi-stage production build for the Nuxt SSR server.
|
||||
# The runtime image runs as numeric UID/GID 10001:10001 so Kubernetes can
|
||||
# verify runAsNonRoot without a named user lookup.
|
||||
|
||||
FROM node:22-alpine AS build
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci
|
||||
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
FROM node:22-alpine AS runtime
|
||||
WORKDIR /app
|
||||
|
||||
ENV NODE_ENV=production
|
||||
ENV HOST=0.0.0.0
|
||||
ENV PORT=3000
|
||||
ENV HOME=/tmp
|
||||
ENV NITRO_TEMP_DIR=/tmp
|
||||
|
||||
# Create a numeric runtime identity. Keep the literal numbers in USER/COPY:
|
||||
# the kubelet cannot resolve names such as "app" reliably.
|
||||
RUN addgroup -g 10001 -S app \
|
||||
&& adduser -u 10001 -S app -G app
|
||||
|
||||
COPY --from=build --chown=10001:10001 /app/.output ./.output
|
||||
|
||||
USER 10001:10001
|
||||
EXPOSE 3000
|
||||
|
||||
CMD ["node", ".output/server/index.mjs"]
|
||||
@@ -0,0 +1,33 @@
|
||||
NPM ?= npm
|
||||
|
||||
.PHONY: install dev build test check preview docker-build smoke smoke-live
|
||||
|
||||
install:
|
||||
$(NPM) ci
|
||||
|
||||
dev:
|
||||
$(NPM) run dev
|
||||
|
||||
build:
|
||||
$(NPM) run build
|
||||
|
||||
test:
|
||||
$(NPM) test
|
||||
|
||||
# Local equivalent of .gitea/workflows/ci.yml.
|
||||
check: install build test
|
||||
|
||||
preview:
|
||||
$(NPM) run preview
|
||||
|
||||
docker-build:
|
||||
docker build -t pulsecast-web:local .
|
||||
|
||||
# Requires a running web server (npm run preview or node .output/server/index.mjs).
|
||||
smoke:
|
||||
node scripts/smoke-api.mjs
|
||||
|
||||
# Requires Go on 18080, ML on 18000 and this app on 13000.
|
||||
# See README "Live stack" for the exact environment.
|
||||
smoke-live:
|
||||
node scripts/smoke-live.mjs
|
||||
@@ -1,3 +1,244 @@
|
||||
# web-nuxt
|
||||
# PulseCast web
|
||||
|
||||
Frontend with SSR and triggered via SSE to get a touch and feel
|
||||
Nuxt 4 SSR frontend for **PulseCast**, a staffing copilot that turns inner-city
|
||||
footfall into a next-week shift plan for a Heilbronn retailer. `/plan` is the
|
||||
decision surface; `/stage` and `/live` present that plan. The map, weather and
|
||||
forecast are supporting evidence.
|
||||
|
||||
## Quick start
|
||||
|
||||
Node 22 is the CI and Docker version. Real data comes from the Go API on
|
||||
`http://localhost:8080`; mock mode needs no API.
|
||||
|
||||
```bash
|
||||
npm ci
|
||||
npm run dev # http://localhost:3000
|
||||
```
|
||||
|
||||
Without the Go API, use the checked-in mock data:
|
||||
|
||||
```bash
|
||||
NUXT_PUBLIC_USE_MOCK=1 npm run dev
|
||||
```
|
||||
|
||||
Build and test exactly as CI does:
|
||||
|
||||
```bash
|
||||
make check # npm ci, npm run build, npm test
|
||||
```
|
||||
|
||||
The built SSR server can also be started directly:
|
||||
|
||||
```bash
|
||||
NUXT_API_INTERNAL_BASE=http://localhost:8080 \
|
||||
PORT=3000 node .output/server/index.mjs
|
||||
```
|
||||
|
||||
## Stack
|
||||
|
||||
- Nuxt `4.6.4`, `ssr: true`, Nitro `node-server`
|
||||
- `@sit-onyx/nuxt` `1.2.0` + `sit-onyx` `1.22.0` for the entire shell and UI
|
||||
- Nitro server routes proxy to the Go API; the browser only talks to this origin
|
||||
- Shared plan heuristic in `shared/staffing.ts`, used for the mock fallback and
|
||||
for the labeled local preview on `/plan`
|
||||
|
||||
Onyx is used for the navigation/app shell, page layout, cards, tables, buttons,
|
||||
badges, tags, selects, segmented control, slider, stepper, accordion and file
|
||||
upload. The app does not ship a parallel component design system.
|
||||
|
||||
## Live demo: `/stage`, `/live`, `/control`
|
||||
|
||||
```text
|
||||
browser ──GET /api/stream──► Nuxt Nitro ──proxy──► Go /api/stream
|
||||
◄── scenario/ping ── ◄────────── SSE hub
|
||||
presenter ──POST /api/scenario──► Nitro (Basic auth + control credentials) ──► Go
|
||||
```
|
||||
|
||||
- `app/composables/useLiveScenario.ts` opens one `EventSource` per tab. On a
|
||||
`scenario` event it updates the shared state and tells the page to refetch;
|
||||
`ping` heartbeats keep the connection marked **Live**.
|
||||
- After two SSE errors, or when no heartbeat arrives for 32 s (a buffering
|
||||
proxy), the client starts polling `GET /api/scenario` every 5 s. The badge
|
||||
shows **Connecting**, **Live**, **Polling** or **Offline**, never a silent
|
||||
stale plan.
|
||||
- `POST /api/scenario` goes through Nitro; the Go control credentials stay in
|
||||
the Node process. `/control` itself requires HTTP Basic auth
|
||||
(`CONTROL_USER`/`CONTROL_PASS`); an HMAC cookie lets the page POST without
|
||||
re-prompting. `/stage`, `/live` and all public GETs stay open.
|
||||
- `/stage` renders a local SVG QR code (`/api/qr`) pointing at `/live`; no
|
||||
third-party QR service is called.
|
||||
|
||||
### Live stack (read-only Go/ML worktrees)
|
||||
|
||||
```bash
|
||||
# 1. ML on 18000 (from ML-py.git/main)
|
||||
PYTHONPATH=src CONTROL_TOKEN=replace-me-token \
|
||||
.venv/bin/uvicorn pulsecast.server:app --host 127.0.0.1 --port 18000
|
||||
|
||||
# 2. Go on 18080 (from api-go.git/main)
|
||||
PORT=18080 FASTAPI_URL=http://127.0.0.1:18000 \
|
||||
CONTROL_USER=control CONTROL_PASS=replace-me-pass CONTROL_TOKEN=replace-me-token \
|
||||
go run ./cmd/api
|
||||
|
||||
# 3. Web preview on 13000 (from this worktree, after npm run build)
|
||||
PORT=13000 NUXT_API_INTERNAL_BASE=http://127.0.0.1:18080 \
|
||||
CONTROL_USER=control CONTROL_PASS=replace-me-pass CONTROL_TOKEN=replace-me-token \
|
||||
node .output/server/index.mjs
|
||||
|
||||
# 4. Live smoke: auth boundary, /stage + /live SSR, QR, SSE event,
|
||||
# polling read, and a staffing/forecast plan that differs from base.
|
||||
CONTROL_USER=control CONTROL_PASS=replace-me-pass WEB_URL=http://127.0.0.1:13000 \
|
||||
node scripts/smoke-live.mjs
|
||||
```
|
||||
|
||||
## API wiring
|
||||
|
||||
Every route in `server/api/` is a proxy to the Go service. The default is the
|
||||
real API; mock JSON is an explicit dev fallback only.
|
||||
|
||||
| Nitro route | Upstream |
|
||||
| --- | --- |
|
||||
| `GET /api/healthz` | `GET /api/healthz` |
|
||||
| `GET /api/readyz` | `GET /api/readyz` |
|
||||
| `GET /api/meta` | `GET /api/meta` |
|
||||
| `GET /api/sensors` | `GET /api/sensors` |
|
||||
| `GET /api/context` | `GET /api/context` |
|
||||
| `GET /api/series` | `GET /api/series` |
|
||||
| `GET /api/forecast` | `GET /api/forecast` |
|
||||
| `GET /api/staffing` | `GET /api/staffing` |
|
||||
| `GET /api/scenario` | `GET /api/scenario` |
|
||||
| `GET /api/stream` | `GET /api/stream`, streamed chunk-by-chunk (SSE) |
|
||||
| `POST /api/scenario` | `POST /api/scenario` with server-side control auth |
|
||||
| `GET /api/qr?text=` | Local SVG QR generation, no upstream call |
|
||||
| `POST /api/train` | `POST /api/train` with server-side control auth |
|
||||
| `GET /api/train/:job_id` | `GET /api/train/{job_id}` with server-side control auth |
|
||||
| `GET /api/scenarios` | Local UI metadata only (labels/descriptions) |
|
||||
|
||||
`/plan` reads Go `/api/staffing` through Nitro. The four local assumption
|
||||
controls (safety factor, minimum staff, shift length, labour cost) are not query
|
||||
inputs of the Go contract, so changing them renders an explicit **local
|
||||
preview** from the API plan’s hourly footfall; “Use API plan” restores the
|
||||
server values. The shared heuristic is tested against a captured Go response in
|
||||
`test/fixtures/go-staffing.json`.
|
||||
|
||||
### Environment
|
||||
|
||||
| Variable | Default | Purpose |
|
||||
| --- | --- | --- |
|
||||
| `NUXT_API_INTERNAL_BASE` | — | Preferred server-side Go base (`http://api:8080` in K8s) |
|
||||
| `NUXT_API_BASE` | — | Alias for the server-side base |
|
||||
| `NUXT_PUBLIC_API_BASE` | — | Fallback base; also exposed to the browser |
|
||||
| `NUXT_API_TIMEOUT_MS` | `8000` | Upstream request timeout |
|
||||
| `NUXT_PUBLIC_USE_MOCK` / `NUXT_USE_MOCK` | unset | `1` enables the mock fallback |
|
||||
| `NUXT_DISABLE_SSE` | unset | `1` forces the polling fallback (SSE failure drill) |
|
||||
| `CONTROL_USER` / `CONTROL_PASS` | unset | Basic auth for `/control` and `POST /api/scenario`; also attached to Go `/api/train` |
|
||||
| `CONTROL_TOKEN` | unset | Optional Bearer fallback when Basic is not configured; the Go control API requires Basic today |
|
||||
| `NUXT_PUBLIC_DEMO_NOW` | `2026-11-14T08:12:00Z` | Replay clock used for labels |
|
||||
|
||||
Control credentials are read only in the Nitro process. They are never placed
|
||||
in `runtimeConfig.public` and never reach the browser bundle. `/control` and
|
||||
`POST /api/scenario` require Basic auth at Nitro, and Nitro then attaches the
|
||||
same credentials to Go. In API mode, if `CONTROL_USER`/`CONTROL_PASS` are
|
||||
unset, the control surface returns `503 control_auth_unconfigured`; public
|
||||
screens keep working.
|
||||
|
||||
The K8s web Deployment must mount the same `control-auth` secret as the API
|
||||
Deployment:
|
||||
|
||||
```yaml
|
||||
env:
|
||||
- name: CONTROL_USER
|
||||
valueFrom: { secretKeyRef: { name: control-auth, key: CONTROL_USER } }
|
||||
- name: CONTROL_PASS
|
||||
valueFrom: { secretKeyRef: { name: control-auth, key: CONTROL_PASS } }
|
||||
```
|
||||
|
||||
### Mock fallback
|
||||
|
||||
```bash
|
||||
NUXT_PUBLIC_USE_MOCK=1 npm run dev
|
||||
```
|
||||
|
||||
Mock mode serves deterministic JSON from `mock/` and completes training
|
||||
immediately. It is for developing the UI without Go; the default and the
|
||||
deployed path are the real API.
|
||||
|
||||
## Screens
|
||||
|
||||
| Route | Purpose |
|
||||
| --- | --- |
|
||||
| `/` | Now: replay reading, 8-sensor schematic, weather, holiday, data versions |
|
||||
| `/forecast` | 7-day daily forecast, uncertainty band, weather strip |
|
||||
| `/plan` | **Hero.** Peak decision, shift blocks, coverage, cost, why, assumptions |
|
||||
| `/simulate` | Base vs scenario plan, both read from Go `/api/staffing` |
|
||||
| `/stage` | Big-screen decision: headline, peak staff, cost, coverage, QR to `/live` |
|
||||
| `/live` | Phone view: current recommendation, peak shift, scenario, last update |
|
||||
| `/control` | Presenter preset buttons; authenticated POST through Nitro |
|
||||
| `/about` | Method, metrics, limits, privacy, train form |
|
||||
|
||||
The layout targets **390 px** (single column, mobile Onyx nav, day cards) and
|
||||
**1440 px** (Onyx horizontal nav, two-column plan with tables).
|
||||
|
||||
## Plan logic
|
||||
|
||||
`shared/staffing.ts` is the single implementation of the contract heuristic:
|
||||
|
||||
```text
|
||||
required = ceil(max(0, footfall) / visitors_per_staff_hour * safety_factor)
|
||||
required = max(required, min_staff)
|
||||
```
|
||||
|
||||
Store hours are 10:00–20:00 Europe/Berlin; default blocks are 4 h; labour cost is
|
||||
€16/h; the default service standard is 25 visitors per staff-hour. The flat
|
||||
schedule applies the global peak requirement to every store hour, matching Go
|
||||
and the contract (§5). Coverage is at or above requirement by construction
|
||||
because each block is sized to its local peak — the UI shows the resulting
|
||||
overstaffed hours instead of hiding them.
|
||||
|
||||
## Checks and CI
|
||||
|
||||
```bash
|
||||
make check # npm ci, npm run build, npm test
|
||||
make smoke # Nitro -> Go API contract, against a running web server
|
||||
make smoke-live # SSE + control + /stage + /live, against the 18080/18000/13000 stack
|
||||
```
|
||||
|
||||
The same `make check` runs in Gitea Actions (`.gitea/workflows/ci.yml`). The
|
||||
workflow needs no secrets, no registry push and no cluster access.
|
||||
|
||||
`scripts/smoke-api.mjs` exercises the Nitro → Go chain: health, sensors,
|
||||
context, meta, series, base and scenario forecasts, standard and premium
|
||||
staffing, local presets, and 404/400 propagation.
|
||||
|
||||
`scripts/smoke-live.mjs` proves the live path: unauthorised POST is rejected,
|
||||
`/control` authenticates, `/stage` and `/live` render server-side, `/api/qr`
|
||||
returns SVG, the SSE proxy emits `retry: 3000` and the initial scenario, a
|
||||
presenter POST produces a `scenario` event (with matching `id` and version)
|
||||
within the 2 s contract target (the script warns if slower), polling reads the
|
||||
same version, and the target staffing and forecast responses differ from base.
|
||||
It restores the base scenario at the end.
|
||||
|
||||
## Docker
|
||||
|
||||
```bash
|
||||
docker build -t pulsecast-web:local .
|
||||
docker run --rm -p 3000:3000 \
|
||||
-e NUXT_API_INTERNAL_BASE=http://host.docker.internal:8080 \
|
||||
pulsecast-web:local
|
||||
```
|
||||
|
||||
On Linux, add `--add-host=host.docker.internal:host-gateway` or use the host IP.
|
||||
|
||||
The multi-stage image copies only `.output/` into `node:22-alpine`. It creates
|
||||
numeric UID/GID **`10001:10001`**, uses `COPY --chown=10001:10001` and runs
|
||||
`USER 10001:10001`. Kubernetes should set `runAsUser: 10001`,
|
||||
`runAsGroup: 10001` (never a named user such as `node`).
|
||||
|
||||
## Limits
|
||||
|
||||
- No POS, sales, queue or payroll data. Cost is an assumption.
|
||||
- Forecast is model output; the plan is decision support, not an optimizer.
|
||||
- Eight sensors in a 580 m cluster; no city-wide heatmap claim.
|
||||
- SSE state is in memory in the single Go pod. A pod restart drops streams;
|
||||
clients reconnect via `retry: 3000` or fall back to 5 s polling.
|
||||
- Raw CSV, secrets and kubeconfig never enter this repository.
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
iconCalendar,
|
||||
iconChart,
|
||||
iconCircleInformation,
|
||||
iconFlash,
|
||||
iconHome,
|
||||
iconMobileSignal,
|
||||
iconPresentionBoard,
|
||||
} from '@sit-onyx/icons'
|
||||
|
||||
const route = useRoute()
|
||||
const config = useRuntimeConfig()
|
||||
const usingMock = computed(
|
||||
() =>
|
||||
config.public.useMock === true ||
|
||||
config.public.useMock === '1' ||
|
||||
config.public.useMock === 'true',
|
||||
)
|
||||
|
||||
const navigation = [
|
||||
{ to: '/', label: 'Now', icon: iconHome },
|
||||
{ to: '/forecast', label: 'Forecast', icon: iconChart },
|
||||
{ to: '/plan', label: 'Plan', icon: iconCalendar },
|
||||
{ to: '/simulate', label: 'Simulate', icon: iconFlash },
|
||||
{ to: '/stage', label: 'Stage', icon: iconPresentionBoard },
|
||||
{ to: '/live', label: 'Live', icon: iconMobileSignal },
|
||||
{ to: '/about', label: 'About', icon: iconCircleInformation },
|
||||
]
|
||||
|
||||
const hiddenPageLabels: Record<string, string> = { '/control': 'Control' }
|
||||
const activeLabel = computed(
|
||||
() => navigation.find((item) => item.to === route.path)?.label ?? hiddenPageLabels[route.path] ?? 'PulseCast',
|
||||
)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<OnyxAppLayout>
|
||||
<template #navBar>
|
||||
<OnyxNavBar app-name="PulseCast" logo-url="/logo.svg" mobile="sm">
|
||||
<OnyxUnstableNavButton
|
||||
v-for="item in navigation"
|
||||
:key="item.to"
|
||||
:link="item.to"
|
||||
:label="item.label"
|
||||
:icon="item.icon"
|
||||
/>
|
||||
<template #contextArea>
|
||||
<OnyxBadge :color="usingMock ? 'warning' : 'success'">{{ usingMock ? 'Mock data' : 'Go API' }}</OnyxBadge>
|
||||
</template>
|
||||
<template #mobileActivePage>{{ activeLabel }}</template>
|
||||
</OnyxNavBar>
|
||||
</template>
|
||||
|
||||
<OnyxPageLayout>
|
||||
<NuxtPage />
|
||||
<template #footer>
|
||||
<footer class="app-footer">
|
||||
<span><strong>PulseCast</strong> — staff the pulse, not the noise.</span>
|
||||
<span class="muted small">
|
||||
Prototype · forecast from the Go API · estimated devices, not people · 8 sensors in a 580 m cluster
|
||||
</span>
|
||||
</footer>
|
||||
</template>
|
||||
</OnyxPageLayout>
|
||||
</OnyxAppLayout>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.app-footer {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
gap: var(--onyx-density-sm);
|
||||
width: 100%;
|
||||
max-width: 1440px;
|
||||
margin-inline: auto;
|
||||
padding-block: var(--onyx-density-sm);
|
||||
color: var(--onyx-color-text-icons-neutral-medium);
|
||||
font-size: 0.8125rem;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,555 @@
|
||||
html,
|
||||
body,
|
||||
#__nuxt {
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
background: var(--onyx-color-base-neutral-100);
|
||||
}
|
||||
|
||||
.page {
|
||||
width: 100%;
|
||||
max-width: 1440px;
|
||||
margin-inline: auto;
|
||||
}
|
||||
|
||||
.page-stack {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--onyx-density-xl);
|
||||
}
|
||||
|
||||
.page-header {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-end;
|
||||
justify-content: space-between;
|
||||
gap: var(--onyx-density-md);
|
||||
}
|
||||
|
||||
.eyebrow {
|
||||
margin: 0 0 var(--onyx-density-xs);
|
||||
color: var(--onyx-color-text-icons-primary-bold);
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.lede {
|
||||
max-width: 72ch;
|
||||
margin: var(--onyx-density-sm) 0 0;
|
||||
color: var(--onyx-color-text-icons-neutral-medium);
|
||||
font-size: 1rem;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.muted {
|
||||
color: var(--onyx-color-text-icons-neutral-medium);
|
||||
}
|
||||
|
||||
.small {
|
||||
font-size: 0.8125rem;
|
||||
line-height: 1.45;
|
||||
}
|
||||
|
||||
.mono {
|
||||
font-family: var(--onyx-font-family-mono);
|
||||
font-size: 0.8125rem;
|
||||
}
|
||||
|
||||
.hero {
|
||||
padding: clamp(1.25rem, 2.5vw, 2rem);
|
||||
border: 1px solid var(--onyx-color-base-primary-200);
|
||||
border-radius: var(--onyx-radius-component-container-soft);
|
||||
background:
|
||||
radial-gradient(circle at 100% 0%, var(--onyx-color-base-primary-200), transparent 42%),
|
||||
linear-gradient(135deg, var(--onyx-color-base-primary-100), var(--onyx-color-base-neutral-100) 68%);
|
||||
}
|
||||
|
||||
.hero-grid {
|
||||
display: grid;
|
||||
gap: var(--onyx-density-xl);
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
.hero-copy {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--onyx-density-md);
|
||||
}
|
||||
|
||||
.hero-copy h1 {
|
||||
max-width: 22ch;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.hero-copy p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.hero-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: var(--onyx-density-sm);
|
||||
}
|
||||
|
||||
.hero-decision {
|
||||
padding: var(--onyx-density-lg);
|
||||
border: 1px solid var(--onyx-color-base-primary-300);
|
||||
border-radius: var(--onyx-radius-component-container-soft);
|
||||
background: var(--onyx-color-base-neutral-100);
|
||||
}
|
||||
|
||||
.hero-decision__value {
|
||||
margin: 0;
|
||||
font-size: clamp(2rem, 3vw, 3rem);
|
||||
font-weight: 700;
|
||||
line-height: 1.05;
|
||||
color: var(--onyx-color-text-icons-primary-intense);
|
||||
}
|
||||
|
||||
.hero-decision__label {
|
||||
margin: var(--onyx-density-xs) 0 0;
|
||||
color: var(--onyx-color-text-icons-neutral-medium);
|
||||
}
|
||||
|
||||
.summary-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: var(--onyx-density-sm);
|
||||
}
|
||||
|
||||
.stat-card {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
/* Onyx badges are flex children inside cards and otherwise stretch to full width. */
|
||||
.onyx-badge {
|
||||
width: fit-content;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
margin: 0;
|
||||
color: var(--onyx-color-text-icons-neutral-medium);
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
margin: var(--onyx-density-xs) 0 0;
|
||||
font-size: clamp(1.35rem, 2vw, 1.75rem);
|
||||
font-weight: 700;
|
||||
line-height: 1.15;
|
||||
}
|
||||
|
||||
.stat-hint {
|
||||
margin: var(--onyx-density-xs) 0 0;
|
||||
color: var(--onyx-color-text-icons-neutral-soft);
|
||||
font-size: 0.8125rem;
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
.split-grid {
|
||||
display: grid;
|
||||
gap: var(--onyx-density-lg);
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
.card-stack {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
flex-direction: column;
|
||||
gap: var(--onyx-density-md);
|
||||
}
|
||||
|
||||
/* Keep wide Onyx tables scrolling inside their card instead of widening the page
|
||||
(Onyx wrappers are flex items and grid tracks default to min-width: auto). */
|
||||
.split-grid > *,
|
||||
.summary-grid > *,
|
||||
.onyx-card,
|
||||
.onyx-table-wrapper,
|
||||
.onyx-table-wrapper__container {
|
||||
min-width: 0;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
/* Onyx marks some wide tables as "no scroll" before layout settles. Keep the
|
||||
scrollport so a phone never scrolls the whole page sideways. */
|
||||
.onyx-table-wrapper__container,
|
||||
.onyx-table-wrapper__container--no-scroll {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: var(--onyx-density-xs);
|
||||
margin-bottom: var(--onyx-density-sm);
|
||||
}
|
||||
|
||||
.card-header h2,
|
||||
.card-header h3 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.form-grid {
|
||||
display: grid;
|
||||
gap: var(--onyx-density-md);
|
||||
}
|
||||
|
||||
.form-grid > *,
|
||||
.onyx-form-element-v2,
|
||||
.onyx-form-element-v2 > * {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.form-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: var(--onyx-density-sm);
|
||||
}
|
||||
|
||||
.assumption-grid {
|
||||
display: grid;
|
||||
gap: var(--onyx-density-md);
|
||||
}
|
||||
|
||||
.shift-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--onyx-density-2xs);
|
||||
}
|
||||
|
||||
.day-card-list {
|
||||
display: none;
|
||||
flex-direction: column;
|
||||
gap: var(--onyx-density-sm);
|
||||
}
|
||||
|
||||
.day-card__header {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
justify-content: space-between;
|
||||
gap: var(--onyx-density-sm);
|
||||
}
|
||||
|
||||
.day-card__date {
|
||||
margin: 0;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.day-card__metrics {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--onyx-density-sm);
|
||||
margin-top: var(--onyx-density-sm);
|
||||
color: var(--onyx-color-text-icons-neutral-medium);
|
||||
font-size: 0.8125rem;
|
||||
}
|
||||
|
||||
.weather-strip {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(5.5rem, 1fr));
|
||||
gap: var(--onyx-density-2xs);
|
||||
padding-bottom: var(--onyx-density-2xs);
|
||||
}
|
||||
|
||||
.weather-day {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
flex-direction: column;
|
||||
gap: 0.25rem;
|
||||
padding: var(--onyx-density-xs);
|
||||
border: 1px solid var(--onyx-color-base-neutral-300);
|
||||
border-radius: var(--onyx-radius-component-container-soft);
|
||||
background: var(--onyx-color-base-neutral-100);
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.weather-day strong {
|
||||
font-size: 0.8125rem;
|
||||
}
|
||||
|
||||
.why-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--onyx-density-sm);
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.why-list li {
|
||||
display: flex;
|
||||
gap: var(--onyx-density-xs);
|
||||
align-items: flex-start;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.why-list .onyx-icon {
|
||||
flex: none;
|
||||
margin-top: 0.1rem;
|
||||
}
|
||||
|
||||
.map-frame {
|
||||
position: relative;
|
||||
min-height: 320px;
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--onyx-color-base-neutral-300);
|
||||
border-radius: var(--onyx-radius-component-container-soft);
|
||||
background:
|
||||
linear-gradient(var(--onyx-color-base-neutral-200) 1px, transparent 1px),
|
||||
linear-gradient(90deg, var(--onyx-color-base-neutral-200) 1px, transparent 1px),
|
||||
var(--onyx-color-base-neutral-100);
|
||||
background-size: 2.5rem 2.5rem;
|
||||
}
|
||||
|
||||
.map-frame__label {
|
||||
position: absolute;
|
||||
top: var(--onyx-density-sm);
|
||||
left: var(--onyx-density-sm);
|
||||
z-index: 2;
|
||||
max-width: 14rem;
|
||||
}
|
||||
|
||||
.sensor-pin {
|
||||
position: absolute;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 0.15rem;
|
||||
transform: translate(-50%, -50%);
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: inherit;
|
||||
cursor: pointer;
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
.sensor-pin__dot {
|
||||
display: grid;
|
||||
width: 2.25rem;
|
||||
height: 2.25rem;
|
||||
place-items: center;
|
||||
border: 2px solid var(--onyx-color-base-neutral-100);
|
||||
border-radius: 999px;
|
||||
background: var(--onyx-color-base-primary-600);
|
||||
color: var(--onyx-color-text-icons-neutral-inverted);
|
||||
box-shadow: var(--onyx-shadow-soft-bottom);
|
||||
font-size: 0.75rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.sensor-pin--active .sensor-pin__dot {
|
||||
background: var(--onyx-color-base-primary-800);
|
||||
outline: 3px solid var(--onyx-color-base-primary-300);
|
||||
}
|
||||
|
||||
.sensor-pin__name {
|
||||
max-width: 7rem;
|
||||
overflow: hidden;
|
||||
padding: 0.1rem 0.3rem;
|
||||
border-radius: 0.2rem;
|
||||
background: color-mix(in srgb, var(--onyx-color-base-neutral-100) 88%, transparent);
|
||||
font-size: 0.6875rem;
|
||||
line-height: 1.2;
|
||||
text-align: center;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.bar-chart {
|
||||
display: flex;
|
||||
height: 96px;
|
||||
align-items: flex-end;
|
||||
gap: 2px;
|
||||
padding-top: var(--onyx-density-sm);
|
||||
}
|
||||
|
||||
.bar-chart__bar {
|
||||
flex: 1;
|
||||
min-width: 3px;
|
||||
border-radius: 2px 2px 0 0;
|
||||
background: var(--onyx-color-base-primary-500);
|
||||
}
|
||||
|
||||
.bar-chart__bar--now {
|
||||
background: var(--onyx-color-base-primary-800);
|
||||
}
|
||||
|
||||
.reading-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: baseline;
|
||||
gap: var(--onyx-density-sm);
|
||||
}
|
||||
|
||||
.reading-value {
|
||||
margin: 0;
|
||||
font-size: clamp(2.5rem, 6vw, 4rem);
|
||||
font-weight: 700;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.legend {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--onyx-density-sm);
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.legend__item {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
color: var(--onyx-color-text-icons-neutral-medium);
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.legend__swatch {
|
||||
width: 0.75rem;
|
||||
height: 0.75rem;
|
||||
border-radius: 2px;
|
||||
background: var(--onyx-color-base-primary-500);
|
||||
}
|
||||
|
||||
.legend__swatch--under {
|
||||
background: var(--onyx-color-base-danger-500);
|
||||
}
|
||||
|
||||
.legend__swatch--over {
|
||||
background: var(--onyx-color-base-warning-500);
|
||||
}
|
||||
|
||||
.table-note {
|
||||
margin: var(--onyx-density-xs) 0 0;
|
||||
}
|
||||
|
||||
.callout {
|
||||
padding: var(--onyx-density-sm) var(--onyx-density-md);
|
||||
border-left: 3px solid var(--onyx-color-base-primary-500);
|
||||
border-radius: 0 var(--onyx-radius-component-container-soft) var(--onyx-radius-component-container-soft) 0;
|
||||
background: var(--onyx-color-base-primary-100);
|
||||
}
|
||||
|
||||
.callout--warning {
|
||||
border-left-color: var(--onyx-color-base-warning-500);
|
||||
background: var(--onyx-color-base-warning-100);
|
||||
}
|
||||
|
||||
.scenario-grid {
|
||||
display: grid;
|
||||
gap: var(--onyx-density-sm);
|
||||
}
|
||||
|
||||
.scenario-card {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.scenario-card--active {
|
||||
outline: 2px solid var(--onyx-color-base-primary-500);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.metric-list {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: var(--onyx-density-md);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.metric-list div {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.metric-list dt {
|
||||
color: var(--onyx-color-text-icons-neutral-medium);
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.metric-list dd {
|
||||
margin: 0.15rem 0 0;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.train-status {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: var(--onyx-density-sm);
|
||||
margin-top: var(--onyx-density-sm);
|
||||
}
|
||||
|
||||
@media (min-width: 577px) {
|
||||
.assumption-grid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 769px) {
|
||||
.summary-grid {
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.day-card-list {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 993px) {
|
||||
.hero-grid {
|
||||
grid-template-columns: minmax(0, 1.65fr) minmax(18rem, 1fr);
|
||||
}
|
||||
|
||||
.split-grid {
|
||||
grid-template-columns: minmax(0, 1.9fr) minmax(20rem, 1fr);
|
||||
}
|
||||
|
||||
.scenario-grid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.desktop-table {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.day-card-list {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 576px) {
|
||||
.sensor-pin__name {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.map-frame {
|
||||
min-height: 360px;
|
||||
}
|
||||
|
||||
.card-header {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.card-header .onyx-badge {
|
||||
align-self: flex-start;
|
||||
}
|
||||
}
|
||||
|
||||
@media print {
|
||||
.hero-actions,
|
||||
.form-actions,
|
||||
.desktop-table {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<script setup lang="ts">
|
||||
import { LIVE_COLORS, LIVE_LABELS, liveAge } from '#shared/live'
|
||||
import type { LiveConnection } from '#shared/live'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
status: LiveConnection
|
||||
lastEventAt?: string
|
||||
compact?: boolean
|
||||
}>(),
|
||||
{ lastEventAt: '', compact: false },
|
||||
)
|
||||
|
||||
const color = computed(() => LIVE_COLORS[props.status])
|
||||
const label = computed(() => LIVE_LABELS[props.status])
|
||||
const age = computed(() => (props.lastEventAt ? liveAge(props.lastEventAt) : ''))
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<span class="live-status" role="status" aria-live="polite" :title="lastEventAt ? `Last event ${age}` : undefined">
|
||||
<OnyxBadge :color="color" :density="compact ? 'compact' : 'default'">{{ label }}</OnyxBadge>
|
||||
<span v-if="lastEventAt && !compact" class="live-status__age">{{ age }}</span>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.live-status {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
}
|
||||
|
||||
.live-status__age {
|
||||
color: var(--onyx-color-text-icons-neutral-soft);
|
||||
font-size: 0.7rem;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,33 @@
|
||||
<script setup lang="ts">
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
label: string
|
||||
value: string
|
||||
hint?: string
|
||||
badge?: string
|
||||
badgeColor?: 'neutral' | 'danger' | 'success' | 'primary' | 'warning' | 'info'
|
||||
icon?: string
|
||||
}>(),
|
||||
{ badgeColor: 'neutral' },
|
||||
)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<OnyxCard class="stat-card">
|
||||
<p class="stat-label">
|
||||
<OnyxIcon v-if="icon" :icon="icon" size="16px" color="primary" />
|
||||
{{ label }}
|
||||
</p>
|
||||
<p class="stat-value">{{ value }}</p>
|
||||
<OnyxBadge v-if="badge" :color="badgeColor" density="compact">{{ badge }}</OnyxBadge>
|
||||
<p v-if="hint" class="stat-hint">{{ hint }}</p>
|
||||
</OnyxCard>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.stat-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,57 @@
|
||||
<script setup lang="ts">
|
||||
import type { Sensor } from '#shared/types'
|
||||
|
||||
const props = defineProps<{
|
||||
sensors: Sensor[]
|
||||
activeId: string
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
select: [sensorId: string]
|
||||
}>()
|
||||
|
||||
const bounds = computed(() => {
|
||||
const lats = props.sensors.map((sensor) => sensor.lat)
|
||||
const lons = props.sensors.map((sensor) => sensor.lon)
|
||||
const pad = 0.0009
|
||||
return {
|
||||
minLat: Math.min(...lats) - pad,
|
||||
maxLat: Math.max(...lats) + pad,
|
||||
minLon: Math.min(...lons) - pad,
|
||||
maxLon: Math.max(...lons) + pad,
|
||||
}
|
||||
})
|
||||
|
||||
function position(sensor: Sensor) {
|
||||
const { minLat, maxLat, minLon, maxLon } = bounds.value
|
||||
const x = ((sensor.lon - minLon) / (maxLon - minLon)) * 76 + 12
|
||||
const y = ((maxLat - sensor.lat) / (maxLat - minLat)) * 52 + 30
|
||||
return { left: `${x}%`, top: `${y}%` }
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="map-frame" role="group" aria-label="Schematic map of the eight Heilbronn sensors">
|
||||
<div class="map-frame__label">
|
||||
<OnyxBadge color="info" density="compact">Schematic</OnyxBadge>
|
||||
<p class="small muted" style="margin: 0.35rem 0 0">
|
||||
Relative sensor positions in the 580 m cluster. Not a city-wide heatmap.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<button
|
||||
v-for="(sensor, index) in props.sensors"
|
||||
:key="sensor.id"
|
||||
type="button"
|
||||
class="sensor-pin"
|
||||
:class="{ 'sensor-pin--active': sensor.id === props.activeId }"
|
||||
:style="position(sensor)"
|
||||
:aria-label="`${sensor.name}: mean ${sensor.mean}, p95 ${sensor.p95}`"
|
||||
:aria-pressed="sensor.id === props.activeId"
|
||||
@click="emit('select', sensor.id)"
|
||||
>
|
||||
<span class="sensor-pin__dot">{{ index + 1 }}</span>
|
||||
<span class="sensor-pin__name">{{ sensor.name }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,168 @@
|
||||
<script setup lang="ts">
|
||||
import { iconUpload } from '@sit-onyx/icons'
|
||||
|
||||
interface TrainResponse {
|
||||
job_id: string
|
||||
status: string
|
||||
model: 'small' | 'forecast'
|
||||
submitted_at: string
|
||||
}
|
||||
|
||||
interface TrainJob {
|
||||
job_id: string
|
||||
status: 'queued' | 'running' | 'succeeded' | 'failed'
|
||||
model: 'small' | 'forecast'
|
||||
metrics: Record<string, number | string> | null
|
||||
model_version: string | null
|
||||
error: string | null
|
||||
}
|
||||
|
||||
const file = ref<File | null>(null)
|
||||
const model = ref<'small' | 'forecast'>('small')
|
||||
const submitting = ref(false)
|
||||
const polling = ref(false)
|
||||
const job = ref<TrainJob | null>(null)
|
||||
const errorMessage = ref('')
|
||||
let pollTimer: ReturnType<typeof setInterval> | undefined
|
||||
|
||||
const modelOptions = [
|
||||
{ label: 'Small busy classifier (fast demo)', value: 'small' },
|
||||
{ label: 'Global forecast model (slower)', value: 'forecast' },
|
||||
]
|
||||
|
||||
const statusColor = computed(() => {
|
||||
switch (job.value?.status) {
|
||||
case 'succeeded':
|
||||
return 'success' as const
|
||||
case 'failed':
|
||||
return 'danger' as const
|
||||
case 'running':
|
||||
return 'info' as const
|
||||
default:
|
||||
return 'neutral' as const
|
||||
}
|
||||
})
|
||||
|
||||
function apiErrorMessage(error: unknown, fallback: string): string {
|
||||
const data = (
|
||||
error as {
|
||||
data?: { error?: { message?: string }; message?: string; statusMessage?: string }
|
||||
}
|
||||
)?.data
|
||||
return data?.error?.message ?? data?.message ?? data?.statusMessage ?? fallback
|
||||
}
|
||||
|
||||
function stopPolling() {
|
||||
if (pollTimer) clearInterval(pollTimer)
|
||||
pollTimer = undefined
|
||||
polling.value = false
|
||||
}
|
||||
|
||||
async function poll(jobId: string) {
|
||||
stopPolling()
|
||||
polling.value = true
|
||||
let attempts = 0
|
||||
pollTimer = setInterval(async () => {
|
||||
attempts += 1
|
||||
try {
|
||||
const result = await $fetch<TrainJob>(`/api/train/${encodeURIComponent(jobId)}`)
|
||||
job.value = result
|
||||
if (result.status === 'succeeded' || result.status === 'failed') stopPolling()
|
||||
} catch (error) {
|
||||
if (attempts >= 30) {
|
||||
stopPolling()
|
||||
errorMessage.value = apiErrorMessage(error, 'Could not read the training job status.')
|
||||
}
|
||||
}
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
async function submit() {
|
||||
errorMessage.value = ''
|
||||
job.value = null
|
||||
if (!file.value) {
|
||||
errorMessage.value = 'Choose a CSV file first.'
|
||||
return
|
||||
}
|
||||
|
||||
submitting.value = true
|
||||
try {
|
||||
const formData = new FormData()
|
||||
formData.append('model', model.value)
|
||||
formData.append('file', file.value)
|
||||
const response = await $fetch<TrainResponse>('/api/train', { method: 'POST', body: formData })
|
||||
await poll(response.job_id)
|
||||
} catch (error) {
|
||||
errorMessage.value = apiErrorMessage(
|
||||
error,
|
||||
'Training submission failed. Check the Go API and its FastAPI training upstream.',
|
||||
)
|
||||
} finally {
|
||||
submitting.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onBeforeUnmount(stopPolling)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<OnyxCard>
|
||||
<div class="card-header">
|
||||
<OnyxHeadline is="h3">Train new data</OnyxHeadline>
|
||||
<OnyxBadge color="info" density="compact">Server proxy</OnyxBadge>
|
||||
</div>
|
||||
<p class="small muted" style="margin-top: 0">
|
||||
Uploads through Nitro to Go <code>/api/train</code>. The control credentials stay in the Node process and are
|
||||
never sent to the browser.
|
||||
</p>
|
||||
|
||||
<form class="form-grid" @submit.prevent="submit">
|
||||
<OnyxFileUpload
|
||||
v-model="file"
|
||||
label="Training CSV"
|
||||
message="Challenge CSV schema. Required."
|
||||
:accept="['text/csv']"
|
||||
max-size="50MiB"
|
||||
/>
|
||||
<OnyxSelect
|
||||
v-model="model"
|
||||
label="Model"
|
||||
list-label="Available models"
|
||||
:options="modelOptions"
|
||||
/>
|
||||
<div class="form-actions">
|
||||
<OnyxButton
|
||||
type="submit"
|
||||
label="Start training"
|
||||
:icon="iconUpload"
|
||||
:loading="submitting || polling"
|
||||
/>
|
||||
<span v-if="submitting" class="small muted">Submitting…</span>
|
||||
<span v-else-if="polling" class="small muted">Training job running…</span>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<p v-if="errorMessage" class="small" style="color: var(--onyx-color-text-icons-danger-intense)">
|
||||
{{ errorMessage }}
|
||||
</p>
|
||||
|
||||
<div v-if="job" class="train-status">
|
||||
<OnyxBadge :color="statusColor">{{ job.status }}</OnyxBadge>
|
||||
<span class="small muted">Job {{ job.job_id }} · {{ job.model }}</span>
|
||||
<OnyxBadge v-if="job.model_version" color="neutral" density="compact">
|
||||
{{ job.model_version }}
|
||||
</OnyxBadge>
|
||||
</div>
|
||||
|
||||
<dl v-if="job?.metrics" class="metric-list" style="margin-top: var(--onyx-density-md)">
|
||||
<div v-for="(value, key) in job.metrics" :key="key">
|
||||
<dt>{{ key }}</dt>
|
||||
<dd>{{ value }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
|
||||
<p v-if="job?.error" class="small" style="color: var(--onyx-color-text-icons-danger-intense)">
|
||||
{{ job.error }}
|
||||
</p>
|
||||
</OnyxCard>
|
||||
</template>
|
||||
@@ -0,0 +1,25 @@
|
||||
<script setup lang="ts">
|
||||
import { iconCloud, iconSunny } from '@sit-onyx/icons'
|
||||
import type { DailyWeather } from '#shared/insights'
|
||||
import { formatShortDate, formatWeekdayShort } from '~/utils/format'
|
||||
|
||||
const props = defineProps<{
|
||||
days: DailyWeather[]
|
||||
}>()
|
||||
|
||||
function iconFor(kind: DailyWeather['kind']) {
|
||||
return kind === 'sunny' || kind === 'partly-cloudy' ? iconSunny : iconCloud
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="weather-strip" role="list" aria-label="Weather forecast for the plan week">
|
||||
<div v-for="day in props.days" :key="day.date" class="weather-day" role="listitem">
|
||||
<strong>{{ formatWeekdayShort(day.date) }} {{ formatShortDate(day.date) }}</strong>
|
||||
<OnyxIcon :icon="iconFor(day.kind)" size="24px" color="primary" />
|
||||
<span>{{ Math.round(day.tempMin) }}–{{ Math.round(day.tempMax) }} °C</span>
|
||||
<span class="muted">{{ day.precipMm.toFixed(1) }} mm</span>
|
||||
<span class="muted">{{ Math.round(day.cloudPct) }}% cloud</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,276 @@
|
||||
import {
|
||||
LIVE_LABELS,
|
||||
liveStatus,
|
||||
parseScenarioEvent,
|
||||
scenarioChanged,
|
||||
SCENARIO_POLL_MS,
|
||||
SSE_FAILURES_BEFORE_POLLING,
|
||||
SSE_STALE_MS,
|
||||
} from '#shared/live'
|
||||
import type { LiveConnection } from '#shared/live'
|
||||
import type { ScenarioState } from '#shared/types'
|
||||
|
||||
interface LiveStore {
|
||||
status: LiveConnection
|
||||
serverScenario: ScenarioState | null
|
||||
lastEventAt: string
|
||||
lastPollAt: string
|
||||
sseFailures: number
|
||||
pollFailures: number
|
||||
revision: number
|
||||
error: string
|
||||
}
|
||||
|
||||
// One stream per browser tab. The module-level store survives page navigation
|
||||
// and is only mutated from onMounted/EventSource callbacks (never during SSR).
|
||||
const store = reactive<LiveStore>({
|
||||
status: 'connecting',
|
||||
serverScenario: null,
|
||||
lastEventAt: '',
|
||||
lastPollAt: '',
|
||||
sseFailures: 0,
|
||||
pollFailures: 0,
|
||||
revision: 0,
|
||||
error: '',
|
||||
})
|
||||
|
||||
let source: EventSource | null = null
|
||||
let pollTimer: ReturnType<typeof setInterval> | null = null
|
||||
let staleTimer: ReturnType<typeof setInterval> | null = null
|
||||
let reconnectTimer: ReturnType<typeof setTimeout> | null = null
|
||||
let subscribers = 0
|
||||
let started = false
|
||||
let lastStaleRetry = 0
|
||||
|
||||
function nowIso(): string {
|
||||
return new Date().toISOString()
|
||||
}
|
||||
|
||||
function refreshStatus() {
|
||||
store.status = liveStatus({
|
||||
online: import.meta.client ? navigator.onLine !== false : true,
|
||||
sseOpen: source?.readyState === EventSource.OPEN,
|
||||
sseFailures: store.sseFailures,
|
||||
polling: pollTimer !== null,
|
||||
pollFailures: store.pollFailures,
|
||||
})
|
||||
}
|
||||
|
||||
function clearPolling() {
|
||||
if (pollTimer) clearInterval(pollTimer)
|
||||
pollTimer = null
|
||||
}
|
||||
|
||||
function applyScenario(next: ScenarioState, origin: 'sse' | 'poll') {
|
||||
const changed = scenarioChanged(store.serverScenario, next)
|
||||
store.serverScenario = next
|
||||
store.lastEventAt = nowIso()
|
||||
store.error = ''
|
||||
if (origin === 'poll') store.lastPollAt = store.lastEventAt
|
||||
if (changed) store.revision += 1
|
||||
}
|
||||
|
||||
async function pollScenario(): Promise<void> {
|
||||
if (!import.meta.client) return
|
||||
try {
|
||||
const next = await $fetch<ScenarioState>('/api/scenario', {
|
||||
headers: { accept: 'application/json' },
|
||||
timeout: 5000,
|
||||
})
|
||||
store.pollFailures = 0
|
||||
applyScenario(next, 'poll')
|
||||
// A successful poll proves the API is reachable; stay "Polling" until SSE
|
||||
// opens again, so the audience can see the fallback is active.
|
||||
if (store.status === 'offline') store.status = 'polling'
|
||||
} catch (error) {
|
||||
store.pollFailures += 1
|
||||
store.error = (error as { statusMessage?: string })?.statusMessage ?? 'Scenario polling failed'
|
||||
}
|
||||
refreshStatus()
|
||||
}
|
||||
|
||||
function startPolling() {
|
||||
if (!import.meta.client || pollTimer) return
|
||||
void pollScenario()
|
||||
pollTimer = setInterval(() => void pollScenario(), SCENARIO_POLL_MS)
|
||||
refreshStatus()
|
||||
}
|
||||
|
||||
function closeSource() {
|
||||
if (source) {
|
||||
source.close()
|
||||
source = null
|
||||
}
|
||||
if (reconnectTimer) clearTimeout(reconnectTimer)
|
||||
reconnectTimer = null
|
||||
}
|
||||
|
||||
function connectSse() {
|
||||
if (!import.meta.client) return
|
||||
closeSource()
|
||||
|
||||
if (navigator.onLine === false) {
|
||||
store.status = 'offline'
|
||||
startPolling()
|
||||
return
|
||||
}
|
||||
|
||||
const eventSource = new EventSource('/api/stream')
|
||||
source = eventSource
|
||||
|
||||
eventSource.onopen = () => {
|
||||
if (source !== eventSource) return
|
||||
store.sseFailures = 0
|
||||
store.pollFailures = 0
|
||||
store.error = ''
|
||||
// Start the stale watchdog now: a proxy can accept the SSE headers and
|
||||
// then buffer the body, so "open" does not prove events are flowing.
|
||||
store.lastEventAt = nowIso()
|
||||
clearPolling()
|
||||
refreshStatus()
|
||||
}
|
||||
|
||||
eventSource.addEventListener('scenario', (event) => {
|
||||
if (source !== eventSource) return
|
||||
const parsed = parseScenarioEvent((event as MessageEvent).data)
|
||||
if (!parsed) {
|
||||
store.error = 'Ignored a malformed scenario event'
|
||||
return
|
||||
}
|
||||
store.sseFailures = 0
|
||||
applyScenario(parsed, 'sse')
|
||||
refreshStatus()
|
||||
})
|
||||
|
||||
eventSource.addEventListener('ping', () => {
|
||||
if (source !== eventSource) return
|
||||
store.sseFailures = 0
|
||||
store.lastEventAt = nowIso()
|
||||
if (pollTimer && eventSource.readyState === EventSource.OPEN) clearPolling()
|
||||
refreshStatus()
|
||||
})
|
||||
|
||||
eventSource.onerror = () => {
|
||||
if (source !== eventSource) return
|
||||
store.sseFailures += 1
|
||||
|
||||
// A non-200 response (Nitro 502/503, proxy error) leaves EventSource in
|
||||
// CLOSED and the browser will not retry it. Treat that as a definitive
|
||||
// failure: start polling now and try the stream again on a timer. Network
|
||||
// errors while CONNECTING still use the browser's own retry loop.
|
||||
const fatal = eventSource.readyState === EventSource.CLOSED
|
||||
if (fatal) {
|
||||
store.sseFailures = Math.max(store.sseFailures, SSE_FAILURES_BEFORE_POLLING)
|
||||
if (!reconnectTimer) {
|
||||
reconnectTimer = setTimeout(() => {
|
||||
if (!started) return
|
||||
connectSse()
|
||||
}, 5000)
|
||||
}
|
||||
}
|
||||
|
||||
if (store.sseFailures >= SSE_FAILURES_BEFORE_POLLING) startPolling()
|
||||
refreshStatus()
|
||||
}
|
||||
}
|
||||
|
||||
function checkStale() {
|
||||
if (!import.meta.client || !started) return
|
||||
const sseOpen = source?.readyState === EventSource.OPEN
|
||||
if (sseOpen && store.lastEventAt) {
|
||||
const age = Date.now() - Date.parse(store.lastEventAt)
|
||||
if (age > SSE_STALE_MS) {
|
||||
// Connection is open but no ping arrived: Cloudflare/path buffering.
|
||||
// Polling is the contract fallback; retry SSE once a minute.
|
||||
store.sseFailures = Math.max(store.sseFailures, SSE_FAILURES_BEFORE_POLLING)
|
||||
startPolling()
|
||||
refreshStatus()
|
||||
if (Date.now() - lastStaleRetry > 60000) {
|
||||
lastStaleRetry = Date.now()
|
||||
connectSse()
|
||||
}
|
||||
}
|
||||
}
|
||||
if (store.pollFailures > 0) refreshStatus()
|
||||
}
|
||||
|
||||
function start() {
|
||||
if (!import.meta.client || started) return
|
||||
started = true
|
||||
store.sseFailures = 0
|
||||
store.pollFailures = 0
|
||||
store.lastEventAt = ''
|
||||
store.error = ''
|
||||
store.status = 'connecting'
|
||||
window.addEventListener('online', handleOnline)
|
||||
window.addEventListener('offline', handleOffline)
|
||||
staleTimer = setInterval(checkStale, 5000)
|
||||
connectSse()
|
||||
}
|
||||
|
||||
function stop() {
|
||||
if (!import.meta.client) return
|
||||
started = false
|
||||
closeSource()
|
||||
clearPolling()
|
||||
if (staleTimer) clearInterval(staleTimer)
|
||||
staleTimer = null
|
||||
window.removeEventListener('online', handleOnline)
|
||||
window.removeEventListener('offline', handleOffline)
|
||||
store.status = 'connecting'
|
||||
}
|
||||
|
||||
function handleOnline() {
|
||||
if (!started) return
|
||||
store.pollFailures = 0
|
||||
connectSse()
|
||||
void pollScenario()
|
||||
}
|
||||
|
||||
function handleOffline() {
|
||||
if (!started) return
|
||||
store.status = 'offline'
|
||||
if (pollTimer) clearInterval(pollTimer)
|
||||
pollTimer = null
|
||||
}
|
||||
|
||||
/**
|
||||
* Subscribe the current page to the Go scenario stream through Nitro.
|
||||
*
|
||||
* The first render uses `initial` from SSR; after mount the composable opens
|
||||
* `/api/stream`, shows Live/Polling/Offline, and falls back to GET
|
||||
* /api/scenario every 5 s when SSE fails or is buffered.
|
||||
*/
|
||||
export function useLiveScenario(initial?: ScenarioState | null) {
|
||||
const initialScenario = initial ?? null
|
||||
|
||||
const current = computed<ScenarioState | null>(() => store.serverScenario ?? initialScenario)
|
||||
const scenarioId = computed(() => current.value?.scenario.scenario ?? 'base')
|
||||
const status = computed(() => store.status)
|
||||
const statusLabel = computed(() => LIVE_LABELS[store.status])
|
||||
|
||||
onMounted(() => {
|
||||
// Seed after hydration so the first client paint matches the SSR HTML.
|
||||
if (initialScenario && !store.serverScenario) store.serverScenario = initialScenario
|
||||
subscribers += 1
|
||||
start()
|
||||
})
|
||||
onBeforeUnmount(() => {
|
||||
subscribers = Math.max(0, subscribers - 1)
|
||||
if (subscribers === 0) stop()
|
||||
})
|
||||
|
||||
return reactive({
|
||||
scenario: current,
|
||||
scenarioId,
|
||||
version: computed(() => current.value?.version ?? 0),
|
||||
scenarioAt: computed(() => current.value?.at ?? ''),
|
||||
status,
|
||||
statusLabel,
|
||||
lastEventAt: computed(() => store.lastEventAt),
|
||||
lastPollAt: computed(() => store.lastPollAt),
|
||||
error: computed(() => store.error),
|
||||
revision: computed(() => store.revision),
|
||||
pollNow: pollScenario,
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
<script setup lang="ts">
|
||||
import { iconCircleInformation, iconShieldUser, iconTriangleWarning } from '@sit-onyx/icons'
|
||||
import type { MetaResponse } from '#shared/types'
|
||||
import { formatDate, formatDateTime, formatPercent } from '~/utils/format'
|
||||
|
||||
useHead({ title: 'About the data and limits — PulseCast' })
|
||||
|
||||
const { data: meta } = await useFetch<MetaResponse>('/api/meta')
|
||||
|
||||
const config = useRuntimeConfig()
|
||||
const usingMock = computed(() => ['1', 'true'].includes(String(config.public.useMock).toLowerCase()))
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="page page-stack">
|
||||
<header class="page-header">
|
||||
<div>
|
||||
<p class="eyebrow">About · method, data and limits</p>
|
||||
<OnyxHeadline is="h1">A decision aid, not a city-wide truth.</OnyxHeadline>
|
||||
<p class="lede">
|
||||
PulseCast turns a footfall forecast into a next-week staffing plan. The forecast is a model output; the
|
||||
staffing rule is a transparent heuristic. Both are shown, editable, and bounded.
|
||||
</p>
|
||||
</div>
|
||||
<OnyxBadge color="warning">Hackathon prototype</OnyxBadge>
|
||||
</header>
|
||||
|
||||
<div class="summary-grid">
|
||||
<MetricCard
|
||||
label="Sensors"
|
||||
:value="String(meta?.coverage.sensors ?? 8)"
|
||||
hint="Fixed points in a 580 m inner-city cluster."
|
||||
:icon="iconCircleInformation"
|
||||
/>
|
||||
<MetricCard
|
||||
label="Model WAPE"
|
||||
:value="meta ? formatPercent(meta.metrics.wape, 1) : '—'"
|
||||
:badge="meta ? `baseline ${formatPercent(meta.metrics.baseline_wape, 1)}` : undefined"
|
||||
badge-color="success"
|
||||
hint="Time-based holdout, not a random split."
|
||||
/>
|
||||
<MetricCard
|
||||
label="R²"
|
||||
:value="meta ? meta.metrics.r2.toFixed(3) : '—'"
|
||||
:hint="meta ? `MAE ${meta.metrics.mae} devices/hour` : undefined"
|
||||
/>
|
||||
<MetricCard
|
||||
label="Cadence"
|
||||
:value="meta ? `${meta.coverage.cadence_min} min` : '—'"
|
||||
:hint="meta ? `${formatDate(meta.coverage.from)} → ${formatDate(meta.coverage.to)}` : undefined"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="split-grid">
|
||||
<div class="card-stack">
|
||||
<OnyxCard>
|
||||
<div class="card-header">
|
||||
<OnyxHeadline is="h2">How the plan is made</OnyxHeadline>
|
||||
<OnyxBadge color="info" density="compact">transparent heuristic</OnyxBadge>
|
||||
</div>
|
||||
<ol class="small" style="margin: 0; padding-left: 1.2rem; display: grid; gap: var(--onyx-density-sm)">
|
||||
<li>Forecast estimated devices per hour for the next 7 days.</li>
|
||||
<li>Divide by visitors per staff-hour, multiply by a safety factor, round up, apply minimum staff.</li>
|
||||
<li>Cover 10:00–20:00 with consecutive shift blocks; a block gets the peak requirement inside it.</li>
|
||||
<li>Score coverage, cost, over/understaffed hours and compare with a flat schedule.</li>
|
||||
<li>Show the weather, holiday and assumption drivers; let the manager edit and regenerate.</li>
|
||||
</ol>
|
||||
<div class="callout" style="margin-top: var(--onyx-density-md)">
|
||||
<p class="small" style="margin: 0">
|
||||
There is no POS, sales, queue, payroll or labour-cost feed. Cost is an assumption. The coverage score
|
||||
is high by construction because shift blocks cover their local peak; overstaffed hours are the honest
|
||||
trade-off.
|
||||
</p>
|
||||
</div>
|
||||
</OnyxCard>
|
||||
|
||||
<OnyxCard>
|
||||
<div class="card-header">
|
||||
<OnyxHeadline is="h2">Model and data coverage</OnyxHeadline>
|
||||
</div>
|
||||
<OnyxTable striped :table-attrs="{ style: 'min-width: 34rem' }">
|
||||
<template #head>
|
||||
<tr><th scope="col">Field</th><th scope="col">Value</th></tr>
|
||||
</template>
|
||||
<tr><th scope="row" style="text-align: left; font-weight: 600">Data version</th><td class="mono">{{ meta?.data_version ?? '—' }}</td></tr>
|
||||
<tr><th scope="row" style="text-align: left; font-weight: 600">Model version</th><td class="mono">{{ meta?.model_version ?? '—' }}</td></tr>
|
||||
<tr><th scope="row" style="text-align: left; font-weight: 600">Context version</th><td class="mono">{{ meta?.context_version ?? '—' }}</td></tr>
|
||||
<tr><th scope="row" style="text-align: left; font-weight: 600">Coverage</th><td>{{ meta ? `${formatDate(meta.coverage.from)} → ${formatDate(meta.coverage.to)}` : '—' }}</td></tr>
|
||||
<tr><th scope="row" style="text-align: left; font-weight: 600">Validation</th><td>{{ meta ? `WAPE ${formatPercent(meta.metrics.wape, 1)} · baseline ${formatPercent(meta.metrics.baseline_wape, 1)} · R² ${meta.metrics.r2}` : '—' }}</td></tr>
|
||||
<tr><th scope="row" style="text-align: left; font-weight: 600">Weather source</th><td>Open-Meteo archive + forecast via /api/context</td></tr>
|
||||
<tr><th scope="row" style="text-align: left; font-weight: 600">Holidays</th><td>Baden-Württemberg 2025–2026 public holidays</td></tr>
|
||||
</OnyxTable>
|
||||
<p class="small muted table-note">Meta comes from Go <code>/api/meta</code> through the Nitro proxy.</p>
|
||||
</OnyxCard>
|
||||
|
||||
<TrainModelCard />
|
||||
</div>
|
||||
|
||||
<aside class="card-stack">
|
||||
<OnyxCard>
|
||||
<div class="card-header">
|
||||
<OnyxHeadline is="h2">Limits</OnyxHeadline>
|
||||
<OnyxIcon :icon="iconTriangleWarning" size="24px" color="warning" />
|
||||
</div>
|
||||
<ul class="why-list">
|
||||
<li v-for="limit in meta?.limits ?? []" :key="limit">
|
||||
<OnyxIcon :icon="iconTriangleWarning" size="16px" color="warning" />
|
||||
<span>{{ limit }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
<p class="small muted table-note">
|
||||
Eight sensors in one pedestrian cluster cannot rank commercial zones across Heilbronn. There is no
|
||||
city-wide heatmap claim here.
|
||||
</p>
|
||||
</OnyxCard>
|
||||
|
||||
<OnyxCard>
|
||||
<div class="card-header">
|
||||
<OnyxHeadline is="h2">Privacy</OnyxHeadline>
|
||||
<OnyxIcon :icon="iconShieldUser" size="24px" color="primary" />
|
||||
</div>
|
||||
<ul class="small" style="margin: 0; padding-left: 1.1rem; display: grid; gap: var(--onyx-density-xs)">
|
||||
<li>No PII, MAC addresses or geolocation permission.</li>
|
||||
<li>No analytics, tracking cookies or local storage on public screens.</li>
|
||||
<li>Public read-only screens; control actions are authenticated separately.</li>
|
||||
<li>Raw challenge CSV and secrets stay out of this repository.</li>
|
||||
</ul>
|
||||
</OnyxCard>
|
||||
|
||||
<OnyxCard>
|
||||
<div class="card-header">
|
||||
<OnyxHeadline is="h3">Data source</OnyxHeadline>
|
||||
<OnyxBadge :color="usingMock ? 'warning' : 'success'" density="compact">
|
||||
{{ usingMock ? 'Mock mode' : 'Go API' }}
|
||||
</OnyxBadge>
|
||||
</div>
|
||||
<p v-if="usingMock" class="small muted" style="margin-top: 0">
|
||||
Explicit dev fallback: <code>NUXT_PUBLIC_USE_MOCK=1</code>. Mock JSON renders the app without the Go
|
||||
service; the plan heuristic is the shared implementation in <code>shared/staffing.ts</code>.
|
||||
</p>
|
||||
<p v-else class="small muted" style="margin-top: 0">
|
||||
The browser only talks to this Nuxt origin. Nitro proxies /api/* to the Go API at
|
||||
<code>NUXT_API_INTERNAL_BASE</code>; forecast, context and meta are served from there.
|
||||
</p>
|
||||
<p class="small muted" style="margin: 0">
|
||||
Last context update: {{ meta ? formatDateTime(meta.context_version) : '—' }}
|
||||
</p>
|
||||
</OnyxCard>
|
||||
</aside>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,269 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
iconArrowRight,
|
||||
iconCircleCheck,
|
||||
iconCircleX,
|
||||
iconPresentionBoard,
|
||||
iconSync,
|
||||
iconTriangleWarning,
|
||||
} from '@sit-onyx/icons'
|
||||
import { scenarioLabel } from '#shared/live'
|
||||
import type { ScenarioPreset, ScenarioState } from '#shared/types'
|
||||
import { apiErrorMessage, apiErrorStatus } from '~/utils/api-error'
|
||||
import { formatDateTime } from '~/utils/format'
|
||||
|
||||
useHead({ title: 'Presenter control — PulseCast' })
|
||||
|
||||
const { data: initialScenario } = await useFetch<ScenarioState>('/api/scenario')
|
||||
const { data: presets, error: presetsError } = await useFetch<ScenarioPreset[]>('/api/scenarios')
|
||||
|
||||
const live = useLiveScenario(initialScenario.value)
|
||||
const submitted = ref<ScenarioState | null>(null)
|
||||
const busy = ref('')
|
||||
const message = ref('')
|
||||
const errorMessage = ref('')
|
||||
|
||||
const current = computed(() => {
|
||||
const liveState = live.scenario
|
||||
const local = submitted.value
|
||||
if (!liveState) return local ?? initialScenario.value ?? null
|
||||
if (!local) return liveState
|
||||
// A remote presenter can move the stage on; always show the newer version.
|
||||
return liveState.version >= local.version ? liveState : local
|
||||
})
|
||||
const activeId = computed(() => current.value?.scenario.scenario ?? '')
|
||||
const presetList = computed(() => presets.value ?? [])
|
||||
|
||||
function applyBody(preset: ScenarioPreset) {
|
||||
return {
|
||||
scenario: preset.id,
|
||||
weather: preset.weather ?? {},
|
||||
event: preset.event,
|
||||
}
|
||||
}
|
||||
|
||||
async function apply(preset: ScenarioPreset) {
|
||||
if (busy.value) return
|
||||
busy.value = preset.id
|
||||
message.value = ''
|
||||
errorMessage.value = ''
|
||||
try {
|
||||
const response = await $fetch<ScenarioState>('/api/scenario', {
|
||||
method: 'POST',
|
||||
body: applyBody(preset),
|
||||
})
|
||||
submitted.value = response
|
||||
message.value = `${preset.label} is now live · version ${response.version}.`
|
||||
} catch (error) {
|
||||
errorMessage.value =
|
||||
apiErrorMessage(error, 'The scenario change failed. Check the Go API and control credentials.') +
|
||||
(apiErrorStatus(error) === 401 ? ' Reload this page to sign in again.' : '')
|
||||
} finally {
|
||||
busy.value = ''
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="page page-stack control-page">
|
||||
<header class="page-header">
|
||||
<div>
|
||||
<p class="eyebrow">Presenter control · not linked in public navigation</p>
|
||||
<OnyxHeadline is="h1">Change the scenario once. Every screen follows.</OnyxHeadline>
|
||||
<p class="lede">
|
||||
Each button POSTs to this Nuxt origin. Nitro attaches the Go control credentials server-side; the browser
|
||||
never sees them. <NuxtLink to="/stage">Stage</NuxtLink> and <NuxtLink to="/live">Live</NuxtLink> update through
|
||||
SSE, with a 5-second polling fallback.
|
||||
</p>
|
||||
</div>
|
||||
<div class="hero-actions">
|
||||
<LiveStatusBadge :status="live.status" :last-event-at="live.lastEventAt" />
|
||||
<OnyxBadge v-if="current" color="neutral" density="compact">v{{ current.version }}</OnyxBadge>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div v-if="errorMessage" class="callout callout--warning" role="alert">
|
||||
<OnyxIcon :icon="iconCircleX" size="16px" color="danger" />
|
||||
<span>{{ errorMessage }}</span>
|
||||
</div>
|
||||
<div v-if="message" class="callout" role="status">
|
||||
<OnyxIcon :icon="iconCircleCheck" size="16px" color="success" />
|
||||
<span>{{ message }}</span>
|
||||
</div>
|
||||
|
||||
<div class="split-grid">
|
||||
<div class="card-stack">
|
||||
<OnyxCard>
|
||||
<div class="card-header">
|
||||
<div>
|
||||
<OnyxHeadline is="h2">Scenario presets</OnyxHeadline>
|
||||
<p class="small muted" style="margin: 0">
|
||||
The enum is fixed by the API contract. Weather and event values match the demo narrative.
|
||||
</p>
|
||||
</div>
|
||||
<OnyxBadge color="info" density="compact">server proxy</OnyxBadge>
|
||||
</div>
|
||||
|
||||
<div v-if="presetList.length" class="scenario-grid">
|
||||
<button
|
||||
v-for="preset in presetList"
|
||||
:key="preset.id"
|
||||
type="button"
|
||||
class="scenario-button"
|
||||
:class="{ 'scenario-button--active': preset.id === activeId }"
|
||||
:disabled="Boolean(busy)"
|
||||
:aria-pressed="preset.id === activeId"
|
||||
@click="apply(preset)"
|
||||
>
|
||||
<span class="scenario-button__head">
|
||||
<strong>{{ preset.label }}</strong>
|
||||
<OnyxBadge v-if="preset.id === activeId" color="success" density="compact">on stage</OnyxBadge>
|
||||
<OnyxBadge v-else color="neutral" density="compact">{{ preset.short }}</OnyxBadge>
|
||||
</span>
|
||||
<span class="small muted">{{ preset.description }}</span>
|
||||
<span v-if="busy === preset.id" class="scenario-button__busy">
|
||||
<OnyxIcon :icon="iconSync" size="16px" color="primary" class="spin" />
|
||||
Broadcasting…
|
||||
</span>
|
||||
<span v-else class="scenario-button__action">
|
||||
Apply
|
||||
<OnyxIcon :icon="iconArrowRight" size="16px" color="primary" />
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div v-else class="callout callout--warning">
|
||||
<OnyxIcon :icon="iconTriangleWarning" size="16px" color="warning" />
|
||||
Scenario presets could not be loaded.
|
||||
<span v-if="presetsError" class="muted">{{ presetsError.statusMessage }}</span>
|
||||
</div>
|
||||
</OnyxCard>
|
||||
|
||||
<OnyxCard>
|
||||
<div class="card-header">
|
||||
<OnyxHeadline is="h2">Open the audience views</OnyxHeadline>
|
||||
<OnyxIcon :icon="iconPresentionBoard" size="24px" color="primary" />
|
||||
</div>
|
||||
<div class="hero-actions">
|
||||
<OnyxButton label="Open /stage" link="/stage" color="primary" />
|
||||
<OnyxButton label="Open /live" link="/live" mode="outline" />
|
||||
<OnyxButton label="Open /plan" link="/plan" mode="outline" />
|
||||
</div>
|
||||
<p class="small muted table-note">
|
||||
Put <code>/stage</code> on the projector and let the audience scan the QR code. <code>/live</code> needs no
|
||||
login and keeps the last known plan if the stream drops.
|
||||
</p>
|
||||
</OnyxCard>
|
||||
</div>
|
||||
|
||||
<aside class="card-stack">
|
||||
<OnyxCard>
|
||||
<div class="card-header">
|
||||
<OnyxHeadline is="h2">Current scenario</OnyxHeadline>
|
||||
<LiveStatusBadge :status="live.status" :last-event-at="live.lastEventAt" compact />
|
||||
</div>
|
||||
<p class="control-current">{{ current ? scenarioLabel(current.scenario.scenario) : 'Unavailable' }}</p>
|
||||
<dl class="metric-list">
|
||||
<div><dt>Version</dt><dd>{{ current?.version ?? '—' }}</dd></div>
|
||||
<div><dt>Broadcast at</dt><dd>{{ current ? formatDateTime(current.at) : '—' }}</dd></div>
|
||||
<div><dt>Last SSE event</dt><dd>{{ live.lastEventAt ? formatDateTime(live.lastEventAt) : '—' }}</dd></div>
|
||||
<div><dt>Transport</dt><dd>{{ live.statusLabel }}</dd></div>
|
||||
</dl>
|
||||
<p v-if="live.error" class="small muted table-note">{{ live.error }}</p>
|
||||
</OnyxCard>
|
||||
|
||||
<OnyxCard>
|
||||
<div class="card-header">
|
||||
<OnyxHeadline is="h3">What the presenter says</OnyxHeadline>
|
||||
</div>
|
||||
<ul class="why-list">
|
||||
<li><span><strong>Base week</strong> — normal weather, no event uplift.</span></li>
|
||||
<li><span><strong>Sunny Saturday + market</strong> — the Saturday plan should add staff.</span></li>
|
||||
<li><span><strong>Rainy Saturday</strong> — the Saturday plan should shed staff.</span></li>
|
||||
<li><span><strong>Wednesday event</strong> — the weekday evening block should rise.</span></li>
|
||||
</ul>
|
||||
<p class="small muted table-note">
|
||||
If the numbers do not move on stage, check the <code>cached</code> badge: Go may be serving its last good
|
||||
forecast because the ML service is down.
|
||||
</p>
|
||||
</OnyxCard>
|
||||
</aside>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.control-current {
|
||||
margin: 0 0 var(--onyx-density-md);
|
||||
color: var(--onyx-color-text-icons-primary-intense);
|
||||
font-size: clamp(1.6rem, 3vw, 2.4rem);
|
||||
font-weight: 700;
|
||||
line-height: 1.1;
|
||||
}
|
||||
|
||||
.scenario-button {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--onyx-density-xs);
|
||||
width: 100%;
|
||||
padding: var(--onyx-density-md);
|
||||
border: 1px solid var(--onyx-color-base-neutral-300);
|
||||
border-radius: var(--onyx-radius-component-container-soft);
|
||||
background: var(--onyx-color-base-neutral-100);
|
||||
color: inherit;
|
||||
font: inherit;
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.scenario-button:hover:not(:disabled),
|
||||
.scenario-button:focus-visible {
|
||||
border-color: var(--onyx-color-base-primary-500);
|
||||
outline: 2px solid var(--onyx-color-base-primary-300);
|
||||
outline-offset: 1px;
|
||||
}
|
||||
|
||||
.scenario-button:disabled {
|
||||
cursor: progress;
|
||||
opacity: 0.65;
|
||||
}
|
||||
|
||||
.scenario-button--active {
|
||||
border-color: var(--onyx-color-base-primary-600);
|
||||
background: var(--onyx-color-base-primary-100);
|
||||
}
|
||||
|
||||
.scenario-button__head,
|
||||
.scenario-button__action,
|
||||
.scenario-button__busy {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: var(--onyx-density-xs);
|
||||
}
|
||||
|
||||
.scenario-button__action,
|
||||
.scenario-button__busy {
|
||||
justify-content: flex-start;
|
||||
margin-top: var(--onyx-density-xs);
|
||||
color: var(--onyx-color-text-icons-neutral-medium);
|
||||
font-size: 0.8125rem;
|
||||
}
|
||||
|
||||
.spin {
|
||||
animation: spin 0.9s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.spin {
|
||||
animation: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,320 @@
|
||||
<script setup lang="ts">
|
||||
import { iconCalendar, iconChart, iconTriangleWarning } from '@sit-onyx/icons'
|
||||
import { dailyWeather } from '#shared/insights'
|
||||
import { berlinParts, planWeekStart, STANDARD_VISITORS_PER_STAFF_HOUR } from '#shared/staffing'
|
||||
import type { ContextResponse, ForecastResponse, MetaResponse, Point, Scenario, ScenarioPreset, ScenarioState, Sensor } from '#shared/types'
|
||||
import { formatDate, formatNumber, formatPercent, formatShortDate, formatWeekday, formatWeekdayShort, weekLabel } from '~/utils/format'
|
||||
|
||||
useHead({ title: 'Forecast — PulseCast' })
|
||||
|
||||
const config = useRuntimeConfig()
|
||||
const demoNow = String(config.public.demoNow)
|
||||
const weekStart = planWeekStart(demoNow)
|
||||
const weekEnd = new Date(new Date(`${weekStart}T12:00:00Z`).getTime() + 6 * 86400000)
|
||||
.toISOString()
|
||||
.slice(0, 10)
|
||||
|
||||
const sensorId = ref('hn-stadtgalerie-01')
|
||||
const scenario = ref<Scenario>('base')
|
||||
|
||||
const { data: sensors } = await useFetch<Sensor[]>('/api/sensors')
|
||||
const { data: context } = await useFetch<ContextResponse>('/api/context')
|
||||
const { data: meta } = await useFetch<MetaResponse>('/api/meta')
|
||||
const { data: presets } = await useFetch<ScenarioPreset[]>('/api/scenarios')
|
||||
const { data: liveScenarioState } = await useFetch<ScenarioState>('/api/scenario')
|
||||
const live = useLiveScenario(liveScenarioState.value)
|
||||
scenario.value = live.scenarioId
|
||||
|
||||
sensorId.value =
|
||||
sensors.value?.find((sensor) => sensor.id === 'hn-stadtgalerie-01')?.id ??
|
||||
sensors.value?.[0]?.id ??
|
||||
sensorId.value
|
||||
|
||||
const {
|
||||
data: forecast,
|
||||
error: forecastError,
|
||||
refresh: refreshForecast,
|
||||
} = await useFetch<ForecastResponse>('/api/forecast', {
|
||||
query: computed(() => ({ sensor: sensorId.value, horizon: '7d', scenario: scenario.value })),
|
||||
})
|
||||
|
||||
watch(
|
||||
() => live.revision,
|
||||
() => {
|
||||
if (live.scenarioId !== scenario.value) scenario.value = live.scenarioId
|
||||
else void refreshForecast()
|
||||
},
|
||||
)
|
||||
|
||||
const activeSensor = computed(() => sensors.value?.find((sensor) => sensor.id === sensorId.value))
|
||||
const sensorOptions = computed(() =>
|
||||
(sensors.value ?? []).map((sensor) => ({ value: sensor.id, label: sensor.name })),
|
||||
)
|
||||
const scenarioOptions = computed(() =>
|
||||
(presets.value ?? []).map((preset) => ({ value: preset.id, label: preset.label })),
|
||||
)
|
||||
|
||||
interface DayForecast {
|
||||
date: string
|
||||
points: Point[]
|
||||
mean: number
|
||||
peak: number
|
||||
peakHour: number
|
||||
weather?: ReturnType<typeof dailyWeather>[string]
|
||||
requiredAtPeak: number
|
||||
}
|
||||
|
||||
const days = computed<DayForecast[]>(() => {
|
||||
const grouped: Record<string, Point[]> = {}
|
||||
for (const point of forecast.value?.points ?? []) {
|
||||
const { date } = berlinParts(point.t)
|
||||
;(grouped[date] ??= []).push(point)
|
||||
}
|
||||
const weather = dailyWeather(context.value?.weather.forecast ?? [])
|
||||
return Object.keys(grouped)
|
||||
.sort()
|
||||
.map((date) => {
|
||||
const points = grouped[date]!
|
||||
const peakPoint = points.reduce((best, point) => (point.v > best.v ? point : best))
|
||||
const mean = points.reduce((sum, point) => sum + point.v, 0) / points.length
|
||||
return {
|
||||
date,
|
||||
points,
|
||||
mean: Math.round(mean),
|
||||
peak: peakPoint.v,
|
||||
peakHour: berlinParts(peakPoint.t).hour,
|
||||
weather: weather[date],
|
||||
requiredAtPeak: Math.max(
|
||||
1,
|
||||
Math.ceil((peakPoint.v / STANDARD_VISITORS_PER_STAFF_HOUR.standard) * 1.15),
|
||||
),
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
const weekPeak = computed(() =>
|
||||
days.value.length ? days.value.reduce((best, day) => (day.peak > best.peak ? day : best)) : undefined,
|
||||
)
|
||||
const dayMax = computed(() => Math.max(...days.value.map((day) => day.peak), 1))
|
||||
// The API 7-day window starts at the current hour, so it spans up to eight
|
||||
// calendar days. Label the real window instead of the Monday plan week.
|
||||
const forecastStart = computed(() => days.value[0]?.date ?? weekStart)
|
||||
const forecastEnd = computed(() => days.value.at(-1)?.date ?? weekEnd)
|
||||
const forecastWindow = computed(() => weekLabel(forecastStart.value, forecastEnd.value))
|
||||
const weekWeather = computed(() =>
|
||||
Object.values(dailyWeather(context.value?.weather.forecast ?? []))
|
||||
.filter((day) => day.date >= forecastStart.value && day.date <= forecastEnd.value)
|
||||
.sort((a, b) => a.date.localeCompare(b.date)),
|
||||
)
|
||||
const total = computed(() => days.value.reduce((sum, day) => sum + day.mean, 0))
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="page page-stack">
|
||||
<header class="page-header">
|
||||
<div>
|
||||
<p class="eyebrow">Forecast · {{ forecastWindow }}</p>
|
||||
<OnyxHeadline is="h1">Next week peaks on {{ weekPeak ? formatWeekday(weekPeak.date) : '—' }}.</OnyxHeadline>
|
||||
<p class="lede">
|
||||
A 168-hour forecast for <strong>{{ activeSensor?.name ?? 'the selected store' }}</strong>, aggregated by
|
||||
day. The decision, shift blocks and hourly coverage are on <NuxtLink to="/plan">Plan</NuxtLink>.
|
||||
</p>
|
||||
</div>
|
||||
<div class="forecast-header-controls">
|
||||
<LiveStatusBadge :status="live.status" :last-event-at="live.lastEventAt" />
|
||||
<div style="min-width: 14rem">
|
||||
<OnyxSelect
|
||||
v-model="sensorId"
|
||||
label="Sensor"
|
||||
list-label="Inner-city sensors"
|
||||
:options="sensorOptions"
|
||||
density="compact"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div v-if="forecastError" class="callout callout--warning" role="alert">
|
||||
<OnyxIcon :icon="iconTriangleWarning" size="16px" color="warning" />
|
||||
The forecast could not be loaded. <span class="muted">{{ forecastError.statusMessage }}</span>
|
||||
<OnyxButton label="Retry" mode="plain" density="compact" @click="refreshForecast()" />
|
||||
</div>
|
||||
<div v-else-if="forecast && !days.length" class="callout callout--warning" role="status">
|
||||
<OnyxIcon :icon="iconTriangleWarning" size="16px" color="warning" />
|
||||
No forecast points are available for this store yet. Try another sensor.
|
||||
</div>
|
||||
|
||||
<OnyxCard>
|
||||
<div class="card-header">
|
||||
<div>
|
||||
<OnyxHeadline is="h2">Daily shape</OnyxHeadline>
|
||||
<p class="small muted" style="margin: 0">
|
||||
Peak estimated devices per hour. Weather is context, not a causal claim.
|
||||
</p>
|
||||
</div>
|
||||
<div style="min-width: 15rem">
|
||||
<OnyxSelect
|
||||
v-model="scenario"
|
||||
label="Scenario"
|
||||
list-label="Demo scenarios"
|
||||
:options="scenarioOptions"
|
||||
density="compact"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="forecast-bars" role="img" aria-label="Daily peak forecast">
|
||||
<div v-for="day in days" :key="day.date" class="forecast-bar">
|
||||
<span class="small muted">{{ formatNumber(day.peak) }}</span>
|
||||
<div class="forecast-bar__track">
|
||||
<div class="forecast-bar__fill" :style="{ height: `${Math.max(4, (day.peak / dayMax) * 100)}%` }" />
|
||||
</div>
|
||||
<strong>{{ formatWeekdayShort(day.date) }}</strong>
|
||||
<span class="small muted">{{ formatShortDate(day.date) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<OnyxTable striped with-page-scrolling :table-attrs="{ style: 'min-width: 46rem' }" style="margin-top: var(--onyx-density-lg)">
|
||||
<template #head>
|
||||
<tr>
|
||||
<th scope="col">Day</th>
|
||||
<th scope="col">Mean</th>
|
||||
<th scope="col">Peak</th>
|
||||
<th scope="col">Peak hour</th>
|
||||
<th scope="col">80% band at peak</th>
|
||||
<th scope="col">Weather</th>
|
||||
<th scope="col">Staff at peak</th>
|
||||
</tr>
|
||||
</template>
|
||||
<tr v-for="day in days" :key="day.date">
|
||||
<th scope="row" style="text-align: left; font-weight: 600">
|
||||
{{ formatWeekday(day.date) }}
|
||||
<span class="muted" style="font-weight: 400">{{ formatShortDate(day.date) }}</span>
|
||||
<OnyxBadge v-if="day.date === weekPeak?.date" color="warning" density="compact" style="margin-left: 0.35rem">peak</OnyxBadge>
|
||||
</th>
|
||||
<td>{{ formatNumber(day.mean) }}</td>
|
||||
<td>{{ formatNumber(day.peak) }}</td>
|
||||
<td>{{ String(day.peakHour).padStart(2, '0') }}:00</td>
|
||||
<td>{{ formatNumber(day.points.find((point) => point.v === day.peak)?.lo ?? 0) }}–{{ formatNumber(day.points.find((point) => point.v === day.peak)?.hi ?? 0) }}</td>
|
||||
<td>
|
||||
<template v-if="day.weather">
|
||||
{{ Math.round(day.weather.tempMin) }}–{{ Math.round(day.weather.tempMax) }} °C · {{ day.weather.precipMm.toFixed(1) }} mm
|
||||
</template>
|
||||
<span v-else class="muted">outside weather window</span>
|
||||
</td>
|
||||
<td><OnyxBadge color="neutral" density="compact">{{ day.requiredAtPeak }}</OnyxBadge></td>
|
||||
</tr>
|
||||
</OnyxTable>
|
||||
|
||||
<p class="small muted table-note">
|
||||
Scroll the table sideways on a phone for the uncertainty band and staffing columns. Weekly mean
|
||||
{{ formatNumber(total) }} estimated devices/hour across open+closed hours. Staff at peak uses 25
|
||||
visitors/staff-hour × 1.15; the plan can use a different standard.
|
||||
</p>
|
||||
</OnyxCard>
|
||||
|
||||
<div class="split-grid">
|
||||
<OnyxCard>
|
||||
<div class="card-header">
|
||||
<OnyxHeadline is="h2">Weather strip</OnyxHeadline>
|
||||
<OnyxBadge color="neutral" density="compact">Open-Meteo context</OnyxBadge>
|
||||
</div>
|
||||
<WeatherStrip :days="weekWeather" />
|
||||
<p v-if="!weekWeather.length" class="small muted table-note">
|
||||
The weather window does not cover the plan week.
|
||||
</p>
|
||||
<p class="small muted table-note">
|
||||
Weather is the main accuracy driver in the model. Holidays are context and a smaller feature.
|
||||
</p>
|
||||
</OnyxCard>
|
||||
|
||||
<OnyxCard>
|
||||
<div class="card-header">
|
||||
<OnyxHeadline is="h2">Read it honestly</OnyxHeadline>
|
||||
<OnyxIcon :icon="iconChart" size="24px" color="primary" />
|
||||
</div>
|
||||
<ul class="why-list">
|
||||
<li>
|
||||
<OnyxIcon :icon="iconCalendar" size="16px" color="primary" />
|
||||
<span>168 hourly points from the API 7-day horizon, not a live stream.</span>
|
||||
</li>
|
||||
<li>
|
||||
<OnyxIcon :icon="iconChart" size="16px" color="primary" />
|
||||
<span>
|
||||
Mean WAPE {{ meta ? formatPercent(meta.metrics.wape, 1) : '—' }} vs
|
||||
{{ meta ? formatPercent(meta.metrics.baseline_wape, 1) : '—' }} seasonal naive in the API meta;
|
||||
per-hour uncertainty is real.
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<OnyxIcon :icon="iconCalendar" size="16px" color="primary" />
|
||||
<span>
|
||||
Forecast covers {{ formatDate(forecastStart) }} → {{ formatDate(forecastEnd) }} in Europe/Berlin.
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
<OnyxButton label="Turn this into a plan" link="/plan" color="primary" style="margin-top: var(--onyx-density-md)" />
|
||||
</OnyxCard>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.forecast-bars {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(4.5rem, 1fr));
|
||||
gap: var(--onyx-density-xs);
|
||||
align-items: end;
|
||||
min-height: 13rem;
|
||||
}
|
||||
|
||||
.forecast-bar {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 0.2rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.forecast-bar strong {
|
||||
font-size: 0.8125rem;
|
||||
}
|
||||
|
||||
.forecast-bar__track {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
height: 8rem;
|
||||
align-items: flex-end;
|
||||
border-radius: 3px;
|
||||
background: var(--onyx-color-base-neutral-200);
|
||||
}
|
||||
|
||||
.forecast-bar__fill {
|
||||
width: 100%;
|
||||
border-radius: 3px 3px 0 0;
|
||||
background: var(--onyx-color-base-primary-500);
|
||||
}
|
||||
|
||||
.forecast-header-controls {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-end;
|
||||
gap: var(--onyx-density-sm);
|
||||
}
|
||||
|
||||
@media (max-width: 576px) {
|
||||
.forecast-bars {
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: var(--onyx-density-2xs);
|
||||
}
|
||||
|
||||
.forecast-bar strong {
|
||||
font-size: 0.7rem;
|
||||
}
|
||||
|
||||
.forecast-bar .small {
|
||||
font-size: 0.65rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,269 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
iconCalendar,
|
||||
iconCloud,
|
||||
iconLocationPin,
|
||||
iconSunny,
|
||||
iconTriangleWarning,
|
||||
} from '@sit-onyx/icons'
|
||||
import { weatherKind } from '#shared/insights'
|
||||
import { berlinParts } from '#shared/staffing'
|
||||
import type { ContextResponse, MetaResponse, Sensor, SeriesResponse } from '#shared/types'
|
||||
import {
|
||||
formatDate,
|
||||
formatDateTime,
|
||||
formatNumber,
|
||||
formatPercent,
|
||||
formatShortDate,
|
||||
formatTime,
|
||||
} from '~/utils/format'
|
||||
|
||||
useHead({ title: 'Now in Heilbronn — PulseCast' })
|
||||
|
||||
const config = useRuntimeConfig()
|
||||
const demoNow = String(config.public.demoNow)
|
||||
|
||||
const { data: sensors } = await useFetch<Sensor[]>('/api/sensors')
|
||||
const { data: context } = await useFetch<ContextResponse>('/api/context')
|
||||
const { data: meta } = await useFetch<MetaResponse>('/api/meta')
|
||||
const sensorId = ref(
|
||||
sensors.value?.find((sensor) => sensor.id === 'hn-stadtgalerie-01')?.id ??
|
||||
sensors.value?.[0]?.id ??
|
||||
'hn-stadtgalerie-01',
|
||||
)
|
||||
const { data: series } = await useFetch<SeriesResponse>('/api/series', {
|
||||
query: computed(() => ({ sensor: sensorId.value, step: '1h' })),
|
||||
})
|
||||
|
||||
const activeSensor = computed(() => sensors.value?.find((sensor) => sensor.id === sensorId.value))
|
||||
const sensorOptions = computed(() =>
|
||||
(sensors.value ?? []).map((sensor) => ({ value: sensor.id, label: sensor.name })),
|
||||
)
|
||||
|
||||
const lastPoint = computed(() => series.value?.points.at(-1))
|
||||
const previousPoint = computed(() => series.value?.points.at(-25))
|
||||
const deltaPct = computed(() => {
|
||||
if (!lastPoint.value || !previousPoint.value || previousPoint.value.v === 0) return 0
|
||||
return ((lastPoint.value.v - previousPoint.value.v) / previousPoint.value.v) * 100
|
||||
})
|
||||
const last24 = computed(() => series.value?.points.slice(-24) ?? [])
|
||||
const barMax = computed(() => Math.max(...last24.value.map((point) => point.v), 1))
|
||||
|
||||
const nowWeather = computed(() => context.value?.weather.now)
|
||||
const weatherIcon = computed(() =>
|
||||
nowWeather.value && weatherKind(nowWeather.value) === 'sunny' ? iconSunny : iconCloud,
|
||||
)
|
||||
const weatherLabel = computed(() => {
|
||||
if (!nowWeather.value) return '—'
|
||||
const kind = weatherKind(nowWeather.value)
|
||||
return kind === 'sunny' ? 'Sunny' : kind === 'partly-cloudy' ? 'Partly cloudy' : kind === 'rain' ? 'Rain' : 'Cloudy'
|
||||
})
|
||||
|
||||
const today = berlinParts(demoNow).date
|
||||
const todayHoliday = computed(() => context.value?.holidays.find((holiday) => holiday.date === today))
|
||||
const lastHoliday = computed(() =>
|
||||
context.value?.holidays.filter((holiday) => holiday.date < today).at(-1),
|
||||
)
|
||||
const nextHoliday = computed(() =>
|
||||
context.value?.holidays.find((holiday) => holiday.date > today),
|
||||
)
|
||||
|
||||
const latestPulse = computed(() => {
|
||||
if (!sensors.value?.length) return 0
|
||||
return Math.round(sensors.value.reduce((sum, sensor) => sum + sensor.mean, 0) / sensors.value.length)
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="page page-stack">
|
||||
<header class="page-header">
|
||||
<div>
|
||||
<p class="eyebrow">Now · replay clock {{ formatDateTime(demoNow) }}</p>
|
||||
<OnyxHeadline is="h1">The pulse is in the pedestrian core.</OnyxHeadline>
|
||||
<p class="lede">
|
||||
Eight fixed sensors around Stadtgalerie and Kaiserstraße. This is estimated device density, not people,
|
||||
and not a city-wide heatmap. The decision lives on <NuxtLink to="/plan">Plan</NuxtLink>.
|
||||
</p>
|
||||
</div>
|
||||
<div class="hero-actions">
|
||||
<OnyxBadge color="warning">Replay, not live</OnyxBadge>
|
||||
<OnyxBadge color="neutral" density="compact">{{ sensors?.length ?? 8 }} sensors</OnyxBadge>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="split-grid">
|
||||
<div class="card-stack">
|
||||
<OnyxCard>
|
||||
<div class="card-header">
|
||||
<div>
|
||||
<OnyxHeadline is="h2">Latest replay reading</OnyxHeadline>
|
||||
<p class="small muted" style="margin: 0">Last available hour in the API series.</p>
|
||||
</div>
|
||||
<div style="min-width: 12rem">
|
||||
<OnyxSelect
|
||||
v-model="sensorId"
|
||||
label="Sensor"
|
||||
list-label="Inner-city sensors"
|
||||
:options="sensorOptions"
|
||||
density="compact"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="reading-row">
|
||||
<p class="reading-value">{{ lastPoint ? formatNumber(lastPoint.v) : '—' }}</p>
|
||||
<div>
|
||||
<p style="margin: 0; font-weight: 600">estimated devices / hour</p>
|
||||
<p class="small muted" style="margin: 0">
|
||||
{{ activeSensor?.name }} · {{ activeSensor?.id }}
|
||||
</p>
|
||||
<OnyxBadge :color="deltaPct >= 0 ? 'success' : 'warning'" density="compact">
|
||||
{{ deltaPct >= 0 ? '+' : '' }}{{ formatPercent(deltaPct, 0) }} vs 24 h earlier
|
||||
</OnyxBadge>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="bar-chart" role="img" :aria-label="`Last 24 hours for ${activeSensor?.name}`">
|
||||
<div
|
||||
v-for="(point, index) in last24"
|
||||
:key="point.t"
|
||||
class="bar-chart__bar"
|
||||
:class="{ 'bar-chart__bar--now': index === last24.length - 1 }"
|
||||
:style="{ height: `${Math.max(4, (point.v / barMax) * 100)}%` }"
|
||||
:title="`${formatTime(point.t)} · ${point.v}`"
|
||||
/>
|
||||
</div>
|
||||
<div class="legend" style="justify-content: space-between; margin-top: var(--onyx-density-2xs)">
|
||||
<span class="small muted">{{ last24[0] ? formatTime(last24[0].t) : '—' }}</span>
|
||||
<span class="small muted">{{ lastPoint ? formatDateTime(lastPoint.t) : '—' }}</span>
|
||||
</div>
|
||||
|
||||
<p class="small muted table-note">
|
||||
This is a replay snapshot, not a live sensor feed. The replay clock is
|
||||
{{ formatDateTime(demoNow) }}; the last measured point is
|
||||
{{ lastPoint ? formatDateTime(lastPoint.t) : '—' }}.
|
||||
</p>
|
||||
</OnyxCard>
|
||||
|
||||
<OnyxCard>
|
||||
<div class="card-header">
|
||||
<div>
|
||||
<OnyxHeadline is="h2">Sensor cluster</OnyxHeadline>
|
||||
<p class="small muted" style="margin: 0">
|
||||
Select a sensor to update the reading. Positions are relative; this is not a geographic map.
|
||||
</p>
|
||||
</div>
|
||||
<OnyxBadge color="info" density="compact">580 m cluster</OnyxBadge>
|
||||
</div>
|
||||
<SensorClusterMap :sensors="sensors ?? []" :active-id="sensorId" @select="sensorId = $event" />
|
||||
</OnyxCard>
|
||||
</div>
|
||||
|
||||
<aside class="card-stack">
|
||||
<OnyxCard>
|
||||
<div class="card-header">
|
||||
<OnyxHeadline is="h2">Heilbronn weather</OnyxHeadline>
|
||||
<OnyxBadge color="neutral" density="compact">Open-Meteo context</OnyxBadge>
|
||||
</div>
|
||||
<div class="reading-row">
|
||||
<OnyxIcon :icon="weatherIcon" size="48px" color="primary" />
|
||||
<div>
|
||||
<p style="margin: 0; font-size: 2rem; font-weight: 700; line-height: 1">
|
||||
{{ nowWeather ? `${nowWeather.temp_c} °C` : '—' }}
|
||||
</p>
|
||||
<p class="small muted" style="margin: 0">{{ weatherLabel }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<dl class="metric-list" style="margin-top: var(--onyx-density-md)">
|
||||
<div><dt>Precipitation</dt><dd>{{ nowWeather?.precip_mm ?? '—' }} mm</dd></div>
|
||||
<div><dt>Cloud cover</dt><dd>{{ nowWeather?.cloud_pct ?? '—' }}%</dd></div>
|
||||
<div><dt>Wind</dt><dd>{{ nowWeather?.wind_kmh ?? '—' }} km/h</dd></div>
|
||||
<div><dt>Humidity</dt><dd>{{ nowWeather?.humidity_pct ?? '—' }}%</dd></div>
|
||||
</dl>
|
||||
<p class="small muted table-note">
|
||||
Updated {{ context ? formatDateTime(context.updated_at) : '—' }} · context
|
||||
{{ context?.cached ? 'cached' : 'live' }}
|
||||
</p>
|
||||
</OnyxCard>
|
||||
|
||||
<OnyxCard>
|
||||
<div class="card-header">
|
||||
<OnyxHeadline is="h2">Holiday context</OnyxHeadline>
|
||||
<OnyxIcon :icon="iconCalendar" size="24px" color="primary" />
|
||||
</div>
|
||||
<OnyxBadge v-if="todayHoliday" color="warning">{{ todayHoliday.name }} today</OnyxBadge>
|
||||
<OnyxBadge v-else color="success">No public holiday today</OnyxBadge>
|
||||
<p class="small muted" style="margin: var(--onyx-density-sm) 0 0">
|
||||
<template v-if="nextHoliday">
|
||||
Next: <strong>{{ nextHoliday.name }}</strong> on {{ formatDate(nextHoliday.date) }}.
|
||||
</template>
|
||||
<template v-else>No upcoming holiday in the holiday calendar.</template>
|
||||
</p>
|
||||
<p v-if="lastHoliday" class="small muted" style="margin: var(--onyx-density-xs) 0 0">
|
||||
Last: {{ lastHoliday.name }} on {{ formatShortDate(lastHoliday.date) }}.
|
||||
</p>
|
||||
<p class="small muted table-note">
|
||||
Baden-Württemberg public holidays; used as model context, not as a causal claim.
|
||||
</p>
|
||||
</OnyxCard>
|
||||
|
||||
<OnyxCard>
|
||||
<div class="card-header">
|
||||
<OnyxHeadline is="h3">What to do next</OnyxHeadline>
|
||||
<OnyxIcon :icon="iconLocationPin" size="24px" color="primary" />
|
||||
</div>
|
||||
<p class="small" style="margin-top: 0">
|
||||
The average sensor is at <strong>{{ latestPulse }}</strong> estimated devices/hour. That is context,
|
||||
not a staffing decision. Open the plan to turn next week’s forecast into shifts.
|
||||
</p>
|
||||
<OnyxButton label="Open the staffing plan" link="/plan" color="primary" />
|
||||
</OnyxCard>
|
||||
</aside>
|
||||
</div>
|
||||
|
||||
<OnyxCard>
|
||||
<div class="card-header">
|
||||
<div>
|
||||
<OnyxHeadline is="h2">Eight sensors</OnyxHeadline>
|
||||
<p class="small muted" style="margin: 0">Measured points, stable order by ID. Battery may be null in the API.</p>
|
||||
</div>
|
||||
<OnyxBadge color="neutral" density="compact">measured points only</OnyxBadge>
|
||||
</div>
|
||||
<OnyxTable striped with-page-scrolling :table-attrs="{ style: 'min-width: 36rem' }">
|
||||
<template #head>
|
||||
<tr>
|
||||
<th scope="col">Sensor</th>
|
||||
<th scope="col">Mean</th>
|
||||
<th scope="col">P95</th>
|
||||
<th scope="col">Battery</th>
|
||||
<th scope="col">Source ID</th>
|
||||
</tr>
|
||||
</template>
|
||||
<tr v-for="sensor in sensors" :key="sensor.id">
|
||||
<th scope="row" style="text-align: left; font-weight: 600">
|
||||
{{ sensor.name }}
|
||||
<OnyxBadge v-if="sensor.id === sensorId" color="primary" density="compact" style="margin-left: 0.35rem">selected</OnyxBadge>
|
||||
</th>
|
||||
<td>{{ sensor.mean }}</td>
|
||||
<td>{{ sensor.p95 }}</td>
|
||||
<td>
|
||||
<OnyxBadge :color="sensor.battery === null ? 'neutral' : sensor.battery >= 60 ? 'success' : 'warning'" density="compact">
|
||||
{{ sensor.battery === null ? 'n/a' : `${sensor.battery}%` }}
|
||||
</OnyxBadge>
|
||||
</td>
|
||||
<td class="mono">{{ sensor.id }}</td>
|
||||
</tr>
|
||||
</OnyxTable>
|
||||
|
||||
<p v-if="meta" class="small muted table-note">
|
||||
Coverage {{ formatDate(meta.coverage.from) }} → {{ formatDate(meta.coverage.to) }} ·
|
||||
{{ meta.coverage.cadence_min }}-min cadence · data {{ meta.data_version }} · model {{ meta.model_version }}
|
||||
</p>
|
||||
</OnyxCard>
|
||||
|
||||
<div v-if="!sensors?.length" class="callout callout--warning">
|
||||
<OnyxIcon :icon="iconTriangleWarning" size="16px" color="warning" />
|
||||
Sensor data is missing. Check that the Go API is running and that NUXT_API_INTERNAL_BASE points to it.
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,325 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
iconArrowRight,
|
||||
iconCircleInformation,
|
||||
iconMobileSignal,
|
||||
iconSync,
|
||||
iconTriangleWarning,
|
||||
iconUserGroup,
|
||||
} from '@sit-onyx/icons'
|
||||
import { scenarioLabel } from '#shared/live'
|
||||
import type { ScenarioState, Sensor, Shift, StaffingResponse } from '#shared/types'
|
||||
import { formatDateTime, formatEuro, formatNumber, formatPercent, formatShortDate, formatWeekday } from '~/utils/format'
|
||||
|
||||
useHead({ title: 'Live recommendation — PulseCast' })
|
||||
|
||||
const { data: sensors } = await useFetch<Sensor[]>('/api/sensors')
|
||||
const { data: initialScenario } = await useFetch<ScenarioState>('/api/scenario')
|
||||
|
||||
const sensorId = ref(
|
||||
sensors.value?.find((sensor) => sensor.id === 'hn-stadtgalerie-01')?.id ??
|
||||
sensors.value?.[0]?.id ??
|
||||
'hn-stadtgalerie-01',
|
||||
)
|
||||
const live = useLiveScenario(initialScenario.value)
|
||||
|
||||
const {
|
||||
data: planData,
|
||||
status: planStatus,
|
||||
error: planError,
|
||||
refresh: refreshPlan,
|
||||
} = await useFetch<StaffingResponse>('/api/staffing', {
|
||||
query: computed(() => ({
|
||||
sensor: sensorId.value,
|
||||
scenario: live.scenarioId,
|
||||
standard: 'standard',
|
||||
})),
|
||||
})
|
||||
|
||||
// Same scenario id with a new version: refresh because the query string does not move.
|
||||
let lastScenarioId = live.scenarioId
|
||||
watch(
|
||||
() => live.revision,
|
||||
() => {
|
||||
if (live.scenarioId === lastScenarioId) void refreshPlan()
|
||||
lastScenarioId = live.scenarioId
|
||||
},
|
||||
)
|
||||
|
||||
const plan = computed(() => planData.value ?? null)
|
||||
const activeSensor = computed(() => sensors.value?.find((sensor) => sensor.id === sensorId.value))
|
||||
|
||||
function maxOf<T>(items: T[], score: (item: T) => number): T | undefined {
|
||||
let best: T | undefined
|
||||
for (const item of items) if (!best || score(item) > score(best)) best = item
|
||||
return best
|
||||
}
|
||||
|
||||
const peakShift = computed<Shift | undefined>(() =>
|
||||
plan.value ? maxOf(plan.value.shifts, (shift) => shift.staff) : undefined,
|
||||
)
|
||||
const peakStaff = computed(() => peakShift.value?.staff ?? 0)
|
||||
const totalStaffHours = computed(() =>
|
||||
plan.value ? plan.value.hours.reduce((sum, hour) => sum + hour.scheduled_staff, 0) : 0,
|
||||
)
|
||||
const currentReason = computed(() => plan.value?.why[0] ?? '')
|
||||
const lastUpdate = computed(() => {
|
||||
if (live.scenarioAt) return live.scenarioAt
|
||||
return plan.value?.context_version ?? ''
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="page page-stack live-page">
|
||||
<header class="live-header">
|
||||
<div>
|
||||
<p class="eyebrow">Live · no login</p>
|
||||
<OnyxHeadline is="h1">The plan on your phone.</OnyxHeadline>
|
||||
<p class="lede">
|
||||
{{ activeSensor?.name ?? 'Stadtgalerie' }} · {{ scenarioLabel(live.scenarioId) }}. Updates arrive over SSE;
|
||||
if the stream drops, this page polls every 5 seconds.
|
||||
</p>
|
||||
</div>
|
||||
<div class="live-header__status">
|
||||
<LiveStatusBadge :status="live.status" :last-event-at="live.lastEventAt" />
|
||||
<OnyxBadge color="neutral" density="compact">v{{ live.version || '—' }}</OnyxBadge>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div v-if="planError" class="callout callout--warning" role="alert">
|
||||
<OnyxIcon :icon="iconTriangleWarning" size="18px" color="warning" />
|
||||
<div>
|
||||
<strong>The live plan is unavailable.</strong>
|
||||
<span class="muted"> {{ planError.statusMessage ?? 'The API did not answer.' }}</span>
|
||||
</div>
|
||||
<OnyxButton label="Retry" mode="outline" density="compact" :icon="iconSync" @click="refreshPlan()" />
|
||||
</div>
|
||||
|
||||
<div v-else-if="planStatus === 'pending' && !plan" class="callout">
|
||||
<OnyxIcon :icon="iconSync" size="18px" color="primary" />
|
||||
<span>Loading the current recommendation…</span>
|
||||
</div>
|
||||
|
||||
<div v-else-if="plan && !plan.shifts.length" class="callout callout--warning" role="status">
|
||||
<OnyxIcon :icon="iconTriangleWarning" size="18px" color="warning" />
|
||||
<span>No shift blocks are available yet. The presenter may still be preparing the plan.</span>
|
||||
</div>
|
||||
|
||||
<section class="live-hero" aria-labelledby="live-decision">
|
||||
<p class="live-hero__kicker"><OnyxIcon :icon="iconUserGroup" size="18px" color="primary" /> Current recommendation</p>
|
||||
<p id="live-decision" class="live-hero__value">
|
||||
<template v-if="plan">{{ peakStaff }} staff</template>
|
||||
<template v-else>No plan yet</template>
|
||||
</p>
|
||||
<p class="live-hero__shift">
|
||||
<template v-if="peakShift">
|
||||
<strong>{{ formatWeekday(peakShift.date) }} {{ formatShortDate(peakShift.date) }}</strong><br />
|
||||
{{ peakShift.start }}–{{ peakShift.end }} · peak shift
|
||||
</template>
|
||||
<template v-else>Waiting for the peak shift</template>
|
||||
</p>
|
||||
<p v-if="currentReason" class="live-hero__why">
|
||||
<OnyxIcon :icon="iconCircleInformation" size="16px" color="primary" />
|
||||
<span>{{ currentReason }}</span>
|
||||
</p>
|
||||
<OnyxButton
|
||||
label="Open the full plan"
|
||||
:link="`/plan?scenario=${live.scenarioId}`"
|
||||
color="primary"
|
||||
:icon="iconArrowRight"
|
||||
icon-position="right"
|
||||
/>
|
||||
</section>
|
||||
|
||||
<section class="live-metrics" aria-label="Plan at a glance">
|
||||
<div class="live-metric">
|
||||
<p class="live-metric__label">Staff-hours</p>
|
||||
<p class="live-metric__value">{{ plan ? formatNumber(totalStaffHours) : '—' }}</p>
|
||||
</div>
|
||||
<div class="live-metric">
|
||||
<p class="live-metric__label">Labour cost</p>
|
||||
<p class="live-metric__value">{{ plan ? formatEuro(plan.summary.cost_eur) : '—' }}</p>
|
||||
</div>
|
||||
<div class="live-metric">
|
||||
<p class="live-metric__label">Coverage</p>
|
||||
<p class="live-metric__value">{{ plan ? formatPercent(plan.summary.coverage_pct, 1) : '—' }}</p>
|
||||
</div>
|
||||
<div class="live-metric">
|
||||
<p class="live-metric__label">Understaffed</p>
|
||||
<p class="live-metric__value">{{ plan ? `${plan.summary.understaffed_hours} h` : '—' }}</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="live-status-card">
|
||||
<div class="live-status-card__row">
|
||||
<span class="live-status-card__label">Scenario</span>
|
||||
<strong>{{ scenarioLabel(live.scenarioId) }}</strong>
|
||||
</div>
|
||||
<div class="live-status-card__row">
|
||||
<span class="live-status-card__label">Version</span>
|
||||
<span>{{ live.version || '—' }}</span>
|
||||
</div>
|
||||
<div class="live-status-card__row">
|
||||
<span class="live-status-card__label">Last update</span>
|
||||
<span>{{ lastUpdate ? formatDateTime(lastUpdate) : '—' }}</span>
|
||||
</div>
|
||||
<div class="live-status-card__row">
|
||||
<span class="live-status-card__label">Transport</span>
|
||||
<span>{{ live.statusLabel }}<template v-if="live.status === 'polling'"> · 5 s</template></span>
|
||||
</div>
|
||||
<p v-if="live.error" class="small muted table-note">{{ live.error }}</p>
|
||||
</section>
|
||||
|
||||
<footer class="live-footer">
|
||||
<p>
|
||||
<strong>Decision support, not an optimizer.</strong> The plan uses
|
||||
{{ plan?.assumptions.visitors_per_staff_hour ?? 25 }} visitors per staff-hour,
|
||||
×{{ plan?.assumptions.safety_factor ?? 1.15 }} safety, {{ plan?.assumptions.shift_length_h ?? 4 }} h shift
|
||||
blocks and €{{ plan?.assumptions.labor_cost_eur_h ?? 16 }}/h.
|
||||
</p>
|
||||
<p class="muted">
|
||||
Estimated devices, not people · {{ sensors?.length ?? 8 }} sensors in a 580 m cluster · no POS, sales or
|
||||
payroll data.
|
||||
</p>
|
||||
</footer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.live-page {
|
||||
max-width: 44rem;
|
||||
gap: clamp(0.85rem, 2vw, 1.25rem);
|
||||
}
|
||||
|
||||
.live-header {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: var(--onyx-density-sm);
|
||||
}
|
||||
|
||||
.live-header h1 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.live-header__status {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--onyx-density-xs);
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.live-hero {
|
||||
padding: clamp(1.1rem, 3vw, 1.75rem);
|
||||
border: 1px solid var(--onyx-color-base-primary-300);
|
||||
border-radius: var(--onyx-radius-component-container-soft);
|
||||
background:
|
||||
radial-gradient(circle at 100% 0%, var(--onyx-color-base-primary-200), transparent 48%),
|
||||
linear-gradient(135deg, var(--onyx-color-base-primary-100), var(--onyx-color-base-neutral-100) 72%);
|
||||
}
|
||||
|
||||
.live-hero__kicker {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
margin: 0;
|
||||
color: var(--onyx-color-text-icons-neutral-medium);
|
||||
font-size: 0.8rem;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.04em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.live-hero__value {
|
||||
margin: var(--onyx-density-xs) 0 0;
|
||||
font-size: clamp(3rem, 16vw, 5.5rem);
|
||||
font-weight: 800;
|
||||
letter-spacing: -0.04em;
|
||||
line-height: 0.95;
|
||||
color: var(--onyx-color-text-icons-primary-intense);
|
||||
}
|
||||
|
||||
.live-hero__shift {
|
||||
margin: var(--onyx-density-sm) 0 0;
|
||||
font-size: clamp(1rem, 3.5vw, 1.25rem);
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.live-hero__why {
|
||||
display: flex;
|
||||
gap: var(--onyx-density-xs);
|
||||
align-items: flex-start;
|
||||
margin: var(--onyx-density-md) 0;
|
||||
color: var(--onyx-color-text-icons-neutral-medium);
|
||||
font-size: 0.9rem;
|
||||
line-height: 1.45;
|
||||
}
|
||||
|
||||
.live-metrics {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: var(--onyx-density-sm);
|
||||
}
|
||||
|
||||
.live-metric {
|
||||
min-width: 0;
|
||||
padding: var(--onyx-density-md);
|
||||
border: 1px solid var(--onyx-color-base-neutral-300);
|
||||
border-radius: var(--onyx-radius-component-container-soft);
|
||||
background: var(--onyx-color-base-neutral-100);
|
||||
}
|
||||
|
||||
.live-metric__label {
|
||||
margin: 0;
|
||||
color: var(--onyx-color-text-icons-neutral-medium);
|
||||
font-size: 0.78rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.live-metric__value {
|
||||
margin: var(--onyx-density-xs) 0 0;
|
||||
font-size: clamp(1.35rem, 6vw, 1.9rem);
|
||||
font-weight: 700;
|
||||
line-height: 1.1;
|
||||
}
|
||||
|
||||
.live-status-card {
|
||||
display: grid;
|
||||
gap: var(--onyx-density-xs);
|
||||
padding: var(--onyx-density-md);
|
||||
border: 1px solid var(--onyx-color-base-neutral-300);
|
||||
border-radius: var(--onyx-radius-component-container-soft);
|
||||
background: var(--onyx-color-base-neutral-100);
|
||||
}
|
||||
|
||||
.live-status-card__row {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
justify-content: space-between;
|
||||
gap: var(--onyx-density-sm);
|
||||
}
|
||||
|
||||
.live-status-card__label {
|
||||
color: var(--onyx-color-text-icons-neutral-medium);
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
.live-footer {
|
||||
padding-top: var(--onyx-density-sm);
|
||||
border-top: 1px solid var(--onyx-color-base-neutral-300);
|
||||
color: var(--onyx-color-text-icons-neutral-medium);
|
||||
font-size: 0.75rem;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.live-footer p {
|
||||
margin: 0 0 var(--onyx-density-xs);
|
||||
}
|
||||
|
||||
@media (min-width: 577px) {
|
||||
.live-metrics {
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,799 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
iconCalendar,
|
||||
iconCheck,
|
||||
iconCircleInformation,
|
||||
iconDownload,
|
||||
iconSync,
|
||||
iconTriangleWarning,
|
||||
iconUserGroup,
|
||||
} from '@sit-onyx/icons'
|
||||
import { dailyWeather } from '#shared/insights'
|
||||
import {
|
||||
addDays,
|
||||
berlinParts,
|
||||
buildStaffing,
|
||||
DEFAULT_ASSUMPTIONS,
|
||||
isInWeek,
|
||||
planWeekStart,
|
||||
STANDARD_VISITORS_PER_STAFF_HOUR,
|
||||
} from '#shared/staffing'
|
||||
import { SCENARIOS } from '#shared/types'
|
||||
import type {
|
||||
ContextResponse,
|
||||
MetaResponse,
|
||||
Scenario,
|
||||
ScenarioPreset,
|
||||
ScenarioState,
|
||||
Sensor,
|
||||
Shift,
|
||||
StaffingHour,
|
||||
StaffingResponse,
|
||||
Standard,
|
||||
} from '#shared/types'
|
||||
import {
|
||||
formatDate,
|
||||
formatDateTime,
|
||||
formatEuro,
|
||||
formatNumber,
|
||||
formatPercent,
|
||||
formatShortDate,
|
||||
formatTime,
|
||||
formatWeekday,
|
||||
weekLabel,
|
||||
} from '~/utils/format'
|
||||
|
||||
useHead({ title: 'Plan next week — PulseCast' })
|
||||
|
||||
const config = useRuntimeConfig()
|
||||
const route = useRoute()
|
||||
const demoNow = String(config.public.demoNow)
|
||||
const usingMock = computed(
|
||||
() =>
|
||||
config.public.useMock === true ||
|
||||
config.public.useMock === '1' ||
|
||||
config.public.useMock === 'true',
|
||||
)
|
||||
|
||||
function initialScenario(): Scenario {
|
||||
const value = route.query.scenario
|
||||
return typeof value === 'string' && SCENARIOS.includes(value as Scenario) ? (value as Scenario) : 'base'
|
||||
}
|
||||
|
||||
/** Keep Stadtgalerie as the demo default, but follow the API when it differs. */
|
||||
function preferredSensor(list: Sensor[] | null | undefined): string {
|
||||
return list?.find((sensor) => sensor.id === 'hn-stadtgalerie-01')?.id ?? list?.[0]?.id ?? 'hn-stadtgalerie-01'
|
||||
}
|
||||
|
||||
const { data: sensors } = await useFetch<Sensor[]>('/api/sensors')
|
||||
const { data: context } = await useFetch<ContextResponse>('/api/context')
|
||||
const { data: meta } = await useFetch<MetaResponse>('/api/meta')
|
||||
const { data: presets } = await useFetch<ScenarioPreset[]>('/api/scenarios')
|
||||
const { data: liveScenarioState } = await useFetch<ScenarioState>('/api/scenario')
|
||||
const live = useLiveScenario(liveScenarioState.value)
|
||||
|
||||
const sensorId = ref(preferredSensor(sensors.value))
|
||||
const scenario = ref<Scenario>(initialScenario())
|
||||
// The stage scenario wins unless the URL explicitly asks for another one.
|
||||
if (!route.query.scenario) scenario.value = live.scenarioId
|
||||
const standard = ref<Standard>('standard')
|
||||
const approved = ref(false)
|
||||
const generating = ref(false)
|
||||
const generatedAt = ref('')
|
||||
const openAssumptions = ref<PropertyKey[]>([])
|
||||
const assumptions = reactive({
|
||||
safety_factor: DEFAULT_ASSUMPTIONS.safety_factor,
|
||||
min_staff: DEFAULT_ASSUMPTIONS.min_staff,
|
||||
shift_length_h: DEFAULT_ASSUMPTIONS.shift_length_h,
|
||||
labor_cost_eur_h: DEFAULT_ASSUMPTIONS.labor_cost_eur_h,
|
||||
})
|
||||
|
||||
const EMPTY_PLAN: StaffingResponse = {
|
||||
sensor: '',
|
||||
scenario: 'base',
|
||||
standard: 'standard',
|
||||
assumptions: DEFAULT_ASSUMPTIONS,
|
||||
hours: [],
|
||||
shifts: [],
|
||||
summary: {
|
||||
coverage_pct: 0,
|
||||
cost_eur: 0,
|
||||
flat_schedule_cost_eur: 0,
|
||||
overstaffed_hours: 0,
|
||||
understaffed_hours: 0,
|
||||
},
|
||||
why: [],
|
||||
cached: false,
|
||||
data_version: '',
|
||||
model_version: '',
|
||||
context_version: '',
|
||||
}
|
||||
|
||||
// The Go plan is the source; assumption edits render a local preview only.
|
||||
const {
|
||||
data: apiPlanData,
|
||||
status,
|
||||
error,
|
||||
refresh,
|
||||
} = await useFetch<StaffingResponse>('/api/staffing', {
|
||||
query: computed(() => ({
|
||||
sensor: sensorId.value,
|
||||
scenario: scenario.value,
|
||||
standard: standard.value,
|
||||
})),
|
||||
})
|
||||
|
||||
watch(
|
||||
() => route.query.scenario,
|
||||
(value) => {
|
||||
if (typeof value === 'string' && SCENARIOS.includes(value as Scenario)) {
|
||||
scenario.value = value as Scenario
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
// A scenario event changes the plan. If the enum is unchanged (same scenario,
|
||||
// new override/version), the query string does not move, so refresh it here.
|
||||
watch(
|
||||
() => live.revision,
|
||||
() => {
|
||||
if (live.scenarioId !== scenario.value) scenario.value = live.scenarioId
|
||||
else void refresh()
|
||||
},
|
||||
)
|
||||
|
||||
const apiPlan = computed(() => apiPlanData.value ?? EMPTY_PLAN)
|
||||
const activeSensor = computed(() => sensors.value?.find((sensor) => sensor.id === sensorId.value))
|
||||
const activeScenario = computed(() => presets.value?.find((preset) => preset.id === scenario.value))
|
||||
const visitorsPerStaffHour = computed(() => STANDARD_VISITORS_PER_STAFF_HOUR[standard.value])
|
||||
|
||||
const weekStart = computed(() => {
|
||||
const first = apiPlan.value.hours[0]
|
||||
return first ? berlinParts(first.t).date : planWeekStart(demoNow)
|
||||
})
|
||||
const weekEnd = computed(() => addDays(weekStart.value, 6))
|
||||
|
||||
const scenarioOptions = computed(() =>
|
||||
(presets.value ?? []).map((preset) => ({ value: preset.id, label: preset.label })),
|
||||
)
|
||||
const sensorOptions = computed(() =>
|
||||
(sensors.value ?? []).map((sensor) => ({ value: sensor.id, label: sensor.name })),
|
||||
)
|
||||
const standardOptions = [
|
||||
{ value: 'relaxed', label: 'Relaxed 35' },
|
||||
{ value: 'standard', label: 'Standard 25' },
|
||||
{ value: 'premium', label: 'Premium 18' },
|
||||
]
|
||||
const standardLabel = computed(
|
||||
() =>
|
||||
({
|
||||
relaxed: 'relaxed · 35 visitors per staff-hour',
|
||||
standard: 'standard · 25 visitors per staff-hour',
|
||||
premium: 'premium · 18 visitors per staff-hour',
|
||||
})[standard.value],
|
||||
)
|
||||
const shiftLengthOptions = [
|
||||
{ value: 2, label: '2 hours' },
|
||||
{ value: 3, label: '3 hours' },
|
||||
{ value: 4, label: '4 hours' },
|
||||
{ value: 5, label: '5 hours' },
|
||||
]
|
||||
|
||||
/** The /api/staffing contract has no assumption query params. Non-query edits
|
||||
* are therefore an explicitly labeled local preview, never a silent swap. */
|
||||
const previewActive = computed(() => {
|
||||
const api = apiPlan.value.assumptions
|
||||
return (
|
||||
assumptions.safety_factor !== api.safety_factor ||
|
||||
assumptions.min_staff !== api.min_staff ||
|
||||
assumptions.shift_length_h !== api.shift_length_h ||
|
||||
assumptions.labor_cost_eur_h !== api.labor_cost_eur_h
|
||||
)
|
||||
})
|
||||
|
||||
const previewBuild = computed(() =>
|
||||
buildStaffing({
|
||||
sensor: sensorId.value,
|
||||
scenario: scenario.value,
|
||||
standard: standard.value,
|
||||
points: apiPlan.value.hours.map((hour) => ({ t: hour.t, v: hour.footfall })),
|
||||
weekStart: weekStart.value,
|
||||
assumptions: {
|
||||
visitors_per_staff_hour: visitorsPerStaffHour.value,
|
||||
safety_factor: assumptions.safety_factor,
|
||||
min_staff: assumptions.min_staff,
|
||||
shift_length_h: assumptions.shift_length_h,
|
||||
labor_cost_eur_h: assumptions.labor_cost_eur_h,
|
||||
store_hours: apiPlan.value.assumptions.store_hours,
|
||||
},
|
||||
data_version: apiPlan.value.data_version,
|
||||
model_version: apiPlan.value.model_version,
|
||||
context_version: apiPlan.value.context_version,
|
||||
}),
|
||||
)
|
||||
|
||||
const plan = computed(() => (previewActive.value ? previewBuild.value.response : apiPlan.value))
|
||||
|
||||
const hoursByDate = computed<Record<string, StaffingHour[]>>(() => {
|
||||
if (previewActive.value) return previewBuild.value.byDate
|
||||
const grouped: Record<string, StaffingHour[]> = {}
|
||||
for (const hour of apiPlan.value.hours) {
|
||||
const date = berlinParts(hour.t).date
|
||||
;(grouped[date] ??= []).push(hour)
|
||||
}
|
||||
return grouped
|
||||
})
|
||||
|
||||
const shiftsByDate = computed<Record<string, Shift[]>>(() => {
|
||||
if (previewActive.value) return previewBuild.value.shiftsByDate
|
||||
const grouped: Record<string, Shift[]> = {}
|
||||
for (const shift of apiPlan.value.shifts) {
|
||||
;(grouped[shift.date] ??= []).push(shift)
|
||||
}
|
||||
return grouped
|
||||
})
|
||||
|
||||
const why = computed(() => apiPlan.value.why)
|
||||
const weekWeather = computed(() => {
|
||||
if (!context.value) return []
|
||||
return Object.values(dailyWeather(context.value.weather.forecast))
|
||||
.filter((day) => isInWeek(day.date, weekStart.value))
|
||||
.sort((a, b) => a.date.localeCompare(b.date))
|
||||
})
|
||||
|
||||
function maxOf<T>(items: T[], score: (item: T) => number): T | undefined {
|
||||
let best: T | undefined
|
||||
for (const item of items) {
|
||||
if (!best || score(item) > score(best)) best = item
|
||||
}
|
||||
return best
|
||||
}
|
||||
|
||||
const peakHour = computed(() => maxOf(plan.value.hours, (hour) => hour.footfall))
|
||||
const peakShift = computed(() => maxOf(plan.value.shifts, (shift) => shift.staff))
|
||||
const totalStaffHours = computed(() =>
|
||||
plan.value.hours.reduce((sum, hour) => sum + hour.scheduled_staff, 0),
|
||||
)
|
||||
const savingEur = computed(() =>
|
||||
Math.max(0, plan.value.summary.flat_schedule_cost_eur - plan.value.summary.cost_eur),
|
||||
)
|
||||
const savingPct = computed(() => {
|
||||
const flat = plan.value.summary.flat_schedule_cost_eur
|
||||
return flat > 0 ? (savingEur.value / flat) * 100 : 0
|
||||
})
|
||||
|
||||
interface DaySummary {
|
||||
date: string
|
||||
shifts: Shift[]
|
||||
staffHours: number
|
||||
peakStaff: number
|
||||
cost: number
|
||||
}
|
||||
|
||||
const daySummaries = computed<DaySummary[]>(() =>
|
||||
Object.keys(hoursByDate.value)
|
||||
.sort()
|
||||
.map((date) => {
|
||||
const hours = hoursByDate.value[date] ?? []
|
||||
const shifts = shiftsByDate.value[date] ?? []
|
||||
const staffHours = hours.reduce((sum, hour) => sum + hour.scheduled_staff, 0)
|
||||
return {
|
||||
date,
|
||||
shifts,
|
||||
staffHours,
|
||||
peakStaff: maxOf(hours, (hour) => hour.scheduled_staff)?.scheduled_staff ?? 0,
|
||||
cost: staffHours * plan.value.assumptions.labor_cost_eur_h,
|
||||
}
|
||||
}),
|
||||
)
|
||||
const dayDates = computed(() => daySummaries.value.map((day) => day.date))
|
||||
const selectedDay = ref('')
|
||||
watch(
|
||||
() => dayDates.value.join(','),
|
||||
() => {
|
||||
if (dayDates.value.includes(selectedDay.value)) return
|
||||
const preferred = addDays(weekStart.value, 5)
|
||||
selectedDay.value = dayDates.value.includes(preferred) ? preferred : (dayDates.value[0] ?? '')
|
||||
},
|
||||
{ immediate: true },
|
||||
)
|
||||
|
||||
const dayOptions = computed(() =>
|
||||
daySummaries.value.map((day) => ({
|
||||
value: day.date,
|
||||
label: `${formatWeekday(day.date)} ${formatShortDate(day.date)} · ${day.peakStaff} peak`,
|
||||
})),
|
||||
)
|
||||
const selectedHours = computed<StaffingHour[]>(() => hoursByDate.value[selectedDay.value] ?? [])
|
||||
const selectedCovered = computed(
|
||||
() => selectedHours.value.filter((hour) => hour.scheduled_staff >= hour.required_staff).length,
|
||||
)
|
||||
const selectedOver = computed(
|
||||
() => selectedHours.value.filter((hour) => hour.coverage === 'over').length,
|
||||
)
|
||||
|
||||
function coverageColor(hour: StaffingHour) {
|
||||
if (hour.coverage === 'under') return 'danger' as const
|
||||
if (hour.coverage === 'over') return 'warning' as const
|
||||
return 'success' as const
|
||||
}
|
||||
|
||||
function coverageLabel(hour: StaffingHour) {
|
||||
if (hour.coverage === 'under') return `${hour.required_staff - hour.scheduled_staff} short`
|
||||
if (hour.coverage === 'over') return `+${hour.scheduled_staff - hour.required_staff} over`
|
||||
return 'Covered'
|
||||
}
|
||||
|
||||
async function generate() {
|
||||
generating.value = true
|
||||
try {
|
||||
await refresh()
|
||||
if (!error.value && import.meta.client) generatedAt.value = formatTime(new Date().toISOString())
|
||||
} finally {
|
||||
generating.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function resetAssumptions() {
|
||||
assumptions.safety_factor = DEFAULT_ASSUMPTIONS.safety_factor
|
||||
assumptions.min_staff = DEFAULT_ASSUMPTIONS.min_staff
|
||||
assumptions.shift_length_h = DEFAULT_ASSUMPTIONS.shift_length_h
|
||||
assumptions.labor_cost_eur_h = DEFAULT_ASSUMPTIONS.labor_cost_eur_h
|
||||
standard.value = 'standard'
|
||||
}
|
||||
|
||||
function useApiPlan() {
|
||||
const api = apiPlan.value.assumptions
|
||||
assumptions.safety_factor = api.safety_factor
|
||||
assumptions.min_staff = api.min_staff
|
||||
assumptions.shift_length_h = api.shift_length_h
|
||||
assumptions.labor_cost_eur_h = api.labor_cost_eur_h
|
||||
}
|
||||
|
||||
function exportPlan() {
|
||||
if (!import.meta.client) return
|
||||
const rows = [
|
||||
['date', 'shift_start', 'shift_end', 'staff', 'staff_hours'],
|
||||
...plan.value.shifts.map((shift) => [
|
||||
shift.date,
|
||||
shift.start,
|
||||
shift.end,
|
||||
String(shift.staff),
|
||||
String((Number(shift.end.slice(0, 2)) - Number(shift.start.slice(0, 2))) * shift.staff),
|
||||
]),
|
||||
]
|
||||
const csv = rows.map((row) => row.join(',')).join('\n')
|
||||
const url = URL.createObjectURL(new Blob([csv], { type: 'text/csv;charset=utf-8' }))
|
||||
const link = document.createElement('a')
|
||||
link.href = url
|
||||
link.download = `pulsecast-plan-${weekStart.value}.csv`
|
||||
link.click()
|
||||
URL.revokeObjectURL(url)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="page page-stack">
|
||||
<section class="hero" aria-labelledby="plan-headline">
|
||||
<div class="hero-grid">
|
||||
<div class="hero-copy">
|
||||
<p class="eyebrow">Plan · {{ weekLabel(weekStart, weekEnd) }}</p>
|
||||
<OnyxHeadline id="plan-headline" is="h1">
|
||||
<template v-if="peakShift">
|
||||
{{ formatWeekday(peakShift.date) }} peak: {{ peakShift.staff }} staff, {{ peakShift.start }}–{{ peakShift.end }}.
|
||||
</template>
|
||||
<template v-else>Build next week’s shift plan.</template>
|
||||
</OnyxHeadline>
|
||||
<p class="lede">
|
||||
Forecast for <strong>{{ activeSensor?.name ?? apiPlan.sensor ?? 'the selected store' }}</strong> needs
|
||||
<strong>{{ peakHour?.required_staff ?? '—' }} staff at the busiest hour</strong>. The rest of the week
|
||||
runs on {{ totalStaffHours }} staff-hours at {{ formatEuro(plan.summary.cost_eur) }}.
|
||||
</p>
|
||||
<div class="hero-actions">
|
||||
<OnyxButton
|
||||
:label="approved ? 'Plan approved' : 'Approve plan'"
|
||||
:icon="approved ? iconCheck : iconCalendar"
|
||||
color="primary"
|
||||
@click="approved = !approved"
|
||||
/>
|
||||
<OnyxButton label="Export CSV" :icon="iconDownload" mode="outline" @click="exportPlan" />
|
||||
<LiveStatusBadge :status="live.status" :last-event-at="live.lastEventAt" />
|
||||
<OnyxBadge v-if="approved" color="success">Approved · demo</OnyxBadge>
|
||||
<span v-else class="small muted">Draft for manager review</span>
|
||||
</div>
|
||||
<p class="small muted" style="margin: 0">
|
||||
<template v-if="usingMock">Mock mode · NUXT_PUBLIC_USE_MOCK=1 · no Go API call.</template>
|
||||
<template v-else-if="previewActive">
|
||||
Local preview · the Go API plan is unchanged.
|
||||
</template>
|
||||
<template v-else>
|
||||
Go /api/staffing · scenario v{{ live.version }} · broadcast
|
||||
{{ live.scenarioAt ? formatDateTime(live.scenarioAt) : '—' }} · no POS, sales or labour-cost feed.
|
||||
</template>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="hero-decision">
|
||||
<p class="stat-label">Peak staffing decision</p>
|
||||
<p class="hero-decision__value">{{ peakShift?.staff ?? '—' }} staff</p>
|
||||
<p class="hero-decision__label">
|
||||
<template v-if="peakShift">
|
||||
{{ formatWeekday(peakShift.date) }} {{ formatShortDate(peakShift.date) }}, {{ peakShift.start }}–{{ peakShift.end }}<br />
|
||||
</template>
|
||||
<template v-if="peakHour">
|
||||
{{ formatWeekday(berlinParts(peakHour.t).date) }} {{ String(berlinParts(peakHour.t).hour).padStart(2, '0') }}:00
|
||||
peak: {{ peakHour.footfall }} est. visitors/hour
|
||||
</template>
|
||||
</p>
|
||||
<OnyxSeparator style="margin-block: var(--onyx-density-sm)" />
|
||||
<div class="reading-row">
|
||||
<OnyxBadge color="success" density="compact">{{ formatPercent(plan.summary.coverage_pct, 1) }} covered</OnyxBadge>
|
||||
<OnyxBadge color="warning" density="compact">{{ plan.summary.overstaffed_hours }} h over</OnyxBadge>
|
||||
<OnyxBadge color="success" density="compact">{{ plan.summary.understaffed_hours }} h under</OnyxBadge>
|
||||
<OnyxBadge v-if="apiPlan.cached" color="warning" density="compact">cached forecast</OnyxBadge>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div v-if="status === 'error'" class="callout callout--warning">
|
||||
<OnyxIcon :icon="iconTriangleWarning" size="16px" color="warning" />
|
||||
The staffing API could not be loaded. Check that the Go API is running and that NUXT_API_INTERNAL_BASE points
|
||||
to it. <span v-if="error" class="muted">{{ error.statusMessage }}</span>
|
||||
</div>
|
||||
<div v-else-if="status === 'success' && !apiPlan.hours.length" class="callout callout--warning">
|
||||
<OnyxIcon :icon="iconTriangleWarning" size="16px" color="warning" />
|
||||
No open hours are available for this store and scenario yet. Pick another sensor or check the data window.
|
||||
</div>
|
||||
|
||||
<section class="summary-grid" aria-label="Plan summary">
|
||||
<MetricCard
|
||||
label="Coverage"
|
||||
:value="formatPercent(plan.summary.coverage_pct, 1)"
|
||||
badge="All hours covered"
|
||||
badge-color="success"
|
||||
:icon="iconCheck"
|
||||
hint="Shift blocks cover the block peak, so low hours are intentionally overstaffed."
|
||||
/>
|
||||
<MetricCard
|
||||
label="Labour cost"
|
||||
:value="formatEuro(plan.summary.cost_eur)"
|
||||
:icon="iconUserGroup"
|
||||
:hint="`${totalStaffHours} staff-hours × €${plan.assumptions.labor_cost_eur_h}/h assumption`"
|
||||
/>
|
||||
<MetricCard
|
||||
label="vs flat schedule"
|
||||
:value="`−${formatEuro(savingEur)}`"
|
||||
:badge="`${formatPercent(savingPct, 0)} lower`"
|
||||
badge-color="success"
|
||||
:hint="`Flat schedule would cost ${formatEuro(plan.summary.flat_schedule_cost_eur)}.`"
|
||||
/>
|
||||
<MetricCard
|
||||
label="Plan risk"
|
||||
:value="`${plan.summary.overstaffed_hours} h over`"
|
||||
:badge="`${plan.summary.understaffed_hours} h under`"
|
||||
badge-color="success"
|
||||
:hint="`${selectedOver} of ${selectedHours.length} selected-day hours are above requirement.`"
|
||||
/>
|
||||
</section>
|
||||
|
||||
<OnyxCard>
|
||||
<div class="card-header">
|
||||
<div>
|
||||
<OnyxHeadline is="h2">Plan inputs</OnyxHeadline>
|
||||
<p class="small muted" style="margin: 0">
|
||||
Store, service standard and scenario are sent to Go /api/staffing. Local assumption edits render a
|
||||
preview from the API forecast.
|
||||
</p>
|
||||
</div>
|
||||
<OnyxBadge :color="usingMock ? 'warning' : previewActive ? 'warning' : 'success'" density="compact">
|
||||
{{ usingMock ? 'Mock mode' : previewActive ? 'Local preview' : 'Go API' }}
|
||||
</OnyxBadge>
|
||||
</div>
|
||||
|
||||
<div class="form-grid">
|
||||
<div style="display: grid; gap: var(--onyx-density-md); grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr))">
|
||||
<OnyxSelect
|
||||
v-model="sensorId"
|
||||
label="Store / sensor"
|
||||
list-label="Inner-city sensors"
|
||||
:options="sensorOptions"
|
||||
:message="activeSensor ? `${activeSensor.id} · ${activeSensor.mean} mean / ${activeSensor.p95} p95` : undefined"
|
||||
/>
|
||||
<OnyxSelect
|
||||
v-model="scenario"
|
||||
label="Scenario"
|
||||
list-label="Demo scenarios"
|
||||
:options="scenarioOptions"
|
||||
:message="activeScenario?.description"
|
||||
/>
|
||||
<div>
|
||||
<p class="stat-label" style="margin-bottom: var(--onyx-density-xs)">Service standard</p>
|
||||
<OnyxSegmentedControl
|
||||
v-model="standard"
|
||||
aria-label="Service standard"
|
||||
:options="standardOptions"
|
||||
name="service-standard"
|
||||
/>
|
||||
<p class="small muted" style="margin: var(--onyx-density-xs) 0 0">{{ standardLabel }}</p>
|
||||
</div>
|
||||
<div style="display: flex; align-items: flex-end; gap: var(--onyx-density-sm); flex-wrap: wrap">
|
||||
<OnyxButton
|
||||
label="Generate plan"
|
||||
:icon="iconSync"
|
||||
color="primary"
|
||||
:loading="generating || status === 'pending'"
|
||||
@click="generate"
|
||||
/>
|
||||
<span v-if="generatedAt" class="small muted">Updated {{ generatedAt }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<OnyxAccordion v-model="openAssumptions" type="card">
|
||||
<OnyxAccordionItem id="assumptions" value="assumptions">
|
||||
<template #header>
|
||||
<span>
|
||||
Assumptions
|
||||
<span class="muted small">
|
||||
· {{ visitorsPerStaffHour }} visitors/staff-h · ×{{ assumptions.safety_factor.toFixed(2) }} ·
|
||||
min {{ assumptions.min_staff }}
|
||||
</span>
|
||||
</span>
|
||||
</template>
|
||||
<div class="assumption-grid">
|
||||
<OnyxSlider
|
||||
v-model="assumptions.safety_factor"
|
||||
label="Safety factor"
|
||||
:min="1"
|
||||
:max="1.5"
|
||||
:step="0.05"
|
||||
control="input"
|
||||
:message="`Higher values add buffer staff. Current ×${assumptions.safety_factor.toFixed(2)}.`"
|
||||
/>
|
||||
<OnyxStepper
|
||||
v-model="assumptions.min_staff"
|
||||
label="Minimum staff"
|
||||
:min="1"
|
||||
:max="10"
|
||||
:step-size="1"
|
||||
message="Floor applied to every open hour."
|
||||
/>
|
||||
<OnyxSelect
|
||||
v-model="assumptions.shift_length_h"
|
||||
label="Shift block length"
|
||||
list-label="Shift lengths"
|
||||
:options="shiftLengthOptions"
|
||||
message="Blocks are scheduled independently; coverage is checked per hour."
|
||||
/>
|
||||
<OnyxStepper
|
||||
v-model="assumptions.labor_cost_eur_h"
|
||||
label="Labour cost (€/hour)"
|
||||
:min="8"
|
||||
:max="60"
|
||||
:step-size="1"
|
||||
message="Assumption only. No payroll or POS data exists."
|
||||
/>
|
||||
<p class="small muted" style="grid-column: 1 / -1; margin: 0">
|
||||
These four values are not query inputs of Go /api/staffing. Changing them shows a local preview;
|
||||
“Use API plan” restores the server values.
|
||||
</p>
|
||||
<div class="form-actions" style="grid-column: 1 / -1">
|
||||
<OnyxButton label="Reset assumptions" mode="outline" @click="resetAssumptions" />
|
||||
<OnyxButton v-if="previewActive" label="Use API plan" mode="outline" @click="useApiPlan" />
|
||||
<span class="small muted">Store hours 10:00–20:00, Europe/Berlin · {{ apiPlan.model_version || 'API' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</OnyxAccordionItem>
|
||||
</OnyxAccordion>
|
||||
</div>
|
||||
</OnyxCard>
|
||||
|
||||
<div class="split-grid">
|
||||
<div class="card-stack">
|
||||
<OnyxCard>
|
||||
<div class="card-header">
|
||||
<div>
|
||||
<OnyxHeadline is="h2">Recommended shifts</OnyxHeadline>
|
||||
<p class="small muted" style="margin: 0">2–5 h blocks per day; staff count covers the block peak.</p>
|
||||
</div>
|
||||
<div class="legend">
|
||||
<span class="legend__item"><span class="legend__swatch legend__swatch--over" /> over requirement</span>
|
||||
<span class="legend__item"><span class="legend__swatch" /> scheduled staff</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<OnyxTable class="desktop-table" striped>
|
||||
<template #head>
|
||||
<tr>
|
||||
<th scope="col">Day</th>
|
||||
<th scope="col">Shift blocks (start–end · staff)</th>
|
||||
<th scope="col">Staff-hours</th>
|
||||
<th scope="col">Peak</th>
|
||||
<th scope="col">Labour</th>
|
||||
<th scope="col"><span class="onyx-visually-hidden">Inspect</span></th>
|
||||
</tr>
|
||||
</template>
|
||||
<tr v-for="day in daySummaries" :key="day.date" :class="{ 'peak-row': day.date === peakShift?.date }">
|
||||
<th scope="row" style="text-align: left; font-weight: 600">
|
||||
{{ formatWeekday(day.date) }}
|
||||
<span class="muted" style="font-weight: 400"> {{ formatShortDate(day.date) }}</span>
|
||||
<OnyxBadge v-if="day.date === peakShift?.date" color="warning" density="compact" style="margin-left: 0.35rem">peak</OnyxBadge>
|
||||
</th>
|
||||
<td>
|
||||
<div class="shift-tags">
|
||||
<OnyxTag
|
||||
v-for="shift in day.shifts"
|
||||
:key="`${shift.date}-${shift.start}`"
|
||||
:label="`${shift.start}–${shift.end} · ${shift.staff}`"
|
||||
density="compact"
|
||||
color="neutral"
|
||||
/>
|
||||
</div>
|
||||
</td>
|
||||
<td>{{ formatNumber(day.staffHours) }}</td>
|
||||
<td>{{ day.peakStaff }}</td>
|
||||
<td>{{ formatEuro(day.cost) }}</td>
|
||||
<td>
|
||||
<OnyxButton
|
||||
label="Hours"
|
||||
mode="plain"
|
||||
density="compact"
|
||||
@click="selectedDay = day.date"
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
</OnyxTable>
|
||||
|
||||
<div class="day-card-list">
|
||||
<OnyxCard v-for="day in daySummaries" :key="day.date" density="compact">
|
||||
<div class="day-card__header">
|
||||
<p class="day-card__date">
|
||||
{{ formatWeekday(day.date) }} <span class="muted">{{ formatShortDate(day.date) }}</span>
|
||||
</p>
|
||||
<OnyxBadge :color="day.date === peakShift?.date ? 'warning' : 'neutral'" density="compact">
|
||||
{{ day.peakStaff }} peak
|
||||
</OnyxBadge>
|
||||
</div>
|
||||
<div class="shift-tags" style="margin-top: var(--onyx-density-xs)">
|
||||
<OnyxTag
|
||||
v-for="shift in day.shifts"
|
||||
:key="`${shift.date}-${shift.start}`"
|
||||
:label="`${shift.start}–${shift.end} · ${shift.staff}`"
|
||||
density="compact"
|
||||
/>
|
||||
</div>
|
||||
<div class="day-card__metrics">
|
||||
<span>{{ formatNumber(day.staffHours) }} staff-hours</span>
|
||||
<span>{{ formatEuro(day.cost) }}</span>
|
||||
</div>
|
||||
<OnyxButton label="View hourly detail" mode="plain" density="compact" @click="selectedDay = day.date" />
|
||||
</OnyxCard>
|
||||
</div>
|
||||
|
||||
<p class="small muted table-note">
|
||||
Total {{ totalStaffHours }} staff-hours · {{ formatEuro(plan.summary.cost_eur) }} at
|
||||
€{{ plan.assumptions.labor_cost_eur_h }}/h · exported CSV has one row per shift block.
|
||||
</p>
|
||||
</OnyxCard>
|
||||
|
||||
<OnyxCard>
|
||||
<div class="card-header">
|
||||
<div>
|
||||
<OnyxHeadline is="h2">Hourly coverage</OnyxHeadline>
|
||||
<p class="small muted" style="margin: 0">
|
||||
{{ selectedCovered }}/{{ selectedHours.length }} open hours covered · {{ selectedOver }} over requirement
|
||||
</p>
|
||||
</div>
|
||||
<div style="min-width: 13rem">
|
||||
<OnyxSelect
|
||||
v-model="selectedDay"
|
||||
label="Inspect day"
|
||||
list-label="Plan days"
|
||||
:options="dayOptions"
|
||||
density="compact"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<OnyxTable striped with-page-scrolling :table-attrs="{ style: 'min-width: 34rem' }">
|
||||
<template #head>
|
||||
<tr>
|
||||
<th scope="col">Hour</th>
|
||||
<th scope="col">Forecast footfall</th>
|
||||
<th scope="col">Required</th>
|
||||
<th scope="col">Scheduled</th>
|
||||
<th scope="col">Coverage</th>
|
||||
</tr>
|
||||
</template>
|
||||
<tr v-for="hour in selectedHours" :key="hour.t">
|
||||
<th scope="row" style="text-align: left; font-weight: 600">{{ String(berlinParts(hour.t).hour).padStart(2, '0') }}:00</th>
|
||||
<td>{{ formatNumber(hour.footfall) }}</td>
|
||||
<td>{{ hour.required_staff }}</td>
|
||||
<td>{{ hour.scheduled_staff }}</td>
|
||||
<td>
|
||||
<OnyxBadge :color="coverageColor(hour)" density="compact">{{ coverageLabel(hour) }}</OnyxBadge>
|
||||
</td>
|
||||
</tr>
|
||||
</OnyxTable>
|
||||
<p class="small muted table-note">
|
||||
Scheduled staff is constant inside a block. Coverage is <em>at or above</em> the service standard by
|
||||
construction; the trade-off is visible as overstaffed hours. Store hours 10:00–20:00 local.
|
||||
</p>
|
||||
</OnyxCard>
|
||||
</div>
|
||||
|
||||
<aside class="card-stack">
|
||||
<OnyxCard>
|
||||
<div class="card-header">
|
||||
<OnyxHeadline is="h2">Why this plan</OnyxHeadline>
|
||||
<OnyxBadge color="info" density="compact">{{ usingMock ? 'Mock mode' : 'Go API' }}</OnyxBadge>
|
||||
</div>
|
||||
<ul class="why-list">
|
||||
<li v-for="reason in why" :key="reason">
|
||||
<OnyxIcon :icon="iconCircleInformation" size="16px" color="primary" />
|
||||
<span>{{ reason }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<OnyxSeparator style="margin-block: var(--onyx-density-md)" />
|
||||
<p class="stat-label" style="margin-bottom: var(--onyx-density-xs)">Weather during the plan week</p>
|
||||
<WeatherStrip :days="weekWeather" />
|
||||
<p v-if="!weekWeather.length" class="small muted table-note">
|
||||
The weather forecast from /api/context does not cover this plan window yet.
|
||||
</p>
|
||||
<p class="small muted table-note">
|
||||
{{ activeScenario?.description ?? 'Base scenario uses the API forecast weather.' }}
|
||||
</p>
|
||||
<p v-if="previewActive" class="small muted table-note">
|
||||
This card explains the API plan; the assumption preview above is local.
|
||||
</p>
|
||||
</OnyxCard>
|
||||
|
||||
<OnyxCard>
|
||||
<div class="card-header">
|
||||
<OnyxHeadline is="h3">Assumptions in this plan</OnyxHeadline>
|
||||
</div>
|
||||
<dl class="metric-list">
|
||||
<div><dt>Service standard</dt><dd>{{ standard }}</dd></div>
|
||||
<div><dt>Visitors / staff-hour</dt><dd>{{ plan.assumptions.visitors_per_staff_hour }}</dd></div>
|
||||
<div><dt>Safety factor</dt><dd>×{{ plan.assumptions.safety_factor }}</dd></div>
|
||||
<div><dt>Minimum staff</dt><dd>{{ plan.assumptions.min_staff }}</dd></div>
|
||||
<div><dt>Shift block</dt><dd>{{ plan.assumptions.shift_length_h }} h</dd></div>
|
||||
<div><dt>Labour cost</dt><dd>{{ formatEuro(plan.assumptions.labor_cost_eur_h) }}/h</dd></div>
|
||||
<div><dt>Store hours</dt><dd>{{ plan.assumptions.store_hours.open }}–{{ plan.assumptions.store_hours.close }}</dd></div>
|
||||
<div><dt>Model / data</dt><dd>{{ plan.model_version || meta?.model_version || '—' }}</dd></div>
|
||||
</dl>
|
||||
<p class="small muted table-note" style="margin-top: var(--onyx-density-md)">
|
||||
No POS, sales, queue or labour-cost data exists. This is decision support with explicit assumptions,
|
||||
not a payroll calculation or a precise ROI.
|
||||
</p>
|
||||
<OnyxButton
|
||||
label="Edit assumptions"
|
||||
mode="plain"
|
||||
density="compact"
|
||||
@click="openAssumptions = ['assumptions']"
|
||||
/>
|
||||
</OnyxCard>
|
||||
|
||||
<OnyxCard>
|
||||
<div class="card-header">
|
||||
<OnyxHeadline is="h3">Data and limits</OnyxHeadline>
|
||||
</div>
|
||||
<p class="small muted" style="margin-top: 0">
|
||||
{{ meta?.coverage.sensors ?? 8 }} sensors · {{ meta?.coverage.cadence_min ?? 15 }}-min cadence ·
|
||||
coverage {{ meta ? `${formatDate(meta.coverage.from)} → ${formatDate(meta.coverage.to)}` : '—' }}
|
||||
</p>
|
||||
<ul class="small muted" style="margin: var(--onyx-density-xs) 0 0; padding-left: 1.1rem">
|
||||
<li v-for="limit in meta?.limits ?? []" :key="limit">{{ limit }}</li>
|
||||
</ul>
|
||||
</OnyxCard>
|
||||
</aside>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.peak-row {
|
||||
background: var(--onyx-color-base-warning-100);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,270 @@
|
||||
<script setup lang="ts">
|
||||
import { iconArrowRight, iconCircleInformation, iconFlash } from '@sit-onyx/icons'
|
||||
import { addDays, berlinParts, planWeekStart } from '#shared/staffing'
|
||||
import type {
|
||||
ContextResponse,
|
||||
Scenario,
|
||||
ScenarioPreset,
|
||||
Sensor,
|
||||
StaffingResponse,
|
||||
} from '#shared/types'
|
||||
import { formatEuro, formatShortDate, formatWeekday, formatWeekdayShort, weekLabel } from '~/utils/format'
|
||||
|
||||
useHead({ title: 'Simulate a scenario — PulseCast' })
|
||||
|
||||
const config = useRuntimeConfig()
|
||||
const demoNow = String(config.public.demoNow)
|
||||
|
||||
const { data: sensors } = await useFetch<Sensor[]>('/api/sensors')
|
||||
const { data: context } = await useFetch<ContextResponse>('/api/context')
|
||||
const { data: presets } = await useFetch<ScenarioPreset[]>('/api/scenarios')
|
||||
|
||||
const sensorId = ref(
|
||||
sensors.value?.find((sensor) => sensor.id === 'hn-stadtgalerie-01')?.id ??
|
||||
sensors.value?.[0]?.id ??
|
||||
'hn-stadtgalerie-01',
|
||||
)
|
||||
const scenario = ref<Scenario>('sunny-saturday-market')
|
||||
|
||||
const EMPTY_PLAN: StaffingResponse = {
|
||||
sensor: '',
|
||||
scenario: 'base',
|
||||
standard: 'standard',
|
||||
assumptions: {
|
||||
visitors_per_staff_hour: 25,
|
||||
safety_factor: 1.15,
|
||||
min_staff: 1,
|
||||
shift_length_h: 4,
|
||||
labor_cost_eur_h: 16,
|
||||
store_hours: { open: '10:00', close: '20:00', tz: 'Europe/Berlin' },
|
||||
},
|
||||
hours: [],
|
||||
shifts: [],
|
||||
summary: {
|
||||
coverage_pct: 0,
|
||||
cost_eur: 0,
|
||||
flat_schedule_cost_eur: 0,
|
||||
overstaffed_hours: 0,
|
||||
understaffed_hours: 0,
|
||||
},
|
||||
why: [],
|
||||
cached: false,
|
||||
data_version: '',
|
||||
model_version: '',
|
||||
context_version: '',
|
||||
}
|
||||
|
||||
const { data: baseData } = await useFetch<StaffingResponse>('/api/staffing', {
|
||||
query: computed(() => ({ sensor: sensorId.value, scenario: 'base', standard: 'standard' })),
|
||||
})
|
||||
const { data: scenarioData, status } = await useFetch<StaffingResponse>('/api/staffing', {
|
||||
query: computed(() => ({ sensor: sensorId.value, scenario: scenario.value, standard: 'standard' })),
|
||||
})
|
||||
|
||||
const basePlan = computed(() => baseData.value ?? EMPTY_PLAN)
|
||||
const scenarioPlan = computed(() => scenarioData.value ?? basePlan.value)
|
||||
|
||||
const weekStart = computed(() => {
|
||||
const first = basePlan.value.hours[0]
|
||||
return first ? berlinParts(first.t).date : planWeekStart(demoNow)
|
||||
})
|
||||
const weekEnd = computed(() => addDays(weekStart.value, 6))
|
||||
|
||||
const activeSensor = computed(() => sensors.value?.find((sensor) => sensor.id === sensorId.value))
|
||||
const sensorOptions = computed(() =>
|
||||
(sensors.value ?? []).map((sensor) => ({ value: sensor.id, label: sensor.name })),
|
||||
)
|
||||
const activePreset = computed(() => presets.value?.find((preset) => preset.id === scenario.value))
|
||||
const radioOptions = computed(() =>
|
||||
(presets.value ?? []).map((preset) => ({
|
||||
value: preset.id,
|
||||
label: preset.label,
|
||||
description: preset.description,
|
||||
})),
|
||||
)
|
||||
|
||||
const baseHours = computed(() => basePlan.value.hours.reduce((sum, hour) => sum + hour.scheduled_staff, 0))
|
||||
const scenarioHours = computed(() =>
|
||||
scenarioPlan.value.hours.reduce((sum, hour) => sum + hour.scheduled_staff, 0),
|
||||
)
|
||||
const deltaHours = computed(() => scenarioHours.value - baseHours.value)
|
||||
const deltaCost = computed(() => scenarioPlan.value.summary.cost_eur - basePlan.value.summary.cost_eur)
|
||||
|
||||
function peakStaffByDay(plan: StaffingResponse) {
|
||||
const map: Record<string, number> = {}
|
||||
for (const hour of plan.hours) {
|
||||
const date = berlinParts(hour.t).date
|
||||
map[date] = Math.max(map[date] ?? 0, hour.required_staff)
|
||||
}
|
||||
return map
|
||||
}
|
||||
const basePeaks = computed(() => peakStaffByDay(basePlan.value))
|
||||
const scenarioPeaks = computed(() => peakStaffByDay(scenarioPlan.value))
|
||||
|
||||
const days = computed(() =>
|
||||
[...new Set([...Object.keys(basePeaks.value), ...Object.keys(scenarioPeaks.value)])]
|
||||
.sort()
|
||||
.map((date) => ({
|
||||
date,
|
||||
base: basePeaks.value[date] ?? 0,
|
||||
scenario: scenarioPeaks.value[date] ?? 0,
|
||||
})),
|
||||
)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="page page-stack">
|
||||
<header class="page-header">
|
||||
<div>
|
||||
<p class="eyebrow">Simulate · {{ weekLabel(weekStart, weekEnd) }}</p>
|
||||
<OnyxHeadline is="h1">Change the weather, watch the plan move.</OnyxHeadline>
|
||||
<p class="lede">
|
||||
A scenario changes forecast footfall, not history. Compare the shift requirement against the base week
|
||||
for <strong>{{ activeSensor?.name ?? 'Stadtgalerie' }}</strong>.
|
||||
</p>
|
||||
</div>
|
||||
<div style="min-width: 14rem">
|
||||
<OnyxSelect
|
||||
v-model="sensorId"
|
||||
label="Sensor"
|
||||
list-label="Inner-city sensors"
|
||||
:options="sensorOptions"
|
||||
density="compact"
|
||||
/>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="callout">
|
||||
<OnyxIcon :icon="iconCircleInformation" size="16px" color="primary" />
|
||||
The base and scenario plans are generated by Go /api/staffing. The presenter broadcasts from
|
||||
<NuxtLink to="/control">/control</NuxtLink>; <NuxtLink to="/stage">/stage</NuxtLink> and
|
||||
<NuxtLink to="/live">/live</NuxtLink> follow the scenario over SSE with a 5 s polling fallback.
|
||||
</div>
|
||||
|
||||
<div class="split-grid">
|
||||
<div class="card-stack">
|
||||
<OnyxCard>
|
||||
<div class="card-header">
|
||||
<div>
|
||||
<OnyxHeadline is="h2">Scenario</OnyxHeadline>
|
||||
<p class="small muted" style="margin: 0">The contract enum is fixed; the API applies the perturbation.</p>
|
||||
</div>
|
||||
<OnyxBadge :color="status === 'pending' ? 'warning' : 'success'" density="compact">
|
||||
{{ status === 'pending' ? 'loading' : 'Go API' }}
|
||||
</OnyxBadge>
|
||||
</div>
|
||||
<OnyxRadioGroup
|
||||
v-model="scenario"
|
||||
label="Choose a scenario"
|
||||
:options="radioOptions"
|
||||
orientation="vertical"
|
||||
/>
|
||||
</OnyxCard>
|
||||
|
||||
<OnyxCard>
|
||||
<div class="card-header">
|
||||
<div>
|
||||
<OnyxHeadline is="h2">Day by day</OnyxHeadline>
|
||||
<p class="small muted" style="margin: 0">Peak required staff per day, base vs scenario.</p>
|
||||
</div>
|
||||
</div>
|
||||
<OnyxTable striped :table-attrs="{ style: 'min-width: 30rem' }">
|
||||
<template #head>
|
||||
<tr>
|
||||
<th scope="col">Day</th>
|
||||
<th scope="col">Base peak</th>
|
||||
<th scope="col">Scenario peak</th>
|
||||
<th scope="col">Δ staff</th>
|
||||
</tr>
|
||||
</template>
|
||||
<tr v-for="day in days" :key="day.date">
|
||||
<th scope="row" style="text-align: left; font-weight: 600">
|
||||
{{ formatWeekday(day.date) }}
|
||||
<span class="muted" style="font-weight: 400">{{ formatShortDate(day.date) }}</span>
|
||||
</th>
|
||||
<td>{{ day.base }}</td>
|
||||
<td>{{ day.scenario }}</td>
|
||||
<td>
|
||||
<OnyxBadge :color="day.scenario > day.base ? 'warning' : day.scenario < day.base ? 'success' : 'neutral'" density="compact">
|
||||
{{ day.scenario === day.base ? '±0' : `${day.scenario > day.base ? '+' : ''}${day.scenario - day.base}` }}
|
||||
</OnyxBadge>
|
||||
</td>
|
||||
</tr>
|
||||
</OnyxTable>
|
||||
</OnyxCard>
|
||||
</div>
|
||||
|
||||
<aside class="card-stack">
|
||||
<OnyxCard>
|
||||
<div class="card-header">
|
||||
<OnyxHeadline is="h2">What changes</OnyxHeadline>
|
||||
<OnyxIcon :icon="iconFlash" size="24px" color="primary" />
|
||||
</div>
|
||||
<p style="margin-top: 0"><strong>{{ activePreset?.label ?? 'Base week' }}</strong></p>
|
||||
<p class="small muted" style="margin-top: 0">{{ activePreset?.description }}</p>
|
||||
<dl class="metric-list">
|
||||
<div><dt>Base staff-hours</dt><dd>{{ baseHours }}</dd></div>
|
||||
<div><dt>Scenario staff-hours</dt><dd>{{ scenarioHours }}</dd></div>
|
||||
<div><dt>Δ staff-hours</dt><dd>{{ deltaHours >= 0 ? '+' : '' }}{{ deltaHours }}</dd></div>
|
||||
<div><dt>Δ labour cost</dt><dd>{{ deltaCost >= 0 ? '+' : '' }}{{ formatEuro(deltaCost) }}</dd></div>
|
||||
<div><dt>Base cost</dt><dd>{{ formatEuro(basePlan.summary.cost_eur) }}</dd></div>
|
||||
<div><dt>Scenario cost</dt><dd>{{ formatEuro(scenarioPlan.summary.cost_eur) }}</dd></div>
|
||||
</dl>
|
||||
<div class="callout" style="margin-top: var(--onyx-density-md)">
|
||||
<p class="small" style="margin: 0">
|
||||
<template v-if="deltaHours > 0">
|
||||
This scenario adds {{ deltaHours }} staff-hours. Check that the Saturday block can be covered before
|
||||
approving.
|
||||
</template>
|
||||
<template v-else-if="deltaHours < 0">
|
||||
This scenario removes {{ Math.abs(deltaHours) }} staff-hours. The plan gets cheaper, but check the
|
||||
peak hour before cutting the block.
|
||||
</template>
|
||||
<template v-else>
|
||||
This scenario does not change the shift requirements. That is a result, not a bug.
|
||||
</template>
|
||||
</p>
|
||||
</div>
|
||||
<OnyxButton
|
||||
:label="`Apply to plan`"
|
||||
:icon="iconArrowRight"
|
||||
icon-position="right"
|
||||
color="primary"
|
||||
:link="`/plan?scenario=${scenario}`"
|
||||
style="margin-top: var(--onyx-density-md)"
|
||||
/>
|
||||
</OnyxCard>
|
||||
|
||||
<OnyxCard>
|
||||
<div class="card-header">
|
||||
<OnyxHeadline is="h3">Scenario rules</OnyxHeadline>
|
||||
</div>
|
||||
<ul class="why-list">
|
||||
<li><span><strong>Base week</strong> — latest forecast weather, no scenario uplift.</span></li>
|
||||
<li><span><strong>Sunny Saturday + market</strong> — Go applies the market/day uplift to next Saturday.</span></li>
|
||||
<li><span><strong>Rainy Saturday</strong> — Go applies the wet-weather reduction.</span></li>
|
||||
<li><span><strong>Wednesday event</strong> — Go applies the weekday evening event uplift.</span></li>
|
||||
</ul>
|
||||
<p class="small muted table-note">
|
||||
Scenario perturbations are produced by the Go/ML stack. This page reads the base and scenario plans from
|
||||
/api/staffing; it does not invent its own multipliers.
|
||||
</p>
|
||||
</OnyxCard>
|
||||
|
||||
<OnyxCard>
|
||||
<div class="card-header">
|
||||
<OnyxHeadline is="h3">Context</OnyxHeadline>
|
||||
</div>
|
||||
<p class="small muted" style="margin-top: 0">
|
||||
Weather now: {{ context?.weather.now.temp_c ?? '—' }} °C, {{ context?.weather.now.precip_mm ?? '—' }} mm
|
||||
precipitation.
|
||||
</p>
|
||||
<p class="small muted" style="margin: 0">
|
||||
{{ formatWeekdayShort(weekStart) }} {{ formatShortDate(weekStart) }} → {{ formatWeekdayShort(weekEnd) }}
|
||||
{{ formatShortDate(weekEnd) }} · Europe/Berlin.
|
||||
</p>
|
||||
</OnyxCard>
|
||||
</aside>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,560 @@
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
iconArrowRight,
|
||||
iconCalendar,
|
||||
iconCheck,
|
||||
iconMobileSignal,
|
||||
iconQrCode,
|
||||
iconSync,
|
||||
iconTriangleWarning,
|
||||
iconUserGroup,
|
||||
} from '@sit-onyx/icons'
|
||||
import { scenarioLabel } from '#shared/live'
|
||||
import type {
|
||||
ForecastResponse,
|
||||
ScenarioState,
|
||||
Sensor,
|
||||
Shift,
|
||||
StaffingHour,
|
||||
StaffingResponse,
|
||||
} from '#shared/types'
|
||||
import { formatDateTime, formatEuro, formatPercent, formatShortDate, formatWeekday } from '~/utils/format'
|
||||
|
||||
useHead({ title: 'Stage — PulseCast live decision' })
|
||||
|
||||
const { data: sensors } = await useFetch<Sensor[]>('/api/sensors')
|
||||
const { data: initialScenario } = await useFetch<ScenarioState>('/api/scenario')
|
||||
|
||||
const sensorId = ref(
|
||||
sensors.value?.find((sensor) => sensor.id === 'hn-stadtgalerie-01')?.id ??
|
||||
sensors.value?.[0]?.id ??
|
||||
'hn-stadtgalerie-01',
|
||||
)
|
||||
const live = useLiveScenario(initialScenario.value)
|
||||
|
||||
const {
|
||||
data: planData,
|
||||
status: planStatus,
|
||||
error: planError,
|
||||
refresh: refreshPlan,
|
||||
} = await useFetch<StaffingResponse>('/api/staffing', {
|
||||
query: computed(() => ({
|
||||
sensor: sensorId.value,
|
||||
scenario: live.scenarioId,
|
||||
standard: 'standard',
|
||||
})),
|
||||
})
|
||||
|
||||
const {
|
||||
data: forecastData,
|
||||
error: forecastError,
|
||||
refresh: refreshForecast,
|
||||
} = await useFetch<ForecastResponse>('/api/forecast', {
|
||||
query: computed(() => ({
|
||||
sensor: sensorId.value,
|
||||
horizon: '7d',
|
||||
scenario: live.scenarioId,
|
||||
})),
|
||||
})
|
||||
|
||||
// A new version of the same scenario (new weather/event values) does not
|
||||
// change the query string, so refresh explicitly. A different scenario id
|
||||
// already triggers useFetch's own query watcher.
|
||||
let lastScenarioId = live.scenarioId
|
||||
watch(
|
||||
() => live.revision,
|
||||
() => {
|
||||
if (live.scenarioId === lastScenarioId) {
|
||||
void refreshPlan()
|
||||
void refreshForecast()
|
||||
}
|
||||
lastScenarioId = live.scenarioId
|
||||
},
|
||||
)
|
||||
|
||||
const plan = computed<StaffingResponse | null>(() => planData.value ?? null)
|
||||
const activeSensor = computed(() => sensors.value?.find((sensor) => sensor.id === sensorId.value))
|
||||
|
||||
function maxOf<T>(items: T[], score: (item: T) => number): T | undefined {
|
||||
let best: T | undefined
|
||||
for (const item of items) if (!best || score(item) > score(best)) best = item
|
||||
return best
|
||||
}
|
||||
|
||||
const peakShift = computed<Shift | undefined>(() =>
|
||||
plan.value ? maxOf(plan.value.shifts, (shift) => shift.staff) : undefined,
|
||||
)
|
||||
const peakHour = computed<StaffingHour | undefined>(() =>
|
||||
plan.value ? maxOf(plan.value.hours, (hour) => hour.required_staff) : undefined,
|
||||
)
|
||||
const peakStaff = computed(() => peakShift.value?.staff ?? peakHour.value?.required_staff ?? 0)
|
||||
const totalStaffHours = computed(() =>
|
||||
plan.value ? plan.value.hours.reduce((sum, hour) => sum + hour.scheduled_staff, 0) : 0,
|
||||
)
|
||||
const forecastPeak = computed(() => {
|
||||
const points = forecastData.value?.points ?? []
|
||||
return points.length ? Math.max(...points.map((point) => point.v)) : 0
|
||||
})
|
||||
const saving = computed(() =>
|
||||
plan.value ? Math.max(0, plan.value.summary.flat_schedule_cost_eur - plan.value.summary.cost_eur) : 0,
|
||||
)
|
||||
|
||||
const requestUrl = useRequestURL()
|
||||
const liveUrl = computed(() => {
|
||||
const origin = import.meta.client ? window.location.origin : requestUrl.origin
|
||||
return `${origin}/live`
|
||||
})
|
||||
const qrSrc = computed(() => `/api/qr?text=${encodeURIComponent(liveUrl.value)}`)
|
||||
|
||||
const headline = computed(() => {
|
||||
if (!plan.value) return 'Waiting for the next staffing plan.'
|
||||
const shift = peakShift.value
|
||||
if (!shift) return 'Next week has no shift blocks yet.'
|
||||
return `${formatWeekday(shift.date)} peak: ${shift.staff} staff, ${shift.start}–${shift.end}.`
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="page page-stack stage-page">
|
||||
<header class="stage-hero">
|
||||
<div class="stage-hero__copy">
|
||||
<div class="stage-kicker">
|
||||
<OnyxBadge color="neutral" density="compact">PulseCast stage</OnyxBadge>
|
||||
<LiveStatusBadge :status="live.status" :last-event-at="live.lastEventAt" />
|
||||
<OnyxBadge v-if="plan?.cached" color="warning" density="compact">cached forecast</OnyxBadge>
|
||||
</div>
|
||||
<h1 class="stage-headline">{{ headline }}</h1>
|
||||
<p class="stage-sub">
|
||||
{{ activeSensor?.name ?? 'Stadtgalerie' }} · {{ scenarioLabel(live.scenarioId) }} ·
|
||||
{{ plan ? `${totalStaffHours} staff-hours` : 'waiting for the API' }} · updates live via SSE
|
||||
</p>
|
||||
<div class="stage-scenario">
|
||||
<OnyxIcon :icon="iconCalendar" size="18px" color="primary" />
|
||||
<span>
|
||||
<strong>Scenario version {{ live.version || '—' }}</strong>
|
||||
<template v-if="live.scenarioAt"> · broadcast {{ formatDateTime(live.scenarioAt) }}</template>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="stage-qr">
|
||||
<div class="stage-qr__frame">
|
||||
<img :src="qrSrc" width="220" height="220" :alt="`QR code to ${liveUrl}`" />
|
||||
</div>
|
||||
<p class="stage-qr__label">
|
||||
<OnyxIcon :icon="iconQrCode" size="16px" color="primary" />
|
||||
Scan for the phone view
|
||||
</p>
|
||||
<p class="stage-qr__url mono">{{ liveUrl }}</p>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div v-if="planError" class="callout callout--warning" role="alert">
|
||||
<OnyxIcon :icon="iconTriangleWarning" size="18px" color="warning" />
|
||||
<div>
|
||||
<strong>The plan is unavailable.</strong>
|
||||
<span class="muted"> {{ planError.statusMessage ?? 'Check the Go API and ML service.' }}</span>
|
||||
</div>
|
||||
<OnyxButton label="Retry" mode="outline" density="compact" :icon="iconSync" @click="refreshPlan()" />
|
||||
</div>
|
||||
|
||||
<div v-else-if="planStatus === 'pending' && !plan" class="callout">
|
||||
<OnyxIcon :icon="iconSync" size="18px" color="primary" class="spin-slow" />
|
||||
<span>Loading the current staffing plan…</span>
|
||||
</div>
|
||||
|
||||
<div v-else-if="plan && !plan.hours.length" class="callout callout--warning" role="status">
|
||||
<OnyxIcon :icon="iconTriangleWarning" size="18px" color="warning" />
|
||||
<span>No open hours are available for this sensor yet. Check the data window or pick another store.</span>
|
||||
</div>
|
||||
|
||||
<section class="stage-metrics" aria-label="Decision summary">
|
||||
<div class="stage-metric stage-metric--primary">
|
||||
<p class="stage-metric__label"><OnyxIcon :icon="iconUserGroup" size="18px" color="primary" /> Peak staff</p>
|
||||
<p class="stage-metric__value">{{ plan ? peakStaff : '—' }}</p>
|
||||
<p class="stage-metric__hint">
|
||||
<template v-if="peakShift">{{ formatWeekday(peakShift.date) }} {{ peakShift.start }}–{{ peakShift.end }}</template>
|
||||
<template v-else>Per shift block</template>
|
||||
</p>
|
||||
</div>
|
||||
<div class="stage-metric">
|
||||
<p class="stage-metric__label">Labour cost</p>
|
||||
<p class="stage-metric__value">{{ plan ? formatEuro(plan.summary.cost_eur) : '—' }}</p>
|
||||
<p class="stage-metric__hint">{{ plan ? `€${plan.assumptions.labor_cost_eur_h}/h assumption` : '—' }}</p>
|
||||
</div>
|
||||
<div class="stage-metric">
|
||||
<p class="stage-metric__label">Coverage</p>
|
||||
<p class="stage-metric__value">{{ plan ? formatPercent(plan.summary.coverage_pct, 1) : '—' }}</p>
|
||||
<p class="stage-metric__hint">
|
||||
{{ plan ? `${plan.summary.understaffed_hours} h under` : '—' }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="stage-metric">
|
||||
<p class="stage-metric__label">Forecast peak</p>
|
||||
<p class="stage-metric__value">{{ forecastPeak ? Math.round(forecastPeak) : '—' }}</p>
|
||||
<p class="stage-metric__hint">estimated devices/hour</p>
|
||||
</div>
|
||||
<div class="stage-metric">
|
||||
<p class="stage-metric__label">vs flat schedule</p>
|
||||
<p class="stage-metric__value">−{{ plan ? formatEuro(saving) : '—' }}</p>
|
||||
<p class="stage-metric__hint">same coverage, fewer hours</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div class="stage-grid">
|
||||
<section class="stage-panel" aria-labelledby="stage-decision">
|
||||
<div class="stage-panel__head">
|
||||
<OnyxHeadline id="stage-decision" is="h2">The decision on stage</OnyxHeadline>
|
||||
<OnyxBadge color="success" density="compact">{{ scenarioLabel(live.scenarioId) }}</OnyxBadge>
|
||||
</div>
|
||||
<p class="stage-decision">
|
||||
<template v-if="peakShift">
|
||||
Put <strong>{{ peakShift.staff }} staff</strong> on {{ formatWeekday(peakShift.date) }}
|
||||
{{ formatShortDate(peakShift.date) }}, {{ peakShift.start }}–{{ peakShift.end }}.
|
||||
</template>
|
||||
<template v-else>Pick a store and scenario; the recommendation appears here.</template>
|
||||
</p>
|
||||
<p class="stage-why">
|
||||
<OnyxIcon :icon="iconCheck" size="18px" color="success" />
|
||||
<template v-if="plan">
|
||||
{{ plan.summary.understaffed_hours === 0 ? 'Every open hour is covered by the block plan.' : `${plan.summary.understaffed_hours} hours are below requirement.` }}
|
||||
{{ plan.summary.overstaffed_hours }} hours are intentionally over requirement.
|
||||
</template>
|
||||
<template v-else>Nothing to approve yet.</template>
|
||||
</p>
|
||||
<div class="stage-actions">
|
||||
<OnyxButton label="Presenter control" link="/control" color="primary" :icon="iconArrowRight" icon-position="right" />
|
||||
<OnyxButton label="Open full plan" link="/plan" mode="outline" />
|
||||
<OnyxButton label="Refresh" mode="plain" :icon="iconSync" @click="refreshPlan()" />
|
||||
</div>
|
||||
<p v-if="forecastError" class="small muted">
|
||||
Forecast refresh failed: {{ forecastError.statusMessage }}
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<aside class="stage-panel stage-panel--aside">
|
||||
<div class="stage-panel__head">
|
||||
<OnyxHeadline is="h2">On every phone</OnyxHeadline>
|
||||
<OnyxBadge color="info" density="compact">no login</OnyxBadge>
|
||||
</div>
|
||||
<div class="stage-phone">
|
||||
<div class="stage-phone__screen">
|
||||
<p class="stage-phone__kicker"><OnyxIcon :icon="iconMobileSignal" size="14px" color="primary" /> LIVE</p>
|
||||
<p class="stage-phone__value">{{ plan ? peakStaff : '—' }} staff</p>
|
||||
<p class="stage-phone__label">
|
||||
<template v-if="peakShift">{{ formatWeekday(peakShift.date) }} · {{ peakShift.start }}–{{ peakShift.end }}</template>
|
||||
<template v-else>Waiting for the plan</template>
|
||||
</p>
|
||||
<p class="stage-phone__scenario">{{ scenarioLabel(live.scenarioId) }} · v{{ live.version || '—' }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<p class="small muted">
|
||||
The audience scans the QR code. The same scenario event refreshes the phone view and this screen within
|
||||
the SSE round trip.
|
||||
</p>
|
||||
</aside>
|
||||
</div>
|
||||
|
||||
<footer class="stage-footer">
|
||||
<span>
|
||||
<strong>Assumptions:</strong> {{ plan?.assumptions.visitors_per_staff_hour ?? 25 }} visitors per staff-hour,
|
||||
×{{ plan?.assumptions.safety_factor ?? 1.15 }} safety, {{ plan?.assumptions.shift_length_h ?? 4 }} h blocks,
|
||||
store hours {{ plan?.assumptions.store_hours.open ?? '10:00' }}–{{ plan?.assumptions.store_hours.close ?? '20:00' }}.
|
||||
</span>
|
||||
<span class="muted">
|
||||
Estimated devices, not people · 8 sensors in a 580 m cluster · no POS or payroll feed ·
|
||||
last update {{ plan ? formatDateTime(live.scenarioAt || plan.context_version) : '—' }}
|
||||
</span>
|
||||
</footer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.stage-page {
|
||||
gap: clamp(1rem, 2vw, 1.75rem);
|
||||
}
|
||||
|
||||
.stage-hero {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
gap: clamp(1rem, 3vw, 2.5rem);
|
||||
align-items: center;
|
||||
padding: clamp(1.25rem, 2.5vw, 2.5rem);
|
||||
border: 1px solid var(--onyx-color-base-primary-200);
|
||||
border-radius: var(--onyx-radius-component-container-soft);
|
||||
background:
|
||||
radial-gradient(circle at 100% 0%, var(--onyx-color-base-primary-200), transparent 45%),
|
||||
linear-gradient(135deg, var(--onyx-color-base-primary-100), var(--onyx-color-base-neutral-100) 70%);
|
||||
}
|
||||
|
||||
.stage-kicker,
|
||||
.stage-scenario,
|
||||
.stage-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: var(--onyx-density-sm);
|
||||
}
|
||||
|
||||
.stage-headline {
|
||||
max-width: 24ch;
|
||||
margin: var(--onyx-density-sm) 0 0;
|
||||
font-size: clamp(2.1rem, 4.8vw, 4.5rem);
|
||||
font-weight: 800;
|
||||
letter-spacing: -0.03em;
|
||||
line-height: 1.02;
|
||||
color: var(--onyx-color-text-icons-primary-intense);
|
||||
}
|
||||
|
||||
.stage-sub {
|
||||
max-width: 70ch;
|
||||
margin: var(--onyx-density-sm) 0 0;
|
||||
color: var(--onyx-color-text-icons-neutral-medium);
|
||||
font-size: clamp(0.95rem, 1.5vw, 1.15rem);
|
||||
}
|
||||
|
||||
.stage-scenario {
|
||||
margin-top: var(--onyx-density-md);
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.stage-qr {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: var(--onyx-density-xs);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.stage-qr__frame {
|
||||
padding: 0.65rem;
|
||||
border: 1px solid var(--onyx-color-base-neutral-300);
|
||||
border-radius: var(--onyx-radius-component-container-soft);
|
||||
background: #fff;
|
||||
box-shadow: var(--onyx-shadow-soft-bottom);
|
||||
}
|
||||
|
||||
.stage-qr__frame img {
|
||||
display: block;
|
||||
width: min(220px, 32vw);
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.stage-qr__label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
margin: 0;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.stage-qr__url {
|
||||
max-width: 18rem;
|
||||
margin: 0;
|
||||
overflow-wrap: anywhere;
|
||||
color: var(--onyx-color-text-icons-neutral-medium);
|
||||
}
|
||||
|
||||
.stage-metrics {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(5, minmax(0, 1fr));
|
||||
gap: var(--onyx-density-sm);
|
||||
}
|
||||
|
||||
.stage-metric {
|
||||
min-width: 0;
|
||||
padding: var(--onyx-density-md);
|
||||
border: 1px solid var(--onyx-color-base-neutral-300);
|
||||
border-radius: var(--onyx-radius-component-container-soft);
|
||||
background: var(--onyx-color-base-neutral-100);
|
||||
}
|
||||
|
||||
.stage-metric--primary {
|
||||
border-color: var(--onyx-color-base-primary-400);
|
||||
background: var(--onyx-color-base-primary-100);
|
||||
}
|
||||
|
||||
.stage-metric__label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
margin: 0;
|
||||
color: var(--onyx-color-text-icons-neutral-medium);
|
||||
font-size: 0.8rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.stage-metric__value {
|
||||
margin: var(--onyx-density-xs) 0 0;
|
||||
font-size: clamp(1.5rem, 2.6vw, 2.5rem);
|
||||
font-weight: 800;
|
||||
line-height: 1.05;
|
||||
}
|
||||
|
||||
.stage-metric__hint {
|
||||
margin: var(--onyx-density-2xs) 0 0;
|
||||
color: var(--onyx-color-text-icons-neutral-soft);
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.stage-grid {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1.65fr) minmax(16rem, 1fr);
|
||||
gap: var(--onyx-density-lg);
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
.stage-panel {
|
||||
min-width: 0;
|
||||
padding: clamp(1rem, 2vw, 1.75rem);
|
||||
border: 1px solid var(--onyx-color-base-neutral-300);
|
||||
border-radius: var(--onyx-radius-component-container-soft);
|
||||
background: var(--onyx-color-base-neutral-100);
|
||||
}
|
||||
|
||||
.stage-panel--aside {
|
||||
background: var(--onyx-color-base-neutral-200);
|
||||
}
|
||||
|
||||
.stage-panel__head {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: var(--onyx-density-xs);
|
||||
}
|
||||
|
||||
.stage-panel__head h2 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.stage-decision {
|
||||
margin: var(--onyx-density-md) 0 0;
|
||||
font-size: clamp(1.1rem, 2vw, 1.5rem);
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
.stage-why {
|
||||
display: flex;
|
||||
gap: var(--onyx-density-xs);
|
||||
align-items: flex-start;
|
||||
margin: var(--onyx-density-sm) 0 0;
|
||||
color: var(--onyx-color-text-icons-neutral-medium);
|
||||
}
|
||||
|
||||
.stage-actions {
|
||||
margin-top: var(--onyx-density-lg);
|
||||
}
|
||||
|
||||
.stage-phone {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-block: var(--onyx-density-md);
|
||||
}
|
||||
|
||||
.stage-phone__screen {
|
||||
width: min(15rem, 100%);
|
||||
padding: var(--onyx-density-md);
|
||||
border: 6px solid #1e293b;
|
||||
border-radius: 1.5rem;
|
||||
background: #fff;
|
||||
box-shadow: var(--onyx-shadow-soft-bottom);
|
||||
}
|
||||
|
||||
.stage-phone__kicker {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.25rem;
|
||||
margin: 0;
|
||||
color: var(--onyx-color-text-icons-primary-intense);
|
||||
font-size: 0.7rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.08em;
|
||||
}
|
||||
|
||||
.stage-phone__value {
|
||||
margin: 0.35rem 0 0;
|
||||
font-size: 2.2rem;
|
||||
font-weight: 800;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.stage-phone__label {
|
||||
margin: 0.25rem 0 0;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.stage-phone__scenario {
|
||||
margin: 0.75rem 0 0;
|
||||
color: var(--onyx-color-text-icons-neutral-medium);
|
||||
font-size: 0.72rem;
|
||||
}
|
||||
|
||||
.stage-footer {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
gap: var(--onyx-density-sm);
|
||||
padding-top: var(--onyx-density-sm);
|
||||
border-top: 1px solid var(--onyx-color-base-neutral-300);
|
||||
color: var(--onyx-color-text-icons-neutral-medium);
|
||||
font-size: 0.75rem;
|
||||
line-height: 1.45;
|
||||
}
|
||||
|
||||
.stage-footer span {
|
||||
max-width: 75ch;
|
||||
}
|
||||
|
||||
.spin-slow {
|
||||
animation: spin 1.4s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.spin-slow {
|
||||
animation: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1100px) {
|
||||
.stage-metrics {
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.stage-hero,
|
||||
.stage-grid {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
|
||||
.stage-qr {
|
||||
align-items: flex-start;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.stage-qr__frame img {
|
||||
width: min(180px, 50vw);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 576px) {
|
||||
.stage-metrics {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.stage-headline {
|
||||
font-size: clamp(1.8rem, 8vw, 2.6rem);
|
||||
}
|
||||
|
||||
.stage-footnote {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,7 @@
|
||||
import type { RouterConfig } from '@nuxt/schema'
|
||||
|
||||
// Onyx scrolls inside .onyx-page__main, not the window, so the default Nuxt
|
||||
// scroll behaviour does not reach the page container.
|
||||
export default {
|
||||
scrollBehavior: createOnyxScrollBehavior(),
|
||||
} satisfies RouterConfig
|
||||
@@ -0,0 +1,27 @@
|
||||
interface ApiErrorLike {
|
||||
status?: number
|
||||
statusCode?: number
|
||||
statusMessage?: string
|
||||
message?: string
|
||||
data?: {
|
||||
error?: { message?: string; code?: string }
|
||||
message?: string
|
||||
}
|
||||
}
|
||||
|
||||
/** Human-readable message from a Nuxt/$fetch error, without leaking tokens. */
|
||||
export function apiErrorMessage(error: unknown, fallback: string): string {
|
||||
const value = error as ApiErrorLike | undefined
|
||||
return (
|
||||
value?.data?.error?.message ??
|
||||
value?.data?.message ??
|
||||
value?.statusMessage ??
|
||||
value?.message ??
|
||||
fallback
|
||||
)
|
||||
}
|
||||
|
||||
export function apiErrorStatus(error: unknown): number | undefined {
|
||||
const value = error as ApiErrorLike | undefined
|
||||
return value?.status ?? value?.statusCode
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
import { BERLIN_TZ } from '#shared/staffing'
|
||||
|
||||
const dateFormatter = new Intl.DateTimeFormat('en-GB', {
|
||||
timeZone: BERLIN_TZ,
|
||||
day: 'numeric',
|
||||
month: 'short',
|
||||
year: 'numeric',
|
||||
})
|
||||
|
||||
const shortDateFormatter = new Intl.DateTimeFormat('en-GB', {
|
||||
timeZone: BERLIN_TZ,
|
||||
day: 'numeric',
|
||||
month: 'short',
|
||||
})
|
||||
|
||||
const weekdayFormatter = new Intl.DateTimeFormat('en-GB', {
|
||||
timeZone: BERLIN_TZ,
|
||||
weekday: 'long',
|
||||
})
|
||||
|
||||
const weekdayShortFormatter = new Intl.DateTimeFormat('en-GB', {
|
||||
timeZone: BERLIN_TZ,
|
||||
weekday: 'short',
|
||||
})
|
||||
|
||||
const dateTimeFormatter = new Intl.DateTimeFormat('en-GB', {
|
||||
timeZone: BERLIN_TZ,
|
||||
day: 'numeric',
|
||||
month: 'short',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
hourCycle: 'h23',
|
||||
})
|
||||
|
||||
const timeFormatter = new Intl.DateTimeFormat('en-GB', {
|
||||
timeZone: BERLIN_TZ,
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
hourCycle: 'h23',
|
||||
})
|
||||
|
||||
const euroFormatter = new Intl.NumberFormat('en-GB', {
|
||||
style: 'currency',
|
||||
currency: 'EUR',
|
||||
maximumFractionDigits: 0,
|
||||
})
|
||||
|
||||
const numberFormatter = new Intl.NumberFormat('en-GB')
|
||||
|
||||
/** Date-only strings are parsed at noon UTC so the local date never shifts. */
|
||||
function toDate(value: string): Date {
|
||||
return value.length > 10 ? new Date(value) : new Date(`${value}T12:00:00Z`)
|
||||
}
|
||||
|
||||
function formatWith(formatter: Intl.DateTimeFormat, value: string): string {
|
||||
const date = toDate(value)
|
||||
return Number.isNaN(date.getTime()) ? '—' : formatter.format(date)
|
||||
}
|
||||
|
||||
export function formatDate(date: string): string {
|
||||
return formatWith(dateFormatter, date)
|
||||
}
|
||||
|
||||
export function formatShortDate(date: string): string {
|
||||
return formatWith(shortDateFormatter, date)
|
||||
}
|
||||
|
||||
export function formatWeekday(date: string): string {
|
||||
return formatWith(weekdayFormatter, date)
|
||||
}
|
||||
|
||||
export function formatWeekdayShort(date: string): string {
|
||||
return formatWith(weekdayShortFormatter, date)
|
||||
}
|
||||
|
||||
/** Format a wire timestamp in Heilbronn local time. */
|
||||
export function formatDateTime(iso: string): string {
|
||||
return formatWith(dateTimeFormatter, iso)
|
||||
}
|
||||
|
||||
export function formatTime(iso: string): string {
|
||||
return formatWith(timeFormatter, iso)
|
||||
}
|
||||
|
||||
export function formatEuro(value: number): string {
|
||||
return euroFormatter.format(value)
|
||||
}
|
||||
|
||||
export function formatNumber(value: number): string {
|
||||
return numberFormatter.format(value)
|
||||
}
|
||||
|
||||
export function formatPercent(value: number, digits = 0): string {
|
||||
return `${value.toFixed(digits)}%`
|
||||
}
|
||||
|
||||
export function weekLabel(start: string, end: string): string {
|
||||
return `${formatShortDate(start)} – ${formatDate(end)}`
|
||||
}
|
||||
+1410
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"now": "2026-11-14T08:12:00Z",
|
||||
"plan_start": "2026-11-15T23:00:00Z",
|
||||
"plan_end": "2026-11-22T23:00:00Z",
|
||||
"timezone": "Europe/Berlin"
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"data_version": "2026-11-14T03:00:00Z",
|
||||
"model_version": "histgb-2026-11-14",
|
||||
"context_version": "2026-11-14T03:00:00Z",
|
||||
"coverage": {
|
||||
"sensors": 8,
|
||||
"from": "2025-10-16T21:00:00Z",
|
||||
"to": "2026-11-07T23:51:00Z",
|
||||
"cadence_min": 15
|
||||
},
|
||||
"metrics": {
|
||||
"model": "weather",
|
||||
"mae": 3.36,
|
||||
"wape": 27.8,
|
||||
"r2": 0.779,
|
||||
"baseline_mae": 5.4,
|
||||
"baseline_wape": 44.7
|
||||
},
|
||||
"limits": [
|
||||
"estimated devices, not people",
|
||||
"8 sensors in a 580 m cluster",
|
||||
"observed weather in training; forecast weather in scenarios"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"scenario": {
|
||||
"scenario": "base"
|
||||
},
|
||||
"at": "2026-11-14T08:12:00Z"
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
[
|
||||
{
|
||||
"id": "base",
|
||||
"label": "Base week",
|
||||
"short": "Base",
|
||||
"description": "Normal week, latest forecast weather.",
|
||||
"weather": {
|
||||
"temp_delta_c": 0,
|
||||
"precip_mm": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "sunny-saturday-market",
|
||||
"label": "Sunny Saturday + market",
|
||||
"short": "Sun + market",
|
||||
"description": "Dry, mild Saturday with a market event; assumes +20% Saturday footfall.",
|
||||
"weather": {
|
||||
"temp_delta_c": 4,
|
||||
"precip_mm": 0
|
||||
},
|
||||
"event": {
|
||||
"type": "market",
|
||||
"uplift": 0.2
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "rainy-saturday",
|
||||
"label": "Rainy Saturday",
|
||||
"short": "Rainy Sat",
|
||||
"description": "Steady rain on Saturday; assumes −18% Saturday footfall.",
|
||||
"weather": {
|
||||
"temp_delta_c": -2,
|
||||
"precip_mm": 3.2
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "weekday-event",
|
||||
"label": "Wednesday evening event",
|
||||
"short": "Wed event",
|
||||
"description": "Evening event nearby; assumes +25% footfall Wed 16:00–20:00.",
|
||||
"weather": {
|
||||
"temp_delta_c": 0,
|
||||
"precip_mm": 0
|
||||
},
|
||||
"event": {
|
||||
"type": "concert",
|
||||
"uplift": 0.25
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,74 @@
|
||||
[
|
||||
{
|
||||
"id": "hn-stadtgalerie-01",
|
||||
"name": "Stadtgalerie",
|
||||
"lat": 49.1427,
|
||||
"lon": 9.2109,
|
||||
"mean": 51.9,
|
||||
"p95": 131,
|
||||
"battery": 61
|
||||
},
|
||||
{
|
||||
"id": "hn-kaiserstrasse-02",
|
||||
"name": "Kaiserstraße",
|
||||
"lat": 49.1434,
|
||||
"lon": 9.2142,
|
||||
"mean": 47.4,
|
||||
"p95": 123,
|
||||
"battery": 74
|
||||
},
|
||||
{
|
||||
"id": "hn-marktplatz-03",
|
||||
"name": "Marktplatz",
|
||||
"lat": 49.1414,
|
||||
"lon": 9.2163,
|
||||
"mean": 45.1,
|
||||
"p95": 115,
|
||||
"battery": 87
|
||||
},
|
||||
{
|
||||
"id": "hn-kilianskirche-04",
|
||||
"name": "Kilianskirche",
|
||||
"lat": 49.1418,
|
||||
"lon": 9.2188,
|
||||
"mean": 40,
|
||||
"p95": 106,
|
||||
"battery": 62
|
||||
},
|
||||
{
|
||||
"id": "hn-rathaus-05",
|
||||
"name": "Rathaus",
|
||||
"lat": 49.1407,
|
||||
"lon": 9.2196,
|
||||
"mean": 37.1,
|
||||
"p95": 95,
|
||||
"battery": 75
|
||||
},
|
||||
{
|
||||
"id": "hn-neckartor-06",
|
||||
"name": "Neckartor",
|
||||
"lat": 49.1389,
|
||||
"lon": 9.2172,
|
||||
"mean": 40.6,
|
||||
"p95": 105,
|
||||
"battery": 88
|
||||
},
|
||||
{
|
||||
"id": "hn-suelmerstrasse-07",
|
||||
"name": "Sülmerstraße",
|
||||
"lat": 49.1451,
|
||||
"lon": 9.2158,
|
||||
"mean": 48.5,
|
||||
"p95": 130,
|
||||
"battery": 63
|
||||
},
|
||||
{
|
||||
"id": "hn-harmonie-08",
|
||||
"name": "Harmonie",
|
||||
"lat": 49.1397,
|
||||
"lon": 9.213,
|
||||
"mean": 34,
|
||||
"p95": 90,
|
||||
"battery": 76
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,714 @@
|
||||
{
|
||||
"sensor": "hn-harmonie-08",
|
||||
"step": "1h",
|
||||
"points": [
|
||||
{
|
||||
"t": "2026-11-07T00:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T01:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T02:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T03:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T04:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T05:00:00Z",
|
||||
"v": 14
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T06:00:00Z",
|
||||
"v": 18
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T07:00:00Z",
|
||||
"v": 26
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T08:00:00Z",
|
||||
"v": 33
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T09:00:00Z",
|
||||
"v": 58
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T10:00:00Z",
|
||||
"v": 79
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T11:00:00Z",
|
||||
"v": 100
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T12:00:00Z",
|
||||
"v": 106
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T13:00:00Z",
|
||||
"v": 99
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T14:00:00Z",
|
||||
"v": 94
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T15:00:00Z",
|
||||
"v": 90
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T16:00:00Z",
|
||||
"v": 112
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T17:00:00Z",
|
||||
"v": 120
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T18:00:00Z",
|
||||
"v": 75
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T19:00:00Z",
|
||||
"v": 52
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T20:00:00Z",
|
||||
"v": 41
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T21:00:00Z",
|
||||
"v": 28
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T22:00:00Z",
|
||||
"v": 18
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T23:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T00:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T01:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T02:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T03:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T04:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T05:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T06:00:00Z",
|
||||
"v": 10
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T07:00:00Z",
|
||||
"v": 14
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T08:00:00Z",
|
||||
"v": 19
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T09:00:00Z",
|
||||
"v": 32
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T10:00:00Z",
|
||||
"v": 42
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T11:00:00Z",
|
||||
"v": 52
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T12:00:00Z",
|
||||
"v": 60
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T13:00:00Z",
|
||||
"v": 48
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T14:00:00Z",
|
||||
"v": 44
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T15:00:00Z",
|
||||
"v": 45
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T16:00:00Z",
|
||||
"v": 58
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T17:00:00Z",
|
||||
"v": 66
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T18:00:00Z",
|
||||
"v": 39
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T19:00:00Z",
|
||||
"v": 28
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T20:00:00Z",
|
||||
"v": 20
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T21:00:00Z",
|
||||
"v": 14
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T22:00:00Z",
|
||||
"v": 9
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T23:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T00:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T01:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T02:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T03:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T04:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T05:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T06:00:00Z",
|
||||
"v": 11
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T07:00:00Z",
|
||||
"v": 15
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T08:00:00Z",
|
||||
"v": 18
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T09:00:00Z",
|
||||
"v": 33
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T10:00:00Z",
|
||||
"v": 48
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T11:00:00Z",
|
||||
"v": 57
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T12:00:00Z",
|
||||
"v": 59
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T13:00:00Z",
|
||||
"v": 55
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T14:00:00Z",
|
||||
"v": 54
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T15:00:00Z",
|
||||
"v": 53
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T16:00:00Z",
|
||||
"v": 59
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T17:00:00Z",
|
||||
"v": 64
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T18:00:00Z",
|
||||
"v": 47
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T19:00:00Z",
|
||||
"v": 30
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T20:00:00Z",
|
||||
"v": 23
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T21:00:00Z",
|
||||
"v": 15
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T22:00:00Z",
|
||||
"v": 9
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T23:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T00:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T01:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T02:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T03:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T04:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T05:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T06:00:00Z",
|
||||
"v": 12
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T07:00:00Z",
|
||||
"v": 16
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T08:00:00Z",
|
||||
"v": 21
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T09:00:00Z",
|
||||
"v": 38
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T10:00:00Z",
|
||||
"v": 54
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T11:00:00Z",
|
||||
"v": 63
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T12:00:00Z",
|
||||
"v": 62
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T13:00:00Z",
|
||||
"v": 56
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T14:00:00Z",
|
||||
"v": 59
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T15:00:00Z",
|
||||
"v": 56
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T16:00:00Z",
|
||||
"v": 64
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T17:00:00Z",
|
||||
"v": 76
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T18:00:00Z",
|
||||
"v": 50
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T19:00:00Z",
|
||||
"v": 31
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T20:00:00Z",
|
||||
"v": 23
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T21:00:00Z",
|
||||
"v": 16
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T22:00:00Z",
|
||||
"v": 11
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T23:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T00:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T01:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T02:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T03:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T04:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T05:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T06:00:00Z",
|
||||
"v": 13
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T07:00:00Z",
|
||||
"v": 19
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T08:00:00Z",
|
||||
"v": 23
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T09:00:00Z",
|
||||
"v": 39
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T10:00:00Z",
|
||||
"v": 58
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T11:00:00Z",
|
||||
"v": 67
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T12:00:00Z",
|
||||
"v": 66
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T13:00:00Z",
|
||||
"v": 64
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T14:00:00Z",
|
||||
"v": 55
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T15:00:00Z",
|
||||
"v": 60
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T16:00:00Z",
|
||||
"v": 71
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T17:00:00Z",
|
||||
"v": 82
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T18:00:00Z",
|
||||
"v": 51
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T19:00:00Z",
|
||||
"v": 34
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T20:00:00Z",
|
||||
"v": 25
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T21:00:00Z",
|
||||
"v": 16
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T22:00:00Z",
|
||||
"v": 11
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T23:00:00Z",
|
||||
"v": 9
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T00:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T01:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T02:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T03:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T04:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T05:00:00Z",
|
||||
"v": 9
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T06:00:00Z",
|
||||
"v": 13
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T07:00:00Z",
|
||||
"v": 18
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T08:00:00Z",
|
||||
"v": 25
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T09:00:00Z",
|
||||
"v": 40
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T10:00:00Z",
|
||||
"v": 64
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T11:00:00Z",
|
||||
"v": 77
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T12:00:00Z",
|
||||
"v": 77
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T13:00:00Z",
|
||||
"v": 70
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T14:00:00Z",
|
||||
"v": 60
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T15:00:00Z",
|
||||
"v": 70
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T16:00:00Z",
|
||||
"v": 80
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T17:00:00Z",
|
||||
"v": 87
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T18:00:00Z",
|
||||
"v": 54
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T19:00:00Z",
|
||||
"v": 38
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T20:00:00Z",
|
||||
"v": 28
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T21:00:00Z",
|
||||
"v": 20
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T22:00:00Z",
|
||||
"v": 12
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T23:00:00Z",
|
||||
"v": 10
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T00:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T01:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T02:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T03:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T04:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T05:00:00Z",
|
||||
"v": 10
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T06:00:00Z",
|
||||
"v": 16
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T07:00:00Z",
|
||||
"v": 20
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T08:00:00Z",
|
||||
"v": 28
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T09:00:00Z",
|
||||
"v": 45
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T10:00:00Z",
|
||||
"v": 63
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T11:00:00Z",
|
||||
"v": 76
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T12:00:00Z",
|
||||
"v": 86
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T13:00:00Z",
|
||||
"v": 79
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T14:00:00Z",
|
||||
"v": 68
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T15:00:00Z",
|
||||
"v": 71
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T16:00:00Z",
|
||||
"v": 93
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T17:00:00Z",
|
||||
"v": 97
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T18:00:00Z",
|
||||
"v": 60
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T19:00:00Z",
|
||||
"v": 40
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T20:00:00Z",
|
||||
"v": 31
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T21:00:00Z",
|
||||
"v": 20
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T22:00:00Z",
|
||||
"v": 14
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T23:00:00Z",
|
||||
"v": 13
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T00:00:00Z",
|
||||
"v": 9
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T01:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T02:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T03:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T04:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T05:00:00Z",
|
||||
"v": 13
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T06:00:00Z",
|
||||
"v": 19
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T07:00:00Z",
|
||||
"v": 26
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T08:00:00Z",
|
||||
"v": 35
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,714 @@
|
||||
{
|
||||
"sensor": "hn-kaiserstrasse-02",
|
||||
"step": "1h",
|
||||
"points": [
|
||||
{
|
||||
"t": "2026-11-07T00:00:00Z",
|
||||
"v": 11
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T01:00:00Z",
|
||||
"v": 9
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T02:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T03:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T04:00:00Z",
|
||||
"v": 11
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T05:00:00Z",
|
||||
"v": 20
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T06:00:00Z",
|
||||
"v": 29
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T07:00:00Z",
|
||||
"v": 40
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T08:00:00Z",
|
||||
"v": 52
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T09:00:00Z",
|
||||
"v": 86
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T10:00:00Z",
|
||||
"v": 111
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T11:00:00Z",
|
||||
"v": 143
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T12:00:00Z",
|
||||
"v": 152
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T13:00:00Z",
|
||||
"v": 144
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T14:00:00Z",
|
||||
"v": 126
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T15:00:00Z",
|
||||
"v": 123
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T16:00:00Z",
|
||||
"v": 154
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T17:00:00Z",
|
||||
"v": 181
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T18:00:00Z",
|
||||
"v": 102
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T19:00:00Z",
|
||||
"v": 76
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T20:00:00Z",
|
||||
"v": 51
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T21:00:00Z",
|
||||
"v": 39
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T22:00:00Z",
|
||||
"v": 26
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T23:00:00Z",
|
||||
"v": 9
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T00:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T01:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T02:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T03:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T04:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T05:00:00Z",
|
||||
"v": 9
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T06:00:00Z",
|
||||
"v": 14
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T07:00:00Z",
|
||||
"v": 20
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T08:00:00Z",
|
||||
"v": 27
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T09:00:00Z",
|
||||
"v": 44
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T10:00:00Z",
|
||||
"v": 64
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T11:00:00Z",
|
||||
"v": 70
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T12:00:00Z",
|
||||
"v": 81
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T13:00:00Z",
|
||||
"v": 72
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T14:00:00Z",
|
||||
"v": 63
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T15:00:00Z",
|
||||
"v": 62
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T16:00:00Z",
|
||||
"v": 76
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T17:00:00Z",
|
||||
"v": 82
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T18:00:00Z",
|
||||
"v": 55
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T19:00:00Z",
|
||||
"v": 37
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T20:00:00Z",
|
||||
"v": 27
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T21:00:00Z",
|
||||
"v": 17
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T22:00:00Z",
|
||||
"v": 11
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T23:00:00Z",
|
||||
"v": 10
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T00:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T01:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T02:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T03:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T04:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T05:00:00Z",
|
||||
"v": 11
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T06:00:00Z",
|
||||
"v": 15
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T07:00:00Z",
|
||||
"v": 20
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T08:00:00Z",
|
||||
"v": 26
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T09:00:00Z",
|
||||
"v": 47
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T10:00:00Z",
|
||||
"v": 66
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T11:00:00Z",
|
||||
"v": 76
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T12:00:00Z",
|
||||
"v": 91
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T13:00:00Z",
|
||||
"v": 70
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T14:00:00Z",
|
||||
"v": 72
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T15:00:00Z",
|
||||
"v": 77
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T16:00:00Z",
|
||||
"v": 86
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T17:00:00Z",
|
||||
"v": 95
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T18:00:00Z",
|
||||
"v": 64
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T19:00:00Z",
|
||||
"v": 43
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T20:00:00Z",
|
||||
"v": 29
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T21:00:00Z",
|
||||
"v": 22
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T22:00:00Z",
|
||||
"v": 13
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T23:00:00Z",
|
||||
"v": 11
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T00:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T01:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T02:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T03:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T04:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T05:00:00Z",
|
||||
"v": 10
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T06:00:00Z",
|
||||
"v": 15
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T07:00:00Z",
|
||||
"v": 25
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T08:00:00Z",
|
||||
"v": 29
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T09:00:00Z",
|
||||
"v": 55
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T10:00:00Z",
|
||||
"v": 75
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T11:00:00Z",
|
||||
"v": 91
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T12:00:00Z",
|
||||
"v": 97
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T13:00:00Z",
|
||||
"v": 77
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T14:00:00Z",
|
||||
"v": 78
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T15:00:00Z",
|
||||
"v": 75
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T16:00:00Z",
|
||||
"v": 91
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T17:00:00Z",
|
||||
"v": 98
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T18:00:00Z",
|
||||
"v": 69
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T19:00:00Z",
|
||||
"v": 44
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T20:00:00Z",
|
||||
"v": 33
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T21:00:00Z",
|
||||
"v": 20
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T22:00:00Z",
|
||||
"v": 14
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T23:00:00Z",
|
||||
"v": 12
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T00:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T01:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T02:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T03:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T04:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T05:00:00Z",
|
||||
"v": 13
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T06:00:00Z",
|
||||
"v": 18
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T07:00:00Z",
|
||||
"v": 23
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T08:00:00Z",
|
||||
"v": 34
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T09:00:00Z",
|
||||
"v": 58
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T10:00:00Z",
|
||||
"v": 81
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T11:00:00Z",
|
||||
"v": 100
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T12:00:00Z",
|
||||
"v": 103
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T13:00:00Z",
|
||||
"v": 92
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T14:00:00Z",
|
||||
"v": 87
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T15:00:00Z",
|
||||
"v": 90
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T16:00:00Z",
|
||||
"v": 103
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T17:00:00Z",
|
||||
"v": 103
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T18:00:00Z",
|
||||
"v": 73
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T19:00:00Z",
|
||||
"v": 45
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T20:00:00Z",
|
||||
"v": 33
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T21:00:00Z",
|
||||
"v": 22
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T22:00:00Z",
|
||||
"v": 16
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T23:00:00Z",
|
||||
"v": 13
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T00:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T01:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T02:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T03:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T04:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T05:00:00Z",
|
||||
"v": 12
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T06:00:00Z",
|
||||
"v": 20
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T07:00:00Z",
|
||||
"v": 27
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T08:00:00Z",
|
||||
"v": 34
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T09:00:00Z",
|
||||
"v": 54
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T10:00:00Z",
|
||||
"v": 76
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T11:00:00Z",
|
||||
"v": 103
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T12:00:00Z",
|
||||
"v": 104
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T13:00:00Z",
|
||||
"v": 100
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T14:00:00Z",
|
||||
"v": 81
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T15:00:00Z",
|
||||
"v": 92
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T16:00:00Z",
|
||||
"v": 103
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T17:00:00Z",
|
||||
"v": 124
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T18:00:00Z",
|
||||
"v": 72
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T19:00:00Z",
|
||||
"v": 51
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T20:00:00Z",
|
||||
"v": 38
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T21:00:00Z",
|
||||
"v": 25
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T22:00:00Z",
|
||||
"v": 16
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T23:00:00Z",
|
||||
"v": 14
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T00:00:00Z",
|
||||
"v": 10
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T01:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T02:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T03:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T04:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T05:00:00Z",
|
||||
"v": 13
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T06:00:00Z",
|
||||
"v": 22
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T07:00:00Z",
|
||||
"v": 32
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T08:00:00Z",
|
||||
"v": 39
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T09:00:00Z",
|
||||
"v": 62
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T10:00:00Z",
|
||||
"v": 85
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T11:00:00Z",
|
||||
"v": 120
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T12:00:00Z",
|
||||
"v": 113
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T13:00:00Z",
|
||||
"v": 111
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T14:00:00Z",
|
||||
"v": 92
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T15:00:00Z",
|
||||
"v": 102
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T16:00:00Z",
|
||||
"v": 115
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T17:00:00Z",
|
||||
"v": 138
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T18:00:00Z",
|
||||
"v": 82
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T19:00:00Z",
|
||||
"v": 56
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T20:00:00Z",
|
||||
"v": 44
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T21:00:00Z",
|
||||
"v": 27
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T22:00:00Z",
|
||||
"v": 18
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T23:00:00Z",
|
||||
"v": 17
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T00:00:00Z",
|
||||
"v": 12
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T01:00:00Z",
|
||||
"v": 10
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T02:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T03:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T04:00:00Z",
|
||||
"v": 11
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T05:00:00Z",
|
||||
"v": 19
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T06:00:00Z",
|
||||
"v": 26
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T07:00:00Z",
|
||||
"v": 37
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T08:00:00Z",
|
||||
"v": 47
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,714 @@
|
||||
{
|
||||
"sensor": "hn-kilianskirche-04",
|
||||
"step": "1h",
|
||||
"points": [
|
||||
{
|
||||
"t": "2026-11-07T00:00:00Z",
|
||||
"v": 11
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T01:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T02:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T03:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T04:00:00Z",
|
||||
"v": 9
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T05:00:00Z",
|
||||
"v": 16
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T06:00:00Z",
|
||||
"v": 23
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T07:00:00Z",
|
||||
"v": 32
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T08:00:00Z",
|
||||
"v": 44
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T09:00:00Z",
|
||||
"v": 65
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T10:00:00Z",
|
||||
"v": 106
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T11:00:00Z",
|
||||
"v": 125
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T12:00:00Z",
|
||||
"v": 129
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T13:00:00Z",
|
||||
"v": 112
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T14:00:00Z",
|
||||
"v": 104
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T15:00:00Z",
|
||||
"v": 111
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T16:00:00Z",
|
||||
"v": 133
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T17:00:00Z",
|
||||
"v": 150
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T18:00:00Z",
|
||||
"v": 93
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T19:00:00Z",
|
||||
"v": 59
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T20:00:00Z",
|
||||
"v": 43
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T21:00:00Z",
|
||||
"v": 29
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T22:00:00Z",
|
||||
"v": 20
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T23:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T00:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T01:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T02:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T03:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T04:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T05:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T06:00:00Z",
|
||||
"v": 12
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T07:00:00Z",
|
||||
"v": 15
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T08:00:00Z",
|
||||
"v": 20
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T09:00:00Z",
|
||||
"v": 34
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T10:00:00Z",
|
||||
"v": 51
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T11:00:00Z",
|
||||
"v": 59
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T12:00:00Z",
|
||||
"v": 64
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T13:00:00Z",
|
||||
"v": 53
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T14:00:00Z",
|
||||
"v": 56
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T15:00:00Z",
|
||||
"v": 52
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T16:00:00Z",
|
||||
"v": 71
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T17:00:00Z",
|
||||
"v": 77
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T18:00:00Z",
|
||||
"v": 48
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T19:00:00Z",
|
||||
"v": 29
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T20:00:00Z",
|
||||
"v": 21
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T21:00:00Z",
|
||||
"v": 15
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T22:00:00Z",
|
||||
"v": 11
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T23:00:00Z",
|
||||
"v": 9
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T00:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T01:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T02:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T03:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T04:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T05:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T06:00:00Z",
|
||||
"v": 13
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T07:00:00Z",
|
||||
"v": 18
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T08:00:00Z",
|
||||
"v": 23
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T09:00:00Z",
|
||||
"v": 38
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T10:00:00Z",
|
||||
"v": 60
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T11:00:00Z",
|
||||
"v": 63
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T12:00:00Z",
|
||||
"v": 75
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T13:00:00Z",
|
||||
"v": 67
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T14:00:00Z",
|
||||
"v": 60
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T15:00:00Z",
|
||||
"v": 60
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T16:00:00Z",
|
||||
"v": 77
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T17:00:00Z",
|
||||
"v": 83
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T18:00:00Z",
|
||||
"v": 51
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T19:00:00Z",
|
||||
"v": 34
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T20:00:00Z",
|
||||
"v": 24
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T21:00:00Z",
|
||||
"v": 17
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T22:00:00Z",
|
||||
"v": 11
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T23:00:00Z",
|
||||
"v": 9
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T00:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T01:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T02:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T03:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T04:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T05:00:00Z",
|
||||
"v": 9
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T06:00:00Z",
|
||||
"v": 14
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T07:00:00Z",
|
||||
"v": 18
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T08:00:00Z",
|
||||
"v": 27
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T09:00:00Z",
|
||||
"v": 45
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T10:00:00Z",
|
||||
"v": 57
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T11:00:00Z",
|
||||
"v": 77
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T12:00:00Z",
|
||||
"v": 71
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T13:00:00Z",
|
||||
"v": 63
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T14:00:00Z",
|
||||
"v": 62
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T15:00:00Z",
|
||||
"v": 72
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T16:00:00Z",
|
||||
"v": 81
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T17:00:00Z",
|
||||
"v": 88
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T18:00:00Z",
|
||||
"v": 57
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T19:00:00Z",
|
||||
"v": 37
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T20:00:00Z",
|
||||
"v": 26
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T21:00:00Z",
|
||||
"v": 18
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T22:00:00Z",
|
||||
"v": 12
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T23:00:00Z",
|
||||
"v": 10
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T00:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T01:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T02:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T03:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T04:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T05:00:00Z",
|
||||
"v": 10
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T06:00:00Z",
|
||||
"v": 14
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T07:00:00Z",
|
||||
"v": 21
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T08:00:00Z",
|
||||
"v": 25
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T09:00:00Z",
|
||||
"v": 47
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T10:00:00Z",
|
||||
"v": 67
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T11:00:00Z",
|
||||
"v": 84
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T12:00:00Z",
|
||||
"v": 83
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T13:00:00Z",
|
||||
"v": 74
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T14:00:00Z",
|
||||
"v": 69
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T15:00:00Z",
|
||||
"v": 77
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T16:00:00Z",
|
||||
"v": 91
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T17:00:00Z",
|
||||
"v": 94
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T18:00:00Z",
|
||||
"v": 56
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T19:00:00Z",
|
||||
"v": 40
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T20:00:00Z",
|
||||
"v": 30
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T21:00:00Z",
|
||||
"v": 20
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T22:00:00Z",
|
||||
"v": 12
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T23:00:00Z",
|
||||
"v": 11
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T00:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T01:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T02:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T03:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T04:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T05:00:00Z",
|
||||
"v": 10
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T06:00:00Z",
|
||||
"v": 16
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T07:00:00Z",
|
||||
"v": 24
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T08:00:00Z",
|
||||
"v": 30
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T09:00:00Z",
|
||||
"v": 49
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T10:00:00Z",
|
||||
"v": 64
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T11:00:00Z",
|
||||
"v": 84
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T12:00:00Z",
|
||||
"v": 92
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T13:00:00Z",
|
||||
"v": 75
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T14:00:00Z",
|
||||
"v": 67
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T15:00:00Z",
|
||||
"v": 82
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T16:00:00Z",
|
||||
"v": 89
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T17:00:00Z",
|
||||
"v": 99
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T18:00:00Z",
|
||||
"v": 69
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T19:00:00Z",
|
||||
"v": 45
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T20:00:00Z",
|
||||
"v": 32
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T21:00:00Z",
|
||||
"v": 20
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T22:00:00Z",
|
||||
"v": 13
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T23:00:00Z",
|
||||
"v": 12
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T00:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T01:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T02:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T03:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T04:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T05:00:00Z",
|
||||
"v": 13
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T06:00:00Z",
|
||||
"v": 19
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T07:00:00Z",
|
||||
"v": 26
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T08:00:00Z",
|
||||
"v": 34
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T09:00:00Z",
|
||||
"v": 54
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T10:00:00Z",
|
||||
"v": 72
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T11:00:00Z",
|
||||
"v": 98
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T12:00:00Z",
|
||||
"v": 93
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T13:00:00Z",
|
||||
"v": 83
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T14:00:00Z",
|
||||
"v": 83
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T15:00:00Z",
|
||||
"v": 84
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T16:00:00Z",
|
||||
"v": 107
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T17:00:00Z",
|
||||
"v": 111
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T18:00:00Z",
|
||||
"v": 74
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T19:00:00Z",
|
||||
"v": 47
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T20:00:00Z",
|
||||
"v": 33
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T21:00:00Z",
|
||||
"v": 25
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T22:00:00Z",
|
||||
"v": 17
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T23:00:00Z",
|
||||
"v": 16
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T00:00:00Z",
|
||||
"v": 10
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T01:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T02:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T03:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T04:00:00Z",
|
||||
"v": 9
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T05:00:00Z",
|
||||
"v": 16
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T06:00:00Z",
|
||||
"v": 24
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T07:00:00Z",
|
||||
"v": 33
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T08:00:00Z",
|
||||
"v": 41
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,714 @@
|
||||
{
|
||||
"sensor": "hn-marktplatz-03",
|
||||
"step": "1h",
|
||||
"points": [
|
||||
{
|
||||
"t": "2026-11-07T00:00:00Z",
|
||||
"v": 12
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T01:00:00Z",
|
||||
"v": 9
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T02:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T03:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T04:00:00Z",
|
||||
"v": 10
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T05:00:00Z",
|
||||
"v": 16
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T06:00:00Z",
|
||||
"v": 24
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T07:00:00Z",
|
||||
"v": 34
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T08:00:00Z",
|
||||
"v": 44
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T09:00:00Z",
|
||||
"v": 85
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T10:00:00Z",
|
||||
"v": 114
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T11:00:00Z",
|
||||
"v": 130
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T12:00:00Z",
|
||||
"v": 150
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T13:00:00Z",
|
||||
"v": 122
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T14:00:00Z",
|
||||
"v": 123
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T15:00:00Z",
|
||||
"v": 115
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T16:00:00Z",
|
||||
"v": 136
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T17:00:00Z",
|
||||
"v": 156
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T18:00:00Z",
|
||||
"v": 105
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T19:00:00Z",
|
||||
"v": 65
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T20:00:00Z",
|
||||
"v": 52
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T21:00:00Z",
|
||||
"v": 36
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T22:00:00Z",
|
||||
"v": 22
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T23:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T00:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T01:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T02:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T03:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T04:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T05:00:00Z",
|
||||
"v": 9
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T06:00:00Z",
|
||||
"v": 13
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T07:00:00Z",
|
||||
"v": 19
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T08:00:00Z",
|
||||
"v": 22
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T09:00:00Z",
|
||||
"v": 43
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T10:00:00Z",
|
||||
"v": 53
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T11:00:00Z",
|
||||
"v": 74
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T12:00:00Z",
|
||||
"v": 77
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T13:00:00Z",
|
||||
"v": 62
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T14:00:00Z",
|
||||
"v": 56
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T15:00:00Z",
|
||||
"v": 64
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T16:00:00Z",
|
||||
"v": 80
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T17:00:00Z",
|
||||
"v": 80
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T18:00:00Z",
|
||||
"v": 52
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T19:00:00Z",
|
||||
"v": 36
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T20:00:00Z",
|
||||
"v": 25
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T21:00:00Z",
|
||||
"v": 16
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T22:00:00Z",
|
||||
"v": 12
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T23:00:00Z",
|
||||
"v": 10
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T00:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T01:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T02:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T03:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T04:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T05:00:00Z",
|
||||
"v": 10
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T06:00:00Z",
|
||||
"v": 15
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T07:00:00Z",
|
||||
"v": 19
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T08:00:00Z",
|
||||
"v": 26
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T09:00:00Z",
|
||||
"v": 42
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T10:00:00Z",
|
||||
"v": 68
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T11:00:00Z",
|
||||
"v": 80
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T12:00:00Z",
|
||||
"v": 87
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T13:00:00Z",
|
||||
"v": 70
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T14:00:00Z",
|
||||
"v": 66
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T15:00:00Z",
|
||||
"v": 75
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T16:00:00Z",
|
||||
"v": 81
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T17:00:00Z",
|
||||
"v": 97
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T18:00:00Z",
|
||||
"v": 56
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T19:00:00Z",
|
||||
"v": 38
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T20:00:00Z",
|
||||
"v": 27
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T21:00:00Z",
|
||||
"v": 21
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T22:00:00Z",
|
||||
"v": 13
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T23:00:00Z",
|
||||
"v": 10
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T00:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T01:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T02:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T03:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T04:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T05:00:00Z",
|
||||
"v": 10
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T06:00:00Z",
|
||||
"v": 15
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T07:00:00Z",
|
||||
"v": 22
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T08:00:00Z",
|
||||
"v": 28
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T09:00:00Z",
|
||||
"v": 50
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T10:00:00Z",
|
||||
"v": 74
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T11:00:00Z",
|
||||
"v": 80
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T12:00:00Z",
|
||||
"v": 87
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T13:00:00Z",
|
||||
"v": 72
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T14:00:00Z",
|
||||
"v": 73
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T15:00:00Z",
|
||||
"v": 78
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T16:00:00Z",
|
||||
"v": 86
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T17:00:00Z",
|
||||
"v": 99
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T18:00:00Z",
|
||||
"v": 63
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T19:00:00Z",
|
||||
"v": 40
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T20:00:00Z",
|
||||
"v": 32
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T21:00:00Z",
|
||||
"v": 21
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T22:00:00Z",
|
||||
"v": 14
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T23:00:00Z",
|
||||
"v": 12
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T00:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T01:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T02:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T03:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T04:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T05:00:00Z",
|
||||
"v": 11
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T06:00:00Z",
|
||||
"v": 16
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T07:00:00Z",
|
||||
"v": 24
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T08:00:00Z",
|
||||
"v": 31
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T09:00:00Z",
|
||||
"v": 51
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T10:00:00Z",
|
||||
"v": 69
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T11:00:00Z",
|
||||
"v": 96
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T12:00:00Z",
|
||||
"v": 100
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T13:00:00Z",
|
||||
"v": 87
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T14:00:00Z",
|
||||
"v": 74
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T15:00:00Z",
|
||||
"v": 80
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T16:00:00Z",
|
||||
"v": 94
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T17:00:00Z",
|
||||
"v": 102
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T18:00:00Z",
|
||||
"v": 72
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T19:00:00Z",
|
||||
"v": 47
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T20:00:00Z",
|
||||
"v": 33
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T21:00:00Z",
|
||||
"v": 24
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T22:00:00Z",
|
||||
"v": 14
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T23:00:00Z",
|
||||
"v": 13
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T00:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T01:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T02:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T03:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T04:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T05:00:00Z",
|
||||
"v": 12
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T06:00:00Z",
|
||||
"v": 17
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T07:00:00Z",
|
||||
"v": 25
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T08:00:00Z",
|
||||
"v": 35
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T09:00:00Z",
|
||||
"v": 59
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T10:00:00Z",
|
||||
"v": 81
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T11:00:00Z",
|
||||
"v": 96
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T12:00:00Z",
|
||||
"v": 107
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T13:00:00Z",
|
||||
"v": 86
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T14:00:00Z",
|
||||
"v": 83
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T15:00:00Z",
|
||||
"v": 83
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T16:00:00Z",
|
||||
"v": 109
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T17:00:00Z",
|
||||
"v": 115
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T18:00:00Z",
|
||||
"v": 68
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T19:00:00Z",
|
||||
"v": 46
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T20:00:00Z",
|
||||
"v": 34
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T21:00:00Z",
|
||||
"v": 23
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T22:00:00Z",
|
||||
"v": 15
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T23:00:00Z",
|
||||
"v": 14
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T00:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T01:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T02:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T03:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T04:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T05:00:00Z",
|
||||
"v": 13
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T06:00:00Z",
|
||||
"v": 19
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T07:00:00Z",
|
||||
"v": 26
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T08:00:00Z",
|
||||
"v": 39
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T09:00:00Z",
|
||||
"v": 58
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T10:00:00Z",
|
||||
"v": 91
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T11:00:00Z",
|
||||
"v": 107
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T12:00:00Z",
|
||||
"v": 121
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T13:00:00Z",
|
||||
"v": 105
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T14:00:00Z",
|
||||
"v": 99
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T15:00:00Z",
|
||||
"v": 99
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T16:00:00Z",
|
||||
"v": 109
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T17:00:00Z",
|
||||
"v": 117
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T18:00:00Z",
|
||||
"v": 84
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T19:00:00Z",
|
||||
"v": 58
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T20:00:00Z",
|
||||
"v": 42
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T21:00:00Z",
|
||||
"v": 26
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T22:00:00Z",
|
||||
"v": 17
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T23:00:00Z",
|
||||
"v": 18
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T00:00:00Z",
|
||||
"v": 11
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T01:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T02:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T03:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T04:00:00Z",
|
||||
"v": 10
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T05:00:00Z",
|
||||
"v": 18
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T06:00:00Z",
|
||||
"v": 28
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T07:00:00Z",
|
||||
"v": 34
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T08:00:00Z",
|
||||
"v": 43
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,714 @@
|
||||
{
|
||||
"sensor": "hn-neckartor-06",
|
||||
"step": "1h",
|
||||
"points": [
|
||||
{
|
||||
"t": "2026-11-07T00:00:00Z",
|
||||
"v": 10
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T01:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T02:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T03:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T04:00:00Z",
|
||||
"v": 10
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T05:00:00Z",
|
||||
"v": 16
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T06:00:00Z",
|
||||
"v": 25
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T07:00:00Z",
|
||||
"v": 31
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T08:00:00Z",
|
||||
"v": 42
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T09:00:00Z",
|
||||
"v": 77
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T10:00:00Z",
|
||||
"v": 94
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T11:00:00Z",
|
||||
"v": 130
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T12:00:00Z",
|
||||
"v": 130
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T13:00:00Z",
|
||||
"v": 109
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T14:00:00Z",
|
||||
"v": 101
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T15:00:00Z",
|
||||
"v": 105
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T16:00:00Z",
|
||||
"v": 131
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T17:00:00Z",
|
||||
"v": 149
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T18:00:00Z",
|
||||
"v": 94
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T19:00:00Z",
|
||||
"v": 62
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T20:00:00Z",
|
||||
"v": 46
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T21:00:00Z",
|
||||
"v": 31
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T22:00:00Z",
|
||||
"v": 21
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T23:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T00:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T01:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T02:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T03:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T04:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T05:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T06:00:00Z",
|
||||
"v": 13
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T07:00:00Z",
|
||||
"v": 15
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T08:00:00Z",
|
||||
"v": 20
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T09:00:00Z",
|
||||
"v": 38
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T10:00:00Z",
|
||||
"v": 52
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T11:00:00Z",
|
||||
"v": 67
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T12:00:00Z",
|
||||
"v": 67
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T13:00:00Z",
|
||||
"v": 61
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T14:00:00Z",
|
||||
"v": 55
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T15:00:00Z",
|
||||
"v": 59
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T16:00:00Z",
|
||||
"v": 63
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T17:00:00Z",
|
||||
"v": 68
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T18:00:00Z",
|
||||
"v": 50
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T19:00:00Z",
|
||||
"v": 34
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T20:00:00Z",
|
||||
"v": 24
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T21:00:00Z",
|
||||
"v": 16
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T22:00:00Z",
|
||||
"v": 11
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T23:00:00Z",
|
||||
"v": 9
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T00:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T01:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T02:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T03:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T04:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T05:00:00Z",
|
||||
"v": 9
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T06:00:00Z",
|
||||
"v": 13
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T07:00:00Z",
|
||||
"v": 17
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T08:00:00Z",
|
||||
"v": 25
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T09:00:00Z",
|
||||
"v": 42
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T10:00:00Z",
|
||||
"v": 62
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T11:00:00Z",
|
||||
"v": 65
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T12:00:00Z",
|
||||
"v": 74
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T13:00:00Z",
|
||||
"v": 66
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T14:00:00Z",
|
||||
"v": 65
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T15:00:00Z",
|
||||
"v": 66
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T16:00:00Z",
|
||||
"v": 71
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T17:00:00Z",
|
||||
"v": 84
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T18:00:00Z",
|
||||
"v": 51
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T19:00:00Z",
|
||||
"v": 33
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T20:00:00Z",
|
||||
"v": 24
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T21:00:00Z",
|
||||
"v": 17
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T22:00:00Z",
|
||||
"v": 11
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T23:00:00Z",
|
||||
"v": 10
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T00:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T01:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T02:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T03:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T04:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T05:00:00Z",
|
||||
"v": 9
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T06:00:00Z",
|
||||
"v": 13
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T07:00:00Z",
|
||||
"v": 21
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T08:00:00Z",
|
||||
"v": 25
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T09:00:00Z",
|
||||
"v": 40
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T10:00:00Z",
|
||||
"v": 58
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T11:00:00Z",
|
||||
"v": 78
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T12:00:00Z",
|
||||
"v": 84
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T13:00:00Z",
|
||||
"v": 75
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T14:00:00Z",
|
||||
"v": 65
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T15:00:00Z",
|
||||
"v": 65
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T16:00:00Z",
|
||||
"v": 79
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T17:00:00Z",
|
||||
"v": 89
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T18:00:00Z",
|
||||
"v": 57
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T19:00:00Z",
|
||||
"v": 35
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T20:00:00Z",
|
||||
"v": 28
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T21:00:00Z",
|
||||
"v": 20
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T22:00:00Z",
|
||||
"v": 12
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T23:00:00Z",
|
||||
"v": 11
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T00:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T01:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T02:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T03:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T04:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T05:00:00Z",
|
||||
"v": 9
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T06:00:00Z",
|
||||
"v": 15
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T07:00:00Z",
|
||||
"v": 20
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T08:00:00Z",
|
||||
"v": 28
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T09:00:00Z",
|
||||
"v": 45
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T10:00:00Z",
|
||||
"v": 66
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T11:00:00Z",
|
||||
"v": 86
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T12:00:00Z",
|
||||
"v": 90
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T13:00:00Z",
|
||||
"v": 75
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T14:00:00Z",
|
||||
"v": 74
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T15:00:00Z",
|
||||
"v": 73
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T16:00:00Z",
|
||||
"v": 91
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T17:00:00Z",
|
||||
"v": 91
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T18:00:00Z",
|
||||
"v": 65
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T19:00:00Z",
|
||||
"v": 38
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T20:00:00Z",
|
||||
"v": 27
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T21:00:00Z",
|
||||
"v": 21
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T22:00:00Z",
|
||||
"v": 13
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T23:00:00Z",
|
||||
"v": 11
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T00:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T01:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T02:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T03:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T04:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T05:00:00Z",
|
||||
"v": 11
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T06:00:00Z",
|
||||
"v": 15
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T07:00:00Z",
|
||||
"v": 22
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T08:00:00Z",
|
||||
"v": 30
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T09:00:00Z",
|
||||
"v": 53
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T10:00:00Z",
|
||||
"v": 66
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T11:00:00Z",
|
||||
"v": 89
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T12:00:00Z",
|
||||
"v": 86
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T13:00:00Z",
|
||||
"v": 77
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T14:00:00Z",
|
||||
"v": 73
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T15:00:00Z",
|
||||
"v": 78
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T16:00:00Z",
|
||||
"v": 86
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T17:00:00Z",
|
||||
"v": 105
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T18:00:00Z",
|
||||
"v": 63
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T19:00:00Z",
|
||||
"v": 47
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T20:00:00Z",
|
||||
"v": 31
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T21:00:00Z",
|
||||
"v": 20
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T22:00:00Z",
|
||||
"v": 16
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T23:00:00Z",
|
||||
"v": 13
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T00:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T01:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T02:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T03:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T04:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T05:00:00Z",
|
||||
"v": 12
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T06:00:00Z",
|
||||
"v": 19
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T07:00:00Z",
|
||||
"v": 25
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T08:00:00Z",
|
||||
"v": 32
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T09:00:00Z",
|
||||
"v": 59
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T10:00:00Z",
|
||||
"v": 85
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T11:00:00Z",
|
||||
"v": 101
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T12:00:00Z",
|
||||
"v": 99
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T13:00:00Z",
|
||||
"v": 85
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T14:00:00Z",
|
||||
"v": 79
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T15:00:00Z",
|
||||
"v": 94
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T16:00:00Z",
|
||||
"v": 106
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T17:00:00Z",
|
||||
"v": 109
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T18:00:00Z",
|
||||
"v": 73
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T19:00:00Z",
|
||||
"v": 52
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T20:00:00Z",
|
||||
"v": 34
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T21:00:00Z",
|
||||
"v": 24
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T22:00:00Z",
|
||||
"v": 16
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T23:00:00Z",
|
||||
"v": 16
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T00:00:00Z",
|
||||
"v": 11
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T01:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T02:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T03:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T04:00:00Z",
|
||||
"v": 9
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T05:00:00Z",
|
||||
"v": 17
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T06:00:00Z",
|
||||
"v": 23
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T07:00:00Z",
|
||||
"v": 32
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T08:00:00Z",
|
||||
"v": 44
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,714 @@
|
||||
{
|
||||
"sensor": "hn-rathaus-05",
|
||||
"step": "1h",
|
||||
"points": [
|
||||
{
|
||||
"t": "2026-11-07T00:00:00Z",
|
||||
"v": 10
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T01:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T02:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T03:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T04:00:00Z",
|
||||
"v": 9
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T05:00:00Z",
|
||||
"v": 14
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T06:00:00Z",
|
||||
"v": 22
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T07:00:00Z",
|
||||
"v": 30
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T08:00:00Z",
|
||||
"v": 40
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T09:00:00Z",
|
||||
"v": 70
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T10:00:00Z",
|
||||
"v": 92
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T11:00:00Z",
|
||||
"v": 113
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T12:00:00Z",
|
||||
"v": 120
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T13:00:00Z",
|
||||
"v": 102
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T14:00:00Z",
|
||||
"v": 92
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T15:00:00Z",
|
||||
"v": 103
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T16:00:00Z",
|
||||
"v": 112
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T17:00:00Z",
|
||||
"v": 139
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T18:00:00Z",
|
||||
"v": 80
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T19:00:00Z",
|
||||
"v": 58
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T20:00:00Z",
|
||||
"v": 42
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T21:00:00Z",
|
||||
"v": 27
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T22:00:00Z",
|
||||
"v": 19
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T23:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T00:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T01:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T02:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T03:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T04:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T05:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T06:00:00Z",
|
||||
"v": 10
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T07:00:00Z",
|
||||
"v": 15
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T08:00:00Z",
|
||||
"v": 20
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T09:00:00Z",
|
||||
"v": 34
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T10:00:00Z",
|
||||
"v": 50
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T11:00:00Z",
|
||||
"v": 61
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T12:00:00Z",
|
||||
"v": 60
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T13:00:00Z",
|
||||
"v": 57
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T14:00:00Z",
|
||||
"v": 48
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T15:00:00Z",
|
||||
"v": 51
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T16:00:00Z",
|
||||
"v": 59
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T17:00:00Z",
|
||||
"v": 67
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T18:00:00Z",
|
||||
"v": 44
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T19:00:00Z",
|
||||
"v": 29
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T20:00:00Z",
|
||||
"v": 20
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T21:00:00Z",
|
||||
"v": 14
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T22:00:00Z",
|
||||
"v": 10
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T23:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T00:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T01:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T02:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T03:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T04:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T05:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T06:00:00Z",
|
||||
"v": 13
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T07:00:00Z",
|
||||
"v": 18
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T08:00:00Z",
|
||||
"v": 23
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T09:00:00Z",
|
||||
"v": 34
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T10:00:00Z",
|
||||
"v": 53
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T11:00:00Z",
|
||||
"v": 61
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T12:00:00Z",
|
||||
"v": 71
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T13:00:00Z",
|
||||
"v": 63
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T14:00:00Z",
|
||||
"v": 51
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T15:00:00Z",
|
||||
"v": 58
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T16:00:00Z",
|
||||
"v": 72
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T17:00:00Z",
|
||||
"v": 75
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T18:00:00Z",
|
||||
"v": 44
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T19:00:00Z",
|
||||
"v": 35
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T20:00:00Z",
|
||||
"v": 24
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T21:00:00Z",
|
||||
"v": 15
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T22:00:00Z",
|
||||
"v": 11
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T23:00:00Z",
|
||||
"v": 9
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T00:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T01:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T02:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T03:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T04:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T05:00:00Z",
|
||||
"v": 9
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T06:00:00Z",
|
||||
"v": 13
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T07:00:00Z",
|
||||
"v": 17
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T08:00:00Z",
|
||||
"v": 23
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T09:00:00Z",
|
||||
"v": 42
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T10:00:00Z",
|
||||
"v": 57
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T11:00:00Z",
|
||||
"v": 73
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T12:00:00Z",
|
||||
"v": 76
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T13:00:00Z",
|
||||
"v": 61
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T14:00:00Z",
|
||||
"v": 60
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T15:00:00Z",
|
||||
"v": 58
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T16:00:00Z",
|
||||
"v": 76
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T17:00:00Z",
|
||||
"v": 82
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T18:00:00Z",
|
||||
"v": 52
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T19:00:00Z",
|
||||
"v": 35
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T20:00:00Z",
|
||||
"v": 24
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T21:00:00Z",
|
||||
"v": 17
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T22:00:00Z",
|
||||
"v": 12
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T23:00:00Z",
|
||||
"v": 10
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T00:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T01:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T02:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T03:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T04:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T05:00:00Z",
|
||||
"v": 9
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T06:00:00Z",
|
||||
"v": 13
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T07:00:00Z",
|
||||
"v": 19
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T08:00:00Z",
|
||||
"v": 27
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T09:00:00Z",
|
||||
"v": 45
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T10:00:00Z",
|
||||
"v": 58
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T11:00:00Z",
|
||||
"v": 69
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T12:00:00Z",
|
||||
"v": 83
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T13:00:00Z",
|
||||
"v": 70
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T14:00:00Z",
|
||||
"v": 65
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T15:00:00Z",
|
||||
"v": 61
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T16:00:00Z",
|
||||
"v": 74
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T17:00:00Z",
|
||||
"v": 82
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T18:00:00Z",
|
||||
"v": 54
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T19:00:00Z",
|
||||
"v": 34
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T20:00:00Z",
|
||||
"v": 29
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T21:00:00Z",
|
||||
"v": 19
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T22:00:00Z",
|
||||
"v": 13
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T23:00:00Z",
|
||||
"v": 10
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T00:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T01:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T02:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T03:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T04:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T05:00:00Z",
|
||||
"v": 10
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T06:00:00Z",
|
||||
"v": 16
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T07:00:00Z",
|
||||
"v": 21
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T08:00:00Z",
|
||||
"v": 28
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T09:00:00Z",
|
||||
"v": 43
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T10:00:00Z",
|
||||
"v": 69
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T11:00:00Z",
|
||||
"v": 80
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T12:00:00Z",
|
||||
"v": 81
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T13:00:00Z",
|
||||
"v": 73
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T14:00:00Z",
|
||||
"v": 68
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T15:00:00Z",
|
||||
"v": 67
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T16:00:00Z",
|
||||
"v": 80
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T17:00:00Z",
|
||||
"v": 98
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T18:00:00Z",
|
||||
"v": 60
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T19:00:00Z",
|
||||
"v": 39
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T20:00:00Z",
|
||||
"v": 30
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T21:00:00Z",
|
||||
"v": 21
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T22:00:00Z",
|
||||
"v": 12
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T23:00:00Z",
|
||||
"v": 12
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T00:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T01:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T02:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T03:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T04:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T05:00:00Z",
|
||||
"v": 11
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T06:00:00Z",
|
||||
"v": 15
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T07:00:00Z",
|
||||
"v": 22
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T08:00:00Z",
|
||||
"v": 31
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T09:00:00Z",
|
||||
"v": 51
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T10:00:00Z",
|
||||
"v": 72
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T11:00:00Z",
|
||||
"v": 95
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T12:00:00Z",
|
||||
"v": 93
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T13:00:00Z",
|
||||
"v": 84
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T14:00:00Z",
|
||||
"v": 75
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T15:00:00Z",
|
||||
"v": 83
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T16:00:00Z",
|
||||
"v": 92
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T17:00:00Z",
|
||||
"v": 106
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T18:00:00Z",
|
||||
"v": 63
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T19:00:00Z",
|
||||
"v": 41
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T20:00:00Z",
|
||||
"v": 33
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T21:00:00Z",
|
||||
"v": 21
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T22:00:00Z",
|
||||
"v": 15
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T23:00:00Z",
|
||||
"v": 14
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T00:00:00Z",
|
||||
"v": 10
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T01:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T02:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T03:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T04:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T05:00:00Z",
|
||||
"v": 14
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T06:00:00Z",
|
||||
"v": 20
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T07:00:00Z",
|
||||
"v": 28
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T08:00:00Z",
|
||||
"v": 38
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,714 @@
|
||||
{
|
||||
"sensor": "hn-stadtgalerie-01",
|
||||
"step": "1h",
|
||||
"points": [
|
||||
{
|
||||
"t": "2026-11-07T00:00:00Z",
|
||||
"v": 13
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T01:00:00Z",
|
||||
"v": 10
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T02:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T03:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T04:00:00Z",
|
||||
"v": 12
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T05:00:00Z",
|
||||
"v": 20
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T06:00:00Z",
|
||||
"v": 28
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T07:00:00Z",
|
||||
"v": 39
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T08:00:00Z",
|
||||
"v": 56
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T09:00:00Z",
|
||||
"v": 92
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T10:00:00Z",
|
||||
"v": 122
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T11:00:00Z",
|
||||
"v": 162
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T12:00:00Z",
|
||||
"v": 164
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T13:00:00Z",
|
||||
"v": 153
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T14:00:00Z",
|
||||
"v": 145
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T15:00:00Z",
|
||||
"v": 142
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T16:00:00Z",
|
||||
"v": 174
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T17:00:00Z",
|
||||
"v": 189
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T18:00:00Z",
|
||||
"v": 127
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T19:00:00Z",
|
||||
"v": 75
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T20:00:00Z",
|
||||
"v": 55
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T21:00:00Z",
|
||||
"v": 41
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T22:00:00Z",
|
||||
"v": 27
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T23:00:00Z",
|
||||
"v": 11
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T00:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T01:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T02:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T03:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T04:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T05:00:00Z",
|
||||
"v": 11
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T06:00:00Z",
|
||||
"v": 16
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T07:00:00Z",
|
||||
"v": 20
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T08:00:00Z",
|
||||
"v": 27
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T09:00:00Z",
|
||||
"v": 47
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T10:00:00Z",
|
||||
"v": 70
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T11:00:00Z",
|
||||
"v": 81
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T12:00:00Z",
|
||||
"v": 85
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T13:00:00Z",
|
||||
"v": 78
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T14:00:00Z",
|
||||
"v": 65
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T15:00:00Z",
|
||||
"v": 78
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T16:00:00Z",
|
||||
"v": 89
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T17:00:00Z",
|
||||
"v": 89
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T18:00:00Z",
|
||||
"v": 62
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T19:00:00Z",
|
||||
"v": 37
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T20:00:00Z",
|
||||
"v": 31
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T21:00:00Z",
|
||||
"v": 20
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T22:00:00Z",
|
||||
"v": 13
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T23:00:00Z",
|
||||
"v": 11
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T00:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T01:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T02:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T03:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T04:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T05:00:00Z",
|
||||
"v": 11
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T06:00:00Z",
|
||||
"v": 16
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T07:00:00Z",
|
||||
"v": 24
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T08:00:00Z",
|
||||
"v": 32
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T09:00:00Z",
|
||||
"v": 55
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T10:00:00Z",
|
||||
"v": 72
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T11:00:00Z",
|
||||
"v": 87
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T12:00:00Z",
|
||||
"v": 87
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T13:00:00Z",
|
||||
"v": 82
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T14:00:00Z",
|
||||
"v": 82
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T15:00:00Z",
|
||||
"v": 75
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T16:00:00Z",
|
||||
"v": 90
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T17:00:00Z",
|
||||
"v": 101
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T18:00:00Z",
|
||||
"v": 69
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T19:00:00Z",
|
||||
"v": 43
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T20:00:00Z",
|
||||
"v": 31
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T21:00:00Z",
|
||||
"v": 24
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T22:00:00Z",
|
||||
"v": 15
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T23:00:00Z",
|
||||
"v": 12
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T00:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T01:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T02:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T03:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T04:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T05:00:00Z",
|
||||
"v": 13
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T06:00:00Z",
|
||||
"v": 19
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T07:00:00Z",
|
||||
"v": 26
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T08:00:00Z",
|
||||
"v": 31
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T09:00:00Z",
|
||||
"v": 59
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T10:00:00Z",
|
||||
"v": 76
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T11:00:00Z",
|
||||
"v": 91
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T12:00:00Z",
|
||||
"v": 103
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T13:00:00Z",
|
||||
"v": 95
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T14:00:00Z",
|
||||
"v": 77
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T15:00:00Z",
|
||||
"v": 82
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T16:00:00Z",
|
||||
"v": 108
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T17:00:00Z",
|
||||
"v": 106
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T18:00:00Z",
|
||||
"v": 77
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T19:00:00Z",
|
||||
"v": 49
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T20:00:00Z",
|
||||
"v": 37
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T21:00:00Z",
|
||||
"v": 24
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T22:00:00Z",
|
||||
"v": 17
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T23:00:00Z",
|
||||
"v": 13
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T00:00:00Z",
|
||||
"v": 9
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T01:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T02:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T03:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T04:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T05:00:00Z",
|
||||
"v": 13
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T06:00:00Z",
|
||||
"v": 19
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T07:00:00Z",
|
||||
"v": 25
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T08:00:00Z",
|
||||
"v": 36
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T09:00:00Z",
|
||||
"v": 62
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T10:00:00Z",
|
||||
"v": 78
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T11:00:00Z",
|
||||
"v": 99
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T12:00:00Z",
|
||||
"v": 110
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T13:00:00Z",
|
||||
"v": 100
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T14:00:00Z",
|
||||
"v": 89
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T15:00:00Z",
|
||||
"v": 100
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T16:00:00Z",
|
||||
"v": 104
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T17:00:00Z",
|
||||
"v": 125
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T18:00:00Z",
|
||||
"v": 73
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T19:00:00Z",
|
||||
"v": 54
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T20:00:00Z",
|
||||
"v": 39
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T21:00:00Z",
|
||||
"v": 24
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T22:00:00Z",
|
||||
"v": 17
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T23:00:00Z",
|
||||
"v": 15
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T00:00:00Z",
|
||||
"v": 9
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T01:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T02:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T03:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T04:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T05:00:00Z",
|
||||
"v": 13
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T06:00:00Z",
|
||||
"v": 22
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T07:00:00Z",
|
||||
"v": 30
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T08:00:00Z",
|
||||
"v": 39
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T09:00:00Z",
|
||||
"v": 68
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T10:00:00Z",
|
||||
"v": 85
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T11:00:00Z",
|
||||
"v": 108
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T12:00:00Z",
|
||||
"v": 124
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T13:00:00Z",
|
||||
"v": 96
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T14:00:00Z",
|
||||
"v": 93
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T15:00:00Z",
|
||||
"v": 104
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T16:00:00Z",
|
||||
"v": 120
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T17:00:00Z",
|
||||
"v": 131
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T18:00:00Z",
|
||||
"v": 83
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T19:00:00Z",
|
||||
"v": 52
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T20:00:00Z",
|
||||
"v": 44
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T21:00:00Z",
|
||||
"v": 28
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T22:00:00Z",
|
||||
"v": 20
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T23:00:00Z",
|
||||
"v": 16
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T00:00:00Z",
|
||||
"v": 11
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T01:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T02:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T03:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T04:00:00Z",
|
||||
"v": 10
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T05:00:00Z",
|
||||
"v": 15
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T06:00:00Z",
|
||||
"v": 22
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T07:00:00Z",
|
||||
"v": 33
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T08:00:00Z",
|
||||
"v": 41
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T09:00:00Z",
|
||||
"v": 73
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T10:00:00Z",
|
||||
"v": 93
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T11:00:00Z",
|
||||
"v": 119
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T12:00:00Z",
|
||||
"v": 124
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T13:00:00Z",
|
||||
"v": 106
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T14:00:00Z",
|
||||
"v": 113
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T15:00:00Z",
|
||||
"v": 119
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T16:00:00Z",
|
||||
"v": 126
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T17:00:00Z",
|
||||
"v": 147
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T18:00:00Z",
|
||||
"v": 96
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T19:00:00Z",
|
||||
"v": 66
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T20:00:00Z",
|
||||
"v": 47
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T21:00:00Z",
|
||||
"v": 34
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T22:00:00Z",
|
||||
"v": 22
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T23:00:00Z",
|
||||
"v": 21
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T00:00:00Z",
|
||||
"v": 14
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T01:00:00Z",
|
||||
"v": 10
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T02:00:00Z",
|
||||
"v": 9
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T03:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T04:00:00Z",
|
||||
"v": 13
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T05:00:00Z",
|
||||
"v": 20
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T06:00:00Z",
|
||||
"v": 30
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T07:00:00Z",
|
||||
"v": 43
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T08:00:00Z",
|
||||
"v": 56
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,714 @@
|
||||
{
|
||||
"sensor": "hn-suelmerstrasse-07",
|
||||
"step": "1h",
|
||||
"points": [
|
||||
{
|
||||
"t": "2026-11-07T00:00:00Z",
|
||||
"v": 12
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T01:00:00Z",
|
||||
"v": 9
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T02:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T03:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T04:00:00Z",
|
||||
"v": 11
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T05:00:00Z",
|
||||
"v": 18
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T06:00:00Z",
|
||||
"v": 28
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T07:00:00Z",
|
||||
"v": 42
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T08:00:00Z",
|
||||
"v": 47
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T09:00:00Z",
|
||||
"v": 80
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T10:00:00Z",
|
||||
"v": 114
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T11:00:00Z",
|
||||
"v": 143
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T12:00:00Z",
|
||||
"v": 150
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T13:00:00Z",
|
||||
"v": 139
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T14:00:00Z",
|
||||
"v": 120
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T15:00:00Z",
|
||||
"v": 131
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T16:00:00Z",
|
||||
"v": 169
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T17:00:00Z",
|
||||
"v": 162
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T18:00:00Z",
|
||||
"v": 105
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T19:00:00Z",
|
||||
"v": 75
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T20:00:00Z",
|
||||
"v": 57
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T21:00:00Z",
|
||||
"v": 40
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T22:00:00Z",
|
||||
"v": 23
|
||||
},
|
||||
{
|
||||
"t": "2026-11-07T23:00:00Z",
|
||||
"v": 10
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T00:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T01:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T02:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T03:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T04:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T05:00:00Z",
|
||||
"v": 10
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T06:00:00Z",
|
||||
"v": 13
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T07:00:00Z",
|
||||
"v": 21
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T08:00:00Z",
|
||||
"v": 23
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T09:00:00Z",
|
||||
"v": 44
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T10:00:00Z",
|
||||
"v": 63
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T11:00:00Z",
|
||||
"v": 69
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T12:00:00Z",
|
||||
"v": 77
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T13:00:00Z",
|
||||
"v": 75
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T14:00:00Z",
|
||||
"v": 60
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T15:00:00Z",
|
||||
"v": 66
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T16:00:00Z",
|
||||
"v": 78
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T17:00:00Z",
|
||||
"v": 93
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T18:00:00Z",
|
||||
"v": 58
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T19:00:00Z",
|
||||
"v": 39
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T20:00:00Z",
|
||||
"v": 29
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T21:00:00Z",
|
||||
"v": 17
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T22:00:00Z",
|
||||
"v": 13
|
||||
},
|
||||
{
|
||||
"t": "2026-11-08T23:00:00Z",
|
||||
"v": 10
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T00:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T01:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T02:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T03:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T04:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T05:00:00Z",
|
||||
"v": 11
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T06:00:00Z",
|
||||
"v": 17
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T07:00:00Z",
|
||||
"v": 21
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T08:00:00Z",
|
||||
"v": 30
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T09:00:00Z",
|
||||
"v": 48
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T10:00:00Z",
|
||||
"v": 67
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T11:00:00Z",
|
||||
"v": 79
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T12:00:00Z",
|
||||
"v": 91
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T13:00:00Z",
|
||||
"v": 83
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T14:00:00Z",
|
||||
"v": 69
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T15:00:00Z",
|
||||
"v": 80
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T16:00:00Z",
|
||||
"v": 88
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T17:00:00Z",
|
||||
"v": 95
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T18:00:00Z",
|
||||
"v": 61
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T19:00:00Z",
|
||||
"v": 41
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T20:00:00Z",
|
||||
"v": 30
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T21:00:00Z",
|
||||
"v": 20
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T22:00:00Z",
|
||||
"v": 15
|
||||
},
|
||||
{
|
||||
"t": "2026-11-09T23:00:00Z",
|
||||
"v": 11
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T00:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T01:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T02:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T03:00:00Z",
|
||||
"v": 4
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T04:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T05:00:00Z",
|
||||
"v": 11
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T06:00:00Z",
|
||||
"v": 18
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T07:00:00Z",
|
||||
"v": 25
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T08:00:00Z",
|
||||
"v": 28
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T09:00:00Z",
|
||||
"v": 51
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T10:00:00Z",
|
||||
"v": 71
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T11:00:00Z",
|
||||
"v": 84
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T12:00:00Z",
|
||||
"v": 88
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T13:00:00Z",
|
||||
"v": 89
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T14:00:00Z",
|
||||
"v": 74
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T15:00:00Z",
|
||||
"v": 78
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T16:00:00Z",
|
||||
"v": 95
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T17:00:00Z",
|
||||
"v": 101
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T18:00:00Z",
|
||||
"v": 73
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T19:00:00Z",
|
||||
"v": 48
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T20:00:00Z",
|
||||
"v": 31
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T21:00:00Z",
|
||||
"v": 21
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T22:00:00Z",
|
||||
"v": 16
|
||||
},
|
||||
{
|
||||
"t": "2026-11-10T23:00:00Z",
|
||||
"v": 12
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T00:00:00Z",
|
||||
"v": 9
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T01:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T02:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T03:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T04:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T05:00:00Z",
|
||||
"v": 13
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T06:00:00Z",
|
||||
"v": 19
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T07:00:00Z",
|
||||
"v": 25
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T08:00:00Z",
|
||||
"v": 31
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T09:00:00Z",
|
||||
"v": 55
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T10:00:00Z",
|
||||
"v": 85
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T11:00:00Z",
|
||||
"v": 95
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T12:00:00Z",
|
||||
"v": 96
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T13:00:00Z",
|
||||
"v": 86
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T14:00:00Z",
|
||||
"v": 81
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T15:00:00Z",
|
||||
"v": 91
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T16:00:00Z",
|
||||
"v": 105
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T17:00:00Z",
|
||||
"v": 119
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T18:00:00Z",
|
||||
"v": 78
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T19:00:00Z",
|
||||
"v": 49
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T20:00:00Z",
|
||||
"v": 34
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T21:00:00Z",
|
||||
"v": 24
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T22:00:00Z",
|
||||
"v": 17
|
||||
},
|
||||
{
|
||||
"t": "2026-11-11T23:00:00Z",
|
||||
"v": 13
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T00:00:00Z",
|
||||
"v": 9
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T01:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T02:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T03:00:00Z",
|
||||
"v": 5
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T04:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T05:00:00Z",
|
||||
"v": 13
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T06:00:00Z",
|
||||
"v": 19
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T07:00:00Z",
|
||||
"v": 28
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T08:00:00Z",
|
||||
"v": 36
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T09:00:00Z",
|
||||
"v": 60
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T10:00:00Z",
|
||||
"v": 87
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T11:00:00Z",
|
||||
"v": 106
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T12:00:00Z",
|
||||
"v": 111
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T13:00:00Z",
|
||||
"v": 102
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T14:00:00Z",
|
||||
"v": 85
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T15:00:00Z",
|
||||
"v": 96
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T16:00:00Z",
|
||||
"v": 110
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T17:00:00Z",
|
||||
"v": 131
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T18:00:00Z",
|
||||
"v": 78
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T19:00:00Z",
|
||||
"v": 55
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T20:00:00Z",
|
||||
"v": 36
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T21:00:00Z",
|
||||
"v": 24
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T22:00:00Z",
|
||||
"v": 18
|
||||
},
|
||||
{
|
||||
"t": "2026-11-12T23:00:00Z",
|
||||
"v": 14
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T00:00:00Z",
|
||||
"v": 10
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T01:00:00Z",
|
||||
"v": 7
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T02:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T03:00:00Z",
|
||||
"v": 6
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T04:00:00Z",
|
||||
"v": 9
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T05:00:00Z",
|
||||
"v": 15
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T06:00:00Z",
|
||||
"v": 22
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T07:00:00Z",
|
||||
"v": 28
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T08:00:00Z",
|
||||
"v": 40
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T09:00:00Z",
|
||||
"v": 71
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T10:00:00Z",
|
||||
"v": 96
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T11:00:00Z",
|
||||
"v": 123
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T12:00:00Z",
|
||||
"v": 130
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T13:00:00Z",
|
||||
"v": 108
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T14:00:00Z",
|
||||
"v": 92
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T15:00:00Z",
|
||||
"v": 105
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T16:00:00Z",
|
||||
"v": 128
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T17:00:00Z",
|
||||
"v": 145
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T18:00:00Z",
|
||||
"v": 84
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T19:00:00Z",
|
||||
"v": 60
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T20:00:00Z",
|
||||
"v": 43
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T21:00:00Z",
|
||||
"v": 29
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T22:00:00Z",
|
||||
"v": 20
|
||||
},
|
||||
{
|
||||
"t": "2026-11-13T23:00:00Z",
|
||||
"v": 18
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T00:00:00Z",
|
||||
"v": 12
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T01:00:00Z",
|
||||
"v": 10
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T02:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T03:00:00Z",
|
||||
"v": 8
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T04:00:00Z",
|
||||
"v": 10
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T05:00:00Z",
|
||||
"v": 19
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T06:00:00Z",
|
||||
"v": 26
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T07:00:00Z",
|
||||
"v": 38
|
||||
},
|
||||
{
|
||||
"t": "2026-11-14T08:00:00Z",
|
||||
"v": 51
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
const useMock =
|
||||
(process.env.NUXT_PUBLIC_USE_MOCK ?? process.env.NUXT_USE_MOCK ?? '').toLowerCase() === 'true' ||
|
||||
process.env.NUXT_PUBLIC_USE_MOCK === '1' ||
|
||||
process.env.NUXT_USE_MOCK === '1'
|
||||
|
||||
export default defineNuxtConfig({
|
||||
compatibilityDate: '2026-11-01',
|
||||
ssr: true,
|
||||
modules: ['@sit-onyx/nuxt'],
|
||||
css: ['~/assets/css/main.css'],
|
||||
devtools: { enabled: false },
|
||||
runtimeConfig: {
|
||||
// Server-side Go API. K8s sets NUXT_API_INTERNAL_BASE=http://api:8080.
|
||||
apiBase:
|
||||
process.env.NUXT_API_INTERNAL_BASE ??
|
||||
process.env.NUXT_API_BASE ??
|
||||
process.env.NUXT_PUBLIC_API_BASE ??
|
||||
'http://localhost:8080',
|
||||
apiTimeoutMs: Number(process.env.NUXT_API_TIMEOUT_MS ?? 8000),
|
||||
// Explicit dev fallback. The default is the real Go API.
|
||||
useMock,
|
||||
// Server-only control credentials for POST /api/scenario and /api/train.
|
||||
controlUser: process.env.CONTROL_USER ?? process.env.NUXT_CONTROL_USER ?? '',
|
||||
controlPass: process.env.CONTROL_PASS ?? process.env.NUXT_CONTROL_PASS ?? '',
|
||||
controlToken: process.env.CONTROL_TOKEN ?? process.env.NUXT_CONTROL_TOKEN ?? '',
|
||||
public: {
|
||||
// Browser never calls Go directly; this is for display/future SSE wiring.
|
||||
apiBase: process.env.NUXT_PUBLIC_API_BASE ?? '',
|
||||
useMock,
|
||||
demoNow: process.env.NUXT_PUBLIC_DEMO_NOW ?? '2026-11-14T08:12:00Z',
|
||||
},
|
||||
},
|
||||
app: {
|
||||
head: {
|
||||
htmlAttrs: { lang: 'en' },
|
||||
title: 'PulseCast — next week’s staffing plan',
|
||||
meta: [
|
||||
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
|
||||
{
|
||||
name: 'description',
|
||||
content:
|
||||
'PulseCast turns inner-city footfall into a transparent next-week staffing plan for Heilbronn retailers.',
|
||||
},
|
||||
{ name: 'theme-color', content: '#0f766e' },
|
||||
],
|
||||
link: [{ rel: 'icon', type: 'image/svg+xml', href: '/logo.svg' }],
|
||||
},
|
||||
},
|
||||
nitro: {
|
||||
preset: 'node-server',
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"$schema": "https://opencode.ai/config.json",
|
||||
"model": "opencode-go/deepseek-v4.1-flash"
|
||||
}
|
||||
Generated
+9674
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "pulsecast-web",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "nuxt dev",
|
||||
"build": "nuxt build",
|
||||
"preview": "nuxt preview",
|
||||
"postinstall": "nuxt prepare",
|
||||
"test": "vitest run",
|
||||
"mock": "node scripts/generate-mock.mjs",
|
||||
"smoke:live": "node scripts/smoke-live.mjs"
|
||||
},
|
||||
"dependencies": {
|
||||
"@sit-onyx/chartjs-plugin": "1.0.1",
|
||||
"@sit-onyx/icons": "1.13.0",
|
||||
"@sit-onyx/nuxt": "1.2.0",
|
||||
"chart.js": "4.6.1",
|
||||
"maplibre-gl": "6.18.0",
|
||||
"nuxt": "4.6.4",
|
||||
"qrcode": "1.5.4",
|
||||
"sit-onyx": "1.22.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/qrcode": "1.5.5",
|
||||
"typescript": "5.9.3",
|
||||
"vitest": "3.2.4"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 598 KiB |
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" fill="none">
|
||||
<rect width="48" height="48" rx="12" fill="#0F766E"/>
|
||||
<path d="M7 26h8l3-9 5 16 4-11 3 4h11" stroke="#CCFBF1" stroke-width="3.2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 262 B |
@@ -0,0 +1,295 @@
|
||||
// Generates deterministic demo data that follows CONTRACT.md.
|
||||
// Run: npm run mock
|
||||
// The output is checked in so the app renders before the Go API exists.
|
||||
import { mkdir, writeFile } from 'node:fs/promises'
|
||||
import { dirname, resolve } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
const root = resolve(dirname(fileURLToPath(import.meta.url)), '..')
|
||||
const out = (path) => resolve(root, 'mock', path)
|
||||
|
||||
const BERLIN = 'Europe/Berlin'
|
||||
const DEMO_NOW = '2026-11-14T08:12:00Z' // 09:12 in Heilbronn
|
||||
const PLAN_START = '2026-11-15T23:00:00Z' // Mon 16 Nov 00:00 local
|
||||
const PLAN_END = '2026-11-22T23:00:00Z' // Mon 23 Nov 00:00 local
|
||||
|
||||
const DATA_VERSION = '2026-11-14T03:00:00Z'
|
||||
const MODEL_VERSION = 'histgb-2026-11-14'
|
||||
const CONTEXT_VERSION = '2026-11-14T03:00:00Z'
|
||||
|
||||
const sensors = [
|
||||
{ id: 'hn-stadtgalerie-01', name: 'Stadtgalerie', lat: 49.1427, lon: 9.2109, factor: 1.15 },
|
||||
{ id: 'hn-kaiserstrasse-02', name: 'Kaiserstraße', lat: 49.1434, lon: 9.2142, factor: 1.05 },
|
||||
{ id: 'hn-marktplatz-03', name: 'Marktplatz', lat: 49.1414, lon: 9.2163, factor: 1.0 },
|
||||
{ id: 'hn-kilianskirche-04', name: 'Kilianskirche', lat: 49.1418, lon: 9.2188, factor: 0.88 },
|
||||
{ id: 'hn-rathaus-05', name: 'Rathaus', lat: 49.1407, lon: 9.2196, factor: 0.82 },
|
||||
{ id: 'hn-neckartor-06', name: 'Neckartor', lat: 49.1389, lon: 9.2172, factor: 0.9 },
|
||||
{ id: 'hn-suelmerstrasse-07', name: 'Sülmerstraße', lat: 49.1451, lon: 9.2158, factor: 1.08 },
|
||||
{ id: 'hn-harmonie-08', name: 'Harmonie', lat: 49.1397, lon: 9.213, factor: 0.76 },
|
||||
]
|
||||
|
||||
// Local weather for 14 Nov (now) through 22 Nov. Deterministic demo context.
|
||||
const weatherByDate = {
|
||||
'2026-11-14': { temp: 10.2, precip: 0.2, cloud: 55, wind: 14, humidity: 74 },
|
||||
'2026-11-15': { temp: 8.6, precip: 0.4, cloud: 70, wind: 12, humidity: 78 },
|
||||
'2026-11-16': { temp: 7.0, precip: 0.8, cloud: 85, wind: 17, humidity: 82 },
|
||||
'2026-11-17': { temp: 5.4, precip: 0.2, cloud: 75, wind: 11, humidity: 80 },
|
||||
'2026-11-18': { temp: 6.2, precip: 0.0, cloud: 60, wind: 9, humidity: 72 },
|
||||
'2026-11-19': { temp: 8.8, precip: 2.4, cloud: 90, wind: 20, humidity: 86 },
|
||||
'2026-11-20': { temp: 9.6, precip: 0.6, cloud: 80, wind: 16, humidity: 84 },
|
||||
'2026-11-21': { temp: 12.4, precip: 0.0, cloud: 25, wind: 8, humidity: 65 },
|
||||
'2026-11-22': { temp: 8.1, precip: 0.0, cloud: 50, wind: 10, humidity: 71 },
|
||||
}
|
||||
|
||||
const hourShape = [
|
||||
0.12, 0.08, 0.06, 0.05, 0.05, 0.07, 0.12, 0.18, 0.25, 0.32,
|
||||
0.55, 0.78, 0.95, 1.0, 0.88, 0.82, 0.86, 1.02, 1.12, 0.72,
|
||||
0.48, 0.35, 0.24, 0.16,
|
||||
]
|
||||
// Monday = 0 ... Sunday = 6
|
||||
const dayFactor = [0.78, 0.84, 0.9, 0.96, 1.08, 1.38, 0.7]
|
||||
|
||||
function mulberry32(seed) {
|
||||
let a = seed
|
||||
return function () {
|
||||
a |= 0
|
||||
a = (a + 0x6d2b79f5) | 0
|
||||
let t = Math.imul(a ^ (a >>> 15), 1 | a)
|
||||
t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t
|
||||
return ((t ^ (t >>> 14)) >>> 0) / 4294967296
|
||||
}
|
||||
}
|
||||
|
||||
const partsFormatter = new Intl.DateTimeFormat('en-CA', {
|
||||
timeZone: BERLIN,
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
hour: '2-digit',
|
||||
hourCycle: 'h23',
|
||||
})
|
||||
|
||||
function localParts(iso) {
|
||||
const parts = Object.fromEntries(
|
||||
partsFormatter.formatToParts(new Date(iso)).map((p) => [p.type, p.value]),
|
||||
)
|
||||
return {
|
||||
date: `${parts.year}-${parts.month}-${parts.day}`,
|
||||
hour: Number(parts.hour),
|
||||
weekday: ((new Date(`${parts.year}-${parts.month}-${parts.day}T12:00:00Z`).getUTCDay() + 6) % 7),
|
||||
}
|
||||
}
|
||||
|
||||
function weatherFactor(date, hour, weekday) {
|
||||
const w = weatherByDate[date] ?? weatherByDate['2026-11-16']
|
||||
let factor = 1
|
||||
if (w.precip >= 1) factor *= 0.86
|
||||
else if (w.precip > 0) factor *= 0.95
|
||||
if (w.cloud < 35 && (weekday === 5 || weekday === 6)) factor *= 1.08
|
||||
if (w.temp < 6) factor *= 0.95
|
||||
if (w.temp > 11) factor *= 1.03
|
||||
return factor
|
||||
}
|
||||
|
||||
function footfallAt(sensorIndex, iso) {
|
||||
const { date, hour, weekday } = localParts(iso)
|
||||
const rand = mulberry32(1000 + sensorIndex * 7919 + Math.floor(new Date(iso).getTime() / 3_600_000))
|
||||
const noise = 0.92 + rand() * 0.16
|
||||
const v = 110 * dayFactor[weekday] * hourShape[hour] * sensors[sensorIndex].factor
|
||||
* weatherFactor(date, hour, weekday) * noise
|
||||
return Math.max(4, Math.round(v))
|
||||
}
|
||||
|
||||
function pointsFor(sensorIndex, fromIso, hours) {
|
||||
const start = new Date(fromIso).getTime()
|
||||
return Array.from({ length: hours }, (_, i) => {
|
||||
const t = new Date(start + i * 3_600_000).toISOString().replace('.000Z', 'Z')
|
||||
const v = footfallAt(sensorIndex, t)
|
||||
return {
|
||||
t,
|
||||
v,
|
||||
lo: Math.max(0, Math.round(v * 0.82)),
|
||||
hi: Math.round(v * 1.18),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function meanOf(points) {
|
||||
return Math.round((points.reduce((sum, p) => sum + p.v, 0) / points.length) * 10) / 10
|
||||
}
|
||||
|
||||
function p95Of(points) {
|
||||
const sorted = points.map((p) => p.v).sort((a, b) => a - b)
|
||||
return sorted[Math.floor(sorted.length * 0.95)] ?? 0
|
||||
}
|
||||
|
||||
function ring(points) {
|
||||
return points.map(({ t, v }) => ({ t, v }))
|
||||
}
|
||||
|
||||
function weatherAt(iso) {
|
||||
const { date, hour } = localParts(iso)
|
||||
const w = weatherByDate[date] ?? weatherByDate['2026-11-16']
|
||||
const temp = Math.round((w.temp + 1.8 * Math.sin(((hour - 9) / 24) * Math.PI * 2)) * 10) / 10
|
||||
const rainHours = w.precip > 0 ? (hour >= 6 && hour <= 9) || (hour >= 15 && hour <= 17) : false
|
||||
const precip = rainHours ? Math.round((w.precip / 4) * 10) / 10 : 0
|
||||
return {
|
||||
t: iso,
|
||||
temp_c: temp,
|
||||
precip_mm: precip,
|
||||
cloud_pct: w.cloud,
|
||||
wind_kmh: w.wind,
|
||||
humidity_pct: w.humidity,
|
||||
}
|
||||
}
|
||||
|
||||
function isoHour(fromIso, offset) {
|
||||
return new Date(new Date(fromIso).getTime() + offset * 3_600_000).toISOString().replace('.000Z', 'Z')
|
||||
}
|
||||
|
||||
await mkdir(out('forecast'), { recursive: true })
|
||||
await mkdir(out('series'), { recursive: true })
|
||||
|
||||
const seriesBySensor = {}
|
||||
for (const [index, sensor] of sensors.entries()) {
|
||||
const series = pointsFor(index, '2026-11-07T00:00:00Z', 177)
|
||||
seriesBySensor[sensor.id] = series
|
||||
await writeFile(
|
||||
out(`series/${sensor.id}.json`),
|
||||
JSON.stringify({ sensor: sensor.id, step: '1h', points: ring(series) }, null, 2) + '\n',
|
||||
)
|
||||
|
||||
const forecast = pointsFor(index, PLAN_START, 168)
|
||||
await writeFile(
|
||||
out(`forecast/${sensor.id}.json`),
|
||||
JSON.stringify({
|
||||
sensor: sensor.id,
|
||||
horizon: '7d',
|
||||
scenario: 'base',
|
||||
points: forecast,
|
||||
cached: false,
|
||||
data_version: DATA_VERSION,
|
||||
model_version: MODEL_VERSION,
|
||||
context_version: CONTEXT_VERSION,
|
||||
}, null, 2) + '\n',
|
||||
)
|
||||
|
||||
sensor.mean = meanOf(series)
|
||||
sensor.p95 = p95Of(series)
|
||||
sensor.battery = 61 + ((index * 13) % 38)
|
||||
delete sensor.factor
|
||||
}
|
||||
|
||||
await writeFile(
|
||||
out('sensors.json'),
|
||||
JSON.stringify(sensors.map(({ id, name, lat, lon, mean, p95, battery }) => ({
|
||||
id, name, lat, lon, mean, p95, battery,
|
||||
})), null, 2) + '\n',
|
||||
)
|
||||
|
||||
const weatherForecast = Array.from({ length: 168 }, (_, i) => weatherAt(isoHour('2026-11-14T09:00:00Z', i)))
|
||||
await writeFile(
|
||||
out('context.json'),
|
||||
JSON.stringify({
|
||||
weather: {
|
||||
now: weatherAt('2026-11-14T08:00:00Z'),
|
||||
forecast: weatherForecast,
|
||||
},
|
||||
holidays: [
|
||||
{ date: '2026-01-01', name: 'Neujahr' },
|
||||
{ date: '2026-01-06', name: 'Heilige Drei Könige' },
|
||||
{ date: '2026-04-03', name: 'Karfreitag' },
|
||||
{ date: '2026-04-06', name: 'Ostermontag' },
|
||||
{ date: '2026-05-01', name: 'Tag der Arbeit' },
|
||||
{ date: '2026-05-14', name: 'Christi Himmelfahrt' },
|
||||
{ date: '2026-05-25', name: 'Pfingstmontag' },
|
||||
{ date: '2026-06-04', name: 'Fronleichnam' },
|
||||
{ date: '2026-10-03', name: 'Tag der Deutschen Einheit' },
|
||||
{ date: '2026-11-01', name: 'Allerheiligen' },
|
||||
{ date: '2026-12-25', name: '1. Weihnachtstag' },
|
||||
{ date: '2026-12-26', name: '2. Weihnachtstag' },
|
||||
],
|
||||
updated_at: '2026-11-14T03:00:00Z',
|
||||
cached: false,
|
||||
}, null, 2) + '\n',
|
||||
)
|
||||
|
||||
await writeFile(
|
||||
out('meta.json'),
|
||||
JSON.stringify({
|
||||
data_version: DATA_VERSION,
|
||||
model_version: MODEL_VERSION,
|
||||
context_version: CONTEXT_VERSION,
|
||||
coverage: {
|
||||
sensors: 8,
|
||||
from: '2025-10-16T21:00:00Z',
|
||||
to: '2026-11-07T23:51:00Z',
|
||||
cadence_min: 15,
|
||||
},
|
||||
metrics: {
|
||||
model: 'weather',
|
||||
mae: 3.36,
|
||||
wape: 27.8,
|
||||
r2: 0.779,
|
||||
baseline_mae: 5.4,
|
||||
baseline_wape: 44.7,
|
||||
},
|
||||
limits: [
|
||||
'estimated devices, not people',
|
||||
'8 sensors in a 580 m cluster',
|
||||
'observed weather in training; forecast weather in scenarios',
|
||||
],
|
||||
}, null, 2) + '\n',
|
||||
)
|
||||
|
||||
await writeFile(
|
||||
out('scenario.json'),
|
||||
JSON.stringify({
|
||||
version: 3,
|
||||
scenario: { scenario: 'base' },
|
||||
at: DEMO_NOW,
|
||||
}, null, 2) + '\n',
|
||||
)
|
||||
|
||||
await writeFile(
|
||||
out('scenarios.json'),
|
||||
JSON.stringify([
|
||||
{
|
||||
id: 'base',
|
||||
label: 'Base week',
|
||||
short: 'Base',
|
||||
description: 'Normal week, latest forecast weather.',
|
||||
weather: { temp_delta_c: 0, precip_mm: 0 },
|
||||
},
|
||||
{
|
||||
id: 'sunny-saturday-market',
|
||||
label: 'Sunny Saturday + market',
|
||||
short: 'Sun + market',
|
||||
description: 'Dry, mild Saturday with a market event; assumes +20% Saturday footfall.',
|
||||
weather: { temp_delta_c: 4, precip_mm: 0 },
|
||||
event: { type: 'market', uplift: 0.2 },
|
||||
},
|
||||
{
|
||||
id: 'rainy-saturday',
|
||||
label: 'Rainy Saturday',
|
||||
short: 'Rainy Sat',
|
||||
description: 'Steady rain on Saturday; assumes −18% Saturday footfall.',
|
||||
weather: { temp_delta_c: -2, precip_mm: 3.2 },
|
||||
},
|
||||
{
|
||||
id: 'weekday-event',
|
||||
label: 'Wednesday evening event',
|
||||
short: 'Wed event',
|
||||
description: 'Evening event nearby; assumes +25% footfall Wed 16:00–20:00.',
|
||||
weather: { temp_delta_c: 0, precip_mm: 0 },
|
||||
event: { type: 'concert', uplift: 0.25 },
|
||||
},
|
||||
], null, 2) + '\n',
|
||||
)
|
||||
|
||||
await writeFile(
|
||||
out('demo.json'),
|
||||
JSON.stringify({ now: DEMO_NOW, plan_start: PLAN_START, plan_end: PLAN_END, timezone: BERLIN }, null, 2) + '\n',
|
||||
)
|
||||
|
||||
console.log('mock data written to mock/')
|
||||
@@ -0,0 +1,133 @@
|
||||
#!/usr/bin/env node
|
||||
// Smoke-test the Nitro -> Go proxy chain against a running web server.
|
||||
// Usage: WEB_URL=http://localhost:3000 node scripts/smoke-api.mjs
|
||||
|
||||
const base = (process.env.WEB_URL ?? 'http://localhost:3000').replace(/\/+$/, '')
|
||||
let failures = 0
|
||||
|
||||
async function request(path, expectedStatus = 200) {
|
||||
const response = await fetch(`${base}${path}`, { headers: { accept: 'application/json' } })
|
||||
const text = await response.text()
|
||||
let body
|
||||
try {
|
||||
body = JSON.parse(text)
|
||||
} catch {
|
||||
throw new Error(`${path} returned non-JSON (${response.status}): ${text.slice(0, 120)}`)
|
||||
}
|
||||
if (response.status !== expectedStatus) {
|
||||
throw new Error(`${path} returned ${response.status}, expected ${expectedStatus}: ${text.slice(0, 200)}`)
|
||||
}
|
||||
return body
|
||||
}
|
||||
|
||||
async function check(name, fn) {
|
||||
try {
|
||||
const detail = await fn()
|
||||
console.log(`PASS ${name}${detail ? ` — ${detail}` : ''}`)
|
||||
} catch (error) {
|
||||
failures += 1
|
||||
console.log(`FAIL ${name} — ${error.message}`)
|
||||
}
|
||||
}
|
||||
|
||||
await check('/api/healthz', async () => {
|
||||
const body = await request('/api/healthz')
|
||||
if (body.ok !== true) throw new Error('ok is not true')
|
||||
return 'ok'
|
||||
})
|
||||
|
||||
let sensors = []
|
||||
await check('/api/sensors', async () => {
|
||||
sensors = await request('/api/sensors')
|
||||
if (!Array.isArray(sensors) || sensors.length === 0) throw new Error('empty sensor list')
|
||||
if (!sensors[0].id || !sensors[0].name) throw new Error('sensor missing id/name')
|
||||
return `${sensors.length} sensors, first=${sensors[0].id}`
|
||||
})
|
||||
|
||||
const sensor = sensors[0]?.id ?? 'hn-stadtgalerie-01'
|
||||
|
||||
await check('/api/context', async () => {
|
||||
const body = await request('/api/context')
|
||||
if (!body.weather?.now?.t) throw new Error('weather.now missing')
|
||||
if (!Array.isArray(body.holidays)) throw new Error('holidays missing')
|
||||
return `${body.holidays.length} holidays, updated=${body.updated_at}`
|
||||
})
|
||||
|
||||
await check('/api/meta', async () => {
|
||||
const body = await request('/api/meta')
|
||||
if (!body.model_version || !body.data_version) throw new Error('versions missing')
|
||||
return `model=${body.model_version}`
|
||||
})
|
||||
|
||||
await check('/api/series', async () => {
|
||||
const body = await request(`/api/series?sensor=${encodeURIComponent(sensor)}&step=1h`)
|
||||
if (!Array.isArray(body.points) || body.points.length === 0) throw new Error('no points')
|
||||
return `${body.points.length} hourly points`
|
||||
})
|
||||
|
||||
await check('/api/forecast 7d base', async () => {
|
||||
const body = await request(
|
||||
`/api/forecast?sensor=${encodeURIComponent(sensor)}&horizon=7d&scenario=base`,
|
||||
)
|
||||
if (!Array.isArray(body.points) || body.points.length === 0) throw new Error('no points')
|
||||
return `${body.points.length} points, cached=${body.cached}`
|
||||
})
|
||||
|
||||
await check('/api/forecast 7d rainy-saturday', async () => {
|
||||
const body = await request(
|
||||
`/api/forecast?sensor=${encodeURIComponent(sensor)}&horizon=7d&scenario=rainy-saturday`,
|
||||
)
|
||||
if (body.scenario !== 'rainy-saturday') throw new Error('scenario not echoed')
|
||||
return `${body.points.length} points`
|
||||
})
|
||||
|
||||
await check('/api/staffing standard', async () => {
|
||||
const body = await request(
|
||||
`/api/staffing?sensor=${encodeURIComponent(sensor)}&scenario=base&standard=standard`,
|
||||
)
|
||||
if (!Array.isArray(body.hours) || body.hours.length === 0) throw new Error('no plan hours')
|
||||
if (!Array.isArray(body.shifts) || body.shifts.length === 0) throw new Error('no shifts')
|
||||
if (!body.summary || typeof body.summary.coverage_pct !== 'number') {
|
||||
throw new Error('summary missing')
|
||||
}
|
||||
return `${body.hours.length} hours, ${body.shifts.length} shifts, cost=${body.summary.cost_eur}`
|
||||
})
|
||||
|
||||
await check('/api/staffing premium', async () => {
|
||||
const body = await request(
|
||||
`/api/staffing?sensor=${encodeURIComponent(sensor)}&scenario=base&standard=premium`,
|
||||
)
|
||||
if (body.standard !== 'premium') throw new Error('standard not echoed')
|
||||
return `cost=${body.summary.cost_eur}`
|
||||
})
|
||||
|
||||
await check('/api/scenarios local presets', async () => {
|
||||
const body = await request('/api/scenarios')
|
||||
if (!Array.isArray(body) || body.length < 4) throw new Error('preset list missing')
|
||||
return `${body.length} presets`
|
||||
})
|
||||
|
||||
await check('unknown sensor propagates 404', async () => {
|
||||
const body = await request('/api/staffing?sensor=does-not-exist', 404)
|
||||
if (!body.error?.message && !body.statusMessage && !body.message) {
|
||||
throw new Error('no error message')
|
||||
}
|
||||
return body.statusMessage ?? body.message ?? body.error?.message ?? '404'
|
||||
})
|
||||
|
||||
await check('invalid standard propagates 400', async () => {
|
||||
const body = await request(
|
||||
`/api/staffing?sensor=${encodeURIComponent(sensor)}&standard=luxury`,
|
||||
400,
|
||||
)
|
||||
if (!body.error?.message && !body.statusMessage && !body.message) {
|
||||
throw new Error('no error message')
|
||||
}
|
||||
return body.statusMessage ?? body.message ?? body.error?.message ?? '400'
|
||||
})
|
||||
|
||||
if (failures > 0) {
|
||||
console.error(`\n${failures} smoke check(s) failed against ${base}`)
|
||||
process.exit(1)
|
||||
}
|
||||
console.log(`\nAll smoke checks passed against ${base}`)
|
||||
@@ -0,0 +1,387 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* End-to-end live smoke test.
|
||||
*
|
||||
* Prerequisites (read-only use of the Go/ML worktrees):
|
||||
* - Go API on http://127.0.0.1:18080 with CONTROL_USER/CONTROL_PASS
|
||||
* - FastAPI ML on http://127.0.0.1:18000 (so Go can answer /api/readyz)
|
||||
* - Built Nuxt server on http://127.0.0.1:13000 with
|
||||
* NUXT_API_INTERNAL_BASE=http://127.0.0.1:18080
|
||||
* CONTROL_USER=control CONTROL_PASS=secret
|
||||
*
|
||||
* What it proves: the presenter POST reaches Go through Nitro, a `scenario`
|
||||
* SSE event arrives through the Nitro stream proxy, and the staffing/forecast
|
||||
* APIs return the new scenario. It also checks /stage, /live, the QR route and
|
||||
* the control-auth boundary.
|
||||
*/
|
||||
import assert from 'node:assert/strict'
|
||||
|
||||
const WEB_URL = (process.env.WEB_URL ?? 'http://127.0.0.1:13000').replace(/\/+$/, '')
|
||||
const CONTROL_USER = process.env.CONTROL_USER ?? 'control'
|
||||
const CONTROL_PASS = process.env.CONTROL_PASS ?? 'secret'
|
||||
const SENSOR = process.env.SENSOR ?? 'hn-stadtgalerie-01'
|
||||
const SSE_TIMEOUT_MS = Number(process.env.SSE_TIMEOUT_MS ?? 8000)
|
||||
const EXPECT_HEARTBEAT = process.env.EXPECT_HEARTBEAT === '1'
|
||||
const verbose = process.env.VERBOSE === '1'
|
||||
|
||||
const AUTHORIZATION = `Basic ${Buffer.from(`${CONTROL_USER}:${CONTROL_PASS}`).toString('base64')}`
|
||||
|
||||
function url(path) {
|
||||
return new URL(path, `${WEB_URL}/`).toString()
|
||||
}
|
||||
|
||||
function log(message) {
|
||||
console.log(` ${message}`)
|
||||
}
|
||||
|
||||
function pass(message) {
|
||||
console.log(`PASS ${message}`)
|
||||
}
|
||||
|
||||
function fail(message) {
|
||||
console.error(`FAIL ${message}`)
|
||||
}
|
||||
|
||||
async function fetchText(path, options = {}) {
|
||||
const response = await fetch(url(path), options)
|
||||
const text = await response.text()
|
||||
if (verbose) log(`${options.method ?? 'GET'} ${path} -> ${response.status}`)
|
||||
return { response, text }
|
||||
}
|
||||
|
||||
async function fetchJson(path, options = {}) {
|
||||
const { response, text } = await fetchText(path, {
|
||||
...options,
|
||||
headers: { accept: 'application/json', ...(options.headers ?? {}) },
|
||||
})
|
||||
let body
|
||||
try {
|
||||
body = JSON.parse(text)
|
||||
} catch {
|
||||
throw new Error(`${path} returned non-JSON (${response.status}): ${text.slice(0, 200)}`)
|
||||
}
|
||||
return { response, body }
|
||||
}
|
||||
|
||||
async function expectJson(path, options, status = 200) {
|
||||
const { response, body } = await fetchJson(path, options)
|
||||
assert.equal(response.status, status, `${path} status ${response.status}, expected ${status}: ${JSON.stringify(body)}`)
|
||||
return body
|
||||
}
|
||||
|
||||
function parseFrame(frame) {
|
||||
let name = 'message'
|
||||
let id = ''
|
||||
let retry = ''
|
||||
const data = []
|
||||
for (const line of frame.split('\n')) {
|
||||
if (!line || line.startsWith(':')) continue
|
||||
const separator = line.indexOf(':')
|
||||
const field = separator < 0 ? line : line.slice(0, separator)
|
||||
const value = separator < 0 ? '' : line.slice(separator + 1).replace(/^ /, '')
|
||||
if (field === 'event') name = value
|
||||
else if (field === 'id') id = value
|
||||
else if (field === 'data') data.push(value)
|
||||
else if (field === 'retry') retry = value
|
||||
}
|
||||
if (!data.length && name === 'message' && !retry) return null
|
||||
return { name: data.length || name !== 'message' ? name : 'retry', id, retry, data: data.join('\n') }
|
||||
}
|
||||
|
||||
/** Minimal incremental SSE reader over fetch (Node has no EventSource). */
|
||||
function openSse(path) {
|
||||
const controller = new AbortController()
|
||||
const events = []
|
||||
const waiters = new Set()
|
||||
let raw = ''
|
||||
let buffer = ''
|
||||
let finished = false
|
||||
|
||||
const notify = () => {
|
||||
for (const waiter of [...waiters]) waiter()
|
||||
}
|
||||
|
||||
const consume = () => {
|
||||
while (true) {
|
||||
const match = buffer.match(/\r?\n\r?\n/)
|
||||
if (!match || match.index === undefined) break
|
||||
const frame = buffer.slice(0, match.index)
|
||||
buffer = buffer.slice(match.index + match[0].length)
|
||||
const event = parseFrame(frame)
|
||||
if (event) {
|
||||
events.push(event)
|
||||
notify()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const responsePromise = fetch(url(path), {
|
||||
headers: { accept: 'text/event-stream' },
|
||||
signal: controller.signal,
|
||||
}).then(async (response) => {
|
||||
assert.equal(response.status, 200, `SSE status ${response.status}`)
|
||||
const contentType = response.headers.get('content-type') ?? ''
|
||||
assert.match(contentType, /text\/event-stream/, `SSE content-type: ${contentType}`)
|
||||
const reader = response.body.getReader()
|
||||
const decoder = new TextDecoder()
|
||||
;(async () => {
|
||||
try {
|
||||
while (true) {
|
||||
const { done, value } = await reader.read()
|
||||
if (done) break
|
||||
const chunk = decoder.decode(value, { stream: true })
|
||||
raw += chunk
|
||||
buffer += chunk.replace(/\r\n/g, '\n')
|
||||
consume()
|
||||
}
|
||||
} catch (error) {
|
||||
if (error?.name !== 'AbortError') throw error
|
||||
} finally {
|
||||
finished = true
|
||||
notify()
|
||||
}
|
||||
})()
|
||||
return response
|
||||
})
|
||||
|
||||
function waitFor(predicate, timeoutMs, label) {
|
||||
const existing = events.find(predicate)
|
||||
if (existing) return Promise.resolve(existing)
|
||||
if (finished) return Promise.reject(new Error(`SSE closed before ${label}`))
|
||||
return new Promise((resolve, reject) => {
|
||||
const timer = setTimeout(() => {
|
||||
waiters.delete(check)
|
||||
reject(new Error(`Timed out after ${timeoutMs} ms waiting for ${label}`))
|
||||
}, timeoutMs)
|
||||
const check = () => {
|
||||
const match = events.find(predicate)
|
||||
if (!match) return
|
||||
clearTimeout(timer)
|
||||
waiters.delete(check)
|
||||
resolve(match)
|
||||
}
|
||||
waiters.add(check)
|
||||
})
|
||||
}
|
||||
|
||||
return {
|
||||
responsePromise,
|
||||
waitFor,
|
||||
get raw() {
|
||||
return raw
|
||||
},
|
||||
close() {
|
||||
controller.abort()
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
function decisionShape(plan) {
|
||||
return JSON.stringify({
|
||||
scenario: plan.scenario,
|
||||
summary: plan.summary,
|
||||
footfall: plan.hours.map((hour) => [hour.t, hour.footfall, hour.required_staff, hour.scheduled_staff]),
|
||||
})
|
||||
}
|
||||
|
||||
async function main() {
|
||||
console.log(`PulseCast live smoke test -> ${WEB_URL}`)
|
||||
|
||||
const health = await expectJson('/api/healthz')
|
||||
assert.equal(health.ok, true, 'healthz.ok')
|
||||
pass('Nitro health endpoint')
|
||||
|
||||
const ready = await expectJson('/api/readyz')
|
||||
assert.equal(ready.ok, true, 'readyz.ok')
|
||||
assert.equal(ready.data, true, 'readyz.data (Go bootstrap snapshot)')
|
||||
assert.equal(ready.model, true, 'readyz.model (FastAPI)')
|
||||
pass('Go API ready with ML snapshot')
|
||||
|
||||
const initial = await expectJson('/api/scenario')
|
||||
assert.equal(typeof initial.version, 'number', 'scenario.version')
|
||||
assert.ok(initial.scenario?.scenario, 'scenario.scenario')
|
||||
pass(`scenario state v${initial.version} (${initial.scenario.scenario})`)
|
||||
|
||||
const basePlan = await expectJson(
|
||||
`/api/staffing?sensor=${encodeURIComponent(SENSOR)}&scenario=base&standard=standard`,
|
||||
)
|
||||
assert.equal(basePlan.sensor, SENSOR)
|
||||
assert.equal(basePlan.scenario, 'base')
|
||||
assert.ok(basePlan.hours.length > 0, 'base plan has open hours')
|
||||
assert.ok(basePlan.shifts.length > 0, 'base plan has shift blocks')
|
||||
pass(`base plan: ${basePlan.hours.length} hours, ${basePlan.shifts.length} shifts`)
|
||||
|
||||
const baseForecast = await expectJson(
|
||||
`/api/forecast?sensor=${encodeURIComponent(SENSOR)}&horizon=7d&scenario=base`,
|
||||
)
|
||||
assert.ok(baseForecast.points.length > 0, 'base forecast has points')
|
||||
pass(`base forecast: ${baseForecast.points.length} hourly points`)
|
||||
|
||||
const unauthenticated = await fetchJson('/api/scenario', {
|
||||
method: 'POST',
|
||||
headers: { 'content-type': 'application/json' },
|
||||
body: JSON.stringify({ scenario: 'rainy-saturday' }),
|
||||
})
|
||||
assert.equal(unauthenticated.response.status, 401, 'POST without presenter auth must be 401')
|
||||
pass('unauthenticated scenario POST is rejected')
|
||||
|
||||
const controlPage = await fetchText('/control')
|
||||
assert.equal(controlPage.response.status, 401, '/control without auth must be 401')
|
||||
assert.match(controlPage.response.headers.get('www-authenticate') ?? '', /Basic/i)
|
||||
pass('/control is presenter-protected')
|
||||
|
||||
const controlAuthed = await fetchText('/control', { headers: { authorization: AUTHORIZATION } })
|
||||
assert.equal(controlAuthed.response.status, 200, '/control with auth')
|
||||
assert.match(controlAuthed.text, /Presenter control/i)
|
||||
pass('/control authenticates and renders')
|
||||
|
||||
for (const [path, needle] of [
|
||||
['/stage', 'Scan for the phone view'],
|
||||
['/live', 'The plan on your phone'],
|
||||
]) {
|
||||
const page = await fetchText(path)
|
||||
assert.equal(page.response.status, 200, `${path} status`)
|
||||
assert.match(page.response.headers.get('content-type') ?? '', /text\/html/i, `${path} content-type`)
|
||||
assert.ok(page.text.includes(needle), `${path} contains "${needle}"`)
|
||||
assert.ok(page.text.includes('PulseCast'), `${path} contains the app shell`)
|
||||
pass(`${path} renders server-side`)
|
||||
}
|
||||
|
||||
const qr = await fetchText(`/api/qr?text=${encodeURIComponent(`${WEB_URL}/live`)}`)
|
||||
assert.equal(qr.response.status, 200, 'QR status')
|
||||
assert.match(qr.response.headers.get('content-type') ?? '', /image\/svg\+xml/i, 'QR content-type')
|
||||
assert.match(qr.text, /<svg/i, 'QR is SVG')
|
||||
pass('QR route returns SVG locally')
|
||||
|
||||
const sse = openSse('/api/stream')
|
||||
try {
|
||||
await sse.responsePromise
|
||||
const initialEvent = await sse.waitFor(
|
||||
(event) => event.name === 'scenario' || event.name === 'retry',
|
||||
5000,
|
||||
'the initial SSE frame',
|
||||
)
|
||||
assert.ok(initialEvent, 'initial SSE frame')
|
||||
if (EXPECT_HEARTBEAT) {
|
||||
await sse.waitFor((event) => event.name === 'ping', SSE_TIMEOUT_MS, 'a heartbeat ping')
|
||||
pass('SSE heartbeat observed')
|
||||
}
|
||||
assert.match(sse.raw, /retry:\s*3000/, 'SSE retry hint')
|
||||
|
||||
const initialScenarioEvent = await sse.waitFor(
|
||||
(event) => event.name === 'scenario',
|
||||
5000,
|
||||
'the initial scenario event',
|
||||
)
|
||||
const initialPayload = JSON.parse(initialScenarioEvent.data)
|
||||
assert.equal(typeof initialPayload.version, 'number', 'SSE initial version')
|
||||
pass(`SSE connected: retry:3000, initial scenario v${initialPayload.version}`)
|
||||
|
||||
const target = initialPayload.scenario === 'rainy-saturday' ? 'sunny-saturday-market' : 'rainy-saturday'
|
||||
const body =
|
||||
target === 'sunny-saturday-market'
|
||||
? {
|
||||
scenario: target,
|
||||
weather: { temp_delta_c: 4, precip_mm: 0 },
|
||||
event: { type: 'market', uplift: 0.2 },
|
||||
}
|
||||
: {
|
||||
scenario: target,
|
||||
weather: { temp_delta_c: -2, precip_mm: 3.2 },
|
||||
}
|
||||
|
||||
const started = performance.now()
|
||||
const posted = await expectJson('/api/scenario', {
|
||||
method: 'POST',
|
||||
headers: { authorization: AUTHORIZATION, 'content-type': 'application/json' },
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
assert.equal(posted.scenario.scenario, target, 'POST response scenario')
|
||||
const postMs = performance.now() - started
|
||||
|
||||
const event = await sse.waitFor(
|
||||
(candidate) => {
|
||||
if (candidate.name !== 'scenario') return false
|
||||
try {
|
||||
const payload = JSON.parse(candidate.data)
|
||||
return payload.version >= posted.version && payload.scenario?.scenario === target
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
},
|
||||
5000,
|
||||
`a scenario SSE event for ${target}`,
|
||||
)
|
||||
const elapsed = performance.now() - started
|
||||
const payload = JSON.parse(event.data)
|
||||
assert.equal(payload.scenario.scenario, target, 'SSE scenario id')
|
||||
assert.equal(event.id, String(payload.version), 'SSE id equals the scenario version')
|
||||
assert.ok(elapsed < 5000, `scenario event took ${elapsed.toFixed(0)} ms (max 5000)`)
|
||||
if (elapsed >= 2000) {
|
||||
console.warn(`WARN scenario propagated in ${elapsed.toFixed(0)} ms; contract target is <2000 ms`)
|
||||
}
|
||||
pass(`scenario POST -> SSE event in ${elapsed.toFixed(0)} ms (POST ${postMs.toFixed(0)} ms)`)
|
||||
|
||||
const polled = await expectJson('/api/scenario')
|
||||
assert.equal(polled.version, posted.version, 'GET /api/scenario polling version')
|
||||
assert.equal(polled.scenario.scenario, target, 'GET /api/scenario polling scenario')
|
||||
pass(`polling fallback reads v${polled.version} (${target})`)
|
||||
|
||||
const targetPlan = await expectJson(
|
||||
`/api/staffing?sensor=${encodeURIComponent(SENSOR)}&scenario=${target}&standard=standard`,
|
||||
)
|
||||
assert.equal(targetPlan.scenario, target, 'target plan scenario')
|
||||
assert.ok(targetPlan.hours.length > 0, 'target plan has hours')
|
||||
assert.notEqual(
|
||||
decisionShape(targetPlan),
|
||||
decisionShape(basePlan),
|
||||
`${target} plan must differ from base`,
|
||||
)
|
||||
if (targetPlan.cached) {
|
||||
console.warn('WARN Go served a cached plan; ML was not used for this request')
|
||||
} else {
|
||||
pass('target plan is live and differs from base')
|
||||
}
|
||||
|
||||
const targetForecast = await expectJson(
|
||||
`/api/forecast?sensor=${encodeURIComponent(SENSOR)}&horizon=7d&scenario=${target}`,
|
||||
)
|
||||
assert.equal(targetForecast.scenario, target, 'target forecast scenario')
|
||||
assert.ok(targetForecast.points.length > 0, 'target forecast has points')
|
||||
assert.notEqual(
|
||||
JSON.stringify(targetForecast.points),
|
||||
JSON.stringify(baseForecast.points),
|
||||
`${target} forecast must differ from base`,
|
||||
)
|
||||
pass('target forecast is live and differs from base')
|
||||
|
||||
const stageAfter = await fetchText('/stage')
|
||||
assert.equal(stageAfter.response.status, 200, 'stage after scenario')
|
||||
const expectedLabel = target === 'rainy-saturday' ? 'Rainy Saturday' : 'Sunny Saturday'
|
||||
assert.ok(stageAfter.text.includes(expectedLabel), `stage renders ${expectedLabel}`)
|
||||
pass(`/stage server-renders the new scenario (${expectedLabel})`)
|
||||
|
||||
const liveAfter = await fetchText('/live')
|
||||
assert.equal(liveAfter.response.status, 200, 'live after scenario')
|
||||
assert.ok(liveAfter.text.includes(expectedLabel), `live renders ${expectedLabel}`)
|
||||
pass(`/live server-renders the new scenario (${expectedLabel})`)
|
||||
|
||||
// Leave the demo in the base state so the next run is deterministic.
|
||||
const restored = await expectJson('/api/scenario', {
|
||||
method: 'POST',
|
||||
headers: { authorization: AUTHORIZATION, 'content-type': 'application/json' },
|
||||
body: JSON.stringify({ scenario: 'base', weather: { temp_delta_c: 0, precip_mm: 0 } }),
|
||||
})
|
||||
assert.equal(restored.scenario.scenario, 'base')
|
||||
pass(`restored base (v${restored.version})`)
|
||||
} finally {
|
||||
sse.close()
|
||||
}
|
||||
|
||||
console.log('\nAll live smoke checks passed.')
|
||||
}
|
||||
|
||||
main().catch((error) => {
|
||||
fail(error?.stack ?? String(error))
|
||||
process.exitCode = 1
|
||||
})
|
||||
@@ -0,0 +1,8 @@
|
||||
import type { ContextResponse } from '../../shared/types'
|
||||
import { apiRequest, isMockMode } from '../utils/api'
|
||||
import { mockContext } from '../utils/mock-data'
|
||||
|
||||
export default defineEventHandler(async () => {
|
||||
if (isMockMode()) return mockContext
|
||||
return apiRequest<ContextResponse>('/api/context')
|
||||
})
|
||||
@@ -0,0 +1,32 @@
|
||||
import { applyScenario } from '../../shared/staffing'
|
||||
import { HORIZONS, SCENARIOS } from '../../shared/types'
|
||||
import type { ForecastResponse, Horizon, Scenario } from '../../shared/types'
|
||||
import { apiRequest, enumParam, isMockMode, sensorParam } from '../utils/api'
|
||||
import { getMockForecast } from '../utils/mock-data'
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const query = getQuery(event)
|
||||
const sensor = sensorParam(query.sensor)
|
||||
const horizon = enumParam<Horizon>(query.horizon, HORIZONS, 'horizon', '7d')
|
||||
const scenario = enumParam<Scenario>(query.scenario, SCENARIOS, 'scenario', 'base')
|
||||
|
||||
if (isMockMode()) {
|
||||
const forecast = getMockForecast(sensor)
|
||||
if (!forecast) {
|
||||
throw createError({ statusCode: 404, statusMessage: `Unknown sensor: ${sensor}` })
|
||||
}
|
||||
const points = applyScenario(forecast.points, scenario)
|
||||
const limit = horizon === '15m' ? 1 : horizon === '1h' ? 4 : horizon === '48h' ? 48 : points.length
|
||||
return {
|
||||
...forecast,
|
||||
horizon,
|
||||
scenario,
|
||||
points: points.slice(0, limit),
|
||||
cached: false,
|
||||
}
|
||||
}
|
||||
|
||||
return apiRequest<ForecastResponse>('/api/forecast', {
|
||||
query: { sensor, horizon, scenario },
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,6 @@
|
||||
import { apiRequest, isMockMode } from '../utils/api'
|
||||
|
||||
export default defineEventHandler(async () => {
|
||||
if (isMockMode()) return { ok: true }
|
||||
return apiRequest<{ ok: boolean }>('/api/healthz')
|
||||
})
|
||||
@@ -0,0 +1,8 @@
|
||||
import type { MetaResponse } from '../../shared/types'
|
||||
import { apiRequest, isMockMode } from '../utils/api'
|
||||
import { mockMeta } from '../utils/mock-data'
|
||||
|
||||
export default defineEventHandler(async () => {
|
||||
if (isMockMode()) return mockMeta
|
||||
return apiRequest<MetaResponse>('/api/meta')
|
||||
})
|
||||
@@ -0,0 +1,35 @@
|
||||
import QRCode from 'qrcode'
|
||||
|
||||
/**
|
||||
* Generate the /stage QR code locally. No third-party QR image service is
|
||||
* called at runtime, so the big screen keeps working without internet access.
|
||||
*/
|
||||
export default defineEventHandler(async (event) => {
|
||||
const query = getQuery(event)
|
||||
const text = typeof query.text === 'string' ? query.text.trim() : ''
|
||||
if (!text) {
|
||||
throw createError({ statusCode: 400, statusMessage: 'text is required' })
|
||||
}
|
||||
if (text.length > 1024) {
|
||||
throw createError({ statusCode: 400, statusMessage: 'text is too long for a QR code' })
|
||||
}
|
||||
|
||||
let svg: string
|
||||
try {
|
||||
svg = await QRCode.toString(text, {
|
||||
type: 'svg',
|
||||
margin: 1,
|
||||
width: 320,
|
||||
errorCorrectionLevel: 'M',
|
||||
color: { dark: '#0f172a', light: '#ffffff' },
|
||||
})
|
||||
} catch {
|
||||
throw createError({ statusCode: 400, statusMessage: 'could not encode text as a QR code' })
|
||||
}
|
||||
|
||||
setResponseHeaders(event, {
|
||||
'content-type': 'image/svg+xml; charset=utf-8',
|
||||
'cache-control': 'public, max-age=300',
|
||||
})
|
||||
return svg
|
||||
})
|
||||
@@ -0,0 +1,6 @@
|
||||
import { apiRequest, isMockMode } from '../utils/api'
|
||||
|
||||
export default defineEventHandler(async () => {
|
||||
if (isMockMode()) return { ok: true, data: true, model: true }
|
||||
return apiRequest<{ ok: boolean; data: boolean; model: boolean }>('/api/readyz')
|
||||
})
|
||||
@@ -0,0 +1,8 @@
|
||||
import type { ScenarioState } from '../../shared/types'
|
||||
import { apiRequest, isMockMode } from '../utils/api'
|
||||
import { getMockScenario } from '../utils/mock-scenario'
|
||||
|
||||
export default defineEventHandler(async () => {
|
||||
if (isMockMode()) return getMockScenario()
|
||||
return apiRequest<ScenarioState>('/api/scenario')
|
||||
})
|
||||
@@ -0,0 +1,27 @@
|
||||
import { SCENARIOS } from '../../shared/types'
|
||||
import type { Scenario, ScenarioDefinition, ScenarioState } from '../../shared/types'
|
||||
import { apiRequest, isMockMode } from '../utils/api'
|
||||
import { setMockScenario } from '../utils/mock-scenario'
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const body = await readBody<ScenarioDefinition>(event)
|
||||
const scenario = body?.scenario
|
||||
if (!scenario || !SCENARIOS.includes(scenario as Scenario)) {
|
||||
throw createError({
|
||||
statusCode: 400,
|
||||
statusMessage: 'Invalid scenario. Expected base | sunny-saturday-market | rainy-saturday | weekday-event.',
|
||||
})
|
||||
}
|
||||
|
||||
if (isMockMode()) {
|
||||
return setMockScenario(body)
|
||||
}
|
||||
|
||||
// Control credentials are attached in the server process, never in the
|
||||
// browser. Go returns 503 until CONTROL_USER/CONTROL_PASS are configured.
|
||||
return apiRequest<ScenarioState>('/api/scenario', {
|
||||
method: 'POST',
|
||||
body,
|
||||
control: true,
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,5 @@
|
||||
import { SCENARIO_PRESETS } from '../../shared/scenarios'
|
||||
|
||||
// Scenario labels are UI metadata, not a Go endpoint. The forecast values and
|
||||
// the scenario enum come from the API.
|
||||
export default defineEventHandler(() => SCENARIO_PRESETS)
|
||||
@@ -0,0 +1,8 @@
|
||||
import type { Sensor } from '../../shared/types'
|
||||
import { apiRequest, isMockMode } from '../utils/api'
|
||||
import { mockSensors } from '../utils/mock-data'
|
||||
|
||||
export default defineEventHandler(async () => {
|
||||
if (isMockMode()) return mockSensors
|
||||
return apiRequest<Sensor[]>('/api/sensors')
|
||||
})
|
||||
@@ -0,0 +1,29 @@
|
||||
import type { SeriesResponse } from '../../shared/types'
|
||||
import { apiRequest, enumParam, isMockMode, sensorParam } from '../utils/api'
|
||||
import { getMockSeries } from '../utils/mock-data'
|
||||
|
||||
const STEPS = ['15m', '1h'] as const
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const query = getQuery(event)
|
||||
const sensor = sensorParam(query.sensor)
|
||||
|
||||
if (isMockMode()) {
|
||||
const series = getMockSeries(sensor)
|
||||
if (!series) {
|
||||
throw createError({ statusCode: 404, statusMessage: `Unknown sensor: ${sensor}` })
|
||||
}
|
||||
const step = query.step === '15m' ? '15m' : '1h'
|
||||
return { ...series, step }
|
||||
}
|
||||
|
||||
const step = query.step ? enumParam(query.step, STEPS, 'step') : undefined
|
||||
return apiRequest<SeriesResponse>('/api/series', {
|
||||
query: {
|
||||
sensor,
|
||||
step,
|
||||
from: query.from,
|
||||
to: query.to,
|
||||
},
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,38 @@
|
||||
import { applyScenario, buildStaffing, planWeekStart } from '../../shared/staffing'
|
||||
import { planDrivers } from '../../shared/insights'
|
||||
import { SCENARIOS, STANDARDS } from '../../shared/types'
|
||||
import type { Scenario, StaffingResponse, Standard } from '../../shared/types'
|
||||
import { apiRequest, enumParam, isMockMode, sensorParam } from '../utils/api'
|
||||
import { getMockForecast, mockContext, mockDemo } from '../utils/mock-data'
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const query = getQuery(event)
|
||||
const sensor = sensorParam(query.sensor)
|
||||
const scenario = enumParam<Scenario>(query.scenario, SCENARIOS, 'scenario', 'base')
|
||||
const standard = enumParam<Standard>(query.standard, STANDARDS, 'standard', 'standard')
|
||||
|
||||
if (isMockMode()) {
|
||||
const forecast = getMockForecast(sensor)
|
||||
if (!forecast) {
|
||||
throw createError({ statusCode: 404, statusMessage: `Unknown sensor: ${sensor}` })
|
||||
}
|
||||
const weekStart = planWeekStart(mockDemo.now)
|
||||
const build = buildStaffing({
|
||||
sensor,
|
||||
scenario,
|
||||
standard,
|
||||
points: applyScenario(forecast.points, scenario),
|
||||
weekStart,
|
||||
data_version: forecast.data_version,
|
||||
model_version: forecast.model_version,
|
||||
context_version: forecast.context_version,
|
||||
})
|
||||
build.response.why = planDrivers(build.response, mockContext, weekStart, scenario)
|
||||
return build.response
|
||||
}
|
||||
|
||||
// The Go API owns the plan. The browser never computes staffing in this path.
|
||||
return apiRequest<StaffingResponse>('/api/staffing', {
|
||||
query: { sensor, scenario, standard },
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,20 @@
|
||||
import { apiBaseUrl, isMockMode } from '../utils/api'
|
||||
|
||||
/**
|
||||
* Same-origin SSE proxy: the browser talks only to Nitro, so CORS stays closed.
|
||||
* proxyRequest forwards chunks as they arrive, preserving heartbeats and retry hints.
|
||||
*/
|
||||
export default defineEventHandler(async (event) => {
|
||||
if (isMockMode() || process.env.NUXT_DISABLE_SSE === '1') {
|
||||
// Failure drill: make the client prove the 5 s polling fallback. Mock mode
|
||||
// has no upstream stream either, so both paths fail fast and visibly.
|
||||
throw createError({
|
||||
statusCode: 503,
|
||||
statusMessage: 'SSE is disabled; the scenario polling fallback is active.',
|
||||
})
|
||||
}
|
||||
|
||||
return proxyRequest(event, `${apiBaseUrl()}/api/stream`, {
|
||||
headers: { accept: 'text/event-stream' },
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,55 @@
|
||||
import { apiForward, isMockMode } from '../utils/api'
|
||||
import { createMockTrainJob } from '../utils/train-jobs'
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
if (isMockMode()) {
|
||||
let model: 'small' | 'forecast' = 'small'
|
||||
let filename: string | null = null
|
||||
|
||||
const contentType = getRequestHeader(event, 'content-type') ?? ''
|
||||
if (contentType.includes('multipart/form-data')) {
|
||||
const parts = await readMultipartFormData(event)
|
||||
for (const part of parts ?? []) {
|
||||
if (part.name === 'model' && part.data) {
|
||||
const value = part.data.toString()
|
||||
if (value === 'small' || value === 'forecast') model = value
|
||||
}
|
||||
if (part.name === 'file' && part.filename) {
|
||||
filename = part.filename
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const body = await readBody<{ model?: 'small' | 'forecast'; path?: string }>(event).catch(() => null)
|
||||
if (body?.model === 'small' || body?.model === 'forecast') model = body.model
|
||||
if (body?.path) filename = body.path
|
||||
}
|
||||
|
||||
const job = createMockTrainJob(model, filename)
|
||||
setResponseStatus(event, 202)
|
||||
return {
|
||||
job_id: job.job_id,
|
||||
status: job.status,
|
||||
model: job.model,
|
||||
submitted_at: job.started_at,
|
||||
mock: true,
|
||||
}
|
||||
}
|
||||
|
||||
// Forward the raw multipart CSV to Go; control credentials stay in this process.
|
||||
const contentType = getRequestHeader(event, 'content-type') ?? ''
|
||||
if (!contentType) {
|
||||
throw createError({
|
||||
statusCode: 400,
|
||||
statusMessage: 'Content-Type must be application/json or multipart/form-data',
|
||||
})
|
||||
}
|
||||
|
||||
const body = await readRawBody(event)
|
||||
return apiForward(event, '/api/train', {
|
||||
method: 'POST',
|
||||
body,
|
||||
headers: { 'content-type': contentType },
|
||||
control: true,
|
||||
timeoutMs: 60_000,
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,19 @@
|
||||
import { apiRequest, isMockMode } from '../../utils/api'
|
||||
import { getMockTrainJob } from '../../utils/train-jobs'
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const jobId = getRouterParam(event, 'jobId')
|
||||
if (!jobId) {
|
||||
throw createError({ statusCode: 400, statusMessage: 'jobId is required' })
|
||||
}
|
||||
|
||||
if (isMockMode()) {
|
||||
const job = getMockTrainJob(jobId)
|
||||
if (!job) {
|
||||
throw createError({ statusCode: 404, statusMessage: `Unknown training job: ${jobId}` })
|
||||
}
|
||||
return job
|
||||
}
|
||||
|
||||
return apiRequest(`/api/train/${encodeURIComponent(jobId)}`, { control: true })
|
||||
})
|
||||
@@ -0,0 +1,99 @@
|
||||
import { createHash, createHmac, timingSafeEqual } from 'node:crypto'
|
||||
import { isMockMode } from '../utils/api'
|
||||
|
||||
const COOKIE_NAME = 'pulsecast_control'
|
||||
const COOKIE_CONTEXT = 'pulsecast-control-v1'
|
||||
|
||||
function digest(value: string): Buffer {
|
||||
return createHash('sha256').update(value).digest()
|
||||
}
|
||||
|
||||
/** Constant-time compare that works for unequal-length strings. */
|
||||
function safeEqual(a: string, b: string): boolean {
|
||||
return timingSafeEqual(digest(a), digest(b))
|
||||
}
|
||||
|
||||
function expectedCookie(pass: string): string {
|
||||
return createHmac('sha256', pass).update(COOKIE_CONTEXT).digest('base64url')
|
||||
}
|
||||
|
||||
function basicCredentials(event: import('h3').H3Event): { user: string; pass: string } | null {
|
||||
const header = getHeader(event, 'authorization') ?? ''
|
||||
if (!header.startsWith('Basic ')) return null
|
||||
let decoded: string
|
||||
try {
|
||||
decoded = Buffer.from(header.slice('Basic '.length), 'base64').toString('utf8')
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
const separator = decoded.indexOf(':')
|
||||
if (separator < 0) return null
|
||||
return { user: decoded.slice(0, separator), pass: decoded.slice(separator + 1) }
|
||||
}
|
||||
|
||||
function isProtected(event: import('h3').H3Event): boolean {
|
||||
const path = getRequestURL(event).pathname.replace(/\/+$/, '') || '/'
|
||||
if (path === '/control') return true
|
||||
if (path === '/api/scenario' && getMethod(event) === 'POST') return true
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Presenter control: Basic auth at Nitro, then an HMAC cookie (signed with
|
||||
* CONTROL_PASS) lets /control POST without re-prompting. Public GETs stay open.
|
||||
*/
|
||||
export default defineEventHandler((event) => {
|
||||
if (!isProtected(event)) return
|
||||
if (isMockMode()) return
|
||||
|
||||
const user = process.env.CONTROL_USER ?? process.env.NUXT_CONTROL_USER ?? ''
|
||||
const pass = process.env.CONTROL_PASS ?? process.env.NUXT_CONTROL_PASS ?? ''
|
||||
const isApi = getRequestURL(event).pathname.startsWith('/api/')
|
||||
setResponseHeader(event, 'cache-control', 'no-store')
|
||||
|
||||
if (!user || !pass) {
|
||||
setResponseStatus(event, 503)
|
||||
if (isApi) {
|
||||
setResponseHeader(event, 'content-type', 'application/json; charset=utf-8')
|
||||
return {
|
||||
error: {
|
||||
code: 'control_auth_unconfigured',
|
||||
message: 'CONTROL_USER and CONTROL_PASS are not configured in the web server.',
|
||||
},
|
||||
}
|
||||
}
|
||||
setResponseHeader(event, 'content-type', 'text/plain; charset=utf-8')
|
||||
return 'Control credentials are not configured. Set CONTROL_USER and CONTROL_PASS on the web server.'
|
||||
}
|
||||
|
||||
const expected = expectedCookie(pass)
|
||||
const cookie = getCookie(event, COOKIE_NAME)
|
||||
const cookieValid = Boolean(cookie && safeEqual(cookie, expected))
|
||||
|
||||
let basicValid = false
|
||||
const basic = basicCredentials(event)
|
||||
if (basic && safeEqual(basic.user, user) && safeEqual(basic.pass, pass)) {
|
||||
basicValid = true
|
||||
const forwardedProto = (getHeader(event, 'x-forwarded-proto') ?? '').split(',')[0]?.trim()
|
||||
setCookie(event, COOKIE_NAME, expected, {
|
||||
httpOnly: true,
|
||||
sameSite: 'lax',
|
||||
path: '/',
|
||||
maxAge: 60 * 60 * 8,
|
||||
secure: (forwardedProto || getRequestProtocol(event)) === 'https',
|
||||
})
|
||||
}
|
||||
|
||||
if (cookieValid || basicValid) return
|
||||
|
||||
setResponseStatus(event, 401)
|
||||
setResponseHeader(event, 'www-authenticate', 'Basic realm="PulseCast presenter"')
|
||||
if (isApi) {
|
||||
setResponseHeader(event, 'content-type', 'application/json; charset=utf-8')
|
||||
return {
|
||||
error: { code: 'unauthorized', message: 'Presenter credentials are required to change the scenario.' },
|
||||
}
|
||||
}
|
||||
setResponseHeader(event, 'content-type', 'text/plain; charset=utf-8')
|
||||
return 'Authentication required.'
|
||||
})
|
||||
@@ -0,0 +1,173 @@
|
||||
// Server-side Go API client. Nitro routes use it so the browser only talks to
|
||||
// this origin and control credentials stay in the Node process.
|
||||
|
||||
interface ApiErrorEnvelope {
|
||||
error?: { code?: string; message?: string }
|
||||
message?: string
|
||||
statusMessage?: string
|
||||
}
|
||||
|
||||
export interface ApiRequestOptions {
|
||||
query?: Record<string, unknown>
|
||||
method?: 'GET' | 'POST'
|
||||
/** Raw request body, forwarded unchanged (multipart training uploads). */
|
||||
body?: any
|
||||
headers?: Record<string, string>
|
||||
/** Attach CONTROL_USER/CONTROL_PASS as Basic auth. */
|
||||
control?: boolean
|
||||
timeoutMs?: number
|
||||
}
|
||||
|
||||
const DEFAULT_API_BASE = 'http://localhost:8080'
|
||||
|
||||
function envValue(...names: string[]): string {
|
||||
for (const name of names) {
|
||||
const value = process.env[name]
|
||||
if (value !== undefined && value !== '') return value
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
/** Runtime Go base URL. Reads the env directly so K8s can override the build. */
|
||||
export function apiBaseUrl(): string {
|
||||
const config = useRuntimeConfig()
|
||||
return (
|
||||
envValue('NUXT_API_INTERNAL_BASE', 'NUXT_API_BASE', 'NUXT_PUBLIC_API_BASE') ||
|
||||
String(config.apiBase ?? '') ||
|
||||
DEFAULT_API_BASE
|
||||
).replace(/\/+$/, '')
|
||||
}
|
||||
|
||||
/** Mock mode is opt-in via NUXT_USE_MOCK or NUXT_PUBLIC_USE_MOCK (1/true). */
|
||||
export function isMockMode(): boolean {
|
||||
const config = useRuntimeConfig()
|
||||
const raw =
|
||||
envValue('NUXT_USE_MOCK', 'NUXT_PUBLIC_USE_MOCK') || String(config.useMock ?? '')
|
||||
return raw === '1' || raw.toLowerCase() === 'true'
|
||||
}
|
||||
|
||||
function controlAuthorization(): string | undefined {
|
||||
const config = useRuntimeConfig()
|
||||
const user = envValue('CONTROL_USER', 'NUXT_CONTROL_USER') || String(config.controlUser ?? '')
|
||||
const pass = envValue('CONTROL_PASS', 'NUXT_CONTROL_PASS') || String(config.controlPass ?? '')
|
||||
if (user && pass) return `Basic ${Buffer.from(`${user}:${pass}`).toString('base64')}`
|
||||
|
||||
const token = envValue('CONTROL_TOKEN', 'NUXT_CONTROL_TOKEN') || String(config.controlToken ?? '')
|
||||
// Go requires Basic today; Bearer is a fallback for a future token-based API.
|
||||
if (token) return `Bearer ${token}`
|
||||
return undefined
|
||||
}
|
||||
|
||||
function timeoutMs(override?: number): number {
|
||||
if (override && Number.isFinite(override)) return override
|
||||
const configured = Number(
|
||||
envValue('NUXT_API_TIMEOUT_MS') || useRuntimeConfig().apiTimeoutMs,
|
||||
)
|
||||
return Number.isFinite(configured) && configured > 0 ? configured : 8000
|
||||
}
|
||||
|
||||
function upstreamError(error: unknown): never {
|
||||
const err = error as {
|
||||
status?: number
|
||||
statusCode?: number
|
||||
data?: ApiErrorEnvelope
|
||||
message?: string
|
||||
code?: string
|
||||
}
|
||||
|
||||
const status = err.status ?? err.statusCode
|
||||
if (status && status >= 400 && status < 600) {
|
||||
const message =
|
||||
err.data?.error?.message ?? err.data?.message ?? err.message ?? 'Go API request failed'
|
||||
throw createError({ statusCode: status, statusMessage: message, data: err.data })
|
||||
}
|
||||
|
||||
const reason = err.code === 'ETIMEDOUT' ? 'timed out' : 'unreachable'
|
||||
throw createError({
|
||||
statusCode: 502,
|
||||
statusMessage: `Go API ${reason} at ${apiBaseUrl()}`,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Call the Go API and return its JSON body. Non-2xx responses are converted to
|
||||
* H3 errors carrying the upstream status, so the UI sees a real 400/404/503.
|
||||
*/
|
||||
export async function apiRequest<T>(path: string, options: ApiRequestOptions = {}): Promise<T> {
|
||||
const headers: Record<string, string> = { accept: 'application/json', ...options.headers }
|
||||
if (options.control) {
|
||||
const authorization = controlAuthorization()
|
||||
if (authorization) headers.authorization = authorization
|
||||
}
|
||||
|
||||
const response = await $fetch
|
||||
.raw<T>(`${apiBaseUrl()}${path}`, {
|
||||
method: options.method ?? 'GET',
|
||||
query: options.query,
|
||||
body: options.body,
|
||||
headers,
|
||||
timeout: timeoutMs(options.timeoutMs),
|
||||
})
|
||||
.catch((error) => upstreamError(error))
|
||||
|
||||
if (response.status >= 400) {
|
||||
const body = response._data as ApiErrorEnvelope | undefined
|
||||
const message =
|
||||
body?.error?.message ?? body?.message ?? `Go API returned ${response.status}`
|
||||
throw createError({ statusCode: response.status, statusMessage: message, data: body })
|
||||
}
|
||||
return response._data as T
|
||||
}
|
||||
|
||||
/** Forward a training upload and keep Go's status code for 202/4xx/5xx. */
|
||||
export async function apiForward<T>(
|
||||
event: import('h3').H3Event,
|
||||
path: string,
|
||||
options: ApiRequestOptions = {},
|
||||
): Promise<T> {
|
||||
const headers: Record<string, string> = { accept: 'application/json', ...options.headers }
|
||||
if (options.control) {
|
||||
const authorization = controlAuthorization()
|
||||
if (authorization) headers.authorization = authorization
|
||||
}
|
||||
|
||||
const response = await $fetch
|
||||
.raw<T>(`${apiBaseUrl()}${path}`, {
|
||||
method: options.method ?? 'POST',
|
||||
query: options.query,
|
||||
body: options.body,
|
||||
headers,
|
||||
timeout: timeoutMs(options.timeoutMs),
|
||||
})
|
||||
.catch((error) => upstreamError(error))
|
||||
|
||||
setResponseStatus(event, response.status)
|
||||
return response._data as T
|
||||
}
|
||||
|
||||
/** Validate an enum-like query value before it reaches the Go API. */
|
||||
export function enumParam<T extends string>(
|
||||
value: unknown,
|
||||
allowed: readonly T[],
|
||||
name: string,
|
||||
fallback?: T,
|
||||
): T {
|
||||
if (value === undefined || value === '') {
|
||||
if (fallback !== undefined) return fallback
|
||||
throw createError({ statusCode: 400, statusMessage: `${name} is required` })
|
||||
}
|
||||
const candidate = String(value) as T
|
||||
if (!allowed.includes(candidate)) {
|
||||
throw createError({
|
||||
statusCode: 400,
|
||||
statusMessage: `Invalid ${name}: ${candidate}. Expected ${allowed.join(' | ')}.`,
|
||||
})
|
||||
}
|
||||
return candidate
|
||||
}
|
||||
|
||||
export function sensorParam(value: unknown, fallback = 'hn-stadtgalerie-01'): string {
|
||||
const sensor = value === undefined || value === '' ? fallback : String(value)
|
||||
if (!sensor) throw createError({ statusCode: 400, statusMessage: 'sensor is required' })
|
||||
return sensor
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
// Server-side mock dataset. Shapes follow the Go API contract; files are imported
|
||||
// so Nitro bundles them and mock mode renders without the Go API.
|
||||
import context from '../../mock/context.json'
|
||||
import demo from '../../mock/demo.json'
|
||||
import meta from '../../mock/meta.json'
|
||||
import scenario from '../../mock/scenario.json'
|
||||
import sensors from '../../mock/sensors.json'
|
||||
|
||||
import forecast01 from '../../mock/forecast/hn-stadtgalerie-01.json'
|
||||
import forecast02 from '../../mock/forecast/hn-kaiserstrasse-02.json'
|
||||
import forecast03 from '../../mock/forecast/hn-marktplatz-03.json'
|
||||
import forecast04 from '../../mock/forecast/hn-kilianskirche-04.json'
|
||||
import forecast05 from '../../mock/forecast/hn-rathaus-05.json'
|
||||
import forecast06 from '../../mock/forecast/hn-neckartor-06.json'
|
||||
import forecast07 from '../../mock/forecast/hn-suelmerstrasse-07.json'
|
||||
import forecast08 from '../../mock/forecast/hn-harmonie-08.json'
|
||||
|
||||
import series01 from '../../mock/series/hn-stadtgalerie-01.json'
|
||||
import series02 from '../../mock/series/hn-kaiserstrasse-02.json'
|
||||
import series03 from '../../mock/series/hn-marktplatz-03.json'
|
||||
import series04 from '../../mock/series/hn-kilianskirche-04.json'
|
||||
import series05 from '../../mock/series/hn-rathaus-05.json'
|
||||
import series06 from '../../mock/series/hn-neckartor-06.json'
|
||||
import series07 from '../../mock/series/hn-suelmerstrasse-07.json'
|
||||
import series08 from '../../mock/series/hn-harmonie-08.json'
|
||||
|
||||
import type {
|
||||
ContextResponse,
|
||||
ForecastResponse,
|
||||
MetaResponse,
|
||||
ScenarioState,
|
||||
Sensor,
|
||||
SeriesResponse,
|
||||
} from '../../shared/types'
|
||||
|
||||
export const mockMeta = meta as MetaResponse
|
||||
export const mockContext = context as ContextResponse
|
||||
export const mockSensors = sensors as Sensor[]
|
||||
export const mockScenario = scenario as ScenarioState
|
||||
export const mockDemo = demo as {
|
||||
now: string
|
||||
plan_start: string
|
||||
plan_end: string
|
||||
timezone: string
|
||||
}
|
||||
|
||||
const forecasts: Record<string, ForecastResponse> = {
|
||||
'hn-stadtgalerie-01': forecast01,
|
||||
'hn-kaiserstrasse-02': forecast02,
|
||||
'hn-marktplatz-03': forecast03,
|
||||
'hn-kilianskirche-04': forecast04,
|
||||
'hn-rathaus-05': forecast05,
|
||||
'hn-neckartor-06': forecast06,
|
||||
'hn-suelmerstrasse-07': forecast07,
|
||||
'hn-harmonie-08': forecast08,
|
||||
} as Record<string, ForecastResponse>
|
||||
|
||||
const series: Record<string, SeriesResponse> = {
|
||||
'hn-stadtgalerie-01': series01,
|
||||
'hn-kaiserstrasse-02': series02,
|
||||
'hn-marktplatz-03': series03,
|
||||
'hn-kilianskirche-04': series04,
|
||||
'hn-rathaus-05': series05,
|
||||
'hn-neckartor-06': series06,
|
||||
'hn-suelmerstrasse-07': series07,
|
||||
'hn-harmonie-08': series08,
|
||||
} as Record<string, SeriesResponse>
|
||||
|
||||
export function getMockForecast(sensorId: string): ForecastResponse | undefined {
|
||||
return forecasts[sensorId]
|
||||
}
|
||||
|
||||
export function getMockSeries(sensorId: string): SeriesResponse | undefined {
|
||||
return series[sensorId]
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import type { ScenarioDefinition, ScenarioState } from '../../shared/types'
|
||||
import { mockScenario } from './mock-data'
|
||||
|
||||
// Mock mode has no Go process, but the presenter controls and the 5 s polling
|
||||
// fallback should still observe a version change. Nitro keeps this per-process
|
||||
// state, exactly like the single Go pod keeps its in-memory scenario.
|
||||
let current: ScenarioState = clone(mockScenario)
|
||||
|
||||
function clone<T>(value: T): T {
|
||||
return JSON.parse(JSON.stringify(value)) as T
|
||||
}
|
||||
|
||||
export function getMockScenario(): ScenarioState {
|
||||
return clone(current)
|
||||
}
|
||||
|
||||
export function setMockScenario(input: ScenarioDefinition): ScenarioState {
|
||||
current = {
|
||||
version: current.version + 1,
|
||||
scenario: clone(input),
|
||||
at: new Date().toISOString(),
|
||||
}
|
||||
return clone(current)
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
import { mockMeta } from './mock-data'
|
||||
|
||||
export interface MockTrainJob {
|
||||
job_id: string
|
||||
status: 'queued' | 'running' | 'succeeded' | 'failed'
|
||||
model: 'small' | 'forecast'
|
||||
started_at: string
|
||||
finished_at: string | null
|
||||
metrics: Record<string, number | string> | null
|
||||
model_version: string | null
|
||||
error: string | null
|
||||
filename: string | null
|
||||
}
|
||||
|
||||
const jobs = new Map<string, MockTrainJob>()
|
||||
|
||||
export function createMockTrainJob(model: 'small' | 'forecast', filename: string | null): MockTrainJob {
|
||||
const now = new Date().toISOString()
|
||||
const job: MockTrainJob = {
|
||||
job_id: `mock-${Date.now().toString(36)}`,
|
||||
// The mock completes immediately; the real path polls GET /api/train/{job_id}.
|
||||
status: 'succeeded',
|
||||
model,
|
||||
started_at: now,
|
||||
finished_at: now,
|
||||
metrics:
|
||||
model === 'small'
|
||||
? { accuracy: 0.84, f1: 0.81, trained_rows: 12480, kind: 'busy classifier' }
|
||||
: {
|
||||
mae: mockMeta.metrics.mae,
|
||||
wape: mockMeta.metrics.wape,
|
||||
r2: mockMeta.metrics.r2,
|
||||
baseline_wape: mockMeta.metrics.baseline_wape,
|
||||
kind: 'global HistGB',
|
||||
},
|
||||
model_version: `${mockMeta.model_version}-mock-${Date.now().toString(36)}`,
|
||||
error: null,
|
||||
filename,
|
||||
}
|
||||
jobs.set(job.job_id, job)
|
||||
return job
|
||||
}
|
||||
|
||||
export function getMockTrainJob(jobId: string): MockTrainJob | undefined {
|
||||
return jobs.get(jobId)
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
import { berlinParts, isInWeek } from './staffing'
|
||||
import type { ContextResponse, Scenario, StaffingResponse, WeatherPoint } from './types'
|
||||
|
||||
export type WeatherKind = 'sunny' | 'partly-cloudy' | 'cloudy' | 'rain'
|
||||
|
||||
export interface DailyWeather {
|
||||
date: string
|
||||
tempMin: number
|
||||
tempMax: number
|
||||
precipMm: number
|
||||
cloudPct: number
|
||||
kind: WeatherKind
|
||||
}
|
||||
|
||||
export function weatherKind(point: Pick<WeatherPoint, 'precip_mm' | 'cloud_pct'>): WeatherKind {
|
||||
if (point.precip_mm >= 0.5) return 'rain'
|
||||
if (point.cloud_pct <= 35) return 'sunny'
|
||||
if (point.cloud_pct <= 70) return 'partly-cloudy'
|
||||
return 'cloudy'
|
||||
}
|
||||
|
||||
/** Group hourly weather into local Heilbronn days. */
|
||||
export function dailyWeather(forecast: WeatherPoint[]): Record<string, DailyWeather> {
|
||||
const days: Record<string, DailyWeather> = {}
|
||||
for (const point of forecast) {
|
||||
const { date, hour } = berlinParts(point.t)
|
||||
const day = (days[date] ??= {
|
||||
date,
|
||||
tempMin: point.temp_c,
|
||||
tempMax: point.temp_c,
|
||||
precipMm: 0,
|
||||
cloudPct: 0,
|
||||
kind: 'cloudy',
|
||||
})
|
||||
day.tempMin = Math.min(day.tempMin, point.temp_c)
|
||||
day.tempMax = Math.max(day.tempMax, point.temp_c)
|
||||
day.precipMm = Math.max(day.precipMm, point.precip_mm)
|
||||
// Cloud cover at midday is a better summary than the daily maximum.
|
||||
if (hour >= 11 && hour <= 14) day.cloudPct = Math.max(day.cloudPct, point.cloud_pct)
|
||||
}
|
||||
for (const day of Object.values(days)) {
|
||||
day.kind = weatherKind({ precip_mm: day.precipMm, cloud_pct: day.cloudPct })
|
||||
}
|
||||
return days
|
||||
}
|
||||
|
||||
/** Plain-language drivers for the "why this plan" card. */
|
||||
export function planDrivers(
|
||||
plan: StaffingResponse,
|
||||
context: ContextResponse,
|
||||
weekStart: string,
|
||||
scenario: Scenario = 'base',
|
||||
): string[] {
|
||||
const reasons: string[] = []
|
||||
const weather = dailyWeather(context.weather.forecast)
|
||||
const weekWeather = Object.values(weather).filter((day) => isInWeek(day.date, weekStart))
|
||||
|
||||
if (plan.hours.length) {
|
||||
const peak = plan.hours.reduce((best, hour) => (hour.footfall > best.footfall ? hour : best))
|
||||
const parts = berlinParts(peak.t)
|
||||
const weekday = new Intl.DateTimeFormat('en-GB', { weekday: 'long', timeZone: 'Europe/Berlin' }).format(
|
||||
new Date(peak.t),
|
||||
)
|
||||
reasons.push(
|
||||
`${weekday} ${String(parts.hour).padStart(2, '0')}:00 is the forecast peak: ${peak.footfall} estimated visitors/hour needs ${peak.required_staff} staff.`,
|
||||
)
|
||||
}
|
||||
|
||||
if (scenario === 'base') {
|
||||
const bestWeather = weekWeather
|
||||
.filter((day) => day.precipMm < 0.5)
|
||||
.sort((a, b) => b.tempMax - a.tempMax)[0]
|
||||
if (bestWeather) {
|
||||
const weekday = new Intl.DateTimeFormat('en-GB', { weekday: 'long', timeZone: 'Europe/Berlin' }).format(
|
||||
new Date(`${bestWeather.date}T12:00:00Z`),
|
||||
)
|
||||
reasons.push(
|
||||
`Weather driver: ${weekday} is the mildest dry day (${Math.round(bestWeather.tempMax)} °C, ${bestWeather.precipMm.toFixed(1)} mm rain) in the current Open-Meteo mock.`,
|
||||
)
|
||||
}
|
||||
} else {
|
||||
reasons.push(
|
||||
`Scenario “${scenario}” applies a mock footfall perturbation. The weather strip stays the base context; it is not recomputed per scenario.`,
|
||||
)
|
||||
}
|
||||
|
||||
const holiday = context.holidays.find((entry) => isInWeek(entry.date, weekStart))
|
||||
reasons.push(
|
||||
holiday
|
||||
? `Public holiday in this week: ${holiday.name} (${holiday.date}). Expect a different footfall shape.`
|
||||
: 'No Baden-Württemberg public holiday falls inside this plan week.',
|
||||
)
|
||||
|
||||
reasons.push(
|
||||
`Rule: ${plan.assumptions.visitors_per_staff_hour} visitors per staff-hour × ${plan.assumptions.safety_factor} safety factor, minimum ${plan.assumptions.min_staff} staff, ${plan.assumptions.shift_length_h} h shift blocks.`,
|
||||
)
|
||||
|
||||
return reasons
|
||||
}
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
import { SCENARIOS } from './types'
|
||||
import type { Scenario, ScenarioState } from './types'
|
||||
|
||||
/** Client connection modes shown on /stage, /live and /plan. */
|
||||
export type LiveConnection = 'connecting' | 'live' | 'polling' | 'offline'
|
||||
|
||||
/** Poll the public scenario endpoint every 5 s while SSE is unavailable. */
|
||||
export const SCENARIO_POLL_MS = 5000
|
||||
/** Two consecutive SSE errors are enough to start the polling fallback. */
|
||||
export const SSE_FAILURES_BEFORE_POLLING = 2
|
||||
/** The Go hub pings every 15 s; two missed pings mean the stream is buffered. */
|
||||
export const SSE_STALE_MS = 32000
|
||||
|
||||
export const LIVE_LABELS: Record<LiveConnection, string> = {
|
||||
connecting: 'Connecting',
|
||||
live: 'Live',
|
||||
polling: 'Polling',
|
||||
offline: 'Offline',
|
||||
}
|
||||
|
||||
export const LIVE_COLORS: Record<LiveConnection, 'neutral' | 'success' | 'warning' | 'danger'> = {
|
||||
connecting: 'neutral',
|
||||
live: 'success',
|
||||
polling: 'warning',
|
||||
offline: 'danger',
|
||||
}
|
||||
|
||||
export interface LiveStatusInput {
|
||||
online: boolean
|
||||
sseOpen: boolean
|
||||
sseFailures: number
|
||||
polling: boolean
|
||||
pollFailures: number
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve the visible connection state. Live means an open SSE stream,
|
||||
* Polling means the 5 s fallback is working, Offline means neither path works.
|
||||
*/
|
||||
export function liveStatus(input: LiveStatusInput): LiveConnection {
|
||||
if (!input.online) return 'offline'
|
||||
if (input.sseOpen) return 'live'
|
||||
if (input.polling) return input.pollFailures > 0 ? 'offline' : 'polling'
|
||||
if (input.sseFailures >= SSE_FAILURES_BEFORE_POLLING) {
|
||||
return input.pollFailures > 0 ? 'offline' : 'polling'
|
||||
}
|
||||
return 'connecting'
|
||||
}
|
||||
|
||||
/** Parse and validate one `event: scenario` payload from Go /api/stream. */
|
||||
export function parseScenarioEvent(raw: string): ScenarioState | null {
|
||||
let value: unknown
|
||||
try {
|
||||
value = JSON.parse(raw)
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
if (!value || typeof value !== 'object') return null
|
||||
const candidate = value as Partial<ScenarioState>
|
||||
if (typeof candidate.version !== 'number' || !Number.isFinite(candidate.version)) return null
|
||||
if (typeof candidate.at !== 'string' || !candidate.at) return null
|
||||
if (!candidate.scenario || typeof candidate.scenario !== 'object') return null
|
||||
const scenario = candidate.scenario as { scenario?: unknown }
|
||||
if (typeof scenario.scenario !== 'string') return null
|
||||
if (!SCENARIOS.includes(scenario.scenario as Scenario)) return null
|
||||
return candidate as ScenarioState
|
||||
}
|
||||
|
||||
/** A new server version, or a changed scenario id, is a reason to refetch. */
|
||||
export function scenarioChanged(
|
||||
previous: ScenarioState | null | undefined,
|
||||
next: ScenarioState,
|
||||
): boolean {
|
||||
if (!previous) return true
|
||||
return previous.version !== next.version || previous.scenario.scenario !== next.scenario.scenario
|
||||
}
|
||||
|
||||
export function scenarioLabel(scenario: Scenario | string | undefined): string {
|
||||
switch (scenario) {
|
||||
case 'sunny-saturday-market':
|
||||
return 'Sunny Saturday + market'
|
||||
case 'rainy-saturday':
|
||||
return 'Rainy Saturday'
|
||||
case 'weekday-event':
|
||||
return 'Wednesday evening event'
|
||||
default:
|
||||
return 'Base week'
|
||||
}
|
||||
}
|
||||
|
||||
/** Small, dependency-free age label for the last SSE/poll event. */
|
||||
export function liveAge(lastEventAt: string, now = Date.now()): string {
|
||||
if (!lastEventAt) return 'no event yet'
|
||||
const time = Date.parse(lastEventAt)
|
||||
if (Number.isNaN(time)) return 'no event yet'
|
||||
const seconds = Math.max(0, Math.round((now - time) / 1000))
|
||||
if (seconds < 5) return 'just now'
|
||||
if (seconds < 60) return `${seconds}s ago`
|
||||
const minutes = Math.round(seconds / 60)
|
||||
return `${minutes} min ago`
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
import type { ScenarioPreset } from './types'
|
||||
|
||||
/**
|
||||
* Demo scenario metadata shown in the UI. The scenario enum and the forecast
|
||||
* perturbation itself live in the Go/ML services; this list only supplies the
|
||||
* labels and the narrative used on /plan and /simulate.
|
||||
*/
|
||||
export const SCENARIO_PRESETS: ScenarioPreset[] = [
|
||||
{
|
||||
id: 'base',
|
||||
label: 'Base week',
|
||||
short: 'Base',
|
||||
description: 'Normal week, latest forecast weather.',
|
||||
weather: { temp_delta_c: 0, precip_mm: 0 },
|
||||
},
|
||||
{
|
||||
id: 'sunny-saturday-market',
|
||||
label: 'Sunny Saturday + market',
|
||||
short: 'Sun + market',
|
||||
description: 'Dry, mild Saturday with a market event; the API applies the forecast uplift.',
|
||||
weather: { temp_delta_c: 4, precip_mm: 0 },
|
||||
event: { type: 'market', uplift: 0.2 },
|
||||
},
|
||||
{
|
||||
id: 'rainy-saturday',
|
||||
label: 'Rainy Saturday',
|
||||
short: 'Rainy Sat',
|
||||
description: 'Steady rain on Saturday; the API applies the forecast reduction.',
|
||||
weather: { temp_delta_c: -2, precip_mm: 3.2 },
|
||||
},
|
||||
{
|
||||
id: 'weekday-event',
|
||||
label: 'Wednesday evening event',
|
||||
short: 'Wed event',
|
||||
description: 'Evening event nearby; the API applies the weekday event uplift.',
|
||||
weather: { temp_delta_c: 0, precip_mm: 0 },
|
||||
event: { type: 'concert', uplift: 0.25 },
|
||||
},
|
||||
]
|
||||
@@ -0,0 +1,250 @@
|
||||
import type {
|
||||
Coverage,
|
||||
Point,
|
||||
Scenario,
|
||||
Shift,
|
||||
StaffingAssumptions,
|
||||
StaffingHour,
|
||||
StaffingResponse,
|
||||
Standard,
|
||||
} from './types'
|
||||
|
||||
export const BERLIN_TZ = 'Europe/Berlin'
|
||||
|
||||
export const STANDARD_VISITORS_PER_STAFF_HOUR: Record<Standard, number> = {
|
||||
relaxed: 35,
|
||||
standard: 25,
|
||||
premium: 18,
|
||||
}
|
||||
|
||||
export const DEFAULT_ASSUMPTIONS: StaffingAssumptions = {
|
||||
visitors_per_staff_hour: STANDARD_VISITORS_PER_STAFF_HOUR.standard,
|
||||
safety_factor: 1.15,
|
||||
min_staff: 1,
|
||||
shift_length_h: 4,
|
||||
labor_cost_eur_h: 16,
|
||||
store_hours: { open: '10:00', close: '20:00', tz: BERLIN_TZ },
|
||||
}
|
||||
|
||||
const partsFormatter = new Intl.DateTimeFormat('en-CA', {
|
||||
timeZone: BERLIN_TZ,
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
hourCycle: 'h23',
|
||||
})
|
||||
|
||||
export interface LocalParts {
|
||||
date: string
|
||||
hour: number
|
||||
minute: number
|
||||
/** Monday = 0 ... Sunday = 6 */
|
||||
weekday: number
|
||||
}
|
||||
|
||||
/** Convert a wire timestamp (UTC) to Heilbronn wall-clock parts. */
|
||||
export function berlinParts(iso: string): LocalParts {
|
||||
const parts = Object.fromEntries(
|
||||
partsFormatter.formatToParts(new Date(iso)).map((p) => [p.type, p.value]),
|
||||
)
|
||||
const date = `${parts.year}-${parts.month}-${parts.day}`
|
||||
return {
|
||||
date,
|
||||
hour: Number(parts.hour),
|
||||
minute: Number(parts.minute),
|
||||
weekday: (new Date(`${date}T12:00:00Z`).getUTCDay() + 6) % 7,
|
||||
}
|
||||
}
|
||||
|
||||
export function addDays(date: string, days: number): string {
|
||||
const d = new Date(`${date}T12:00:00Z`)
|
||||
d.setUTCDate(d.getUTCDate() + days)
|
||||
return d.toISOString().slice(0, 10)
|
||||
}
|
||||
|
||||
/** Start of the plan window: the Monday after `now`. */
|
||||
export function planWeekStart(nowIso: string): string {
|
||||
const { date, weekday } = berlinParts(nowIso)
|
||||
// Monday=0 -> next Monday (7 days); Tuesday=1 -> 6 days; Sunday=6 -> 1 day.
|
||||
const days = weekday === 0 ? 7 : 7 - weekday
|
||||
return addDays(date, days)
|
||||
}
|
||||
|
||||
export function isInWeek(date: string, weekStart: string): boolean {
|
||||
return date >= weekStart && date <= addDays(weekStart, 6)
|
||||
}
|
||||
|
||||
export function parseHour(time: string): number {
|
||||
return Number(time.split(':')[0] ?? 0)
|
||||
}
|
||||
|
||||
export function hhmm(hour: number): string {
|
||||
return `${String(hour).padStart(2, '0')}:00`
|
||||
}
|
||||
|
||||
/** Demo perturbations for the mock fallback; the Go API applies scenarios from ML output. */
|
||||
export function applyScenario(points: Point[], scenario: Scenario): Point[] {
|
||||
if (scenario === 'base') return points
|
||||
return points.map((point) => {
|
||||
const { weekday, hour } = berlinParts(point.t)
|
||||
let factor = 1
|
||||
if (scenario === 'sunny-saturday-market' && weekday === 5) factor = 1.2
|
||||
if (scenario === 'rainy-saturday' && weekday === 5) factor = 0.82
|
||||
if (scenario === 'weekday-event' && weekday === 2 && hour >= 16 && hour < 20) factor = 1.25
|
||||
if (factor === 1) return point
|
||||
const v = Math.round(point.v * factor)
|
||||
return {
|
||||
...point,
|
||||
v,
|
||||
lo: point.lo === undefined ? undefined : Math.round(point.lo * factor),
|
||||
hi: point.hi === undefined ? undefined : Math.round(point.hi * factor),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function requiredStaff(footfall: number, assumptions: StaffingAssumptions): number {
|
||||
const raw = (Math.max(0, footfall) / assumptions.visitors_per_staff_hour) * assumptions.safety_factor
|
||||
return Math.max(Math.ceil(raw), assumptions.min_staff)
|
||||
}
|
||||
|
||||
function shiftBlocks(
|
||||
open: number,
|
||||
close: number,
|
||||
length: number,
|
||||
): Array<{ start: number; end: number }> {
|
||||
const blocks: Array<{ start: number; end: number }> = []
|
||||
let start = open
|
||||
while (start < close) {
|
||||
const end = Math.min(start + Math.max(1, length), close)
|
||||
blocks.push({ start, end })
|
||||
start = end
|
||||
}
|
||||
return blocks
|
||||
}
|
||||
|
||||
export interface BuildStaffingInput {
|
||||
sensor: string
|
||||
scenario: Scenario
|
||||
standard: Standard
|
||||
points: Point[]
|
||||
weekStart: string
|
||||
assumptions?: Partial<Omit<StaffingAssumptions, 'store_hours'>> & {
|
||||
store_hours?: Partial<StaffingAssumptions['store_hours']>
|
||||
}
|
||||
why?: string[]
|
||||
cached?: boolean
|
||||
data_version: string
|
||||
model_version: string
|
||||
context_version: string
|
||||
}
|
||||
|
||||
export interface StaffingBuild {
|
||||
response: StaffingResponse
|
||||
/** Local date -> hours, used by the plan UI. */
|
||||
byDate: Record<string, StaffingHour[]>
|
||||
/** Local date -> shift blocks. */
|
||||
shiftsByDate: Record<string, Shift[]>
|
||||
}
|
||||
|
||||
/** Deterministic staffing heuristic v1, identical to CONTRACT.md section 5. */
|
||||
export function buildStaffing(input: BuildStaffingInput): StaffingBuild {
|
||||
const assumptions: StaffingAssumptions = {
|
||||
...DEFAULT_ASSUMPTIONS,
|
||||
...input.assumptions,
|
||||
store_hours: {
|
||||
...DEFAULT_ASSUMPTIONS.store_hours,
|
||||
...input.assumptions?.store_hours,
|
||||
},
|
||||
}
|
||||
const open = parseHour(assumptions.store_hours.open)
|
||||
const close = parseHour(assumptions.store_hours.close)
|
||||
|
||||
const weekPoints = input.points
|
||||
.map((point) => ({ point, local: berlinParts(point.t) }))
|
||||
.filter(({ local }) => isInWeek(local.date, input.weekStart) && local.hour >= open && local.hour < close)
|
||||
.sort((a, b) => a.point.t.localeCompare(b.point.t))
|
||||
|
||||
const blocks = shiftBlocks(open, close, assumptions.shift_length_h)
|
||||
const byDate: Record<string, StaffingHour[]> = {}
|
||||
const shiftsByDate: Record<string, Shift[]> = {}
|
||||
const shifts: Shift[] = []
|
||||
|
||||
for (const { point, local } of weekPoints) {
|
||||
const required = requiredStaff(point.v, assumptions)
|
||||
const block = blocks.find((b) => local.hour >= b.start && local.hour < b.end)
|
||||
if (!block) continue
|
||||
const blockHours = weekPoints.filter(({ local: l }) => {
|
||||
return l.date === local.date && l.hour >= block.start && l.hour < block.end
|
||||
})
|
||||
const blockStaff = Math.max(...blockHours.map(({ point: p }) => requiredStaff(p.v, assumptions)), required)
|
||||
|
||||
const scheduled = blockStaff
|
||||
const coverage: Coverage = scheduled < required ? 'under' : scheduled > required ? 'over' : 'ok'
|
||||
const hour: StaffingHour = {
|
||||
t: point.t,
|
||||
footfall: Math.round(point.v),
|
||||
required_staff: required,
|
||||
scheduled_staff: scheduled,
|
||||
coverage,
|
||||
}
|
||||
;(byDate[local.date] ??= []).push(hour)
|
||||
}
|
||||
|
||||
for (const date of Object.keys(byDate).sort()) {
|
||||
const dayHours = byDate[date]
|
||||
shiftsByDate[date] = []
|
||||
for (const block of blocks) {
|
||||
const blockHours = dayHours.filter((h) => {
|
||||
const hour = berlinParts(h.t).hour
|
||||
return hour >= block.start && hour < block.end
|
||||
})
|
||||
if (!blockHours.length) continue
|
||||
const staff = Math.max(...blockHours.map((h) => h.scheduled_staff))
|
||||
if (staff <= 0) continue
|
||||
const shift: Shift = {
|
||||
date,
|
||||
start: hhmm(block.start),
|
||||
end: hhmm(block.end),
|
||||
staff,
|
||||
}
|
||||
shifts.push(shift)
|
||||
shiftsByDate[date]!.push(shift)
|
||||
}
|
||||
}
|
||||
|
||||
const hours = Object.values(byDate).flat().sort((a, b) => a.t.localeCompare(b.t))
|
||||
const covered = hours.filter((h) => h.scheduled_staff >= h.required_staff).length
|
||||
const coveragePct = hours.length ? Math.round((covered / hours.length) * 1000) / 10 : 0
|
||||
const cost = hours.reduce((sum, h) => sum + h.scheduled_staff * assumptions.labor_cost_eur_h, 0)
|
||||
// CONTRACT.md §5: the flat schedule applies max(required) to every store
|
||||
// hour. Go uses one global peak, not one peak per day; keep this identical.
|
||||
const peakRequired = hours.reduce((peak, hour) => Math.max(peak, hour.required_staff), 0)
|
||||
const flatCost = peakRequired * hours.length * assumptions.labor_cost_eur_h
|
||||
|
||||
return {
|
||||
response: {
|
||||
sensor: input.sensor,
|
||||
scenario: input.scenario,
|
||||
standard: input.standard,
|
||||
assumptions,
|
||||
hours,
|
||||
shifts,
|
||||
summary: {
|
||||
coverage_pct: coveragePct,
|
||||
cost_eur: cost,
|
||||
flat_schedule_cost_eur: flatCost,
|
||||
overstaffed_hours: hours.filter((h) => h.coverage === 'over').length,
|
||||
understaffed_hours: hours.filter((h) => h.coverage === 'under').length,
|
||||
},
|
||||
why: input.why ?? [],
|
||||
cached: input.cached ?? false,
|
||||
data_version: input.data_version,
|
||||
model_version: input.model_version,
|
||||
context_version: input.context_version,
|
||||
},
|
||||
byDate,
|
||||
shiftsByDate,
|
||||
}
|
||||
}
|
||||
+174
@@ -0,0 +1,174 @@
|
||||
// Canonical wire shapes for the Go API; keep them in sync with the contract.
|
||||
|
||||
export const HORIZONS = ['15m', '1h', '48h', '7d'] as const
|
||||
export type Horizon = (typeof HORIZONS)[number]
|
||||
|
||||
export const SCENARIOS = ['base', 'sunny-saturday-market', 'rainy-saturday', 'weekday-event'] as const
|
||||
export type Scenario = (typeof SCENARIOS)[number]
|
||||
|
||||
export const STANDARDS = ['relaxed', 'standard', 'premium'] as const
|
||||
export type Standard = (typeof STANDARDS)[number]
|
||||
|
||||
export type Coverage = 'under' | 'ok' | 'over'
|
||||
|
||||
export interface Sensor {
|
||||
id: string
|
||||
name: string
|
||||
lat: number
|
||||
lon: number
|
||||
mean: number
|
||||
p95: number
|
||||
battery: number | null
|
||||
}
|
||||
|
||||
export interface Point {
|
||||
t: string
|
||||
v: number
|
||||
lo?: number
|
||||
hi?: number
|
||||
}
|
||||
|
||||
export interface SeriesResponse {
|
||||
sensor: string
|
||||
step: '15m' | '1h'
|
||||
points: Array<Pick<Point, 't' | 'v'>>
|
||||
}
|
||||
|
||||
export interface ForecastResponse {
|
||||
sensor: string
|
||||
horizon: Horizon
|
||||
scenario: Scenario
|
||||
points: Point[]
|
||||
cached: boolean
|
||||
data_version: string
|
||||
model_version: string
|
||||
context_version: string
|
||||
}
|
||||
|
||||
export interface WeatherPoint {
|
||||
t: string
|
||||
temp_c: number
|
||||
precip_mm: number
|
||||
cloud_pct: number
|
||||
wind_kmh: number
|
||||
humidity_pct: number
|
||||
}
|
||||
|
||||
export interface Holiday {
|
||||
date: string
|
||||
name: string
|
||||
}
|
||||
|
||||
export interface ContextResponse {
|
||||
weather: {
|
||||
now: WeatherPoint
|
||||
forecast: WeatherPoint[]
|
||||
}
|
||||
holidays: Holiday[]
|
||||
updated_at: string
|
||||
cached: boolean
|
||||
}
|
||||
|
||||
export interface MetaResponse {
|
||||
data_version: string
|
||||
model_version: string
|
||||
context_version: string
|
||||
coverage: {
|
||||
sensors: number
|
||||
from: string
|
||||
to: string
|
||||
cadence_min: number
|
||||
}
|
||||
metrics: {
|
||||
model: string
|
||||
mae: number
|
||||
wape: number
|
||||
r2: number
|
||||
baseline_mae: number
|
||||
baseline_wape: number
|
||||
}
|
||||
limits: string[]
|
||||
}
|
||||
|
||||
export interface StaffingAssumptions {
|
||||
visitors_per_staff_hour: number
|
||||
safety_factor: number
|
||||
min_staff: number
|
||||
shift_length_h: number
|
||||
labor_cost_eur_h: number
|
||||
store_hours: {
|
||||
open: string
|
||||
close: string
|
||||
tz: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface StaffingHour {
|
||||
t: string
|
||||
footfall: number
|
||||
required_staff: number
|
||||
scheduled_staff: number
|
||||
coverage: Coverage
|
||||
}
|
||||
|
||||
export interface Shift {
|
||||
date: string
|
||||
start: string
|
||||
end: string
|
||||
staff: number
|
||||
}
|
||||
|
||||
export interface StaffingSummary {
|
||||
coverage_pct: number
|
||||
cost_eur: number
|
||||
flat_schedule_cost_eur: number
|
||||
overstaffed_hours: number
|
||||
understaffed_hours: number
|
||||
}
|
||||
|
||||
export interface StaffingResponse {
|
||||
sensor: string
|
||||
scenario: Scenario
|
||||
standard: Standard
|
||||
assumptions: StaffingAssumptions
|
||||
hours: StaffingHour[]
|
||||
shifts: Shift[]
|
||||
summary: StaffingSummary
|
||||
why: string[]
|
||||
cached: boolean
|
||||
data_version: string
|
||||
model_version: string
|
||||
context_version: string
|
||||
}
|
||||
|
||||
export interface ScenarioDefinition {
|
||||
scenario: Scenario
|
||||
weather?: {
|
||||
temp_delta_c?: number
|
||||
precip_mm?: number
|
||||
}
|
||||
event?: {
|
||||
type: string
|
||||
uplift: number
|
||||
}
|
||||
}
|
||||
|
||||
export interface ScenarioState {
|
||||
version: number
|
||||
scenario: ScenarioDefinition
|
||||
at: string
|
||||
}
|
||||
|
||||
export interface ScenarioPreset extends ScenarioDefinition {
|
||||
id: Scenario
|
||||
label: string
|
||||
short: string
|
||||
description: string
|
||||
}
|
||||
|
||||
export interface DemoClock {
|
||||
now: string
|
||||
plan_start: string
|
||||
plan_end: string
|
||||
timezone: string
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { berlinParts, buildStaffing } from '../shared/staffing'
|
||||
import type { StaffingResponse } from '../shared/types'
|
||||
|
||||
// Captured from the real Go API:
|
||||
// curl 'http://localhost:8080/api/staffing?sensor=hn-stadtgalerie-01&scenario=base&standard=standard'
|
||||
// with api-go.git/main/testdata/data as DATA_DIR.
|
||||
const fixture = JSON.parse(
|
||||
readFileSync(new URL('./fixtures/go-staffing.json', import.meta.url), 'utf8'),
|
||||
) as StaffingResponse
|
||||
|
||||
describe('Go /api/staffing parity', () => {
|
||||
it('rebuilds the API plan from its own hourly forecast', () => {
|
||||
const firstHour = fixture.hours[0]
|
||||
expect(firstHour).toBeDefined()
|
||||
|
||||
const build = buildStaffing({
|
||||
sensor: fixture.sensor,
|
||||
scenario: fixture.scenario,
|
||||
standard: fixture.standard,
|
||||
points: fixture.hours.map((hour) => ({ t: hour.t, v: hour.footfall })),
|
||||
weekStart: berlinParts(firstHour!.t).date,
|
||||
data_version: fixture.data_version,
|
||||
model_version: fixture.model_version,
|
||||
context_version: fixture.context_version,
|
||||
})
|
||||
|
||||
expect(build.response.assumptions).toEqual(fixture.assumptions)
|
||||
expect(build.response.summary).toEqual(fixture.summary)
|
||||
expect(build.response.shifts).toEqual(fixture.shifts)
|
||||
|
||||
// The API returns float footfall; the local display type rounds it. Every
|
||||
// decision field must still be identical.
|
||||
const decision = (hours: StaffingResponse['hours']) =>
|
||||
hours.map(({ footfall: _footfall, ...rest }) => rest)
|
||||
expect(decision(build.response.hours)).toEqual(decision(fixture.hours))
|
||||
})
|
||||
})
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"sensor":"hn-stadtgalerie-01","scenario":"base","standard":"standard","assumptions":{"visitors_per_staff_hour":25,"safety_factor":1.15,"min_staff":1,"shift_length_h":4,"labor_cost_eur_h":16,"store_hours":{"open":"10:00","close":"20:00","tz":"Europe/Berlin"}},"hours":[{"t":"2026-11-16T09:00:00Z","footfall":30.2,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-16T10:00:00Z","footfall":30.4,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-16T11:00:00Z","footfall":30.6,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-16T12:00:00Z","footfall":28.4,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-16T13:00:00Z","footfall":23.1,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-16T14:00:00Z","footfall":24.2,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-16T15:00:00Z","footfall":25.7,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-16T16:00:00Z","footfall":26.3,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-16T17:00:00Z","footfall":28.3,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-16T18:00:00Z","footfall":26.4,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-17T09:00:00Z","footfall":30.5,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-17T10:00:00Z","footfall":28.7,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-17T11:00:00Z","footfall":30.4,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-17T12:00:00Z","footfall":29.3,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-17T13:00:00Z","footfall":23.1,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-17T14:00:00Z","footfall":25,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-17T15:00:00Z","footfall":23,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-17T16:00:00Z","footfall":25.7,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-17T17:00:00Z","footfall":28.5,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-17T18:00:00Z","footfall":25.7,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-18T09:00:00Z","footfall":31,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-18T10:00:00Z","footfall":28.1,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-18T11:00:00Z","footfall":30.8,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-18T12:00:00Z","footfall":30.6,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-18T13:00:00Z","footfall":22.2,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-18T14:00:00Z","footfall":24.7,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-18T15:00:00Z","footfall":25.4,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-18T16:00:00Z","footfall":26.5,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-18T17:00:00Z","footfall":29.1,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-18T18:00:00Z","footfall":29.5,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-19T09:00:00Z","footfall":29.3,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-19T10:00:00Z","footfall":31.2,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-19T11:00:00Z","footfall":27.7,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-19T12:00:00Z","footfall":28.4,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-19T13:00:00Z","footfall":24.7,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-19T14:00:00Z","footfall":22.5,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-19T15:00:00Z","footfall":22.8,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-19T16:00:00Z","footfall":25.7,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-19T17:00:00Z","footfall":29.2,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-19T18:00:00Z","footfall":26.9,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-20T09:00:00Z","footfall":28,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-20T10:00:00Z","footfall":29.7,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-20T11:00:00Z","footfall":28.2,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-20T12:00:00Z","footfall":28.7,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-20T13:00:00Z","footfall":25.5,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-20T14:00:00Z","footfall":23.4,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-20T15:00:00Z","footfall":25.4,"required_staff":2,"scheduled_staff":2,"coverage":"ok"},{"t":"2026-11-20T16:00:00Z","footfall"Line truncated
|
||||
@@ -0,0 +1,96 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import {
|
||||
liveAge,
|
||||
liveStatus,
|
||||
parseScenarioEvent,
|
||||
scenarioChanged,
|
||||
scenarioLabel,
|
||||
SSE_FAILURES_BEFORE_POLLING,
|
||||
} from '../shared/live'
|
||||
import type { ScenarioState } from '../shared/types'
|
||||
|
||||
const state = (version: number, scenario: ScenarioState['scenario']['scenario'] = 'base'): ScenarioState => ({
|
||||
version,
|
||||
scenario: { scenario },
|
||||
at: '2026-11-14T09:12:00Z',
|
||||
})
|
||||
|
||||
describe('parseScenarioEvent', () => {
|
||||
it('accepts the Go /api/stream scenario shape', () => {
|
||||
expect(parseScenarioEvent(JSON.stringify(state(7, 'rainy-saturday')))).toEqual(
|
||||
state(7, 'rainy-saturday'),
|
||||
)
|
||||
})
|
||||
|
||||
it('rejects malformed JSON, missing versions and unknown scenarios', () => {
|
||||
expect(parseScenarioEvent('{')).toBeNull()
|
||||
expect(parseScenarioEvent(JSON.stringify({ scenario: { scenario: 'base' }, at: 'x' }))).toBeNull()
|
||||
expect(
|
||||
parseScenarioEvent(JSON.stringify({ version: 1, at: 'x', scenario: { scenario: 'party' } })),
|
||||
).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
describe('scenarioChanged', () => {
|
||||
it('refreshes on a new version or a new scenario id', () => {
|
||||
expect(scenarioChanged(null, state(1))).toBe(true)
|
||||
expect(scenarioChanged(state(1), state(1))).toBe(false)
|
||||
expect(scenarioChanged(state(1), state(2))).toBe(true)
|
||||
expect(scenarioChanged(state(1, 'base'), state(1, 'rainy-saturday'))).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
describe('liveStatus', () => {
|
||||
const base = {
|
||||
online: true,
|
||||
sseOpen: false,
|
||||
sseFailures: 0,
|
||||
polling: false,
|
||||
pollFailures: 0,
|
||||
}
|
||||
|
||||
it('shows connecting before the first event and live once SSE opens', () => {
|
||||
expect(liveStatus(base)).toBe('connecting')
|
||||
expect(liveStatus({ ...base, sseOpen: true })).toBe('live')
|
||||
})
|
||||
|
||||
it('switches to polling after repeated SSE failures', () => {
|
||||
expect(
|
||||
liveStatus({
|
||||
...base,
|
||||
sseFailures: SSE_FAILURES_BEFORE_POLLING,
|
||||
polling: true,
|
||||
}),
|
||||
).toBe('polling')
|
||||
})
|
||||
|
||||
it('reports offline when the browser or both transports are down', () => {
|
||||
expect(liveStatus({ ...base, online: false, sseOpen: true })).toBe('offline')
|
||||
expect(
|
||||
liveStatus({
|
||||
...base,
|
||||
sseFailures: SSE_FAILURES_BEFORE_POLLING,
|
||||
polling: true,
|
||||
pollFailures: 1,
|
||||
}),
|
||||
).toBe('offline')
|
||||
})
|
||||
})
|
||||
|
||||
describe('scenarioLabel and liveAge', () => {
|
||||
it('labels every contract enum', () => {
|
||||
expect(scenarioLabel('sunny-saturday-market')).toBe('Sunny Saturday + market')
|
||||
expect(scenarioLabel('rainy-saturday')).toBe('Rainy Saturday')
|
||||
expect(scenarioLabel('weekday-event')).toBe('Wednesday evening event')
|
||||
expect(scenarioLabel('base')).toBe('Base week')
|
||||
expect(scenarioLabel('unknown')).toBe('Base week')
|
||||
})
|
||||
|
||||
it('renders a short age without a date library', () => {
|
||||
const now = Date.parse('2026-11-14T09:12:10Z')
|
||||
expect(liveAge('', now)).toBe('no event yet')
|
||||
expect(liveAge('2026-11-14T09:12:08Z', now)).toBe('just now')
|
||||
expect(liveAge('2026-11-14T09:11:40Z', now)).toBe('30s ago')
|
||||
expect(liveAge('2026-11-14T09:07:10Z', now)).toBe('5 min ago')
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,105 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { buildStaffing, planWeekStart, applyScenario } from '../shared/staffing'
|
||||
import type { Point } from '../shared/types'
|
||||
|
||||
const now = '2026-11-14T08:12:00Z'
|
||||
|
||||
function mondayPoints(value = 100): Point[] {
|
||||
return Array.from({ length: 24 }, (_, hour) => ({
|
||||
t: new Date(Date.UTC(2026, 10, 15, 23 + hour)).toISOString().replace('.000Z', 'Z'),
|
||||
v: value,
|
||||
}))
|
||||
}
|
||||
|
||||
describe('planWeekStart', () => {
|
||||
it('returns the Monday after the demo Saturday', () => {
|
||||
expect(planWeekStart(now)).toBe('2026-11-16')
|
||||
})
|
||||
})
|
||||
|
||||
describe('buildStaffing', () => {
|
||||
it('applies the contract heuristic to a flat 10:00-20:00 day', () => {
|
||||
const build = buildStaffing({
|
||||
sensor: 'hn-stadtgalerie-01',
|
||||
scenario: 'base',
|
||||
standard: 'standard',
|
||||
points: mondayPoints(100),
|
||||
weekStart: '2026-11-16',
|
||||
data_version: 'data',
|
||||
model_version: 'model',
|
||||
context_version: 'context',
|
||||
})
|
||||
|
||||
expect(build.byDate['2026-11-16']).toHaveLength(10)
|
||||
expect(build.response.shifts).toEqual([
|
||||
{ date: '2026-11-16', start: '10:00', end: '14:00', staff: 5 },
|
||||
{ date: '2026-11-16', start: '14:00', end: '18:00', staff: 5 },
|
||||
{ date: '2026-11-16', start: '18:00', end: '20:00', staff: 5 },
|
||||
])
|
||||
expect(build.response.summary.coverage_pct).toBe(100)
|
||||
expect(build.response.summary.cost_eur).toBe(800)
|
||||
expect(build.response.summary.flat_schedule_cost_eur).toBe(800)
|
||||
expect(build.response.summary.understaffed_hours).toBe(0)
|
||||
})
|
||||
|
||||
it('uses the block peak so low hours become overstaffed, not understaffed', () => {
|
||||
const points = mondayPoints(60).map((point, index) =>
|
||||
index === 11 ? { ...point, v: 200 } : point,
|
||||
)
|
||||
const build = buildStaffing({
|
||||
sensor: 'hn-stadtgalerie-01',
|
||||
scenario: 'base',
|
||||
standard: 'standard',
|
||||
points,
|
||||
weekStart: '2026-11-16',
|
||||
data_version: 'data',
|
||||
model_version: 'model',
|
||||
context_version: 'context',
|
||||
})
|
||||
const firstHour = build.byDate['2026-11-16']?.[0]
|
||||
expect(firstHour?.required_staff).toBe(3)
|
||||
expect(firstHour?.scheduled_staff).toBe(10)
|
||||
expect(build.response.summary.overstaffed_hours).toBeGreaterThan(0)
|
||||
expect(build.response.summary.understaffed_hours).toBe(0)
|
||||
})
|
||||
|
||||
it('compares the flat schedule against the global peak, matching the Go API', () => {
|
||||
// Monday needs 5, Tuesday needs 10. CONTRACT §5 applies max(required) to
|
||||
// every hour: 10 * 20 h * €16 = €3200, not a per-day peak sum.
|
||||
const points = [
|
||||
...mondayPoints(100).map((point, index) => ({
|
||||
...point,
|
||||
t: new Date(Date.UTC(2026, 10, 15, 23 + index)).toISOString().replace('.000Z', 'Z'),
|
||||
})),
|
||||
...mondayPoints(200).map((point, index) => ({
|
||||
...point,
|
||||
t: new Date(Date.UTC(2026, 10, 16, 23 + index)).toISOString().replace('.000Z', 'Z'),
|
||||
})),
|
||||
]
|
||||
const build = buildStaffing({
|
||||
sensor: 'hn-stadtgalerie-01',
|
||||
scenario: 'base',
|
||||
standard: 'standard',
|
||||
points,
|
||||
weekStart: '2026-11-16',
|
||||
data_version: 'data',
|
||||
model_version: 'model',
|
||||
context_version: 'context',
|
||||
})
|
||||
|
||||
expect(build.response.summary.flat_schedule_cost_eur).toBe(3200)
|
||||
expect(build.response.summary.cost_eur).toBe(2400)
|
||||
})
|
||||
})
|
||||
|
||||
describe('applyScenario', () => {
|
||||
const saturday: Point = { t: '2026-11-21T12:00:00Z', v: 100, lo: 80, hi: 120 }
|
||||
|
||||
it('raises Saturday for the sunny market scenario', () => {
|
||||
expect(applyScenario([saturday], 'sunny-saturday-market')[0]?.v).toBe(120)
|
||||
})
|
||||
|
||||
it('lowers Saturday for the rainy scenario', () => {
|
||||
expect(applyScenario([saturday], 'rainy-saturday')[0]?.v).toBe(82)
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "./.nuxt/tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"resolveJsonModule": true
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user