Patient Identifier


I’m trying to insert patients from datasheet into openmrs. I’m doing a kind of bulk insert module, but now I have a problem with the identifier that exists in this datasheet. It has some patient information in the identifier. I know is not a great idea, but I need to keep it in order to track the existing information of those patients. The problem, is that I didn’t found a way to define the generator rules, beside those in the Generator Editor.

Is there any way to create a custom generator?

Thanks, Fernando Almeida

Did you get a chance to look at this?

Yes I did @dkayiwa but it doesn’t seem much configurable. The only way I see to match my requirement, is to implement a Remote Identifier Source in some module. I was thinking of some mechanism like an handler, but I didn’t find anything like that. Do you agree remote identifier source is the best option?

Thank you :wink:

Including meaning in an patient identifier is considered bad practice. That’s probably why there isn’t an interface or handler mechanism that to which the patient is passed (e.g, so it could insert patient details – meaning – into the identifier).

Another option would be to assign the identifier manually as you create the patient rather than depending on auto generation. I did this recently when creating a command line client for the REST API. That client is currently hard-coded to use patient identifier type 1 (OpenMRS Identifier), so may not work for you. But, one of the ways I use the client is to specify the identifier myself when creating a patient. As long as the identifier is valid (in my case, uses the mod30 algorithm of OpenMRS Identifier), it works.

So, in your case, you should be able to generate the identifier you need as part of your import process (setting it manually as you create the patient) instead of depending on idgen to come up with the identifier for you. Would that work?

Thank you @burke.

I think you pointed me to the right option, however this option will oblige me to have different identifier to the through web interface registered patients, since I think registration app recalls on idgen to generate its openmrsID. That’s not a bad option to me, have two identifiers, one for legacy purpose, and another to one to be the main identifier, but I need to confirm it with my project manager. I’m just not sure if I can search for both identifiers, for example on patient search, or eventually on reports. Can you just confim it to me?

Yes. I would recommend using two separate identifier types, so the autogenerared identifiers can be validated. Patient search should work across names and all identifiers (all types). This is a common scenario to have a few types of identifiers, trying to encourage use of a meaningless identifier going forward, and needing to search across all of them.

Assuming humans will be manually entering or transcribing identifiers at times, I’d recommend using a check digit when you can.

ok, that’s enough for me. Thanks @burke for your help. :slight_smile: