Find Patients to Merge throws SQLException

I wanted to expose “Find Patients to Merge” functionality through REST API as part of my GSoC 2021 task.

First I wanted to try out the existing UI. However, when selecting one of these 3 fields: Given, Middle, Family Name, I receive the following SQL Exception:

I’m running OpenMRS server version: 2.4.0 Build e4adbd

I’ve been able to reproduce the issue with https://qa-refapp.openmrs.org/

You may need to take a look at this and this

Am skeptical about the version you are consuming !! @sharif @herbert24 @jwnasambu do we have this version already for use ?

the latest version of core is 2.4.0

1 Like

Is it recommended for use Or still a SNAPSHOT ?

the snapshot is 2.5.0

1 Like

I’m not sure how that explains the issue with “Find Patients to Merge” which is occurring on build 2.4.0

These two links point to code that tests the merging process, not finding patients to be merged :slight_smile:

I’m talking about this page: https://qa-refapp.openmrs.org/openmrs/admin/patients/findDuplicatePatients.htm

cc: @dkayiwa @gcliff

@kdaud does it mean that the existing automated tests did not catch this?

We have an automated test that captures patient merge, one has to ensure that there exists two patient data set in the db instance for the action to be effective. Ideally the better way would be creating your own patient data than relying on the existing data within the server and then perform the action.

But if the test am pointing out does not capture @navareth use case, then we can have it automated if more light is thrown on the idea behind the use case.
cc: @sharif

The tests you are talking about don’t test use cases when a user wants to find mergeable patients based on their attributes (names specifically).

I know it’s not possible in the new UI, however we could do that through LegacyUI at : https://qa-refapp.openmrs.org/openmrs/admin/patients/findDuplicatePatients.htm

cc: @k.joseph @sharif

There’s a way to search for patients in ref app 2.x and selecting the first and second inputs the first and second patient ids automatically and this works perfectly at https://qa-refapp.openmrs.org/. The legacy ui doesn’t perhaps support finding patients by name, it relies on knowing the patient ids, please go ahead and create a ticket for this @navareth in https://issues.openmrs.org/projects/LUI/issues and if you have time and desperately need this work on it.

The automated test doesn’t use the search option in ref app 2.x, @grace @christine can we can this feature in one of our workflows and include the search for patient in that instead?

1 Like

@navareth thanks for the catch, Feel free to let us know incase of help or resolvng the issue because we might as well need to automate it ,

The legacy UI does support finding patients by name, however, the core webapp throws an exception when trying to do so. That’s why I think creating an issue in the TRUNK project makes more sense.

https://issues.openmrs.org/browse/TRUNK-6008

Apart from that, we could create an issue for adding a refapp test that will use the search options, on the merging page.

Good catch Kaweesi. @christine can you update the workflow test tickets accordingly?

I’ve posted a PR with a fix for the issue above: https://github.com/openmrs/openmrs-core/pull/3810

1 Like