Patient Queueing module displays COMPLETED patient on the provider dashboard

Tags: #<Tag:0x00007f0f1ca77588> #<Tag:0x00007f0f1ca77470> #<Tag:0x00007f0f1ca773a8>

Module: Patient Queueing

Module Version: 1.0.0

System Version: OpenMRS 2.3.0, Reference application 2.10.0

Issue or Question: The Provider Dashboard displays all the patient including the COMPLETED one, but only the PENDING patients are expected.

Steps to reproduce:

  1. Send a patient to service area
  2. Go to the Provider Dashboard
  3. Select the patient
  4. Click on the General Actions: Complete Patient Session
  5. Go to the Provider Dashboard
  6. The patient is still present

The development console of my browser shows that the Provider Dashboard page send a query to the Patient queuing module as follow:

http://localhost:8082/openmrs/patientqueueing/clinicianQueueList/getPatientQueueList.action?

with the following query string:

successUrl=/openmrs/patientqueueing/providerDashboard.page?
searchfilter=

The response is then:

JSON patientQueueList object
{patientQueueList=[
        {
            "patientQueueId": 6,
            "patientId": 7,
            "patientNames": "Test John ",
            "age": "33",
            "gender": null,
            "providerNames": "John Smith",
            "locationFrom": "Surgery 2",
            "locationTo": "Surgery 2",
            "status": "COMPLETED",
            "dateCreated": "2020-06-25 11:15:41.0",
            "creatorId": null,
            "creatorNames": null,
            "encounterId": null,
            "visitNumber": "25/06/2020-Reg-001",
            "priority": null,
            "priorityComment": null,
            "id": 6
        },
        {
            "patientQueueId": 5,
            "patientId": 7,
            "patientNames": "Test John ",
            "age": "33",
            "gender": null,
            "providerNames": "John Smith",
            "locationFrom": "Registration Desk",
            "locationTo": "Surgery 2",
            "status": "COMPLETED",
            "dateCreated": "2020-06-25 11:10:53.0",
            "creatorId": null,
            "creatorNames": null,
            "encounterId": null,
            "visitNumber": "25/06/2020-Reg-001",
            "priority": null,
            "priorityComment": null,
            "id": 5
        }
    ]
}

My question: Is there anything special that I need to do in order to get only the PENDING patients or is it a bug in the module?

Thanks for your help !

cc @ssmusoke @slubwama

Yes that is a bug in the module.

Should I create a new Issue for this? I will try to see if I can resolve it, or at least narrow down the problem.

Yes feel free to take charge of that module with a ticket and pull request. :smile:

@npiaget have you create a new issue

Yes, I just have.

https://issues.openmrs.org/browse/PQ-9

@npiaget thanks for creating the issue. Would you like to help fix the issue a I guide you through the process??

Sure. Thanks for the proposition. I have already forked the repository and started a new OpenMRS instance with Ref App 2.10 using Maven. Do you have some hints where I should look at?

@npiaget before you start working with anything first have an impression from UgandaEMR demo http://aijar.mets.or.ug:8080/ugandaemr username:manager password:Manager123. Check under any icon such as triage, ART Clinic, or TB Clinic. Let me know if thats something you would like to achieve or not.

@slubwama Thanks for the information.

My understanding is that the biggest visible difference is the two lists (Patients new and Patients - Attended to) versus the Number of Patients in Queue in the Ref App module. Am I right?

While that could be a nice add-on, already having the list Number of Patients in Queue showing only the PENDING ones would be enough for now.

I did a quick search and its seems that by changing the call bellow of patientQueueingService.getPatientQueueListBySearchParams by replacing the last null with PatientQueue.Status.PENDING solves the issue.

What do you think? I could to a PR for you to review it.

@npiaget makes perfect sense. Go ahead and raise a pull request.

Thanks @dkayiwa. The PR is ready.

Thanks @npiaget for not only raising the bug, but also fixing it. Merged!

Your welcome!

@dkayiwa I have however another problem with the module. The current master raises a SyntaxError: JSON.parse: unexpected non-whitespace character after JSON data at line 1 column 4 of the JSON data when loading the Patient Dashboard.

I believe that this is due to the replace is not a function change:

Reversing back the commit solves the issue. Any ideas?

Try changing this line https://github.com/openmrs/openmrs-module-patientqueueing/blob/master/omod/src/main/java/org/openmrs/module/patientqueueing/fragment/controller/ClinicianQueueListFragmentController.java#L58 to simpleObject.put("patientQueueList", patientQueueMappers);

It get then the following response:

"{patientQueueList=[org.openmrs.module.patientqueueing.mapper.PatientQueueMapper@7fd300b7]} "

I will keep looking at the problem. Do you mind explaining why you had to change this line?

Because i was getting a replace is not a function javascript error.

OK thanks.

It seems that problem come from the escaping done by JSON.stringify when response is already a string. But my understanding of

this should always return a string in clinicianQueueList.gsp . Is this assumption wrong? I was not able to reproduce the replace is not a function javascript error.

I don’t know how to fix this other than by moving back to the previous version. I would need your help for this. Thanks!

Feel free to revert my change for replace is not a function javascript error, if it makes things work on your side. :slight_smile: