Skip to contents

Usage

Asuming the data is loaded into a dataframe df, the SOFA score can be calculated in two different ways.

Automatic calculation

Use the sofa_magic_wrapper() function when you use a raw data file from the Acutelines database. SOFA related variables are coded as SOFA_[timespan]h_[variable]. Make sure all variables are present. interval can be used to set the time stap interval in correspondance to your dataset, while timespan can be use to set the maximum timespan. By default return_df is FALSE and can be left out, if set to TRUE the function will return all the inidivual elements of the SOFA scora instead of only the totals.

result <- sofa_magic_wrapper(df, interval=24, timespan=72)
Manual calculation

When your dataset has a different naming schema (not having the SOFA_[timespan]h_[variable] format), you can still calculate the SOFA score with this package, however, you have to provide the package with a mapping of each column in your dataset corresponding to the acutal element of the SOFA score.

First define the mapping:

column_mapping <- c(
  PaO2 = "your_PaO2_variable",
  SpO2 = "your_SpO2_variable",
  FiO2 = "your_FiO2_variable",
  oxygen_supply = "your_oxygen_supply_variable",
  oxygen_mode = "your_oxygen_mode_variable",
  platelets = "your_platelets_variable",
  bilirubin = "your_bilirubin_variable",
  MAP = "your_MAP_variable",
  dopamine = "your_dopamine_variable",
  dobutamine = "your_dobutamine_variable",
  epinephrine = "your_epinephrine_variable",
  norepinephrine = "your_norepineprhine_variable",
  norepinephrine_amp = "your_norepinephrine_amp_variable",
  GCS = "your_GCS_variable",
  creatinine = "your_creatinine_variable"
)

Then pass that mapping to the sofa_total function along with your dataframe:

result <- sofa_total(df, column_mapping)

Calculations

The SOFA (Sequential Organ Failure Assessment) [1,2] calculation functions are designed to provide the worst SOFA score for a patient within a specific interval. When retrospectively calculating the SOFA score, one must address missing values and inaccurately recorded values. This function automatically handles such issues. Consequently, the SOFA score functions incorporate several assumptions to ensure feasible calculations. Users should be aware of these assumptions when utilizing these functions.

Respiratory system

Points 0 1 2 3 4
PaO2/FiO2 (mmHg) ≥400 <400 <300 <200 <100
NOT mechanically ventilated with respiratory support

Many respiratory parameters tend to be missing. The sofa_respiration() function calculated the respiratory points of the SOFA score with the following rules and assumptions:

PaO2

  1. Venous PaO2:
    If PaO2 is below 7 kPa, it is assumed to be venous and removed from the dataset. The next available value will be used if possible; otherwise, it will be marked as missing.
  2. Low SpO2:
    If SpO2 is below 50%, the value is removed from the dataset and it is treated as missing 1. Note: Pulse oximeters are only calibrated for SpO2 values between 70-100%. Values below 70% should be considered qualitatively rather than quantitatively accurate and are therefore set to 70%. [3]
  3. Approximation using SpO2:
    When PaO2 is unknown (e.g., arterial blood gas not available), it is imputed from SpO2 using the Brown’s equation [4]. Rounded to one decimal place. Imputation is unreliable for SpO2 >96% due to the hemoglobin-oxygen dissociation curve plateau. Therefore, a PaO2 of 110 mmHg is used as a substitute for SpO2 ≥97% to avoid overestimation. [5]
  4. Missing Values:
    If both PaO2 and SpO2 are unavailable, the value is treated as missing. Consequently, no points will be assigned to this domain.

FiO2

  1. Values Above 100: If FiO2 ≥101, it is capped at 100 as values above this are not physiologically possible. This issue originates from certain devices where the calculation of FiO2 is automated by an algorithm using specific parameters. In some situations, these algorithms may erroneously report values greater than 100, which is technically impossible. To address this, such values are adjusted to a maximum of 100.
  2. FiO2 as zero value:
    If FiO2 = 0, it is treated as missing.2
  3. High FiO2 with no other respiratory data:
    If FiO2 ≥85 and no oxygen delivery device is known and (Oxygen flow is zero or missing), this is likely an SpO2 confusion on data entry. The value is treated as missing.3
  4. Fractional FiO2 Values:
    If FiO2 is below 1, it is assumed to be a fraction and multiplied by 100 to convert it to a percentage.
  5. Low FiO2 Values:
    If FiO2 is between 1 and 21, it is treated as missing.4
  6. Estimation from type of O2 delivery and flow rate:
    • If FiO2 is missing but oxygen supplementation type and flow rate are available, the FiO2 is estimated using the table below.
    • If only oxygen mode is available, the maximum FiO2 for that mode is used.
    • Estimating FiO2 from oxygen flow/delivery rates:
Type of O2 delivery Flowrate (L/min) FiO2 Formula
Nasal cannula 1
2
3
4
5
6
24%
28%
32%
36%
40%
44%
FiO2=20+(4*Q)FiO_{2} = 20+(4*Q)
Non-rebreather mask 10-15 ~60-90% FiO2=60+(Q10)*6FiO_{2} = 60 + (Q – 10) * 6
Venturi Mask 2
4
6
8
10
15
24%
28%
31%
35%
40%
60%
n/a
High-flow nasal cannula (optiflow or cpap) Up to 60 30-100% FiO2=30+(Q1)*7059FiO_{2} = 30 + \frac{(Q - 1) * 70}{59}

