dams-mcda / Dams-MCDA

Emma Fox R/Shiny Project with a docker server configuration
1 stars 0 forks source link

Regular user save/Admin user login #70

Closed elbfox closed 4 years ago

elbfox commented 5 years ago

Add login capability (2 types of users: regular and admin - regular can only access what they have saved, admin can access all saved data frames). When user creates account, they will enter their name (required) and a group name (optional). We want the user to have the ability to save their individual and group results within the program after completing Step 3 - Elicit Preferences (and also download them if they want to) and also be able to enter Step 3 with preloaded preferences from a saved data frame that will automatically set the critera toggle bars in the place they should be for the preloaded data; In addition, we need the individual or group data frame to be automatically fed into the MATLAB ranking code when Step 3 is completed (Task 15). We also want the capability for them to select group preloaded preferences for Step 3, which will cause all preferences for that group to be automatically averaged for the pre-load from internal Shiny saved individual user data. For example, if I go in to my account and select Group 1, then my preferences that I saved under Group 1 and the preferences of all other users who entered as Group 1 will be automatically averaged and pre-loaded from internal Shiny saved individual user data into the Step 3 Enter Preferences toggle bars.

Administrator capabilities (saving/using preloaded preferences-->shiny.admin package), regular user capabilities (saving preloaded preferences--> shiny.user package). Here is a helpful article: https://www.r-bloggers.com/user-authentication-in-r-shiny-sneak-peek-of-shiny-users-and-shiny-admin-packages/

sythel commented 5 years ago

The shiny packages in the linked article are not released. We might need to write a users system from scratch. We could use a different web framework to manage the users and database and upon successful login pass the necessary information to the shiny application.

elbfox commented 5 years ago

Well, that's frustrating! This is another option I stumbled upon in researching the subject...seems like it still falls pretty short of what we're hoping for, but their code is released on GitHub, so that's an improvement over nothing. Take a look and let me know if I'm on the right track. I can continue to search for survey-type applications if you think it will help us to piece something together from scratch.

Blog description of the survey tool: Actual GitHub repository: Shiny survey tool:

elbfox commented 5 years ago

I don't know how to do hyperlinks, I guess.

Blog description: https://econometricsbysimulation.shinyapps.io/Survey/ Repository: https://github.com/EconometricsBySimulation/Shiny-Demos/tree/master/Survey Shiny survey tool: https://econometricsbysimulation.shinyapps.io/Survey/

sythel commented 5 years ago

After a quick glance I don't see any authentication on that website or in the source code. In my last comment I provide a possible solution, I suggest we use a different web framework that includes authentication by default ( i recommend Django ).

How this works:

This also covers the need of having an admin interface as that's included in django by default.

elbfox commented 5 years ago

I trust your judgment here. If you think Django is the way to go to address this Task 3, then that's fine with me.

elbfox commented 4 years ago

Added placeholder buttons to ui.R script "Start Here" page to connect to (a) individual user and (b) group path types. Added placeholder button to ui.R script for upload functionality. These changes, made under WSMUpdate_Dams branch, can stay or go as needed.

elbfox commented 4 years ago

Putting this issue on hold until we get the WSM function and corresponding graphs debugged. Debugging needs to be the top priority in case we run out of time for this issue.

sythel commented 4 years ago

Group, Individual, data upload buttons moved to a popup-modal and presented at start of application. added in latest commit to branch SamsUpdate_WSM_fixes

sythel commented 4 years ago

@elbfox are users allowed to create groups or only select from already made groups?

sythel commented 4 years ago

@elbfox see above comment

elbfox commented 4 years ago

Oops! I must have missed this. Let's say already made groups, and start with 5. Can we add more later? I will know next week how many people may be attending the actual workshop, but 5 should be enough to work with at NOAA. @sharonklein if you think this should be more please let me know!

sythel commented 4 years ago

groups can be added/removed in admin interface, just didn't know if users needed an interface. It will save time not making one.

elbfox commented 4 years ago

Sorry, my comment was ambiguous. We do need a user interface. We want a place for individuals to be able to log in, use the app, and save results as an individual to be later added to a group or if they could log back in and add it to a group themselves. Or if an admin could add it to a group. Basically, we want the app to be user-friendly for individuals just using it for any reason, and also to aggregate individual results on a group level for the workshop. Hopefully, this clears things up.

Also, please let me know if this is a huge task...Sharon and I can brainstorm about what we need for 'bare bones' functionality.

elbfox commented 4 years ago

EDIT: This task also requires creating a "save" button for individuals. Just wanted to make that clear. Is this something that is on track? Sharon and I are trying to figure out what is completely and totally essential at this point in time.

