5 ms·
Amazing read, really well written - prior to reading, it seemed odd to me that a simple PID insulin or sugar pump armed with a glucose sensor could not mimic a
by bigmattystyles 4y ago
Amazing read, really well written - prior to reading, it seemed odd to me that a simple PID insulin or sugar pump armed with a glucose sensor could not mimic a pancreas. I didn't realize there were so many variables. It still seems from my engineering mindset that a PID device should be able to do this, but I'm starting to understand why it's not so simple now.
- bsder 4y agoThis could be engineered around--mostly the limitations are liability. If you, the patient, take a glucose sensor, an insulin pump and tie them together with an app, you don't get to sue somebody if something fails and you die. If a company takes all three of those, packages them together, and sells them, then that company is now liable when one of the pieces fails and you wind up dead. The sad part is that AI/ML would be incredibly useful for all this. People could take pictures of their meals, upload their sleep and exercise data, and weigh themselves, feed all that into a cloud algorithm that could determine how you are likely to react and dial your insulin plan into your pump while feeding the glucose readings back to the cloud. Sadly, I suspect none of this is going to happen in the US due to the liability. Maybe China will pull this off.
- bayesian_horse 4y agoI don't want to call your comment ignorant, but you are lacking a lot of the information necessary to see why it's not that easy. For starters: Insulin is quite long acting. Maybe 4 hours for some injected "short-acting" types. Regular insulin (like the one from the pancreas) acts for maybe 6 hours. The ratio of how much insulin you need for a given weight of carbs doesn't stay constant. If you inject too much insulin, if you raise your carb intake, that leads to a higher ratio. Physical exercise modifies the ratio in a short-term fashion. Inflammation, like from a cold or other infection, can raise the ratio significantly. You could model the situation with a bunch of differential equations, and that's what a lot of scientific Most of these variables can't even be estimated precisely enough because there is too little data for too much variation. ML/AI is good at using information in the dataset that is hard to describe or see for Humans. But it can't use information that just isn't in the input data, it's not magic. For Type-2 diabetes there are relatively simple rules that work remarkably well. Type-1 is a lot harder, partly because a lot of the "buffering" of the system dynamics is missing.
- icehawk 4y ago> The sad part is that AI/ML would be incredibly useful for all this. People could take pictures of their meals, Pictures of food are nowhere near near enough data to determine the carb content of a food. My SO has T1, and there have been times where there's been no visible change, and I can only taste a vague change in the taste of some food item and the changes it caused to their blood glucose were wildly different that what it had done previously.
- GrinningFool 4y agoConversely, it sucks to know that software you wrote is responsible for having killed even one person - to say nothing of doing so at scale. Were I in that field as an engineer, I'd be all in favor of being very conservative - and it has nothing to do with liability.
- bsder 4y ago> Conversely, it sucks to know that software you wrote is responsible for having killed even one person - to say nothing of doing so at scale. But, how many people did your software improve the lives of? This is the real problem with stuff like T1D automatic insulin control loops. You will likely kill some number of people through failure modes. However, how much better will the lives of those people whom you didn't kill be? T1D results in a lot of complications over time that, if they could be controlled, would result in a significant increase in quality of life for the survivors. I actually had this discussion with a doctor who invented an asthma monitor for his daughter. It would automatically inform him and the school nurse as well as transmit the severity of event so the father could dispatch an ambulance immediately if it was really bad. I assure you it worked as well as it possibly could. However, nobody would touch turning it into a product because, at some point, the monitor was going to miss an event (bad detection, cellular system transmission failure, something) and some child was going to die and the liability was going to be enormous. And that asthma monitor is a much easier case to discuss as it's all upside--the monitor failing doesn't kill anybody. Without the monitor, some number of children will die anyway. With the monitor, some number of those children will be saved. Having this discussion about T1D is much more difficult.
- bayesian_horse 4y agoThe PID mindset, maybe with a "bayesian" bend, is generally the right idea. You have to realize from the outset that you're not going to predict the results of your actions correctly, and you can't even tell afterwards what effect your particular actions had. Which is frightening. Internal medicine is a lot about "let's try this common dosage and see what happens". It gets worse with an organism still growing, which means the dosages and effects have a long-term trend at the least. In my (non-human-medical) opinion, low blood sugar is on average better than high blood sugar, especially for patients who don't need to walk around unsupervised and operate heavy machinery (i.e. cats, dogs, small children). An adult Human body only has on the order of 3g of sugar circulating in its blood at any time. We can easily generate blood sugar from protein. It's much harder to eliminate high blood sugar. Even extreme overdoses of injected insulin often only result in a coma that the patients can often recover from on their own because they metabolize the insulin and generate the glucose. I'm not recommending that, of course! Low blood sugar however, is an immediate problem, high blood sugar is a long-term problem. Getting the balance right is hard, especially for Type-1 Diabetes. In overweight Type-2 patients (like I was) usually the patient's liver is so good at generating glucose that it buffers a wider range of insulin dosages and you have more time finding the lowest sufficient dose. Insulin is bad for your health, it means too much glucose is deposited everywhere in your body, leading to all sorts of problems. But too much glucose in the blood is even worse, so...
- mlsu 4y agoLow BG is a nonstarter, because it immediately impairs you. You will crash your car. You will get confused and fight someone. You will pass out and not be able to reach glucose. That coma will cause brain damage. And, if you have back to back hypo episodes, you will actually fry both your body's natural counterregulation (you deplete your glycogen store, which makes subsequent hypo events more severe) and your neurological response to hypo (you lose awareness that you are hypo). In the long term, after too many lows, you will lose your ability to recognize hypo entirely. The brain/metabolism link runs deeep into the lizard brain. Real deep. A non-diabetic with a 5.5% A1C is doing just fine. Someone with Type 1 with a 5.5% A1C is almost certainly critically endangering themselves and everyone on the road.
- heisenzombie 4y agoSo, insulin pumps linked to continuous glucose monitors (CGMs) do exist. For example, "Tandem Control-IQ" or "Minimed Smart Guard". These are known generally as "Hybrid closed-loop" systems. They work very well and generally offer positive outcomes for most people with Type 1 diabetes. They are called "hybrid" because they do not try to correct for carbs that you eat ("bolus"), rather they only try to adjust background insulin levels ("basal") and do some "mopping up" if you mis-dose for carbs you eat. The main things holding them back are that: - CGMs only measure glucose in interstitial fluid, which has a time-delay of 5-15 minutes from veinous blood glucose - Injected insulin also takes roughly 5-15 minutes to start acting and peak action is after an hour. That means your PID controller could have up to a 30 minute lag time to the system it's controlling. And let me tell you, blood glucose isn't a slow system. It can go from dangerously high to dangerously low in 30 minutes (or vice-versa). The body has the advantage that its insulin is faster acting, it can sense blood glucose changes faster, and it can use other sensors (e.g. glucose receptors in the mouth can start insulin production before it ever hits the bloodstream).
- bayesian_horse 4y ago"Artificial Pancreas" schemes usually use ultra-short-acting insulins which are even quicker acting than "regular human" insulin. There is virtually no immediate danger from high BGL (but medium to long term for sure!). High BGL over long time in Type-2 diabetes means there is actually too much insulin production for your own good, leading to high insulin resistance, leading to a situation where the cells aren't getting enough glucose at all. But this state takes some time to develop. Low BGL is the other way around: immediate danger, long term it's easier to buffer or control. Keep in mind those are generalizations. Don't take this as medical advice. Don't think I'm saying there is no need to react to high BGL.
- Benjamin_Dobell 4y ago> ultra-short-acting insulins which are even quicker acting than "regular human" insulin. Whilst this is true chemically, it's the delivery mechanism that causes the delay. The chemical composition of insulins like Novorapid (which my daughter uses) are slightly faster than regular human insulin, but not nearly enough to account for the aforementioned (up to) 30 minute lag.
- icehawk 4y agoYeah from first glance you'd think so, but the feedback loop even with CGMs and insulin pumps is just so much longer and less sensitive than what the body normally does. The CGM measures glucose in the interstitial fluid, and the pump injects insulin subcutaneously, while the pancreas secrets it directly into the blood stream. Even with the improvements we've made with synthetic insulin it just doesn't work as fast or as well as what we produce internally.
- mlsu 4y agoWhat you describe (sugar + insulin pump) is called a "dual hormone" pump. No such device exists on the open market. So that is yet another challenge. You can actuate in only one direction: pushing BG lower. PID does actually work for this, but it is outperformed by algorithms that can explicitly consider a patient model (model predictive control, or MPC). I believe closed-loop algorithms using both PID and MPC have been tested on in vivo, and both have been brought to market, although of course all vendors are very tight-lipped about what their algorithm looks like. If you are working in the AP space, you are looking at algorithm performance after an unannounced meal (patient doesn't tell you that he's eaten: how much do you dose?). You will test your algorithm in a virtual patient simulator first. Then, if you are lucky enough to work with the research hospital at your institution, you can test your algorithm on real patients in vivo. The low bar for bringing an AP to the FDA is a provable safety envelope: you will never ever dose too much insulin. Ever. Even if your RL agent learns badly, even if your patient put honey over the CGM site before putting it on. Not having a negative result in the simulator is not enough -- you need a provable bound on dose. This is why the majority of RL algorithms do not work. And why the problem is so hard. You have this super complex system, with a ton of metabolic unknowns. Unknowns over short timescales, like food response, exercise, illness, stress, and so on. And over long timescales, like your diet changes over time, your body changes, etc. And you have huge variation between patients, with different genetics, diet, and astrological sign between people. Boy it would be nice to learn those unknowns with a computer, which is what every RL paper says about the AP. But: if you get it wrong once, it's all over, and further, if you really want to play, you have to prove that you will never get it wrong. That's why every AP system out there now is very conservative, and why none of them are using exotic ML techniques. And why, with the standard classical toolkit, the problem is very difficult. Although it's a bit old, this is a pretty good overview of where the field is: https://diabetesjournals.org/care/article/37/5/1191/38217 https://diabetesjournals.org/care/article/37/5/1191/38217