🌠Individual
Overview
Individual is the registry of people in a health campaign — every person the system needs to know about, whether a beneficiary or a field worker. One Individual record holds a person's name, gender, date of birth, contact details, plus their:
Identifiers — ID documents that identify the person (e.g. a system beneficiary ID, Aadhaar number, mobile number).
Addresses — one or more places linked to the person (home, permanent, correspondence), tied to campaign boundaries.
Skills — for workers, what they are trained or qualified to do.
Sensitive personal data (PII) such as Aadhaar, mobile number and name is encrypted at rest. When a person also needs to log in (typically a worker or supervisor), the individual links the record to a login account in the platform's egov-user service.
In short: "who is this person, how do we identify and reach them, and can they sign in?"
Business Flow
A health campaign is a time-bound programme that registers people, assigns workers, and delivers health interventions within defined boundaries.
During campaign setup, field workers and supervisors are registered as Individuals (often with a login account and roles), so they can use the mobile app.
During the campaign (runtime), beneficiaries are registered as Individuals — usually by the household service while registering a household — and tagged with a unique beneficiary ID.
Throughout, other services (household, project, referral, stock hand-outs) reference these Individual records to know who received what.
Individual records feed the dashboards (via the transformer → Elasticsearch) and other registries that need beneficiary/worker counts.
Key APIs / Entry Points
Base path /individual/v1. Each write has a single and a bulk form. Bulk endpoints return 202 Accepted after queuing the request for Kafka processing. Single endpoints validate and enrich records in the request path, then publish persistence events.
Since both single and bulk creates are asynchronous (the response only confirms the request was accepted/queued for Kafka processing — not that Postgres has persisted it yet), the client doesn't have the server-generated ID at the time of the write. There's a gap between "request accepted" and "record exists with an ID."
clientReferenceId solves this gap: it's a client-supplied identifier sent with the create request, before the server ID exists. Because the client controls this value, it can be used to:
Poll
_searchafter a create, looking up the record byclientReferenceIduntil it appears — that's how the client discovers the server-assigned ID.Correlate the original write with the eventually-persisted record, since there's no other way to tie the two together across the async boundary.
Ensure idempotency/deduplication — if the same
clientReferenceIdis submitted twice (e.g. due to a retry after a timeout), the system can recognize it as the same logical record rather than creating a duplicate.
POST /individual/v1/_create, /bulk/_create
Register a person (single or bulk).
POST /individual/v1/_update, /bulk/_update
Update a person's details.
POST /individual/v1/_delete, /bulk/_delete
Soft-delete a person.
POST /individual/v1/_search
Find people (by id, name, mobile, identifier, boundary/ward, since-time …). PII filters are encrypted before querying.
Kafka entry points (async). Bulk create/update/delete requests land on individual-consumer-bulk-create-topic / …-update-topic / …-delete-topic and are processed by the service's own consumer. Persisted results go out on save-individual-topic / update-individual-topic / delete-individual-topic (plus update-user-id-topic) for the persister and transformer.
Swagger contract:
Kafka topics
individual-consumer-bulk-create-topic
in
Bulk person create requests
individual-consumer-bulk-update-topic
in
Bulk person update requests
individual-consumer-bulk-delete-topic
in
Bulk person delete requests
save-individual-topic
out
Persist new individuals
update-individual-topic
out
Persist individual updates
delete-individual-topic
out
Persist individual soft-deletes
update-user-id-topic
out
Link individual to its egov-user account id
egov.core.notification.sms
out
Outbound SMS notifications
Dependencies
egov-user — creates/updates the login account for people who are system users; login resolves by
userUuid(no password held in Individual).idgen — generates individual record IDs.
beneficiary-idgen — supplies and marks-used the unique beneficiary IDs handed to the mobile app.
egov-enc-service (via
enc-client) — encrypts/decrypts PII (Aadhaar, mobile, name). Needs MDMSDataSecurity.SecurityPolicydata for the tenant or the service fails to start.boundary-service — validates the campaign boundary/ward on an address.
MDMS — tenant-scoped master data and the security policy used by encryption.
Localisation + SMS notification (
egov.core.notification.smstopic) on create/update where enabled.health-services-common / -models — shared clients, validators, POJOs.
Kafka — async create/update/delete pipeline.
egov-persister (deployed via the
configs/repo) — actually writes the rows to Postgres off thesave-*/update-*/delete-*topics.transformer → Elasticsearch — builds the dashboard read-model from the same topics.
Redis — caching used by the shared repository layer.
Process Flow
Bulk writes are asynchronous: the API validates and acknowledges, then a Kafka consumer enriches, syncs the login account, encrypts PII and 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. Single create/update/delete runs the same steps inline. Search reads (encrypted) from the database and decrypts before returning.
Sequence Diagrams







Data Model

Failure / Retry Handling
Async, no batch rollback. A bulk request returns
202before persistence. The consumer validates each record independently. Invalid records are dropped and the rest proceed. The Individual API has no per-record status or error endpoint. Confirm persistence with_searchusingclientReferenceId. Inspect consumer logs or observability events for rejected records. A user-account failure is reported asUSER_SERVICE_ERROR.Idempotency is via
clientReferenceId— re-submitting the same one should not create a duplicate person.Optimistic locking via
rowVersionprotects against concurrent edits on update.Soft delete (
isDeleted) everywhere — nothing is hard-deleted; unique constraints include the delete flag.User-service failures are per-record. If creating/updating the egov-user login account fails for a person, that person is removed from the valid set with a
USER_SERVICE_ERROR; the others still persist.Encryption start-up dependency. If MDMS
DataSecurity.SecurityPolicyis missing for the tenant, the service crashes at boot (enc-client) — the most common environment trap for this service.If the persister config for the individual topics is missing/stale in an environment, the API accepts writes but rows silently don't appear in Postgres.
Known Risks / Limitations
Encryption is a hard boot dependency — missing MDMS
DataSecurity.SecurityPolicyfor the tenant (theIndividual*models) crashes the service at start-up; enc-client loads the policy once at boot, so a fix requires a restart.PII search is exact-match on encrypted values — mobile/Aadhaar/identifier searches encrypt the filter and match the ciphertext, so partial or fuzzy matching on PII is not possible.
User-service coupling. People marked as system users must sync to egov-user; if that service is down, those records are rejected (others still save). Login depends on
userUuidbeing correctly linked.identifierType/ address types are convention-driven — validators enforce known types, but the DB does not constrain free-text values.A persister gap is silent — writes are accepted (
202) even if no environment consumer is writing the rows.
Last updated
Was this helpful?