REPRODUCIBILITY PACKAGE
Comparative predictive performance of the CORN and culturally adapted Munro
scales for intraoperatively acquired pressure injury: a retrospective cohort
study

================================================================================
CONTENTS
================================================================================

analysis_dataset.csv      Additional file 1. De-identified analysis dataset;
                          296 records, 36 variables, one row per patient.

analysis.R                Additional file 2. Complete analysis script.
R_output.txt              Log produced by running analysis.R.

baseline_dataset.csv      Additional file 3. De-identified participant and
                          operative characteristics; 296 records, 12 variables.
                          Table 1 is reproduced from this file by analysis.R.

make_figures_roc.py       Additional file 4. Regenerate Figs. 2 and 3.
make_figure_flowchart.py  Additional file 4. Regenerate Fig. 1.
requirements.txt          Python dependencies for the two figure scripts.
README.txt                This file.

================================================================================
HOW TO RUN
================================================================================

All scripts resolve their own paths relative to the folder that contains them,
so no editing is required. Run them from inside this folder.

  Statistical analysis (R 4.5.1; base R only, no add-on packages):

      cd <this folder>
      Rscript analysis.R

  This reproduces every number in Table 1, Tables 3-8 and the abstract, and
  writes the same output as R_output.txt. Table 1 needs baseline_dataset.csv
  in the same folder; everything else needs only analysis_dataset.csv.

  Figures (Python 3.9 or later):

      python -m pip install -r requirements.txt
      python make_figures_roc.py
      python make_figure_flowchart.py

  These write fig1_flow.png, fig2_preop_roc.png and fig3_intraop_roc.png into
  this folder.

================================================================================
WHAT IS AND IS NOT DERIVED FROM THE DATASET
================================================================================

Derived from baseline_dataset.csv at run time:

  - Table 1 (characteristics by outcome; Welch t test for age, Fisher's exact
    test - Freeman-Halton for r x c - for every categorical variable)

Derived from analysis_dataset.csv at run time:

  - IAPI incidence and its Wilson confidence interval
  - Table 3 (scores by outcome, Welch t tests)
  - Table 4 (risk grades by outcome, rank-sum tests)
  - Table 5 (AUCs, DeLong confidence intervals, paired DeLong comparisons)
  - Table 6 (Youden-optimal cut-offs, sensitivity, specificity, PPV, NPV,
    with exact Clopper-Pearson confidence intervals)
  - Table 7 (observed incidence within each scale's predefined risk grades)
  - Table 8 (item-level AUCs)
  - the sensitivity analyses
  - Cronbach's alpha for both scales
  - the outcome split and all four 2 x 2 tables in Fig. 1, and the cut-offs
    labelled on them
  - the AUCs and confidence intervals printed in the legends of Figs. 2 and 3

NOT derived from the dataset, and declared as constants at the top of
make_figure_flowchart.py:

  - the screening cascade in Fig. 1: 5366 procedures performed, 3034 records
    excluded (with the five exclusion reasons) and 2332 eligible records.
    These come from the hospital's operating-theatre register for the study
    period and are not recoverable from a de-identified patient-level file.

Also not included:

  - the raw ratings from the 13-patient reliability pretest, which is the
    source of the reported Kendall's W values. That pretest was conducted
    separately from this analysis and contributed no records to it.
  - the nurse characteristics in Table 2, which were extracted from the source
    records.

================================================================================
NOTES ON THE DATASET
================================================================================

Column names are in English and follow the pattern
<scale>_<stage>_<item>, e.g. corn_pre_asa, munro_int_temp.

  iapi                    1 = intraoperatively acquired pressure injury
                          occurred, 0 = did not occur
  corn_pre_total          CORN preoperative total (6 items)
  corn_int_total          CORN intraoperative total (4 items)
  munro_pre_total         Munro preoperative total (6 items)
  munro_int_subtotal      Munro intraoperative items only (7 items)
  munro_int_cumulative    Munro preoperative + intraoperative (used for the
                          intraoperative comparison, as the scale specifies)
  munro_post_ortime,
  munro_post_blood        Munro postoperative items

Scale items that were not documented in the record were scored at their lowest
value; this affected the Munro items for intraoperative temperature,
blood-pressure fluctuation and recent weight loss most often. The dataset
therefore contains the imputed values, not missing-value codes. The
implications are discussed in the Limitations section of the manuscript.

The CORN scale defines separate preoperative and intraoperative totals with
their own risk grades and defines no combined total. Any summed
preoperative-plus-intraoperative CORN score in the sensitivity analyses is an
index constructed for this study.

Cut-offs reported in Table 6 and shown in Fig. 1 are in-sample Youden-optimal
thresholds. They were not pre-specified and were not externally validated, so
the corresponding accuracy estimates are optimistic.

================================================================================
KNOWN DATA NOTE
================================================================================

Three hundred records were drawn from the eligible pool. On review, four of them
(ids 27, 96, 98, 100) were of patients aged 6, 7, 7 and 7 years and therefore
did not meet the age >= 18 eligibility criterion; none had developed IAPI. They
were excluded, and the datasets distributed here contain the 296 analysed
records. The excluded ids are absent from both CSV files, so the id column has
four gaps; ids were not renumbered, so that records can be traced.

For transparency: with those four records included (n = 300) the preoperative
AUC difference was 0.193 and the intraoperative difference 0.109; at n = 296
they are 0.195 and 0.110. No conclusion changes either way.
