Skip to main content

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

physionet-0.1.5.tar.gz (34.5 kB view details)

Uploaded Source

Built Distribution

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

physionet-0.1.5-py3-none-any.whl (30.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: physionet-0.1.5.tar.gz
  • Upload date:
  • Size: 34.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for physionet-0.1.5.tar.gz
Algorithm Hash digest
SHA256 f03c3370cc0542a0243cfea68350faf14840c9ed8e57a0750d24c085585b9f0a
MD5 611d914ad48962ab6fcaa432c6438b42
BLAKE2b-256 283a0d0ef88b7b72b8747e65b55cacb59b191efffeaae513b8475c36a26d8568

See more details on using hashes here.

File details

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

File metadata

  • Download URL: physionet-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 30.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for physionet-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 94a703685bfc8e83fe771b5905e1e1eb6c1c4509b63e98016ff4650c3d49721f
MD5 1ceb54049569da8303be5741b64724e2
BLAKE2b-256 09a65fac9d25538ac4f03e2bde43a25cf73a65aac029b7f0b7d154d58d9ff518

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

0.0.0

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page