msupply-foundation / mobile

Open source mobile app for medical inventory control
http://msupply.org.nz/mobile
Other
42 stars 27 forks source link

Lookup patient/prescriber should be hidden until the user has done a local search #2715

Open wlthomson opened 4 years ago

wlthomson commented 4 years ago

Is your feature request related to a problem? Please describe.

Suggested by @craigdrown that the lookup API functionality should be "hidden" until the user has searched locally.

Not too knowledgeable on how things work on the ground, but I'm not sure if I agree with this! I think it might be bad UX to enforce a local search always, as it might become a frustration for the user (e.g. if the store only has a small number of patients/prescribers, or if the user already has prior knowledge that the patient/prescriber is not local).

Also not sure how this would work from a UI perspective. The lookup currently has more parameters than the local search, and is not linked to the local search data. If the user searches locally, then will the lookup search be "locked" to the data they searched for locally? This could be a bit confusing/frustrating for the user?

I think a better solution might be to think about how the lookup can be updated as more of an "advanced search" which maybe can include both local and remote patients (e.g. a tab between "local" and "remote")? Personally, I don't think it's really a problem if local patients are included as the patient isn't duplicated, so there is no problem caused (only that the user wasted their time doing a remote lookup when they could have done a local lookup).

Describe the solution you'd like

TO DO.

Implementation

TO DO.

Describe alternatives you've considered

Leave as it is?

Additional context

@craigdrown Feedback from dispensary demo (17/04/20).

josh-griffin commented 4 years ago

What if you just made the lookup patient button an advanced search - when you search, it closes the modal, populates the list with local patients. If there are none, use https://reactnative.dev/docs/virtualizedlist#listfootercomponent to add a button "look online", which sends the request?

Yes, more steps but only in certain circumstances. In the case where you search normally for patient, and then can't find them and have to do a lookup, it's actually less number of steps

wlthomson commented 4 years ago

I think this is quite similar to what I replied on another issue, so just copying it across:

@joshxg I think in order to do that (without a pretty sizable refactor), you'd have to add all the result records to the local db, which would increase the amount of records stored in multiple places (potentially massively, e.g. if the user searched for a and added all the patients beginning with a) , and might be a bit confusing for the user in terms of distinguishing between local and remote patients.

I think the feedback I'm getting indicates that the modal solution is probably going to be a short term one, as the general concensus seems to be that the search functionality needs to be "combined" in some way with local search (which I agree with, but am not sure how would work in practice).

My thinking would be that the dispensing page has an optional "advanced search", which brings up the search form (maybe as a side/bottom modal, or full screen modal) and adds a checkbox (or mobile equivalent) for including remote results. Then when the patient is selected, if the patient is non-local, he/she is added as an extra action dispatched on opening the prescribing wizard.

If I'm honest, I think the reason I didn't go with this sort of approach wasn't taken from the beginning was mainly time constraints. I think designing this well would require a decent amount of thought and possibly a lot of refactoring of the dispensing form/logic.

I think this might have to be milestoned for a later release? I don't think it's realistic to target this for v5 given the time constraints!

josh-griffin commented 4 years ago

@wlthomson

Will just reply here 🤣

I think in order to do that (without a pretty sizable refactor), you'd have to add all the result records to the local db,

Not 100% sure it would be huge. You could have each patient record be a plain object, and populate data with them. They would just need to be mapped to have the same field names.. although it does make it a little horrible when you start searching and things.

I think the feedback I'm getting indicates that the modal solution is probably going to be a short term one, as the general concensus seems to be that the search functionality needs to be "combined" in some way with local search (which I agree with, but am not sure how would work in practice).

Yeah, seems so

My thinking would be that the dispensing page has an optional "advanced search", which brings up the search form (maybe as a side/bottom modal, or full screen modal) and adds a checkbox (or mobile equivalent) for including remote results. Then when the patient is selected, if the patient is non-local, he/she is added as an extra action dispatched on opening the prescribing wizard.

Yeah - basically we're talking about the same thing except you've got checkbox and I'm suggesting a button on the bottom of the list "search online"

I think this might have to be milestoned for a later release? I don't think it's realistic to target this for v5 given the time constraints!

100%