Repository navigation
Description
We should aim to prevent the creation of WFDB headers which aren't to specification (via the WFDB write functions). We should also provide clear messaging for errors related to already created WFDB headers (via he WFDB read functions).
Two sets of projects have had WFDB header issues related to base_date recently:
- 2020 and 2021 Challenges. These projects used -'s instead of /'s in the
base_dateand the date was given before thebase_time: HeaderSyntaxError encountered when using wfdb 3.4.1 #351 . As mentioned in this issue, the WFDB tools were not used to create these files, so these errorneous headers shouldn't come as a surprise.
Error message: HeaderSyntaxError: invalid syntax in record line - Cerebral projects. These projects had a year for the
base_dateand no time. This problem was initially noted in: wfdb.rdsamp for reading cerebral perfusion database #307. More recently, another user sent an email about this issue.
Error message: ValueError: time data '2006' does not match format '%d/%m/%Y' (ecg files in https://physionet.org/content/cerebral-perfusion-diabetes/1.0.0/)
Error message: ValueError: unconverted data remains: 10 (ECG files in https://physionet.org/content/cded/1.0.0/)
It isn't clear how the WFDB files for 2. were created. There is some indication that MIT-LCP helped generate these files.
At the very least we should:
- Use validation checks to prevent the creation of WFDB files with these issues in our WFDB toolboxes.
- Catch these issues in all of our WFDB toolboxes and provide clear, consistent error messages.
Since we need to address multiple issues across 3 different toolboxes this issue may get messy. I will update this post to denote how updates to the Matlab and C toolboxes will be tracked once that is determined.
Finally, it would also be good if our wfdbcheck algorithm would catch these issues. This could prevent cases like those seen in the 2020, and 2021 challenges from getting through (i.e. even if a header is created outside of our toolboxes, we'd like to flag it if it isn't to specification).
Activity
briangow commentedon Oct 19, 2022
@nick-trivirum , thank you for bringing this to our attention. The issue in https://physionet.org/content/ecg-arrhythmia/1.0.0/ appears to be a bit different though. There are a couple of corrupted
.heafiles. I have asked the author to submit a new version but haven't heard back yet. I'd encourage you to also contact the corresponding author for this project if this is something you'd like to see fixed.slishak commentedon Nov 17, 2022
There is also a similar error in MGHDB:
Header content:
rdyan0053 commentedon Jun 24, 2023
Hi,
This problem seems to have not been solved yet. When using wfdb to read the 'WFDBRecords/01/019/JS01052. hea' record, the same error
ValueError: time data '/' does not match format '%d/%m/%Y'still occurred.I only want to read the patient's basic information, like
age, not thedatetimeinformation. So, I don need to check thedatetime. What can I do to achieve such a result.briangow commentedon Oct 13, 2025
The issues with the WFDB files which were causing this error were likely introduced by this bug: #544. This should be fixed in the next WFDB version.
tompollard commentedon Nov 2, 2026
A data point from #550 (dates written as
DD.MM.YYYY): the WFDB library ignores a base date that isn't inDD/MM/YYYYform, and reads the rest of the record normally (rdsamp -pdshows the time but no date), whilerdheaderhere raisesValueError: time data '25' does not match format '%d/%m/%Y'. Matching the WFDB library, by warning and leavingbase_dateasNone, would let these records be read.Ignore an invalid base date in a header, with a warning
Ignore an invalid base time or date in a header, with a warning (MIT-…