sythel commented 4 years ago

save what

elbfox commented 4 years ago

Oh my gosh, I didn't realize that I never answered your question! Individuals need to be able to 'save' their preference inputs somewhere in the app (server?) so that when we log in as a group during the workshop, the app averages all of the individual preference input 'files' or model runs and pre-sets the toggle bars (much like it does when the user uploads preferences). Is this something that can happen? The Group Preference button does not work, so my understanding is that this individual save and averaging function/capability does not yet exist. At this stage (1 week until workshop), is this something that is even feasible?

sythel commented 4 years ago

Its possible I can get group working

group mode application flow:

  1. user selects group mode
  2. input dam preferences
  3. click a button to average input preferences with group preferences? (generate code will fetch avg from scores from db)
  4. save (updates or adds a record of input preferences, which will be included when other group members run)

@elbfox after step 3 for Raw preference scores graphs/tables do we display user input or average of group Raw Preference Score

elbfox commented 4 years ago

Is this flow how it is currently structured? What we're looking for is this:

Individual Mode

  1. User selects individual model
  2. Input dam preferences
  3. Click a button (could be in the multi-dam output step 4, or in its own tab) to save individual preferences.

This 3rd step could average the preferences every time "save" is pressed by different users, or just collect them for later use.

Group Mode

  1. User selects group mode
  2. Individual outputs that have been saved are averaged together (generate code can fetch from db) and show the slider bars in positions that reflect those averaged values (as when uploading prefs)
  3. Group can then accept bar position or move slider bars from that average position before generating new group output. They will need to click "generate" to choose to display the average of the group's raw preference scores, or whatever they decided to enter together.

The idea here in step 3 is that the slider bars act as the starting place for discussion and give us something to fall back on if we can't get everyone to agree on what the values should be for the slider inputs.

sharonklein commented 4 years ago

I would also just mention that it is important to somehow be able to have different groups, so a user can select what group they want to use/join, but that when one individual accesses that group they can never see individual preferences of a different user through that group function - only the average of all individuals in the group, and they won't know who has contributed scores to the average...

Sharon Klein, Ph.D. Associate Professor School of Economics 5782 Winslow Hall, Room 305 University of Maine Orono, ME 04469 207-581-3174 http://umaine.edu/soe/faculty-and-staff/klein/

On Tue, Sep 24, 2019 at 12:07 PM Emma Fox notifications@github.com wrote:

Is this flow how it is currently structured? What we're looking for is this:

Individual Mode

  1. User selects individual model
  2. Input dam preferences
  3. Click a button (could be in the multi-dam output step 4, or in its own tab) to save individual preferences.

This 3rd step could average the preferences every time "save" is pressed by different users, or just collect them for later use.

Group Mode

  1. User selects group mode
  2. Individual outputs that have been saved are averaged together (generate code can fetch from db) and show the slider bars in positions that reflect those averaged values (as when uploading prefs)
  3. Group can then accept bar position or move slider bars from that average position before generating new group output. They will need to click "generate" to choose to display the average of the group's raw preference scores, or whatever they decided to enter together.

The idea here in step 3 is that the slider bars act as the starting place for discussion and give us something to fall back on if we can't get everyone to agree on what the values should be for the slider inputs.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dams-mcda/Dams-MCDA/issues/70?email_source=notifications&email_token=ACB234CCFHODKSEUE7S6HDDQLI3LVA5CNFSM4HWYC642YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7O4ZOY#issuecomment-534629563, or mute the thread https://github.com/notifications/unsubscribe-auth/ACB234BIJLQTVZMDCT37QZ3QLI3LVANCNFSM4HWYC64Q .

sythel commented 4 years ago

save/load works, now onto populating sliders and group averaging

each user only gets two saves; one for individual one for group if they make changes and save it overwrites the save for the current mode (ie group/individual)

@elbfox for loading: what about the case of user re-entering group mode, do we show them the updated average or their only choices for the group

elbfox commented 4 years ago

I think overwriting the save for current mode makes sense. We will want to add a note about it too.

For loading, please use the updated average. When a person logs into group mode, their individual preferences shouldn't be identifiable.

sythel commented 4 years ago

implementation in branch "GroupMode"

launching it to live server also launched on server

"save button"(push changes to server) is in the combined results tab titled "Save Input Preferences"

make sure to clear browser cache as the buttons didn't appear to me at first

sythel commented 4 years ago

added save button style f7f2f7a

elbfox commented 4 years ago

Is this issue closed? Trying to wrap things up on Monday as much as possible.