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

Uploaded Python 3

File details

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

File metadata

  • Download URL: medquerypy-0.1.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.1.1.tar.gz
Algorithm Hash digest
SHA256 38065bccdf581831cad15fd345c4537e92cc44ac8685bc5c4d6692a028dd59a5
MD5 151ac98cf2edd178ba6f1410e0a4c25d
BLAKE2b-256 0f18540d689a7e29743be0ede80ae4cfd9dab37eccb5ba6ae7c1867db92b62f9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: medquerypy-0.1.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.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 da588a4984e288f4879f906c5386b6bdd66f528faa81cdd30c207aec9c6df8b5
MD5 795f6683fb5fe12ac7f509e5e371700b
BLAKE2b-256 fbd850b80af697cc6f5ebc10caa5dee3ee65101cfb4eaf227838b5578c8e2ac9

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