MIT-LCP / MIT-LCP/wfdb-python

One malformed signal in mimic3 matched?

Open
#458 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
853
Forks
322
PR merge metrics
No merged PRs in 30d

Description

Hi,

I've been using wfdb-python to parse numerics from the mimic3 waveforms database at large. I've found just one file that appears to be unreadable by wfdb, from patient p086831. Here's a minimum example (pulling from the online database):

import wfdb
rec_id = "p086831-2130-12-29-18-28n"
# rec_path = "mimic3wdb/1.0/matched/p08/p086831/"
rec_path = "mimic3wdb-matched/1.0/p08/p086831/"
rec = wfdb.rdrecord(rec_id, pn_dir=rec_path)
ValueError                                Traceback (most recent call last)
Cell In[6], line 6
      4 # rec_path = "mimic3wdb/1.0/matched/p08/p086831/"
      5 rec_path = "mimic3wdb-matched/1.0/p08/p086831/"
----> 6 rec = wfdb.rdrecord(rec_id, pn_dir=rec_path)
...
File .../venv/lib/python3.11/site-packages/wfdb/io/_signal.py:2051, in _check_sig_dims(sig, read_len, n_sig, samps_per_frame)
   2049 for ch in range(n_sig):
   2050     if len(sig[ch]) != samps_per_frame[ch] * read_len:
-> 2051         raise ValueError("Samples were not loaded correctly")

ValueError: Samples were not loaded correctly

This also occurs when pulling the respective .hea and .dat files locally and using wfdb from there.

Perhaps this is an issue with the MIMIC file itself, but I wanted to start here, since I'm not sure how to tell. Might this be a MIMIC bug, or is this a wfdb issue?

Thanks in advance--

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the example with wfdb.rdrecord for p086831-2130-12-29-18-28n, both from the online database and from the local .hea and .dat files. Inspect wfdb/io/_signal.py around _check_sig_dims and compare the declared sample dimensions with the loaded data. Done means determining whether the mismatch originates in wfdb or the MIMIC file and recording the evidence.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.