Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change logic for KDIGO staging #584

Merged
merged 11 commits into from
Aug 16, 2019
Merged

Change logic for KDIGO staging #584

merged 11 commits into from
Aug 16, 2019

Conversation

alistairewj
Copy link
Member

@alistairewj alistairewj commented Jul 25, 2019

  • kdigo-creatinine.sql - now creates a row for every creatinine value, along with (1) the lowest previous creatinine in last 48 hours and (2) the lowest previous creatinine in the last 7 days
  • kdigo-uo.sql - added the time of earliest UO measurement that was used to calculate the rate (so, if we calculated a 6 hour rate using a measurement 3 hours ago, this would be the time of the measurement 3 hours ago). This time is used in staging (see below).
  • kdigo-stages.sql added - stages AKI at all time points (rather than once for 48 hours/7 days)
  • kdigo-stages-48hr.sql - subselects from above query, and gets the highest AKI stage in the first 48 hours of a patient's stay
  • kdigo-stages-7day.sql - subselects from above query, and gets the highest AKI stage in the first 7 days of a patient's stay

Some logic changes:

  • baseline has been redefined from lowest value in the first 24 hours of the ICU stay to the lowest value in the last 7 days. This is more consistent with KDIGO, which states baseline "...is known or presumed to have occurred within the prior 7 days" - and mentioned by Chris in an issue.
  • UO rate is only used if the rate was calculated over at least N/2 hours, where N=6, 12, 24 as appropriate

Regarding some open issues/PRs, this closes #486 (no longer relevant), closes #484, and refers to #476 (but not necessarily closed).

Contingency table:

aki_48hr aki_creat_48hr aki_uo_48hr n % of stays
0 0 0 10299 29.5
0 0 1647 4.7
0 0 25 0.1
0 25 0.1
1 0 1 2902 8.3
1 0 2 7543 21.6
1 0 3 2853 8.2
1 1 0 1484 4.3
1 1 1 788 2.3
1 1 2 2263 6.5
1 1 3 2037 5.8
1 1 460 1.3
1 2 0 250 0.7
1 2 1 90 0.3
1 2 2 401 1.1
1 2 3 503 1.4
1 2 95 0.3
1 3 0 134 0.4
1 3 1 34 0.1
1 3 2 150 0.4
1 3 3 702 2.0
1 3 185 0.5
1 2 14 0.0
1 3 11 0.0

Query for above table:

with t1 as
(
SELECT ic.icustay_id
, ic.gender
, ic.admission_age AS age
, w.weight
, h.height
, los_icu
, first_hosp_stay
, aki_48hr
, k4.aki_stage_creat as AKI_stage_48hr_creat
, k4.aki_stage_uo AS AKI_stage_48hr_uo
FROM icustay_detail ic
LEFT JOIN weightfirstday w USING(icustay_id)
LEFT JOIN heightfirstday h USING(icustay_id)
LEFT JOIN kdigo_stages_48hr k4 USING(icustay_id)
)
, t2 as
(
select aki_48hr, AKI_stage_48hr_creat, AKI_stage_48hr_uo
, count(*) as n
from t1
where age > 18
and first_hosp_stay
and los_icu > 1
group by aki_48hr, AKI_stage_48hr_creat, AKI_stage_48hr_uo
)
select aki_48hr, AKI_stage_48hr_creat, AKI_stage_48hr_uo, n
, round(cast(n AS NUMERIC)*100/SUM(n) OVER (), 1) as frac
from t2
order by 1, 2, 3;

I'd be interested in people's thoughts on this - in particular @JackieMium / @steph409 / @chris20881

@alistairewj
Copy link
Member Author

changed the logic to use the actual duration of time we estimated UO over, rather than fixing it to 6/12/24 hours; expect this to increase the rate of AKI, but doesn't seem to change too much:

aki_48hr aki_stage_48hr_creat aki_stage_48hr_uo n frac
0 0 0 11930 34.2
0 0 1647 4.7
0 0 25 0.1
0 25 0.1
1 0 1 3124 9.0
1 0 2 7315 21.0
1 0 3 1228 3.5
1 1 0 1729 5.0
1 1 1 854 2.4
1 1 2 2553 7.3
1 1 3 1436 4.1
1 1 460 1.3
1 2 0 287 0.8
1 2 1 106 0.3
1 2 2 467 1.3
1 2 3 384 1.1
1 2 95 0.3
1 3 0 158 0.5
1 3 1 45 0.1
1 3 2 187 0.5
1 3 3 630 1.8
1 3 185 0.5
1 2 16 0.0
1 3 9 0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Creatinine Stage 3 not exactly as in KDIGO criteria
1 participant