wfdb-python icon indicating copy to clipboard operation
wfdb-python copied to clipboard

Errors in `get_record_list`

Open WilliamDixon opened this issue 4 years ago • 2 comments

import wfdb print(wfdb.get_record_list("antimicrobial-resistance-uti")) # The 7th database from get_dbs()

Rather than returning a list of records, it returns a list of lines of a 403 Error HTML file.

['<!DOCTYPE html>', '', '<html lang="en">', ' <head>', ' <meta charset="UTF-8">', ' <title>', '403: Forbidden Access', '</title>', ... , '</html>']

Beyond either removing, renaming or fixing the dbname. I would also recommend detecting that the file accessed is an Error Page and not a valid list of records and raise a corresponding Python Error.

Also: print(wfdb.get_record_list("bhx-brain-bounding-box")) # The 9th database from get_dbs()

Raises a Value Error: ValueError: The database https://physionet.org/files/bhx-brain-bounding-box/1.1 has no WFDB files to download

WilliamDixon avatar May 31 '21 13:05 WilliamDixon

Hello @WilliamDixon, thanks for the feedback! I like your suggestion for returning a Python error if some of these errors occur! Here's the explanations:

  1. antimicrobial-resistance-uti: It returns 403 because it's a credentialed project so I believe once you are a credentialed user on PhysioNet then it will appear as intended. The Python exception could say "Forbidden access: you must be a credentialed PhysioNet user" or something along those lines.

  2. bhx-brain-bounding-box: There is no RECORDS file so it has no record_list so the Python exception could say "No RECORDS files found".

Lucas-Mc avatar May 31 '21 14:05 Lucas-Mc

Thanks for the explanation @Lucas-Mc, good to know this was expected behaviour.

WilliamDixon avatar May 31 '21 16:05 WilliamDixon