Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Bahmni uses OpenMRS ID Gen module for patient ID management & generation.

There are two configuration required for automatically generating the patient identifier. If you are doing it for the first time it is likely you need to configure the patient identifier source first. For each identifier source you can define multiple identifier sequences. Bahmni currently doesn't support more than one identifier source. The user interface for ID gen module is broken hence you would need to set this by directly using the SQL in database.

Choosing the primary identifier type

Tip

Please refer to this video on Patient Identifier Configuration in Bahmni.


Bahmni uses a global property called 'bahmni.primaryIdentifierType'. It accepts the UUID of the identifer identifier type you  you want to use in the application. Bahmni uses this UUID to fetch the list of identifier sources. Please make sure to uncheck 'Is required' field in other identifier types if you have any. Also set Location behaviour to 'Not used' in the identifier type. Please refer OpenMRS wiki for details about identifier sources and types.

Note

Till 0.88 bahmni.primaryIdentifierType wascalled as emr.primaryIdentifierType

Note: by default Bahmni ships with Bahmni Id. Implementations can change it.

Creating a New Patient Identifier Source

You will need to fire the following SQL query to create an Identifier Source. 

Note

Please check if it already exists. If so, then instead of the INSERT query, fire an appropriate UPDATE query. 


Code Block
languagesql
titleSQL Query for creating an identifier source
-- Note that "ANC" and "ID Sequence source for patients in ANC" are the PREFIX, and the DESCRIPTION respectively. 
-- You can change them as you need
 
insert into idgen_identifier_source (uuid, name, description, identifier_type, date_created, creator) 
values (uuid(), 'ANC', 'ID sequence source for patients in ANC', (select patient_identifier_type_id 
from patient_identifier_type where name = 'Bahmni Id'), now(), 1);

Create a New Identifier Sequence

 Now you need to specify the details about the Identifier sequence number. The ID sequence format is controlled by the table "idgen_seq_id_gen" where  Here is an explanation: 

AttributeExplanation
next_sequence_valueStores the value of the next sequence number to be generated
first_identifier_baseDetermines the starting value from which sequence should start. Set this to a value of current ID number to generate future ID numbers that are higher than this. Useful when you have existing numbering system and want to keep new patient ids separate
prefixAllows you to define the prefix for the ID - can be used to denote a health center / department e.g. SEA, or ANC, etc.
suffixAllows to define a fixed value that can be appended (in the end) to the ID like a year e.g. /14
min_lengthAllows for defining minimum length of the ID generated. This includes the length of Prefix and suffix so if you have min 4 digits as id but have a Prefix and suffix like given above then min_length should be 3+4+3 = 10
max_lengthAllows for defining maximum length of the ID generated. This includes the length of Prefix and suffix so if you have max of 7 digits as ID but have a Prefix and suffix like given above then max_length should be 3+7+3 = 13


Note

Please check if it already exists. If so, then instead of the INSERT query, fire an appropriate UPDATE query. 


Code Block
languagesql
titleSQL for specifying Identifier details
-- Set the values appropriately
-- Example here:
-- next_sequence_value = '200001'
-- base_character_set = '0123456789'
-- first_identifier_base = '200000'
-- prefix = 'ANC'
-- suffix = '' (nothing)
-- min_length = 9 digits
-- max_length = 9 digits
 
insert into idgen_seq_id_gen (id, next_sequence_value, base_character_set, first_identifier_base, prefix, 
suffix, min_length, max_length) values ((select id from idgen_identifier_source where name = 'ANC'), 
200001, 0123456789, 200000, 'ANC', '', 9, 9);


Resetting or Modifying the ID Numbering Scheme Used in Bahmni

If you want to reset the patient ID generator, so that it starts again from a Fixed number, then you can fire the below UPDATE query. Here for instance, the suffix is being changed to /15 (to indicate year 2015 has started), and the patient id is being reset to number 1.

Code Block
languagesql
titleSequence and suffix reset query
UPDATE `openmrs`.`idgen_seq_id_gen` SET `next_sequence_value`='1', `suffix`='/15' WHERE `id`='1';


Auto Increment Logic for Registration Numbers

Auto generation of ID's in registration page works based on the last generated sequence number. But, it also looks at Manuallyentered IDs, to ensure an auto generated ID doesn't clash with a manually entered id. The logic is such that if the system detects a manually entered ID greater than the last auto generated id, then the next generated id starts from 1 more than the last manually entered id.  

Scenario 1: If the manually entered Id is lesser than the auto generated sequence, then the next auto generated Id will continue to follow the auto generated Id. For example: Suppose last auto generated Id is "200070" and after this there was a patient created with manual Id "200060". Now if a patient is created with auto generated Id, the new ID would be "200071".

Scenario 2: If the manually entered Id is greater than the auto generated Id, then the next sequence will respect the manual Id. For example: Lets say the last auto generated Id is "200070" and after this a patient was created with Id manually entered as "200080". Now if a patient is created with auto generated Id, the Id would be "200081".


Creating extra identifierTypes

OpenMRS has a global property called 'bahmni.extraPatientIdentifierTypes'. It accepts the list of UUIDs of the Patient Identifer Type that one want to use in Bahmni. Bahmni uses this UUID to fetch the list of identifier sources.  Please refer OpenMRS wiki for details about Identifier sources and types.

Note

Till 0.88 bahmni.extraPatientIdentifierTypes wascalled as emr.extraPatientIdentifierTypes


Tip
titleWhere are the extra Identifiers seen?

The extra identifiers will be listed in registration page along side primary identifier type.


Warning

The extra identifier names should not be "Patient Identifier" because it is currently reserved for primary identifier.



Panel
titleBGColor#F9F2B1
titleOn this page

Table of Contents


Panel
titleColorwhite
titleBGColor#1FA5A0
titleRelated Links

Registration Configuration

IDGen Module of OpenMRS