[Help] Searching for a patient using an identifier

So for our project, we have a patient identifier that we have created. I am trying to determine if I can search for patients using that identifier, or a subset of that identifier.

So say a patient was given the ID KFE5-1 (-1 being the check digit). Is it possible to search for the patient by searching for KRE?

Related, is it possible to do this using the REST API?

I moved this to the #ask category.

Are you saying that you want to search by partial identifier, e.g. you type “KFE” and it finds all patients whose ID starts with those 3 characters?

OpenMRS’s built-in patient searching does partial searches for names but only exact searches for identifier, so you would have to type KFE5-1 in order to find that patient by ID. (This is intentional because it’s otherwise easy to accidentally select the wrong patient.)

(I think it’s possible to change this behavior by writing Java code.)

You are correct. I want to be able to input those three characters, and get all the possible patients back whose IDs begin with those. Is it possible to disable the behavior of doing exact searches through a setting, or does it require modifying some code base?

This behavior is not configurable by any setting.

It would require you to modify some codebase. (I don’t know offhand exactly how.)

Okay, thank you for that answer. That explains a lot.

Is it possible to then search by an identifier and return several patients? The identifier in this case is not intended to be unique, but a way to determine patients coming from a specific mobile device.

EDIT: I have actually come with a workaround, that in the end actually might work better for our project. We intend to use another identifier, that will be the same for several patients. That way, we can search for that identifier, as it would be a complete query, and return all patients we need.

This would work, yes.

It’s not ideal to use a “Patient Identifier” for this (unless it actually is an ID like for a household). It would be better to use a Person Attribute (but I don’t know if these are searchable in the reference application).

@darius yes person attributes are searchable in the reference application. :smile:

Thanks for the feedback! We might just switch to using a person attribute instead then.