Pharma Market Intel Agent - FAERS Query Skill
name: pharmaclaw-market-intel-agent
by cheminem · published 2026-03-22
$ claw add gh:cheminem/cheminem-pharmaclaw-market-intel-agent---
name: pharmaclaw-market-intel-agent
description: |
Fetches and analyzes FAERS (FDA Adverse Event Reporting System) data from openFDA API.
Supports drug names and SMILES (resolves via PubChem).
Generates: events list, yearly trends (counts), top reactions/outcomes as JSON + matplotlib bar chart PNGs.
triggers: ['faers', 'adverse event', 'safety report', 'drug side effect', 'post-market surveillance', 'reaction trend', 'clinical trial', 'clinicaltrials', 'trial pipeline', 'recruiting trial']
---
# Pharma Market Intel Agent - FAERS Query Skill
Overview
Query real-world post-market safety data for drugs. Useful for market intel on safety profiles, emerging risks, competitor analysis.
Key outputs:
**Rate limits**: openFDA ~240 req/min. Counts are fast (no full data).
Chemistry-Query Structure
Parse user queries into this model for standardized chaining:
from dataclasses import dataclass
from typing import List, Optional
@dataclass
class ChemistryQuery:
drug: str # Drug name or SMILES
query_type: str = 'faers' # 'faers', 'pubchem', etc.
metrics: Optional[List[str]] = None # ['yearly_trends', 'top_reactions', 'top_outcomes', 'events']
limit_events: int = 20Example:
{
\"drug\": \"aspirin\", // or \"CC(=O)OC1=CC=CC=C1C(=O)O\"
\"query_type\": \"faers\",
\"metrics\": [\"yearly_trends\", \"top_reactions\"]
}Quick Start / Workflows
1. Basic Query (All Metrics)
exec skills/pharma-market-intel-agent/scripts/query_faers.py --drug aspirin --output ./aspirin_faersGenerates:
2. SMILES Input
exec ... --drug \"CC(=O)OC1=CC=CC=C1C(=O)O\" # Aspirin SMILESAuto-resolves to name via PubChem.
3. Custom Limit
exec ... --drug ozempic --limit-events 50 --output ozempic_analysisChaining Examples
# Agent workflow:
1. Parse ChemistryQuery
2. Resolve SMILES if needed (pubchempy or query_faers handles)
3. Run query_faers.py
4. Read PNGs/JSONs into response
5. Chain if metrics require---
ClinicalTrials.gov Integration
Query clinical trial data from ClinicalTrials.gov API v2. Search by drug, condition, phase, and status. No API key needed.
Quick Start
# Search by drug
exec skills/pharma-market-intel-agent/scripts/query_trials.py --drug "sotorasib" --output ./sotorasib_trials
# Search by condition + filters
exec ... --condition "breast cancer" --phase PHASE3 --status RECRUITING --limit 10 --output ./bc_trials
# Search by both
exec ... --drug "pembrolizumab" --condition "NSCLC" --output ./pembro_trials
# SMILES input (auto-resolves via PubChem)
exec ... --drug "CC(=O)OC1=CC=CC=C1C(=O)O" --output ./aspirin_trialsOutputs
JSON Summary Structure
{
"drug": "sotorasib",
"total_found": 45,
"trials": [{"nct_id": "NCT...", "title": "...", "phase": "PHASE3", "sponsor": "Amgen", ...}],
"stats": {"by_phase": {...}, "by_status": {...}, "top_sponsors": [...], "top_conditions": [...]}
}Chaining Examples
---
References
Resources
More tools from the same signal band
Order food/drinks (点餐) on an Android device paired as an OpenClaw node. Uses in-app menu and cart; add goods, view cart, submit order (demo, no real payment).
Sign plugins, rotate agent credentials without losing identity, and publicly attest to plugin behavior with verifiable claims and authenticated transfers.
The philosophical layer for AI agents. Maps behavior to Spinoza's 48 affects, calculates persistence scores, and generates geometric self-reports. Give your...