Skip to content

Add PubMed literature mining API - #1

Open
dainiubi438-debug wants to merge 1 commit into
OpenTCM01:mainfrom
dainiubi438-debug:agent/pubmed-literature-mining
Open

dainiubi438-debug wants to merge 1 commit into
OpenTCM01:mainfrom
dainiubi438-debug:agent/pubmed-literature-mining

Conversation

@dainiubi438-debug

Copy link
Copy Markdown

What changed

  • add a reusable PubMedClient built on the official NCBI E-utilities API
  • expose GET /api/pubmed with validated query and result-limit parameters
  • return citation metadata plus publication-year, journal, and publication-type analytics
  • support optional PUBMED_EMAIL and NCBI_API_KEY configuration
  • document usage and add isolated client and Flask route tests

Why

OpenTCM currently answers from its traditional medicine knowledge graph but has no maintained path for retrieving modern biomedical evidence. This integration provides a small, dependency-neutral backend module that downstream UI and RAG workflows can reuse without coupling PubMed access to the existing LLM implementation.

User and developer impact

Users can retrieve relevant PubMed citations and a lightweight bibliometric summary through a JSON endpoint. Developers can inject a session for testing, configure NCBI identification through environment variables, and handle query errors separately from upstream service failures.

Validation

  • python -m unittest discover -s tests -v — 8 tests passed
  • python -m compileall -q pubmed_mining.py app.py
  • live smoke query: acupuncture osteoarthritis, 2 records returned from 1,456 matches

Operational note

Deployments should set PUBMED_EMAIL and follow the NCBI E-utilities rate limits. NCBI_API_KEY is optional and raises the default request allowance.

@dainiubi438-debug
dainiubi438-debug force-pushed the agent/pubmed-literature-mining branch from cb598c6 to b4ec6be Compare August 9, 2026 11:36
@dainiubi438-debug
dainiubi438-debug marked this pull request as ready for review August 9, 2026 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant