Abstract:
An implantable cardiac rhythm management device (pacemaker or defibrillator) having circuitry for determining the interval between two successive natural ventricular depolarization signals, includes the capability of computing and storing histogram arrays of heart rate variability data over a prolonged period, such as 24 hours. By utilizing an algorithm for generating a histographic log and a time domain log wherein a logarithmic data compression technique is implemented, the volume of HRV data collected for later telemetered readout to an external device does not exceed the memory and power capabilities of the implanted device.

Description:
BACKGROUND OF THE INVENTION 
     I. Field of the Invention 
     This invention relates generally to medical electronic diagnostic and/or treatment apparatus and more particularly to an implantable device having means for logging heart rate variability data over extended time periods for subsequent read-out and analysis. 
     II. Discussion of the Prior Art 
     Currently available implantable cardiac pacemakers and defibrillators are capable of collecting and storing a variety of information relating to the instantaneous electrical response of the heart and providing this information in real time, via telemetry link, to an external programmer which may readily be equipped with substantial data processing, storage and display resources. Certain other implantable devices are capable of logging a limited amount of parametric data, typically in the form of various event counters, which is retained in the device for future telemetry and analysis. These arrangements provide useful, but limited, information regarding the status of the heart or progression of the disease. 
     Accurate diagnosis requires evaluation of extensive data over an extended period of time. Long-term telemetry of raw data from an implanted device is undesirable because the low energy available to the implanted transmitter requires that the external receiver be worn by the patient in close proximity to the implanted device. Even then, the transmission of voluminous raw data may prematurely deplete the implanted battery. The preferred device currently used for logging diagnostically useful cardiac data is known as a Holter monitor. It is an external data recorder which monitors and stores cardiac electrical data sensed via surface EKG electrodes. It is desirable to incorporate the data logging function exemplified by the Holter monitor into the implantable pacemaker. However, generally speaking, prior art implantable cardiac devices, such as pacemakers, lack the memory capacity to store the voluminous raw data and/or the power to telemeter it. Well known signal compression techniques offer insufficient compression. 
     Lossless signal compression techniques, such as run length encoding, are well known. Since only redundant elements of the signal are eliminated all of the raw data is recoverable from the compressed signal with exactly the same resolution that it was quantized. However, all lossless compression techniques suffer from an insufficient compression ratio and an intolerable processing load. The highest compression ratios are achieved by first extracting a feature, or set of features, from the raw data, which is well correlated to the cardiac diagnostic process, and then employing lossy compression on the extracted features. Ideally, lossy data compression allows most of the data to be discarded, preserving only the minimum set of data required to adequately characterize the extracted features. 
     Heart Rate Variability (HRV) has been identified as a feature of cardiac activity which is particularly useful for both diagnosis and prognosis. HRV is defined as a measure of the beat-to-beat variance in sinus cycle length over a period of time. It is used as a measure of parasympathetic tone. It has been determined that individuals with diminished HRV have reduced vagal tone and probably are at increased risk of death following myocardial infarction. Various researchers have employed spectral analysis to characterize HRV. (See Coumel et al., &#34;Heart Rate and Heart Rate Variability in Normal Young Adults&#34;, J. Cardiovascular Electrophysiology, Vol. 5, No. 11, November 1994.) Others have elected to characterize Heart Rate Variability by considering the beat-to-beat variability in heart rate. (See Ori, et al., &#34;Heart Rate Variability&#34;, Clinics, Vol. 10, No. 3, August 1992.) This beat-to-beat characterization has been expanded to a two-dimensional histogram which displays the probability density function of the absolute beat-to-beat interval difference as a function of interval. The process of forming such a two-dimensional histogram is defined as &#34;binning&#34;. This process will be subsequently described in detail. In summary, although the prior art shows several ways that heart rate variability data, accumulated over an extended period of time, may be processed to make the data more understandable to a clinician, we are not aware of any teaching of how logging of HRV data might be accomplished within an implantable pacemaker. 
     OBJECTS OF THE INVENTION 
     It is an object of this invention to provide a method and apparatus for very efficiently processing, logging and disseminating the essential features relating to HRV accumulated from a continuous long term monitoring of cardiac activity. The method is sufficiently conservative of data memory, program memory and power consumption that it may be incorporated within an implantable pacemaker to log a 24 hour period of cardiac activity accumulated for subsequent telemetry. The 24 hour data can be converted to a single index through calculation of a standard deviation. These standard deviations can be stored for long-term trend analysis. 
     It is a further object of this invention to provide a method of processing and displaying HRV data received via telemetry from the microprocessor in a manner most easily understood by a clinician and which will provide the greatest graphical contrast between a normal and an abnormal HRV pattern, for example, in a sick heart. 
     SUMMARY OF THE INVENTION 
     Referring to FIG. 1(a), a two-dimensional histogram indicative of the rate variability of a normal heart over a 24 hour interval is illustrated. The X axis corresponds to the interval between an instant pair of consecutive heartbeats with the interval increasing from left to right. The Y axis corresponds to the absolute difference between the instant interval and the immediately preceding interval with the difference increasing from the background to the foreground. The X axis and the Y axis are quantized into bins to form the two-dimensional histogram. The Z axis corresponds to the base 2 logarithm of the frequency of occurrence for each bin. The resulting histogram has the appearance of a mountain with foothills projecting to the right and front. The mountain corresponds to the more typical cardiac interval variations while the foothills correspond to the more atypical and varied activity. It is believed that the entire texture of this histogram is diagnostically useful. The spatial and quantitative relationship of the foothills to the mountain is of particular interest. FIG. 1(b), showing a corresponding presentation for a diseased heart, provides support for this belief. Note that the diseased heart exhibits much less variability. Even without considering the beat-to-beat interval variations, there is less variability of the intervals themselves as shown by the higher and narrower peak for the diseased heart. Further, the foothills indicative of beat-to-beat variability are absent. Logarithmic compression of the Z axis greatly enhances the contrast between FIGS. 1(a) and 1(b) in that the foothills are effectively magnified while the essential information regarding the shape of the mountain is preserved. Fortuitously, the logarithmically compressed binning also yields a very high degree of data compression which can be accomplished with a computationally simple process. 
     In a preferred embodiment of the invention, an implantable stimulator, such as a pacemaker or defibrillator or monitoring device, processes and logs multiple sets of two-dimensional histogram data similar to what is plotted in FIG. 1. Data is accumulated only for sensed beat intervals and not any intervals associated with paced events. Each set corresponds to a fraction of a day and there are a sufficient number of sets to continuously span a 24-hour interval. One possibility may comprise 24 one-hour sets. Hereafter, the data accumulated in this manner over a 24-hour interval will be referred to as the histographic log. Data accumulation is preferably initiated by a telemetry command and proceed automatically to completion. Alternatively, an ongoing mode of logging could be initiated which terminates in response to a particular cardiac condition sensed by the pacemaker. This would provide HRV data coincident with a significant cardiac episode. For either mode, the data is retained for subsequent retrieval via telemetry. The external pacemaker programmer may then develop a display or hard copy presentation of the data. Presentations contemplated include individual histograms for each data set or composite histograms of a plurality of data sets. One particularly useful mode of display, particularly for a video terminal device, is to display the bins of FIG. 1 as a uniform array of squares where the X and Y axes of the display correspond to the X and Y axes of FIG. 1, respectively. The value for each bin, i.e., the Z axis of FIG. 1 is represented as varying colors or shades of grey to thus produce a contour map form of presentation. Alternatively, the data may be displayed as a time lapse graphical display showing motion over, say 24 hours. 
     A single pair of indices, i.e., the mean value and standard deviation of the absolute value of the beat-to-beat difference provides the best summary characterization of the more detailed information provided by the two-dimensional histogram. These indices may be computed for a substantially shorter period than provided by the histographic log to more thoroughly characterize the short and long term trends of heart rate variability. For example, a 24-hour period may be characterized with 288 pairs of data, each pair computed for a five-minute interval. The data can be accumulated in a one-dimensional, 1152 byte Trend array contained in the RAM memory of the pacemaker. The pacemaker logs the square of the variance to thereby move the computationally intensive burden of performing the square root operation required to compute the standard deviation from the pacemaker to the external pacemaker programmer. Hereafter, the set of indices accumulated in this manner will be referred to as the &#34;time domain log&#34;. Although the histographic log and the time domain log each have independent diagnostic value, in a preferred embodiment, a single implantable pacemaker can, alternatively, as commanded via telemetry, generate either log, storing the accumulated data in a common region of memory. 
    
    
     DESCRIPTION OF THE DRAWINGS 
     FIG. 1(a) is a two-dimensional histogram of HRV for a normal healthy heart; 
     FIG. 1(b) is a two-dimensional histogram of HRV for a sick heart; 
     FIG. 2 is a block diagram representation of a DDD pacemaker incorporating the present invention; 
     FIG. 3 is a memory map for the HRV log in accordance with the present invention; 
     FIG. 4 is a plot of histogram bin counters vs. beat-to-beat difference in R-R interval; 
     FIG. 5 is a logic block diagram of the logarithmic compression algorithm employed in implementing the present invention; 
     FIG. 6 is a software flow diagram showing the manner in which the algorithm of FIG. 5 can be implemented in firmware; 
     FIG. 7 is a program flow chart of the software routine used in generating a time domain log. 
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
     FIG. 2 shows a system block diagram of the instant invention. It is representative of a prior art, implantable microprocessor-controlled, dual-chamber demand pacemaker modified to incorporate the invention, but the invention is not limited to this embodiment. implantable pacemaker is shown enclosed by dashed line box 2 Either Read Only Memory 10 or RAM memory 30 contains a program which is executable by Central Processing Unit 20 to perform the well-known functions of DDD pacing and telemetry of data stored in memory 30 to an external programmer device enclosed by dashed line box 42. The programmer 42 is entire conventional. The ROM 10 also contains subprograms for selectively generating both a histographic log and a time domain log. The pacing program conditionally calls one of these subprograms for each occurrence of a sensed ventricular event (heartbeat) preceded by a ventricular event. A pair of status flags determines which, if either, of these subprograms is called. Random Access Memory 30 provides the temporary storage required by all programs, including the data logging subprograms. It also provides storage for the data accumulated in the logging process. The telemetry subprogram controls the additional status flags associated with data logging and to transmit the accumulated log data to the external programmer 42. 
     Although a histographic HRV log may be implemented with a range of parametric values, for this description a square array of bins, e.g., 16×16 bins with each bin being four bits deep, is assumed. FIG. 3 shows a memory map of the region of Random Access Memory 30 used to generate such a log. Each two-dimensional histogram is packed into a 128 byte block of memory designated Histogram 1 to Histogram 24. Each byte contains two 4-bit bins. The counter array contains a one-byte counter for each bin of the histogram array or for 16×16 bins, 256 bytes are needed. These comprise a set of working counters which operate cooperatively with a histogram bin storage array, which is also a counter array, to perform logarithmic compression of the histogram data as it is accumulated. For each bin, the corresponding counter in the counter array functions as a variable weight pre-scaler for the histogram bin counter, i.e., the prescale value increases in accordance with the log of the number of events for a given bin. 
     
                       TABLE 1______________________________________Bin Counter  Event Count                   Pre-Scale Divisor______________________________________0            0          11            1          12            2          13            3          14            4-7        45             8-11      46            12-15      47            16-19      48            20-51      329            52-83      3210            84-115    3211           116-147    3212           148-403    25613           404-659    25614           660-915    25615            916-1171  256______________________________________ 
    
     Table 1 shows how the pre-scale divisor varies to yield a logarithmically compressed count in the corresponding histogram bin counter. For the first four hits, each hit increments the bin counter by one. As used herein, the term &#34;hit&#34; is used to indicate when a measured RR interval and a computed absolute value of the difference in successive RR intervals fall within the range of a given bin. Upon a bin count reaching four, the pre-scale divisor is changed to four. Thus, the bin counter is not again incremented until the eighth hit. The pre-scal divisor also switches to 32 and then to 256 when the bin count reaches 8 and 12 respectively. As the pre-scale divisor is progressively incremented, the higher values of the bin counter acquire a greater weight, i.e., higher bin counter values represent a greater range of hits. 
     The solid stepped line of FIG. 4 graphically shows the value of the histogram bin counter as a function of input event counts, where an input event is a beat-to-beat difference which is within the range of a given histogram bin. The results shown graphically in FIG. 4 are produced by an algorithm based on Table 1. Note that these results generally correspond to the theoretical logarithm of the input event count which is shown as a dashed line in FIG. 4. 
     The logarithmic compression algorithm is implemented in hardware as illustrated in the logic block diagram of FIG. 5. As will be explained, it is also implementable in software. With reference to FIG. 5, counter 50 is shown as a 4-bit synchronous counter whose count value corresponds to an instant bin of the histogram array. Counter 52 is an 8-bit synchronous counter corresponding to the counter from the aforementioned counter array which is paired with counter 50 to function as a pre-scaler. Each heartbeat generates a signal on event line 54 which is connected to the clock inputs of counters 50 and 52. Thus, the counters are incremented in response to a heartbeat event when their respective count enable lines, 56 and 58, are active. AND gates 60, 62 and 64 decode the outputs of counter 52 for values of 3, 31 and 255 respectively. Multiplexor 66 selects one of these decode outputs depending upon the permutations of the two most significant bits of counter 50. Thus, the states of counter 50 equal to 00xx, 01xx, 10xx and 11xx invoke pre-scale divisors of 1, 4, 32 and 256 respectively. Counters 50 and 52 are cleared by a signal on &#34;Begin&#34; line 68. A logical &#34;1&#34; on hit line 70 signals that the beat-to-beat difference is within a given bin and is to be counted by counter pair 50 and 52. The output of AND gate 72 remains ZERO unless count saturation, i.e., 1171 counts is reached. Thus, AND gate 74 remains enabled to activate clock enable line 56, causing counter 52 to be clocked by the event signal 54. Initially, line 6 (P=T) is a logical &#34;1&#34; since the &#34;0&#34; input of multiplexor 66 is selected. Thus, each hit also fully enables AND gate 78 to activate counter enable line 58 and cause counter 50 to be incremented. At this time, reset line 80 is also activated, via OR gate 82, thus holding counter 52 cleared. When the count in counter 50 reaches 4 the &#34;1&#34; input of multiplexor 66 is selected. Now, AND gate 78 is enabled only when AND gate 60 is enabled to invoke a pre-scale value of 4. That is, every fourth hit increments counter 50 and resets counter 52. Pre-scale values of 32 and 256 are invoked as counting proceeds in counter 50 with the selection of multiplexor input &#34;2&#34; and then input &#34;3&#34;. When both counters have filled, AND gates 64 and 84 are enabled to disable AND gates 74 and 78 which freezes the counters to prevent wrap around. 
     FIG. 6 is a software flow diagram which embodies the algorithm of FIG. 5 in firmware rather than hardware. Here, the counters C and P (50 and 52) of FIG. 5 are arrays of counters contained in RAM memory 30. This program is called by the main pacing program for each spontaneous heartbeat (sensed R wave) when the histographic log function is enabled. Each iteration of the program corresponds to a &#34;Hit&#34; signal in FIG. 5. The program fetches the specified counter pair from memory, operates on the counters in the manner of FIG. 5 and stores the results in memory. When initialized, the variable &#34;Cbase&#34; contains the base address corresponding to the beginning of the first histogram array of RAM memory 30. Similarly, &#34;Pbase&#34; contains the base address corresponding to RAM memory for the pre-scaler array. Variable &#34;RR&#34; contains a value indicative of the R-to-R interval, i.e., the elapsed time since the previous heartbeat. Upon being called, step 100 tests the Hour Flag. If an hour has elapsed, Cbase is adjusted at step 102 to point to the next histogram array. At step 104, Cbase is tested against a maximum Cbase limit, Cbase Mx, to assure that the program does not log data outside of the histogram arrays. If the Hour Flag is cleared, execution proceeds directly to step 106 where a scaled value of the R-to-R interval, &#34;RRS&#34;, which corresponds to the bins of the histogram, is computed. For example, if the pacing program counts elapsed time at 128 counts/second, the variable RR in counts may range from 38 to 255 corresponding to a heart rate of 30 to 200 BPM. In this case, scaling coefficients a =0.069 and b=2.626 would be appropriate. Steps 108 and 110 test the value of RRS and clip it, if necessary, to assure that RRS is in the range of 0-15. 
     In a similar manner, steps 112-116 compute a scaled value of the beat-to-beat difference .increment.RRS which ranges from 0-15. At step 112, the absolute difference of the instant R-to-R interval (RR) and the previous R-to-R interval (RR 0 ) is computed. Next RR 0  is set equal to RR to be available for the next iteration. Scaling coefficients c=0.25 and d=0 would be appropriate to scale .increment.RRS to a range of 0-15. Variables RRS and .increment.RRS now define the bin in the two-dimensional histogram which is to be incremented. At step 18, RRS and .increment.RRS are multiplied to compute an index which identifies the relative position of the subject bin in RAM memory 0. 
     Variable, P, is fetched from the counter array of RAM memory 30 using an address which is the sum of &#34;Idx p  &#34; and &#34;Pbase&#34;. Idx p , itself, is an address index for a linear bank of memory with no offset and is used to point to P values. Since the C counters are 4-bit counters which are packed two per byte, Idx c  is formed as in step 118 of FIG. 6. The least significant bit of .increment.RRS is saved to make a selection of either the upper or lower nibble to thus unpack the data. Variable C is fetched from the histogram array of memory 30 using an address which is the sum of Idx c  and Cbase. Steps 120-130 test the state of counter C to determine the value of Mx which corresponds to the value of the pre-scale divisor per Table 1. Counter P is incremented at step 132 and tested against Mx at step 134. If P is less than or equal to Mx and if the carry flag is equal to 0, execution passes directly to step 136 which stores the current values of P and C using the indexes previously described. C must be packed back into memory without disturbing its associated nibble. Following step 136, execution is passed back to the main pacing program. Alternatively, if at step 134 counter P is greater than Mx or the carry flag is &#34;1&#34; then, at step 138, P is cleared and counter, C, is incremented. Steps 140 and 142 clip C at a maximum of 15 to prevent wrap around. For simplicity, the event counter P of FIG. 6 has been described as being an 8-bit counter. Logarithmic compression may also be accomplished with different length counters by computing N x  =2 c  -1. Alternatively, other forms of monotonic, non-linear mapping may implemented with a ROM look-up table. 
     The time domain log is comprised of sequential pairs of data where each data pair describes heart rate variability for a 5-minute interval. The data pair is comprised of the mean value of the R-to-R interval and the variance of the R-to-R interval. The external pacemaker programmer, that is not subject to power constraints, extracts the square root from the variance to obtain the standard deviation external to the implanted device. 
     There is more than one approach to calculating variance. The direct approach is inferior to the indirect method. The direct method for estimating the variance of RR is: 
     
         σ.sub.RR.sup.2 =&lt;RR.sup.2 &gt;-&lt;RR&gt;.sup.2 
    
     The use of this approach requires separate and simultaneous calculation of the 1st and 2nd moments of the data. The approach is numerically ill conditioned, especially when the mean RR is on the order of the standard deviation. Further, fixed-point INTEGER math is poorly suited to this approach, since it introduces large errors in both moment estimates, which when subtracted, yield a poor estimate of variance. 
     The indirect method provides an improvement in numerical performance: 
     
         σ.sub.RR.sup.2 =&lt;[RR-RR].sup.2 &gt;;RR=&lt;RR&gt; 
    
     If the mean is available prior to estimating variance, then this method works fine. For a process with a non-zero mean, subtracting out the mean prior to accumulation reduces the size of the numbers involved and avoids the final subtraction. However, it is not possible to know the mean in advance nor is it desirable to store the set of RR values in an array such that the mean could be calculated followed by the variance. Although the indirect method is preferred, modifications are still required to make the RR variance calculation tractable in an implantable pacemaker. 
     The instance invention employs a novel variation of the indirect method, where an estimate of the mean is substituted. The resulting variance can be corrected after all the data values in the current 5-minute period have been seen. A modified expression for the mean RR is required to instrument this. 
     The usual summation required to evaluate the mean is not necessary with RR interval data when the period of integration is fixed to a constant interval of time. This is the case when calculating the mean RR interval as: ##EQU1## where N(n) is the number of RR intervals in the current period. While N(n) is unknown until the end of the current period, the sum of all the intervals, end-to-end over 5-minutes, is a constant 300 seconds. This feature is a little unusual, but it greatly simplifies what must be done. 
     
         RR(n)=SUM/N(n) ; SUM=a constant 
    
     As indicated above, the variance of RR can be written as the sum of a variance estimate and an error term. 
     
         σ.sub.RR.sup.2 (n)=σ.sub.est.sup.2 (n)+Error(n) 
    
     The estimated variance is simply expressed: ##EQU2## Where N 0  =N(n-1) 
     
         N.sub.1 =N(n) 
    
     But the exact expression for the variance of RR is 
     
         σ.sub.RR.sup.2 =&lt;RR.sup.2 &gt;-(SUM/N.sub.1).sup.2 
    
     Combining the information in the immediately preceding two equations yields: ##EQU3## Simplifying and solving for the error correction gives: ##EQU4## An expansion of the error function above provides a correction which may be practically computed in a pacemaker&#39;s microprocessor. After some manipulation and retaining, only the first two terms in the expansion, the above error correction equation reduces to: ##EQU5## The corrected expression for the variance becomes: ##EQU6## 
     Where: N 1  =N(n) 
     N 0  =N(n-1) 
     .increment.N=N(n)-N(n-1) 
     RR(n-1)=SUM/N(n-1) 
     The next step is to apply node scaling to the accumulation step in the preceding equation. During the simulation of RR intervals, values which occasionally exceeded 255 were observed. This was with an RR resolution of 1/128 or 128 counts corresponding to 1 second. In order to avoid clipping, all RR values were right shifted one bit. This allows the inputs to the accumulator to be represented in 8-bits. 
     Further scaling is required to insure that the accumulation sum fits within a 16-bit representation. To accomplish the above, the variance equation is modified: ##EQU7## 
     Where: X 0  =RR(n-1) 
     SUM=300*Countsec 
     Countsec=Counts/Second=128. 
     ∝=8 
     FIG. 7 shows a flow diagram of a subprogram which employs the novel variance algorithm to generate a time domain log. As with the histogram subprogram, this program is called by the main pacing program for each spontaneous heartbeat (sensed R wave) when the time domain log function is enabled and passes the variable RR indicative of the R-to-R interval. Upon initialization, the variable, N, which counts the number of events in a 5-minute period, is cleared, the variable, Idx, is set to a value corresponding to the first address of the log data array and a dummy, non-zero value is chosen for No. When the subprogram is called, step 200 tests the 5-Minute Flag, which indicates the end of the 5-minute sampling period. If this flag is cleared, step 202 increments the variable N. At step 204, RR is shifted right one place to prevent overflow in subsequent calculations. Variable, X 0  is one half of the mean value computed for the preceding period. This provides the estimate for the mean of the current period. The difference between the adjusted value of RR and X 0  is squared, multiplied by 1/2 and added to VSum. Sixteen-bit multiplication is used to perform the square operation and VSum is accumulated in a register. 
     As the subprogram is re-entered with each new value of RR, VSum progressively accumulates the sum of the squares of the difference between RR and the estimated mean. If the 5-minute flag is set, the subprogram branches to compute the mean value and the square of the variance. At step 208, which is repeated every five minutes, the instant and previous values of N are used to compute the correction required to compensate for the difference between the estimated and actual value of the mean value. At Step 210 The variable σ 2  is computed. First, N is divided by 8 (∝=8), then VSum is divided by the scaled value of N. Finally, the error correction is subtracted to obtain the actual value. Overflow and truncation errors are minimized by employing well-known scaling techniques at steps 208 and 210. At step 212, the mean value of the R-to-R interval is computed by dividing a constant Sum by N. This computation relies upon the fact that for sinus rhythm the sum of the R-to-R intervals is a constant. Paced events are ignored and their time is thus subtracted from the 300 seconds. On the first pass after initialization, Step 214 is skipped. Otherwise, it stores the computed data in RAM memory 30, using Idx as a pointer. If Step 216 determines that Idx is greater than Mx, a Log Full Flag is set to inhibit the pacer program from making further calls to this subprogram, which would overrun the log data array. At step 220, N 0  is set equal to N to prepare for the next error calculation and N is cleared. The variable X 0  is set to one half the Mean to provide a new estimate for the next set of calculations. With valid values of N 0  and X 0  now established, subsequent calculations will be accurate and will be logged at step 214 .