Files

400 lines
22 KiB
Plaintext
Raw Permalink Normal View History

Episode: 2683
Title: HPR2683: Using Open source tools to visualize the heartrate and blood oxygen saturation level of my stepchild
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr2683/hpr2683.mp3
Transcribed: 2025-10-19 07:28:05
---
This in HBR episode 2683 entitled, using open source tools to visualize the heart rate and blood oxygen saturation level of my step child.
It is hosted by your own pattern and in about 32 minutes long and carrying a clean flag.
The summary is, using open source tools to visualize the heart rate and blood oxygen saturation level of my step child.
This episode of HBR is brought to you by AnanasThost.com.
Get 15% discount on all shared hosting with the offer code HBR15. That's HBR15.
Better web hosting that's honest and fair at AnanasThost.com.
Well, hello there and welcome to my third podcast.
So if you've never heard my any of my podcast, well, I guess you don't.
You haven't missed anything, but well, I like to do it.
So I made a two prior podcast and I thought, let's give it a try.
Again, this time is a much more personal subject. It's much more close to me.
And at the same time, I want to tell you all a technical story.
So bear in mind that everything I tell you is the truth, only the truth and nothing but the truth.
So it's based on stuff that actually happened.
And so it's a human story.
But at the same time, it has a very technical dimension that I want to share with you all.
So the title of this podcast would be if I did the talk about three years ago at a conference.
And that's the only time I did this presentation.
So this is in a way, it's the second time.
Okay, so the title was using Python, PHP, J query and my SQL and Linux to visualize the heart rate and
blood oxygen saturation level of my stepdaughter.
And well, you guessed by now, that's a personal story and it is.
So I'm going to tell you who am I?
Let's make it a sort of semi-formal introduction.
Who is Anushka? Anushka is the child in question.
But more on that later, what happened?
What did I do?
How it all worked out at the end?
The end.
And they all lived happily ever after.
So I already, it was spoiler alert, you know, it has a happy ending in a way.
Okay, so more about me.
My name is Jerome Batten.
Anyway, if you would pronounce it in Dutch, where I'm from, it's Yerun Batten.
So if you want to visualize that in your Spanish or English, if you would do a YER UN and
pronounce it in English, then you have something that sounds pretty familiar to Yerun.
Anyway, I've been an open source geek since 1997.
By now, I'm almost 55.
Even when this is broadcast, I've, I believe, two weeks left before my birthday.
I've written several books on Linux and open source, both for educational purposes,
also for managers.
So these days I call myself an IT solutionist because I like to solve problems.
I used to be a volunteer firefighter, so I did that.
And I was also active in the Boy Scout movement.
At home, we drive an adjusted Opel Vivaro van.
Vorksol would be the brand in the UK.
And it's adjusted because it's adjusted for wheelchair and more on that later.
But on the side, on the both sides of the van is a very big tux.
There was a present from my wife, one of my birthday about 10 years ago.
We have a family.
We have a family with only daughters.
So all in all, we have five daughters.
We are extremely proud of every child.
Two of them are severely disabled.
It just, that's the way sometimes stuff goes in life.
It just happens.
And it just happened to me and it happened to my wife.
So I had three daughters she had two and when we met up, well, we ended up with five children.
The oldest one is just graduated from university and is an actual doctor and is working in a hospital.
So we're very proud of that as well.
But and two others are still in college, studying and well.
But today we're going to talk about Anushka.
Anushka is the youngest daughter of my wife.
She by now is 21.
So she was born in 1997.
And when she was born, she was diagnosed with what's called Spina Bifida.
In her case, Spina Bifida Aperta, L3 to L5.
Which means that she has a spinal cord opening in a way that was created at the very first weeks of pregnancy.
And it has affected her ever since, of course.
She can't walk, she can move her legs.
But it's more erratic than anything else.
But due to this, she also gets a malformation in the skull, which is called Arnold Giari malformation.
She has what's called hydrocephalus.
And for that, she has a drain in her head.
And well, up till today, she has had 43 surgeries in her life.
And then there's the extra number of hospital sessions for pneumonia and other stuff.
We stopped counting.
So all in all, she has been in the hospital many, many, many times.
So did we.
When I met her, she was 10.
So I've, I've sort of joined them in these kind of festivities.
And I mean that, of course, ironically, for the last 11 years.
She's very acquainted with hospital life.
She, in a way, it's, oh, do I need to go to the hospital?
That's fine because every Thursday, there are the clinic lounge.
So she, she focuses on the good stuff that happens there, not realizing that.
Actually, you should avoid being in a hospital as much as possible.
And well, to give you an example, she, at one point, had a surgery to, to straighten her spinal cord.
Because she was, when you're 15, 16 years old and you're always sitting in a wheelchair,
sort of your body, your, your spinal cord is not a straight line anymore,
but becomes a sort of an S figure.
And everything becomes shorter.
All organs become packed together.
And at the time that they are, the doctors say she's probably not going to grow anymore.
That's the time when they do these kinds of adjustments.
They straighten the spinal cord just by, well, pulling it straight, of course,
when you're under anesthesia.
And then putting two iron rods parallel to your spinal cord.
It does take about six weeks of recovery after that to get acquainted,
to get your body acquainted with the fact that you can't move your spinal cord anymore.
But it's strengthening you. It gives more room to your organs.
So all in all, it was, it was an improvement, strangely enough.
Anyway, so the surgery session where our journey today starts was a couple of years ago,
when she had what I would call chronic pain in her hip joint, one of her hip joints.
The side doesn't matter, of course.
And the cause for that was that there's insufficient joint development,
simply because you're always in a wheelchair.
So normal kids who are standing, the hip joint cup is created because,
well, your body weight is pressing on to your leg.
So it sort of forms itself just by playing and walking, et cetera.
But if you are sitting and lying all your life, the hip joint doesn't really develop well.
So there was some surgery necessary, and actually they cut off the top of the hip bone,
rotated it, 180 degrees, and put it back together, together with some metal and screws.
And I won't bother you with the details why, but it was an improvement.
But, and this is where it starts, post surgery, she had low oxygen levels during sleep.
So during the day, no problem, everything's fine.
But during sleep, her oxygen levels were decreasing.
So there was some questions as to what's the source of this?
How severe is this?
Can we fix this?
Those kind of questions that you ask yourself at that particular point in time.
So she was, of course, taken care of by a pediatrician at her hospital,
an excellent pediatrician, by the way, excellent guy.
So one of the things that was ordered was what's called a polysomnography.
And a polysomnography is a difficult word for, let's say, a 24 hour monitoring of your oxygen levels during the day and during sleep.
So it takes 24 hours.
The result of it was that the oxygen levels were varying at night between 85 and 90%.
So that doesn't seem to be too bad.
85%, 60% to 90%, it's not alarming.
So the end conclusion of this polysomnography was that the values found were in the gray area.
So it's not green, it's not red, it's in between slightly orange, maybe, but we call that a gray area.
So there were some measures regarding oxygen introduced at home.
And the pediatrician said, if only we had more data.
If only we had more data.
But please, not a huge table with data.
This was clearly a picture guy.
And so we came home, we went home, and we got two devices.
As if we didn't have enough, but we got two devices.
One was an oxygen concentrator.
And the other is a saturation measurement device.
So the oxygen concentrator is for producing oxygen.
We got a Phillips or ever flow oxygen concentrator.
And no matter what people say, these things are loud at night.
They switch every so many seconds.
And it bothers the hell out of me.
Strangely enough, it doesn't bother the hell out of Anushka, the child in question.
She doesn't care. She just sleeps.
Which is, of course, marvelous.
Especially when you've got a device next to your bed that every, let's say, every 20 seconds goes...
And then there's 20 seconds of silence.
So it annoys me.
It doesn't annoy her.
Thank God for small fairs.
Anyway, the other thing we got was a saturation measurement for correct level feedback and alarm.
And we got what's called a Massimo Red 8 RAD 8 saturation measurement device.
And that's where we begin.
But, you know, I'm a nerd, I'm a geek, whatever.
And what is that I see on the back of the RAD 8?
Well, believe it or not, it's an RS232 connector.
It's a serial interface.
Yay! Can I play with it?
May I play with it?
So I go and Google the stuff.
And I find the Massimo Red 8 user manual.PDF, which clearly describes everything that this connector can do.
And what does the manual say?
Well, there are buttons where you can set the serial output on and off.
And standard, it's 9600 board, 8 bits, no priority, one stop bit, one start bit.
So basically, very simple serial connection.
And when I connect this to a Linux system, what do I get?
A nice string that's output every two seconds that gives me a date, a time.
It gives me a serial number of the measurement we're talking about.
It gives me the saturation percentage of oxygen.
It gives me a heart rate.
And let's see what else.
Some other stuff that's actually blank.
So it's a generic serial library.
And the device does not measure everything that's in the library.
But it measures enough for us anyway.
So, next order of business.
I created a database.
I used my SQL just in how simple it doesn't have to be a rock solid.
It doesn't have to be enterprise ready.
It's just store some data.
And I'll look at it in a later time.
So I made a table with a few fields.
You know, ID, timestamp, the data received.
So that's the complete string.
And I also made a separate field for the oxygen percentage for the heart rate.
And well, yeah.
And the time.
Oh, yeah.
And the timestamp field that I got from the device.
And I create some indexes.
And I'm ready to go.
So I start programming in Python to import the serial data and put everything in the database.
Now, the device is not switched on 24 hours a day.
So, but the PC that's running on her room because she is a Ubuntu user because she had to.
And she was familiar with Ubuntu games because she liked simple games.
We just left it running.
And I created a service that was running the Python program.
And only when there were measurements coming from the serial line, he would store it in the database.
So no zero value values during the day.
Only as soon as the unit was switched on, there would be stored in the database.
Well, what do we have?
We have a database.
We have at the end, we add some 7 million.
Yeah, that's 7 million measurement values.
So all strings, measurement strings.
And that should be enough 7 million.
So I needed to get the basic heart rate and the zero, sorry, the O2 from the string.
So I just, well, this is plain and simple update data set.
Spo2 to a substring of the data from 38 three characters.
Update data set the heart rate to a substring and so on.
So because it was a fixed length, ASCII string, no stored procedure, nothing hard.
Nothing hard to do.
Just simple.
Just get the data from the substring and store it in the separate field and work from that.
Next thing was, okay, shall I, I need to visualize this data quick and dirty.
And what's the best way to visualize quick and dirty?
Obviously, there are other solutions.
No doubt people who are listening to this are thinking, oh, that's dumb.
You should have used, well, X, Y, Z, whatever.
Anyway, so this is in a way a random choice, but at the end, I was happy with this.
So I use PHP and I use jQuery.
And jQuery was simple to get a data selector because at the time I wrote this,
there was no HTML5 with a nice input type is date and you get a date selector.
You had to build it yourself.
So I use jQuery for that.
And then I had to find it easy to use PHP visualization library.
Of course, I know I knew of JP graph because at some time that was the all around go to graphic library for visualizing graphs in PHP.
But when I was looking at it and that this is back in 2015,
it turned out to be no longer the leading library.
So let's look at what stayed of the art at that point in time.
So there is Google, you know, it's hip, it's happening.
They do a lot of stuff and they have a charts JavaScript library.
Well, that can't be wrong, right? It's Google wrong.
It is, it's, it's, no, it was clearly not for me.
It was, I don't know, too complex.
I do, too buggy. I forgot.
But it clearly wasn't for me.
So I found, I found this other thing.
It was dy graph, do it yourself graph, dy graph.
And basically what you do is you send it CS, CSV format data and you're done.
So I could make an HTML form every graph that I wanted.
I just, the source of it would be a PHP script that would only produce CHV format data.
Easy peasy, done, working.
It includes zoom functionality out of the box.
Yay. And that's when I saw the first results.
And so I had a heart rate, I had oxygen levels.
And yes, they were dipping. Sometimes they were at 65%.
So, oh, no, sorry, that's not 65%.
The heart rate is 65. No problem there.
I'm ready. I was reading this wrong.
And the oxygen level was well.
On average, I would say 92%, which isn't bad.
Nothing alarming anyway.
So, I was, I changed the measurements.
No, I changed the visualization of the measurements to use a small range
averages. So, as in, give me the average O2 or heart rate for five or six minutes or something.
Then you can see some more of a trend instead of all the noise if you use two second intervals.
And yeah, it gave me some pictures, but I wasn't very happy yet.
Anyway, so I basically, in the end, I had three PHP programs.
I had indexed PHP, which would just say, okay, I'm going to draw two pictures, two graphics.
And one would be the oxygen PHP, who would generate CSV for the oxygen.
And one would be BPM for beats per minute, heart rate dot PHP to give me CHV values for the heart rate.
And then when we were playing around with it during the week, nothing there.
And then during the weekend, we could start an experiment.
And this is why it becomes a little hairy.
Let me explain first before you draw yourself in a fitty.
Because during the weekend, we could switch the oxygen supply off.
Now, this sounds dangerous, but she was connected to a saturation alarm.
So, if the oxygen level would become too low, the alarm would go off since we had a permanent communication line with her bedroom.
The alarm would wake us, and we could go down to her.
She was lying on the ground floor, and we won the first floor.
And we'd be always in time, because this is so, this is seconds, you know,
and you only get into trouble after a couple of minutes.
No danger at all.
But if you supply her with oxygen, we could never measure if she needed oxygen.
And that was what we needed to find out.
So, at Friday evening, we switched off the oxygen, and of course kept the saturation monitoring.
And this was of course for us still.
Well, not so much. It's not that it's scary, but it's also not that you're ex...
I don't know what the word for it is, but it comes close to unnerving, I guess.
So, this is my lack of English. Sorry for that.
Anyway, what we did see that during the night, we did this the whole weekend,
because, well, 24 hours was not enough.
Otherwise, the polysomnography had given us a good result.
So, we did this the whole weekend.
And what we saw was that somewhere at three o'clock in the morning,
she would... the oxygen level would dip.
Would go... what's that? A downward peak value.
Let's say, so the first, it would go to 60%, the next day,
it would go to 70%, the next day, it would go to 80%,
and it wouldn't be for a long period of time, but...
No, that's wrong. So, it first dipped to 80%, then it dipped to 70%,
and then it dipped to 60%. Not for a long period, but there was a clear,
decreasing amount of oxygen over time every night.
So, maybe this... I still see the graph in front of me while I'm telling this,
but I know it's hard to explain it.
So, I'm repeating it just to make it clear.
So, somewhere around three in the morning, her oxygen level would go down
from the normal 90%, 95%, the first night, it would go to 80%,
and then back up to 90 during the rest of the night, nothing there.
The next night, it would, again, three, four o'clock in the morning,
go from 90%, 95, down to... we were at 80, so it would be 70%.
Just for a few minutes, and then it would go back up again to 90, 95.
And the third night, she would go to 60%.
Of course, we get an alarm by then, so we went and have a look,
and well, she was just sleeping fine.
And there was no real alarm, sure.
But at the same time, every morning, she woke up,
she felt increasingly tired.
So, it was sort of an energy drain on her to sleep without oxygen.
And we saw an increasing amount of... well, it's decreasing, actually.
So, the oxygen dip would become increasingly worse.
So, three days was more than enough for us to convince us.
We went with these graphics to her physician who was very happy
to have all this data and all these graphs.
And we could put this doubt to rest whether or not she would actually need oxygen
because first it was... well, you know, it's inconclusive, you don't know.
So, we're not connected to oxygen during the night.
The minimum rates will continue to drop during several days.
Ago, oxygen always needed.
So, that was, at the end, the conclusion that we had to take.
The physician was happy with the results.
We were happy with the results.
I was proud because as a hacker, I could do something really valuable
with my skillset in her healthcare.
And at the end of the day, so was she, actually.
So, as she's still on oxygen, well, it did have a serious impact.
But that has nothing to do with this research.
But the other thing we had to decide, and that's where Anishka...
She... she doesn't have the regular skill set of somebody of 21.
It's lower than that.
But still, at some point, sometimes she can really amaze you by your insights.
And when we got the oxygen system at home,
and the saturation measurement device,
and she knew that these saturation measuring devices,
they also give out false warnings every night.
If you have a good night, it's one.
If you have an average night, it will be three false alarms.
And we already had our day job.
After our day job, we would have our care job taking care of her.
And that would mean that we couldn't even sleep normally anymore.
So, if you cannot even rest during the night, consistently.
And I'm not talking about... sometimes the night that you can't sleep.
I'm talking about every night that will be broken.
You just know when you start down that road,
that this situation will become increasingly worse for us as a parent.
So, we had to discuss with her the option of starting to live somewhere else.
And she already figured that one out herself.
So, when she was 18, because she was very close to her 18th birthday,
she started to live somewhere very close by.
And she's very happy.
As a matter of fact, when I'm recording this, I'm just home.
And I picked her up at where she lives.
And we went to a Greek restaurant and had a lovely dinner together with her.
And we all, all three of us enjoyed it thoroughly.
And I brought her back there where they can take so much better care of her than we can.
At the end, you're just simply exhausted to keep on doing this.
Which would, in a way, be a nice intro to a podcast about my burnout.
I realized while I'm seeing this.
But maybe that's something for another episode.
Let's not overdo it at this day.
Maybe this is enough for today.
So, that was it.
I'm using nerd stuff and open source tools to measure the oxygen levels of your daughter
and to zoom in on the best way of treating and diagnosed diagnosis.
And that's it for today.
So, yeah.
I hope you find it interesting.
If you like, please leave a comment.
I enjoy the comments that I've read so far on the previous podcast.
I enjoy them tremendously.
Too bad there is no reaction button, so I can't respond to comments as I would like to.
Maybe I should record a podcast of the comments.
But, you know, then you get a sort of a never-ending cycle of responding to comments on podcasts,
to comments on podcasts, etc.
You know, it's a never-ending route.
I leave you at that.
I hope you enjoyed this.
And I would say, till we meet or talk or tell you hear me again.
Okay? Bye-bye.
You've been listening to Hacker Public Radio at HackerPublicRadio.org.
We are a community podcast network that releases shows every weekday, Monday through Friday.
Today's show, like all our shows, was contributed by an HBR listener like yourself.
If you ever thought of recording a podcast, then click on our contribute link to find out how easy it really is.
Hacker Public Radio was founded by the Digital Dove Pound and the Infonomicon Computer Club.
And it's part of the binary revolution at binrev.com.
If you have comments on today's show, please email the host directly, leave a comment on the website or record a follow-up episode yourself.
Unless otherwise stated, today's show is released on the creative comments,
attribution, share a like, 3.0 license.