Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Project

Overview

The Project service is the operational backbone of a health campaign. A project is the on-the-ground unit of work. For example: “Measles vaccination round in District X”. The service records everything needed to run that unit and everything that happened:

  • who is working on it (staff),

  • who it is for (beneficiaries — the households or individuals being served),

  • where it operates (facilities and boundaries),

  • what supplies are tied to it (resources), and

  • what was done in the field — every visit, delivery or service event (tasks), plus the commodities each task consumed (task resources).

It also records lighter-weight field signals: a worker's location trail and user actions (what a field user did on their device, including stock-count submissions).

In short: "what is the campaign, who runs it, who is it for, and what happened on the ground?"

Business Flow

  • During campaign setup, Project Factory creates the projects, attaches staff, links facilities, and registers the target beneficiaries. The project is the registry that all of this lands in.

  • During the campaign (runtime), the field/mobile app reads its assigned project and then writes back tasks — each beneficiary visit or service delivery becomes a task, and the commodities used become task resources. The app also streams a worker's location and user actions as they move through the day.

  • Beneficiary tagging links a household/individual to the project so the app knows who is eligible and what they have already received.

  • The data feeds the dashboards (via the transformer → Elasticsearch) so programme managers can see coverage, staff activity and consumption per area.

Key APIs / Entry Points

Base path /project. Most sub-entities provide create, update, delete, and search endpoints. Single and bulk variants are available where listed. The list below covers the most important endpoints.

Endpoint
Purpose

POST /project/v1/_create, /v1/_update, /v1/_search, /v2/_search

Manage the project itself (the campaign unit). v2 search returns richer linked data.

POST /project/task/v1/_create, /bulk/_create … _search

Record field work — visits, deliveries, service events (the highest-volume path).

POST /project/beneficiary/v1/_create … _search

Tag households/individuals as targets of a project.

POST /project/staff/v1/_create … _search

Assign / unassign workers to a project.

POST /project/facility/v1/_create … _search

Link facilities (and their boundaries) to a project.

POST /project/resource/v1/_create … _search

Link products/supplies to a project.

POST /project/user-action/v1/bulk/_create, /bulk/_update, /_search

Capture field-user actions, including bulk stock-count updates (link)

POST /project/user-location/..., /check/bandwidth

Worker location trail and a connectivity check used by the mobile app.

Kafka entry points (async). Bulk writes land on the service's own consumer topics (e.g. save-project-task-bulk-topic, save-user-action-project-bulk-topic, the beneficiary/staff/facility/resource equivalents). After processing, persisted rows go out on save-* / update-* / delete-* topics (e.g. save-project-task-topic, update-user-action-project-topic) for the persister and transformer.

Swagger contract:

Kafka topics

in topics are consumed by the Project service. out topics are produced by it.

Topic
Dir
Purpose

save-project-task-bulk-topic

in

Bulk task create requests

update-project-task-bulk-topic

in

Bulk task update requests

delete-project-task-bulk-topic

in

Bulk task delete requests

save-project-staff-bulk-topic

in

Bulk staff create requests

update-project-staff-bulk-topic

in

Bulk staff update requests

delete-project-staff-bulk-topic

in

Bulk staff delete requests

save-project-facility-bulk-topic

in

Bulk project-facility create requests

update-project-facility-bulk-topic

in

Bulk project-facility update requests

delete-project-facility-bulk-topic

in

Bulk project-facility delete requests

save-project-resource-bulk-topic

in

Bulk resource create requests

update-project-resource-bulk-topic

in

Bulk resource update requests

delete-project-resource-bulk-topic

in

Bulk resource delete requests

project-beneficiary-consumer-bulk-create-topic

in

Bulk beneficiary create requests

project-beneficiary-consumer-bulk-update-topic

in

Bulk beneficiary update requests

project-beneficiary-consumer-bulk-delete-topic

in

Bulk beneficiary delete requests

save-user-action-project-bulk-topic

in

Bulk user-action create requests

