Underneath the covers, when you’re talking to one of these insulin pumps, it uses a relatively proprietary protocol, but it’s running on packet radio. So you’re getting these packets of data, you’re sending commands to the pump, getting things back, and it’s giving you frames of data that you have to peel away and do CRC checks on and make sure that everything looks right, and then you can add that to the bundle of things that you’ve already received.

Once you get enough of those things together, then you have this page - it’s 1,024 bytes full of stuff, and you have to figure out what to do with it. That’s the way both the history and the continuous glucose monitor data comes from the pump. So these pages of information have various kinds of events encoded in them. At the simplest, it’s a single byte that tells you what your blood sugar is. At it’s most complicated, it’s “Hey, I changed the date and time on the pump. The old one was this, the new one is this”, and it’s like 20 bytes, or something like that.

So there’s just lots of different varying links and varying types of data that are stored in these pages, and you have to be able to walk through multiple pages, sometimes, to get to where you want. If I just flipped a page on the CGM, if I just filled up the last byte of the previous page and I’m on a new one, then if I need 20 minutes worth of CGM data, I’ve gotta go fetch two pages - I’ve gotta fetch the one I’m on, turn around, make another request, get all these packets back, reassemble them, and then get another page and then walk through that.

So there’s just a lot of manipulation of data and streams and binary that when you look at it in the Python code or you look at it in the Swift code, they handle it reasonably, but you’re going a bunch of different places to try to figure out how it works. And then Elixir - I mean, it’s right there in the function head; you’re just saying “Okay, if it’s this kind of an event based on that first byte, it’s gonna be twelve long, and then the first four are gonna be the timestamps; let’s go decode those.” It’s just all right there.

[ ] There’s no indirection and there’s no “Oh, this is scary because it’s binary, so I have to treat it differently, and I have to have a raise”, and scary things like that. It’s just regular function head processing, just like everything else in Elixir. It’s really exciting, because you can see how it’s processing the data without having to go jump around and jump through hoops.