The SOFA (Sequential Organ Failure Assessment) score is a commonly used assessment tool for tracking a patient's status during a stay at an ICU. Organ function is quantified by aggregating 6 individual scores, representing respiratory, cardiovascular, hepatic, coagulation, renal and neurological systems. The function sofa_score() is used as callback function to the sofa concept but is exported as there are a few arguments that can used to modify some aspects of the presented SOFA implementation. Internally, sofa_score() calls first sofa_window(), followed by sofa_compute() and arguments passed as ... will be forwarded to the respective internally called function.

  worst_val_fun = max_or_na,
  explicit_wins = FALSE,
  win_length = hours(24L),
  keep_components = FALSE,
  interval = NULL

sofa_resp(..., interval = NULL)

sofa_coag(..., interval = NULL)

sofa_liver(..., interval = NULL)

sofa_cardio(..., interval = NULL)

sofa_cns(..., interval = NULL)

sofa_renal(..., interval = NULL)



Concept data, either passed as list or individual argument


functions used to calculate worst values over windows


The default FALSE iterates over all time steps, TRUE uses only the last time step per patient and a vector of times will iterate over these explicit time points


Time-frame to look back and apply the worst_val_fun


Logical flag indicating whether to return the individual components alongside the aggregated score (with a suffix _comp added to their names)


Time series interval (only used for checking consistency of input data, NULL will use the interval of the first data object)


A ts_tbl object.


The function sofa_score() calculates, for each component, the worst value over a moving window as specified by win_length, using the function passed as worst_val_fun. The default functions max_or_na() return NA instead of -Inf/Inf in the case where no measurement is available over an entire window. When calculating the overall score by summing up components per time-step, a NA value is treated as 0.

Building on separate concepts, measurements for each component are converted to a component score using the definition by Vincent et. al.:

SOFA score1234
PaO2/FiO2 [mmHg]< 400< 300< 200< 100
and mechanical ventilationyesyes
Platelets [x103/mm3]< 150< 100< 50< 20
Bilirubin [mg/dl]1.2-1.92.0-5.96.0-11.9> 12.0
MAP< 70 mmHg
or dopamine<= 5> 5> 15
or dobutamineany dose
or epinephrine<= 0.1> 0.1
or norepinephrine<= 0.1> 0.1
Central nervous system
Glasgow Coma Score13-1410-126-9< 6
Creatinine [mg/dl]1.2-1.92.0-3.43.5-4.9> 5.0
or urine output [ml/day]< 500< 200

aAdrenergic agents administered for at least 1h (doses given are in [ug/kg . min]

At default, for each patient, a score is calculated for every time step, from the first available measurement to the last. In instead of a regularly evaluated score, only certain time points are of interest, this can be specified using the explicit_wins argument: passing for example hours(24, 48) will yield for every patient a score at hours 24 and 48 relative to the origin of the current ID system (for example ICU stay).


Vincent, J.-L., Moreno, R., Takala, J. et al. The SOFA (Sepsis-related Organ Failure Assessment) score to describe organ dysfunction/failure. Intensive Care Med 22, 707–710 (1996).