Unit 4 / 11

Biosignal Processing: ECG and Cardiac Signals

Gains:

  • Ability to explain the role of artificial intelligence in the noise removal, wave detection and rhythm classification steps of the ECG signal
  • Ability to critically evaluate model outputs with physiological range, artifact and clinical context
  • Understanding that cardiac AI recommendations are separate from diagnostic decisions that require physician approval

Electrocardiography (ECG; ECG or EKG in English) is the recording of the electrical activity produced by the heart with each beat with electrodes on the skin. The resulting curve is the most common biosignal in medicine, indicating the heart's rhythm and conduction. A biosignal is a measurable quantity that changes over time from a living organism. The ECG is an excellent study area from an engineering perspective: it has well-defined waves (P, QRS, T), known physiological ranges and huge data volume. Artificial intelligence offers strong support in ECG with noise removal, wave detection and rhythm classification. In this unit, we will see these steps, physiological confirmation, and why the final diagnosis remains with the physician.

Let's be clear from the start: an ECG pattern may say "atrial fibrillation is possible"; But this is a warning, not a diagnosis. AI does not diagnose; The physician makes the decision together with the patient.

ECG Processing Chain

Step 1 — Signal acquisition and noise removal. Raw ECG; include network noise (50/60 Hz), baseline drift (baseline drifting with breathing and movement), and muscle artifact. Filtering (bandpass filters) and, in modern approaches, AI-based noise removal reduce these distortions. Critical point: filtering should not delete real information either; Excessive filtering may obscure true ischemia by distorting the ST segment.

Step 2 — Wave detection (delineation). The model detects the P wave, QRS complex and T wave. The most basic output is R peak detection; The distance between consecutive R peaks (R-R interval) gives heart rate and rhythm regularity.

Step 3 — Feature extraction. Features such as R-R intervals, QT duration, ST level, wave morphology are calculated. These serve as both clinical interpretation and model input.

Step 4 — Rhythm/anomaly classification. The model suggests classes such as atrial fibrillation, ventricular premature beat, or normal sinus rhythm. The output is a label and confidence score.

Step 5 — Physician evaluation. The recommendation is presented to the physician along with the clinical context (symptoms, medication, history). The diagnosis belongs to the doctor.

Physiological Ranges: Quick Validation Anchor

Order of magnitude control is very strong in the ECG because physiological ranges are clear:

  • Heart rate at rest: 50-100 beats/minute (may decrease to 40 for athletes).
  • Normal QRS duration: 80-120 ms; A wider QRS suggests conduction delay.
  • Corrected QT (QTc): roughly 350-450 ms in adults; Above 500 ms can be dangerous.
  • The P wave precedes every normal QRS.

If the model gave a heart rate of 250, either a true tachyarrhythmia is present or the noise has been counted as an R peak (double counting). You can't make this distinction without looking at the raw signal; This is where the discipline of verification comes into play.

Three Mini Cases: By the Numbers

Case 1 — Artifact mimicking arrhythmia. During one patient monitoring, the model sounded a "ventricular tachycardia" alarm for 3 minutes. When the raw signal was examined, it was seen that the patient was brushing his teeth and the muscle artifact mimicked the QRS. Physiological plausibility (the patient was symptom-free and stable at this time) and raw signal checking resolved the false alarm. Model warned, raw signal corrected.

Case 2 — Scanning speed. A cardiology clinic was reviewing 24-hour Holter recordings (portable continuous ECG); Average 20 minutes per recording. AI pre-marking reduced review time to 7 minutes by highlighting possible events. The model did not close any event on its own; The technician and cardiologist reviewed each sign.

Case 3 — Double counting error. In a patient with a high T wave, the model also counted the T wave as the R peak, reporting a heart rate twice the actual value (about 300 instead of 150). The order of magnitude check — “300 bpm is not a sustainable rhythm” — immediately gave away the error, and the R peak threshold was corrected.

Weak Prompt / Strong Prompt

