PhysioNet
A collection of tools for working with the PhysioNet repository.
Installation
pip install physionet
Usage
API Client
Interact with the PhysioNet API to explore and search published projects:
from physionet import PhysioNetClient
# Create a client instance
client = PhysioNetClient()
# List all published projects
projects = client.projects.list_published()
print(f"Total projects: {len(projects)}")
# Display first few projects
for project in projects[:5]:
print(f"{project.slug} v{project.version}: {project.title}")
# Search for projects
ecg_projects = client.projects.search('ECG')
print(f"Found {len(ecg_projects)} ECG-related projects")
# Get all versions of a project
versions = client.projects.list_versions('mimic-iv-demo')
for version in versions:
print(f"Version {version.version}: {version.title}")
# Get detailed information about a specific version
details = client.projects.get_details('mimic-iv-demo', '2.2')
print(f"Title: {details.title}")
print(f"DOI: {details.doi}")
print(f"Published: {details.publish_datetime}")
print(f"Size: {details.main_storage_size} bytes")
Authenticated Requests
For endpoints that require authentication (e.g., downloading checksums):
from physionet import PhysioNetClient
# Create client with authentication
client = PhysioNetClient(
username='your_username',
password='your_password'
)
# Download checksums file
client.projects.download_checksums(
'mimic-iv-demo',
'2.2',
'checksums.txt'
)
# Or use environment variables
# Set PHYSIONET_USERNAME and PHYSIONET_PASSWORD
from physionet.api.utils import get_credentials_from_env
username, password = get_credentials_from_env()
client = PhysioNetClient(username=username, password=password)
Using Context Manager
from physionet import PhysioNetClient
# Automatically close session when done
with PhysioNetClient() as client:
projects = client.projects.list_published()
print(f"Found {len(projects)} projects")
Utility Functions
from physionet.api.utils import format_size
# Format bytes to human-readable size
size = format_size(16224447)
print(size) # "15.47 MB"
Error Handling
from physionet import PhysioNetClient
from physionet.api.exceptions import NotFoundError, RateLimitError, ForbiddenError
client = PhysioNetClient()
try:
details = client.projects.get_details('nonexistent-project', '1.0')
except NotFoundError:
print("Project not found")
except RateLimitError:
print("Rate limit exceeded, please wait before retrying")
except ForbiddenError:
print("Access denied - check credentials or project permissions")
Contributing
Contributions are welcome!
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for physionet 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| physionet-0.1.4.tar.gz | 13.4 kB | Without provenance | Details for physionet-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| physionet-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for physionet-0.1.4-py3-none-any.whl |
Total release size: 24.5 kB
Release files / physionet-0.1.4.tar.gz
| Download URL | physionet-0.1.4.tar.gz |
|---|---|
| Size | 13.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
91705c7924d40882ffd3b44dc2ed35841f0da95870cfa06066443314f350c593
|
|
BLAKE2b-256 checksum How to use checksums |
a3670f0b4f30ec73f1e911028bb161207bf44eb9a03851bff56c4c491c4e1124
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / physionet-0.1.4-py3-none-any.whl
| Download URL | physionet-0.1.4-py3-none-any.whl |
|---|---|
| Size | 11.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a206e2deacb9e3d72b736a70f96d62f88466d1be6216cfa5f3c48785f8d499bd
|
|
BLAKE2b-256 checksum How to use checksums |
b3fbae35a86b9b5776b638a8939dbb4c0c739ad0bd325805af48f83c7bfb74b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Security for physionet 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.