msupply-foundation / mobile

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

Tonga would like to be warned if they are dispensing >1 dose of HPV vaccine #5014

Closed DhanyaHerath closed 1 year ago

DhanyaHerath commented 1 year ago

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

From Jess:

A request from the team in Tonga has come in to whether we can limit the HPV to one dose (e.g. can not be dispensed twice in mobile) or alternatively, a pop-up saying: “This patient has already received one dose, are you sure you want to dispense another dose”.

The reason for this request is that it will significantly cut down the number of accidental duplicate dispensing in the system, which from what has been communicated is one of the larger data cleaning issues they are having.

The team there would like to use the approach of having a Warning pop up if a patient has already had a dose. They have not provided a timeframe they would like this warning to pop-up - but I think we can be conservative with it to allow for the possibility that things are back entered more than 1/2 days late.

The reason for not creating a hard limit is that there might be a future dose for patients, so we don’t to box ourselves in :)

Describe the solution you'd like

Implementation

TO BE DISCUSSED

Describe alternatives you've considered

TO BE DISCUSSED

Additional context

Jobcode

TGAVAC:DD

DhanyaHerath commented 1 year ago

Please work on a design and estimated hours for this work before starting on it, thanks!

ujwalSussol commented 1 year ago

@sworup and @arjunSussol : Could you come up with a design plus hours needed. Once done, I am thinking you could present your findings in a meeting.... The Server we are talking about is the Tonga Vax server.

sworup commented 1 year ago

@ujwalSussol @DhanyaHerath @arjunSussol


Proposed solution for discussion

These are a few things that come to mind:

If we replace this dispatch by a newly created (that we will create) checkPredispensedBeforeSelect action and do these steps we should be fine.

The above code is selecting non-vaccine history but it won't be hard to create a selector of vaccine history only.

DhanyaHerath commented 1 year ago

@sworup thanks for that! Some comments:

sworup commented 1 year ago

@DhanyaHerath

I've heard that there is a separate branch for Tonga, is that correct? Could you link the branch for me, please?

It looks like tonga has v8.2.3 installed. We can create a branch off of 8.2.3 tag and start from there.

  • Would it be possible to make the "7 days" a preference, rather than hardcoded? I'm a bit worried they'll ask us to change quickly...

Yes we can

It seems @arjunSussol would work on this. I will discuss this with him and give an estimated time. I am expecting around 20-30 hours, which would be around 3-4 workdays.

ujwalSussol commented 1 year ago

@DhanyaHerath We had a heated debate during our 10 minutes standup.

I was for making our Mobile master compatible for both Kiribati and Tonga. So the idea was to update the master and the Tonga datafile compatible for the latest Mobile... Otherwise it complicates for support folks ... we need to know Tonga Vax are on a special version.

So the preference would be to have the Mobile master compatible for all mobile deployment.

arjunSussol commented 1 year ago

@DhanyaHerath @sworup @ujwalSussol After discussion and local testing, we have to estimate about 3 to 5 days depends on complexities. I have some points before starting this:

1) If we are going to validate all items that are vaccines (item has already isVaccine field in both desktop and mobile side) then no need to care about item category. 2) If we differentiate vaccine based on item category then we should be cleared that mobile is accepting item_category.description not item_category2.description. So better to keep existing item_category.description and end user should be aware about this functionality. Otherwise we need to change code in mobile if go with item_category2 3) 7 days period preference: We need this preference in mSupply desktop and should be editable. This preference should be set in cloud as general preference not store specific because we need same period in all over the mobile sites to validate. 4) As we need to add preference on desktop, we have to make changes there too. Also, do we need this 7 days period visible in mobile site? If yes then can add it to mobile > Setting page similar to sync settings. 5) Confirmation alert: This patient has already received one dose, are you sure you want to dispense another dose, we need Yes and No for confirmation. Once we click Confirm or OK and Next button, the above alert should be visible. If we click Yes then we dispense the same vaccine to that patient otherwise don't proceed ahead and keep the vaccination page open.

We are going to deal with patient vaccination history that have all records from all stores instead of respective site store. Please, give your opinion as we need to update proposed solution.

DhanyaHerath commented 1 year ago

@ujwalSussol @arjunSussol @sworup Thanks!

I totally agree that the two versions should be merged, but we can't do that until we have funding for it :( It would be a much bigger job.

Answering Arjun's questions here:

  1. We do need to check all vaccine items, but should only alert if the same type of vaccine is being dispensed multiple times over 7 days, so we will need to use the item_category2.
  2. Ok, good to know...I think we should start sending item category 2 through to mobile. Does the item.category_2 field not get sent at all? Or is it the item_category2 table that doesn't get sent? If at least the field is sent, that should be enough.
  3. Ok with me, though I am checking with @jagoje whether we need to check patient history across all sites, or if it's enough to check what was dispensed on that mobile site.
  4. Yes, will be a change in desktop - doesn't need to show in the mobile settings page.
  5. Yes, sounds good. If they click "No", I think we should still keep the vaccination page open. And it's easy enough, we should remove the vaccine line.
