The statistics routes compute aggregated people-count metrics directly from theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/AngelAmoSanchez/TFG-RaspberryPi-BLE/llms.txt
Use this file to discover all available pages before exploring further.
detections table. All calculations use the StatisticsService, which estimates the number of people present by dividing unique BLE device counts by the DEVICES_PER_PERSON ratio (default 1.5, configurable via the DEVICES_PER_PERSON environment variable). Times are handled in the Europe/Madrid timezone unless an explicit ISO timestamp with offset is provided. All endpoints are mounted under /api/v1/statistics.
GET /api/v1/statistics/realtime
Return aggregated statistics for the most recent N minutes. This is the endpoint used by the dashboard for live occupancy display. Query parametersWidth of the time window in minutes. Must be between
1 and 10080 (7 days).Restrict results to detections recorded by a specific Raspberry Pi node. Omit to aggregate across all devices.
ISO 8601 server time when the query was executed.
The
minutes value that was applied.Per-zone breakdown. Keys are zone names (
near, medium, far). Only zones with at least one detection in the window appear.Totals across all zones.
GET /api/v1/statistics/range
Return aggregated statistics for an arbitrary time window defined by explicit start and end timestamps. Useful for historical analysis or exporting a specific period. Query parametersStart of the time range in ISO 8601 format, e.g.
2026-04-23T10:00:00. A timezone offset (+02:00 or Z) is accepted and recommended; if omitted the server treats the value as Europe/Madrid local time.End of the time range in ISO 8601 format. Must be later than
start_time; otherwise the server returns HTTP 400.Restrict results to a specific Raspberry Pi node.
/realtime — a top-level timestamp, start_time, end_time, by_zone map, and total summary.
GET /api/v1/statistics/hourly
Return per-hour, per-zone statistics for a single calendar day. Results are grouped by truncated hour and ordered chronologically. Query parametersTarget date in ISO 8601 date format, e.g.
2026-05-15. If omitted, the current date in the Europe/Madrid timezone is used.The date that was queried, in
YYYY-MM-DD format.Array of per-hour, per-zone stat objects. Each element covers one (hour, zone) combination.
GET /api/v1/statistics/daily
Return per-day, per-zone statistics for a date range. When neitherstart_date nor end_date is provided, the endpoint defaults to the last days days ending today.
Query parameters
Start date in ISO 8601 format, e.g.
2026-05-01. When omitted, computed as end_date - days.End date in ISO 8601 format. When omitted, defaults to today in the Europe/Madrid timezone.
Number of days to look back when
start_date is not supplied.Effective start date in
YYYY-MM-DD format.Effective end date in
YYYY-MM-DD format.Array of per-day, per-zone stat objects. Each element has the same shape as the hourly statistics array element, but with
period_type set to "day" and period_start truncated to midnight.GET /api/v1/statistics/distribution
Return the share of total detections that each proximity zone accounts for over the last N hours. Useful for visualising how foot traffic distributes across near, medium, and far ranges. Query parametersNumber of hours to look back from the current time.
ISO 8601 start of the analysis window.
ISO 8601 end of the analysis window.
Total detection records across all zones in the window.
Per-zone counts and percentages. Keys are zone names (
near, medium, far).