Skip to content

Add list_databases using physionet.list_projects - #816

Merged
tompollard merged 1 commit into
mainfrom
list-databases-api
Dec 1, 2026
Merged

tompollard merged 1 commit into
mainfrom
list-databases-api

Conversation

@tompollard

@tompollard tompollard commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Summary

Add wfdb.list_databases(), a thin wrapper around physionet.list_projects("database") from physionet 0.11.0 (MIT-LCP/physionet#244). Listing PhysioNet projects now lives in the physionet package, and wfdb reuses it rather than building its own listing.

databases = wfdb.list_databases()
mitdb = next(db for db in databases if db.slug == "mitdb")
records = wfdb.list_records(mitdb.slug, version=mitdb.version)
  • Returns physionet.api.PublishedProject objects, with each database's slug, version, title, access_policy and other metadata, sorted by slug. The version can be passed straight to list_records and download_records.
  • Lists the latest version of each database by default; all_versions=True lists every version.
  • The docs note that the list includes databases without WFDB records, and that only databases with a RECORDS file work with list_records and download_records.
  • get_dbs() keeps returning [slug, title] pairs, now built from the same call. Its output is unchanged (the same 469 databases live).
  • WFDB-Python now requires physionet >= 0.11.0.

Related to #672. The download_database and download_files names need a separate decision about WFDB record files versus whole-project files under #534.

Checks

  • Offline suite: 1,530 passed, 4 skipped.
  • Database tests, including the live PhysioNet tests: 6 passed. Live, list_databases() returns 469 databases with versions and 643 with all_versions=True, and the docstring example runs.
  • Ruff check and format, and the Sphinx HTML build with warnings as errors, passed.

@tompollard tompollard left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. The alias is correct, and both names resolve to the same function from wfdb and wfdb.io. The offline suite, Ruff and the strict docs build pass locally.

Two points before this becomes a long-term name:

  • Scope. #794 left a generic list_databases out of wfdb because whole-PhysioNet operations belong in physionet. Since physionet has no simple Python listing function today, keeping it here seems reasonable, but it lists every database, including many with no WFDB records, where list_records and download_records will fail. Could the docs say so (only databases with a RECORDS file work with the record functions), and could the PR description note the change from #794?
  • Return value. [slug, title] lists are the get_dbs shape, and as a plain alias the new name can't change it later without a second rename. Returning named tuples such as Database(slug, title, version) would read better, and the version could go straight into download_records(..., version=...) (the function already selects the latest version). get_dbs would keep returning lists as a separate legacy function.

wfdb.list_databases() returns physionet.list_projects("database"), so
callers get each database's version and access policy as well as its
slug and title, and the listing itself lives in the physionet package.
get_dbs() keeps returning [slug, title] pairs, now built from the same
call. WFDB-Python now requires physionet 0.11.0.
@tompollard tompollard changed the title Add list_databases as a readable name for get_dbs Add list_databases using physionet.list_projects Dec 1, 2026
@tompollard
tompollard merged commit 998767e into main Dec 1, 2026
19 checks passed
@tompollard
tompollard deleted the list-databases-api branch December 1, 2026 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant