HOCO B2B
Team tasksAnis

SRV-21 — Field operations module — objectives, tours, visits, reports

Objectives, tour planning and lifecycle, visits with GPS check-in tolerance, checklists, photos, structured reports that create follow-ups, location pings, closing summary/KPIs, recommended visit order.

FieldDetails
Task codeSRV-21
PhaseP1 — V1 build & integration
Product scopeV1
StatusDone (Mon 19 Oct 2026)
StartMon 19 Oct 2026
DueMon 19 Oct 2026
ResponsibleAnis — Full-stack developer
Co-responsible—
Effort2.5 person-day(s) planned · 10 from scratch · size M
Area · appServer · server
Depends onSRV-14
UnblocksSRV-23, SRV-26, DSH-08, SRV-25
Milestones—

Summary

Objectives, tour planning and lifecycle, visits with GPS check-in tolerance, checklists, photos, structured reports that create follow-ups, location pings, closing summary/KPIs, recommended visit order.

Description

Field operations are the second pillar of the cahier (§4.5, §6.1–§6.9; FLD-01…FLD-17, FLD-19): delegates follow planned tours, check in at points of sale, run checklists, take photos, write structured reports and close their day, while the back-office follows them live. This task implements objectives per delegate and period (ObjectiveMetric, ObjectivePeriod), tour planning with ordered stops, priorities, time slots and ordering mode (IMPOSED/RECOMMENDED with a nearest-neighbour recommendation), the TourStatus lifecycle (only the assigned delegate starts it; suspend/resume with reason), visits with the VisitStatus lifecycle and GPS check-in tolerance (150 m with accuracy ≤ 100 m by default), checklists per visit type, mandatory photos by type, notes, the structured VisitReport that creates follow-up CrmTasks automatically, not-done reasons, visit locking and unlock, location pings only while a tour is IN_PROGRESS (90-day retention), closing preview and definitive close with reopen, and delegate home, performance and reports. Business days are computed in Africa/Algiers. Out of scope: offline replay mechanics (SRV-23), invitations (SRV-22), field pages (DSH-08).

Subtasks

#SubtaskOwner
1Objectives per delegate and period with progress computation (visits, sign-ups, installs, first orders, orders, revenue) and admin.objectives.crudAnis
2Tour planning: admin.tours.create/update/setStops (order, priority, time slot), TRN numbering, delegate notificationAnis
3Recommended order (nearest-neighbour from the start point) via admin.tours.recommendOrder and delegate.tours.reorder when RECOMMENDEDAnis
4Tour lifecycle PLANNED → TO_START → IN_PROGRESS ↔ SUSPENDED → COMPLETED / CANCELLED with TourStatusChange and TOUR_SUSPEND_REASONAnis
5Visit flow: arrive (distance vs field.checkInToleranceMeters, accuracy vs field.gpsMaxAccuracyMeters → 422 CHECKIN_OUT_OF_TOLERANCE unless allowed and flagged), start, checklist, note, photos, end, notDone with VISIT_NOT_DONE_REASON; VIS numberingAnis
6VisitType and ChecklistTemplate configuration (admin.visitTypes.crud, admin.checklists.crud) incl. mandatory photos per typeAnis
7VisitReport (person met, interest, products and promotions presented, VISIT_ISSUE_TAG, NextAction, follow-up date) creating a CrmTask and an InteractionAnis
8Visit lock after end and admin.visits.unlock within field.visitUnlockHours; ad-hoc visits delegate.tours.addVisitAnis
9Location pings (sync.locationPings) accepted only while IN_PROGRESS; purge job after 90 days; admin.tours.track and admin.live.delegatesAnis
10Closing preview and close (all visits DONE or NOT_DONE with reasons, pending sync = 0, comment, summary KPIs); admin.tours.reopen within field.reopenMaxDaysAnis
11Delegate home, profile, zone, objectives, performance and reports endpoints; admin.delegates.crud and performanceAnis
12Review of tour/visit payloads and offline-relevant fields for the delegate appImad

Deliverables

  • apps/server/src/modules/field/{objectives,tours,visits,checklists,reports,location,closing,delegates}.{service,router}.ts and jobs.ts
  • packages/contracts/src/{delegate/day.ts,delegate/tours.ts,admin/field.ts}
  • Field rules page /docs/srs/business-rules (field section) confirmed with the settings keys

