Skip to content
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

Allow a user to save parameter settings #146

Closed
Mdraugelis opened this issue Mar 20, 2020 · 8 comments · Fixed by #460
Closed

Allow a user to save parameter settings #146

Mdraugelis opened this issue Mar 20, 2020 · 8 comments · Fixed by #460
Assignees
Labels
enhancement New feature or request hospital-request A hospital needs this to make a decision python STAT We need this immediately!!!
Milestone

Comments

@Mdraugelis
Copy link

Mdraugelis commented Mar 20, 2020

Health systems are creating daily reports for multiple hospitals with multiple scenarios. This can take 1 - 2 hours and when done manually increases the risk of error.

A user should be able to save their settings so they can share them with others and reuse them later.

@mdbecker mdbecker added this to Platform 1.0 Fixes (ready) in App Platform Mar 20, 2020
@mdbecker mdbecker added enhancement New feature or request hospital-request A hospital needs this to make a decision python STAT We need this immediately!!! labels Mar 20, 2020
@nickcanz
Copy link
Member

I don't think we're able to do this with the current version of streamlit. There is an open PR on streamlit to add functionality to accomplish this, but it is unmerged: streamlit/streamlit#1169

@jlubken
Copy link
Collaborator

jlubken commented Mar 21, 2020

@Mdraugelis There is a cli that takes a --file option to read settings from a file. It doesn't generate png graphs, but it does output csvs.

@mdbecker mdbecker changed the title Allow a user to save parameter setting as a URL to share Allow a user to save parameter settings Mar 22, 2020
@mdbecker
Copy link
Collaborator

Updated the ticket to make it more about the use case and less about the solution. I'm not sure if this changes anything but please take a second look @nickcanz and @jlubken

@mariekers mariekers moved this from Platform 1.0 Fixes (ready) to Platform (on hold) in App Platform Mar 23, 2020
@mariekers
Copy link
Contributor

This might be more feasible once we move off of streamlit - should we wait for that? we can make a plan on how to switchover once the new tool is decided

@quinn-dougherty quinn-dougherty moved this from Platform (on hold) to CHIME 2.0 (Dash and BE/QA) in App Platform Mar 25, 2020
@quinn-dougherty
Copy link
Collaborator

should export settings.cfg from current state of widgets.

@quinn-dougherty quinn-dougherty added this to the Move to Dash milestone Mar 25, 2020
@pjhoberman
Copy link
Collaborator

Any preference on this being a js or py solution?

pjhoberman pushed a commit that referenced this issue Mar 26, 2020
@pjhoberman pjhoberman self-assigned this Mar 26, 2020
This was referenced Mar 26, 2020
@quinn-dougherty quinn-dougherty moved this from CHIME 2.0 (Dash) to Platform In Progress in App Platform Mar 28, 2020
pjhoberman pushed a commit that referenced this issue Mar 29, 2020
…board. Branch contains infinite loop, DO NOT MERGE
@pjhoberman
Copy link
Collaborator

pjhoberman commented Mar 29, 2020

The branch as pushed does not work, as it has an infinite loop constantly refreshing the charts and overwriting input changes. I need to step away for a bit, but I could use some help. Thanks for everyone who has already chipped in on this issue!

There’s currently an infinite loop that constantly reloads the app, overwriting any changes to the inputs. This happens even if there is not a hash present in the url. I can’t figure out what’s causing it but I figured I’d push this branch in case anyone has bandwidth and ideas.

As far as the actual issue...

I opted to store the params in the url hash as an easy way for users to save a link, send a link, and open a link without any effort, and thereby see the params as saved. It's not the prettiest solution (it's an ugly URL), but I think it's the easiest method for sharing links.

There's a button at the bottom of the sidebar:
image

Clicking that button updates the hash with the new params, like so:
http://0.0.0.0:8050/#market_share=13;susceptible=4119405;known_infected=510;current_hospitalized=14;doubling_time=4;relative_contact_rate=0;hospitalized_rate=2.5;icu_rate=0.75;ventilated_rate=0.5;hospitalized_los=7;icu_los=9;ventilated_los=10;n_days=60;max_y_axis_value=;_as_date-true=on;_show_tables-true=on;_show_tool_details-true=on;_show_additional_projections-true=on;

and also pops up a confirm dialog to see if the user wants to copy that to their clipboard. I did it this way so that they don't accidentally overwrite their clipboard, though there are more elegant ways to do this.

image

If you want to test this locally, after the page loads you have to stop your server, otherwise the infinite loop overwrites your effort. I'll come back to this tonight / tomorrow, but I am stuck on the infinite loop problem.

I would love feedback on the approach itself from anyone who has it!

@quinn-dougherty
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hospital-request A hospital needs this to make a decision python STAT We need this immediately!!!
Projects
App Platform
Platform Done
7 participants