Cht-core: Separate training data from real data

Created on 3 May 2016  Â·  18Comments  Â·  Source: medic/cht-core

Analytics needs to filter out training data from dashboards, and webapp needs an easy way to delete training data.

We could tag training data when it's created with a training/practice/dummy field, which analytics could filter on, and the webapp could make a couch view with it for easy deletion.

In terms of UX, we could have a training mode toggle in the settings, which sets the whole app in training mode, and when you're done, you toggle out of training mode, click the "Delete training data" button, and you're done.
Would also be nice to see easily whether you're in training mode, so CHPs know if they can go crazy or not. We could have a banner across the top of the page for instance, like: "You are in training mode (What does this mean?)"
Also nice, display a little icon on training docs, so that CHPs know they'll be disappearing later.

@michaelkohn @btbonval

waiting for design Feature

Most helpful comment

I think that's still doable. We still have two local databases, one which replicates to the server and one which doesn't. Something like...

  1. Phone starts in production mode and replicates everything from the server as per usual
  2. User selects "training mode"
  3. A medic-training db is created on the phone
  4. All the data in medic is replicated to medic-training (local, so should be fast)
  5. The user can do whatever in medic-training and nothing is sent to the server or back to medic locally
  6. When the user deactivates training mode the medic-training db is deleted to free up space
  7. The user can go back to training mode again whenever they like

All 18 comments

I'm fine if each form has a training field which is true/false. That's easy to operate on. We'd need to create a new version of every form with the new field, of course.

There were some alternatives brought up of labeling the CHP Area itself as training, which gets associated with each form's json metadata. I could also operate on that in analytics, but I don't know if that is useful for mobile targets or filtering out of webapp views.

@btbonval points out that "deletion happens haphazardly and there are problems with CHWs syncing in staggered way after training", and so that "it'd be cleaner to filter data at all levels" (i.e. hide the training docs from the UI when you're not in training mode) "and delete whenever is convenient" later.

Other thought : the phones need to be notified when we get in/out of training mode.
Put training_mode as a field in app_settings, and it'll trigger a ddoc change, so phones will know.

"Starting next week, LG will be training users in batches, meaning we could have 2-3 different groups within a branch with different training dates and different cut-off dates for data deletion." (@sglangevin)

So we need more granularity : whole app in training mode is not enough, branch in training mode is not enough... We'd need each user in training mode.

How's that, even better :

  • Two servers, lg.app vs lg-training.app
  • Add a hidden toggle in android app to switch from one to the other

    • only known to the tech people, not the CHPs

    • Actual URLs/passwords are not visible or editable, just display “training” vs “real”

  • App now has two pouchdbs, so you’ll have to first-load both on each phone. But the training data should be small enough, and can be wiped regularly.
  • Admins log in to two different urls, lg.app or lg-training.app.
  • Display "You are in training app", with a colorful banner, across every page, so that people are not too confused.

@estellecomment would that ensure that any form submitted in training mode but not synced prior to the switchover to non-training mode would be tagged correctly? That's been the challenge we keep running into as we discuss the options. Ideally, when you log into lg.app, the app would also log you into lg-training.app and load the forms there.

How would the switchover work? Would it need to replicate? Or would we be able to set a time for everyone in a certain group so that training mode would shut off on the phone? The hours immediately before and immediately after the switchover have been the challenge we keep needing to solve for.

So, it would be two completely separate apps, side by side on the phone. There wouldn't be any tagging, it would be like using lg vs lg-testing, they're separate.

So you'll need to replicate the two, yes. Which is twice as much pain, yes. When the tech people first load the phones, they log into both, and load both.

Switching over can be done by pressing a button somewhere, ideally by the tech people at LG.
We could also have a timer instead, I suppose. But how big of a problem is it for techs to flip the switch after the training is done?

We decided on the iteration call today that we will have another instance just for training, then users will download the dev android app _and_ the LG app. When training is finished the dev app will be uninstalled.

In the dev app, you have to enter the URL for the server, right? That means giving the admin credentials to the LG techs. Do they already have them anyway?

No, you just enter the URL then log in as the user. We'll just need to create users in 2 places, but that should be a small amount of effort.

@estellecomment Now that we have a lg-training instance we no longer need this?

@garethbowen @estellecomment I think we should either open a new issue or keep this one open. Training on 2 apps is a good short-term solution but in the long-term it would be better to do as Estelle describes in the top comment - have a training mode within the production app that can be switched on and off.

There are a number of considerations here as we'll need to find a way that is easy for IT staff or managers to switch on and off but is also very clear to CHPs. Maybe we should move this to Needs Design Work? Or we could open a new issue for design work. cc @diannakane

What if... the app started up in training mode which creates a local db which never syncs to the server. Then when you switch out of training mode the local db is deleted and a fresh local db is created which then replicates all the data? You could then go back in to training mode at any time.

I think ideally the data would all be replicated at once, and training mode could be switched on and off. That way we avoid having to download lots of data on dodgy connections, which would be the case if we had to replicate during or after training. We should be downloading data centrally, before training, so that phones are loading over a stronger internet connection.

I think that's still doable. We still have two local databases, one which replicates to the server and one which doesn't. Something like...

  1. Phone starts in production mode and replicates everything from the server as per usual
  2. User selects "training mode"
  3. A medic-training db is created on the phone
  4. All the data in medic is replicated to medic-training (local, so should be fast)
  5. The user can do whatever in medic-training and nothing is sent to the server or back to medic locally
  6. When the user deactivates training mode the medic-training db is deleted to free up space
  7. The user can go back to training mode again whenever they like

SG!
UI needs to be really clear about when you're in training mode otherwise people will be confused as hell.

@SCdF please close or schedule before the end of this sprint. See triaging old issues.

We've solved this for the last 6 months or so with no obvious complaints from partners. While we could fix this in a cooler way it doesn't seem necessary right now. Closing.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

abbyad picture abbyad  Â·  3Comments

garethbowen picture garethbowen  Â·  4Comments

abbyad picture abbyad  Â·  4Comments

alxndrsn picture alxndrsn  Â·  6Comments

garethbowen picture garethbowen  Â·  5Comments