Invalid format of file 3029208.hea (waveform record header file)
Nobody has claimed this yet.
- Dominant language
- Jupyter Notebook
- Stars
- 3.4k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
File 3029208.hea (available at https://physionet.org/files/mimic3wdb/1.0/30/3029208/3029208.hea) in MIMIC-III Waveform Database has an invalid format and is not parseable by wfdb library.
It specifies 16 as number of segments but contains only 15 signal specification lines, whereas:
Header files must contain valid signal specification lines for at least as many signals as were indicated in the record line (the first non-empty, non-comment line in the file)
as specified in HEADER file format specification (available at https://www.physionet.org/physiotools/wag/header-5.htm).
The file format error makes the following Python script crash, with the output given below:
import wfdb
db_dir = '/path/to/mimic3wdb/'
record = wfdb.rdheader(db_dir + '30/3029208/3029208')
print(f"n_seg: {record.n_seg}, seg_name: {len(record.seg_name)}")
wfdb.rdheader(db_dir + '30/3029208/3029208', rd_segments=True)
n_seg: 16, seg_name: 15
Traceback (most recent call last):
File "test.py", line 9, in <module>
wfdb.rdheader(db_dir + '30/3029208/3029208', rd_segments=True)
File "/.../python3.6/site-packages/wfdb/io/record.py", line 2631, in rdheader
record.sig_segments = record.get_sig_segments()
File "/.../python3.6/site-packages/wfdb/io/_header.py", line 726, in get_sig_segments
sig_dict[sig] = self.get_sig_segments(sig)
File "/.../python3.6/site-packages/wfdb/io/_header.py", line 731, in get_sig_segments
if self.seg_name[i] != '~' and sig_name in self.segments[i].sig_name:
IndexError: list index out of range
Other files in the database might contain similar errors, but they were not checked.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reported 3029208.hea file and the HEADER file format specification, then reproduce the failure using wfdb.rdheader(..., rd_segments=True). Check whether the malformed segment count can be resolved in the database file or requires a wfdb change; done means the record parses without the reported IndexError and the correction is verified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100