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 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.1.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.1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file medquerypy-0.2.1.tar.gz.

File metadata

  • Download URL: medquerypy-0.2.1.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.1.tar.gz
Algorithm Hash digest
SHA256 da3e996f34bddc3ae5e8d2b213ebaaa4571ee302ad7d9e92c0fd4fdba0efaebd
MD5 e935c0ab85c6d655d40e946363c841b2
BLAKE2b-256 c6f27b74f13f81d373b1a6114032e2d7422696d1aa7136860119404ebc798645

See more details on using hashes here.

File details

Details for the file medquerypy-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: medquerypy-0.2.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8e2d95959abb4b7c04eb978126843eac6bfc44af1a5f07f27e91c67107a7a6eb
MD5 71a8b067a5895dfdec675803bbe6828a
BLAKE2b-256 2a20c2adb3c6efa2294cf7ba6fe8b6406de28d30d3339cdc4f231f53e594b37a

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