Coagulation

Calculates the coagulation SOFA-score part based on platelet count (*103 µL-1) using the sofa_coagulation() function. This section does not correct for unrealistic platelet counts, as this data is generally already curated by the lab.

Points 0 1 2 3 4
Platelet Count (*103 µL-1) ≥ 150 < 150 < 100 < 50 < 20

Cardiovascular system

Calculates the SOFA score component for the cardiovascular system using the sofa_cardiovascular() function. The first two levels (0 and 1 points) are based on Mean Arterial Pressure (MAP), while higher levels are determined by catecholamine administration. For dopamine, dobutamine, epinephrine, and norepinephrine, these dosages need to be provied as µg/kg/min.

Points 0 1 2 3 4
Criteria MAP ≥ 70 mmHg MAP < 70 mmHg Dopamine ≤ 5 µg/kg/min OR Dobutamine (any dose) Dopamine > 5 µg/kg/min OR Epinephrine ≤ 0.1 µg/kg/min OR Norepinephrine ≤ 0.1 µg/kg/min Dopamine > 15 µg/kg/min OR Epinephrine > 0.1 µg/kg/min OR Norepinephrine > 0.1 µg/kg/min

In some cases, norepinephrine is administered as a bolus rather than as a continuous infusion. This is recorded in the norepinephrine_amp variable, which is set to 1 (true) for bolus administration or 0 (false) otherwise. Since the amount of norepinephrine administered differentiates between 3 and 4 points in the cardiovascular SOFA score, the script cannot automatically assign the correct point value. Therefore, when norepinephrine is given, 3.5 points are assigned. Researchers should decide whether to round this value up or down based on their specific research question.

Liver

Calculates the SOFA score component for the liver using the sofa_liver() function. Points are assigned according to the following table. Bilirubin levels should be entered in μmol/L, mg/dL only for reference.

Points 0 1 2 3 4
Bilirubin (mg/dL) <1.2 1.2–1.9 2.0–5.9 6.0–11.9 ≥12.0
Bilirubin (μmol/L) <20 20–32 33–101 102–204 ≥205

Central Nervous System

Calculates the SOFA score component for the central nervous system using the sofa_cns() function. Points are assigned based on the Glascow Coma Scale (GCS).

Points 0 1 2 3 4
Glasgow Coma Scale (GCS) 15 13–14 10–12 6–9 <6

A GCS score < 3 reflects severe neurological dysfunction and is assigned the maximum score, eg in patient with a tube.

Renal

Calculates the SOFA score compontent for the renal function using the sofa_renal() function. Points are assigned based on the creatinine level (µmol/L). This section does not correct for unrealistic creatinine levels, as this data is generally already curated by the lab.

The following table lists the assigned points: [6] Creatine should be provided in µmol/L, mg/dL for reference.

Points 0 1 2 3 4
Creatinine (mg/dL) < 1.2 1.2–1.9 2.0–3.4 3.5–4.9 ≥ 5.0
Creatinine (μmol/L) < 110 110–170 171–299 300–440 ≥ 440
Urine Output (mL/day) > 500 < 500 < 200

The following assumptions are made when calculating the renal SOFA score:

Urine output < 500 mL/day correlates with moderate renal dysfunction, while < 200 mL/day indicates severe dysfunction. Urine output is currently not implemented in the calculation, as this data is often missing or registred inadequately.

References

1.
Lambden S, Laterre PF, Levy MM, Francois B. The SOFA score—development, utility and challenges of accurate assessment in clinical trials. Critical Care. 2019;23(1):374. doi:10.1186/s13054-019-2663-7
2.
Moreno R, Rhodes A, Piquilloud L, et al. The sequential organ failure assessment (SOFA) score: Has the time come for an update? Critical Care. 2023;27(1):15. doi:10.1186/s13054-022-04290-9
3.
Chan ED, Chan MM, Chan MM. Pulse oximetry: Understanding its basic principles facilitates appreciation of its limitations. Respiratory Medicine. 2013;107(6):789-799. doi:https://doi.org/10.1016/j.rmed.2013.02.004
4.
Brown SM, Grissom CK, Moss M, et al. Nonlinear imputation of Pao2/Fio2 from Spo2/Fio2 among patients with acute respiratory distress syndrome. CHEST. 2016;150(2):307-313. doi:10.1016/j.chest.2016.01.003
5.
Severinghaus JW. Simple, accurate equations for human blood O2 dissociation computations. Journal of Applied Physiology. 1979;46(3):599-602. doi:10.1152/jappl.1979.46.3.599
6.
Vincent J-L, Moreno R, Takala J, et al. The SOFA (sepsis-related organ failure assessment) score to describe organ dysfunction/failure. Intensive Care Medicine. 1996;22(7):707-710. doi:10.1007/bf01709751