Calculate SOFA (Sequential Organ Failure Assessment) score for ICU patients. Use for sepsis severity assessment, organ dysfunction quantification, mortality prediction, or Sepsis-3 criteria evaluation.
The Sequential Organ Failure Assessment (SOFA) score quantifies organ dysfunction across 6 systems. Each component scores 0-4, with a total range of 0-24. Higher scores indicate greater organ dysfunction.
| System | 0 | 1 | 2 | 3 | 4 |
|---|---|---|---|---|---|
| Respiration (PaO2/FiO2 mmHg) | >= 400 | < 400 | < 300 | < 200 + respiratory support | < 100 + respiratory support |
| Coagulation (Platelets x10^3/uL) |
| >= 150 |
| < 150 |
| < 100 |
| < 50 |
| < 20 |
| Liver (Bilirubin mg/dL) | < 1.2 | 1.2-1.9 | 2.0-5.9 | 6.0-11.9 | >= 12.0 |
| Cardiovascular | No hypotension | MAP < 70 | Dopa <= 5 or Dob | Dopa > 5 or Epi <= 0.1 or Norepi <= 0.1 | Dopa > 15 or Epi > 0.1 or Norepi > 0.1 |
| CNS (GCS) | 15 | 13-14 | 10-12 | 6-9 | < 6 |
| Renal (Creatinine mg/dL or UO) | < 1.2 | 1.2-1.9 | 2.0-3.4 | 3.5-4.9 or UO < 500 | >= 5.0 or UO < 200 |
Note: Vasopressor doses are in mcg/kg/min. UO is urine output in mL/day.
MIMIC-IV provides a pre-computed SOFA table with hourly values:
SELECT
stay_id,
hr,
starttime,
endtime,
respiration_24hours,
coagulation_24hours,
liver_24hours,
cardiovascular_24hours,
cns_24hours,
renal_24hours,
sofa_24hours
FROM mimiciv_derived.sofa
WHERE hr = 24; -- 24 hours after ICU admission
mimiciv_icu.icustays - ICU stay identifiersmimiciv_derived.bg - Blood gas for PaO2/FiO2 (specimen = 'ART.')mimiciv_derived.chemistry - Creatininemimiciv_derived.enzyme - Bilirubinmimiciv_derived.complete_blood_count - Plateletsmimiciv_derived.gcs - Glasgow Coma Scalemimiciv_derived.urine_output_rate - Daily urine outputmimiciv_derived.ventilation - Ventilation statusmimiciv_derived.norepinephrine, epinephrine, dopamine, dobutamine - VasopressorsTime Window: The score uses the worst value in a 24-hour rolling window. SOFA calculated at hour 24 uses data from hours 0-24.
Respiratory Score: Requires interaction between PaO2/FiO2 ratio AND ventilation status:
FiO2 Sources: FiO2 can come from blood gas measurement OR charted FiO2. When not documented, estimate from supplemental O2 device.
Vasopressor Units: All vasopressor doses must be in mcg/kg/min. Weight is often estimated (check mimiciv_derived.weight_durations).
GCS in Sedated Patients: For sedated/intubated patients, use pre-sedation GCS or assume normal (GCS=15). The verbal component may be 0 for intubated patients - this is handled specially.
Arterial Blood Gas: Use only arterial specimens (specimen = 'ART.') for PaO2/FiO2.
Missing Components: Missing data is imputed as 0 (normal) in the final score. Document which components are missing; do not claim complete scores when data is absent. If you prefer to treat missing data as NA rather than 0, you will need to modify the SQL (remove the COALESCE(..., 0) wrapper). Statistically, it is more appropriate to treat missing values as missing and calculate SOFA scores after proper imputation.
Urine Output Calculation: Uses uo_tm_24hr to verify 24 hours of data available before calculating rate.
SELECT
ie.stay_id,
ie.subject_id,
ie.hadm_id,
s.sofa_24hours,
s.respiration_24hours,
s.coagulation_24hours,
s.liver_24hours,
s.cardiovascular_24hours,
s.cns_24hours,
s.renal_24hours
FROM mimiciv_icu.icustays ie
LEFT JOIN mimiciv_derived.sofa s
ON ie.stay_id = s.stay_id
AND s.hr = 24
ORDER BY s.sofa_24hours DESC NULLS LAST;
WITH sofa_change AS (
SELECT
stay_id,
sofa_24hours AS sofa_day1,
LEAD(sofa_24hours, 24) OVER (
PARTITION BY stay_id ORDER BY hr
) AS sofa_day2
FROM mimiciv_derived.sofa
WHERE hr = 24 OR hr = 48
)
SELECT
stay_id,
sofa_day1,
sofa_day2,
sofa_day2 - sofa_day1 AS delta_sofa
FROM sofa_change
WHERE sofa_day2 IS NOT NULL;