New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Time-Use tab (Sebastian) #915
Conversation
In the following locations I fixed the enketo module dependencies that weren't loading - enketo/answer.js - enketo-demographics.js - enketo-trip-button.js - enketo/service.js - time-use/list.js main.js - added time-use as a module dependency index.js - loaded the time use js files - loaded the missing enketo/answer.js file main.html - added time-use button en.json - added time-use text for the time-use button
main.html - Added "main-" to the beginning of "time-use" because it wasn't recognizing the correct angular module state (the text needs to be exactly the same)
@lgharib @TTalex @jf87 is there interest from the rest of the community on a manually entered time-use survey? Would you be interested in co-designing it, or should we go with @asiripanich's thoughts and plans for now? |
@shankari, it would be best to co-design this time-use tab with the community. Here is what we were trying to achieve with the time-use code designed by @MaliheTabasi : Screen.Recording.2022-07-19.at.17.24.40.1.mp4 |
I am getting hung up on the state change between the Enketo Time-Use survey back to the Time-Use screen: Screen.Recording.2022-12-12.at.10.58.36.AM.movHere is what the phonegap server log says when that "Save"/"Next" buttons are pressed: @shankari how does the state change work for the enketo survey stuff? Is there an argument I should be passing to the I also looked and saw that there is an |
@MaliheTabasi I have a couple of thoughts/questions about this design based on our experience with OpenPATH UI design so far.
|
@sebastianbarry you have not yet changed the time use code to use the existing enketo directives. I'm not going to help debug obsolete code, and you should not waste your time on it either. |
Quick note on that subject: the feature doesn't match any current use case from our side. We're not, in fact, big survey users. Following @asiripanich plan sounds good ! |
In order to get familiar with the new Enketo directives, I commented out the It displays correctly inline. It looks like interacting with the Screen.Recording.2022-12-14.at.10.22.24.AM.movI believe I should make an enketo directive for the time-use survey. Probably something like Pros and cons of doing it this way:
|
|
Good eye, it looks like the demographics survey is not working (I had not observed the demographics survey until you pointed this out, but I believe it hasn't been working on this branch yet) Screen.Recording.2022-12-14.at.11.24.51.AM.mov
This makes more sense. So essentially I can create a |
I just reverted my changes and confirmed that the demographics survey is not working with this branch |
@sebastianbarry I don't think you still understand what directives do and might need to continue reading up on them You don't use the directive inside
what error do you see? You need to get it working with the branch before making any additional changes. |
My bad, typo. I meant to say
|
FYI, I just spoke to a deployer who wants to allow people to add "untaken trips" - aka trips that they were not able to take due to lack of mobility options. It sounds like we may be able to reuse the time-use survey to support that - it would just be a different survey popping up when the user clicks on the big green button. |
Right, so does that file exist? If not, you might need to pull from master again. Recall that there is no guarantee that this branch is up to date with master.
Look carefully at the |
Added new directive and files for enketo survey for time use: - timeuse-button.html - timeuse-inline.html - enketo-time-use.js index.html - Added enketo-time-use.js as a script Fixed enketo survey not loading issue (for both timeuse and Demographics): enketoSurveyConfig.json - Removed this file since it is not needed and is not present in the master branch enketoSurveyConfig.json.sample - Added an additional survey pointing at TimeUseSurvey answer.js - Added TimeUseSurvey as an object to the survey list Added the new emission.survey.enketo.time-use module as a dependency: - time-use.js - list.js main.js - Moved the button over so that the Dashboard button is in the middle list.html - Replaced the current launch Survey "+" button with my new directive for the enketo-timeuse
I pushed my commit, the enketo survey has been successfully loaded and successfully comes up and goes away once the user clicks "next". The Demographics survey also works again: Screen.Recording.2022-12-15.at.1.35.17.PM.movNext steps:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and goes away once the user clicks "next".
I don't think that this is the expected behavior. In general, the surveys should go to the next screen when the user clicks "Next", as you might remember from the demographic survey feedback. Please look through the existing surveys and carefully understand how surveys are supposed to behave (including Amarin's video above) before declaring that they work.
enketo-time-use.js - Removed Timeuse-inline directive - Removed Timeuse-inline controller timeuse-button.html - Removed this file since the template is not needed by the directive Also removed the legacy commented code for timeuse-button.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also look into the "next" button and its behavior.
TimeUseSurvey: (xmlDoc) => { | ||
return 'Answered'; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might want to check with @asiripanich on whether we want to pull out some fields to display in the label for this as well (since it will show up in the diary).
* Directive to display a survey for each trip | ||
* Assumptions: | ||
* - The directive is embedded within an ion-view | ||
* - The controller for the ion-view has a function called | ||
* 'recomputeDisplayTrips` which modifies the trip *list* as necessary. An | ||
* example with the label view is removing the labeled trips from the | ||
* "toLabel" filter. Function can be a no-op (for example, in | ||
* the diary view) | ||
* - The view is associated with a state which we can record in the client stats. | ||
* - The directive implements a `verifyTrip` function that can be invoked by | ||
* other components. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change comments.
var populateIdLABEL = function(time) { | ||
var curriedPILABEL = function() { | ||
populateIdLABEL(time); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this a new file that is checked in and how is it different from the www/js/survey//external/time_insert.js
I found that the "next" button is displaying because the KoboToolbox survey is just being generated in a strange way - in my testing I was able to get it to display without the "Next" button without needing to change any code at all: I copied the KoboToolbox survey for the demographics survey to use as a template, and then changed/deleted the questions I needed |
Hi @shankari and @sebastianbarry, here is the PDF of the new time-use UI. |
Recreated time-use survey in Kobotoolbox and added it into the project, contains: - Spanish translations - No "next" button - Proper skip logic
@JGreenlee so the way the config works right now, is that we have a config file for each study/program on GitHub
where should we store these survey links?
So there is a trip confirm survey at
Whether we want to keep this two level design (local config -> URL) or just specify the URL directly in the code so we can get it directly from the dynamic config is something we need to investigate. |
Two big immediate tasks are:
@sebastianbarry and @JGreenlee will figure out who works on what and come back with a design tomorrow. |
@shankari both me and @JGreenlee met after our meeting today to discuss which aspect of this project each of us will work on. We decided
@JGreenlee here is the new branch we can work off of together (I took only the important information from my |
@sebastianbarry you are right that there is a mapping between the survey result and the value to be displayed on the button once the survey is complete. We will have to see if we can include this extraction in the dynamic config file as well so that, again, we don't have to change the code if we need to support new surveys. |
Hi @sebastianbarry, I guess you don't need our time-use kobotoolbox form anymore right? Please let me know if you still want that, I can share with you on Kobotoolbox. |
for surveys going forward: I think we should remove So my suggestion is to do this in two stages:
But also include
|
To try out the trip details survey, change all these locations from
|
Potential future step (2) for #915 (comment) is to actually put in the functionality from the |
So since we are making everything dynamic, we should also convert the
https://github.com/e-mission/nrel-openpath-deploy-configs/blob/main/docs/index.html#L62 |
we should test the trip confirm options and make them dynamic as well. This involves two changes:
|
Consider the following use case:
What could go wrong?
to work:
Question for you: Why not only find the most recent timestamp? Why do we have to load all local labels first, match and then find the most recent instead of the other way around?
we don't just want to find the most recent label |
to adapt this to time-use, I would largely use what we do for mode/purpose/trip-confirm, with the caveat that the matching may need to change slightly because:
|
@shankari and @JGreenlee I have added the the new surveys info/ survey information in the config files how I think they should work, (e-mission/nrel-openpath-deploy-configs#8) please take a look and let me know if there is anything else that should be added, such as:
|
==========================
|
For multi-label, the flow is:
|
@sebastianbarry @JGreenlee I found a non-empty userCache at
Again, this seems to be consistent with https://stackoverflow.com/a/24153116/4040267 You could also look at the logs from Note that they will only be displayed on first install. |
Local database
|
in terms of trip matching or figuring out which entries are currently valid, how will we support edits and deletes in general?
Native approach easy for matching at least:
|
@shankari Here is what I understand concerning uploading the keys Firstly, I know that if we fill out the trip confirm survey, the response is saved on the localdb successfully (and same goes for timeuse survey): Now, in order to upload the localdb to the server manually we must do the following:
The problem I am running into is that I can't press the "End Trip and Force Sync" button on any study/program with
Here is the error message I believe is associated with it: |
@sebastianbarry @JGreenlee, that is a complicated error to debug further/fix. |
@shankari looks like commenting out the I tried this on both our |
@sebastianbarry |
so with the current design of the survey specification, we should also consider where we want to store the data keys.
so if we kept the data key associated with the survey type, then if the user was using a time use, we would need to read We should re-think this approach and potentially store the key in the buttons instead For time-use, this will look like
and for the missing trip, it will look like
We theoretically don't even need to have the survey_data_key - that can be hardcoded in the HTML based on where the button is. So the directive will still take in the key, but when we use the directive, we can pass in If we hardcode the survey_data_key in the HTML, this could be even simpler
and
|
ASSUMPTION: there will only be one kind of trip addition and one kind of place addition per program and if they want multiple types of inputs, they will just use a more complex survey. The advantage of this is that we can hardcode the survey key into the retrieval on both phone and server and not have to test through multiple different config options. |
note also that trip additions are an array.
how do we deal with the matching in this case? my proposal is:
and in the matching, we remove DELETED entries from the array and add new ACTIVE entries to the array we will maintain a local (in-memory) copy of the array in the trip object that we manipulate in addition to storing the data in the usercache.
matching on id:
Potential solutions:
|
On the phone
On the server (KS)
|
Got the basic time use tab working!
Now that it is working at a basic level, Next steps are to make changes to the time use tab to get it working how we want it.
A meeting is scheduled next Monday for this conversation with @asiripanich and @shankari
Testing: