Making a patient identifier preferred in an encounter form

Tags: #<Tag:0x00007f01bae3ae78> #<Tag:0x00007f01bae3adb0>

Continuing the discussion from Preferred Identifier - Patient Registration + Removing Automatic Assignment Question:

When a patient is created, they are automatically assigned an OpenMRS ID as an identifier.

Depending on where they go next, they will get additional identifiers that are manually entered, however we are running into an error where encounter forms cannot be saved because the patient does not have a preferred identifier.

I have looked through the documentation, but I cannot see how to make a patient identifier the preferred one.

Also how does the search work if patients have different identifiers as their preferred ones?

For background, the idea in the Reference Application is that the notion of one “preferred identifier” per patient in openmrs-core is misguided, and we want the UI to behave in a different way.

Basically, an implementation should define its preferred identifier types in order, and the UI should consistently show those types of IDs for all patients, and not have the generic patient dashboard show a TB ID for one patient but an HIV ID for another patient. It would make sense to use the preferred flag to indicate one out of multiple identifiers for one patient + identifier type, but that’s not how the features behaves now in openmrs-core.

Now, the Registration App and Registration Core modules should be working together to automatically set some identifier as preferred (even though this doesn’t drive the Reference Application UI), e.g. from this line in registrationcore. You might want to use the debugger and step through to determine why this isn’t setting a preferred identifier in your case.

I believe that searching for a patient will search across all of their identifiers (though I wouldn’t be surprised if there is no obvious graphical indication when you’ve found a patient by a non-preferred identifier or identifier type). You should verify this.