AllenNeuralDynamics / foraging-behavior-browser

Foraging behavior browser (streamlit)
https://foraging-behavior-browser.streamlit.app/
MIT License
2 stars 2 forks source link

Sharing a contextual app #25

Closed hanhou closed 8 months ago

hanhou commented 8 months ago

Using st.query_params, I now make it possible to share a contextual app. Meaning (at least a part of) the context (or "session_state") is now bi-directionally synchronized with the URL. After applying some filters and changes in plot settings, the user can share the URL that comes with all the settings. This becomes a novel way of sharing a data analysis.

Ref: https://blog.streamlit.io/how-streamlit-uses-streamlit-sharing-contextual-apps/

For example, this URL will show exactly the plot below.

https://foraging-behavior-browser.streamlit.app/Old_mice?filter_h2o=HH&filter_session=1.0&filter_session=81.0&filter_finished_trials=825.6&filter_finished_trials=1872.0&filter_foraging_eff=0.793295&filter_foraging_eff=1.2966&filter_task=coupled_block_baiting&filter_photostim_location=None&tab_id=tab_session_x_y&x_y_plot_xname=foraging_eff&x_y_plot_yname=finished_trials&x_y_plot_group_by=h2o&x_y_plot_if_show_dots=True&x_y_plot_if_aggr_each_group=True&x_y_plot_aggr_method_group=linear+fit&x_y_plot_if_aggr_all=False&x_y_plot_aggr_method_all=mean+%2B%2F-+sem&x_y_plot_smooth_factor=5&x_y_plot_if_use_x_quantile_group=False&x_y_plot_q_quantiles_group=20&x_y_plot_if_use_x_quantile_all=False&x_y_plot_q_quantiles_all=20&x_y_plot_dot_size=21&x_y_plot_dot_opacity=0.4&x_y_plot_line_width=3.5&auto_training_history_x_axis=session&auto_training_history_sort_by=progress_to_graduated&auto_training_history_sort_order=descending

image