Unique Social ID
Description
OpenG2P's Social Registry supports the feature of generating randomized unique IDs both individuals and households that may be used to issue a "Social ID", "Family ID", "Famer ID", or any way that uniquely identifies a record in the SR. This is essential for ensuring accurate and efficient tracking and updating of records. The need arose to enhance data consistency and integration with other systems within the registry. We use MOSIP's sophisticated ID generator which applies several rules before assigning an ID to a record. Learn more about ID generator here:
Technical design
The ID generation is implemented as a Background Task
New Registrants are inserted into a table — g2p_que_background_task - with
status = PENDING
worker_type = id_generation_request_worker
worker_payload = {"registrant_id"="XXX"}
The celery beat producer - a cron based beat producer - periodically scans this table for PENDING records and emits queue item (id) one by one
The celery worker - "ID_GENERATION_WORKER" listening on this beat - picks up these queue IDs - Each worker picks up one queue ID at a time
To scale, the celery worker POD can be spawned into multiple PODs
The worker requests MOSIP ID Generator for an ID and on receipt of the ID - updates the res_partner table in the Social Registry Postgre Database - "res_partner.unique_id". The worker also updates the g2p_que_id_generation.status to "COMPLETED"
In turn, the worker inserts another record in g2p_queue_background_task with
status = PENDING
worker_type = id_generation_update_worker
worker_payload = {"registrant_id"="XXX"}
This queue item - is picked up the Beat Producer / id_generation_update_worker
This worker - calls the MOSIP ID Generator - REST API - to update the status of the ID as "UTILIZED"
Any failure during this process, the worker updates the g2p_que_id_generation - retry attempts. If the attempts cross a specified threshold, the g2p_que_id_generation - status is updated as FAILED
Till the g2p_que_id_generation - status is updated to FAILED, the beat producer will regularly pick up that record for retries
Source Code
Last updated
Was this helpful?