How to Configure Unique IDs sources on OpenSRP
What are unique ids
These are identifiers assigned to clients/patients for unique identification in the OpenSRP platform.
When do they get assigned to clients/patients?
They are assigned during registration. The registration form will auto-populate them for every user created.
Why do we need to configure their sources?
Because most OpenSRP implementations have different unique id requirements they cannot be configured by default by the OpenSRP code. We, therefore, allow the different teams and configure them according to their needs.
The following are all the configurable attributtes
baseCharacterSet
- 0123456789
is used by default -- implementations can update if need be
minLength
defaults to 8
-- implementations can update if need be
maxLength
defaults to 10
-- implementations can update if need be
prefix
- No defaults
regexFormat
- No defaults
Instructions
Server-Side Configuration
Send the following payload to the OpenSRP server you intend to configure. This is to be done using a
POST
to the following endpointhttps://{{base_url}}/opensrp/rest/identifier-source
{ "identifier": "1", "identifierValidatorAlgorithm": "LUHN_CHECK_DIGIT_ALGORITHM", "baseCharacterSet": "0123456789", "minLength": 8, "maxLength": 10, "prefix": "", "regexFormat": "" }
Client-Side Configuration
Update the application build configs on the
build.gradle
file to assign the correct unique identifier sourceidentifier
. The following configs can be addedOPENMRS_UNIQUE_ID_INITIAL_BATCH_SIZE
-- The initial number of Unique Ids to be DownloadedOPENMRS_UNIQUE_ID_BATCH_SIZE
-- Subsequent number of Unique Ids to be downloaded in each batchOPENMRS_UNIQUE_ID_SOURCE
-- The Unique identifier source to be used.
Here is an example of the configuration.
buildTypes { release { minifyEnabled false zipAlignEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rule.pro' resValue "string", 'opensrp_url', '"https://anc.labs.smartregister.org/opensrp/"' buildConfigField "int", "OPENMRS_UNIQUE_ID_INITIAL_BATCH_SIZE", '250' buildConfigField "int", "OPENMRS_UNIQUE_ID_BATCH_SIZE", '100' buildConfigField "int", "OPENMRS_UNIQUE_ID_SOURCE", '1' buildConfigField "int", "DATABASE_VERSION", '2' buildConfigField "long", "MAX_SERVER_TIME_DIFFERENCE", "1800000l" buildConfigField "boolean", "TIME_CHECK", "false buildConfigField "int", "DATA_SYNC_DURATION_MINUTES", '15' buildConfigField "int", "VACCINE_SYNC_PROCESSING_MINUTES", '30' buildConfigField "int", "IMAGE_UPLOAD_MINUTES", '180' buildConfigField "int", "PULL_UNIQUE_IDS_MINUTES", '180' buildConfigField "int", "VIEW_SYNC_CONFIGURATIONS_MINUTES", '15' buildConfigField "int", "CLIENT_SETTINGS_SYNC_MINUTES", '15' } debug { resValue "string", 'opensrp_url', '"https://anc.labs.smartregister.org/opensrp/"' buildConfigField "int", "OPENMRS_UNIQUE_ID_INITIAL_BATCH_SIZE", '250' buildConfigField "int", "OPENMRS_UNIQUE_ID_BATCH_SIZE", '100' buildConfigField "int", "OPENMRS_UNIQUE_ID_SOURCE", '2' buildConfigField "int", "DATABASE_VERSION", '2' buildConfigField "long", "MAX_SERVER_TIME_DIFFERENCE", "1800000l" buildConfigField "boolean", "TIME_CHECK", "false" buildConfigField "int", "DATA_SYNC_DURATION_MINUTES", '15' buildConfigField "int", "VACCINE_SYNC_PROCESSING_MINUTES", '15' buildConfigField "int", "IMAGE_UPLOAD_MINUTES", '15' buildConfigField "int", "PULL_UNIQUE_IDS_MINUTES", '15' buildConfigField "int", "VIEW_SYNC_CONFIGURATIONS_MINUTES", '15' buildConfigField "int", "CLIENT_SETTINGS_SYNC_MINUTES", '15' testCoverageEnabled true } }
Related articles
Configuring postman to interact with OpenSRP endpoints here
Read more on the identifier validation algorithm here
Issues used to implement the identifier sources functionality in opensrp
This site is no longer maintained. Please visit docs.opensrp.io for current documentation.