{"v":"<p dir=\"auto\">Replace OptimoRoute for the field supervisors with our own system, so routing, visits and GPS tracking stay inside the same PHI perimeter as the client data. At the 10 Sep meeting the agency ranked route optimization <strong>above EVV replacement<\/strong>.<\/p>\n<p dir=\"auto\"><strong>Full plan:<\/strong> <code>docs\/processed\/RoutePlan.md<\/code> (written 2026-08-05, revised 2026-10-21). This issue now tracks the work, and the document is kept for its reasoning.<\/p>\n<h2 id=\"user-content-change-from-the-original-plan-native-apps\" dir=\"auto\">Change from the original plan: native apps<\/h2>\n<p dir=\"auto\">The field app is <strong>native iOS (Swift\/SwiftUI) and native Android (Kotlin\/Jetpack Compose)<\/strong>, not Flutter. The Flutter app (<code>apiapp\/<\/code>) was discontinued on 2026-10-01. There is no field app today, so this feature is the first one the native apps will have. Plan \u00a79 is rewritten for this:<\/p>\n<ul dir=\"auto\">\n<li><strong>One server contract, two apps.<\/strong> The request\/response JSON and the list of terminal and retryable error codes go in <code>scripts\/fixtures\/routes\/<\/code>. The PHP and both apps test against these files.<\/li>\n<li><strong>Platform location APIs, no commercial SDK.<\/strong> iOS uses Core Location with background updates. Android uses a foreground service of type <code>location<\/code>.<\/li>\n<li><strong>Maps use MapLibre Native on our own tiles<\/strong>, not MapKit, the Google Maps SDK or Mapbox. Those fetch tiles with the viewport, which would mean a BAA. Android&#39;s fused location (Google Play services) is a decision to make after measuring, not the default.<\/li>\n<li><strong>The offline outbox design is rebuilt natively.<\/strong> It keeps the old rules: retryable vs terminal errors, drain on reconnect, resume or &#34;Sync now&#34;, and a 401 keeps the outbox. iOS needs a specific file-protection choice so pings can be written while the phone is locked.<\/li>\n<li><strong>The paperwork stays in Forms V2.<\/strong> When a stop is on site, the app opens the V2 visit (<code>\/visit-v2<\/code>) in an in-app browser. The apps do not re-implement the forms.<\/li>\n<\/ul>\n<h2 id=\"user-content-shape\" dir=\"auto\">Shape<\/h2>\n<ul dir=\"auto\">\n<li><strong>Self-hosted geo stack.<\/strong> We already run Nominatim and the tile server. OSRM (travel times) and VROOM (the optimizer) are new. The optimizer receives integer ids and coordinates, nothing else.<\/li>\n<li><strong>New tables:<\/strong> <code>hh_staff_profile<\/code>, <code>hh_route<\/code>, <code>hh_visit<\/code> (+ <code>hh_visit_event<\/code>), <code>hh_shift<\/code>, <code>hh_location_ping<\/code>, <code>hh_tracking_consent<\/code>. All coordinates are <code>*_enc<\/code>.<\/li>\n<li><strong>Tracking only while on duty.<\/strong> Before tracking starts: tracking notice accepted, OS Always permission granted, and a shift open. Off duty there is no location access at all. Breadcrumbs are kept 90 days.<\/li>\n<li><strong>Dispatcher board <code>\/routes<\/code><\/strong> with a live map. Supervisors see only their own route and trail, never a colleague&#39;s.<\/li>\n<\/ul>\n<h2 id=\"user-content-gaps-against-optimoroute-added-2026-10-21-plan-8-10-3\" dir=\"auto\">Gaps against OptimoRoute, added 2026-10-21 (plan \u00a78, \u00a710.3)<\/h2>\n<p dir=\"auto\">Compared with <a href=\"https:\/\/optimoroute.com\/features\/\" rel=\"nofollow\">OptimoRoute&#39;s feature list<\/a>, the first draft lacked six features that matter for home visits:<\/p>\n<ul dir=\"auto\">\n<li><strong>Multi-week planning.<\/strong> OptimoRoute plans up to 5 weeks ahead. Each supervisor-day becomes one optimizer vehicle, so VROOM picks the <strong>day<\/strong> as well as the order. The default horizon is 2 weeks. Visits are tentative until the office confirms them with the client; a confirmed visit is pinned and never moved by a re-plan.<\/li>\n<li><strong>Workload balancing.<\/strong> Option on &#34;Build routes&#34;: spread visits evenly (the default) or use as few supervisors as needed. VROOM has no balancing objective of its own; we enforce it with per-supervisor caps or a fixed cost per vehicle.<\/li>\n<li><strong>Lunch breaks.<\/strong> A break window plus a length on the staff profile. The break shows in the stop list so the ETAs after it are honest.<\/li>\n<li><strong>Flexible start time.<\/strong> An earliest\/latest start and a shift length instead of a fixed 8:00. Whether VROOM can cap a whole shift directly needs checking.<\/li>\n<li><strong>Two-person visits.<\/strong> Built only if the customer has them (question 13).<\/li>\n<li><strong>Planned vs. actual route.<\/strong> When a shift closes, its trail is matched to roads (OSRM <code>\/match<\/code>). Actual miles, drive time, stops visited out of order and time off route are stored beside the plan and kept after the breadcrumbs are purged. A trail can be replayed over the plan while the breadcrumbs are kept.<\/li>\n<\/ul>\n<p dir=\"auto\">Messages to clients (ETA texts, tracking link, feedback survey) are a <strong>customer question<\/strong> (10), not planned yet. Out of scope because they don&#39;t apply to home visits: truck routing, depots, pickup\/delivery, long-haul routes, barcodes. Photo proof, Microsoft SSO and a public API stay outside this issue.<\/p>\n<h2 id=\"user-content-phases\" dir=\"auto\">Phases<\/h2>\n<ol start=\"0\" dir=\"auto\">\n<li>Geo foundation: tile server, OSRM + VROOM. Client geocoding is <strong>done<\/strong> (2026-10-20).<\/li>\n<li>Visit entity + <code>\/routes<\/code> board with manual ordering of stops.<\/li>\n<li>Optimizer, with breaks, flexible start and workload balancing.\n2b. Multi-week planning: tentative\/confirmed visits, pinning on re-plan.<\/li>\n<li><strong>Native apps:<\/strong> scaffolding (sign-in, agency picker, push), then today&#39;s route, stop detail, arrive\/depart, V2 visit hand-off, offline cache. <em>This is a safe place to stop.<\/em><\/li>\n<li>Apps: on-duty tracking.<\/li>\n<li>Live dispatch.<\/li>\n<li>Analytics + retention purge, with planned vs. actual and trail replay.<\/li>\n<li>Client messages, only if question 10 is yes.<\/li>\n<\/ol>\n<h2 id=\"user-content-waiting-on-the-customer\" dir=\"auto\">Waiting on the customer<\/h2>\n<ol dir=\"auto\">\n<li>Whose routes: field supervisors only, or attendants too?<\/li>\n<li>Do supervisors start from home or from a branch office?<\/li>\n<li>Is a 90-day breadcrumb retention right?<\/li>\n<li>Will arrive\/depart times ever feed payroll?<\/li>\n<li>What are the real visit types, and how long does each take?<\/li>\n<li>Do clients give preferred time windows, and where are they recorded?<\/li>\n<li><strong>One app with an agency picker (recommended), or a branded app per agency?<\/strong> (Plan \u00a79.7)<\/li>\n<li>Are phones agency-issued or the supervisors&#39; own?<\/li>\n<li>OptimoRoute cutover: run both in parallel or switch at once? Is there history to import?<\/li>\n<li><strong>Messages to clients\/family:<\/strong> should we send &#34;scheduled&#34;, &#34;on the way&#34; and &#34;running late&#34; texts or emails, with a tracking link and a survey afterwards? If yes, the link would show the ETA only, never a moving pin of the employee, and could sit behind the client sign-in.<\/li>\n<li>How far ahead should we plan (2 weeks?), and who confirms a visit with the client today?<\/li>\n<li>Spread visits evenly across supervisors, or use as few as needed?<\/li>\n<li>Does a visit ever need two staff at once?<\/li>\n<li>Is there a fixed lunch window? Fixed start times, or may the plan suggest a later start?<\/li>\n<\/ol>\n<p dir=\"auto\">Also needed before rollout: counsel to review the tracking notice and the retention period.<\/p>\n"}