# MileMath data handling

MileMath by Cendariq is designed for local route calculations without an account. Original manifests and OCR text remain on the device during processing and are not sent to the application server.

## Photos, camera, and recognition

The app offers separate controls to choose photos/screenshots and take a photo. The camera control asks the browser to open its camera flow only after the user taps it. Camera permission is optional: if the user denies it or the browser cannot provide a camera, photo selection and manual entry remain available.

Selected images are decoded in the browser, using image orientation metadata where supported. The user can rotate, crop, or cover a region before recognition. OCR runs locally using the same-origin Tesseract.js worker, WebAssembly core, and English model. The app does not post photos to an API or cloud OCR service.

A recognition pass may report a low-resolution or low-contrast warning. Offered pay, stops, windows, and mileage are editable; unreadable or conflicting values remain blank or marked for review. The user must confirm the payout and route review before calculating. Possible duplicate addresses remain in the stop list with a review warning because they may represent separate visits. If recognition fails, the user can reshoot or enter the route manually.

The selected file references, temporary canvas pixels, object URLs, OCR worker, and temporary image blob are released after processing. Images, canvas data, and OCR text are never written to route history, PostgreSQL, analytics, or logs.

## Local route storage

The optional one-time unlock adds saved confirmed routes, comparisons, and JSON export. Saved route JSON, the pending checkout session reference, and the verified local unlock record are stored in this browser's IndexedDB. Route JSON includes the confirmed offer, route miles, time, expenses, stops, and schema/calculation versions; it excludes image data and raw OCR text. Use **Clear saved routes** in the app to delete the local route history. Clearing saved routes does not revoke the purchase reference held for entitlement verification.

## Server-side records

- Beta signup: platform (`ios` or `android`), email address, and signup timestamp.
- Usage aggregation: one allowlisted event name, event count, summed elapsed milliseconds, and date. The usage endpoint rejects route fields, image data, OCR text, and other properties.
- Purchase verification: the checkout session reference, fixed product key, pending/verified status, optional verified customer email, and timestamps. No saved route content is stored in PostgreSQL.
- The browser temporarily keeps a pending checkout session reference until verification completes, and stores a local verified-unlock record for the optional device-only features. These values contain no route details. Clearing browser site data removes them; the server purchase record remains the verification source.
- Ordinary page analytics may record page path, hashed IP, user agent, referrer, and UTM metadata. These events do not include image bytes or route fields.