update-user-action-project-bulk-topic

in

Bulk user-action update requests

save-location-capture-project-bulk-topic

in

Bulk location-capture create requests

save-project / update-project / update-project-date

out

Persist project + date changes

save-project-task-topic / update-project-task-topic / delete-project-task-topic

out

Persist task create / update / delete

save-project-staff-topic / update-project-staff-topic / delete-project-staff-topic

out

Persist staff create / update / delete

save-project-facility-topic / update-project-facility-topic / delete-project-facility-topic

out

Persist project-facility create / update / delete

save-project-resource-topic / update-project-resource-topic / delete-project-resource-topic

out

Persist resource create / update / delete

save-project-beneficiary-topic / update-project-beneficiary-topic / delete-project-beneficiary-topic

out

Persist beneficiary create / update / delete

save-user-action-project-topic / update-user-action-project-topic

out

Persist user-action create / update

save-location-capture-project-topic

out

Persist location-capture

project-staff-attendance-health-topic

out

Emit staff attendance event

Dependencies

  • idgen — generates project/task/beneficiary record IDs.

  • household & individual — the registries a beneficiary points at (validation of who is being served).

  • facility — validates facilities linked to a project.

  • product — validates products linked as project resources/task resources.

  • boundary — administrative boundaries a project and its facilities operate in.

  • egov-mdms — master data (project types, task statuses, tenant config).

  • health-services-common / -models — shared clients, validators, POJOs.

  • Kafka — async create/update/delete pipeline for every entity.

  • egov-persister (deployed via the configs/ repo) — actually writes the rows to Postgres off the save-* topics.

  • transformer → Elasticsearch — builds the dashboard read-model from the same topics.

  • Redis — caching used by the shared repository layer.

Process Flow

Writes are asynchronous: the API validates, enriches and acknowledges, then a Kafka consumer persists. The service does not write Postgres directly — it emits a save-* event that egov-persister turns into a row, while the transformer indexes the same event into Elasticsearch for dashboards.

Sequence Diagrams

Project - Create
Project - Update
Project - Search
Project Task - Create
Project Task - Update
Project Staff - Create
Project Staff - Update
Project Beneficiary - Create
Project Beneficiary - Update
Project Beneficiary - Search
Project Facility - Create
Project Facility - Update
Project Facility - Search
Project Resource - Create
Project Resource - Update
Project Resource - Search

User Action Flow
Location Capture Flow

Data Model

Failure / Retry Handling

  • Async, no batch rollback. A bulk request returns 202 before persistence. If one record in the batch fails validation in the consumer, it does not roll back the others — check consumer logs and the record's status.

  • Idempotency is via clientReferenceId — re-submitting the same one should not create a duplicate row.

  • Optimistic locking via rowVersion protects against concurrent edits on the normal entity-update paths (task, beneficiary, etc.). (See the v2.1 note for the one place this is now relaxed — the user-action path.)

  • Soft delete (isDeleted) everywhere — nothing is hard-deleted; unique constraints include the delete flag.

  • If the persister config for the project topics is missing/stale in an environment, the API will accept writes but rows will silently not appear in Postgres — a classic "it worked in QA" trap.

Known Risks / Limitations

  • Large surface area. Project bundles seven core entities (project, task, beneficiary, staff, facility, resource, task-resource) plus the user_action / user_location audit tables. A change to shared validation or enrichment can ripple across all of them — test the whole set, not just the entity you touched.

  • Task is the highest-volume entity. Field rounds generate huge task / task-resource volumes; search and persister throughput here drive overall campaign performance.

  • Cross-registry references are validated app-side. Beneficiary → household/individual and resource → product links are checked by service calls, not DB foreign keys — a stale or unreachable dependency surfaces as a validation failure, not a constraint error.

  • Persister/transformer config drift. Because writes are async, a missing or stale persister/transformer config in an environment lets the API accept writes that never land in Postgres or Elasticsearch.

Last updated

Was this helpful?