Experiment detail comparator

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

Experiment detail comparator is an AI agent skill from the GitHub repository aipoch/medical-research-skills. Compare experimental method details between two Zotero PDF papers, identify protocol differences (ratios, dosages, timing, conditions), search supporting literature to explain why they differ, and generate an HTML report. Use when you need a parameter-level comparison of two methods and evidence-bac

How to use this skill

Skill file

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

Validation Shortcut

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

python scripts/compare_methods.py --help

Experiment Detail Comparator

When to Use

Use this skill when you need to:

  1. Compare two papers that apply the same or highly similar experimental method (e.g., CRISPR editing, ELISA, Western blot, synthesis protocol).
  2. Identify parameter-level differences in protocols (concentration, ratio, dosage, temperature, duration, incubation, buffer composition, instrument settings).
  3. Explain why protocols differ by searching additional references and extracting evidence-backed rationales.
  4. Produce a structured, shareable HTML comparison report for collaborators, lab records, or reproducibility audits.
  5. Standardize method extraction into machine-readable JSON for downstream analysis (QA, meta-analysis, protocol harmonization).

Key Features

Dependencies

Runtime (Python)

Core libraries / modules

Optional but recommended

Install optional dependencies:

pip install "pdfplumber>=0.10.0" "PyPDF2>=3.0.0" "requests>=2.31.0"

External tools / services

https://www.ncbi.nlm.nih.gov/books/NBK179288/

Environment variables (recommended)

Set in Notes/.env:

Example Usage

End-to-end run (recommended)

Compare two papers by Zotero search terms:

python run_comparison.py \
  "CRISPR-Cas9 knockout in HeLa cells" \
  "Efficient genome editing in HEK293 cells" \
  ./output

Compare two papers by Zotero attachment keys:

python run_comparison.py \
  ABCDEFGHIJKLMNOPQRSTUVWXYZ123456 \
  ZYXWVUTSRQPONMLKJIHGFEDCBA654321 \
  ./output

Compare two local PDFs:

python run_comparison.py \
  ./paper1.pdf \
  ./paper2.pdf \
  ./output

Expected outputs (in ./output):

Manual workflow (script-by-script)

1) Find items in Zotero and resolve PDF attachments

result1 = mcp__zotero__zotero_search_items(query="paper 1 title or author", limit=5)
item_key1 = result1[0]["key"]

result2 = mcp__zotero__zotero_search_items(query="paper 2 title or author", limit=5)
item_key2 = result2[0]["key"]

children1 = mcp__zotero__zotero_get_item_children(item_key=item_key1)
attachment_key1 = [c for c in children1 if c.get("type") == "application/pdf"][0]["key"]

children2 = mcp__zotero__zotero_get_item_children(item_key=item_key2)
attachment_key2 = [c for c in children2 if c.get("type") == "application/pdf"][0]["key"]

2) Retrieve PDFs (local cache first, download if needed)

python scripts/get_zotero_pdf.py "$ATTACHMENT_KEY1"
python scripts/get_zotero_pdf.py "$ATTACHMENT_KEY2"

3) Convert PDFs to Markdown

python scripts/convert_pdf_to_markdown.py "PATH_TO_PDF1" "temp/paper1.md"
python scripts/convert_pdf_to_markdown.py "PATH_TO_PDF2" "temp/paper2.md"

4) Extract comprehensive method details to JSON

python scripts/extract_method_section.py temp/paper1.md temp/paper1_method.json
python scripts/extract_method_section.py temp/paper2.md temp/paper2_method.json

5) Compare extracted methods

python scripts/compare_methods.py temp/paper1_method.json temp/paper2_method.json output/comparison.json

6) Search literature for explanations (per major difference)

python scripts/search_explanations.py output/comparison.json output/explanations.json

7) Generate HTML report

python scripts/generate_html_report.py \
  temp/paper1_method.json \
  temp/paper2_method.json \
  output/comparison.json \
  output/explanations.json \
  output/comparison_report.html

Implementation Details

1) Method extraction schema (what is captured)

The extraction step aims to produce a structured JSON object per paper with:

2) Optional enhancements

A) Extract tables directly from PDF

Use when parameters are primarily in tables (common in materials lists, primer tables, buffer recipes):

python scripts/extract_pdf_tables.py paper.pdf output/tables.json

Output includes detected table types (e.g., materials/parameters/results) and normalized JSON rows.

B) Download and parse full PDFs (URL or local)

Use when you need full-text parsing, DOI detection, or multi-language handling:

python scripts/download_full_pdf.py https://example.com/paper.pdf ./downloads
# or
python scripts/download_full_pdf.py ./local/paper.pdf ./parsed

Features:

3) Comparison logic (protocol diff)

compare_methods(...) identifies differences across normalized fields and produces:

Example comparison table structure:

| Parameter | Paper 1 | Paper 2 | Difference |

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

| Reagent concentration | 10 mM | 20 mM | 2× higher in Paper 2 |

| Temperature | 37°C | 25°C | 12°C lower in Paper 2 |

| Duration | 2 h | 4 h | 2× longer in Paper 2 |

4) Literature search and explanation synthesis

For each significant difference, the skill builds targeted queries such as:

Supported sources (depending on your toolchain availability):

The output is an explanation object per parameter with:

5) Evidence grading rubric

Each explanation is graded:

6) HTML report generation

The report includes:

Primary output file:

Supporting outputs:

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/compare_methods.py --help

Expected output format:

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