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

  1. Send the following payload to the OpenSRP server you intend to configure. This is to be done using a POST to the following endpoint https://{{base_url}}/opensrp/rest/identifier-source

    {     "identifier": "1",     "identifierValidatorAlgorithm": "LUHN_CHECK_DIGIT_ALGORITHM",     "baseCharacterSet": "0123456789",     "minLength": 8,     "maxLength": 10,     "prefix": "",     "regexFormat": "" }

 

Client-Side Configuration

  1. Update the application build configs on the build.gradle file to assign the correct unique identifier source identifier. The following configs can be added

    1. OPENMRS_UNIQUE_ID_INITIAL_BATCH_SIZE -- The initial number of Unique Ids to be Downloaded

    2. OPENMRS_UNIQUE_ID_BATCH_SIZE -- Subsequent number of Unique Ids to be downloaded in each batch

    3. OPENMRS_UNIQUE_ID_SOURCE -- The Unique identifier source to be used. 

  2. 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