# Supervisor Platform — Privacy & Data Retention Policy

**Reference Version:** 1.0 (Audit & Launch Ready)  
**Applicability:** Supervisor Field Mobile Application & Supervisor Web Admin Portal  
**Jurisdiction Compliance:** Privacy Act 1988 (Cth), Australian Privacy Principles (APPs)

---

## 1. Sensor & Telemetry Data Scope

The Supervisor mobile application collects device sensor data **strictly during active shift sessions** for workforce attendance verification, facility security, and bio-containment compliance:

1. **High-Accuracy GPS Location:**
   - **Check-In & Check-Out:** Point-in-time GPS fix (lat, lng, accuracy, mocked state) to verify employee presence within the authorized facility zone perimeter (50m default radius).
   - **Background Geofencing:** System-level Enter/Exit zone notifications via OS geofencing (`Location.startGeofencingAsync`) strictly while shift is `in_progress`.
   - **No Off-Shift Tracking:** GPS location sampling immediately terminates upon shift check-out.

2. **Foreground Accelerometer & Step Sampling:**
   - Motion variance and step delta calculations computed locally on device at 10Hz and rolled up into 60-second audit windows.
   - Used solely to demonstrate active movement during cleanroom disinfection.

3. **Hardware Diagnostics:**
   - Battery level and operating system app state (`foreground` vs `background`) sampled per window to diagnose hardware failures or unintentional backgrounding.

---

## 2. Surveillance-Visibility Boundary (Employee UX)

- **Worker Dignity & Clean Interface:** Live motion variance scores, raw step counts, and battery discharge percentages are classified as internal compliance audit telemetry. They are **not** rendered as surveillance gauges on the employee's active shift screen.
- **Employee-Facing Display:** Employees see a clear elapsed wall-clock timer, facility zone details, and a verified protection status badge.

---

## 3. Data Retention & Automated Purge Policy (Sec §7.2)

To avoid indefinite accumulation of high-frequency sensor records and minimize data liability, the platform enforces an automated 90-day data retention lifecycle:

| Data Category | Table | Retention Window | Purge Mechanism |
|:---|:---|:---:|:---|
| Raw Inbound Event Queue Logs | `event_log` | **90 Days** | Nightly CLI Cron (`cron/purge_old_data.php`) |
| 60-Second Sensor Samples | `sensor_samples` | **90 Days** | Nightly CLI Cron (`cron/purge_old_data.php`) |
| Device Bearer Auth Tokens | `api_tokens` | **90 Days (or on deactivation)** | Automatic expiry + deactivation cascade |
| Shift Summaries & Incident Flags | `shifts`, `flags` | **Permanent / 7 Years** | Preserved for payroll & regulatory audit |

---

## 4. Hardware Binding & Token Invalidation (AP-42)

- Each employee profile binds to exactly one physical hardware device (`bound_device_id`).
- When a supervisor deactivates an employee profile in the Admin Portal, all active bearer tokens in `api_tokens` are immediately deleted server-side in the same atomic transaction, ensuring immediate fail-closed protection.
