MIT-LCP / physionet

A collection of tools for working with the PhysioNet repository.
http://physionet.org/
MIT License
69 stars 17 forks source link

Missing files for MIMIC3wdb #109

Open kl2532 opened 5 years ago

kl2532 commented 5 years ago

Thanks for your work matching the MIMIC-III clinical database with the MIMIC-III Waveform Database. I ran into this issue loading the following record:

record = wfdb.rdrecord('p017488-2153-10-19-16-24', 
                        pb_dir = 'mimic3wdb/matched/p01/p017488')

HTTPError: 404 Client Error: Not Found for url: 
http://physionet.org/physiobank/database/mimic3wdb/matched/p01/p017488/3783537_10000.hea

I believe there are missing files in the subject's folder: https://physionet.org/physiobank/database/mimic3wdb/matched/p01/p017488/, specifically these files:

3783537_10000
...
3783537_13933

To fix this, I downloaded the specific files from 'mimic3wdb':

# The files to download
hea_file_list = ['37/3783537/3783537_{}.hea'.format(i) for i in range(10000, 13933+1)]
dat_file_list = ['37/3783537/3783537_{}.dat'.format(i) for i in range(10000, 13933+1)]
file_list = hea_file_list + dat_file_list

# Make a temporary download directory in your current working directory
cwd = os.getcwd()
dl_dir = os.path.join(cwd, 'tmp_dl_dir')

# Download the listed files
wfdb.dl_files('mimic3wdb', dl_dir, file_list)

I placed the files with the other files for mimic3wdb/matched/p01/p017488 because I downloaded the matched database, and the record was read successfully!

(I referenced this demo for guidance -- thanks for putting this together!)