Prototype development
This study characterized urinary catheter output using a compact, affordable mini-spectrometer (Hamamatsu Photonics, CM12880MA), capable of rapid, non-obstructive measurements within the detection range of 340–850nm. The spectrometer captured light intensity values from 0 to 65,000 (unitless) across 288 discrete detection channels, surpassing the human eye’s perception range of 360–830nm as defined by the International Commission on Illumination9.
To facilitate future integration into a bedside urinary catheter system, a compact, energy-efficient, robust, and affordable light source capable of illuminating the entire detection range of the spectrometer was required. As no commercially available source met these specifications, a custom hyperspectral light source was developed. This source (illustrated in Supplementary Figure S1) combined three LEDs emitting in ultraviolet (UV), near-infrared (NIR), and full-spectrum (FS) ranges. The LEDs were mounted on a carrier PCB, and their light output was collected via a laser-cut light guide and directed to the sample chamber. When activated, all three LEDs operated simultaneously, producing hyperspectral illumination.
To assess the influence of different light paths on sample interaction, three configurations were evaluated: direct transmission (DT), angular transmission (AT), and angular reflection (AR). Optical simulations were performed using Ansys Zemax OpticStudio 2023 R2.02 (Supplementary Figure S2) to optimize the setup, including light source positioning, light guide geometry, and lens array configurations. Simulations prioritized minimizing light interaction with the glass walls of the sample chamber while maximizing light interaction with the fluid. The optimal setup, shown in Fig.1, integrated the mini-spectrometer with a custom-designed lens array and three hyperspectral light sources, forming three distinct light paths: DT, AT and AR.
Schematic of the mini spectrometer and its key components. Light from the hyperspectral light sources is directed via the light guides to the sample chamber where it interacts with the sample. The resulting light output is captured by a lens array and focused on the spectrometer head. This setup utilizes three light sources placed at different angles to form three distinct light paths: direct transmission (DT), angular transmission (AT), and angular reflection (AR). This figure was rendered using Autodesk Fusion 360.
All materials in the optical path (light guide: Röhm, Plexiglas GS; sample chamber: Hilgenberg, borosilicate glass; lens array: Edmund Optics, UV quartz glass lenses) were selected based on their transmissivity within the spectrometer’s detection range.
Initially, the optical components were positioned using an evaluation platform constructed via Fused Deposition Modeling (FDM) 3D printing (Ultimaker S5) using polylactide (PLA). However, the lack of rigidity and low resolution of FDM printing led to unreliable positioning of the optical elements. To address this, an enhanced platform was developed using high-resolution Stereolithography (SLA) 3D printing (Formlabs Form 3B+) and rigid resin materials (Formlabs Tough Resin 1500). This improved platform ensured stable and precise positioning of the optical elements and incorporated mechanical isolation for critical components.
For data acquisition, six spectra were recorded for each fluid sample, corresponding to illumination from three distinct light paths (DT, AT and AR) and two exposure times (low and high). This approach was designed to optimize the signal-to-noise ratio while preventing oversaturation. To eliminate interference between light paths, spectra were collected separately, with only one hyperspectral light source activated at a time.
The spectral data were saved as comma-separated values (.csv) files, resulting in a cuboidal dataset comprising 3 light paths × 2 exposure times × 288 wavelength channels, producing 1,728 light intensity values influenced by the fluid’s biochemical properties. These data were collected for subsequent statistical analysis.
Study population andethics committee
A total of 401 samples from 168 patients of the University Hospital Essen were collected for this study. Informed consent was obtained from adult patients as well as written consent from legal guardians as well as assent from minors. The study received ethical approval under reference number 21-10402-BO.
All methods were conducted in accordance with relevant guidelines and regulations, including the principles outlined in the Declaration of Helsinki.
Detailed information regarding the number of participants, age and gender distribution can be found online in Supplementary Figure S3.
Urine parameters and sample collection
Table1, under the column “Urine Marker” presents the urine parameters measured in this study along with the methodologies employed for their assessment. Parameters labeled quantitative were measured by the central laboratory of the University Hospital Essen using specific detection methods resulting in data points on the metric scale. Parameters labeled qualitative were measured using urine test strips, providing ordinally scaled data points.
Samples were either collected from catheter bags or passed directly into sample collection tubes by the patients. An overnight waiting period of at least 12h was observed between sample collections for patients providing multiple samples. The number of samples collected per patient ranged from one to eleven, with a mean of 3.04 samples per patient and a standard deviation of 2.34. The variation in the number of samples was influenced by the duration of each patient’s stay on the ward.
Following collection, urine samples were immediately split into two fractions (“A” & ”B”), frozen at -80°C, and stored until further processing.
Measurements
Urine samples were measured in batches of 20 to 40 samples (“A”) after thawing at room temperature, utilizing the described prototype. For each measured sample, a corresponding frozen sample (“B”) was sent to the central laboratory at Essen University Hospital to obtain clinically validated values for the parameters as presented in Table1.
Following each measurement, the urine sample was discarded, and the prototype tubing and measurement chamber were thoroughly flushed with sterile water to prevent cross-contamination between samples. After completing the batch measurements, the prototype underwent a flush with isopropyl alcohol followed by water to ensure the prevention of sample cross-contamination and bacterial growth.
Sample overview
After sample analysis at the central laboratory, an overview of the ratio of pathological vs. healthy samples for each urine parameter was created (Table1).
Table1 provides an overview of the measured urine parameters, detailing the methodology of data acquisition, the total number of obtained and measured samples, the respective cut-off values for healthy samples, and the distribution of pathological and healthy samples. The column labeled “Percentage H” presents the proportion of healthy samples within the entire sample set, where healthy samples constitute the predominant class across all parameters. A visual representation of this ratio is depicted in the “Ratio H vs. P” column, where green bars signify healthy samples and red bars indicate pathological samples.
The Cut-off value column specifies the cut-off values between healthy and pathological samples. For most samples, the range provided by the central laboratory of the University Hospital Essen was adopted. However, for urine parameters pH and specific gravity, no range was specified by the central laboratory. Accordingly, the range was determined by literature research with a range of urine pH of [5, 7.5]10 and a range of urine specific gravity of [1.002, 1.04]11.
Urine parameters were organized based on the proportion of healthy samples, revealing that parameters such as protein and leukocytes exhibited approximately equal proportions of healthy and pathological samples, with fewer pathological samples observed for all other parameters.
Given the low number of pathological samples observed for the pH parameter and its potential for straightforward statistical analysis, it was not categorized into a distinct healthy and pathological class. Instead, it was bifurcated into two parameters (pH acidic and pH basic) and analyzed according to the acidity/alkalinity of the sample, with samples exhibiting a pH of 7 being considered neutral in both parameters.
Statistical analysis and programming
Spectra normalization
The correct calibration of the spectrometer is crucial for the acquisition of clean data. Nevertheless, artifacts caused by external events, such as noise contribution, and the physical properties of the sample (e.g., turbidity), can significantly affect the measured light intensities between different spectra11. When comparing different spectra, pronounced scattering in the intensity values becomes evident, creating a bias in the input data that can negatively impact the outcome of statistical analysis methods12. In the present work, correction for such phenomena was achieved by scaling the spectra using the Standard Normal Variate (SNV) method. The SNV method transforms a spectrum \(s\to\)into a new spectrum \(\stackrel{\sim}{s}\to\) by mapping each datapoint \({s}_{i}\in s\to\) to a new datapoint \(\stackrel{\sim}{{s}_{i}}\in\stackrel{\sim}{s}\to\)using the following equation:
$$\stackrel{\sim}{{s}_{i}}=\frac{{s}_{i}-\mu(s\to)}{\sigma(s\to)}$$
where \(\mu(s\to)\) and \(\sigma(s\to)\)are, respectively, mean and standard deviation of the original spectrum \(s\to\). As a consequence, the transformed spectrum \(\stackrel{\sim}{s}\to\) has zero mean and unit variance.
SNV correction on the spectral data measured in attenuated reflection with 320 ms exposure time (AR_320). (a) Original spectra. (b) Spectra after the SNV correction. (c) Semi-logarithmic plot of the standard deviation of the intensities before (blue line) and after (red line) the SNV correction.
The effect of the SNV method is shown in Fig.2. In this example, all spectra measured in attenuated reflection with an exposure time of 320 ms (AR_320) are plotted together before (Fig.2a) and after (Fig.2b) the SNV correction. The impact of this scaling method on the variance of the data is depicted in Fig.2c. For each wavelength, the standard deviation of the intensities of the spectra before (blue line) and after (red line) the SNV correction is shown in a semi-logarithmic plot. With average values of 1097.62 (before SNV) and 0.24 (after SNV), the standard deviation of the intensities at each wavelength decreased drastically by nearly 4 orders of magnitude. Similar results were obtained for all other spectrometer settings, defined by combination of light pathway and exposure time.
Correlation analysis
Next, a correlation analysis guided by literature about the known optical characteristics of the respective marker was performed to identify the wavelengths in the spectra that show the highest correlations with the measured laboratory parameters, narrowing down the range of wavelengths to the most relevant for further statistical modeling.
Correlation curve (a) and corresponding \(p\)-values (b) for the laboratory parameter specific gravity and spectrometer in direct transmission with 20 ms exposure time (DT_20).
The measured spectra for a specific spectrometer setting were arranged in an \(nx288\) matrix \(S\) where \(n\) represents the number of samples. Each column vector \({s}_{i}\to\) of the matrix contained all the scaled intensities measured at the \(i\)-th wavelength. Similarly, for a specific laboratory parameter, a vector \(l\to=({l}_{1},{l}_{2,\dots,}{l}_{n})\) was defined containing the measured laboratory value of each sample. A correlation coefficient and corresponding \(p\)-value, indicating whether the correlation coefficient is significantly different from zero, were computed between each column vector \({s}_{i}\to\) and the laboratory vector \(l\to\). This process was repeated for each spectrometer setting and laboratory parameter. If the laboratory parameter was measured quantitatively, the Pearson’s correlation coefficient was computed; otherwise, Kendall’s ττ correlation coefficient was chosen for the correlation analysis. The calculated coefficients were wavelength-specific and were arranged into correlation curves. An example of such curves for the laboratory parameter “specific gravity” and spectrometer setting DT_20 is shown in Fig.3a. The corresponding \(p\)-values in Fig.3b provide a measure of the statistical significance of the computed correlations.
Statistical modeling methodology for spectral data analysis and urine parameter classification
All analyses were performed using R version 4.4.113 and RStudio14, utilizing the following R packages: glmtoolbox15, lme416, MuMIn17, caret18, ConfusionTableR19 and ROCR20.
To ensure the reliability and quality of the dataset, specific data points were excluded from the analysis. Measurements taken at higher exposure times, which resulted in light intensities exceeding the spectrometer’s maximum capacity and causing detector oversaturation, were removed from the dataset across all three illumination angles. No additional data omissions were made intentionally.
The response variables were dichotomized based on the urine markers and their respective cut-off values outlined in Table1. For qualitatively measured outcomes, generalized linear models (glm) with logit link function (logistic regression models) were estimated. Spectral data at various wavelengths were used as regressor variables. To account for patient-specific variability in the dataset, a logistic regression model (denoted as LRRE) incorporating a random intercept for each patient was estimated. This approach assumes that the relationship between predictors and outcomes is consistent across all patients, while the random intercept accounts for between-patient variability21. For comparison, a logistic regression model without random intercepts (LR) was also computed.
The classification performance of the models was evaluated using two key metrics: the Area Under the Curve (AUC) of the Receiver Operating Characteristic (ROC) curve and Balanced Accuracy (BAC). BAC is defined as the mean of sensitivity and specificity. To identify the most relevant regressors for model performance, a best subset selection procedure was performed by minimizing the Akaike Information Criterion (AIC).
The best subset selection and model estimation were carried out using the entire dataset (n = 401) to derive a global model. The AUC calculated for the global model represents its inner-sample performance, as the same dataset was used for both subset selection and model estimation. However, since inner-sample performance tends to be overly optimistic, an out-of-sample performance estimate was required to account for potential overfitting.
To estimate out-of-sample performance, a correction term was derived using a 5-fold cross-validation (CV) procedure. The dataset was divided into five subsamples of approximately equal size (80 or 81 observations each). In each fold, four subsamples were combined to form the training dataset (n = 320/321), while the remaining subsample (n = 80/81) was used as the test dataset. This process was repeated five times, ensuring that each subsample served as the test dataset once.
For each training dataset, best subset selection and model estimation were conducted, and the inner-sample performance of the resulting model was evaluated. The out-of-sample performance was then assessed by applying the model to the corresponding test dataset. The differences between inner- and out-of-sample performance were calculated for each of the five folds. The mean of these differences was used as the correction term. By subtracting this correction term from the inner-sample performance of the global model, an estimator for the global model’s out-of-sample performance was obtained.