A Python package for fetching PubMed articles with MeSH support
Project description
pypubmech
A Python package for fetching and processing PubMed articles with comprehensive metadata extraction and MeSH term support.
Features
- Search PubMed articles by keyword or MeSH terms
- Extract comprehensive article metadata including:
- Title, Abstract, Authors
- Volume, Issue, Journal
- Citations and Links
- MeSH terms
- Export results to CSV
- Compare different sets of PMIDs
Installation
pip install pypubmech
Quick Start
from pypubmech import PubMedClient
# Initialize client
client = PubMedClient(email="your.email@example.com")
# Search by keyword
pmids = client.search_by_keyword("cancer", 100)
# Fetch metadata
client.fetch_article_metadata()
# Export to CSV
client.export_to_csv("cancer_articles.csv")
MeSH Search Example
# Search using MeSH terms
mesh_query = "Neoplasms[MeSH] AND Genetics[MeSH]"
pmids = client.search_by_mesh(mesh_query)
client.fetch_article_metadata()
client.export_to_csv("cancer_genetics.csv")
Development
Setup
- Clone the repository:
git clone https://github.com/yourusername/pypubmech.git
cd pypubmech
- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install development dependencies:
pip install -e ".[dev]"
Running Tests
pytest tests/
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pypubmech-0.1.tar.gz.
File metadata
- Download URL: pypubmech-0.1.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36e73463253d723baa863c6bec13186a5eabab3b137d37a251d36626735539d2
|
|
| MD5 |
c1b7fe0abf65b44686e6fd90f4a343b5
|
|
| BLAKE2b-256 |
0f774a0e7f4346dc76da68f6fc09d7b6432659a46e5643289b7d9c6a3fcc1cca
|
File details
Details for the file pypubmech-0.1-py3-none-any.whl.
File metadata
- Download URL: pypubmech-0.1-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
384af89f08aa8aeae9b0c5db4a931b7d7a67ae92dc8c68ec3cc8a1d4332e1a9c
|
|
| MD5 |
8049ebdf9957282af5b92deac2b603f9
|
|
| BLAKE2b-256 |
be28a7b04985a1c901b43044b2e89c0c46d84b5bf6109a8fbc0aff2bfe5e1a9d
|