ECG Rhythm Conduction Ptbxl
Domain: health_medicine — Therapeutic & Oncology Services

Summary: Variant ptbxl 2263: Single PTB XL derived rhythm/conduction benchmark slice with 2,263 anonymized ECG records.

Task prompt:
You are a computational precision health researcher working on staged ECG waveform data.

## Variant
`ptbxl_2263`: Single PTB-XL-derived rhythm/conduction benchmark slice with 2,263 anonymized ECG records.

## Your Task
Build a multilabel classifier for rhythm and conduction findings from the staged WFDB ECG records.

## Input Files
- WFDB records directory: `ptbxl_2263\input\records`
- Required ECG ID list: `ptbxl_2263\input\record_ids.csv`
- Label glossary: `ptbxl_2263\input\label_codebook.csv`
- Output template: `ptbxl_2263\input\template_output.csv`

## Software
- Task-local command prompt helper: `ptbxl_2263\software\open_input_cmd.bat`
- Baseline package installer: `ptbxl_2263\software\install_baseline_python_packages.bat`
- You may use the system `python` on the VM and install additional open-source Python packages if needed

## What You Must Do
1. Read the staged ECG records from `ptbxl_2263\input\records`.
2. Use `ptbxl_2263\input\record_ids.csv` as the exact required output row set.
3. Train or fit any CPU-feasible multilabel workflow you judge appropriate.
4. Write one CSV exactly to:
   `ptbxl_2263\output\predictions.csv`

## Output Requirements
- The file must be named exactly `predictions.csv`
- The columns must be exactly:
  `ecg_id, SR, STACH, SBRAD, SARRH, AFIB, AFLT, PACE, CLBBB, CRBBB, LAFB, 1AVB, IRBBB, NORM`
- Include exactly the ECG IDs from `ptbxl_2263\input\record_ids.csv`
- Every label value must be binary: `0` or `1`
- Do not save extra files into `ptbxl_2263\output`

## Important Constraints
- Treat this as a multilabel problem; labels are not guaranteed to be mutually exclusive
- Use the staged task files as the source of truth for row set and schema

Required actions:
Open the staged task directory on the Windows VM and inspect the ECG bundle under `input/`.
Load all 2,263 WFDB records from `input/records/` and build a multi-label classifier for the 13 labels `SR`, `STACH`, `SBRAD`, `SARRH`, `AFIB`, `AFLT`, `PACE`, `CLBBB`, `CRBBB`, `LAFB`, `1AVB`, `IRBBB`, and `NORM`.
Write `output/predictions.csv` with exactly the IDs from `input/record_ids.csv` and binary predictions for all 13 labels in the required order.
Make the modeling decisions needed to get there under CPU-only constraints, including waveform preprocessing, feature/model family, multilabel thresholding, and any class-imbalance handling; the benchmark contract does not prescribe a single fixed recipe.

Software: pandas
Python

Input files:
name: ECG waveform records
format: WFDB `.hea` + `.dat` pairs
description: 2,263 anonymized 12-lead, 500 Hz, 10 s ECGs
name: Record ID list
format: `.csv`
description: One-column CSV with header ecg_id; exact required output ID set
name: Label codebook
format: `.csv`
description: Two-column CSV label,description giving the public meaning of each target label
name: Output template
format: `.csv`
description: Canonical 14-column schema ecg_id plus the 13 label columns, with blank prediction cells and the required row order