MIT-LCP / mimic-code

MIMIC Code Repository: Code shared by the research community for the MIMIC family of databases
https://mimic.mit.edu
MIT License
2.41k stars 1.5k forks source link

Question about GCS in mimiciv_derived.apsiii #1594

Closed heisenbug-1 closed 11 months ago

heisenbug-1 commented 11 months ago

The GCS should have a max score of 15, however the gcs column in the mimiciv_derived.apsiii table has larger scores. How is this possible? Does it mean something went wrong with my my build? I'm using pgAdmin to query data: SELECT * FROM mimiciv_derived.apsiii

tompollard commented 11 months ago

The problem is that you are (understandably!) misinterpreting the gcs_score column. It is not displaying a list of GCS scores. It is displaying the gcs_score component of the Acute Physiology Score. If you look at the underpinning query you'll see that the table is intentionally assigning these scores.

        , CASE
            WHEN gcs_unable = 1
                -- here they are intubated, so their verbal score
                -- is inappropriate
                -- normally you are supposed to use "clinical judgement"
                -- we don't have that, so we just assume normal
                -- (as was done in the original study)
                THEN 0
            WHEN gcs_eyes = 1
                THEN CASE
                    WHEN gcs_verbal = 1 AND gcs_motor IN (1, 2)
                        THEN 48
                    WHEN gcs_verbal = 1 AND gcs_motor IN (3, 4)
                        THEN 33
                    WHEN gcs_verbal = 1 AND gcs_motor IN (5, 6)
                        THEN 16
                    WHEN gcs_verbal IN (2, 3) AND gcs_motor IN (1, 2)
                        THEN 29
                    WHEN gcs_verbal IN (2, 3) AND gcs_motor IN (3, 4)
                        THEN 24
                    WHEN gcs_verbal IN (2, 3) AND gcs_motor >= 5
                        -- highly unlikely clinical combination
                        THEN null
                    WHEN gcs_verbal >= 4
                        THEN null
                END
            WHEN gcs_eyes > 1
                THEN CASE
                    WHEN gcs_verbal = 1 AND gcs_motor IN (1, 2)
                        THEN 29
                    WHEN gcs_verbal = 1 AND gcs_motor IN (3, 4)
                        THEN 24
                    WHEN gcs_verbal = 1 AND gcs_motor IN (5, 6)
                        THEN 15
                    WHEN gcs_verbal IN (2, 3) AND gcs_motor IN (1, 2)
                        THEN 29
                    WHEN gcs_verbal IN (2, 3) AND gcs_motor IN (3, 4)
                        THEN 24
                    WHEN gcs_verbal IN (2, 3) AND gcs_motor = 5
                        THEN 13
                    WHEN gcs_verbal IN (2, 3) AND gcs_motor = 6
                        THEN 10
                    WHEN gcs_verbal = 4 AND gcs_motor IN (1, 2, 3, 4)
                        THEN 13
                    WHEN gcs_verbal = 4 AND gcs_motor = 5
                        THEN 8
                    WHEN gcs_verbal = 4 AND gcs_motor = 6
                        THEN 3
                    WHEN gcs_verbal = 5 AND gcs_motor IN (1, 2, 3, 4, 5)
                        THEN 3
                    WHEN gcs_verbal = 5 AND gcs_motor = 6
                        THEN 0
                END
            ELSE null
        END AS gcs_score

The query below counts the number of scores within each decile:

SELECT
  FLOOR(gcs_score / 10) * 10 AS decile,
  COUNT(*) AS count_per_decile
FROM 
  `physionet-data.mimiciii_derived.apsiii`
GROUP BY 
  decile
ORDER BY 
  decile;
gcs_score decile count
null 10167
0 - 10 44845
10 - 20 3767  
20 - 30 948  
30 - 40 439  
40 - 50 1366
heisenbug-1 commented 11 months ago

Thanks, Tom. Is there a reason for assigning these scores? I am majoring in Computer Science and using the MIMIC Data for my thesis. I lack medical training and rely on this repo for computing the SOFA/APSIII/SAPSII scores

tompollard commented 11 months ago

@heisenbug-1 please take a look at the code at: https://github.com/MIT-LCP/mimic-code/blob/main/mimic-iv/concepts/score/apsiii.sql ? APSIII aggregates a number of different health components, one of which is GCS:

, score AS (
    SELECT s.*
        -- coalesce statements impute normal score of zero
        -- if data element is missing
        , COALESCE(hr_score, 0)
        + COALESCE(mbp_score, 0)
        + COALESCE(temp_score, 0)
        + COALESCE(resp_rate_score, 0)
        + COALESCE(pao2_aado2_score, 0)
        + COALESCE(hematocrit_score, 0)
        + COALESCE(wbc_score, 0)
        + COALESCE(creatinine_score, 0)
        + COALESCE(uo_score, 0)
        + COALESCE(bun_score, 0)
        + COALESCE(sodium_score, 0)
        + COALESCE(albumin_score, 0)
        + COALESCE(bilirubin_score, 0)
        + COALESCE(glucose_score, 0)
        + COALESCE(acidbase_score, 0)
        + COALESCE(gcs_score, 0)
        AS apsiii
    FROM scorecomp s
)

If you're working on a computational health thesis and you don't yet have a clinical collaborator, I would strongly suggest trying to find one!

heisenbug-1 commented 11 months ago

Thank's for the speedy feedback :)