Title: ECG Superclass Ptbxl
Domain: health_medicine — Therapeutic & Oncology Services

Summary: Variant ptbxl 1386: Single PTB XL derived diagnostic superclass benchmark slice with 1,386 anonymized ECG records.

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

## Variant
`ptbxl_1386`: Single PTB-XL-derived diagnostic superclass benchmark slice with 1,386 anonymized ECG records.

## Your Task
Produce multilabel diagnostic superclass predictions for the staged WFDB ECG records.

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

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

## What You Must Do
1. Read the staged ECG records from `ptbxl_1386\input\records`.
2. Use `ptbxl_1386\input\record_ids.csv` as the exact required output row set.
3. Use any CPU-feasible multilabel workflow you judge appropriate, including signal interpretation, feature engineering, classical ML, or pretrained open-source ECG models.
4. Write one CSV exactly to:
   `ptbxl_1386\output\predictions.csv`

## Output Requirements
- The file must be named exactly `predictions.csv`
- The columns must be exactly:
  `ecg_id, NORM, MI, STTC, CD, HYP`
- Include exactly the ECG IDs from `ptbxl_1386\input\record_ids.csv`
- Every label value must be binary: `0` or `1`
- Do not save extra files into `ptbxl_1386\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

The agent must:
Open the staged task directory on the Windows VM and inspect the ECG bundle under `input/`.
Load all 1,386 WFDB records from `input/records/` and build a multi-label classifier for the five superclass labels `NORM`, `MI`, `STTC`, `CD`, and `HYP`.
Write `output/predictions.csv` with exactly the IDs from `input/record_ids.csv` and binary predictions for all five labels.
Make the modeling decisions needed to get there under CPU-only constraints, including waveform preprocessing, model selection, multilabel thresholding, and whether to use direct signal interpretation, classical ML, or publicly available pretrained ECG models.

Software: pandas
Python

Input files:
name: ECG waveform records
format: WFDB `.hea` + `.dat` pairs
path: input/records/
description: 1,386 anonymized 12-lead, 500 Hz, 10 s ECGs
name: Record ID list
format: `.csv`
path: input/record_ids.csv
description: Exact required output ID set
name: Label codebook
format: `.csv`
path: input/label_codebook.csv
description: Public meanings of the 5 superclass labels
name: Output template
format: `.csv`
path: input/template_output.csv
description: Canonical header and row order for predictions.csv