Uploaded image for project: 'Reference Application'
  1. Reference Application
  2. RA-1474

Coreapps: Patient Search Widget performed redundant search when running on OpenMRS 2.1.x

    XMLWordPrintable

Details

    • Undetermined

    Description

      https://github.com/openmrs/openmrs-module-coreapps/blob/master/omod/src/main/webapp/resources/scripts/patientsearch/patientSearchWidget.js

      The patient search widget in CoreApps currently has two types of searches it performs, a "searchOnExactIdentifierMatch" and a "searchOnIdentifierAndName".  The idea is that the "exact identifier" search is faster and so therefore runs first for cases when an identifier has been supplied.

      However, in 2.1, after the inclusion of Lucene, on the backend these two searches end up calling the same underlying DAO methods, and so both end up being an "identifier and name" match.

      So, in cases when Lucene is running, the search widget only really needs to do the "searchOnIdentifierAndName"

      We should modify the widget so that whether or not it runs the "searchOnExactIdentifier" match first is configurable, and most likely default that to FALSE if running 2.1 or above?

      Also, importantly, the "searchOnExactIdentifier" will "autoselect" a patient if only one result set is returned (ie, jump directly to the dashboard for that patient).  We want to preserve this behavior.  Ideally, it will still only autoselect in the case of an identifier match, but if that is too complicated, it could simply autoselect any time there is only 1 match.

      fyi raff darius don't know if we want to prioritize this?

       

      Some options:

      1) Full details/TODOS if we want to preserver support for versions of OpenMRS prior to 2.1:

      • Change patientSearchWidget.js so that it has a new config parameter, "searchOnExactIdentifier"
      • Change the PatientSearchWidgetFragmentController so that it sets this parameter to false if the current version of OpenMRS is 2.1 or above
      • If "searchOnExactIdentifier" = false, then the doSearch method in patientSearchWidget.js should only do a searchOnIdentifierAndName
      • some comments should be added to PatientSearchWidgetFragmentController and patientSearchWidget.js should be added explaining the reasoning for this (using Lucene in OpenMRS 2.1) since it's wouldn't be obvious to the average developer

      2) Updated TODOs if we don't mind dropping support prior to 2.0:

      • Refactor the "searchOn ExactIdentiferAndMatch" and "searchOnIdentifierAndName" into a single search method that's only called once

       

      Gliffy Diagrams

        Attachments

          Activity

            People

              Unassigned Unassigned
              mogoodrich Mark Goodrich
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated: