Skip to main content

Time-on-site / job-site report

GET 

/api/v1/reports/time-on-site

Time on each job-site geofence per device per workspace-tz day.

Derived from GeofenceEvent entry/exit pairing (event_type "entry"/"exit", NOT "enter"). Each entry pairs with the NEXT exit per (device, geofence). A re-entry with no exit between reads as a missed exit: it ends the open visit and starts a new one, as /reports/detention pairs them. An entry still open at range end clamps its exit to range_end (open interval, not dropped) while its device keeps reporting; once the device goes quiet for longer than settings.DETENTION_STALE_CONTACT_HOURS the visit stops at its last observation (DeviceSession.last_contact_at), and one last observed before start adds nothing, exactly as /reports/detention places such a stop. SignalEvent signal_type="dwell" enriches the totals where entry/exit pairing is incomplete.

Precedence: entry/exit-derived seconds are PRIMARY. A dwell signal supplements a (device, geofence, day) bucket only when no entry/exit pairing produced a visit there (so a workflow-only dwell still surfaces job-site time).

A closed entry/exit pair shorter than MIN_VISIT_SECONDS is a drive-by and adds neither seconds nor a visit.

visit_count counts visits that STARTED on the row's local day, so a row for a continuation day carries seconds with a zero count; is_continuation flags those rows so nothing can render "a full day on site, zero visits". For per-visit arrival/departure timestamps and billable overage, use /reports/detention.

Request​

Responses​

OK