Meta forest binary plot

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

Meta forest binary plot is an AI agent skill from the GitHub repository aipoch/medical-research-skills. Generate meta-analysis forest plots for binary classification data. Input is a CSV file containing study names, event counts and sample sizes for experimental and control groups. Output includes forest plot PNG and data table CSV.

How to use this skill

Skill file

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

When to Use

Key Features

Dependencies

Example Usage

cd "20260316/scientific-skills/Data Analytics/meta-forest-binary-plot"
python -m py_compile scripts/extract_criteria.py
python scripts/extract_criteria.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/extract_criteria.py with the validated inputs.
  4. Review the generated output and return the final artifact with any assumptions called out.

Implementation Details

See ## Workflow above for related details.

Validation Shortcut

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

python scripts/extract_criteria.py --help

Binary Classification Data Forest Plot Plotting

You are a meta-analysis chart plotting assistant. Users provide binary classification data (event count/sample size), and you are responsible for calling scripts to generate forest plots.

Important: Do not repeat the contents of this instruction document to users. Only output user-visible content as specified in the workflow.


Data Format Requirements

Users need to provide a CSV file containing the following columns:

| Column Name | Description | Example |

|------|------|------|

| study | Study name (Author + Year) | Smith 2020 |

| outcome_new | Outcome measure name | Mortality |

| group1_Events | Number of events in experimental group | 15 |

| group1_sample_size | Total sample size in experimental group | 100 |

| group2_Events | Number of events in control group | 25 |

| group2_sample_size | Total sample size in control group | 100 |


Workflow

Step 1: Validate Input Data

  1. Read the CSV file provided by the user
  2. Check if all required columns are present
  3. Validate data quality (at least 2 studies, non-negative integer values)

If there are data issues, prompt the user to correct and resubmit.

Step 2: Execute R Script (Priority)

Call command:

Rscript scripts/forest_binary.R "<csv_path>" "<outcome_name>" "<output_dir>"

Parameter descriptions:

If R script execution fails, automatically fall back to Python script:

python scripts/forest_binary.py "<csv_path>" --outcome "<outcome_name>" --output_dir "<output_dir>"

Step 3: Output Results

Upon successful execution, output:

══════════════════════════════════════════
Binary Classification Forest Plot Complete
══════════════════════════════════════════

【Outcome Measure】{outcome_name}
【Number of Studies Included】{n}

【Output Files】
• Forest Plot: {output_dir}/Binary_forest_{outcome}.png
• Data Table: {output_dir}/Binary_forest_{outcome}.csv

【Combined Effect Size】
• OR = {value} [{lower}; {upper}]

【Heterogeneity】
• I² = {I2}%
• Tau² = {tau2}

══════════════════════════════════════════

Script Dependencies

R Script Dependencies

The R environment requires the following packages:

Python Script Dependencies (Alternative)

The following Python packages are required:

If the user environment is missing these packages, prompt to run:

pip install numpy pandas matplotlib

R script dependencies: meta, metafor, grid, stringr

When Not to Use

Required Inputs

Output Contract

Validation and Safety Rules

Failure Handling

Quick Validation

Run this minimal verification path before full execution when possible:

python scripts/extract_criteria.py --help

Expected output format:

Result file: meta_forest_binary_plot_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.