Mining Pubmed Literature logo

Mining Pubmed Literature

CommunityPopular
maziyarpanahi
mining-pubmed-literature

Searches and fetches PubMed and PMC via NCBI E-utilities (ESearch then EFetch/ESummary) to gather biomedical evidence and build text corpora. Use when the user wants citations for a condition or drug, abstracts to summarize, MeSH-based searches, or a corpus of literature to run NER over. Trigger keywords: PubMed, PMC, NCBI, E-utilities, ESearch, EFetch, ESummary, MeSH, PMID, literature search, abstracts, evidence. Pairs adjacent to OpenMed: fetched abstracts feed openmed.analyze_text for biomedical NER, and OpenMed-extracted diagnoses/drugs/genes become the search terms. E-utilities are public; an optional free API key raises rate limits from 3 to 10 requests/second.

Overview

Publishermaziyarpanahi
Repositoryopenmed
Skill namemining-pubmed-literature
Stars
5.3K
Forks
677
Bundled files
Instructions only
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by maziyarpanahi on GitHub. Read the source before you install it.

Installation

Install the Mining Pubmed Literature AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/maziyarpanahi/openmed.git /tmp/openmed
mkdir -p .claude/skills
cp -r /tmp/openmed/skills/mining-pubmed-literature .claude/skills/mining-pubmed-literature
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Mining Pubmed Literature in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Mining Pubmed Literature on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Mining Pubmed Literature is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Mining PubMed & PMC literature (NCBI E-utilities)

Search PubMed (citations/abstracts) and PMC (full text) programmatically with NCBI E-utilities — the stable HTTP interface to Entrez. The core pattern is two steps: ESearch returns matching record IDs (PMIDs), then EFetch (or ESummary) downloads the records. The Entrez History server (usehistory=y) lets you chain the two without re-sending thousands of IDs.

E-utilities are public. No key is required, but a free API key raises your limit from 3 to 10 requests/second and is strongly recommended for batch work.

When to use

  • OpenMed extracted a diagnosis, drug, or gene and you want supporting literature.
  • You need abstracts to summarize or to assemble a corpus for biomedical NER.
  • You want MeSH-anchored, reproducible searches (date ranges, article types).

For ClinicalTrials.gov use searching-clinicaltrials; this skill is for the published literature.

Quick start (real E-utilities calls)

Base URL: https://eutils.ncbi.nlm.nih.gov/entrez/eutils/. JSON for ESearch/ ESummary via retmode=json; EFetch returns text or XML (no JSON for PubMed).

python
import requests, time

BASE = "https://eutils.ncbi.nlm.nih.gov/entrez/eutils"
API_KEY = None   # set to your free NCBI key to get 10 req/s instead of 3

def _params(**kw):
    if API_KEY:
        kw["api_key"] = API_KEY
    return kw

def esearch(term: str, retmax: int = 50) -> dict:
    """Find PMIDs; usehistory=y stores them on the Entrez History server."""
    r = requests.get(f"{BASE}/esearch.fcgi", params=_params(
        db="pubmed", term=term, retmax=retmax,
        usehistory="y", retmode="json"), timeout=30)
    r.raise_for_status()
    res = r.json()["esearchresult"]
    return {"count": int(res["count"]), "ids": res["idlist"],
            "webenv": res["webenv"], "query_key": res["querykey"]}

def efetch_abstracts(webenv: str, query_key: str, retmax: int = 50) -> str:
    """Pull abstracts by reference to the stored result set (no ID list needed)."""
    r = requests.get(f"{BASE}/efetch.fcgi", params=_params(
        db="pubmed", WebEnv=webenv, query_key=query_key,
        retmax=retmax, rettype="abstract", retmode="text"), timeout=60)
    r.raise_for_status()
    return r.text

hits = esearch('("type 2 diabetes"[MeSH]) AND metformin AND 2023:2025[pdat]')
print(hits["count"], "papers")
abstracts = efetch_abstracts(hits["webenv"], hits["query_key"])