Note: The prompts below are helpful in interpreting the ECG report/parameter text; Raw ECG diagnosis is the work of a confirmed device and physician.

Weak prompt:

Look at these ECG values, what happened to the patient?[values]

Powerful prompt:

Your role: You are a cardiac signal analysis assistant (YOU ARE NOT DIAGNOSIS). Evaluate the following anonymous ECG parameters:- Compare each parameter to its normal range (HR, PR, QRS, QTc).- Mark out-of-range values, but do not make a diagnosis.- Note cases where values may be due to artifact (“double counting suspicion”).- At the end, list 3 points that the physician should confirm in the raw signal. Anonymous parameters: [HR, PR, QRS, QTc, rhythm tag]

Four Copiable Templates

1) Parameter-range control:

Compare the following ECG parameters with normal adult ranges and tabulate the deviations. Don't diagnose. Parameters: [list]

2) Artifact suspicion elimination:

Is this rhythm tag and heart rate physiologically reasonable? If not, explain which artifact (double count, muscle, baseline) it might be imitating. Data: [values]

3) Holter summary outline:

Group the following anonymous Holter event list by event type to produce a frequency table. Mark each group as "high/low cardiologist priority" and let him decide.List: [events]

4) QT security note:

Compare QTc to adult thresholds; If it is above 500 ms, draft a physician warning note reminding you that medication and electrolyte control is required. Value: [QTc]

Model's Role: By Task Type

Task type

AI contribution

criticality

verification

Noise removal/preprocessing

high

low

Raw signal comparison

R crest/wave detection

high

medium

physiological range

Rhythm pre-sorting

high

high

Physician + raw signal

Holter event prioritization

high

medium

Cardiologist review

Diagnosis/treatment decision

limited

very high

Full physician approval

Tip: Always look at the raw signal before believing the output of an ECG pattern. In cardiac AI, the vast majority of errors arise from artifact mimicking the real wave, and this is only visible in the raw trace.
Caution: Excessive filtering produces a cosmetically “clean” signal but may erase diagnostically critical details such as the ST segment. A clear-looking signal does not mean the correct signal; filter settings should be validated clinically.

Common mistakes

  • Trusting the tag without looking at the raw signal. Artifacts mimic arrhythmias; This is the most common source of error.
  • Excessive filtering. Diagnostic information may also be erased along with the noise.
  • Overlooking double counting. A high T wave can double the heart rate; The order of magnitude captures this.
  • Mistaking consumer device data for clinical data. A single-channel smartwatch ECG is not a replacement for a 12-lead diagnostic ECG.
  • Mistaking the model for diagnostics. The model warns; Rhythm diagnosis and treatment belong to the physician.

In summary

  • The ECG workflow consists of noise removal, wave detection, feature extraction, and rhythm classification.
  • Physiological intervals (HR, QRS, QTc) are a powerful and fast validation anchor.
  • Most errors arise because the artifact imitates the real wave; Raw signal control is a must.
  • Excessive filtering may delete diagnostic information; A clean signal does not mean a correct signal.
  • Rhythm tags are warnings; The diagnosis and treatment decision belongs to the physician.

Application task

Prepare an ECG parameter set (HR, PR, QRS, QTc, rhythm label) and deliberately insert a non-physiological value (e.g. HR 280) into it. Have the model evaluate using the powerful prompt and observe whether the model flags this value as suspected of artifact. Then “which anchor (physiological range or raw signal) captures this error?” Answer the question with a paragraph.

checklist

  • [ ] I know the noise removal, detection, feature and classification steps of the ECG processing chain.
  • [ ] I can use basic physiological ranges (HR, QRS, QTc) as validation anchors.
  • [ ] I realized that artifact mimics arrhythmia and raw signal control is essential.
  • [ ] I understand that excessive filtering can delete diagnostic information.
  • [ ] I internalized that the rhythm label is a warning and the diagnosis remains with the doctor.