EECA-NZ / eeud-dashboard

Energy End-Use Database dashboard built with Quarto and Shiny for Python
MIT License
1 stars 0 forks source link

Implement data view download buttons #3

Closed ThomasHP-EECA closed 4 months ago

ThomasHP-EECA commented 4 months ago

Download buttons need to be implemented for each of the explore, time series, and data pages. They should sit below the filters in the sidebars of these pages, and return as csv file.

ThomasHP-EECA commented 4 months ago

Download buttons had been previously attempted, but the functionality of these buttons was not solved. They attempted to use py shiny to access the dataframes returned by the reactive functions explore_eeud_filtered(), chronistic_eeud_filtered(), and data_eeud_filtered(), respectively.

The download button is rendered with the code: @render.ui def render_explore_download_button(): btn_class = 'btn-secondary' return ui.download_button(id="exploredownload", label="⭳", class=btn_class)

This attempt to utilise the button was unsuccessful: @reactive.effect def explore_download(): input.explore_download() with reactive.isolate(): yield explore_eeud_filtered().to_csv()

Error: "Missing download" when hovering over the button. Relevant documentation: https://shiny.posit.co/py/api/core/render.download.html

ThomasHP-EECA commented 4 months ago

Thanks @Achieeca for implementing this!