Processes multiple FIT files from a specified directory, utilizing caching to avoid reprocessing unchanged files. This function efficiently processes new or updated files in a directory, leveraging a cache to skip already processed files.
process_fit_directory(
dir_path,
cache_file = file.path(dir_path, "hrv_cache.csv"),
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,
clear_cache = FALSE,
sport_name = "OST",
min_quality_threshold = 0,
correction_method = "linear"
)The directory path containing FIT files to process.
Path to the cache file for storing processed data. Defaults to "hrv_cache.csv" within the directory.
Time in seconds to consider as standing. Default is 180 seconds.
Time in seconds to consider as transition. Default is 20 seconds.
Time in seconds to consider as laying. Default is 180 seconds.
Minimum RR interval in milliseconds. Default is 272 ms.
Maximum RR interval in milliseconds. Default is 2000 ms.
Window size for moving average calculation. Default is 7.
Threshold for artifact detection. Default is 0.2.
Logical indicating whether to center transition phases. Default is TRUE.
Logical indicating whether to use centered window for processing. Default is FALSE.
Warmup time in seconds to exclude from beginning. Default is 70.
Logical indicating whether to clear existing cache. Default is FALSE.
Character string specifying the sport name filter. Default is "OST".
Minimum quality threshold (0-1) for data to be processed. Data below this quality threshold will be discarded. Default is 0.0 (no filtering).
Character string specifying the artifact correction method. Options are: "linear", "cubic", "lipponen", "none". Default is "linear".
A tibble containing HRV metrics for all processed FIT files