This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Automated neurology newsletter generator that fetches recent publications from PubMed, triages them with AI, and generates curated markdown newsletters for clinical neurologists. Specializes in neuromuscular disorders, neurovascular diseases, and general neurology.
# Install dependencies
pip install -r requirements.txt
# Full run (requires ANTHROPIC_API_KEY environment variable)
python newsletter.py
# Useful flags
python newsletter.py --dry-run # Fetch papers without Claude analysis
python newsletter.py --no-triage # Skip triage, analyze all papers
python newsletter.py --no-full-text # Skip full text fetching
python newsletter.py --reset-processed # Clear processed papers list
python newsletter.py --budget 1.00 # Limit API spending to $1
Five-phase pipeline orchestrated by newsletter.py:
PubMed Fetching (pubmed_fetcher.py): Queries NCBI E-utilities API for papers from 25+ configured neurology journals plus mega-journals (Nature, NEJM, etc.) filtered by neuro keywords
Triage (paper_analyzer.py): Batch scores papers 1-10 using Claude, categorizes into evidence-based/pathophysiology/reviews/clinical-pearls, selects balanced top N (default 20)
Full Text Fetching (full_text_fetcher.py): Attempts retrieval from PMC, Unpaywall, or publisher proxy (in priority order)
Analysis (paper_analyzer.py): In-depth Claude analysis generating importance ratings (+ to +++++), summaries, 3 keywords per paper. Supports budget limiting with graceful degradation (switches to abstract-only, then stops).
Newsletter Generation (newsletter_generator.py): Creates markdown newsletters grouped by category (Evidence-Based Medicine, Pathophysiology & Mechanisms, Reviews, Clinical Pearls), ordered by importance within each section
Blog Drafts (newsletter_generator.py): Generates individual Jekyll-formatted draft posts in _drafts/ for papers above a configurable importance threshold
config.yaml: Journal lists, mega-journal keywords, lookback days, triage settings, budget limit, proxy config, blog drafts settingsprocessed_papers.json: Tracks previously processed PMIDs to avoid re-analysisWhen blog_drafts.enabled is true in config.yaml, the generator creates individual Jekyll draft posts:
../../_drafts/ (relative to output_dir, i.e., the blog’s _drafts/ folder)min_importance (default 3, which is rating 6+ on 0-10 scale)Set budget_limit in config.yaml or use --budget flag. When budget is constrained:
Token usage summary and detailed JSON log saved to output/token_log_*.json after each run.
Paper dataclass flows through pipeline: PubMedFetcher creates them, FullTextFetcher enriches with text, PaperAnalyzer produces TriageResult and PaperAnalysis, NewsletterGenerator outputs markdown.