Example participant days

One reproducibly selected participant-day from each site illustrates the near-eye light recording, diary-defined sleep, and reported non-wear periods. Days must satisfy the coverage rules and contain one identifiable sleep-preparation transition and one waking transition. A fixed seed controls the selection. Site labels are joined from config/site_metadata.csv.

coverage <- readRDS(file.path(paths$coverage, "light_glasses_coverage.rds"))
context <- readRDS(file.path(paths$model_data, "context", "site_solar_context.rds"))
site_metadata <- utils::read.csv("config/site_metadata.csv", stringsAsFactors = FALSE,
  check.names = FALSE, fileEncoding = "UTF-8")
coverage <- dplyr::left_join(coverage,
  dplyr::select(site_metadata, site, location),
  by = "site", relationship = "many-to-one")
examples <- derive_prepared_day_showcase(coverage, context, site_metadata,
  seed = prepared_day_showcase_seed())
examples$selected_summary
# A tibble: 9 × 15
  site    location       participant local_date wake_time sleep_preparation_time
  <chr>   <chr>          <chr>       <date>     <chr>     <chr>                 
1 BAUA    Dortmund, Ger… BAUA_S024   2025-10-15 07:40     22:30                 
2 FUSPCEU Madrid, Spain  FUSPCEU_S0… 2025-02-09 11:00     01:30                 
3 IZTECH  Izmir, Türkiye IZTECH_S007 2025-03-02 10:00     00:35                 
4 KNUST   Kumasi, Ghana  KNUST_S008  2024-11-30 07:00     22:30                 
5 MPI     Tübingen, Ger… MPI_S231    2023-11-12 08:44     00:50                 
6 RISE    Borås, Sweden  RISE_S003   2025-03-18 06:10     22:00                 
7 THUAS   Delft, the Ne… THUAS_S003  2025-03-23 04:59     22:15                 
8 TUM     Munich, Germa… TUM_S003    2024-06-04 09:54     23:40                 
9 UCR     San José, Cos… UCR_S003    2025-06-20 11:00     00:30                 
# ℹ 9 more variables: civil_dawn <chr>, civil_dusk <chr>,
#   photoperiod_hours <dbl>, valid_melEDI_minutes <int>,
#   valid_melEDI_percent <dbl>, declared_nonwear_minutes <int>,
#   other_unavailable_minutes <int>, eligible_days_at_site <int>,
#   selection_seed <int>

The vertical extent of each light trace shows measured melEDI, while the overlaid intervals distinguish sleep and non-wear. Civil dawn and dusk provide site-specific astronomical context.

plot <- make_prepared_day_showcase_plot(examples$plot_data)
plot
Figure 1: Near-eye light exposure, diary-defined sleep and non-wear for one selected participant-day per site. Civil dawn and dusk mark the local solar context.
Code
write_csv_artifact(examples$selected_summary, file.path(paths$diagnostics,
  "prepared_day_showcase", "selected_days.csv"), "preparation/07-example-days.qmd")
write_csv_artifact(examples$eligible_counts, file.path(paths$diagnostics,
  "prepared_day_showcase", "eligible_day_counts.csv"), "preparation/07-example-days.qmd")
write_csv_artifact(examples$source_data, file.path(paths$source_data,
  "prepared_day_showcase.csv"), "preparation/07-example-days.qmd")
write_csv_artifact(examples$plot_data, file.path(paths$source_data,
  "prepared_day_showcase_plot.csv"), "preparation/07-example-days.qmd")
write_prepared_day_showcase_plot(plot, file.path(paths$figures, "prepared_day_showcase.png"),
  device = ragg::agg_png)
write_prepared_day_showcase_plot(plot, file.path(paths$figures, "prepared_day_showcase.svg"),
  device = svglite::svglite)