Adjusted urine-ouput for MIMIC-III+IV (Bigquery), per STAY_ID, for hourly interval, every hour on the hour.
Revised Re-PR, for MIMIC-III+IV of this https://github.com/MIT-LCP/mimic-code/pull/721
Can somone please approve this revised PR? @alistairewj
I think my main concern is that it is confusing to have two urine output queries. Sorry to ask for more work, but could you summarize the differences, mainly for MIMIC-IV, between what you've uploaded and the latest version?
Thank you for your response. I didn't actually uploaded two different versions! After a few fixes in the old PR branch (#721) you said "Yes, a new PR sounds fine! Everything is now in this repository, so you could PR both at the same time, if that works." - so that's why I did. See comments on the old branch.
Yes what I mean is, ultimately we would have two queries for urine output. What makes more sense in my mind is a derived view from the current UO query which makes it clear what the changes you incorporated were (I recall GU irrigant being one of them, but am unsure of the others). That way it's clear to everyone what the differences are, and we have the bulk of the UO code in one place.
The original query congregates all the spot urine outputs items to one table which is super essential and also incorporated in my code. The query in the PR is used for standardising the items, e.g. spot urine outputs, to hourly urine output intervals for research purposes. Everything is summarised in more details in the comment in the code itself, but the main part is:
-- ## Rationale: -- This is urine-output adjustment corrected to 1 hour intervals, every hour on the hour. -- This adjustment is meant to be used for AKI calculation and other research purposes. -- Each ICUSTAY_ID has "T_PLUS" column that represents the hourly intervals from the beginning to the end of -- his urine outputevents.
-- The problems with regular urine-outputs in outputevents measurements are: -- (1) You can have two measurements at one hour interval (e.g. 00:01, 00:59). -- (2) Different time interval between measurements. -- Since urine collection is done per unit of time from the last measurement, every value should be -- corrected for the time length it represents.
-- ### SUMMARY OF THE SOLUTION: -- The solution is summing up: -- 1st sample in the interval - is multiplied by the portion of time within the interval to the full length of time. -- 1st sample of the NEXT interval - is multiplied by the portion of time within the interval to the full length of time. -- Other samples in the interval - simply added.
@arielhasidim are you still interested in contributing this, and/or is this still the latest version? I understand it's been a while (sorry!). I started to work through this code, but it's a significant undertaking. I think there are SQL built-ins which might simplify the logic, like those used in the KDIGO UO calculation in this repo (that post-date your original contribution of this code).
@alistairewj Thank you for reaching out and considering my contribution! I apologize for the delay in responding and for the outdated version of the code in the pull request.
I am still very much interested in contributing the code for adjusting hourly urine output. However, I am working on a more comprehensive and updated solution, which addresses the complexities involved in the task. I will keep you updated. In the meantime, I will go ahead and close the old PR, as it no longer represents the most up-to-date version of the code.
Thank you once again for your understanding, and I appreciate your support in this matter!
no problem, sorry I never got around to finishing the review but glad there are improvements in the pipe!