Equivalent cURL (search then fetch one PMID's abstract):

bash
curl "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term=metformin&retmode=json"
curl "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pubmed&id=38000000&rettype=abstract&retmode=text"

ESummary for structured metadata

When you need titles/authors/journal/date as JSON (not the full abstract), use ESummary — it returns one record per ID:

python
def esummary(ids: list[str]) -> dict:
    r = requests.get(f"{BASE}/esummary.fcgi", params=_params(
        db="pubmed", id=",".join(ids), retmode="json"), timeout=30)
    r.raise_for_status()
    return r.json()["result"]   # keyed by PMID: title, pubdate, source, authors…

For PMC full text, repeat with db=pmc and EFetch rettype=""/retmode=xml (JATS XML). Respect each article's license before redistributing full text.

Workflow

  1. Build the query. Combine OpenMed-extracted terms with MeSH tags and field filters: "<disease>"[MeSH] AND <drug>[tiab] AND 2020:2025[pdat]. Use [tiab] (title/abstract), [au] (author), [pdat] (publication date).
  2. ESearch with usehistory=y to capture WebEnv + query_key and the count.
  3. Batch-fetch with EFetch/ESummary in pages of ≤ ~200 IDs (or by history), sleeping to stay under your rate limit.
  4. Parse abstracts/metadata; store PMID, title, journal, date, abstract text.
  5. NER the abstracts with openmed.analyze_text to extract diseases, drugs, genes, and oncology entities for downstream synthesis.

Hand-off to / from OpenMed

  • OpenMed facts → query. openmed.analyze_text(note) yields Disease, Pharmaceutical, Genomics, and Oncology entities. Turn the top spans into the ESearch term (optionally grounded: ICD-10 label, RxNorm ingredient, gene symbol) to retrieve targeted evidence.
  • Abstracts → OpenMed. Feed fetched abstracts straight into openmed.analyze_text(abstract, model_name="disease_detection_superclinical") (or a Genomics/Oncology model) to structure the literature into entities for evidence tables or knowledge-graph edges.
  • Queries and abstracts are public literature, not PHI. Still run locally and never embed patient text in a search term.

Edge cases & gotchas

  • Rate limits. 3 req/s without a key, 10 with one — exceed it and NCBI returns HTTP 429. Add api_key, throttle, and retry with backoff. NCBI also requests a tool= and email= parameter identifying your application.
  • EFetch has no JSON for PubMed. Use retmode=text (human-readable) or retmode=xml (PubMedArticle XML) and parse XML for structured fields.
  • History expires. WebEnv/query_key are session-scoped — fetch promptly after searching, or re-run ESearch.
  • Large result sets. Page with retstart/retmax (or history) rather than pulling everything at once; cap total fetches.
  • MeSH lag. Very recent articles may not yet be MeSH-indexed — include [tiab] term variants so you do not miss them.
  • Full-text licensing. PMC full text carries per-article licenses; many are not redistributable. Store PMIDs/abstracts freely; check the license before republishing full text.

Standards & references

Frequently asked questions

What does the Mining Pubmed Literature AI skill do?

Searches and fetches PubMed and PMC via NCBI E-utilities (ESearch then EFetch/ESummary) to gather biomedical evidence and build text corpora. Use when the user wants citations for a condition or drug, abstracts to summarize, MeSH-based searches, or a corpus of literature to run NER over. Trigger keywords: PubMed, PMC, NCBI, E-utilities, ESearch, EFetch, ESummary, MeSH, PMID, literature search, abstracts, evidence. Pairs adjacent to OpenMed: fetched abstracts feed openmed.analyze_text for biomedical NER, and OpenMed-extracted diagnoses/drugs/genes become the search terms. E-utilities are pub...

Why use Mining Pubmed Literature on TypingMind?

Because you install it once and use it with any model. Mining Pubmed Literature is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Mining Pubmed Literature in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/maziyarpanahi/openmed/tree/master/skills/mining-pubmed-literature. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Mining Pubmed Literature?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Mining Pubmed Literature?

As many as you like. As long as a model supports skills, you can use Mining Pubmed Literature with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Mining Pubmed Literature AI skill free?

Yes. It is published on GitHub by maziyarpanahi under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