Skip to main content

A Python package to fetch research papers from PubMed

Project description

PubMed Fetcher

Overview

PubMed Fetcher is a command-line tool that allows users to search PubMed for research articles and retrieve relevant data programmatically. It is designed for researchers, developers, and data analysts who need to automate literature searches.

Features

  • Fetches research articles from PubMed based on user queries.
  • Provides structured output in JSON format.
  • CLI-based interaction for ease of use.
  • Supports advanced search queries.

Installation

Prerequisites

  • Python 3.13+
  • Poetry (for dependency management)

Steps to Install

  1. Clone the repository:
    git clone https://github.com/yourusername/pubmed_fetcher.git
    cd pubmed_fetcher
    
  2. Install dependencies using Poetry:
    poetry install
    
  3. Activate the virtual environment:
    poetry shell
    

Usage

Running the CLI

To search for research articles on a specific topic:

poetry run python src/cli.py "Machine Learning"

Running Tests

Run unit tests using pytest:

poetry run pytest tests/

How It Works

  1. CLI Execution:

    • User provides a search term.
    • The CLI interacts with the PubMed API.
    • The results are fetched and displayed.
  2. PubMed API Interaction:

    • Queries PubMed using requests.
    • Parses and formats the response.
  3. Output Handling:

    • Results are printed in a readable format.
    • Can be exported as JSON.

Troubleshooting

Common Issues

  • CLI output is None: Ensure you are running the command correctly with a valid query.
  • Encoding errors in Windows: Run the following before executing the script:
    set PYTHONUTF8=1
    

Contributing

  1. Fork the repository.
  2. Create a new branch:
    git checkout -b feature-new-feature
    
  3. Commit changes:
    git commit -m "Add new feature"
    
  4. Push and create a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.


Contact

For questions, reach out via GitHub Issues or email at abhichandrav108@gmail.com.

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

pubmed_fetcher_abhichandra-0.1.5.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

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

pubmed_fetcher_abhichandra-0.1.5-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file pubmed_fetcher_abhichandra-0.1.5.tar.gz.

File metadata

  • Download URL: pubmed_fetcher_abhichandra-0.1.5.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.13.1 Windows/11

File hashes

Hashes for pubmed_fetcher_abhichandra-0.1.5.tar.gz
Algorithm Hash digest
SHA256 46ffe4c1ed14695c43a50f67ad197237130d6b7e41104024359d5183e294cfcf
MD5 3d687a3a8aec98c4132e7956137dfd06
BLAKE2b-256 c2f9a7f12ce737387fc66c93683a6cb3b18682f95f2beddac4cfc81e5daa0a96

See more details on using hashes here.

File details

Details for the file pubmed_fetcher_abhichandra-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for pubmed_fetcher_abhichandra-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 dd84df669b914d8474b3d69affe3dae921fa074524ec44995df88735936942a3
MD5 6c6ba9caaa1bcd0dbd843a260584d907
BLAKE2b-256 cee470f023784e16254e4ffc13f06e5904cf8e48d7c46d7c5a6e0aa85b293231

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