| name | build-a-reproducible-analysis-notebook |
| category | school |
| description | Build a reproducible analysis notebook with pinned inputs, explicit transformations, deterministic execution, validation, and interpretable outputs. Use when research results must be rerunnable and reviewable. |
build-a-reproducible-analysis-notebook
The notebook is evidence only if a clean run reproduces it.
When to use
- Use for coursework, research, audits, experiments, or published analyses.
- Never embed secrets, unauthorized personal data, or unexplained manual edits.
Preconditions
- Define source authority, data rights, environment, expected outputs, review audience, and retention.
Procedure
- Record source versions, checksums, retrieval dates, licenses, schemas, and exclusions.
- Separate immutable raw inputs, cleaning, analysis, charts, and exported artifacts.
- Pin runtime and package versions and document platform dependencies.
- Make parameters, random seeds, time zones, locales, units, and missing-data rules explicit.
- Add assertions for schema, row identity, ranges, joins, denominators, and invariants.
- Explain why each transformation and method supports the question.
- Run top-to-bottom in a clean environment and compare expected hashes or tolerances.
- Export a readable report plus machine-readable environment and validation records.
Failure plan
- If source data cannot be shared, publish a lawful synthetic or access-controlled reproduction path.
- If results vary, identify nondeterminism and report tolerances rather than hiding it.
Worked example
A notebook rebuilds an enrollment chart from a hashed source snapshot, checks student uniqueness and denominators, pins packages, and reproduces its report in a clean environment.
Done
- A notebook repository contains source manifest, code, environment lock, assertions, outputs, and a rerun document
- Clean-run, checksum, schema, invariant, seed, privacy, and output-comparison tests verify reproducibility