Clinic sample size

From aipoch/medical-research-skills · View interactive version

Clinic sample size is an AI agent skill from the GitHub repository aipoch/medical-research-skills. Unified tool for calculating sample sizes for Diagnostic, Efficacy, Etiology, and Prognosis clinical studies. Supports various statistical methods (Sensitivity/Specificity, Log-rank, Chi-square, EPV, etc.).

How to use this skill

Skill file

Source: https://github.com/aipoch/medical-research-skills

When to Use

Key Features

Dependencies

Example Usage

See ## Usage above for related details.

cd "20260316/scientific-skills/Others/clinic-sample-size"
python -m py_compile scripts/main.py
python scripts/main.py --help

Example run plan:

  1. Confirm the user input, output path, and any required config values.
  2. Edit the in-file CONFIG block or documented parameters if the script uses fixed settings.
  3. Run python scripts/main.py with the validated inputs.
  4. Review the generated output and return the final artifact with any assumptions called out.

Implementation Details

Validation Shortcut

Run this minimal command first to verify the supported execution path:

python scripts/validate_skill.py --help

Clinic Sample Size Calculator

This skill integrates sample size calculations for four major types of clinical research: Diagnostic, Efficacy, Etiology, and Prognosis.

Output

The calculation results are saved as Markdown files in the output/ directory by default. The file path is returned in the JSON output.

You can specify a custom output directory using --output_dir.

Usage

The skill is executed via the scripts/main.py script. The first argument specifies the study type: diagnostic, efficacy, etiology, or prognosis.

Optional Metadata

You can add study information to the report using:

1. Diagnostic Studies

Calculates sample size for sensitivity/specificity, AUC, Kappa, or multivariable models.

Example: Sensitivity/Specificity (Full Params)

python scripts/main.py --study_name "New Biomarker Study" --outcome "Sensitivity > 0.8" diagnostic sens_spec --se 0.8 --sp 0.9 --error 0.05 --prev 0.3 --dropout 0.1

Example: Sensitivity/Specificity (Smart Inference)


# Only providing study name/outcome, tool infers se=0.85, sp=0.90, prev=0.5, etc.
python scripts/main.py --study_name "Screening Test" --outcome "Diagnosis" diagnostic sens_spec

2. Efficacy Studies

Calculates sample size for randomized controlled trials (RCTs) or single-arm studies.

Input: JSON string or file.

Example: Two-arm General (Smart Inference)


# Infers MeanT=0.5, MeanC=0 (Medium effect size), St=1, Sc=1
python scripts/main.py --study_name "Drug Trial" --outcome "Pain Score" efficacy --input '{"study_type": "general", "design": "two"}'

3. Etiology Studies

Calculates sample size for cohort/case-control studies.

Example: Categorical (Smart Inference)


# Infers Pt=0.2, Pc=0.1 (RR=2.0)
python scripts/main.py --study_name "Risk Factor Study" etiology --mode categorical

4. Prognosis Studies

Calculates sample size for prediction models or prognostic factors.

Example: Prediction Model (EPV)


# Infers P=0.1 (Event rate), training_rate=0.7
python scripts/main.py prognosis epv --variables_number 10

When Not to Use

Required Inputs

Recommended Workflow

  1. Validate the request against the skill boundary and confirm all required inputs are present.
  2. Select the documented execution path and prefer the simplest supported command or procedure.
  3. Produce the expected output using the documented file format, schema, or narrative structure.
  4. Run a final validation pass for completeness, consistency, and safety before returning the result.

Output Contract

Validation and Safety Rules

Failure Handling

Quick Validation

Run this minimal verification path before full execution when possible:

python scripts/calculators.py --help

Expected output format:

Result file: clinic_sample_size_result.md
Validation summary: PASS/FAIL with brief notes
Assumptions: explicit list if any

Deterministic Output Rules

Completion Checklist

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.