Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Warn for possible duplicates when adding New Patient #461

Closed
2 tasks
tangollama opened this issue May 12, 2016 · 5 comments
Closed
2 tasks

Warn for possible duplicates when adding New Patient #461

tangollama opened this issue May 12, 2016 · 5 comments
Labels
🚀enhancement an issue/pull request that adds a feature to the application needs requirements indicates that an issue needs more requirements in order to be worked on v2.x wontfix indicates an issue/pull request will not be worked on
Milestone

Comments

@tangollama
Copy link
Member

tangollama commented May 12, 2016

When entering a new patient, the system would wait for the first name and family name to be provided and then send a callback to the system to determine if there are possible matches.

If a match(es) are found, present those in an alert with the option to navigate to that patient record.

Ideally, this search would be smart, examining best match scenarios.

Optional: the ability to configure the system to include birthdate as part of the required fields for a search.

TODO

  • Add conflict indicator beside First/Last name fields
  • Add screen to tell user that there might be a conflict after save
@tangollama tangollama added 🚀enhancement an issue/pull request that adds a feature to the application Patient needs requirements indicates that an issue needs more requirements in order to be worked on labels May 12, 2016
@jkleinsc
Copy link
Member

@tangollama waiting for first name and family name to be provided is a tricky if you really want to perform a fuzzy (aka smart search), because how do you know when the user is completely done filling out these fields?

I think there are two different ways to accomplish this functionality:

  1. One option would be to make first name and last name typeahead fields and if a user clicks on an existing name, you take the user directly to that record. Both typeaheads would have the full names so for example if you started typing "Joe" in the first name box it would show you as a suggestion "Joe Bagadonuts". This option would be fairly simple to implement but wouldn't accommodate fuzzy searching on things like misspellings. The plus side to this option would be that you wouldn't need to perform a server side call every time a user typed a new value, you could just preload all patient names on the patient edit screen for the typeaheads.
  2. Another option would be to wait until the user clicks on save for the new patient. At that point we could use the already existing search capability of HospitalRun to find possible matches. This search capability uses ElasticSearch if so configured which then gives us fuzzy search capabilities so that misspellings and/or similar names could be returned. If we went this route, I think the workflow is as follows:
    1. When the user clicks on save for new patient, run the query to find if any similar/same patients exist.
    2. If similar/same patients exist, show the user a modal with the existing patients.
    3. From that modal allow the user to select an existing patient or save the current details as a new patient. If the user selects an existing patient, ask them if they want to update the existing patient with the details just entered.

@jkleinsc
Copy link
Member

If we went with option 2, here are some details as to what would need to be done;
Fuzzy search solution overview 🔍
This feature could be accomplished by using the query/search already built into HospitalRun. The current search functionality in HospitalRun allows you to search for the same value against multiple fields but it doesn't allow you to search for distinct values on distinct fields, so there would need to be a slight change made in order to do this.
Steps to implement 📄

  1. Searching is currently accomplished by the following:
let searchText = 'joe';
let queryParams = {
  containsValue: {
    value: searchText,
    keys: [{
      name: 'firstName',
      type: 'fuzzy' //Do a fuzzy search (only is fuzzy when ElasticSearch is used)
    }, {
      name: 'lastName',
      type: 'contains' //Do a contains search (eg lastName contains joe somewhere in the name). 
   }],
  }
};
this.store.query('patient', queryParams).then((response) => {
  // response contains search results
}, (error) =>{
  // error executing search
});

More information about DS.Store.query can be found here: http://emberjs.com/api/data/classes/DS.Store.html
As mentioned above the currenty search solution doesn't allow you to search for distinct values on distinct fields. What we really want here is to pass in the following query:

let queryParams = {
  containsValue: {
    value: searchText,
    keys: [{
      name: 'firstName',
      value: 'joe',
      type: 'fuzzy' //Do a fuzzy search (only is fuzzy when ElasticSearch is used)
    }, {
      name: 'lastName',
      value: 'donuts',
      type: 'contains' //Do a contains search (eg lastName contains donuts somewhere in the name). 
   }],
  }
};

In order to do this, you will need to modify app/adapters/application.js. This file has a function _executeContainsSearch which is what gets invoked when this.store.query(searchModel, queryParams) gets called. This function uses the values in containsValue to search, so the code needs to be modify to accommodate the structure described above as well as continue to allow usage of the old structure for existing code.

  1. Modify the patient edit controller (app/patients/edit/controller) to perform the following logic on new patients:
    1. On save of new patient, run the query to find if any similar/same patients exist.
    2. If similar/same patients exist, show the user a modal with the existing patients.
    3. From that modal allow the user to select an existing patient or save the current details as a new patient. If the user selects an existing patient, ask them if they want to update the existing patient with the details just entered.

@tangollama tangollama added the help wanted indicates that an issue is open for contributions label Mar 14, 2017
@DerekTBrown
Copy link
Contributor

I think this makes sense as a feature- though I wonder if it violates privacy. Is there a recommended way of implementing this so that the patient is not confirmed via name (for instance, if a possible duplicate is found, prompts for DOB).

@stale
Copy link

stale bot commented Aug 7, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix indicates an issue/pull request will not be worked on label Aug 7, 2019
@fox1t fox1t added v2.x and removed Hack Day help wanted indicates that an issue is open for contributions labels Aug 7, 2019
@stale stale bot removed the wontfix indicates an issue/pull request will not be worked on label Aug 7, 2019
@matteovivona matteovivona added this to the v2.0.0 milestone Aug 7, 2019
@fox1t fox1t removed the Patient label Aug 7, 2019
@stale
Copy link

stale bot commented Oct 6, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix indicates an issue/pull request will not be worked on label Oct 6, 2019
@fox1t fox1t closed this as completed Jan 14, 2020
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
🚀enhancement an issue/pull request that adds a feature to the application needs requirements indicates that an issue needs more requirements in order to be worked on v2.x wontfix indicates an issue/pull request will not be worked on
Projects
None yet
Development

No branches or pull requests

6 participants