infirmary-integrated icon indicating copy to clipboard operation
infirmary-integrated copied to clipboard

Tracing Realism: A-Fib & A-Flutter

Open tanjera opened this issue 1 year ago • 1 comments

Needs realistic update to tracing algorithms for atrial fibrillation and atrial flutter. Current tracings have unrealistic outcomes.

  • [x] Atrial fibrillation: baseline atrial activity too "sawtooth" (predictable)
  • [ ] Atrial flutter: atrial activity sawteeth slightly out of phase with RR phase... align phase for realistic synchronicity

tanjera avatar Jun 10 '23 18:06 tanjera

Atrial fibrillation isoelectric drawing updated to:

public static List<PointD> ECG_Isoelectric__Atrial_Fibrillation (Physiology? _P, Lead? _L) {
            if (_P is null || _L is null)
                return new ();

            int Fibrillations = (int)System.Math.Ceiling (_P.GetHR_Seconds / 0.08);
            List<PointD> thisBeat = new ();
            for (int i = 1; i < Fibrillations; i++)
                thisBeat = Plotting.Concatenate (thisBeat, ECG_P (_P, _L,
                    Math.RandomDbl (0.04d, 0.12d),                                                                          // fibrillatory wave interval
                    (Math.RandomInt (0, 3) == 0 ? Math.RandomDbl (-0.04d, -0.02d) : Math.RandomDbl (0.02d, 0.06d)),         // fibrillation amplitude
                    0d, Plotting.Last (thisBeat)));

            return thisBeat;
        }
  • Wave interval randomized around 0.08 sec (0.04 - 0.12 sec)
  • Fibrillatory amplitude switched to be 33% negative deflection, 66% positive inflection
    • No actual clinical basis for this, but visually examining fibrillatory waveforms, this seems to give a more accurate rendition
  • Fibrillatory amplitudes set to -0.04 - -0.02 for negative deflections, 0.02 - 0.06 for positive inflections
    • Again, no actual clinical basis, but this most accurately simulates the variety of rhythms examined in my clinical experience and in reference materials

Overall, a huge improvement in clinical realism for atrial fibrillation's isoelectric drawing!

tanjera avatar Jun 10 '23 19:06 tanjera