HEGSRR/HEGSRR-Template

template code

Closed this issue · 9 comments

  • replace 01-r_script.r with a markdown template, or possibly include both by having a template that calls this helper R script.
  • include here and functions to set up directory paths.
  • include starter rmarkdown variables / setup
  • create a python jupyter notebook version of the same

Preliminary work done in commit 8209ab8 - soliciting comments.

Good start!

Let's strip out the default content, as I just did in 028ffb4 and add in creation of the main here() paths in both the .rmd and .ipynb ?

Is there a more foolproof option for a jupyter notebook to write environment info as the notebook is run, without requiring folks to remember to run something afterward?

over the next week, can we:

  • include all the other markdown code for an analysis plan into the python notebook template
  • add use of the citation function in R to create a .bib file of citations for all the packages used? This could probably be saved in the compendium root as something like software.bib
  • if there is any analogous function in python to create a bib file based on packages, let's implement that!

@doabell : I'm curious what you think about having a separate environment set-up script / instruction file for python, which would install pipenv, pigar, and pyhere and contain the instructions for cleaning the environment.txt file?

Then the computational environment section of the python notebook would contain the normally-skipped code to 1) install packages using environment.txt and 2) generate the environment.txt, as well as code that will always be run to load packages and set pyhere paths analogous to the R here paths in the rmd template.

Separating these initial installs would declutter the notebook from the one-time tasks of setting up the basic python environment. However, would dividing it up like this make it any more difficult to use services like Binder?

If we split into two, it'd be:

00-Python-environment-setup.py (easier as script or as notebook?)
01-Jupyter_notebook.ipynb

@josephholler Sure, that does indeed makes more sense
00-Python-environment-setup.ipynb would still be a notebook, perhaps with "record" and "install" chunks.

Ok, you can try doing it. I think the record step still needs to be in the main 01-Jupyter_notebook.ipynb notebook, because that is where the packages will be loaded. Also, the package loading makes sense in the main notebook as part of the documentation of the computational environment.

@doabell

Wrapping up some final edits to this template, there are a few more things /w the jupyter notebook:

  • can the title be embedded in the notebook metadata rather than as a header
  • if so, title should be removed from markdown and all other heading levels decreased by 1
  • ideally, separate the markdown into different chunks for each section so that it will be more straightforward to add code chunks in between each section. Use the spielman notebook as an example for natural breaks between chunks.
  • Add an acknowledgement code chunk to the and as I did in the .rmd:
# Acknowledgements

- `Funding Name`: name of funding for the project
- `Funding Title`: title of project grant
- `Award info URI`: web address for award information
- `Award number`: award number

This report is based upon the template for Reproducible and Replicable Research in Human-Environment and Geographical Sciences, DOI:[10.17605/OSF.IO/W29MQ](https://doi.org/10.17605/OSF.IO/W29MQ)

Seems like notebook metadata may not be straightforward... we can pause that thought and the related heading levels.

Done, until there's a neat package for generating a .bib file for python packages used in a compendium.