The Plug acquires a wealth of data about you. There is medical data, such as the biomarkers indicating the disease, as well as social data gathered through a variety of sensors.
The biomarkers are obtained through Magnetic Resonance Imaging (MRI) and taking your spinal fluid through a spinal tap. These procedures will be done in hospital with specialists. The data obtained from these tests will be fed into your profile which communicates directly with your implant.
More complex is the sensor data obtained. The data collected depends completely on the parameters you specify which give your life quality. We can detect a lot of details, how much is up to you. For example, we can collect data about your whereabouts by movement sensors in your house, GPS trackers you wear (or have implanted). We can detect forgetfulness by analysing repetition. We can detect looping behaviour (getting stuck in a same behaviour pattern repetitively). We can detect social behaviours, your own, and of those you love. The latter is only possible with the explicit consent of those whose responses to you you wish to track.
Your parameters can be compared to a boolean string search. You can set one particular condition which will activate The Plug, or a string of specific conditions which need to all be met before The Plug is triggered.
The Plug implant will be surgically implanted into your heart, much like a pacemaker. The implant only gets activated when the conditions you have specified have come to pass. The implant communicates with your wearable (or implanted) sensor, and triggers when you are in deep sleep. This assures your death is peaceful, painless and fast.