IMA-WorldHealth / bhima

A hospital information management application for rural Congolese hospitals
GNU General Public License v2.0
216 stars 103 forks source link

Make BHIMA work in a limited offline fashion #5097

Open jniles opened 3 years ago

jniles commented 3 years ago

As we start thinking about deploying in health zones, we will need to be able to support BHIMA on low bandwidth or even offline connections. It would be nice to seamlessly allow our connections to drop and restart, and support certain operations such as "offline mode" for stock management and patient registration.

To do so, we'll probably need to add a manifest file to store the assets. It looks like we may be able to use a gulp plugin to generate this for us automatically.

It may also require (or as an alternative to the above) us to use ServiceWorkers.

Unfortunately, we are really limited by the fact that we are using an ancient Angularjs version here.

jniles commented 3 years ago

To make this more concrete, I should be able to:

  1. Flip a switch on the settings page that says "Go Offline".
  2. Now, my user will be remembered on the local machine. If I try to log out and log back in, it won't look up the user from the backend, it will just use the local user on my machine, provided the username and hash of the password match.
  3. Assets will be loaded from a manifest file, so we shouldn't need an internet connection to get the JS/HTML/etc.
  4. Cached depots will be available to use, you will be able to record stock consumption against that depot by storing it in an offline cache.
  5. When you go "online" the system will check the offline cache queue and ask you if you want to submit that data to the server.
  6. Data will be submitted as normal, checking errors, etc.