Files
web-nuxt/app/pages/about.vue
T
Noel Sabia 66b80a62fb
ci / check (push) Successful in 1m20s
ci / check (pull_request) Successful in 51s
docs: tighten README quick start and stale comments
- Lead with purpose and exact local/CI commands.
- Remove local absolute paths, stale auth notes and unverified claims.
- Keep comments to the reason or invariant they protect.
2026-11-14 09:16:19 +01:00

153 lines
7.5 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<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>