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

Ability to export resulting notebook to file (jl, html) #2

Open
eford opened this issue Nov 11, 2021 · 0 comments
Open

Ability to export resulting notebook to file (jl, html) #2

eford opened this issue Nov 11, 2021 · 0 comments

Comments

@eford
Copy link

eford commented Nov 11, 2021

I'm thinking about using Pluto for report generation. Basically, there would be a template notebook. For each new report (say each day), we'd load the template notebook, update a few variables, let PlutoRESTClient take care of updating things, store some outputs, and then export jl and/or html versions of the resulting Pluto notebook. On "good days", people would quickly view the html version including visualizations of the outputs and verify that everything went ok. But if they ever wanted to dig into what happened, then they could open the Pluto notebook from the html and jump right into data analysis.

nb = PlutoNotebook("MyTemplateNotebook.jl")  # Open template notebook with PlutoRESTClient

# Set some variables specific to this report
input_file = joinpath(data_path,string(today()),"inputs.csv")
output_file = joinpath(data_path,string(today()),"outputs.csv")
output_notebook_html = joinpath(data_path,string(today()),"report.jl")
output_notebook_html = joinpath(data_path,string(today()),"report.html")

# Set variables in notebook, update notebook, and get results (assumed to be in df_output)
results = nb(; report_date=today(), input_file=input_file ).df_output

# Write output data to table
CSV.write(output_file, results)

# Export resulting Pluto notebook
PlutoRESTClient.save(output_notebook_jl,nb)

# Export html version of notebook using PlutoSliderServer 
# Would provide both pretty report and ability to dive into notebook when needed using PlutoSliderServer
PlutoSliderServer.export_notebook(output_notebook_jl)

# or maybe the previous two steps could be merged like
export_notebook(output_notebook_html, nb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant