# Lab 1: Reproducible Computing Setup
This repository contains a reproducible patient-data analysis for Lab 1, it was taken from the Week 3 Week 3 Practical — Starter Notebook (Jupyter)file but repurposed for Python. The analysis is implemented in Python with Conda/Mamba and in base R with renv. A Docker container reproduces the Python analysis.
## Project structure
hds-practical/
├── README.md
├── AI\_USAGE.md
├── .gitignore
├── environment.yml
├── renv.lock
├── Dockerfile
├── src/
│ ├── analysis.py
│ └── analysis.R
├── data/
│ └── .gitkeep
└── renv/
  └── activate.R
## Analysis
The project uses a small de-identified toy dataset of five patients with patient ID, age, and study site (DC, MD, or VA). Both scripts calculate descriptive age statistics, mean age by site, patient counts by age group, and mean/minimum/maximum age by site.
Expected results:
Overall mean age: 54.6
Mean age by site:
DC: 50.5
MD: 50.0
VA: 72.0
Patient count by age group:
0-40: 1
41-60: 2
61-80: 2
Generated CSV outputs are written to data/ and are ignored by Git because they can be recreated by rerunning the scripts.
## Python workflow
Create and activate the environment:
mamba env create -f environment.yml
mamba activate hds-lab1
Run the analysis:
python src\analysis.py
Python reproducibility test performed:
mamba deactivate
mamba env remove -n hds-lab1 -y
mamba env create -f environment.yml
mamba activate hds-lab1
python src\analysis.py
The recreated environment produced the same results.
## R workflow
The R script uses base R functions. Restore and run the R project:
R
Then, in R:
r
renv::restore()
source("src/analysis.R")
R reproducibility test performed:
rmdir /s /q renv\library
R
Then, in R:
r
renv::restore(prompt = FALSE)
renv::status()
source("src/analysis.R")
The restored project produced the same results.
## Docker workflow
Docker Desktop must be running.
Build the image:
docker build -t hds-lab1:1.0 .
Run the container:
bat
docker run --rm hds-lab1:1.0
The container runs `src/analysis.py` and produces the same patient summary as the native Python environment.
\## AI assistance
See \[AI\_USAGE.md](AI\_USAGE.md) for the detailed record of AI use, verification steps, and corrections.