fig1 illustrates one embodiment of the guardian system 10 consisting of an implanted cardiosaver 5 and external equipment 7 . the battery powered cardiosaver 5 contains electronic circuitry that can detect a cardiac event such as an acute myocardial infarction or arrhythmia and warn the patient when the event occurs . the cardiosaver 5 can store the patient &# 39 ; s electrogram for later readout and can send wireless signals 53 to and receive wireless signals 54 from the external equipment 7 . the functioning of the cardiosaver 5 will be explained in greater detail with the assistance of fig4 . the cardiosaver 5 has two leads 12 and 15 that have multi - wire electrical conductors with surrounding insulation . the lead 12 is shown with two electrodes 13 and 14 . the lead 15 has subcutaneous electrodes 16 and 17 . in fact , the cardiosaver 5 could utilize as few as one lead or as many as three and each lead could have as few as one electrode or as many as eight electrodes . furthermore , electrodes 8 and 9 could be placed on the outer surface of the cardiosaver 5 without any wires being placed externally to the cardiosaver 5 . the lead 12 in fig1 could advantageously be placed through the patient &# 39 ; s vascular system with the electrode 14 being placed into the apex of the right ventricle . the lead 12 with electrode 13 could be placed in the right ventricle or right atrium or the superior vena cava similar to the placement of leads for pacemakers and implantable coronary defibrillators ( icds ). the metal case 11 of the cardiosaver 5 could serve as an indifferent electrode with either or both electrodes 13 and / or 14 being active electrodes . it is also conceived that the electrodes 13 and 14 could be used as bipolar electrodes . alternately , the lead 12 in fig1 could advantageously be placed through the patient &# 39 ; s vascular system with the electrode 14 being placed into the apex of the left ventricle . the electrode 13 could be placed in the left atrium . the lead 15 could advantageously be placed subcutaneously at any location where the electrodes 16 and / or 17 would provide a good electrogram signal indicative of the electrical activity of the heart . again for this lead 15 , the case 11 of the cardiosaver 5 could be an indifferent electrode and the electrodes 16 and / or 17 could be active electrodes or electrodes 16 and 17 could function together as bipolar electrodes . the cardiosaver 5 could operate with only one lead and as few as one active electrode with the case of the cardiosaver 5 being an indifferent electrode . the guardian system 10 described herein can readily operate with only two electrodes . one embodiment of the cardiosaver device 5 using subcutaneous lead 15 would have the electrode 17 located under the skin on the patient &# 39 ; s left side . this could be best located between 2 and 20 inches below the patient &# 39 ; s left arm pit . the cardiosaver case 11 could act as the indifferent electrode and would typically be implanted under the skin on the left side of the patient &# 39 ; s chest . fig1 also shows the external equipment 7 that consists of a physician &# 39 ; s programmer 68 having an antenna 70 , an external alarm system 60 including a charger 166 . the external equipment 7 provides means to interact with the cardiosaver 5 . these interactions include programming the cardiosaver 5 , retrieving data collected by the cardiosaver 5 and handling alarms generated by the cardiosaver 5 . the purpose of the physician &# 39 ; s programmer 68 shown in fig1 is to set and / or change the operating parameters of the implantable cardiosaver 5 and to read out data stored in the memory of the cardiosaver 5 such as stored electrogram segments . this would be accomplished by transmission of a wireless signal 54 from the programmer 68 to the cardiosaver 5 and receiving of telemetry by the wireless signal 53 from the cardiosaver 5 to the programmer 68 . when a laptop computer is used as the physician &# 39 ; s programmer 68 , it would require connection to a wireless transceiver for communicating with the cardiosaver 5 . such a transceiver could be connected via a standard interface such as a usb , serial or parallel port or it could be inserted into the laptop &# 39 ; s pcmcia card slot . the screen on the laptop would be used to provide guidance to the physician in communicating with the cardiosaver 5 . also , the screen could be used to display both real time and stored electrograms that are read out from the cardiosaver 5 . in fig1 the external alarm system 60 has a patient operated initiator 55 , an alarm disable button 59 , a panic button 52 , an alarm transceiver 56 , an alarm speaker 57 and an antenna 161 and can communicate with emergency medical services 67 with the modem 165 via the communication link 65 . if a cardiac event is detected by the cardiosaver 5 , an alarm message is sent by a wireless signal 53 to the alarm transceiver 56 via the antenna 161 . when the alarm is received by the alarm transceiver 56 a signal 58 is sent to the loudspeaker 57 . the signal 58 will cause the loudspeaker to emit an external alarm signal 51 to warn the patient that an event has occurred . examples of external alarm signals 51 include a periodic buzzing , a sequence of tones and / or a speech message that instructs the patient as to what actions should be taken . furthermore , the alarm transceiver 56 can , depending upon the nature of the signal 53 , send an outgoing signal over the link 65 to contact emergency medical services 67 . when the detection of an acute myocardial infarction is the cause of the alarm , the alarm transceiver 56 could automatically notify emergency medical services 67 that a heart attack has occurred and an ambulance could be sent to treat the patient and to bring him to a hospital emergency room . if the remote communication with emergency medical services 67 is enabled and a cardiac event alarm is sent within the signal 53 , the modem 165 will establish the data communications link 65 over which a message will be transmitted to the emergency medical services 67 . the message sent over the link 65 may include any or all of the following information : ( 1 ) a specific patient is having an acute myocardial infarction or other cardiac event , ( 2 ) the patient &# 39 ; s name , address and a brief medical history , ( 3 ) a map and / or directions to where the patient is located , ( 4 ) the patient &# 39 ; s stored electrogram including baseline electrogram data and the specific electrogram segment that generated the alarm ( 5 ) continuous real time electrogram data , and ( 6 ) a prescription written by the patient &# 39 ; s personal physician as to the type and amount of drug to be administered to the patient in the event of a heart attack . if the emergency medical services 67 includes an emergency room at a hospital , information can be transmitted that the patient has had a cardiac event and should be on his way to the emergency room . in this manner the medical practitioners at the emergency room could be prepared for the patient &# 39 ; s arrival . the communications link 65 can be either a wired or wireless telephone connection that allows the alarm transceiver 56 to call out to emergency medical services 67 . the typical external alarm system 60 might be built into a pocket pc or palm pilot pda where the alarm transceiver 56 and modem 165 are built into insertable cards having a standardized interface such as compact flash cards , pcmcia cards , multimedia , memory stick or secure digital ( sd ) cards . the modem 165 can be a wireless modem such as the sierra aircard 300 or the modem 165 may be a wired modem that connects to a standard telephone line . the modem 165 can also be integrated into the alarm transceiver 56 . the purpose of the patient operated initiator 55 is to give the patient the capability for initiating transmission of the most recently captured electrogram segment from the cardiosaver 5 to the external alarm system 60 . this will enable the electrogram segment to be displayed for a medical practitioner . the alarm disable button 59 will turn off the internal alarm signal generated within the cardiosaver 5 and / or the external alarm signal 51 played through the speaker 57 . the patient might press the panic button 52 in the event that the patient feels that he is experiencing a cardiac event . the panic button 52 will initiate the transmission from the cardiosaver 5 to the external alarm system 60 via the wireless signal 53 of both recent and baseline electrogram segments . the external alarm system 60 will then retransmit these data via the link 65 to emergency medical services 67 where a medical practitioner will view the electrogram data . the remote medical practitioner could then analyze the electrogram data and call the patient back to offer advice as to whether this is an emergency situation or the situation could be routinely handled by the patient &# 39 ; s personal physician at some later time . it is envisioned that there may be preset limits within the external alarm system 60 that prevent the patient operated initiator 55 and / or panic button from being used more than a certain number of times a day to prevent the patient from running down the batteries in the cardiosaver 5 and external alarm system 60 as wireless transmission takes a relatively large amount of power as compared with other functional operation of these devices . fig2 illustrates a typical electrogram signal from some pair of implanted electrodes such as the electrode 14 and the case 11 of fig3 overlaid with an elevated st segment 4 . the various portions of the electrogram are shown as the p , q , r , s , and t waves . these are all shown as portions of a heavy solid line in fig2 . the normal st segment 3 is also shown in fig2 . when an acute myocardial infarction occurs , there is typically an elevation ( or depression ) of the st segment 4 as shown by the light solid line in fig2 . it is this shift of the st segment 4 as compared to the baseline st segment 3 that is a clear indicator that an acute myocardial infarction has occurred in a significant portion of the patient &# 39 ; s myocardium . although an elevated st segment 4 can be a good indicator of an acute myocardial infarction , other indicators such as a sudden change of heart rate or heart wall motion , intra - coronary blood pressure or a sudden decrease in blood po 2 could also be used as independent sensing means or those signals could be used in addition to the voltage shift of the st segment 4 . it is important to note that the electrogram from implanted electrodes may provide a faster detection of an st segment shift as compared to an electrocardiogram signal obtained from skin surface electrodes . thus the electrogram from implanted electrodes as described herein is the preferred embodiment of the present invention . it is also well known that the t wave can shift very quickly when a heart attack occurs . it is envisioned that the present invention might detect this t wave shift as compared to a time of 1 to 5 minutes in the past . it is anticipated that when a patient who has a stenosis in a coronary artery is performing a comparatively strenuous exercise his heart rate increases and he can develop exercise induced ischemia that will also result in a shift of the st segment of his electrogram . this is particularly true for patients who have undergone balloon angioplasty with or without stent implantation . such patients will be informed by their own physician that , if their cardiosaver 5 of fig1 activates an alarm during exercise , that it may be indicative of the progression of an arterial stenosis in one of the heart &# 39 ; s arteries . such a patient would be advised to stop all exertion immediately and if the alarm signal goes away as his heart rate slows , the patient should see his doctor as soon as convenient . if the alarm signal does not go away as the patient &# 39 ; s heart rate slows down into the normal range then the cardiosaver will change the alarm signal to indicate that the patient should immediately seek medical care . as previously described , the cardiosaver 5 could emit a different signal if there is a heart attack as compared to the signal that would be produced if there were ischemia resulting from exercise . it is also envisioned that heart rate and the rate of change of heart rate experienced during an st segment voltage shift can be used to indicate which alarm should be produced by the cardiosaver 5 . specifically , an st segment shift at a near normal heart rate would indicate an acute myocardial infarction . an st segment shift when there is an elevated heart rate ( e . g ., greater than 100 bpm ) would generally be indicative of a progressing stenosis in a coronary artery . in any case , if a sufficient st segment shift occurs that results in an alarm from the cardiosaver 5 , the patient should promptly seek medical care to determine the cause of the alarm . it should be understood that , depending on a patient &# 39 ; s medical condition , a vigorous exercise might be as energetic as running a long distance or merely going up a flight of stairs . after the cardiosaver 5 is implanted in a patient who has undergone a stent implant , he should have a stress test to determine his level of st segment shift that is associated with the highest level of exercise that he can attain . the patient &# 39 ; s heart rate should then be noted and the cardiosaver thresholds for detection , described with fig5 through 9 , should be programmed so as to not alarm at st segment shifts observed during exercise . then if at a later time the patient experiences an increased shift of his st segment at that pre - determined heart rate or within a heart rate range , then an alarm indicating ischemia can be programmed to occur . the occurrence of such an alarm can indicate that there is a progression in the narrowing of some coronary artery that may require angiography to determine if angioplasty , possibly including stent implantation , is required . the alarm signal associated with an excessive st shift caused by an acute myocardial infarction can be quite different from the “ see doctor ” alarm means associated with progressing ischemia during exercise . for example , the see doctor alarm signal might be an audio signal that occurs once every 5 to 10 seconds . a different alarm signal , for example an audio signal that is three buzzes every 3 to 5 seconds , may be used to indicate a major cardiac event such as an acute myocardial infarction . similar alarm signal timing would typically be used for both internal alarm signals generated by the alarm sub - system 48 of fig4 and external alarm signals generated by the external alarm system 60 . in any case , a patient can be taught to recognize which signal occurs for these different circumstances so that he can take immediate response if an acute myocardial infarction is indicated but can take a non - emergency response if progression of the narrowing of a stenosis or some other less critical condition is indicated . it should be understood that other distinctly different audio alarm patterns could be used for different arrhythmias such as atrial fibrillation , atrial flutter , pvc &# 39 ; s , pac &# 39 ; s , etc . a capability of the physician &# 39 ; s programmer 68 of fig1 would be to program different alarm signal patterns , enable or disable detection and / or generation of associated alarm signals in the cardiosaver for any one or more of these various cardiac events . also , the intensity of the audio alarm , vibration or electrical tickle alarm could be adjusted to suit the needs of different patients . in order to familiarize the patient with the different alarm signals , the programmer 68 of the present invention would have the capability to turn each of the different alarm signals on and off . fig3 is a plan view of the cardiosaver 5 having a case 11 and a plastic header 20 . the case 11 contains the battery 22 and the electronics module 18 . this type of package is well known for pacemakers , implantable defibrillators and implantable tissue stimulators . electrical conductors placed through the plastic header 20 connect the electronics module 18 to the electrical leads 12 and 15 , which have respectively electrodes 14 and 17 . the on - case electrodes 8 and 9 of fig1 are not shown in fig3 . it should also be understood that the cardiosaver 5 can function with only two electrodes , one of which could be the case 11 . all the different configurations for electrodes shown in fig1 and 3 , such as the electrodes 8 , 9 , 13 , 14 , 16 or the metal case 11 are shown only to indicate that there are a variety of possible electrode arrangements that can be used with the cardiosaver 5 . on the metal case 11 , a conducting disc 31 mounted onto an insulating disc 32 can be used to provide a subcutaneous electrical tickle to warn the patient that an acute myocardial infarction is occurring or to act as an independent electrode . fig4 is a block diagram of the cardiosaver 5 with battery 22 . the electrodes 14 and 17 connect with wires 12 and 15 respectively to the amplifier 36 that is also connected to the case 11 acting as an indifferent electrode . as two or more electrodes 12 and 15 are shown here , the amplifier 36 would be a multi - channel amplifier . the amplified electrogram signals 37 from the amplifier 36 are then converted to digital signals 38 by the analog - to - digital converter 41 . the digital electrogram signals 38 are buffered in the first - in - first - out ( fifo ) memory 42 . processor means shown in fig4 as the central processing unit ( cpu ) 44 coupled to memory means shown in fig4 as the random access memory ( ram ) 47 can process the digital electrogram data 38 stored the fifo 42 according to the programming instructions stored in the program memory 45 . this programming ( i . e . software ) enables the cardiosaver 5 to detect the occurrence of a cardiac event such as an acute myocardial infarction . a clock / timing sub - system 49 provides the means for timing specific activities of the cardiosaver 5 including the absolute or relative time stamping of detected cardiac events . the clock / timing sub - system 49 can also facilitate power savings by causing components of the cardiosaver 5 to go into a low power standby mode in between times for electrogram signal collection and processing . such cycled power savings techniques are often used in implantable pacemakers and defibrillators . in an alternate embodiment , the clock / timing sub - system can be provided by a program subroutine run by the central processing unit 44 . in an advanced embodiment of the present invention , the clock / timing circuitry 49 would count for a first period ( e . g . 20 seconds ) then it would enable the analog - to - digital converter 41 and fifo 42 to begin storing data , after a second period ( e . g . 10 seconds ) the timing circuitry 49 would wake up the cpu 44 from its low power standby mode . the cpu 44 would then process the 10 seconds of data in a very short time ( typically less than a second ) and go back to low power mode . this would allow an on off duty cycle of the cpu 44 which often draws the most power of less than 2 seconds per minute while actually collecting electrogram data for 20 seconds per minute . in a preferred embodiment of the present invention the ram 47 includes specific memory locations for 3 sets of electrogram segment storage . these are the recent electrogram storage 472 that would store the last 2 to 10 minutes of recently recorded electrogram segments so that the electrogram data leading in the period just before the onset of a cardiac event can be reviewed at a later time by the patient &# 39 ; s physician using the physician &# 39 ; s programmer 68 of fig1 . for example , the recent electrogram storage 472 might contain eight 10 second long electrogram segments that were captured every 30 seconds over the last 4 minutes . the baseline electrogram memory 474 would provide storage for baseline electrogram segments collected at preset times over one or more days . for example , the baseline electrogram memory 474 might contain 24 baseline electrogram segments of 10 seconds duration , one from each hour for the last day . the event memory 476 occupies the largest part of the ram 47 . the event memory 476 is not overwritten on a regular schedule as are the recent electrogram memory 472 and baseline electrogram memory 474 but is typically maintained until read out by the patient &# 39 ; s physician with the programmer 68 of fig1 . at the time a cardiac event like excessive st shift indicating an acute myocardial infarction is detected by the cpu 44 , all ( or part ) of the entire contents of the baseline and recent electrogram memories 472 and 474 would typically be copied into the event memory 476 so as to save the pre - event data for later physician review . the ram 47 also contains memory sections for programmable parameters 471 and calculated baseline data 475 . the programmable parameters 471 include the upper and lower limits for the normal and elevated heart rate ranges , and physician programmed parameters related to the cardiac event detection processes stored in the program memory 45 . the calculated baseline data 475 contain detection parameters extracted from the baseline electrogram segments stored in the baseline electrogram memory 474 . calculated baseline data 475 and programmable parameters 471 would typically be saved to the event memory 476 following the detection of a cardiac event . the ram 47 also includes patient data 473 that may include the patient &# 39 ; s name , address , telephone number , medical history , insurance information , doctor &# 39 ; s name , and specific prescriptions for different medications to be administered by medical practitioners in the event of different cardiac events . it is envisioned that the cardiosaver 5 could also contain pacemaker circuitry 170 and / or defibrillator circuitry 180 similar to the cardiosaver systems described by fischell in u . s . pat . no . 6 , 240 , 049 . the alarm sub - system 48 contains the circuitry and transducers to produce the internal alarm signals for the cardiosaver 5 . the internal alarm signal can be a mechanical vibration , a sound or a subcutaneous electrical tickle or shock . the telemetry sub - system 46 with antenna 35 provides the cardiosaver 5 the means for two - way wireless communication to and from the external equipment 7 of fig1 . existing radiofrequency transceiver chip sets such as the ash transceiver hybrids produced by rf microdevices , inc . can readily provide such two - way wireless communication over a range of up to 10 meters from the patient . it is also envisioned that short range telemetry such as that typically used in pacemakers and defibrillators could also be applied to the cardiosaver 5 . it is also envisioned that standard wireless protocols such as bluetooth and 802 . 11a or 802 . 11b might be used to allow communication with a wider group of peripheral devices . a magnet sensor 190 may be incorporated into the cardiosaver 5 . an important use of the magnet sensor 190 is to turn on the cardiosaver 5 on just before programming and implantation . this would reduce wasted battery life in the period between the times that the cardiosaver 5 is packaged at the factory until the day it is implanted . fig5 illustrates in the form of a block diagram the operation of the heart signal processing program 450 for cardiac event detection by the cardiosaver 5 of fig1 - 4 . the heart signal processing program 450 is an example of one of many such detection programs whose instructions could reside in the program memory 45 for use by the cpu 44 of the cardiosaver 5 as shown in fig4 . the main section of the heart signal processing program 450 begins with step 451 where the event counter “ k ” is set to zero indicating there have been no detected events . next , in step 452 the cardiosaver 5 is said to sleep for x seconds . the term sleep here indicates that for a period of x seconds , the cardiosaver 5 would either be placed in a low power standby mode ( if available ) or would otherwise simply wait for a time of x seconds before moving to step 453 . step 453 following 452 has an electrogram segment representing y seconds of electrogram data captured into the fifo buffer 42 of fig4 . σ is the data sampling rate in samples per second , thus the total number of samples collected in step 453 is a multiplied by y . it is envisioned that x would be a time between 5 seconds and 5 minutes with 20 seconds as a preferred value . y would be between 3 and 30 seconds with 10 seconds as a preferred value . σ is typically between 100 and 500 samples per second with 200 samples per second being a preferred value . after being captured , in step 454 , the y seconds of electrogram data representing the most recent electrogram segment is transferred to the recent electrogram memory 472 of fig4 . at this time the processing and analysis of the data begins . throughout the remainder of this detailed description of the drawings , the “ y second long electrogram segment ” refers to the most recently collected y seconds of electrogram data that have been captured and transferred to the recent electrogram memory 472 by the steps 453 and 454 . the term “ recent electrogram segments ” refers to all of the electrogram segments stored in the recent electrogram memory 472 . for example , there could be eight total 10 second long recent electrogram segments that were captured at 30 second intervals over a 4 minute period . the first processing step following the collection of the y second long electrogram segment is step 455 that measures the intervals between the r waves in the most y second long electrogram segment . these r — r intervals are then used to calculate the average heart rate and r — r interval variation for the y second long electrogram segment . if the average heart rate is below a programmed low heart rate limit ρ low or above a programmed high heart rate limit ρ high , it is considered “ out - of - range ” and a hi / low heart rate subroutine 420 ( see fig9 ) is run to properly respond to the condition . if the r — r interval variation within the y second long electrogram segment is more than a programmed limit , the hi / low heart rate subroutine is also run . this is an important feature of the present invention as pvc &# 39 ; s and unstable heart rhythms such as a bigeminal rhythm can cause errors in an st shift detection algorithm that is works best with a steady heart rhythm . one embodiment of the present invention identifies an unsteady heart rate by comparing the two shortest r — r intervals and the 2 longest intervals in the y second long electrogram segment . if the difference between both of the two shortest r — r intervals and the average of the two longest r — r intervals are more than a programmed percentage α , an unsteady heart rate is identified . for example the programmed percentage α might be 25 % so that if the two shortest r — r intervals are each more than 25 % less than the average of the two longest r — r intervals , then the heart rate is unsteady . it is envisioned that if longer times y are used for electrogram segment collection then it might require 3 or more “ short ” beats to indicated an unsteady heart rate . any beat that is not too short is classified by step 455 as a normal beat . ρ low , ρ high and α are programmable parameters typically set using the programmer 68 during programming of the cardiosaver 5 . typical values for ρ low and ρ high would be 50 and 140 beats per minute respectively . if the heart rate is not high , low or unsteady as checked in step 455 , the heart signal processing program 450 moves to step 456 where the average heart rate is compared to a programmed normal range between ρ low and ρ elevated where ρ elevated is the elevated heart rate limit that defines the upper limit of the “ normal range ” ( e . g . 80 beats per minute ). if the patient &# 39 ; s heart rate is elevated but not out - of - range ( i . e . above ρ high ), the patient may be exercising and the ischemia subroutine 480 allows for different cardiac event detection criteria during elevated heart rates to reduce false positive detections of acute myocardial infarction and to detect exercise induced ischemia . an example of one embodiment of the ischemia subroutine 480 is illustrated in fig1 . although the above specification describes low , high and elevated heart rate limits ρ low , ρ high and ρ elevated , it is envisioned that instead of heart rate ( i . e . beats per second ) the limits and decision making could be set in terms or r wave to r wave ( r — r ) interval with the low , high and elevated limits are for r — r interval and are expressed in seconds per beat , milliseconds per beat or samples per beat . if the average heart rate of the patient is within the “ normal ” range in step 456 , then the program 450 moves to step 457 where it looks for an excessive st shift on m out of n beats as compared with the baseline electrogram segment collected at a time u ± w minutes in the past . u can be any time from 1 minute to 48 hours but to allow for daily cycles u = 24 hours is a preferred embodiment . w is half the interval between times when the baseline data is saved and can be any time from 10 seconds to 12 hours . for a u of 24 hours , a preferred setting would have w equal to half an hour so that the current y second long electrogram segment is always being compared with a baseline electrogram segment from 24 ± ½ hour before . this also means that baseline electrogram segments are saved and processed to extract detection parameters at an interval of twice w ( 2w ). i . e ., if w is half an hour , then the baseline data is saved and processed once an hour . m can be any number from 1 to 30 and n can be any number from m to 100 . an example of a typical m and n used would be 6 out of 8 beats . it is envisioned that the first of the 8 beats will typically be the beat including the 2 nd r wave in the y second long electrogram segment collected in steps 453 and 454 . an alternate to st shift detection in step 457 is to process just the t wave , which can change its peak or average amplitude rapidly if there is a heart attack . the t wave can , however change its amplitude slowly under normal conditions so a t wave shift detector would need a much shorter time u than that of a detector using the st segment before the t wave . if the detector is checking for such t wave shift , i . e . a voltage shift of the t wave part of the st segment , then it may be desirable to check against a baseline where u is 1 to 30 minutes and w is 15 seconds to 15 minutes . for example , u = 3 minutes and w = 15 seconds is a preferred setting to catch a quickly changing t wave . this would also allow use of recent electrogram segments stored in the recent electrogram memory of fig4 as baseline electrogram segments for t wave shift detection . it is envisioned that the programmer 68 of fig1 would allow the patient &# 39 ; s doctor to program the cardiosaver 5 to use st segment shift or t wave shift detectors by themselves , or together simultaneously . if both were used then the programmer 68 would allow the patient &# 39 ; s doctor to choose whether a positive detection will result if either technique detects an event or only if both detect an event . if the average heart rate is in the normal range , is not unsteady and there is no cardiac event detection in step 457 , ( i . e . the electrogram signal is indicative of a “ normal ” heart signal for the patient ), the heart signal processing program 450 checks in step 458 if it is more than the interval of 2w minutes since the last time baseline data was captured . if it has been more than 2w , the baseline parameter extraction subroutine 440 of fig7 is run . the parameters x , y , u and w are stored with the programmable parameters 471 in the ram 47 in fig4 . these parameters may be permanently set at the time of manufacturing of the cardiosaver 5 or they may be programmed through the programmer 68 of fig1 . the calculated criteria for cardiac event detection extracted from the baseline electrogram segments stored in baseline electrogram memory 474 are stored in the calculated baseline data memory 475 of the ram 47 . a typical configuration of the heart signal processing program 450 using only an st shift detector , would use a sleep of x = 20 seconds , followed by collection of a y = 10 second long electrogram segment . if the patient &# 39 ; s heart rate is in a normal range of between 50 and 80 beats per minute , step 457 would check for an excessive shift of the st segment in 6 out of 8 of the beats as compared with baseline data collected 24 ± ½ hour previously . if there has been a detected excessive st shift in m out of n beats in step 457 , the st verification subroutine 460 is run to be sure that the detected event is not a transitory change in the electrogram . the st verification subroutine 460 begins with step 461 where the recently collected y second long electrogram segment is saved to the event memory 476 of fig4 for later review by the patient &# 39 ; s doctor . the st shift verification subroutine 460 then increments the event counter k by 1 ( step 462 ) and then checks ( step 463 ) if k is equal to 3 ( i . e . 3 events is the trigger for an alarm . if k = 3 then the alarm subroutine 490 illustrated in fig8 is run , thus declaring that there has been a positive detection of a major cardiac event . fig1 illustrates examples of the combinations of conditions that can lead to k = 3 and the running of the alarm subroutine 490 . although step 463 is shown checking if k = 3 as the condition for running the alarm subroutine 490 , the number of events required could be a programmable parameter from k = 1 to k = 20 . even higher possible values than k = 20 might be used to avoid false positive detections . with current average times from onset of a heart attack to arrival at a treatment center of 3 hours , a few minutes delay for a device that should enable the patient to easily reach a treatment center within 30 minutes is valuable if it improves the reliability of detection . in step 463 if k is less than 3 then the st shift verification subroutine 460 proceeds to sleep z seconds in step 464 followed by collection ( step 465 ) and saving ( step 466 ) to the next location in the recent electrogram memory 472 of fig4 of a new y second long electrogram segment . z seconds can be different from the x seconds used in step 452 to allow the st shift verification subroutine 460 to look over longer ( or shorter ) intervals than the main program so as to best verify the positive detection of step 457 . the term sleep here has the same connotation as in step 452 . a preferred embodiment of the present invention uses z = x = 20 seconds . the st shift verification subroutine 460 then checks for heart rate out - of - range or unsteady in step 467 . as described with respect to step 455 above , heart rate out - of - range means that the average heart rate in the y second long electrogram segment is below the low heart rate limit ρ low or above the high heart rate limit ρ high . if the heart rate is out - of range or unsteady step 467 will initiate the hi / low subroutine 420 . if the heart rate is not out - of range or unsteady , then step 468 follows to check if the heart rate is normal or elevated similar to step 456 above . if the heart rate is elevated , the ischemia subroutine 480 is run . the reason for checking if the heart rate has changed is that acute myocardial infarction can induce high heart rates from tachycardia or fibrillation that might mask the st shift but are in of themselves major cardiac events whose detection will increment the event counter k . if the heart rate is in the normal range ( i . e . not elevated ), then step 469 checks for an excessive st and / or t wave shift in m out of n beats of the y second long electrogram segment as compared with the baseline data extracted u ± w minutes in the past ( similar to step 457 ). if no excessive st and / or t wave shift is seen , the subroutine 460 returns to step 458 of the heart signal processing program 450 and then eventually back to step 451 , the start of heart signal processing program 450 . in step 451 , k is set back to 0 so that only if there are cardiac events detected in three ( k ) successive y second long electrogram segments , will the alarm subroutine 490 be run . in a preferred embodiment of the present invention , steps 457 and 469 only examine m out of n “ normal ” beats , ignoring any beats that are too short as determined by step 455 . it is important to note , that baseline data is extracted only when the heart rate is within the normal range and there is not an excessive st or t wave shift in m out of n beats . in one embodiment of the present invention , this is improved further by having the baseline parameter extraction subroutine 440 only process normal beats that individually do not exhibit an excessive st and / or t wave shift . fig6 illustrates the features of a single normal beat 500 of an electrogram segment and a single beat 500 ′ of an ami electrogram segment that has a significant st segment shift as compared with the normal beat 500 . such st segment shifting occurs within minutes following the occlusion of a coronary artery during an ami . the beats 500 and 500 ′ show typical heart beat wave elements labeled p , q , r , s , and t . the definition of a beat such as the beat 500 is a sub - segment of an electrogram segment containing exactly one r wave and including the p and q elements before the r wave and the s and t elements following the r wave . for the purposes of detection algorithms , different sub - segments , elements and calculated values related to the beats 500 and 500 ′ are hereby specified . the peak of the r wave of the beat 500 occurs at the time t r ( 509 ). the pq segment 501 and st segment 505 are sub - segments of the a . the pq segment 501 has a time duration d pq ( 506 ) and starts t pq ( 502 ) milliseconds before the time t r ( 509 ). b . the st segment 505 has a time duration d st ( 508 ) and starts t st ( 502 ) milliseconds after the time t r ( 509 ). the pq segment 501 ′ and st segment 505 ′ are sub - segments of the beat 500 ′ and are located in time with respect to the time t ′ r ( 509 ′) as follows : c . the pq segment 501 ′ has a time duration d pq ( 506 ) and starts t pq ( 502 ) milliseconds before the time t ′ r ( 509 ′). d . the st segment 505 ′ has a time duration d st ( 508 ) and starts t st ( 502 ) milliseconds after the time t ′ r ( 509 ′). the st segments 505 and 505 ′ and the pq segments 501 and 501 ′ are examples of sub - segments of the electrical signals from a patient &# 39 ; s heart . the r wave and t wave are also sub - segments . the dashed lines v pq ( 512 ) and v st ( 514 ) illustrate the average voltage amplitudes of the pq and st segments 501 and 505 respectively for the normal beat 500 . similarly the dashed lines v ′ pq ( 512 ′) and v ′ st ( 514 ′) illustrate the average amplitudes of the pq and st segments 501 ′ and 505 ′ respectively for the beat 500 ′. the “ st deviation ” δv ( 510 ) of the normal beat 500 and the st deviation δv ami ( 510 ′) of the ami electrogram beat 500 ′ are defined as : δv ( 510 )= v st ( 514 )− v pq ( 512 ) δv ami ( 510 ′)= v ′ st ( 514 ′)− v ′ pq ( 512 ′) note that the both beats 500 and 500 ′ are analyzed using the same time offsets t pq and t st from the peak of the r wave and the same durations d pq and d st . in this example , the beats 500 and 500 ′ are of the same time duration ( i . e . the same heart rate ). the parameters t pq , t st , d pq and d st would typically be set with the programmer 68 of fig1 by the patient &# 39 ; s doctor at the time the cardiosaver 5 is implanted so as to best match the morphology of the patient &# 39 ; s electrogram signal and normal heart rate . v pq ( 512 ), v st ( 514 ), v r ( 503 ) and δv ( 510 ) are examples of per - beat heart signal parameters for the beat 500 . although it may be effective to fix the values of time offsets t pq ( 502 ) and t st ( 504 ) and the durations d pq ( 506 ) and d st ( 508 ), it is envisioned that the time offsets t pq and t st and the durations d pq and d st could be automatically adjusted by the cardiosaver 5 to account for changes in the patient &# 39 ; s heart rate . if the heart rate increases or decreases , as compared with the patient &# 39 ; s normal heart rate , it envisioned that the offsets t pq ( 502 ) and t st ( 504 ) and / or the durations d pq ( 506 ) and d st ( 508 ) could vary depending upon the r — r interval between beats or the average r — r interval for an electrogram segment . a simple technique for doing this would vary the offsets t pq and t st and the durations d pq and d st in proportion to the change in r — r interval . for example if the patient &# 39 ; s normal heart rate is 60 beats per minute , the r — r interval is 1 second ; at 80 beats per minute the r — r interval is 0 . 75 seconds , a 25 % decrease . this could automatically produce a 25 % decrease in the values of t pq , t st , d pq and d st . alternately , the values for t pq , t st , d pq and d st could be fixed for each of up to 20 preset heart rate ranges . in either case , it is envisioned that after the device has been implanted , the patient &# 39 ; s physician would , through the programmer 68 of fig1 download from the cardiosaver 5 to the programmer 68 , a recent electrogram segment from the recent electrogram memory 472 . the physician would then use the programmer 68 to select the values of t pq , t st , d pq and d st for the heart rate in the downloaded recent electrogram segment . the programmer 68 would then allow the physician to choose to either manually specify the values of t pq , t st , d pq and d st for each heart rate range or have the cardiosaver 5 automatically adjust the values of t pq , t st , d pq and d st based on the r — r interval for each beat of any electrogram segment collected in the future by the cardiosaver 5 . it is also envisioned that only the offset times , t pq and t st , might be automatically adjusted and the durations d pq and d st would be fixed so that the average values of the st and pq segments v pq ( 512 ), v st ( 514 ), v ′ pq ( 512 ′) and v ′ st ( 514 ′) would always use the same number of data samples for averaging . an example of a sequence of steps used to calculate the st deviation 510 for the normal beat 500 are as follows : 1 . identify the time t r ( 509 ) for the peak of the r wave for the beat 500 , 2 . calculate the time since the previous r wave and use that time to look up or calculate the values of t pq , t st , d pq and d st . 3 . average the amplitude of the pq segment 501 between the times ( t r − t pq ) and ( t r − t pq + d pq ) to create the pq segment average amplitude v pq ( 512 ), 4 . average the amplitude of the st segment 505 between the times ( t r + t st ) and ( t r + t st + d st ) to create the st segment average amplitude v st ( 514 ), 5 . subtract v pq ( 512 ) from v st ( 514 ) to produce the st deviation δv ( 510 ) for the beat 500 . although only one normal beat 500 is shown here , there would typically be multiple beats saved in the y second long electrogram segments stored in the recent electrogram memory 472 and the baseline electrogram memory 474 of fig4 . at preset time intervals during the day step 458 of fig5 will run the baseline parameter extraction subroutine 440 that will calculate the “ average baseline st deviation ” δv base defined as the average of the st deviations δv ( 510 ) for at least two beats of a baseline electrogram segment . typically the st deviation of 4 to 8 beats of the baseline electrogram segment will be averaged to produce the average baseline st deviation δv base . for each of “ i ” preset times during the day ( at a time interval of approximately 2w ) an average baseline st deviation δv base ( i ) will be calculated and saved in the calculated baseline data memory 475 for later comparison with the st deviation δv ( 510 ) of each beat of a recently collected electrogram . for example , in a preferred embodiment of the present invention , the average baseline st deviation δv base ( i ) is collected once an hour and there are be 24 values of δv base ( i ) ( δv base ( 1 ), δv base ( 2 ) . . . δv base ( 24 )) stored in the calculated baseline data memory 475 of fig4 . an excessive st shift for a single beat of a recently collected electrogram segment is then detected when the st deviation δv for that beat shifts by more than a predetermined threshold amplitude from the average baseline st deviation δv base ( i ) collected approximately 24 hours before . the st shift of a given beat is calculated by subtracting the appropriate averaged baseline st deviation δv base ( i ) from the st deviation δv for that beat . assuming the r — r interval indicates that the heart rate for a beat is in the normal range then an excessive st shift for a single beat is detected if ( δv − δv base ( i )) is greater than the normal st shift threshold h normal for the normal heart rate range . the heart signal processing program 450 of fig5 requires that such an excessive st shift be positively identified in m out of n beats in three successive recent electrogram segments before the alarm subroutine 490 is activated . the threshold h normal may be a fixed value that does not change over time and is set at the time of programming of the cardiosaver 5 with the programmer 68 of fig1 . in a preferred embodiment , the threshold for detection of excessive st shift is not fixed but is calculated as h st ( i ) from the i &# 39 ; th baseline electrogram segment stored in the baseline electrogram memory 474 of fig4 . to do this the difference between the amplitude of the peak of the r wave v r ( 503 ) and the average pq segment amplitude v pq ( 512 ) are calculated for each of at least 2 beats of each baseline electrogram segment by the baseline parameter extraction subroutine 440 . the average value δr ( i ) of this difference ( v r − v pq ) for at least two beats of the i &# 39 ; th baseline electrogram segment can be used to produce a threshold for st shift detection h st ( i ) that is proportional to the signal strength of the i &# 39 ; th baseline electrogram segment . the advantage of this technique is that , if the signal strength of the electrogram changes slowly over time , the threshold h st ( i ) for st shift detection will change in proportion . the preferred embodiment of the present invention would have a preset percentage p st that is multiplied by δr ( i ) to obtain the threshold h st ( i )= p st × δr ( i ). thus , the threshold h st ( i ) would be a fixed percentage of the average height of the r wave peaks over the st segments of the i &# 39 ; th baseline electrogram segment . for example , if p st is 25 % an excessive st shift on a given beat would be detected if the st shift ( δ v − δv base ( i )) is greater than the threshold h st ( i ) where h st ( i ) is 25 % of the average pq to r height δr ( i ) of the i &# 39 ; th baseline electrogram segment . in a preferred embodiment of the present invention heart signal processing program 450 of fig5 the value x and z are both 20 seconds , y is 10 seconds , 2w is 60 minutes , u is 24 hours , w is 30 minutes , m is 6 and n is 8 . therefore the steps 457 and 469 of fig5 will check for excessive st shifts in 6 out of 8 beats from of the y = 10 second long electrogram segment captured every 30 seconds as compared with parameters extracted from the baseline electrogram segment captured 24 ± ½ hour before . in this preferred embodiment baseline electrogram segments are captured once per hour . fig7 illustrates a preferred embodiment of the baseline extraction subroutine 440 . the subroutine 440 begins in step 439 by saving in the i &# 39 ; th memory location in baseline electrogram memory 474 of fig4 the last y second long electrogram segment saved into the “ recent ” electrogram memory in step 454 of fig5 . this y seconds of electrogram data then becomes the baseline electrogram segment for calculating parameters for detection to be used during the 2w long period of time u ± w minutes in the future . next in step 441 the baseline extraction subroutine 440 finds the r wave peak times t r ( j ) for the 1 st through ( n + 2 ) th beat ( j = 1 through n + 2 ) in the baseline electrogram segment saved in step 439 . this is a total of n + 2 beats . each time t r ( j ) is typically counted from the beginning of the y second long electrogram segment until the peak of the j &# 39 ; th r wave . next in step 442 the average r — r interval of the i &# 39 ; th baseline electrogram segment rr ( i ) is calculated by averaging the r — r intervals for each of the n + 1 beats ( j = 2 through n + 2 ) where the r — r interval for beat j is t r ( j )− t r ( j − 1 ). for example , for beat 2 , the r — r interval is the time interval from the r wave peak of beat 1 ( the very first r wave ) to the r wave peak of beat 2 . i . e . r — r intervals before and after each of the n beats j = 2 through j = n + 1 are calculated . this step also identifies any r — r intervals that are out of the “ normal ” range as defined in the programming of the cardiosaver 5 . in a preferred embodiment of the present invention , baseline data will only be extracted from “ normal ” beats . a normal beat is one in which the r — r interval both before and after the r wave is in the “ normal range . this is a preferred technique to use as a too short r — r interval before the r wave can affect the pq segment amplitude and a too short r — r interval after the r wave can affect the st segment amplitude , either of which could produce a false indication of excessive st shift . next in step 443 the offsets t pq , t st , d pq and d st ( see fig6 ) are calculated . in one embodiment , t pq and t st are the percentages φ pq and φ st multiplied by the average r — r interval rr ( i ) respectively . this technique will adjust the location of the start of the pq and st segments to account for changes in heart rate . the percentages φ pq and φ st would be selected by the patient &# 39 ; s doctor based on “ normal ” electrogram segments analyzed by the programmer 68 of fig1 . another embodiment of the present invention uses fixed time offsets t pq and t st that are programmed by the patient &# 39 ; s doctor . similarly the duration of the pq and st segments d pq and d st ( see fig6 ) can be calculated by multiplying the percentages δ pq and δ st times the average r — r interval rr ( i ) respectively . the percentages δ pq and δ st would also be selected by the patient &# 39 ; s doctor using the programmer 68 . the preferred embodiment of the present invention uses fixed segment durations d pq and d st that are programmed by the patient &# 39 ; s doctor . using fixed durations d pq and d st has the advantage of keeping the same number of samples averaged in each calculation of the average pq and st segment amplitudes v pq and v st respectively . next in step 444 for each of the n beats ( j = 2 through n + 1 ) identified by step 422 as a normal beat , v pq ( j ) the average of the pq segment amplitude of the j &# 39 ; th beat over the duration d pq beginning t pq before the peak t r ( j ) and v st ( j ) the average st segment amplitude of the j &# 39 ; th beat over the duration d st beginning t st after the time t r ( j ) are calculated . similarly , step 444 calculates the peak t wave heights v t ( j ). for each beat the st deviation δv st ( j ) that is the difference between v st ( j ) and v pq ( j ) is then calculated in step 445 . similarly , step 445 calculates the t wave deviation δv ( j ) that is the difference between v t ( j ) and v pq ( j ). it should be noted that step 455 of fig5 will only allow the baseline extraction subroutine to be run if less than 2 too short beats are present , thus at least n − 2 of the n beats used for baseline data extraction will be normal beats . although there is a limit here of less than 2 short beats , it is envisioned that other minimum numbers of short beats than 2 might also be used . next in step 446 the st deviation δv st ( j ) for all normal beats within the n beats is averaged to produce the i &# 39 ; th average baseline st deviation δv base ( i ). similarly , in step 446 the t wave deviation δv t ( j ) for all normal beats within the n beats is averaged to produce the i &# 39 ; th average baseline t wave deviation δt base ( i ). an alternate embodiment of the present invention would also check for excessive st shift on each normal beat and exclude any such beats from the average baseline st deviation and t wave deviation calculations . next in step 447 , δr ( i ) the average of the height of the peak of the j &# 39 ; th r wave above the average pq segment v pq ( j ) is calculated for the normal beats . δr ( i ) acts as an indication of the average signal strength of the i &# 39 ; th baseline electrogram segment . δr ( i ) is used to provide a detection threshold for excessive st shift that will adapt to slow changes in electrogram signal strength over time . this is of most value following implant as the sensitivity of the electrodes 14 and 17 may change as the implant site heals . δt base ( i ) can either be the average of the signal samples of the entire t waves or it can be the average of the peak amplitude of the t waves in the normal beats . it is also envisioned , that if both st and t wave shift detection are used , a cardiac event could be declared if either excessive st shift or t wave shift detects a change ( this is preferred ) or the program could require that both excessive st shift and t wave shift be present . next in step 448 , the threshold for st shift detection for normal heart rates h st ( i ) is calculated by multiplying the programmed threshold percentage p st of δr ( i ). also in step 448 , if the t wave shift detector is being used , the threshold for t wave shift detection for normal heart rates h t ( i ) is calculated by multiplying the programmed threshold percentage p t of δr ( i ). finally in step 449 , the extracted baseline parameters δv base ( i ), δt base ( i ), δr ( i ), h st ( i ) and h t ( i ) are saved to the calculated baseline data memory 475 . the baseline extraction subroutine 440 has ended and the program returns to the main heart signal processing program 450 step 451 of fig5 . one embodiment of st shift and t wave shift detection might use a baseline for st shift detection that is 24 ± ½ hour before and a baseline for t wave shift that is 1 to 4 minutes in the past . this would require that the baseline extraction subroutine 440 be run for t wave shift parameters approximately every 60 seconds and for st segment parameters every hour . although the baseline extraction subroutine 440 is described here as using the same “ n ” as the number of beats processed as the st shift detection steps 457 and 469 of fig5 it is envisioned that either a greater or lesser number of beats could be used for baseline extraction as compared with the number of beats “ n ” checked for excessive st shifts in fig5 . typical values used for the baseline extraction subroutine 440 as shown in fig7 would be n = 8 to average the data over 8 beats using beats 2 through 9 of the y second long electrogram segment . however , it is envisioned that as few as 1 beat or as many as 100 beats or higher could be used to calculate the parameters extracted by subroutine 440 . also even though the preferred embodiment of the present invention extracts baseline data only from “ normal ” beats , it is envisioned that using all 8 beats would usually yield an acceptable result . although the baseline extraction subroutine 440 shows the extraction of parameters for identifying excessive st shifts and t wave shifts , the cardiosaver 5 would function with either of these detection methods or could use other techniques to measure the changes in electrogram signals indicating one or more coronary event . fig8 illustrates a preferred embodiment of the alarm subroutine 490 . the alarm subroutine 490 is run when there have been a sufficient number of events detected to warrant a major event cardiac alarm to the patient . the alarm subroutine 490 begins with step 491 where the entire contents of both baseline electrogram memory 474 and recent electrogram memory 472 of fig4 are saved into the event memory 476 . this saves the above mentioned electrogram data in a place where it is not overwritten by new baseline or recent electrogram data to allow the patient &# 39 ; s physician to review the electrogram segments collected during a period of time that occurred before the alarm . in a preferred embodiment with 24 baseline electrogram segments collected once per hour , and 8 recent electrogram segments collected every 30 seconds , the physician will be able to review a significant amount of electrogram data from the 4 minutes just before the cardiac event as well as being able to see any changes in the 24 hours before the event . next ; in step 492 the internal alarm signal is turned on by having the cpu 44 of fig4 cause the alarm sub - system 48 to activate a major event alarm signal . next in step 493 the alarm subroutine instructs the cpu 44 to send a major event alarm message to the external alarm system 60 of fig1 through the telemetry sub - system 46 and antenna 35 of the cardiosaver 5 of fig4 . the alarm message is sent once every l 1 seconds for l 2 minutes . during this time step 494 waits for an acknowledgement that the external alarm has received the alarm message . after l 2 minutes , if no acknowledgement is received , the cardiosaver 5 of fig1 gives up trying to contact the external alarm system 60 . if an acknowledgement is received before l 2 minutes , step 495 transmits alarm related data to the external alarm system . this alarm related data would typically include the cause of the alarm , baseline and last event electrogram segments and the time at which the cardiac event was detected . next in step 496 , the cardiosaver 5 transmits to the external alarm system 60 of fig1 other data selected by the patient &# 39 ; s physician using the programmer 69 during programming of the cardiosaver . these data may include the detection thresholds h st ( i ), h t ( i ) and other parameters and electrogram segments stored in the cardiosaver memory 47 . once the internal alarm signal has been activated by step 492 , it will stay on until the clock / timing sub - system 49 of fig4 indicates that a preset time interval of l 3 minutes has elapsed or the cardiosaver 5 receives a signal from the external alarm system 60 of fig1 requesting the alarm be turned off . to save power in the implantable cardiosaver 5 , step 496 might check once every minute for the turn off signal from the external alarm system 60 while the external alarm system 60 would transmit the signal continuously for slightly more than a minute so that it will not be missed . it is also envisioned that when the alarm is sent to the external alarm system 60 , the internal clock 49 of the cardiosaver 5 and the external alarm system 60 can be synchronized so that the programming in the external alarm system 60 will know when to the second , that the cardiosaver will be looking for the turn off signal . at this point in the alarm subroutine 490 step 497 begins to record and save to event memory 476 of fig4 an e second long electrogram segment every f seconds for g hours , to allow the patient &# 39 ; s physician and / or emergency room medical professional to read out the patient &# 39 ; s electrogram over time following the events that triggered the alarm . this is of particular significance if the patient , his caregiver or paramedic injects a thrombolytic or anti - platelet drug to attempt to relieve the blood clot causing the acute myocardial infarction . by examining the data following the injection , the effect on the patient can be noted and appropriate further treatment prescribed . in step 498 the alarm subroutine will then wait until a reset signal is received from the physician &# 39 ; s programmer 68 or the patient operated initiator 55 of the external alarm system 60 of fig1 . the reset signal would typically be given after the event memory 476 of fig4 has been transferred to a component of the external equipment 7 of fig1 . the reset signal will clear the event memory 476 ( step 499 ) and restart the main program 450 at step 451 . if no reset signal is received in l 6 hours , then the alarm subroutine 490 returns to step 451 of fig5 and the cardiosaver 5 will once again begin processing electrogram segments to detect a cardiac event . if another event is then detected , the section of event memory 476 used for saving post - event electrogram data would be overwritten with the pre - event electrogram data from the new event . this process will continue until all event memory is used . i . e . it is more important to see the electrogram data leading up to an event than the data following detection . fig9 illustrates the function of the hi / low heart rate subroutine 420 . the hi / low heart rate subroutine is meant to run when the patient &# 39 ; s heart rate is below the normal range ( e . g . 50 to 80 beats per minute ) or above the elevated range that can occur during exercise ( e . g . 80 to 140 beats per minute ). a low heart rate ( bradycardia ) may indicate the need for a pacemaker and should prompt a “ see doctor ” warning to the patient if it does not go away after a programmed period of time . very high heart rate can be indicative of tachycardia or ventricular fibrillation and is serious if it does not quickly go away and should warrant a major event alarm like a detected ami . the hi / low heart rate subroutine 420 begins with step 421 where the electrogram segment of y seconds collected in steps 453 and 454 of fig5 is saved to the event memory 476 ( step 421 ) because the patient &# 39 ; s doctor may wish to know that the high or low heart rate occurred . once the y second long electrogram segment is saved , step 422 of the hi / low heart rate subroutine 420 directs the processing in different directions depending on if the heart rate is too high , too low or unsteady . if unsteady , the unsteady heart rate subroutine 410 illustrated in fig1 is run . if it is too high , step 423 increments the event counter k by 1 , then step 424 checks whether the event counter k is equal to 3 . although this embodiment uses k = 3 events as the trigger to run the alarm subroutine 490 it is envisioned that k = 1 or 2 or k values higher than 3 can also be used . in step 424 , if k = 3 then the alarm subroutine 490 illustrated in fig8 is run . if k less than 3 then in step 425 the hi / low heart rate subroutine 420 waits for “ b ” seconds and checks again in step 426 if the heart rate is still too high . if the heart rate is still too high , the hi / low heart rate subroutine 420 returns to step 423 where the event counter is incremented by 1 . if the heart rate remains high , the hi / low heart rate subroutine 420 will loop until k is equal to 3 and the alarm subroutine 490 is run . if the heart rate does not remain high in step 426 , the hi / low heart rate subroutine 420 will return to step 453 of the main heart signal processing program 450 illustrated in fig5 . st shift amplitude is not checked during the high heart rate section of the hi / low heart rate subroutine 420 as the presence of a very high heart rate could alter the detection of changes in st and pq segments of the electrogram giving false indications . very high heart rate is , by itself , extremely dangerous to the patient and is therefore a major cardiac event . if in step 422 , the heart rate is too low rather than too high , the hi / low heart rate subroutine 420 will proceed to step 431 where the y second long electrogram segment is checked for an excessive st shift in the same way as step 457 of the main heart signal processing program 450 illustrated in fig5 . in other words , the st deviation on m out of n beats must be shifted at least h st ( i ) from the baseline average st deviation δv base ( i ) of the i &# 39 ; th baseline electrogram segment . if there is a detected excessive st shift in step 431 , the hi / low heart rate subroutine 420 returns to run the st shift verification subroutine 460 illustrated in fig5 . if there is not an excessive st shift detected in step 431 , step 432 causes the hi / low heart rate subroutine 420 in step 432 to wait for “ c ” seconds then buffer and save a new y second long electrogram segment as in steps 453 and 454 of the main heart signal processing program 450 of fig5 . once the new y second long electrogram segment is collected , the hi / low heart rate subroutine 420 checks in step 433 if the heart rate is still too low . if it is no longer too low , the system returns to step 455 of the main heart signal processing program 450 illustrated in fig5 . if the heart rate remains too low , then step 434 checks for an excessive st shift . if there is an excessive st shift in step 434 , the hi / low heart rate subroutine 420 returns to run the st shift verification subroutine 460 of fig5 . if there is not an excessive st shift detected in step 434 , step 435 causes the hi / low heart rate subroutine 420 in step 435 to wait for another “ c ” seconds then buffer and save another y second long electrogram segment as in steps 453 and 454 of the main heart signal processing program 450 of fig5 . once this y second long electrogram segment is collected , the hi / low heart rate subroutine 420 checks in step 436 if the heart rate is still too low ( for the 3 rd time ). if it is no longer too low , the system returns to step 455 of the main heart signal processing program 450 of fig5 . if the heart rate remains too low , then step 437 checks for an excessive st shift . if there is an excessive st shift in step 437 , the hi / low heart rate subroutine 420 returns to run the st shift verification subroutine 460 of fig5 . if there is not an excessive st shift detected in step 437 , the step 438 saves the contents of the most recently collected y second long electrogram segment and the to the event memory 476 for later review by the patient &# 39 ; s doctor . if the hi / low heart rate subroutine 420 reaches step 438 then the patient &# 39 ; s heart rate has been too low even after two waits of “ c ” seconds . now the hi / low heart rate subroutine 420 proceeds to step 427 to turn on the internal “ see doctor ” alarm signal . step 427 also sends out to the external alarm system 60 of fig1 a signal to activate the “ see doctor ” alarm signal of the external alarm system 60 that may include a text or played speech message indicating the cause of the alarm . e . g . the external alarm system speaker 57 of fig1 could emit warning tones and a text message could be displayed or the speaker 57 might emit a spoken warning message to the patient . note that during the checking for continued low heart rate , st shift amplitudes are still checked after each wait because it is well known that low heart rate can be a byproduct of an acute myocardial infarction . finally in step 428 , the hi / low heart rate subroutine 420 will keep the “ see doctor ” alarm signal turned on for l 4 minutes or until receipt of a signal from the external alarm system 60 to turn off the alarm signal . after the “ see doctor alarm signal is enabled , the low heart rate limit , below which the hi / low heart rate subroutine 420 is run , is changed by step 429 to be just below the average heart rate measured in step 436 . once the patient is warned to go see the doctor , additional warnings will be annoying and therefore the low rate limit is best changed . this allows the hi / low heart rate subroutine 420 to then return to step 452 of the main program where it will continue to monitor st shift amplitudes to provide early detection of acute myocardial infarction . actual programming of the cardiosaver 5 may use r — r interval instead of heart rate and it is understood that either is sufficient and one can be easily computed from the other . fig1 illustrates the ischemia subroutine 480 that provides decision making for the cardiosaver 5 in the event of an elevated heart rate such as that would occur during exercise by the patient . the ischemia subroutine 480 uses a beat counter j to indicate the beat within a y second long electrogram segment . a beat is defined as a sub - segment containing exactly one r wave of the y second long electrogram segment . the ischemia subroutine 480 begins in step 481 by initializing the beat counter j to a value of 2 . then in step 482 , the r — r interval range a for the beat j is determined . for example that there could be between 4 r — r interval ranges a = 1 to 4 of 750 to 670 , 670 to 600 , 600 to 500 and 500 to 430 milliseconds respectively . these would correspond to heart rate intervals of 80 to 90 , 90 to 100 , 100 to 120 and 120 to 140 beats per minute . the number of ranges a and the upper and lower limit of each range would be programmable by the patient &# 39 ; s physician from the programmer 68 of fig1 . next in step 483 the programmed ischemia multiplier μ ( a ) is retrieved from the programmable parameters 471 of fig4 . μ ( a ) is the allowable factor increase or decrease in st shift detection threshold for the r — r interval range a . in other words , because the patient may have some ischemia during elevated heart rates from exercise , the patient &# 39 ; s physician can program μ ( a ) s that are greater than 1 and might increase with each successive heart rate range . for example , if the r — r interval ranges are 750 to 670 , 670 to 600 , 600 to 500 and 500 to 430 milliseconds the corresponding μ ( a ) s might be 1 . 1 , 1 . 2 , 1 . 3 and 1 . 5 . this would require that the st shift in the r — r interval range of a = 4 ( 500 to 430 milliseconds ) be one and a half times as large as during normal heart rates in order to qualify as a cardiac event . it is envisioned that the patient could undergo an exercise stress test at a time after implant when the implanted leads have healed into the wall of the heart and electrogram segments captured by the cardiosaver 5 during that stress test would be reviewed by the patient &# 39 ; s physician to determine the appropriate range intervals and ischemia multipliers to help identify a worsening of the patient &# 39 ; s exercise induced ischemia from the time when the stress test is conducted . it is also envisioned that in order to detect smaller changes in vessel narrowing than a full acute myocardial infarction , the cardiosaver 5 of fig1 - 4 might use μ ( a ) s that are less than one . for example , if the r — r interval ranges are 750 to 670 , 670 to 600 , 600 to 500 and 500 to 430 milliseconds the corresponding μ ( a ) s might be 0 . 5 , 0 . 6 , 0 . 7 and 0 . 8 . thus in this example , in the r — r interval range of 750 to 670 milliseconds , the threshold for ischemia detection would be half of what it is for the normal heart rate range . once the ischemia multiplier has been retrieved , step 484 calculates the ischemia st shift threshold θ ( a ) for the r — r interval range a where θ ( a )= h st ( i )× μ ( a ) where h st ( i ) is the current st shift threshold for normal heart rates . next in step 485 , the ischemia subroutine 480 checks if for the beat j the st shift is greater than the ischemia threshold θ ( a ). if it is not greater , step 487 then checks if the n &# 39 ; th beat has been examined . if the st shift of the j &# 39 ; th beat exceeds the ischemia threshold θ ( a ) then step 486 checks if m beats with st shifts greater than θ ( a ) have been seen . if they have not been seen proceed to step 487 . if in step 487 , the nth beat has been examined , return to step 451 of the main heart signal processing program 450 of fig5 . if n beats have not yet been examined , increment j by 1 in step 489 and loop back to step 482 . if m beats with excessive st shift are found by step 486 , step 581 saves the current y second long electrogram segment to the event memory 476 , then in step 582 the event counter k is incremented by 1 followed by step 583 checking if k is equal to 3 . if k is less than 3 then the ischemia subroutine 480 continues by sleeping for z seconds in step 584 , then buffering a new y second long electrogram segment in step 585 , saving in step 586 the new y second long electrogram segment to the next location in recent electrogram memory 472 of fig4 . and then checking if the heart rate is still elevated in step 587 . if the heart rate is still elevated in step 587 , the loop checking for ischemia is run again starting with step 481 . if the heart rate is no longer elevated then step 588 checks if the heart rate is too high , too low or unsteady . if such is the case , the hi / low heart rate subroutine 420 is run . if the heart rate is not high , low or unsteady , the ischemia subroutine 480 ends and the program returns to step 469 of the st shift verification subroutine 460 of fig5 . this will allow an excessive st shift detected at elevated heart rate that stays shifted when the heart rate returns to normal to quickly trigger the ami alarm . this works because k is either 1 or 2 at this point so either 2 or 1 more detection of excessive st shift with normal heart rate will cause a major event ami alarm . if however k = 3 in step 582 , then the last detection of excessive st shift occurred during an elevated heart rate and will be treated as exercise induced ischemia rather than an acute myocardial infarction . so if k = 3 ( i . e . exercise induced ischemia has been detected ) in step 582 the ischemia subroutine 480 moves on to step 681 where it checks if it has been more than l 5 minutes since the first time that exercise induced ischemia was detected where k = 3 in step 583 . if it has been less than l 5 minutes since the first detection of exercise induced ischemia then the internal see doctor alarm signal is turned on by step 682 if it has not already been activated . if it has been more than l 5 minutes , then the alarm subroutine 490 is run . this will change the see doctor alarm signal previously started in step 682 to a major event ami alarm if the excessive st shift at an elevated heart rate does not go away within l 5 minutes . similarly , if the patient stops exercising and his heart rate returns to normal but the excessive st shift remains , then the alarm subroutine 490 will also be run . if it has been less than l 5 minutes and the see doctor alarm signal has not been already been activated , step 683 next sends a message to the external alarm system 60 of fig1 to activate the see doctor external alarm signal and indicate to the patient by a text of spoken message that he should stop whatever he is doing , and sit or lie down to get his heart rate to return to normal . following this , in step 684 the ischemia subroutine 480 will keep the see doctor alarm signal on for l 4 minutes from the first time it is turned on or until the receipt of an off signal from the alarm disable button 59 of the external alarm system 60 of fig1 . the program then returns to step 451 of the main program 451 of fig5 to continue to examine the patient &# 39 ; s heart signals . fig1 diagrams the alarm conditions 600 that are examples of the combinations of major and minor events that can trigger an internal alarm signal ( and / or external alarm signal for the guardian system of fig1 . box 610 shows the combinations 611 through 617 of major cardiac events that can cause the alarm subroutine 490 to be run . these include the following : 611 . 3 st shift events ( detections of excessive st shift ) with either a normal heart rate or a low heart rate . 612 . 2 st shift events with a normal or low heart rate and 1 event from heart rate too high . 613 . 1 st shift event with a normal or low heart rate and 2 events from heart rate too high . 615 . 3 st shift events with either a normal , low or elevated heart rate ( ischemia ) where the last detection is at a normal or low heart rate . 616 . 3 events ( excessive st shift or high heart rate ) where the last event is high heart rate . 617 . an ischemia alarm indication from conditions in box 620 that remains for more than l 5 minutes after the first detection of ischemia . 621 . 3 st shift events with either a normal , low or elevated heart rate ( ischemia ) where the last detection is at an elevated heart rate . 622 . any 3 events including a too high heart rate event where the last detection is an excessive st shift at an elevated heart rate . if either of the ischemia alarm conditions 620 is met and it is less than l 5 minutes since the exercise induced ischemia was first detected , then the see doctor alarm signal will be turned on by step 682 of the ischemia subroutine 480 if it has not already been activated . box 630 shows the other minor event alarm conditions including the bradycardia alarm condition 632 that is three successive electrogram segments collected with heart rate too low and the unsteady heart rate alarm condition 635 that is caused by more than p unsteady % of beats having a too short r — r interval . these will trigger the see doctor alarm signal initiated by step 427 of the hi / low heart rate subroutine 420 for the bradycardia alarm condition 632 and step 416 of the unsteady hart rate subroutine 410 for the unsteady heart rate alarm condition 635 . also triggering the see doctor alarm signal is a low battery condition 636 . fig1 is a block diagram illustrating the unsteady heart rate subroutine 410 . the subroutine 410 is run if the r — r interval varies greatly over many of the beats in the y second long electrogram segment collected by steps 453 and 454 of the main heart signal processing program 450 . as previously described , one technique for identifying such an unsteady heart rate is to compare the two shortest r — r intervals and the 2 longest intervals . if the difference between the both of the two shortest and the average of the two longest r — r intervals are more than a programmed percentage α , an unsteady heart rate is identified . for example the programmed percentage a might be 25 % so that if the two shortest r — r intervals are each more than 25 % less than the average of the two longest r — r intervals , then the heart rate is unsteady . it is envisioned that if a longer time y is used for electrogram segment collection then it might require 3 or more “ short ” beats to indicated an unsteady heart rate . if there is zero or one short beat , the main heart signal processing program 450 will move on to step 456 having marked all of the “ normal ” beats in the y second long electrogram segment . a normal beat is defined as a beat including where the r — r intervals before and after the r wave are both in the normal range ( i . e . not too short ). the unsteady heart rate subroutine 410 begins in step 411 by checking for at least n normal beats in the most recently collected electrogram data . when the subroutine begins there is only one y second long electrogram segment being examined . if there are not n normal beats , then an additional y second long electrogram segment is collected in step 412 . step 411 then will check for n normal beats in the two y second long electrogram segments ( i . e . 2y seconds of electrogram data ). this loop of steps 411 and 412 , where each time y additional seconds of electrogram is collected , will continue until n normal beats are found . it is envisioned that step 411 could also check for beats with elevated heart rate r — r intervals or might include elevated heart rate beats as “ normal ” beats by expanding the allowed range of the r — r interval for a normal beat . once n “ normal ” beats are found by step 411 , then step 413 checks for an excessive st shift in m out of the n normal beats similar to step 457 of fig5 . step 413 could also ( as in step 457 of fig5 ) look for an excessive t wave shift . if an excessive st shift ( and / or t wave shift ) is detected by step 413 , the program returns to the st shift verification subroutine 460 of fig5 . if excessive st shift ( and / or t wave shift ) are not detected by step 413 , then step 414 checks if more than p unsteady % of all the beats ( not just the normal beats ) in the electrogram data collected have a too short r — r interval as defined above by the programmed parameter α . if not the program returns to step 451 of the main heart signal processing program 450 of fig5 . if , however , more than p unsteady % of the beats have a short r — r intervals , then step 415 saves all the current electrogram data to event memory 476 of fig4 and step 416 turns on the see doctor alarm signal with the internal alarm sub - system 48 of fig4 and also initiates an external alarm signal by the external alarm system 60 of fig1 with a text or spoken message to the patient indicating that the see doctor alarm signal is the result of detection of unsteady heart rate . as in the case of other see doctor alarm signals , step 417 will keep the “ see doctor ” alarm mechanism turned on for l 4 minutes or until receipt of a signal from the external alarm system 60 to turn off the alarm . fig1 shows a modified embodiment of the guardian system 510 . the cardiosaver implant 505 with lead 512 , electrode 514 , antenna 516 , header 520 and metal case 511 would be implanted subcutaneously in a patient at risk of having a serious cardiac event such as an acute myocardial infarction . the lead 512 could be placed either subcutaneously or into the patient &# 39 ; s heart . the case 511 would act as the indifferent electrode . the system 510 also included external equipment that includes a physician &# 39 ; s programmer 510 an external alarm transceiver 560 and a pocket pc 540 with charger 566 . the external alarm transceiver 560 has its own battery 561 and includes an alarm disable button 562 radiofrequency transceiver 563 , speaker 564 antenna 565 and standard interface card 552 . the cardiosaver 505 has the same capabilities as the cardiosaver 5 of fig1 through 4 . the standardized interface card 552 of the external alarm transceiver 510 can be inserted into a standardized interface card slot in a handheld or laptop computer . the pocket pc 540 is such a handheld computer . the physician &# 39 ; s programmer 510 is typically a laptop computer . such standardized card slots include compact flash card slots , pcmcia adapter ( pc adapter ) card slots , memory stick card slots , secure digital ( sd ) card slots and multi - media card slots . the external alarm transceiver 510 is designed to operate by itself as a self - contained external alarm system , however when inserted into the standardized card slot in the pocket pc 540 , the combination forms an external alarm system with enhanced functionality . for example , in stand alone mode without the pocket pc 540 , the external alarm transceiver 560 can receive alarm notifications from the cardiosaver implant 505 and can produce an external alarm signal by generating one or more sounds through the speaker 564 . these sounds can wake the patient up or provide additional alerting to that provided by the internal alarm signal generated by the cardiosaver 505 . the alarm disable button 562 can acknowledge and turn off both external and internal alarm signals . the standalone external alarm transceiver 560 therefore provides key functionality could be small enough to wear on a chain around the neck or on a belt . when plugged into the pocket pc 540 , the external alarm transceiver 560 can facilitate the display of text messages to the patient and electrogram data that is transmitted from the cardiosaver 505 . the pocket pc 540 also enables the patient operated initiator 55 and panic button 52 capabilities of the external alarm system 60 of fig1 . being a pocket pc also readily allows connection to wireless communication capabilities such as wireless internet access that will facilitate retransmission of data to a medical practitioner at a geographically remote location . it is also envisioned that the charger 566 could recharge the batter 551 when the external alarm adaptor 560 is plugged into the pocket pc 540 . the external alarm transceiver 560 can also serve as the wireless two - way communications interface between the cardiosaver 505 and the programmer 510 . the physician &# 39 ; s programmer 510 is typically a laptop computer running some version of the microsoft windows operating system . as such , any or the above standardized slot interfaces can be either directly interfaced to such a laptop computer or interfaced using a readily available conversion adaptor . for example , almost all laptop computers have a pcmcia slot and pcmcia card adaptors are available for compact flash cards , secure digital cards etc . thus the external alarm adaptor 560 could provide the interface to the physician &# 39 ; s programmer 510 . this provides additional security as each cardiosaver implant 505 and external alarm adaptor 560 could be uniquely paired with built in security codes so that to program the implant 505 , the physician would need the patient &# 39 ; s external alarm adaptor 560 that would act both as a wireless transceiver and as a security key . although the guardian system 10 as described herein could clearly operate as a stand - alone system , it is clearly conceivable to utilize the guardian system 10 with additional pacemaker or implanted defibrillator circuitry . as shown in fig4 pacemaker circuitry 170 and / or defibrillator circuitry 180 could be made part of any cardiosaver 5 or 505 . furthermore , two separate devices ( one pacemaker or one defibrillator plus one cardiosaver 5 ) could be implanted within the same patient . fig1 illustrates a preferred physical embodiment of the external alarm transceiver 560 having standardized interface card 552 , alarm disable button 562 labeled “ alarm off ” and speaker 564 . it is also envisioned that by depressing and holding the alarm disable button 562 for a minimum length of time , when there is not an alarm , the external alarm transceiver could verify the operational status of the cardiosaver 505 and emit a confirming sound from the speaker 564 . fig1 illustrates the physical embodiment of the combined external alarm transceiver 560 and pocket pc 540 where the standardized interface card 552 has been inserted into a matching standardized interface card slot the pocket pc 540 . the screen 542 of the pocket pc 540 shows an example of the display produced by an external alarm system following the detection of an acute myocardial infarction by the cardiosaver 505 . the screen 542 of fig1 displays the time of the alarm , the recent electrogram segment from which the cardiac event was detected and the baseline electrogram segment used for comparison in the cardiac event detection . such a display would greatly facilitate diagnosis of the patient &# 39 ; s condition upon arrival at an emergency room and could eliminate the need for additional electrocardiogram measurements before the patient is treated . although throughout this specification all patients have been referred to in the masculine gender , it is of course understood that patients could be male or female . furthermore , although the only electrogram indications for an acute myocardial infarction that are discussed herein are shifts involving the st segment and t wave height , it should be understood that other changes in the electrogram ( depending on where in the heart the occlusion has occurred and where the electrodes are placed ) could also be used to determine that an acute myocardial infarction is occurring . furthermore , sensors such as heart motion sensors , or devices to measure pressure , po 2 or any other indication of an acute myocardial infarction or cardiac events could be used independently or in conjunction with a st segment or t wave shift detectors to sense a cardiac event . it is also envisioned that all of the processing techniques described herein for an implantable cardiosaver are applicable to a guardian system configuration using skin surface electrodes and a non - implanted cardiosaver 5 the term electrogram would be replaced by the term electrocardiogram . thus the cardiosaver device described in fig5 through 12 would also function as a monitoring device that is completely external to the patient . various other modifications , adaptations , and alternative designs are of course possible in light of the above teachings . therefore , it should be understood at this time that , within the scope of the appended claims , the invention can be practiced otherwise than as specifically described herein .
heart disease is the leading cause of death in the united states . a heart attack ) typically results from a thrombus that obstructs blood flow in one or more coronary arteries . the extent of damage to the myocardium from an ami is strongly dependent upon the length of time prior to restoration of blood flow to the heart muscle . acute myocardial infarction and ischemia may be detected from a patient &# 39 ; s electrocardiogram by noting an st segment shift over a relatively short period of time . the present invention is a guardian system including electrodes , a cardiosaver device having ami detection capability and an alarm means to warn the patient that they have had an ami or other serious cardiac event and should immediately seek medical attention . such a warning would facilitate getting medical treatment quickly to restore blood flow to the patient &# 39 ; s heart muscle . the present invention provides accuracy of detection by comparing a recently collected electrogram data with baseline electrogram data collected at an earlier time when the heart signals were normal . false positives are reduced by requiring multiple detections separated by a predetermined time interval . the present invention can identify and differentiate between an acute myocardial infarction , exercise induced ischemia and other anomalous cardiac conditions . in the preferred embodiment of the present invention the electrodes and the cardiosaver are implanted and the guardian system includes an external alarm system that can produce an external alarm signal and also has means to turn off the alarm .