Skip to main content

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

  1. The CLI takes a search query as input.
  2. Fetches PubMed papers matching the query.
  3. Uses AI to identify non-academic authors.
  4. Uses AI to summarize research papers.
  5. 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

medquerypy-0.2.2.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

medquerypy-0.2.2-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

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

Hashes for medquerypy-0.2.2.tar.gz
Algorithm Hash digest
SHA256 1a4e12b7615b04a6536dd62457fda45122acf12d7747d7152b4fe1f82d82b894
MD5 94686ec3bee080b6c99075a4e4b65fa4
BLAKE2b-256 94c4962d42515a4ce46236f5d4e912808754c54b5c7c4244c4a23a4b2cc26fcd

See more details on using hashes here.

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

Hashes for medquerypy-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9e6008e63379f599d2823243c7cfe9d1669f838f230686accf87697f6eec8151
MD5 3decc0dbbe65b8dc973cd169f4fc2c02
BLAKE2b-256 70c169e1808d16968e69377931cfee601a3d8f88a09affb88e0811595211db6a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page