sworup commented 1 year ago
  • We do need to check all vaccine items, but we should only alert if the same type of vaccine is being dispensed multiple times over 7 days, so we will need to use the item_category2.

Why check other categories if we are not gonna alert? Do we keep log?

  • Ok, good to know...I think we should start sending item category 2 through to mobile. Does the item.category_2 field not get sent at all? Or is it the item_category2 table that doesn't get sent? If at least the field is sent, that should be enough.

@DhanyaHerath Looking at the mobile code, our mobile app only syncs ItemCategory into item.category in Realm, which is item_category table and field from mSupply. Neither item_category2 table nor the field is synced to mobile.

Unless we are sending item_category2 (and other category types) as item_category sync data from desktop server. But upon my inspection it is not the case.

arjunSussol commented 1 year ago

@ujwalSussol @DhanyaHerath @sworup If we skip the item_category2 works then we can do rest in 5 working days which includes development, testing and apk building.

As item_category2 is not consuming by mobile, if we need it then we have to create its fresh schema and need to link with item. After using this client needs to be re synced mobile data which would be time consuming for syncing too. Also, we need extra time to implement this into mobile and we may need more than 5 working days.

ujwalSussol commented 1 year ago

@arjunSussol @sworup : Talking with @arjunSussol today, I mentioned the point that we should control this feature with a preference of some sort.... Let us discuss tomorrow.

DhanyaHerath commented 1 year ago

Why check other categories if we are not gonna alert? Do we keep log?

@sworup We should always alert if a vaccine of the same category is dispensed twice within a period of 7 days.

@arjunSussol @ujwalSussol Thanks all for the estimates and design everyone! I'll take this back to Jess to check whether we should go ahead with this work based on the 5+ day estimate.

ujwalSussol commented 1 year ago

@DhanyaHerath @jagoje :

Further discussion with @sworup and @arjunSussol : We have a confirmed plan.

@arjunSussol will update the plan here with screenshots so that @jagoje and everyone will know what the final outcome will look like.

https://docs.google.com/document/d/10nQeySzggs4ScaoQbrBRg1A8bu5qZtP6pCjRLnuUdHs/edit

arjunSussol commented 1 year ago

@DhanyaHerath @jagoje :

Further discussion with @sworup and @arjunSussol : We have a confirmed plan.

@arjunSussol will update the plan here with screenshots so that @jagoje and everyone will know what the final outcome will look like.

https://docs.google.com/document/d/10nQeySzggs4ScaoQbrBRg1A8bu5qZtP6pCjRLnuUdHs/edit

I have updated above docs with detailed plan and tentative timeline.

jagoje commented 1 year ago

Thanks Everyone for all the work,

Reviewing this now - much appreciated

bijaySussol commented 1 year ago

Chipping In, something controlling via preference on desktop is been registered issue as well.

So sort of we heading toward a right path. Please consider updating above issue

Thanks

DhanyaHerath commented 1 year ago

Hey team @arjunSussol @sworup @ujwalSussol Thanks so much for that detailed estimate! That was great - so helpful to think through.

Given we don't have specific funding for this, I think we'll have to reduce the scope, so still do this work but:

How does that sound?

ujwalSussol commented 1 year ago

@DhanyaHerath : Agreed. We are ok with your streamed down idea 👍

Discussed with @arjunSussol and @sworup .

DhanyaHerath commented 1 year ago

Fantastic, thank you all! Please use the job code if you are working on this :)

DhanyaHerath commented 1 year ago

@arjunSussol now that you're starting working on this, could you give me a quick estimate of when you think it will be done? Nothing too detailed, just maybe which week we should expect the work done by. Thanks Arjun!

sworup commented 1 year ago

@DhanyaHerath we have hit a potential snag with this issue. The issue is Tonga does not save prescription data (as current kiribati module version does) which means it relies on transactions in the database to get the vaccine name, id etc. This might mean we would only get vax history of current store, which in turn restricts us from check if the vaccine category was dispensed to the client in last X days in all stores.

@arjunSussol is further investigating this but the above conclusion is what it most likely looks like. I would let him finish the investigation before we say it with 100% confidence.

If that is the case, we have 3 options:

  1. Upgrade tonga to use the current mobile version, and update the database data, it will be a lot of syncs but we would get proper vax history and could check to span all stores.
  2. Whenever a vaccine is selected in the final transaction creation phase, as soon as the vax name is selected by the client we do a get request to mSupply which in turn would do a check and return an object with its results (isAllowedToDispense: true/false, numberOfOccurances: 0 or a number, daysChecked: last x days (number)}. This would be the easiest implementation if we absolutely need all store checking but the implications are the feature would no longer be available offline, and there will be a slight delay when user select a vaccine which can be annoying.
  3. Accept that we would not be able to check spanning all stores and only check in current tablet's data.
arjunSussol commented 1 year ago

@DhanyaHerath I am trying to deliver it to you by the end of next week if the progress goes well.

After discussion with @sworup I noticed that we can get vaccination history records from all sites belong to selected current patient. So, no need to worry for now as I am not going to depend on current store data.

Just made a commit which get all vaccination history of selected patient.

sworup commented 1 year ago

Resolved with #5014