Features / Planning & tracking

Activity Tracker

A daily log where field staff record the activities they did, with a photo for each, and submit the day after 18:00. Built on the in-house assessment (survey) library.

FactsheetPlanning & tracking
Who uses it
Field staff / CRP (regular cadre)
How you get here
Drawer > Activity Tracker. Hidden for Unit login (unit-incharge / fmt_l1).
Tables
AssessmentInstanceAssessee (assessment library), Attachment (assessment library)
APIs
3 calls today, 6 App Service operations
Offline
Answers saved locally in assessment library tables; submit queues the response and photo uploads with retry (dooWithRetry). assessmentTakenOn = selected date at 00:00 UTC.

Screens

ScreenWhat it doesSource
Activity calendarMonth view coloured by submitted / saved days.app/src/main/java/org/platformcommons/urvi/view/activity_tracker/ActivityCalendarFragment.kt
Activity history (day)Activities answered on one day, add and submit.app/src/main/java/org/platformcommons/urvi/view/activity_tracker/ActivityHistoryFragment.kt
Activity listPick an activity (question) to answer, with search.app/src/main/java/org/platformcommons/urvi/view/activity_tracker/ActivityListFragment.kt
Save activityAnswer one activity with photo.app/src/main/java/org/platformcommons/urvi/view/activity_tracker/SaveActivityFragment.kt
Selectable responseOption picker for objective and custom questions.app/src/main/java/org/platformcommons/urvi/view/activity_tracker/SelectableResponseFragment.kt

What it captures

FieldTypeRequiredValidationOptions from
Objective / Multiselect answerSingle or multi option pickerYesAt least 1 option.Assessment question options (ASSESSMENT_CODE_ACTIVITY_TRACKER)
Custom crop / VO / SHG / lead farmer answerPickerYesAt least 1. Question APCNF_SURVEY_ACTIVITYTRACKER_012 is forced to single-select.Local data: product SKU (by language), VO list, all SHGs, lead farmers
Subjective answerText, or two numeric fields when the question has 2 hint labelsYesTwo-field form: a decimal up to 999.99 and an integer up to 5 digits; both required.User input
File upload answerAttachmentYesDevice files
PhotoCameraYesMandatory for every activity; compressed to about 45 KB JPEG.Device camera
LocationGPSNoAttached when available.Device GPS

Rules

Conditions from the code, rewritten as plain decision rules.

WhenThen
A day has a record with a server id or a pending uploadCalendar day coloured primary (submitted).
A day has a record without server id or pending uploadCalendar day coloured orange (saved, not submitted).
User taps a future dayIt cannot be opened.
Selected date is today and nothing submitted for the day"+" add-activity button is shown; hidden for past days.
Activity already answered that dayToast "activity already added".
Editing an answered activityAllowed only on the same day and before 18:00.
Submitting today before 18:00Blocked with snackbar "submit activity warning".
Submitting today at or after 18:00, or a past day at any timeConfirmation dialog, then assessment-response POST plus one attachment upload per photo are queued.

API contracts

Each call opens to its use case, headers, request and response bodies, and errors.

App Service v2: operationUse
GET /configTyped config bundle (ETag)
GET /assessmentsAssessment definitions and past submissions
POST /sync/batchApply an ordered batch of offline mutations
POST /filesCreate a file upload (resumable or single-shot)
PATCH /files/{fileId}Append a chunk to a resumable upload
HEAD /files/{fileId}Current offset of a resumable upload

Behaviour notes

  • Assessee is the logged-in user (actor type Bridge user); sub-type ASSESSMENT_SUB_TYPE_ACTIVITY_TRACKER.

Improve in the rewrite

  • Show the "editable until 18:00 / submit after 18:00" rule on screen.
  • Make the 18:00 cut-off and photo size configurable.