% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/scores_nt_fitbit.R
\name{identify_hr_exclusions}
\alias{identify_hr_exclusions}
\title{Identify heart rate based exclusions}
\usage{
identify_hr_exclusions(data, hr_low, hr_high = NULL, hr_rep_day, hr_rep_sleep)
}
\arguments{
\item{data}{tbl. Data frame with the following columns with minute-level
epoch data with the following columns:
\itemize{
\item \code{participant_id}: Participant identifier
\item \code{session_id}: Session identifier
\item \code{dtt}: POSIXct epoch timestamp
\item \code{dtt} POSIXct epoch timestamp.
}}

\item{hr_low}{numeric, positive whole number. Lower bound for plausible heart
rate (Default: 50 bpm)}

\item{hr_high}{numeric, positive whole number. Upper bound for plausible
heart rate. If NULL, no upper bound is applied (Default: NULL)}

\item{hr_rep_day}{numeric, positive whole number. Number of consecutive
missing heart rate values allowed during non-sleep minutes (Default: 10).}

\item{hr_rep_sleep}{numeric, positive whole number. Number of consecutive
missing heart rate values allowed during sleep minutes (Default: 30).}
}
\value{
tbl. The input data frame with the following additional columns:
\itemize{
\item \code{hrate_low}: TRUE if heart rate is below \code{hr_low} threshold, FALSE
otherwise.
\item \code{hrate_hi}: TRUE if heart rate is above \code{hr_high} threshold (if \code{hr_high}
is not NULL), FALSE otherwise. Column is not created if \code{hr_high} is NULL.
\item \code{hrate_no}: TRUE if heart rate is missing, FALSE otherwise.
\item \code{hrate_repeat_actv}: TRUE if there are more than \code{hr_rep_day} consecutive
identical heart rate values during non-sleep minutes, FALSE otherwise.
\item \code{hrate_repeat_slp}: TRUE if there are more than \code{hr_rep_sleep} consecutive
identical heart rate values during sleep minutes, FALSE otherwise.
\item \code{hrate_excluded}: TRUE if any above exclusion criteria are met, FALSE
otherwise.
}
}
\description{
Flags implausible or poor-quality heart rate observations based on
physiologic thresholds, missingness and repeated values.
}
\details{
Missing values are handled using a bounded approach. When a consecutive
sequence of missing values are bounded by identical values, exclusions are
flagged as repeat exclusions if the length of sequence meets repeat
threshold parameters.
}
\note{
\code{data} is either \code{fitbit_raw_activity} or \code{fitbit_covid_raw_activity}
downloaded from LASSO.
}
\keyword{internal}
