Calculates HRV metrics from a FIT file, integrating data extraction, RR interval processing, and HRV calculation with error handling.

process_fit_file(
  file_path,
  standing_time = 180,
  transition_time = 20,
  laying_time = 180,
  min_rr = 272,
  max_rr = 2000,
  window_size = 7,
  threshold = 0.2,
  centered_transition = TRUE,
  centered_window = FALSE,
  warmup = 70,
  sport_name = "OST",
  min_quality_threshold = 0,
  correction_method = "linear"
)

Arguments

file_path

Path to FIT file

standing_time

Time in seconds to consider as standing

transition_time

Time in seconds to consider as transition

laying_time

Time in seconds to consider as laying

min_rr

Minimum RR interval in milliseconds

max_rr

Maximum RR interval in milliseconds

window_size

Window size for moving average calculation

threshold

Threshold for artifact detection

centered_transition

Logical indicating whether the transition time should be split into laying and standing times. FALSE, if transition time is only taken from the laying phase.

centered_window

Logical indicating whether the moving window should be centered. Defaults to FALSE.

warmup

Time in seconds from the start that should be discarded

sport_name

Name of the sport for the fit file. Used as a filter.

min_quality_threshold

Minimum quality threshold (0-1) for data to be processed. Data below this quality threshold will be discarded. Default is 0.0 (no filtering).

correction_method

Character string specifying the artifact correction method. Options are: "linear", "cubic", "lipponen", "none". Default is "linear".

Value

Tibble containing HRV metrics