SUPPLEMENTARY FILE 2
DATA DICTIONARY FOR THE NAKURU MALARIA MORTALITY ANALYTICAL DATASET

Dataset filename
----------------
nakuru_malaria_dataset_2020_2026.csv

Unit of analysis
----------------
One eligible malaria admission per patient. Where more than one eligible admission existed, only the first eligible admission was retained in the analytical dataset.

Outcome coding
--------------
Outcome is converted to a binary model outcome y:
- Survived = 0
- Died = 1

Predictor set
-------------
The study contains the same five prespecified clinical predictors in all main model specifications:
1. Age
2. Sex
3. Parasite density
4. Haemoglobin level
5. Platelet count

The corrected restricted cubic spline model still contains five clinical predictors. It uses eight predictor parameters because age, haemoglobin level, and platelet count each contribute one linear and one nonlinear spline basis term, while sex and parasite density each contribute one parameter.

VARIABLE DEFINITIONS
====================

1. Patient_ID
   Description: De-identified unique patient record identifier.
   Type: Identifier.
   Units/coding: Character or integer identifier.
   Analysis role: Not used as a predictor.
   Data-quality role: Used to verify one analytical record per patient.

2. Year
   Description: Calendar year of admission.
   Type: Integer.
   Range represented in dataset: 2020-2026.
   Analysis role: Descriptive only; not included in the five-predictor mortality model.

3. Age
   Description: Age at hospital admission.
   Type: Continuous.
   Unit: Completed years.
   Original linear model: Entered as one linear term.
   Corrected model: Represented using a three-knot restricted cubic spline.
   Full-dataset spline knots: 9, 44, and 78 years (10th, 50th, and 90th percentiles).
   Box-Tidwell detail: Age*ln(Age+1) is used for the diagnostic interaction because age=0 occurs in the dataset and ln(0) is undefined.

4. Gender
   Description: Recorded biological sex category in the hospital record.
   Type: Binary categorical.
   Dataset values: Female, Male.
   Model coding: Female = 0; Male = 1.
   Analysis role: Binary predictor in all model specifications.

5. Parasite_Density_per_uL
   Description: Parasite density measured in peripheral blood.
   Type: Continuous.
   Unit: Parasites per microlitre (parasites/µL).
   Analysis transformation: Divided by 1,000 before model fitting/reporting.
   Derived model variable: parasite_1000 = Parasite_Density_per_uL / 1000.
   Interpretation: A one-unit increase in parasite_1000 equals an increase of 1,000 parasites/µL.
   Original linear model: Entered as a linear term.
   Corrected full-sample model: Retained as a linear term because the Box-Tidwell test did not detect nonlinearity.

6. Haemoglobin_g_dL
   Description: Blood haemoglobin concentration at admission.
   Type: Continuous.
   Unit: g/dL.
   Original linear model: Entered as one linear term.
   Corrected model: Represented using a three-knot restricted cubic spline.
   Full-dataset spline knots: 6.0, 10.2, and 14.4 g/dL (10th, 50th, and 90th percentiles).

7. Platelet_Count_10^9_L
   Description: Circulating platelet count at admission.
   Type: Continuous.
   Unit: ×10^9/L.
   Original linear model: Entered as one linear term.
   Corrected model: Represented using a three-knot restricted cubic spline.
   Full-dataset spline knots: 68, 198.5, and 316.1 ×10^9/L (10th, 50th, and 90th percentiles).

8. Outcome
   Description: In-hospital discharge outcome for the malaria admission.
   Type: Binary categorical.
   Dataset values: Survived, Died.
   Derived model coding: Survived = 0; Died = 1.
   Analysis role: Dependent variable for logistic regression.

DERIVED ANALYSIS VARIABLES
==========================

y
  Definition: Binary mortality indicator derived from Outcome.
  Coding: 0 = survived; 1 = died.

male
  Definition: Binary indicator derived from Gender.
  Coding: 0 = female; 1 = male.

parasite_1000
  Definition: Parasite_Density_per_uL / 1000.
  Unit: Thousands of parasites per µL.

Restricted cubic spline basis variables
  Age_linear, Age_nonlinear
  Hb_linear, Hb_nonlinear
  Platelet_linear, Platelet_nonlinear
  Definition: Basis terms constructed from the original continuous predictors using the restricted cubic spline equation specified in the manuscript and analysis code.
  Note: These basis terms are mathematical representations of the same clinical predictors and are not additional clinical predictors.

MISSING DATA AND EXCLUSIONS
===========================
The analytical dataset supplied to the analysis script is the complete-case dataset used for modelling. The script verifies that required analytical fields are non-missing and that Patient_ID is unique. Records excluded before formation of the analytical dataset are not reconstructed by the supplementary script.

MODEL-SPECIFICATION AND VALIDATION NOTES
========================================
- Original prespecified model: five-predictor linear logistic regression model.
- Corrected full-sample model: same five predictors, with three-knot restricted cubic splines for age, haemoglobin level, and platelet count; sex binary; parasite density linear.
- Full-sample knots are the 10th, 50th, and 90th percentiles of each spline-modelled predictor.
- During repeated cross-validation, Box-Tidwell functional-form assessment is repeated within each training fold. Any continuous predictor showing p<0.05 is spline-modelled in that training fold, with knots recalculated using that training fold only. This prevents held-out observations from influencing functional-form selection or knot placement.
- Youden threshold selection is also repeated in training data only before evaluation on held-out observations.
- A ridge-penalized version of the corrected RCS model is evaluated as a sensitivity analysis for overfitting.

SOFTWARE
========
The analysis script prints and saves the exact versions of Python, NumPy, pandas, SciPy, statsmodels, scikit-learn, and Matplotlib used when it is run.
