Apnea Board Forum - CPAP | Sleep Apnea
OSCAR Overview Chart AHI Bars are Wrong Size? - Printable Version

+- Apnea Board Forum - CPAP | Sleep Apnea (https://www.apneaboard.com/forums)
+-- Forum: Public Area (https://www.apneaboard.com/forums/Forum-Public-Area)
+--- Forum: Software Support Forum (https://www.apneaboard.com/forums/Forum-Software-Support-Forum)
+--- Thread: OSCAR Overview Chart AHI Bars are Wrong Size? (/Thread-OSCAR-Overview-Chart-AHI-Bars-are-Wrong-Size)

Pages: 1 2


OSCAR Overview Chart AHI Bars are Wrong Size? - spacewrench - 03-14-2020

Recently, I've occasionally had trouble falling asleep until I take off my machine (then I sleep fine, though I wake up less oxygenated).  When I check the next day, I usually find that the whole time I was trying to fall asleep was just a long string of CAs and hypopneas, with a crazy-high AHI. But on the Overview page, the AHI bars don't match up -- the short day might be AHI 20 (over 15-20 minutes) while the next day might be 4 (over 5 hours).  But the 4 bar is taller than the 20 bar.

Why is that?

[attachment=20994][attachment=20995][attachment=20996]


RE: OSCAR Overview Chart AHI Bars are Wrong Size? - sawinglogz - 03-16-2020

Wow, THAT looks wrong. Somebody who knows the graphing code will need to check that one out.


RE: OSCAR Overview Chart AHI Bars are Wrong Size? - spacewrench - 03-18-2020

Actually, I had an idea that might explain it.  I have an SPO2 monitor that I use, and those sessions are always 6-8 hours, even when I give up on CPAP after 15 minutes or whatever.  So perhaps the bar-graph is showing the AHI divided by the total length of data for the day.  On a day when CPAP and SPO2 sessions are the same, it's a wash.  But when CPAP is shorter than SPO2, perhaps the AHI is being divided by the SPO2 session time, giving an unexpectedly low value.


RE: OSCAR Overview Chart AHI Bars are Wrong Size? - sawinglogz - 03-19-2020

That's a real possibility!

Take a look at those days, and scroll down to the bottom in the left panel. It will show you the sessions from each device you used that day, along with its duration.

I think the daily graph will also extend from earliest to latest timestamp on that day.

Do those confirm your theory?


RE: OSCAR Overview Chart AHI Bars are Wrong Size? - spacewrench - 03-29-2020

I figured I'd take a look at this today, so I pulled the latest code and built it.  Loaded a new profile from my CPAP machine (only) and the summary bars look good.  Then I loaded SPO2 data from some of the short-session, high-AHI days (SPO2 session much longer than CPAP session), and the summary bars still look fine.

Looking at gSessionTimesChart.cpp:1263 gAHIChart::populate(), I think I see where the problem might be.  This routine calculates hours as an overall value (not using the hours(machineType) method of Days) and then divides the various event counts by the total hours.  I think populate() at 1267 should pass MT_CPAP to hours().

However, since I don't currently have a bad display to try to fix, it's possible that the problem has been fixed somewhere else.

I'll keep an eye on it, and if I see the error turn up again, I'll try the above and report whether it helps.

Regards,
sw


RE: OSCAR Overview Chart AHI Bars are Wrong Size? - pholynyk - 03-29-2020

I think you are right. I've made a note of it, and I will try to find a way to test it.
I want to verify the kinds of codes included in calcitems.


RE: OSCAR Overview Chart AHI Bars are Wrong Size? - sawinglogz - 03-29-2020

Thanks for digging into this, that was a huge help! Looking at the code, I'm pretty sure you're right. I'm going to see if I can come up with a test case to reproduce it and test the fix.


RE: OSCAR Overview Chart AHI Bars are Wrong Size? - sawinglogz - 03-29-2020

(03-29-2020, 02:52 PM)pholynyk Wrote: I think you are right. I've made a note of it, and I will try to find a way to test it.
I want to verify the kinds of codes included in calcitems.

This is in the constructor of gAHIChart (in the header file). I'm going to work on a test case, since I have lots of test data to play with, and I can slice PRS1 data down into short sessions, so I should be able to come up with a test case.


RE: OSCAR Overview Chart AHI Bars are Wrong Size? - sawinglogz - 03-29-2020

@spacewrench you were exactly right! Nearly every other call in that file to day->hours() uses day->hours(m_machtype) which uses the type passed to the constructor (MT_CPAP).

What I noticed in reproducing this with a test case is that the usage chart was similarly wrong: it would show 8 hours of usage for a night with 1 hour of CPAP and 8 hours of oximetry. I'm about to merge a fix for both.

(After I fix another issue I found on the welcome screen.)


RE: OSCAR Overview Chart AHI Bars are Wrong Size? - spacewrench - 03-29-2020

What's that they say?  "An old clock is right twice a day"?  Something like that, anyway :-)