Skip to content

QclawQ/pubmed-watcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ”¬ PubMed Watcher

Automated alerting for new PubMed papers matching your research interests. Detects only new papers by tracking previously seen PMIDs.

Built for cron-based monitoring β€” zero external dependencies, pure Python 3 stdlib.

Quick Start

# Run all watched queries, report new papers
python pubmed_watcher.py watch

# First run initializes with 5 default longevity/biotech queries

Commands

watch β€” Check for new papers

python pubmed_watcher.py watch                        # Default: last 7 days
python pubmed_watcher.py watch --days 14              # Look back 14 days
python pubmed_watcher.py watch --json                 # Machine-readable JSON
python pubmed_watcher.py watch --markdown             # Telegram-ready markdown
python pubmed_watcher.py watch --days 3 --markdown    # Combine flags

How it works:

  1. Runs each configured query against PubMed E-utilities
  2. Filters out papers already in seen.json
  3. Reports only NEW papers
  4. Saves newly seen PMIDs to seen.json

add β€” Add a watch query

python pubmed_watcher.py add "CRISPR aging therapy"
python pubmed_watcher.py add "rapamycin longevity clinical trial"

list β€” Show all queries

python pubmed_watcher.py list

Output:

πŸ“‹ Watched Queries (5)

  [1] epigenetic reprogramming aging longevity
      Added: 2026-02-17
  [2] immunosenescence aging immune system
      Added: 2026-02-17
  ...

remove β€” Remove a query by ID

python pubmed_watcher.py remove 3

history β€” Show recent alert runs

python pubmed_watcher.py history              # Last 20 runs
python pubmed_watcher.py history --limit 5    # Last 5 runs

reset-seen β€” Clear seen-papers database

python pubmed_watcher.py reset-seen    # Backs up to seen.bak.json first

Output Formats

Terminal (default)

πŸ”” 12 new papers found across 5 queries (last 7 days)

━━━ πŸ”Ž "epigenetic reprogramming aging longevity" β€” 3 new ━━━

  πŸ“„ Epigenetic reprogramming reverses age-associated...
     πŸ‘€ Zhang W … Bhatt DL
     πŸ“° Nature Aging  β€’  2026 Feb
     πŸ”— https://pubmed.ncbi.nlm.nih.gov/12345678/

Markdown (--markdown)

Telegram-ready formatting with bold titles and inline links.

JSON (--json)

Full structured output for piping to other tools:

[
  {
    "query": "epigenetic reprogramming aging longevity",
    "query_id": 1,
    "new_papers": [
      {
        "pmid": "12345678",
        "title": "...",
        "authors": ["First Author", "Last Author"],
        "journal": "Nature Aging",
        "date": "2026 Feb",
        "doi": "10.1038/...",
        "url": "https://pubmed.ncbi.nlm.nih.gov/12345678/"
      }
    ]
  }
]

State Files

File Purpose
config.json Watched queries and their IDs
seen.json All previously seen PMIDs (prevents re-alerting)
history.json Log of past watch runs with counts

All state is stored in the same directory as the script. Safe to version-control config.json; the others are ephemeral.

Default Queries

On first run, these queries are pre-configured:

  1. epigenetic reprogramming aging longevity
  2. immunosenescence aging immune system
  3. senolytics senescent cells therapy
  4. AI drug discovery clinical trial
  5. biological age clock methylation

Cron Setup

# Run daily at 8 AM, pipe markdown to a notification script
0 8 * * * cd /path/to/pubmed-watcher && python3 pubmed_watcher.py watch --markdown >> /tmp/pubmed-alerts.md 2>&1

Or integrate directly with OpenClaw cron for Telegram delivery.

Technical Details

  • API: NCBI E-utilities (esearch + efetch)
  • Rate limiting: 0.5s delay between API calls (NCBI-friendly)
  • Dependencies: None β€” pure Python 3.9+ stdlib
  • Retry: 3 attempts with backoff on network errors
  • Date filter: Uses edat (Entrez date) for reliable recency filtering

License

Internal tool. No license required.

About

πŸ”¬ PubMed Watcher β€” automated alerting for new research papers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors