We have released physionet, a Python package and command-line tool for working with PhysioNet. Use it to search for datasets, download whole projects or selected files, load tables directly into Python, and check a dataset before submitting it. Install it with:
pip install physionet
Find a dataset. Search published projects, then view the details of a specific version:
physionet search "sleep" --resource-type database
physionet show mimic-iv-demo --version 2.2
Download files. Download a whole project, or just the files you need. Downloads resume if interrupted, and every file is checked against the project's published checksums. Open datasets are downloaded from our AWS mirror when available.
physionet download mimic-iv-demo --version 2.2
physionet download mimic-iv-demo --version 2.2 --include "hosp/*" --dry-run
Sign in to access restricted data. Restricted and credentialed datasets need a PhysioNet account that meets the dataset's access requirements. Sign in once: the package shows a link and a short code, which you approve in your browser. This also works on remote servers and clusters, because you can open the link on any device. Later downloads, from the command line and from Python, then use your account. Your password is never stored.
physionet login
physionet download mimiciv --version 3.1
physionet whoami
physionet logout
In a notebook, call physionet.login() instead. You can see your signed-in devices, and sign them out, under Settings > Tokens. For scheduled jobs and continuous integration, create a personal access token there with the "Download data" scope and set it as the PHYSIONET_TOKEN environment variable. Signing in with your username and password still works.
Load a table in Python. Files are downloaded once and cached, so later calls read them from disk. Restricted tables load the same way once you are signed in:
import physionet
patients = physionet.load("mimic-iv-demo", "hosp/patients", version="2.2")
Prepare a submission. Check a dataset for common problems, such as missing documentation, file naming issues, and possible identifiers, before you submit it to PhysioNet:
physionet validate /path/to/dataset
The package is open source and requires Python 3.10 or later. See the GitHub repository for full documentation, and to report issues or suggest features.