<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/the-gold-standard-of-data-science-project-management/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://towardsdatascience.com/the-gold-standard-of-data-science-project-management-13d68c9e85d6?source=rss-459e62b88a2a------2"> Stories by Matt.0 on Medium</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<h3>The “Gold Standard” for Data Science Project Management</h3>
<p>The inspiration for this post came most recently from a <a rel="nofollow" href="https://divingintogeneticsandgenomics.rbind.io/talk/2018-uf-talk/" target="_blank">slide-deck</a> by <a rel="nofollow" href="https://twitter.com/tangming2005" target="_blank">Ming Tang</a>, a Bioinformatician at Harvard, and a new <a rel="nofollow" href="https://leanpub.com/universities/courses/jhu/cbds-organizing" target="_blank">Chromebook Data Science course</a> offered by <a rel="nofollow" href="https://twitter.com/jtleek" target="_blank">Jeffery Leek</a> from John Hopkins University.</p>
<p>However, this has been a topic I’ve been thinking about for some time. A number of other great resources I’d read in the past (<a rel="nofollow" href="http://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1000424" target="_blank">1</a>,<a rel="nofollow" href="https://nicercode.github.io/blog/2013-04-05-projects/" target="_blank">2</a>,<a rel="nofollow" href="http://lab.loman.net/2014/05/14/how-i-start-a-bioinformatics-project/" target="_blank">3</a>,<a rel="nofollow" href="https://www.biostarhandbook.com/" target="_blank">4</a>) inspired me to create a <a rel="nofollow" href="https://github.com/moldach/project-directory" target="_blank">Github repo</a> for a <strong>Gold Standard </strong>workflow for setting up a new data science project directory.</p>
<figure><img alt="" src="https://i2.wp.com/cdn-images-1.medium.com/max/1024/1*H0UYSwR2ku3I5Y9FPLi40g.png?w=456&ssl=1" data-recalc-dims="1"></figure>
<p><a rel="nofollow" href="https://twitter.com/JennyBryan?ref_src=twsrc%5Egoogle%7Ctwcamp%5Eserp%7Ctwgr%5Eauthor" target="_blank">Jenny Bryan,</a> a statistician and data-scientist from UBC, who has strong views on the <a rel="nofollow" href="https://www.youtube.com/watch?v=7oyiPBjLAWY" target="_blank">proper layout of R scripts</a>, <a rel="nofollow" href="https://speakerdeck.com/jennybc/zen-and-the-art-of-workflow-maintenance" target="_blank">workflows</a> and file organization/naming, said it best:</p>
<figure><img alt="" src="https://i1.wp.com/cdn-images-1.medium.com/max/1024/1*Hj2-9NO6gxK8SMaepNlPHQ.jpeg?w=456&ssl=1" data-recalc-dims="1"><figcaption><a rel="nofollow" href="https://twitter.com/dguarch/status/663049353007931392" target="_blank">Image Source</a></figcaption></figure>
<p>Leek has talked about the Duke scandal (along with <a rel="nofollow" href="http://www.biostat.jhsph.edu/~rpeng/" target="_blank">Roger Peng</a> and <a rel="nofollow" href="http://rafalab.github.io//" target="_blank">Rafa Irizarry</a>) on the <a rel="nofollow" href="https://simplystatistics.org/2012/02/27/the-duke-saga-starter-set/" target="_blank">simplystats</a> blog in the past so it wasn’t surprising that it also made it into his course. For those of you who don’t want to watch the presentation “<a rel="nofollow" href="http://videolectures.net/cancerbioinformatics2010_baggerly_irrh/" target="_blank">The Importance of Reproducible Research in High-Throughput Biology: Case Studies in Forensic Bioinformatics</a>” I’ll give the <a rel="nofollow" href="https://en.wikipedia.org/wiki/Coles_Notes" target="_blank">Coles Notes </a>version (but I warn you, you’re missing out!).</p>
<p>Researcher’s from Duke university published a study on using personalized-genomics for patient-specific chemotherapy treatment. Two researchers, <a rel="nofollow" href="https://www.nytimes.com/2011/07/08/health/research/08genes.html" target="_blank">Baggerly and Coombes</a>, from MD Anderson requested the data and code. It took many months of back-and-forth (<em>hounding</em>) to actually get the data and code — when they did it was disorganized and poorly documented. Baggerly and Coombes eventually found an error in the code, showing it actually put patients at risk, leading to a major lawsuit and terminated clinical trials.</p>
<p>As an aside, the reluctance to share data is, sadly, still prevalent today. Case in point, the now infamous <a rel="nofollow" href="https://www.nejm.org/doi/full/10.1056/NEJMe1516564" target="_blank">“Research Parasite” editorial</a> published by the New England Journal of Medicine, a leading journal in the field. I’m also including screen-shots I saved from some unknown graduate student’s frustration tracking down data/code (source unknown — sorry I forgot).</p>
<figure><img alt="" src="https://i0.wp.com/cdn-images-1.medium.com/max/588/1*JUARL4oLZPrpULemtyndpQ.png?w=456&ssl=1" data-recalc-dims="1"></figure>
<p>I know that some scientists will skim the abstract of a manuscript first but my stamp-of-approval is a <strong>Reproducibility Statement </strong>with all of the (<em>r</em>a<em>w</em>) data and code available. If you don’t see something like this RUN!</p>
<figure><img alt="" src="https://i2.wp.com/cdn-images-1.medium.com/max/720/1*9K-IBNKS42lR3LOuNKlAow.jpeg?w=456&ssl=1" data-recalc-dims="1"></figure>
<p>Failure to make your project reproducible is <strong>academic misconduct </strong>and can have serious repercussions. It was one of the charges (“<strong>failure to properly document and preserve research results</strong>”), among many others, for the recently <a rel="nofollow" href="https://www.cnn.com/2018/09/20/health/brian-wansink-retractions-resignation-misconduct-bn/index.html" target="_blank">disgraced Cornell researcher Brian Wansink</a> (I’m not saying it’s worse than the p-hacking allegations but I refuse to say it’s any better either). This <a rel="nofollow" href="https://www.divio.com/blog/documentation/" target="_blank"><em>excellent </em>post on a <strong>Gold Standard </strong>for software documentation</a> by Daniele Procida sums it up nicely when he says:</p>
<blockquote><p>“It doesn’t matter how good your software is, because <strong>if the documentation is not good enough, people will not use it</strong>.</p></blockquote>
<blockquote><p>Even if for some reason they have to use it because they have no choice, without good documentation, they won’t use it effectively or the way you’d like them to.”</p></blockquote>
<p>So follow the sage advice of Mr. Procida and make it effortless for others to understand what you did in your project and reproduce those results. It’s essential for collaborating with colleagues in the present and also for posterity’s sake (<em>e.</em>g. your future-self when you’re asked to re-run an analysis 6-months down the road or for any other researcher wishing to revisit your work). Leek considers it important enough to suggest that you “<strong>budget 10–20% of the time you will be working on a data science project just to organizing and documenting your work.”</strong></p>
<p>Since my <a rel="nofollow" href="https://github.com/moldach/project-directory" target="_blank">Github repo</a> already addresses the <strong>Gold Standard </strong>for setting up folders in your data science project (*please star the repo as I plan on updating and improving it in the coming days*) I’ll talk about another important aspect of data science project management, which is:</p>
<figure><img alt="" src="https://i2.wp.com/cdn-images-1.medium.com/max/399/1*7HHA_UkjUK7wp7qP4CYu1g.png?w=456&ssl=1" data-recalc-dims="1"></figure>
<h3>File Naming</h3>
<p>Jenny Bryan gives three key principles of file naming for data science projects.</p>
<ol>
<li>Machine readable</li>
<li>Human readable</li>
<li>Plays well with default ordering</li>
</ol>
<p>For machine readability we want to <strong>avoid spaces, punctuation, periods and any other special characters (except _ and -)</strong>.</p>
<figure><img alt="" src="https://i2.wp.com/cdn-images-1.medium.com/max/855/1*M-nHs3nLYph0zpMScavLRw.png?w=456&ssl=1" data-recalc-dims="1"></figure>
<p>For human readability you want to give files meaningful names. When naming R objects there is a tendency to abbreviate object names, this is okay as long as you include a comment. For example, that the cv_perf_recall_rf was the calculation for the validate recall of each cross-validation fold of a random forest model.</p>
<pre>cv_perf_recall &lt;- cv_prep_rf %>%<br> mutate(validate_recall = map2_dbl(validate_actual, validate_predicted, ~recall(actual = .x, predicted = .y)))</pre>
<p>However, when were naming files I would caution against acronyms unless absolutely necessary and, if so, including that information in the README file.</p>
<p>The next piece of advice is to place dates and number in the beginning of the file name. Always use the ISO8601 date format (yyyy-mm-dd) and left-pad numbers with zeros. The maximum number of digits will be determined by how many files you may generate. Say you expected to save 100 structural MRI image files then it should look like this 001_T1_mri.nii.gz. Say you thought you would actually generate 1000 files then it would look like this 0025_T1_mri.nii.gz.</p>
<h3>Taking A Contrarian Stance</h3>
<figure><img alt="" src="https://i0.wp.com/cdn-images-1.medium.com/max/1024/1*JRJe_ZSoYz9tBDrVuYaFRg.jpeg?w=456&ssl=1" data-recalc-dims="1"></figure>
<p>Leek also says you should avoid case sensitivity, for example Esophageal-Cancer_Report.md is obviously a horrible filename (my fingers hurt from all the extra key-strokes <img alt="😫" src="https://s.w.org/images/core/emoji/2.4/72x72/1f62b.png" class="wp-smiley">) but suggest that esophageal-cancer_report.md is superior.</p>
<p>Respectfully I have to disagree with him here. Personally I find <a rel="nofollow" href="https://en.wikipedia.org/wiki/Camel_case" target="_blank">camelCase</a> aesthetically pleasing esophagealCancer_report.md looks much more pleasant to me and it doesn’t come with the risks that Leek mentions; as long as don’t forget to include the -iname flag to ignore case insensitivity with the find command in linux. If you’re forgetful, or just efficient (<em>i.</em>e. lazy), you could always just include this as an alias in your .bashrc file <img alt="🤷" src="https://s.w.org/images/core/emoji/2.4/72x72/1f937.png" class="wp-smiley"></p>
<p>Making your file name start with a capital letter is obviously a bad idea as it causes you to add additional key strokes to generate the capital letter (<em>e.g.</em> Shift +