Open shankari opened 3 years ago
One option is to update the confirmed_trip directly while using the manual/ for long-term reproducibility. With this, when the user tries to label a trip, we: a) save it into the manual/ entries on the phone, and b) update the confirmed_trip on the server synchronously
In the common case, where the user does have access to the network, the data is available on the server immediately, and the leaderboard will be updated on the next run. We could even have the "update confirmed_trip` function launch the leaderboard update immediately to see Instant Updates.
In the uncommon case, where the user does not have access to the network, the data is still cached locally and updated when possible. No guarantees about when your updates will make it to the leaderboard in that case.
Right now, user labels are stored in the usercache: multilabel: https://github.com/e-mission/e-mission-phone/blob/master/www/js/survey/multilabel/multi-label-ui.js#L207 enketo-trip-button: https://github.com/e-mission/e-mission-phone/blob/master/www/js/survey/enketo/service.js#L138 so they are basically treated just like location points or motion activity points and are pushed up when the next trip ends but they can be labeled offline as well.
For review: the steps that we need to get the leaderboard to work are:
timeseries
in the moveToLongTerm
matchIncomingLabels
create_confirmed_objects
and create confirmed trips. Cleaned trips without matching labels will still have confirmed trips, but with empty labels.I would suggest looking up the matching pipeline design and really understanding it, and then seeing if there are any timing issue with pushing the data synchronously.
My quick take is that I designed it well enough that there won't be, but we should definitely write out the scenarios and convince ourselves.
Related issue and initial high level design: https://github.com/e-mission/e-mission-docs/issues/476#issuecomment-561727669 The issue also has some other high level designs questions around the mismatch between the trip and section objects which you can keep in mind for a future improvement, but let's focus on trips for now.
Related PR: https://github.com/e-mission/e-mission-server/pull/780
window.cordova....BEMUserCache.putMessage(...
emission/pipeline/intake.py
) takes the raw location points and creates trip objectsI will share:
/bin
, see document in e-mission-docs
repo)Here is how I think the problem looks, using an example of a user who has the app downloaded:
SQLite
database local to the phonestart_location
and points throughout the tripNote: The label hasn't been input yet
trip_ID
The problem being, if they don't have internet conneciton, the leaderboard does not update.
@sebastianbarry as we discussed, I will share:
/bin
, see document in e-mission-docs
repo)Can you let me know when you have labeled your trips and then taken a trip (walk/run/etc) so that we know that the relevant logs will be in the logs that I share?
I have access to the logs and can view them, but I am not entirely sure how to decipher them. When you are available, we should quickly go over how to read the logs, and compare them in order to figure out where the discrepancy (or delay) between labeling trips / the leaderboard score is located
I can also get on this weekend if that would be easier for you! :)
Here is how I think the problem looks, using an example of a user who has the app downloaded:
SQLite
database local to the phonestart_location
and points throughout the tripNote: The label hasn't been input yet
trip_ID
The problem being, if they don't have internet conneciton, the leaderboard does not update.
@sebastianbarry There are some areas where this doesn't work the way that you expect. I think that your expectation is based on how other apps work, but this app doesn't work that way, at least not yet.
usercache/get
calls and caches it locally
the sync mechanism to push data from the phone to the server was really designed for background operation. In order to avoid mucking up the trip end detection on the phone, it pushes data only when there is a completed trip, and that too, only the data upto the completed trip.
This is fine for sensed data, but it has always been a bone of contention about labels - e.g. https://github.com/e-mission/e-mission-docs/issues/351
Although the labels are visible on the phone, people are unhappy about the delay in pushing them to the server. These people include:
The program participants notice it because the labeling rate is on the leaderboard, they update the labels, but the leaderboard doesn't get updated.
There are a couple of potential solutions:
manual/*
entries even though there is no completed trip, since they do not affect trip detection in any wayputOne
method or write something similar to push data directly to the server https://github.com/e-mission/e-mission-server/blob/master/emission/net/api/cfc_webapp.py#L284, which is the earlier https://github.com/e-mission/e-mission-docs/issues/351The second option is definitely the more intuitive to the user, but I am concerned about regressing in terms of robustness. We have been really careful to ensure that users don't require a data plan to use the app in an ongoing fashion - the new approach will mean that they will need to have internet access at any time that they want to label the trips. What if they want to label at a bus stop?
Another option is to use the synchronous option, and fall back to the async if the sync fails. That is great, except for potential timing and ordering issues. What if we had an entry that was stored locally, and then when the user got access to WiFi, they labeled trips before the saved entries were uploaded?
We would mark the incremental processing as done until the synchronous save, and the asynchronously saved entries, which were saved earlier will be lost.
Need to think through how to handle this properly, and should get input on what people expect.