Skip to content

Latest commit

 

History

History
86 lines (60 loc) · 2.32 KB

README.md

File metadata and controls

86 lines (60 loc) · 2.32 KB

PubMed Fetcher

pubmed-fetcher is a Python tool designed to fetch research papers from PubMed and extract relevant information into CSV files. Below are the steps to run the program:

  1. If you dont already have poetry, run pip install poetry
  2. Clone the repository.
  3. Run : cd pubmed-fetcher
  4. Run : poetry install --no-root
  5. To use, use command : poetry run get-papers-list "YOUR QUERY" -f YOUR-FILE-NAME.csv -d
  6. If you don't want the file to be saved then you can skip the -f parameter, in which case the output will be printed to console.
  7. For help use: poetry run get-papers-list -h

Features

  • Fetch PubMed IDs based on a search query.
  • Retrieve detailed XML data for given PubMed IDs.
  • Extract and parse required fields from PubMed XML data into CSV files.

Installation

  1. Ensure you have Poetry installed. If not, you can install it using pip:

    pip install poetry
  2. Clone the repository:

    git clone https://github.com/November-6/pubmed-fetcher.git
  3. Change to the project directory:

    cd pubmed-fetcher
  4. Install dependencies:

    poetry install --no-root

Usage

To fetch research papers from PubMed, use the command:

poetry run get-papers-list "YOUR QUERY" -f YOUR-FILE-NAME.csv -d
  • Replace "YOUR QUERY" with your search query.
  • Replace YOUR-FILE-NAME.csv with the desired output CSV file name.
  • If you don't want the file to be saved, you can skip the -f parameter, and the output will be printed to the console.

For help, use:

poetry run get-papers-list -h

Example

To fetch papers related to "cancer research" and save the results to results.csv:

poetry run get-papers-list "cancer research" -f results.csv

To fetch papers related to "cancer research" and print the results to the console:

poetry run get-papers-list "cancer research"

Project Structure

  • pubmed_fetcher.py: Contains the core functions for fetching and parsing PubMed data.
  • pubmed_cli.py: Command-line interface for interacting with the tool.
  • poetry.lock: Lock file generated by Poetry for managing dependencies.

License

This project is licensed under the MIT License.

Contact

For any inquiries or issues, feel free to contact me at [email protected].