Batch Cohort Analysis (batch-cohort)
Turns one validated analysis template into N variable-swapped R/Python scripts across exposure × outcome pairs, then aggregates everything into a summary results matrix.
Data & AnalyticsAdvanced★ 320⑂ 77AI score 8/10Last updated: Sep 29, 2026
What it does
- Reads a validated analysis script (or a template type such as
nhis_cohort,cross_national,survey_weighted) and identifies the slot variables to swap: EXPOSURE_VAR, OUTCOME_VAR, codings and labels. - Takes an exposure/outcome spec (inline list, CSV file, or the
allkeyword for every pairwise combination), builds a combination matrix, then emits one script per combination plus arun_all.Rmaster runner. - In
execute/fullmode it runs the batch, logs failed combinations with reasons, and aggregatessummary_matrix.csv,subgroup_matrix.csv, and an optional effect-size heatmap. - Enforces epidemiology guardrails: drop self-adjustment when the exposure is also a covariate, mandatory survey-weighted analysis, EPV (≥10 events per covariate) check, Bonferroni column when >5 combinations, physician-diagnosis in outcome definitions, data SHA256 in the README, and explicit hypothesis-generation (anti-p-hacking) framing.
- Cross-national mode produces paired Korea/US scripts and a direction-agreement column.
Who it's for
- Medical and public-health researchers working with KNHANES, NHANES, NHIS, or any cleaned cohort file.
- PIs and graduate students who want to systematically explore many exposure–outcome hypotheses with one fixed methodology.
- Research teams standardizing a single reproducible statistical pipeline across many analysts.
Example uses
- Point it at KNHANES
HN18.csvplus a validated script and run six exposures (depression, obesity, smoking, heavy drinking, low income, low education) against diabetes infullmode. - Run Korea (KNHANES) and US (NHANES) side by side for 3 exposures × 3 outcomes (diabetes, hypertension, metabolic syndrome) to get nine paired cross-national scripts.
- On an NHIS sample cohort, generate
code_onlyscripts for AF / heart failure / COPD / CKD against all-cause mortality, cardiovascular death and stroke, then review before executing.
· · · Install guide · · ·
Try it now, no install
Paste this into Claude to use the skill without installing anything.
Read the instructions in this file and follow them to help me: https://raw.githubusercontent.com/Aperivue/medsci-skills/HEAD/skills/batch-cohort/SKILL.md What I want: (describe your task here)
If Claude can't open the link, open it yourself and paste the contents instead.
↓ If it works for you, download the ZIP below and install it. Then it runs on its own — no pasting each time.
Install in the Claude app (no terminal)
- Download the ZIP with the button below.
- In Claude, open Settings → Capabilities and turn on 'Code execution and file creation'. (one time)
- Go to Customize → Skills → + → 'Upload a skill' and upload the ZIP.
Install in Claude Code
Let Claude do it — paste this into Claude Code
Install the skill I found on Claude Skill Mart. Copy the skills/batch-cohort folder from the GitHub repo Aperivue/medsci-skills into my ~/.claude/skills/batch-cohort/. When it's done, tell me in one line what this skill can do.
Install with a command instead
git clone https://github.com/Aperivue/medsci-skills.git && mkdir -p ~/.claude/skills && cp -r medsci-skills/skills/batch-cohort ~/.claude/skills/⚠ This is a third-party skill. Check the source repository before installing.
- Open a terminal and move to the folder where you keep repos.
- Clone the repository:
git clone https://github.com/Aperivue/medsci-skills.git - Create the skills directory:
mkdir -p ~/.claude/skills - Copy the skill in:
cp -r medsci-skills/skills/batch-cohort ~/.claude/skills/ - Also copy the companion skills (
analyze-stats,replicate-study,cross-national,make-figures,write-paper) so the referenced workflows and the code-quality gate work. - Restart Claude Code, type
/batch-cohort, and supply: data path(s), template path or template type, exposure/outcome lists, and mode (code_only/execute/full). - Make sure R or Python is installed (e.g. the R
surveypackage for weighted analysis) if you want actual batch execution rather than code generation only.
View source on GitHub ↗License: MIT