A Python tool to fetch research papers from PubMed.
Project description
๐ MedQueryPy - Fetch PubMed Research Papers with AI
๐ MedQueryPy is a Python package designed to fetch research papers from PubMed and filter those with non-academic authors affiliated with pharmaceutical or biotech companies. Now, with AI-powered author classification and research paper summarization, the package is smarter than ever!
๐ Features
โ
Fetches research papers using the PubMed API
โ
Identifies papers with non-academic authors from biotech/pharma companies using AI
โ
Uses GPT-4 to summarize research papers ๐
โ
Saves results in CSV format
โ
Provides a command-line interface & Python module
โ
Poetry-based dependency management
โ
Optimized for fast and efficient queries
๐ Installation
You can install MedQueryPy via pip:
pip install medquerypy
๐ Usage
๐ Import as a Python Module
from MedQueryPy.fetcher import PubMedFetcher
# Define a search query
query = "COVID-19 vaccines"
# Fetch paper IDs
paper_ids = PubMedFetcher.fetch_pubmed_papers(query)
print("Paper IDs:", paper_ids)
# Fetch details of each paper
results = [PubMedFetcher.get_paper_details(pid) for pid in paper_ids]
print("Paper Details:", results)
# Check if an affiliation is non-academic using AI
affiliation = "XYZ Biotech"
print("Is non-academic:", PubMedFetcher.is_non_academic(affiliation))
# Summarize a research paper using AI
abstract = "This study investigates the effect of COVID-19 vaccines on different age groups..."
summary = PubMedFetcher.summarize_paper(abstract)
print("Summary:", summary)
# Save results to CSV
PubMedFetcher.save_to_csv(results, "output.csv")
print("Results saved to output.csv")
๐ Use as a Command-Line Tool
Fetch papers and print results:
get-papers-list "COVID-19 vaccines"
Save results to a CSV file:
get-papers-list "COVID-19 vaccines" -f results.csv
Enable Debug Mode:
get-papers-list "COVID-19 vaccines" -d
๐ Project Structure
medquerypy/
โโโ medquerypy/ # Package directory
โ โโโ __init__.py # Makes the folder a Python package
โ โโโ fetcher.py # Module for fetching PubMed papers & AI processing
โโโ cli.py # Command-line interface script
โโโ README.md # Documentation
โโโ pyproject.toml # Poetry configuration
โโโ poetry.lock # Poetry lock file
โโโ .gitignore # Git ignore file
๐ค Technology Stack
- Python ๐
- Requests (for API calls) ๐
- OpenAI GPT-4 (for AI-based filtering & summarization) ๐ง
- CSV (for saving results) ๐
- Poetry (for package management) ๐ฆ
โก How It Works
- The CLI takes a search query as input.
- Fetches PubMed papers matching the query.
- Uses AI to identify non-academic authors.
- Uses AI to summarize research papers.
- Outputs results to console or CSV.
๐ Contributing
๐ฏ Contributions are welcome! Feel free to fork the repo and submit a PR.
๐ License
๐ MIT License. See LICENSE for details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file medquerypy-0.2.2.tar.gz.
File metadata
- Download URL: medquerypy-0.2.2.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.12.9 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a4e12b7615b04a6536dd62457fda45122acf12d7747d7152b4fe1f82d82b894
|
|
| MD5 |
94686ec3bee080b6c99075a4e4b65fa4
|
|
| BLAKE2b-256 |
94c4962d42515a4ce46236f5d4e912808754c54b5c7c4244c4a23a4b2cc26fcd
|
File details
Details for the file medquerypy-0.2.2-py3-none-any.whl.
File metadata
- Download URL: medquerypy-0.2.2-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.12.9 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e6008e63379f599d2823243c7cfe9d1669f838f230686accf87697f6eec8151
|
|
| MD5 |
3decc0dbbe65b8dc973cd169f4fc2c02
|
|
| BLAKE2b-256 |
70c169e1808d16968e69377931cfee601a3d8f88a09affb88e0811595211db6a
|