Acceptance criteria

  • Only the assigned delegate can start a tour; another delegate gets 403 OUT_OF_SCOPE (FLD-04)
  • A check-in 220 m from the store with tolerance 150 m returns 422 CHECKIN_OUT_OF_TOLERANCE unless out-of-tolerance check-in is allowed, in which case the visit is flagged (FLD-07, FLD-08)
  • Ending a visit of a type with mandatory photos and no photo returns 422 VISIT_PHOTO_REQUIRED; a not-done visit without reason is refused (FLD-08, FLD-09)
  • A report with next action PHONE_FOLLOW_UP and a date creates a CrmTask for the delegate due that date (FLD-10)
  • Closing a tour with visits still PLANNED returns 422 TOUR_HAS_OPEN_VISITS; a closed tour is read-only unless reopened (FLD-12)
  • Location pings outside an IN_PROGRESS tour are rejected and pings older than 90 days are purged (FLD-15)
  • The recommended order is the nearest-neighbour sequence from the start point (FLD-17)

Requirements covered

RequirementTitleRelease
FLD-01Delegate accounts and profiles; assignment of wilayas, communes and points of saleV1
FLD-02Objectives per delegate and period: visits, sign-ups, app installs, orders, revenueV1
FLD-03Tour planning: daily, weekly or monthly; ordered stops (imposed or recommended); priorities and time slotsV1
FLD-04Tour lifecycle (planned, to start, in progress, suspended, completed, cancelled); only the assigned delegate starts itV1
FLD-05Delegate home: today's tour, counters, objectives, conversion rate, quick accessV1
FLD-06Tour programme: list and map show the same visits in the same order; filters, delays, prioritiesV1
FLD-07Map and navigation: position, next destination with ETA and distance, external GPS navigation, arrival confirmation within toleranceV1
FLD-08Visit and check-in: time and position at check-in, duration, checklist, note, photos (mandatory by visit type), call; finished visit lockedV1
FLD-09A visit not carried out requires a reasonV1
FLD-10Structured visit report (person met, interest, products and promotions presented, issues, next action, follow-up date, attachments) that triggers the follow-upV1
FLD-11Field reseller sign-up with GPS and façade photo, offline-capable, linked to the creating delegate, pending validationV1
FLD-12Tour closing: day summary, comment, objectives and conversion, final report; requires reasons and synced data; definitive unless reopenedV1
FLD-13Live follow-up in the back-office: delegates on tour, positions, visit progressV1
FLD-14Back-office analysis of visit reports and validation of new points of saleV1
FLD-15Location policy: consent, frequency, tolerance and retention configurable and transparentV1
FLD-16Visit types and checklist templates configurationV1
FLD-17Recommended visit order (nearest-neighbour heuristic)V1
FLD-19Delegate reports history and own performance over periodsV1

Screens

ScreenNameApp
BO-16Delegates listBO
BO-17Delegate detail & performanceBO
BO-20ObjectivesBO
BO-21Tour planner (calendar)BO
BO-22Tour editor (stops, order, recommendation)BO
BO-23Tour live detailBO
BO-24Visits listBO
BO-25Visit detailBO
BO-26Visit types & checklist templatesBO

API surface

Test measures

  • Unit tests for tolerance, nearest-neighbour ordering and Africa/Algiers day boundaries
  • DB tests for tour and visit lifecycles including suspend/resume and reopen
  • E2E with the delegate app on staging: full tour from start to close

Risks

  • GPS accuracy in dense urban areas or indoors exceeds 100 m — allow-out-of-tolerance setting with a flag reviewed in the back-office instead of blocking the delegate
  • Battery drain from location sampling — sampling only during IN_PROGRESS, every 5 min or 200 m, documented for Imad

KPI

  • Delivered by Mon 19 Oct 2026 within 2.5 person-day(s).
  • Every acceptance criterion above demonstrated before hand-off; linked requirements' acceptance criteria pass.
  • Zero open critical defects, permission gaps or data-integrity regressions at sign-off.

Generated from content/plan/tasks.json by scripts/generate-team-tasks.mjs. Dates are computed by the scheduler (Sunday–Thursday weeks, holidays excluded) — change the plan, not this page.

On this page