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.tar.gz (4.2 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-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: medquerypy-0.2.tar.gz
  • Upload date:
  • Size: 4.2 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.tar.gz
Algorithm Hash digest
SHA256 ca21adcdcfe133f958b89228baba9f8a7d5e98c1a1b8db2067860e7f7ba121fe
MD5 093b09cf3ecf0d3288465d5b24030e3f
BLAKE2b-256 48993f16e8f7f9a4b6fec84e74272104f07e2d134a748e77a20e800165c9ffba

See more details on using hashes here.

File details

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

File metadata

  • Download URL: medquerypy-0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.1 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-py3-none-any.whl
Algorithm Hash digest
SHA256 7959a30a2d79026fafc0cc9d7decfa7d1494e60ef5937852caffc53d187e1030
MD5 a2ac123cbab847ed99c72b4bd5241020
BLAKE2b-256 3563cfacb039e926c504fadbe2b288028bdd02234f3de0ea317a4b07f28227fb

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