## ----setup, include = FALSE---------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  eval = FALSE
)

## -----------------------------------------------------------------------------
# library(gpbiometrics)

## -----------------------------------------------------------------------------
# demo_dir <- system.file(
#   "extdata",
#   "gazepoint_biometrics_kiosk_demo_exports",
#   package = "gpbiometrics"
# )
# 
# workflow <- run_gazepoint_biometrics_workflow(
#   path = demo_dir,
#   include_all_gaze = TRUE,
#   include_fixations = FALSE,
#   include_other_csv = FALSE,
#   expected_sampling_rate_hz = 60
# )
# 
# summarise_gazepoint_biometrics_workflow(workflow)

## -----------------------------------------------------------------------------
# dat <- import_gazepoint_biometrics("path/to/biometric_export.csv")

## -----------------------------------------------------------------------------
# folder <- "path/to/gazepoint_exports"
# 
# dat <- import_gazepoint_biometric_folder(folder)

## -----------------------------------------------------------------------------
# readiness <- run_gazepoint_biometrics_real_data_readiness(dat)
# 
# readiness$overview
# readiness$checks

## -----------------------------------------------------------------------------
# workflow <- run_gazepoint_biometrics_workflow(
#   path = folder,
#   include_all_gaze = TRUE,
#   include_fixations = FALSE,
#   include_other_csv = FALSE,
#   expected_sampling_rate_hz = 60
# )
# 
# summary <- summarise_gazepoint_biometrics_workflow(workflow)
# summary

## -----------------------------------------------------------------------------
# unit_audit <- audit_gazepoint_gsr_units(dat)
# 
# smoothed <- standardise_gazepoint_adaptive_ema(
#   dat,
#   signal_col = "GSR_US",
#   time_col = "CNT"
# )
# 
# scr_recovery <- extract_gazepoint_scr_recovery_times(
#   dat,
#   eda_col = "GSR_US",
#   time_col = "CNT",
#   event_onset_col = "event_onset"
# )

## -----------------------------------------------------------------------------
# temperature_adjusted <- correct_gazepoint_eda_temperature(
#   dat,
#   eda_col = "GSR_US",
#   temperature_cols = c("ambient_temperature", "body_temperature"),
#   group_cols = "participant"
# )

## -----------------------------------------------------------------------------
# hrv <- extract_gazepoint_hrv_features(
#   dat,
#   ibi_col = "IBI",
#   group_cols = "participant"
# )
# 
# hrv_summary <- summarise_gazepoint_hrv_features(hrv)

## -----------------------------------------------------------------------------
# nonlinear_hrv <- extract_gazepoint_hrv_nonlinear(
#   dat,
#   ibi_col = "IBI",
#   group_cols = "participant"
# )
# 
# rcmse <- extract_gazepoint_hrv_rcmse(
#   dat,
#   ibi_col = "IBI",
#   group_cols = "participant"
# )
# 
# fuzzy_csi <- extract_gazepoint_hrv_fuzzy_csi(
#   dat,
#   ibi_col = "IBI",
#   group_cols = "participant"
# )

## -----------------------------------------------------------------------------
# beats <- extract_gazepoint_beats_kmeans(
#   dat,
#   pulse_col = "HRP",
#   time_col = "CNT",
#   group_cols = "participant"
# )

## -----------------------------------------------------------------------------
# ttl_events <- extract_gazepoint_ttl_events(dat)
# 
# aligned <- align_gazepoint_biometrics_to_ttl(
#   dat,
#   ttl_col = "TTL0",
#   time_col = "CNT"
# )
# 
# model_data <- prepare_gazepoint_biometrics_lme_data(
#   dat,
#   outcome_cols = c("GSR_US", "HR"),
#   group_cols = c("participant", "condition"),
#   time_col = "CNT"
# )

## -----------------------------------------------------------------------------
# bundle <- export_gazepoint_biometrics_report_bundle(
#   workflow,
#   output_dir = file.path(tempdir(), "gpbiometrics_report_bundle")
# )

## -----------------------------------------------------------------------------
# inventory <- create_gazepoint_biometrics_feature_inventory()
# 
# formatted_inventory <- format_gazepoint_biometrics_feature_inventory(
#   inventory
# )
# 
# inventory_summary <- summarise_gazepoint_biometrics_feature_inventory(
#   formatted_inventory
# )
# 
# inventory$overview
# inventory_summary$domain_summary
# head(formatted_inventory)

## ----eval=FALSE---------------------------------------------------------------
# private_folder <- "path/to/private_gazepoint_exports"
# private_output <- file.path(tempdir(), "gpbiometrics_real_check")
# 
# workflow <- run_gazepoint_biometrics_workflow(
#   path = private_folder,
#   include_all_gaze = TRUE,
#   include_fixations = FALSE,
#   include_other_csv = FALSE,
#   expected_sampling_rate_hz = 60
# )
# 
# summarise_gazepoint_biometrics_workflow(workflow)
# 
# export_gazepoint_biometrics_report_bundle(
#   workflow,
#   output_dir = private_output
# )
# 
# summary <- summarise_gazepoint_biometrics_workflow(workflow)
# summary

