MIT-LCP / MIT-LCP/wfdb-python

wfdb.io._url.NetFileNotFoundError: 404 Error: Not Found for url: https://physionet.org/files/ecg-arrhythmia/1.0.0/WFDBRecords/01/010/.hea

オープン
#513 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Jupyter Notebook
スター
853
フォーク
322
PR マージ指標
30日以内にマージされた PR はありません

説明

import os
import wfdb

for db in wfdb.get_dbs():
    print(db)

def download_dataset_from_physionet(dataset_name: str):
    # https://wfdb.readthedocs.io/en/latest/io.html#module-1
    print(f"Downloading {dataset_name} dataset from PhysioNet...")
    if not os.path.exists("physionet"):
        os.makedirs("physionet")
    if not os.path.exists("physionet/" + dataset_name):
        os.makedirs("physionet/" + dataset_name)
    
    wfdb.dl_database(db_dir=dataset_name,
                     dl_dir=os.path.join(os.getcwd(), "physionet", dataset_name),
                     records='all',
                     annotators='all',
                     keep_subdirs=True,
                     overwrite=False)
    print(f"Downloaded {dataset_name} dataset from PhysioNet!")

# Download the MIT-BIH dataset
download_dataset_from_physionet("mitdb") # This one downloads

# Download the ECG arrhythmia dataset
download_dataset_from_physionet("ecg-arrhythmia") # This one doesn't, see traceback below

...
['ecg-arrhythmia', 'A large scale 12-lead electrocardiogram database for arrhythmia study']
.....

Downloading mitdb dataset from PhysioNet...
Downloading ecg-arrhythmia dataset from PhysioNet...
Generating list of all files for: WFDBRecords/01/010/
Traceback (most recent call last):
  File "I:\nasty\Python_Projects\Healthcare\ECG_Classification_Scholarship_Project\main.py", line 27, in <module>
    download_dataset_from_physionet("ecg-arrhythmia")
  File "I:\nasty\Python_Projects\Healthcare\ECG_Classification_Scholarship_Project\main.py", line 15, in download_dataset_from_physionet
    wfdb.dl_database(db_dir=dataset_name,
  File "C:\Users\chalu\AppData\Local\Programs\Python\Python311\Lib\site-packages\wfdb\io\record.py", line 3065, in dl_database  
    record = rdheader(
             ^^^^^^^^^
  File "C:\Users\chalu\AppData\Local\Programs\Python\Python311\Lib\site-packages\wfdb\io\record.py", line 1847, in rdheader     
    header_content = download._stream_header(file_name, pn_dir)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\chalu\AppData\Local\Programs\Python\Python311\Lib\site-packages\wfdb\io\download.py", line 109, in _stream_header
    content = f.read()
              ^^^^^^^^
  File "C:\Users\chalu\AppData\Local\Programs\Python\Python311\Lib\site-packages\wfdb\io\_url.py", line 581, in read
    result = b"".join(self._read_range(start, end))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\chalu\AppData\Local\Programs\Python\Python311\Lib\site-packages\wfdb\io\_url.py", line 474, in _read_range     
    with RangeTransfer(self._current_url, req_start, req_end) as xfer:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\chalu\AppData\Local\Programs\Python\Python311\Lib\site-packages\wfdb\io\_url.py", line 168, in __init__        
    self._parse_headers(method, self._response)
  File "C:\Users\chalu\AppData\Local\Programs\Python\Python311\Lib\site-packages\wfdb\io\_url.py", line 214, in _parse_headers  
    raise cls(
wfdb.io._url.NetFileNotFoundError: 404 Error: Not Found for url: https://physionet.org/files/ecg-arrhythmia/1.0.0/WFDBRecords/01/010/.hea

Seems to be trying to find a filename that doesn't exist? When you navigate to https://physionet.org/files/ecg-arrhythmia/1.0.0/WFDBRecords/01/010 there are files in there, but the code is looking for .hea which doesn't exist?

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

wfdb/io/record.py の wfdb.dl_database から始め、wfdb/io/download.py と wfdb/io/_url.py を通じてダウンロードを追跡します。ecg-arrhythmia データセットへのリクエストを再現し、WFDBRecords/01/010/ がどのように解釈されるかを調べます。欠落している .hea パスを要求せずにデータセットをダウンロードできれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
data
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。