Adverse event narrative

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

Adverse event narrative is an AI agent skill from the GitHub repository aipoch/medical-research-skills. Generates CIOMS I-compliant ICSR narratives from adverse event case data for FDA and EMA regulatory submission. Includes temporal analysis, MedDRA coding, causality assessment using WHO-UMC or Naranjo criteria, and multi-format output.

How to use this skill

Skill file

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

Adverse Event Narrative Generator

Quick Check

Use this command to verify that the packaged script entry point can be parsed before deeper execution.

python -m py_compile scripts/main.py

Audit-Ready Commands

Use these concrete commands for validation. They are intentionally self-contained and avoid placeholder paths.

python -m py_compile scripts/main.py
python scripts/main.py --help
python scripts/main.py --help
python scripts/main.py --validate-only --help

Workflow

  1. Collect case data: Receive adverse event case data including: patient demographics, medical history, concomitant medications, suspect drug(s) with dosing, adverse event description, diagnostic results, treatment, dechallenge/rechallenge dates, outcome, and causality assessment.
  2. Validate completeness: Check that required CIOMS I fields are present (case ID, patient age/sex, suspect drug, AE with MedDRA PT, dates). Flag missing fields.
  3. Checkpoint: Display case summary and list of missing fields to user. Confirm whether to proceed with partial data or wait for complete information.
  4. Reconstruct timeline: Analyze temporal relationships: time to onset, dechallenge response, rechallenge response, temporal plausibility with known drug profile.
  5. Generate narrative: Compose CIOMS I-compliant narrative in all 10 standard sections (demographics → causality assessment). Use objective, factual language; reserve opinion for causality section only.
  6. Checkpoint: User reviews draft narrative for clinical accuracy and verifies that no patient identifiers remain.
  7. Format output: Generate in requested format (CIOMS I, ICH E2B R3, FDA MedWatch 3500A). Apply MedDRA coding.
  8. Fallback: If case data is too incomplete for narrative generation, output a structured checklist of required fields with example entries and a partial narrative for completed sections only.

Overview

Regulatory-grade narrative generation tool that transforms adverse event case data into CIOMS-compliant ICSR narratives suitable for submission to FDA, EMA, and other health authorities.

Key Capabilities:

When to Use

Core Capabilities

1. CIOMS I Narrative Structure

Generate standardized sections per CIOMS guidelines:

from scripts.narrative_generator import NarrativeGenerator

generator = NarrativeGenerator()

# Generate complete narrative
narrative = generator.generate(
    case_data=case_json,
    format="cioms_i",  # or "ich_e2b", "fda_medwatch"
    include_meddra=True
)

narrative.save("ICSR_2024_001_narrative.txt")

Standard Sections:

  1. Patient Demographics - Age, sex, weight, relevant characteristics
  2. Medical History - Significant pre-existing conditions
  3. Concomitant Medications - Other drugs at time of event
  4. Suspect Drug(s) - Medication(s) in question with dosing
  5. Adverse Event - Detailed reaction description with MedDRA terms
  6. Diagnostic Results - Lab values, imaging, procedures
  7. Treatment - Medical management of the event
  8. Dechallenge/Rechallenge - Effect of drug withdrawal/reintroduction
  9. Outcome - Final patient status and sequelae
  10. Causality Assessment - Reporter's relationship evaluation

2. Temporal Relationship Analysis

Reconstruct timeline and assess temporal plausibility:

# Analyze temporal relationships
timeline = generator.analyze_timeline(
    drug_start="2024-01-15",
    drug_stop="2024-02-01",
    ae_onset="2024-01-28",
    dechallenge_date="2024-02-01",
    rechallenge_date=None
)

# Output shows temporal assessment
# "AE onset 13 days after drug initiation, positive dechallenge within 24h"

Assessments Generated:

3. Causality Evaluation Support

Structure causality assessment per WHO-UMC criteria:

# Generate causality section
causality = generator.assess_causality(
    case_data=case,
    criteria="who_umc",  # or "naranjo", "cochrane"
    include_rationale=True
)

# Output structured assessment with points for each criterion

WHO-UMC Categories:

4. Multi-Format Output

Generate narratives for different regulatory contexts:

# FDA MedWatch Form 3500A
fda_narrative = generator.generate(
    case_data=case,
    format="fda_medwatch",
    max_length=2000  # Character limit
)

# EMA E2B(R3) electronic format
ema_narrative = generator.generate(
    case_data=case,
    format="ich_e2b",
    version="R3"
)

# CIOMS I paper format
cioms_narrative = generator.generate(
    case_data=case,
    format="cioms_i"
)

Quality Checklist

Pre-Generation:

Narrative Content:

Post-Generation:

Common Pitfalls

Completeness Issues:

Medical Accuracy Issues:

Regulatory Issues:

References

Available in references/ directory:

Scripts

Located in scripts/ directory:

Limitations


⚠️ CRITICAL: This tool generates draft narratives for efficiency. All adverse event narratives require review by qualified drug safety physicians before regulatory submission. Causality assessment must be performed by healthcare professionals with access to complete medical records.

Output Requirements

Every final response should make these items explicit when they are relevant:

Error Handling

Input Validation

This skill accepts requests that match the documented purpose of adverse-event-narrative and include enough context to complete the workflow safely.

Do not continue the workflow when the request is out of scope, missing a critical input, or would require unsupported assumptions. Instead respond:

adverse-event-narrative only handles its documented workflow. Please provide the missing required inputs or switch to a more suitable skill.

Response Template

Use the following fixed structure for non-trivial requests:

  1. Objective
  2. Inputs Received
  3. Assumptions
  4. Workflow
  5. Deliverable
  6. Risks and Limits
  7. Next Checks

If the request is simple, you may compress the structure, but still keep assumptions and limits explicit when they affect correctness.

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.