Input Format

This page describes the required input formats for running the LoS Estimator.

Configuration Files

Configuration is managed via TOML files. The default configuration at los_estimator/default_config.toml provides all necessary settings.

Key Configuration Sections

data_config
  • icu_file: Path to ICU occupancy data CSV.

  • los_file: Path to hospital LOS data CSV.

  • start_day and end_day: Time range for analysis.

model_config
  • kernel_width: Width of distribution kernel in days (default: 120).

  • train_width: Width of training window in days (default: 102).

  • test_width: Width of test window in days (default: 21).

  • step: Step size for sliding windows (default: 7).

  • distributions: List of distributions to fit (e.g., ["lognorm", "gaussian", "linear"]).

  • error_fun: Error function for optimization ("mse", "mae", etc.).

debug_config
  • one_window: Fit only the first window (bool).

  • less_windows: Reduce windows to ~3 for quick testing (bool).

  • less_distros: Test only linear and compartmental (bool).

  • only_linear: Fit only linear models (bool).

visualization_config
  • show_figures: Display plots interactively (bool).

  • save_figures: Save plots to disk (bool).

  • figsize: Figure dimensions as [width, height].

animation_config
  • show_figures: Display animations interactively (bool).

  • save_figures: Save animations as GIFs (bool).

Data Files

ICU Data (Required)

The primary input is a CSV file containing ICU admission and occupancy time series with the following columns:

  • date - Date in YYYY-MM-DD format

  • admissions - Number of new ICU admissions on that date (integer)

  • occupancy - Total ICU beds occupied on that date (integer)

Example:

date,admissions,occupancy
2020-01-01,5,20
2020-01-02,3,22
2020-01-03,7,25
...

File Path: Specify the path to this file in your configuration as data_config.icu_file.

Initial Parameters (Optional)

You can provide initial parameter values for optimization to improve convergence. The file should be CSV formatted:

  • distro - Distribution name (e.g., “lognorm”, “gamma”, “gaussian”)

  • params - Space-separated parameter values in brackets, e.g., [2.5 1.0 1.2]

Example:

distro,params
lognorm,[2.5 0.8 1.0]
gamma,[3.0 0.5 1.0]

File Path: Specify as data_config.init_params_file in your configuration.

Sample LoS Distribution (Optional)

For validation purposes, you can provide a known LoS distribution (typically for synthetic data). The file should be CSV formatted:

  • day - Length of stay in days (integer, 0 to max_los)

  • probability - Discharge probability for that day (float, 0-1)

Example:

day,probability
0,0.05
1,0.10
2,0.15
...

File Path: Specify as data_config.los_file in your configuration.

Note: The package includes a sample distribution file for the synthetic example.