class: middle, center, inverse # Tips and advice when creating a python software for lab members to use in academia .pull-left[ <img src="images/business-team.jpg" width="70%" style="display: block; margin: auto;" /> ### PyData Global 2021 ] .pull-right[ <img src="images/books.jpg" width="70%" style="display: block; margin: auto;" /> ### Jeremy Selva [
](https://github.com/JauntyJJS) [
](https://www.linkedin.com/in/jeremy-selva-085b9112a/) [
](https://jeremy-selva.netlify.app/) [
](https://twitter.com/JauntyJJS) ] .left[ .footnote[ Images by [Amonrat Rungreangfangsai](https://www.vecteezy.com/members/amy1313) [Xaringan](https://github.com/yihui/xaringan) Slide Template by [Sharla Gelfand](https://github.com/sharlagelfand/sharstudioconf) [
](https://github.com/sharlagelfand) [
](https://sharla.online) [
](https://twitter.com/sharlagelfand) [
](https://www.youtube.com/watch?v=JThd3YYQXGg) ] ] .center[.footnote[https://jauntyjjs.github.io/PyDataGlobal2021Talk [
](https://jauntyjjs.github.io/PyDataGlobal2021Talk/PyDataGlobal2021Talk.pdf)] ] --- ## Introduction It started with a Python script used to organise Mass Spectrometry data for my project. <img src="images/single-python-script.jpg" width="80%" style="display: block; margin: auto;" /> .center[.footnote[https://jauntyjjs.github.io/PyDataGlobal2021Talk [
](https://jauntyjjs.github.io/PyDataGlobal2021Talk/PyDataGlobal2021Talk.pdf)] ] --- ## Introduction Many asked me to troubleshoot R/Python/Bash scripts, created by past collaborators, that were meant to do similar tasks as mine. - *"This script does not work on my computer anymore. I don't know why."* 😵 .pull-left[ <img src="images/many-scripts.jpg" width="80%" style="display: block; margin: auto;" /> ] .pull-right[ <img src="images/overwhelmed.jpg" width="80%" style="display: block; margin: auto;" /> ] .left[.footnote[Images by [Amonrat Rungreangfangsai](https://www.vecteezy.com/members/amy1313)]] .center[.footnote[https://jauntyjjs.github.io/PyDataGlobal2021Talk [
](https://jauntyjjs.github.io/PyDataGlobal2021Talk/PyDataGlobal2021Talk.pdf)] ] --- ## Introduction I combined all these scripts into one Windows executable software in Python called [MSOrganiser](https://github.com/SLINGhub/MSOrganiser). .pull-left[ <img src="images/many-scripts.jpg" width="100%" style="display: block; margin: auto;" /> ] .pull-right[ <img src="images/logo.png" width="60%" style="display: block; margin: auto;" /> .center[ https://github.com/SLINGhub/MSOrganiser ] ] .left[.footnote[Images by [Amonrat Rungreangfangsai](https://www.vecteezy.com/members/amy1313)]] .center[.footnote[https://jauntyjjs.github.io/PyDataGlobal2021Talk [
](https://jauntyjjs.github.io/PyDataGlobal2021Talk/PyDataGlobal2021Talk.pdf)] ] --- ## Introduction Looking back, I realise that things have not been easy... <img src="images/not-easy.jpg" width="50%" style="display: block; margin: auto;" /> .left[.footnote[Images by [Amonrat Rungreangfangsai](https://www.vecteezy.com/members/amy1313)]] .center[.footnote[https://jauntyjjs.github.io/PyDataGlobal2021Talk [
](https://jauntyjjs.github.io/PyDataGlobal2021Talk/PyDataGlobal2021Talk.pdf)] ] --- ## Introduction In academia, most of us are not trained in coding or software development. It is hard for us to write software for our own research paper, it is even more challenging to create software for others to use. .pull-left[ Daniel Lemire’s [blog](https://lemire.me/blog/2012/06/18/on-the-quality-of-academic-software/) <img src="images/Daniel_Lemire_Blog.jpg" width="80%" style="display: block; margin: auto;" /> ] .pull-right[ <img src="images/programming-hard.jpg" width="90%" style="display: block; margin: auto;" /> ] .left[.footnote[Images by [Amonrat Rungreangfangsai](https://www.vecteezy.com/members/amy1313)]] .center[.footnote[https://jauntyjjs.github.io/PyDataGlobal2021Talk [
](https://jauntyjjs.github.io/PyDataGlobal2021Talk/PyDataGlobal2021Talk.pdf)] ] --- ## Introduction In this talk, I decide to share some things that have helped me tremendously. <img src="images/sharing.jpg" width="50%" style="display: block; margin: auto;" /> .left[.footnote[Images by [Amonrat Rungreangfangsai](https://www.vecteezy.com/members/amy1313)]] .center[.footnote[https://jauntyjjs.github.io/PyDataGlobal2021Talk [
](https://jauntyjjs.github.io/PyDataGlobal2021Talk/PyDataGlobal2021Talk.pdf)] ] --- ## 1: Convert scripts to a web service or executable software Users make less error when clicking buttons compared to typing in command lines <img src="images/click-vs-command.jpg" width="90%" style="display: block; margin: auto;" /> .center[.footnote[https://jauntyjjs.github.io/PyDataGlobal2021Talk [
](https://jauntyjjs.github.io/PyDataGlobal2021Talk/PyDataGlobal2021Talk.pdf)] ] --- ## Advice 1 Tips - Chriskiehl's [Gooey](https://github.com/chriskiehl/Gooey) to create a simple GUI interface quickly. - [Pyinstaller](https://www.pyinstaller.org/) to convert the scripts to a stand alone executable program. <img src="images/procedure.jpg" width="80%" style="display: block; margin: auto;" /> .center[.footnote[https://jauntyjjs.github.io/PyDataGlobal2021Talk [
](https://jauntyjjs.github.io/PyDataGlobal2021Talk/PyDataGlobal2021Talk.pdf)] ] --- ## Advice 1 Tips Jack McKew's [blog](https://jackmckew.dev/making-executable-guis-with-python-gooey-pyinstaller.html) helps me make use of the two tools to get what I need. <br> <img src="images/Jack_McKew_Blog.jpg" width="95%" style="display: block; margin: auto;" /> .center[.footnote[https://jauntyjjs.github.io/PyDataGlobal2021Talk [
](https://jauntyjjs.github.io/PyDataGlobal2021Talk/PyDataGlobal2021Talk.pdf)] ] --- ## I forgot about new users <img src="images/software_growth.jpg" width="100%" style="display: block; margin: auto;" /> .left[.footnote[ Baby Dragon by [drawinghowtos.com](https://drawinghowtos.com/baby-dragon-2-7909) Cartoon Hydra by [how-to-draw-cartoons-online.com](https://how-to-draw-cartoons-online.com/cartoon-hydra.html) ] ] .center[.footnote[https://jauntyjjs.github.io/PyDataGlobal2021Talk [
](https://jauntyjjs.github.io/PyDataGlobal2021Talk/PyDataGlobal2021Talk.pdf)] ] --- ## I forgot about new users New users typical reaction to complex program - Scared 🥺 and Confused 😵 - *"Maybe this tool is not for me"* 😂 .pull-left[ <img src="images/cartoon_hydra.gif" width="65%" style="display: block; margin: auto;" /> ] .pull-right[ <img src="images/scared.jpg" width="80%" style="display: block; margin: auto;" /> ] .left[.footnote[ Cartoon Hydra by [how-to-draw-cartoons-online.com](https://how-to-draw-cartoons-online.com/cartoon-hydra.html) Images by [Amonrat Rungreangfangsai](https://www.vecteezy.com/members/amy1313)]] .center[.footnote[https://jauntyjjs.github.io/PyDataGlobal2021Talk [
](https://jauntyjjs.github.io/PyDataGlobal2021Talk/PyDataGlobal2021Talk.pdf)] ] --- ## 2: Give a software overview using cheatsheet <img src="images/my_cheatsheet.PNG" width="60%" style="display: block; margin: auto;" /> .center[.footnote[https://jauntyjjs.github.io/PyDataGlobal2021Talk [
](https://jauntyjjs.github.io/PyDataGlobal2021Talk/PyDataGlobal2021Talk.pdf)] ] --- ## Advice 2 Tips RStudio cheatsheet [examples](https://www.rstudio.com/resources/cheatsheets/) and [template](https://github.com/rstudio/cheatsheets/blob/master/.github/CONTRIBUTING.md) and [advice](https://github.com/rstudio/cheatsheets/blob/master/README.md) .pull-left[ <img src="images/RStudio_cheatsheet_examples.jpg" width="100%" style="display: block; margin: auto;" /> ] .pull-right[ <img src="images/RStudio_cheatsheet.jpg" width="100%" style="display: block; margin: auto;" /> ] .center[.footnote[https://jauntyjjs.github.io/PyDataGlobal2021Talk [
](https://jauntyjjs.github.io/PyDataGlobal2021Talk/PyDataGlobal2021Talk.pdf)] ] --- ## 3: Provide helpful messages when users make a mistake Users and programmers make mistakes sometimes. Software error messages are unavoidable. .pull-left[ <img src="images/unknown_error.jpg" width="90%" style="display: block; margin: auto;" /> ] .pull-right[ <img src="images/hammer-computer.jpg" width="100%" style="display: block; margin: auto;" /> ] .left[.footnote[Images by [Amonrat Rungreangfangsai](https://www.vecteezy.com/members/amy1313)]] .center[.footnote[https://jauntyjjs.github.io/PyDataGlobal2021Talk [
](https://jauntyjjs.github.io/PyDataGlobal2021Talk/PyDataGlobal2021Talk.pdf)] ] --- ## 3: Provide helpful messages when users make a mistake However, if you can make them helpful, it does goes a long way. .pull-left[ <img src="images/helpful_error-2.jpg" width="70%" style="display: block; margin: auto;" /> <img src="images/helpful_error.jpg" width="60%" style="display: block; margin: auto;" /> ] .pull-right[ <img src="images/thumbs-up.jpg" width="100%" style="display: block; margin: auto;" /> ] .left[.footnote[Images by [Amonrat Rungreangfangsai](https://www.vecteezy.com/members/amy1313)]] .center[.footnote[https://jauntyjjs.github.io/PyDataGlobal2021Talk [
](https://jauntyjjs.github.io/PyDataGlobal2021Talk/PyDataGlobal2021Talk.pdf)] ] --- ## Advice 3 Tips .pull-left[ Saadia Minhas' [blog](https://uxplanet.org/how-to-write-good-error-messages-858e4551cd4) provides some good tips <img src="images/saadia-minhas-blog.jpg" width="90%" style="display: block; margin: auto;" /> ] .pull-right[ Micheal Lynch's [tip](https://mtlynch.io/code-review-love/) to show openness to criticism <img src="images/michael-lynch-blog.jpg" width="100%" style="display: block; margin: auto;" /> ] .center[.footnote[https://jauntyjjs.github.io/PyDataGlobal2021Talk [
](https://jauntyjjs.github.io/PyDataGlobal2021Talk/PyDataGlobal2021Talk.pdf)] ] --- ## 4: Include necessary software reports to show reliability Academia journals are getting more demanding with regards to software, wanting reusability besides reproducibility. .pull-left[ <img src="images/nature-reusable-1.jpg" width="90%" style="display: block; margin: auto;" /> ] .pull-right[ <img src="images/nature-reusable-2.jpg" width="100%" style="display: block; margin: auto;" /> ] https://www.nature.com/articles/s43588-021-00109-9 .center[.footnote[https://jauntyjjs.github.io/PyDataGlobal2021Talk [
](https://jauntyjjs.github.io/PyDataGlobal2021Talk/PyDataGlobal2021Talk.pdf)] ] --- ## Advice 4 Tips Tag a label on different software version and encourage users to cite not just the software name but the version number as well. <img src="images/github-tag-release.jpg" width="60%" style="display: block; margin: auto;" /> .center[.footnote[https://jauntyjjs.github.io/PyDataGlobal2021Talk [
](https://jauntyjjs.github.io/PyDataGlobal2021Talk/PyDataGlobal2021Talk.pdf)] ] --- ## Advice 4 Tips Create a report file/table (pdf or excel) that store the user's input parameters .pull-left[ <img src="images/report-MSOrganiser.jpg" width="90%" style="display: block; margin: auto;" /> ] .pull-right[ Chris Moffitt's [example](https://pbpython.com/pdf-reports.html) using WeasyPrint <img src="images/report-Chris-Moffitt.jpg" width="90%" style="display: block; margin: auto;" /> Matt Clarke's [example](https://practicaldatascience.co.uk/data-science/how-to-create-pdf-reports-in-python-using-pandas-and-gilfoyle) using Gilfoyle <img src="images/report-Matt-Clarke.jpg" width="90%" style="display: block; margin: auto;" /> ] .center[.footnote[https://jauntyjjs.github.io/PyDataGlobal2021Talk [
](https://jauntyjjs.github.io/PyDataGlobal2021Talk/PyDataGlobal2021Talk.pdf)] ] --- ## Advice 4 Tips Show pre-processing results to explain how the software calculate the final results. They are helpful when there is a need to troubleshoot for logical errors <img src="images/normArea.jpg" width="80%" style="display: block; margin: auto;" /> .center[.footnote[https://jauntyjjs.github.io/PyDataGlobal2021Talk [
](https://jauntyjjs.github.io/PyDataGlobal2021Talk/PyDataGlobal2021Talk.pdf)] ] --- ## My documentation issue I started my documentation by trying to follow some advice provided by Lee's [article](https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1006561) <img src="images/documentation-beginning.jpg" width="60%" style="display: block; margin: auto;" /> .center[.footnote[https://jauntyjjs.github.io/PyDataGlobal2021Talk [
](https://jauntyjjs.github.io/PyDataGlobal2021Talk/PyDataGlobal2021Talk.pdf)] ] --- ## My documentation issue As my documentation starts to get longer and more complex, people find it hard to understand. .pull-left[ <img src="images/documentation-confused.jpg" width="100%" style="display: block; margin: auto;" /> ] .pull-right[ <img src="images/documentation-confused-2.jpg" width="100%" style="display: block; margin: auto;" /> ] .left[.footnote[Images by [Amonrat Rungreangfangsai](https://www.vecteezy.com/members/amy1313)]] .center[.footnote[https://jauntyjjs.github.io/PyDataGlobal2021Talk [
](https://jauntyjjs.github.io/PyDataGlobal2021Talk/PyDataGlobal2021Talk.pdf)] ] --- ## 5: Organise your documentation into specific structures Thankfully, I came across DIVIO [website](https://documentation.divio.com/) that encourages me to split my documentations into manageable categories. <img src="images/documentation-table.jpg" width="60%" style="display: block; margin: auto;" /> .center[.footnote[https://jauntyjjs.github.io/PyDataGlobal2021Talk [
](https://jauntyjjs.github.io/PyDataGlobal2021Talk/PyDataGlobal2021Talk.pdf)] ] --- ## 5: Organise your documentation into specific structures Following in its footsteps, this is what I come up with <img src="images/documentation-cleanup.jpg" width="50%" style="display: block; margin: auto;" /> .left[.footnote[Images by [Amonrat Rungreangfangsai](https://www.vecteezy.com/members/amy1313)]] .center[.footnote[https://jauntyjjs.github.io/PyDataGlobal2021Talk [
](https://jauntyjjs.github.io/PyDataGlobal2021Talk/PyDataGlobal2021Talk.pdf)] ] --- ## Advice 5 Tips .pull-left[ Tutorial: Github README <img src="images/documentation-readme.jpg" width="100%" style="display: block; margin: auto;" /> ] .pull-right[ How To Guide: Cheatsheet <img src="images/documentation-cheatsheet.jpg" width="100%" style="display: block; margin: auto;" /> ] .center[.footnote[https://jauntyjjs.github.io/PyDataGlobal2021Talk [
](https://jauntyjjs.github.io/PyDataGlobal2021Talk/PyDataGlobal2021Talk.pdf)] ] --- ## Advice 5 Tips .pull-left[ Explaination: User Documentation <img src="images/documentation-user-documentation.jpg" width="100%" style="display: block; margin: auto;" /> ] .pull-right[ Reference: Developer Documentation <img src="images/documentation-developer-documentation.jpg" width="100%" style="display: block; margin: auto;" /> ] .center[.footnote[https://jauntyjjs.github.io/PyDataGlobal2021Talk [
](https://jauntyjjs.github.io/PyDataGlobal2021Talk/PyDataGlobal2021Talk.pdf)] ] --- ## Take Home Advice:<br>Create a software that gives a lasting impact. .pull-left[ <img src="images/help-people.jpg" width="100%" style="display: block; margin: auto;" /> ] .pull-right[ - The main purpose for creating a software is not to make us popular, it is to **help others with their problems**. - A problem no matter how small can be as annoying as big ones - The more annoying the problem the software tries to solve, the more useful it is. ] .left[.footnote[Images by [Amonrat Rungreangfangsai](https://www.vecteezy.com/members/amy1313)]] .center[.footnote[https://jauntyjjs.github.io/PyDataGlobal2021Talk [
](https://jauntyjjs.github.io/PyDataGlobal2021Talk/PyDataGlobal2021Talk.pdf)] ] --- ## Take Home Advice:<br>Create a software that gives a lasting impact. .pull-left[ <img src="images/help-people-2.jpg" width="100%" style="display: block; margin: auto;" /> ] .pull-right[ - Don't feel discouraged when you are tasked to create a tool that does small and simple things. - Instead "do (these) small things with great love." -- *Saint Teresa of Calcutta* - "If you can impact a few people deeply, they will just shout from the rooftops for you. The breadth of the impact will be a matter of time". -- *Yihui Xie* [blog](https://yihui.org/en/2018/08/influence-depth-or-breadth/) <img src="images/Yihui_Xie_Blog.jpg" width="100%" style="display: block; margin: auto;" /> ] .left[.footnote[Images by [Amonrat Rungreangfangsai](https://www.vecteezy.com/members/amy1313)]] .center[.footnote[https://jauntyjjs.github.io/PyDataGlobal2021Talk [
](https://jauntyjjs.github.io/PyDataGlobal2021Talk/PyDataGlobal2021Talk.pdf)] ] --- ## All the best... .pull-left[ Review of advice - Convert scripts to a web service or executable software. - Give a software overview using cheat sheets. - Provide helpful messages when users make a mistake. - Include necessary software reports to show reliability. - Organise your documentation into specific structures. Take home advice - Create a software that gives a lasting impact. ] .pull-right[ <img src="images/that-is-all.jpg" width="100%" style="display: block; margin: auto;" /> ] .left[.footnote[ Images by [Amonrat Rungreangfangsai](https://www.vecteezy.com/members/amy1313) [Xaringan](https://github.com/yihui/xaringan) Slide Template by [Sharla Gelfand](https://github.com/sharlagelfand/sharstudioconf) [
](https://github.com/sharlagelfand) [
](https://sharla.online) [
](https://twitter.com/sharlagelfand) [
](https://www.youtube.com/watch?v=JThd3YYQXGg) ] ] .center[.footnote[https://jauntyjjs.github.io/PyDataGlobal2021Talk [
](https://jauntyjjs.github.io/PyDataGlobal2021Talk/PyDataGlobal2021Talk.pdf)] ]