MIT-LCP / MIT-LCP/wfdb-python

Accessing a file in a subfolder on PhysioNet using pn_dir

Open
#467 2 comments 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

I'm using wfdb 4.1.2, and when I try to run this code it fails with a 404:

import wfdb
record = wfdb.rdrecord('p1003/p10030753/s40735970/40735970', pn_dir='mimic-iv-ecg')

NetFileNotFoundError: 404 Error: Not Found for url: https://physionet.org/files/mimic-iv-ecg/1.0/40735970.hea

Looks like this relates to hacky path parsing which there is an open (semi-complete) PR for (#346).

I also tried:

import wfdb
record = wfdb.rdrecord('40735970', pn_dir='mimic-iv-ecg/1.0/p1003/p10030753/s40735970')

NetFileNotFoundError: 404 Error: Not Found for url: https://physionet.org/files/mimic-iv-ecg/1.0/p1003/p10030753/s40735970/40735970.hea

So I played with the path, and this ends up working:

import wfdb
record = wfdb.rdrecord('40735970', pn_dir='mimic-iv-ecg/1.0/files/p1003/p10030753/s40735970')

Seems a bit unintuitive to me that you have to put files in there, am I doing something wrong?

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 at wfdb.rdrecord and follow how record and pn_dir are combined for PhysioNet downloads. Reproduce both failing examples, then read the semi-complete PR #346 for the existing path-parsing approach. Done means nested MIMIC-IV-ECG records resolve without requiring an unintuitive files segment, with regression coverage for the shown paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
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.