5697137c52
The "permit/lejet" feature is really a subscription. Full rename of the mutable master data, plus a recurring monthly price. - DB (migration 0004, data-preserving ALTER RENAME): permits→subscriptions, permit_credentials/_plates→subscription_*, sessions.permit_id→subscription_id. - Pricing: per-subscription priceMinor + period(monthly) + currency, with a site default (site_config.subscription_monthly_price_minor) pre-filling the form. - Server: subscription-flow.ts (SubscriptionFlow), routes/subscriptions.ts (/api/subscriptions). Web: SubscriptionManager, route, i18n (sq Abonimet/en). - The signed ledger `permitId` payload is intentionally kept — immutable hash-chained history; renaming it would break verification of past events. Deferred (wiki notes): fee collection into the ledger/shift (a shift-attributed payment), LPR/ANPR plate source, time-of-day access windows (overnight subscriber). Also carries the device-footer UI surface (api DeviceStatus, router mount, i18n devices) due to shared-file overlap with the preceding footer commit. Verified end-to-end on a fresh DB and migration on a live-DB copy (sessions preserved). Live DB migrated. Full monorepo builds clean. Claude-Session: https://claude.ai/code/session_01Xcm6ikLgGoCxxHrxtjkk5V
49 lines
2.3 KiB
Markdown
49 lines
2.3 KiB
Markdown
---
|
|
type: concept
|
|
tags: [parking, domain, business, reporting]
|
|
sources: []
|
|
updated: 2026-06-15
|
|
status: open
|
|
---
|
|
|
|
# Reporting & Analytics
|
|
|
|
Turning the signed event log into the numbers an owner runs the business on. All reports are
|
|
**projections over the [[append-only-event-chain]]** — the chain is the single source, reports are
|
|
derived and rebuildable, never a separate ledger.
|
|
|
|
## Reports (driven by the events already designed)
|
|
|
|
- **Revenue** — by day/week/shift, by tender (cash vs. card), gross vs. discounts vs. net. Source:
|
|
`payment` events + [[validation-discounts|discount]] events + `shift_z_report` ([[shift]]).
|
|
- **Occupancy** — current ([[capacity-occupancy]]) and historical curve; peak times; turnover.
|
|
- **Stay analytics** — average/median duration, distribution; transient vs. [[subscription]] split.
|
|
- **Permit usage** — active permits, utilisation, concurrency vs. `maxConcurrent`.
|
|
- **Anomalies** — out-of-band opens, never-exited sessions, occupancy drift, over-validation —
|
|
the `anomaly` events + reconciliation findings ([[reconciliation]]).
|
|
|
|
## Plate / entry search (admin lookup) — user-requested 2026-06-15
|
|
|
|
The admin can **search for an entry/session by licence plate** — *if the plate was captured* (by
|
|
the [[opencv-anpr-service|vision service]] or an LPR read; a pure-ticket transient has no plate).
|
|
Returns the matching session(s): entry/exit times, fee, payment, snapshot image. Useful for
|
|
disputes ("I was charged for a car that left earlier"), lost-ticket lookup, and incident review.
|
|
|
|
- Search keys: plate (when captured), ticket id, session id, time range.
|
|
- Read-only over the chain; surfaces the linked snapshot ([[lpr-camera]] `imageRef`) as evidence.
|
|
- Honest limit: **no plate → no plate-search hit.** The UI must say "not captured", not "no such
|
|
car", so the absence isn't mistaken for a missing record.
|
|
|
|
## Properties
|
|
|
|
- **Offline** ([[offline-first]]): all computed locally from the local DB; no cloud BI dependency.
|
|
- **Reproducible**: a report run twice over the same chain gives the same answer; figures trace to
|
|
signed events.
|
|
- **Export** for [[reconciliation]] / accounting (CSV/PDF) — the periodic external-authority path
|
|
([[open-questions]] #4).
|
|
|
|
## Open
|
|
|
|
- Which reports matter at launch vs. later; the export format/cadence.
|
|
- Dashboard (live) vs. on-demand reports.
|