SciOps from ReproNim
Yaroslav O. Halchenko
@yarikoptic
@yarikoptic@fosstodon.org
Center for Open Neuroscience
Department of Psychological and Brain Sciences
Center for Cognitive Neuroscience
Dartmouth College
New Hampshire, USA
Live slides/
Sources
:
http://datasets.datalad.org/repronim/artwork/talks/webinar-2024-reproflow/
Acknowledgments
From
"What is Reproducibility"
by DN Kennedy.
---- # Ultimate Goal/Approach Reproducibility should become merely a *feature*
(if not a side-effect) of the *results*
AKA "Reproducible by Design"
# But HOW? ---- ## Introducing SciOps: Aim for Level 4 
From
"A Maturity Model for Operations in Neuroscience Research"
, 2023 by Erik C. Johnson, ..., Dimitri Yatsenko
https://arxiv.org/abs/2401.00077v1
---- ## Level 4: Scalable — Introducing SciOps
Levels 4 and 5 transform research operations by adopting technologies for **automation, scalability, and efficient collaboration**. We collectively refer to these methodologies as SciOps, aligning with the principles of other successful “Ops” disciplines in the technology industry: DevOps, DataOps, and MLOps.
From
"A Maturity Model for Operations in Neuroscience Research"
, 2023 by Erik C. Johnson, ..., Dimitri Yatsenko
https://arxiv.org/abs/2401.00077v1
---- # Where do we start? ---- ## HOWTO: Guiding principles - Be greedy - get as much as possible (even if you think you don't need it ATM) - Be lazy - manually do as little as necessary - Be not special - do not come up with *your ways* ---- ## HOWTO: Guiding principles - Be ~~greedy~~ thorough - get as much as possible (even if you think you don't need it) - know what you are going to do and what you have done: - **automate provenance information collection** - Be ~~lazy~~ efficient - manually do as little as necessary - **automate as much as feasible** - achieve more than originally planned - Be ~~not special~~ ~~academic~~ formal - do not come up with *your ways* - **use standardized approaches** - become efficient collaborator ---- ## One more: Pareto Principle  more: https://en.wikipedia.org/wiki/Pareto_principle
# What about a Recipe? I was told that my Lasagna would be as great if I just follow the recipe... liers ---- ## Recipe of a Study - **Ingredients**: - humans (100% of *effort*) - computers (0% of *effort*) - language(s) (100% of the *result*) - English/... (human -to- human) - programming/scripting languages (human -to- computer) - standards (human/computer -to- computer/human) note: - automate: use language(s) to make computers (not humans) do boring stuff - human-to-human languages aren't good for automation ---- ## ❮Languages-Rant❯ Part of the prior webinar "Reproducible Execution of Data Collection/Processing"
- Video: https://youtu.be/dwBtrpI2iS0 - Slides: https://datasets.datalad.org/repronim/artwork/talks/webinar-2020-reprocomp/#/4/2
### Main take away: Embrace standards ## ❮/Languages-Rant❯ ---- ## Recipe of a Study - **Ingredients**: - humans (100% of *effort*) - computers (0% of *effort*) - language(s) (100% of the *result*) - English/... (human -to- human) - programming/scripting languages (human -to- computer) - standards (human/computer -to- computer/human) - **Steps**: - **humans**: plan the study ahead (**Science!**) - **humans and computers**: do data collection/processing (**SciOps!**) note: - automate: use language(s) to make computers (not humans) do boring stuff - human-to-human languages aren't good for automation ---- ### Currently Dominant Recipe Effort Proportions
- **Steps**: - **humans**: plan the study ahead (<20% effort) - **(a good number of) humans and (some) computers**:
do data collection/processing (>80% effort) ---- ### Target Recipe Effort Proportions **Prove Pareto to be *wrong***
**and that we can avoid wasting our effort** - **Steps**: - **humans**: plan the study ahead (>80% effort) - **(some) humans and (many) computers**:
automated data collection/processing (<20% effort)  ---- ### Recipe Steps&Ingredients for Planing Ahead (>80% effort)  ---- ### Humans: Plan Ahead (>80% effort) - Plan to be ~~greedy~~ thorough - plan for **all** [5 ReproNim steps](http://5steps.repronim.org) (including *do-ing* analyses etc.) - prepare to be (ab)used ([Halchenko&Hanke, 2015](http://dx.doi.org/10.1186/s13742-015-0072-7)) - be ~~lazy~~ **efficient** and learn from/(re)use work of others - improve your study workflow SciOps - check webinar from
Dec 2, 2022 by Keith Bush
- **choose an RDM (Research Data Management) platform/approach** - decide how to *log* what you will have done - **aim to collect rich(er) datasets** - Pre-register - treat it as a checklist (now) and a "regression-test" (later) - Prepare/train humans to "talk" to computers - [ReproNim Training](https://www.repronim.org/teach.html) - Listen to and/or participate in [BrainHacks](https://brainhack.org/tutorials.html) - [DataLad Handbook](http://handbook.datalad.org) notes: - nothing is "final" until ... virtually never
# Plan Ahead: Choose an RDM ----  ---- ### Plan Ahead: YODA  https://github.com/myyoda/poster/
by Michael Hanke (CP7, DataLad) et al. ---- ### Plan Ahead: YODA's Layout  ---- ### Plan Ahead: YODA's Hierarchy  https://github.com/ReproNim/containers/ ---- ### Fact: ~~No~~Everybody should care about YODA  https://fmriprep.org by Russ Poldrack (CP5*, OpenNeuro), et al. ---- ### Plan Ahead: More on YODA via DataLad  http://handbook.datalad.org/en/latest/basics/basics-yoda.html ---- ### Plan Ahead: More on DataLad and Its Automations [](https://www.youtube.com/watch?v=Mkb7qpYaL7o)
[distribits 2024](https://distribits.live). Yaroslav O. Halchenko. "What's in the DataLad sandwich" AKA DataLad "ecosystem": - Video: https://www.youtube.com/watch?v=Mkb7qpYaL7o - Slides: https://datasets.datalad.org/centerforopenneuroscience/talks/2024-distribits-datalad.html
---- ### Plan Ahead: DataLad or not but ... - become friends with YODA and its principles - choose an RDM platform/approach which - tells you what you have done to obtain result X - knows where you have or can get data Y (of exact version Z) - **minimizes %effort** to re-run desired steps as-is or modified - works well with your *analytics* platforms - extra: allows you to search for data, results, etc - to find other *nominally similar*
# Plan Ahead:
aim to collect rich(er) datasets ---- ## Plan Ahead: automate collection of any relevant (meta)data in standard form Re *automate*: - manual data entry/wrangling = hard to trace/fix data bugs - we must be efficient: - facilitate human/computer -to- computer/human interactions - we are not unique: (ab)use existing solutions - seek for longer term low %effort solutions Re *any relevant*: - of cause there is a trade-off - prepare to be (ab)used - ~~others~~ you could find (meta)data relevant to their study missing - more of explained variance = higher power - new explanations of "noise" regularly emerge - have data ≠ have to analyze all data Re *standard form*: - without it - **high %effort** for a human/computer to understand it
## Plan Ahead: Collect DICOMs (not NIfTI, PAR/REC, ...) - DICOMs contain lots of relevant metadata - most of the contained metadata is not relevant to your study - Conversion from DICOMs to BIDS could be automated - You should be able to - extract additional metadata happen you need it - reconvert if the conversion tool was buggy ---- ### Plan Ahead: HeuDiConv/ReproIn - **HeuDiConv** (https://github.com/nipy/heudiconv) - A flexible scriptable (Python) framework for conversion from DICOMs into an arbitrary layout - Uses [dcm2niix](https://github.com/rordenlab/dcm2niix/) by ReproNim Guru Chris Rorden for basic DICOM -> NIfTIs conversion - BIDS-aware and comes with a collection of conversion heuristics ---- ### Plan Ahead: HeuDiConv/ReproIn - **ReproIn** (https://github.com/repronim/reproin) - A convention for organizing and naming sequences on the scanner console - BIDS-like - **very low %effort to "adopt"** - HeuDiConv heuristic to convert from such convention to BIDS - Can be used to retroactively "map" into ReproIn (see
reproin/issues/18
) - Prototype
reproin
script provides higher level functionality: study-create, study-convert, study-show, ... ---- ### CRON Job: reproin lists-update-study-shows 
More about our setup at https://github.com/ReproNim/reproin/tree/master?tab=readme-ov-file#complete-setup-at-dbic
---- ### Plan Ahead: use ReproIn Convention  ---- ### ReproIn Convention: Use ReproIn-namer by Will Foran
Use/contribute back: https://github.com/NPACore/reproin-namer
---- ### Plan Ahead: ReproIn or not but automate conversion to BIDS! - *Taking Control of your DICOM Data: ReproIn/Heudiconv Tools* webinar https://www.repronim.org/webinar-series.html - Consider using reproin helper to streamline handling of multiple studies - If not ReproIn, consider - https://github.com/brainlife/ezbids (Pestilli, Brainlife, CP6*) - https://bids.neuroimaging.io/benefits.html#converters ...
## Plan Ahead: Get your ~~greedy~~ thorough hands on Phantom QA Data ### Surprise: Phantom QA data can explain (some)
variance in your data!
(Operation code-name: ReproPhantom (?)) ---- ### FYI: Study "Nuisance"  Cheng CP and Halchenko YO. A new virtue of phantom MRI data: explaining variance in human participant data (v1; under peer review). F1000Research 2020, 9:1131 https://doi.org/10.12688/f1000research.24544.1 Full slide stack: http://datasets.datalad.org/centerforopenneuroscience/nuisance/presentations/2020-NNL/ GitHub: https://github.com/proj-nuisance/nuisance ---- ### What we know: Phantoms are good for scanner QA  https://www.dartmouth.edu/dbic/research_infrastructure/qualityassurance.html and the variance is largely "noise", right? ---- ### Model: Phantom SNR "explained"  ---- ### Model: Phantom SNR (variables)  ---- ### But why do we care about "noise?"  ---- ### Plan Ahead: Talk to your MR physicist/technician - they better be doing QA - do not discard phantom data - can come handy - improve you power - possibly help to harmonize across sites - **ultra low %effort** to keep phantom data around - **∞ %effort** to recover when deleted - **small %effort** to make use of it - concern: dates are "sensitive data"
## Plan Ahead: Physiological data ### Let's streamline acquisition of physiological data
(Operation code-name: ReproPhys) ---- ### Others Planned it already: [phys2bids](https://github.com/physiopy/phys2bids/)  A nice overview: [OHBM 2020 poster](https://cdn-akamai.6connex.com/645/1827//phys2bids_OHBM_15922384856589877.pdf) ---- ### Others Planned it already: [bidsphysio](https://github.com/cbinyu/bidsphysio)  HeuDiConv support PR: https://github.com/nipy/heudiconv/pull/446 ---- ### Plan Ahead: Consider collecting physiological data - benefits are known - improve power of your studies - tools for conversion/slicing are available - relatively high **%effort** at the moment to setup/do - pales in comparison to other **%effort**s spent
## Plan Ahead: Automate collection of all related metadata (audio/video stimuli, events) (Operation code-name: ReproFlow) ---- ### ReproFlow: MRI Experiment *Flow  ---- ### ReproFlow: Used Standards/Technologies  ---- ### ReproFlow: Projects  ---- ### ReproFlow: Projects
- **ReproStim** - capture audio and video stimuli - **ReproEvents** - capture behavioral events from participants - **Con/noisseur** - capture and QA operator input at the scanner console - **ReproMon** - online operator feedback and alerts in case of incidents or anomalous metadata input ---- ### Let's collect all video and audio stimuli as presented to the participants
(Operation code-name: ReproStim)    ---- ### But WHY/What For? - QA (was there a jitter/dropped stimuli/randomization...)? - make it possible to forward model **any** collected dataset - *resting state folks - see previous sections* - explain low level signal features (/confounds?) - post-hoc salience features analysis - **100% reproduce experiment stimulation at ≈0% effort** ---- ### Plowing Ahead: https://github.com/ReproNim/reprostim - Goal: **0% effort** for "clients" - Minimal **%effort** to setup - Fully seamless and automated after that - HOW: - [Video](https://www.amazon.com/gp/product/B00BLZDY6A/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1)/Audio splitters - Video/Audio grabber, e.g. [Magewell USB Capture DVI Plus](https://www.amazon.com/gp/product/B01MSDFAO5/) - A new video file upon connect/change of resolution
(e.g., `2020.11.24.12.57.08_2020.11.24.15.51.23.mkv` ) - Synchronization: - NTP where possible
(stimuli delivery computer, video grabber, ...) - video stream QR time-stamping and detection/decoding - Automated data synchronization/transfer using
git-annex assistant
- Target: Automated "slicing" of audio-video into BIDS datasets
### ReproFlow: Projects  ---- ## Plan Ahead: Events description ### Automate collection of all events information in consistent machine-readable form
(Operation code-name: ReproEvents)  ---- ### ReproEvents: Two approaches for Current Design hardware   - MicroPython board+code: collect events on 932 or Birch via AUX Port - Native Birch device "tune up"
**Disclaimer**: we have no affiliation or commercial interest in the curdes business
---- ### ReproEvents: Birch Response collector
- https://www.curdes.com/birch-optical-interface-unit.html - Contains Raspberry PI running [RaspberryPi](https://wiki.debian.org/RaspberryPi) - we installed NTP client to sync the clock - Uses Python to run the GUI and record responses - we patched to record events as JSON records:  ---- ### ReproFlow: Projects  ---- ### Let's inform Experimenter about ongoing Repro-activities
(Operation code-name: ReproMon)  ---- ### ReproMon: Monitor the humans and hardware Information/alert feedback for Researcher/MRI tech.  ---- ### ReproFlow: Take home summary
- We are working on automation of collection of audio/video stimuli and responses/events timing and alignment them into BIDS datasets - Sample collation of data are available from https://github.com/ReproNim/reproflow-data-sync - Many components are ready for deployment by enthusiasts - Coming: simplified installation on (Neuro)Debian-based systems - Visit our exhibit table and poster on ReproFlow at OHBM 2024
## Plan Ahead (the 80%): Summary - Plan to be ~~greedy~~ thorough - plan for **all** [5 ReproNim steps](http://5steps.repronim.org) (including *do-ing* analyses etc.) - be ~~lazy~~ efficient and (re)use work of others - **choose an RDM for your SciOps** - decide how to *log* what you will have done - **aim to automate collection of rich(er) datasets** - collect phantom data - consider adopting elements of ReproFlow - Be ~~not special~~ ~~academic~~ formal - **learn about and reuse existing standards and study workflows**
# Reproducible Execution of Data Processing (the 20%) Becomes more feasible with increased automation,
good RDM, and good (human- AND machine-) readable *logging*. ---- ## The ultimate do it (the 20%) - **(some) humans and (many) computers**:
automated data collection/processing (<20% effort) - data collection - QA - pre-processing - analysis - publication composition - also automate as much as possible by tuning prior stages - keep in mind/plan for: - pipelines are great, but could be tricky. Use pre-crafted: - MRIQC, fMRIPrep, C-PAC, ... - having a small number of modular steps allow for "ad-hoc" pipelining (minimal script etc) - containers can help to collaborate/scale/debug/... ---- ### SciOP: ReproYODA with [ReproNim/containers](https://github.com/ReproNim/containers/#a-typical-workflow)  ---- ### SciOP: ReproYODA with [ReproNim/containers](https://github.com/ReproNim/containers/#a-typical-workflow)  ---- ### ReproYODA Log  ---- ### Ultimately - many computers  *Version control your data and computation using containers, DataLad and ReproMan, and reproducible they be!*
https://www.repronim.org/webinar-series.html ---- ### More on ReproMan [](https://www.youtube.com/watch?v=P0SOGt3xWmw)
[distribits 2024](https://distribits.live). Joe Wexler: fMRI Pipelines on HPC with DataLad and ReproMan - Video: https://www.youtube.com/watch?v=P0SOGt3xWmw
YODA style OpenNeuro Derivatives from CP5* OpenNeuro
Explore/obtain yourself from
https://github.com/OpenNeuroDerivatives
## Welcome https://github.com/con/duct  ---- ## duct as a runner within datalad containers-run
---- ## Try duct for your SciOps!
## Final Take Home Message ### Embrace SciOps - Be ~~greedy~~ thorough - get as much as possible (even if you think you don't need it) - know what you are going to do and what you have done: - **automate provenance information collection** - Be ~~lazy~~ efficient - manually do as little as necessary - **automate as much as feasible** - achieve more than originally planned - Be ~~not special~~ ~~academic~~ formal - do not come up with *your ways* - **use standardized approaches** - become efficient collaborator ---- # Thank you! ## Establish your SciOps and ### Let the reproducibility be with you
Slides: https://github.com/ReproNim/webinar-2024-reproflow