% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/scores_nt_fitbit.R
\name{compute_fitbit_activity_table}
\alias{compute_fitbit_activity_table}
\title{Computes Daily Activity Summaries}
\usage{
compute_fitbit_activity_table(
  data_activity,
  data_daily,
  hr_low = 50,
  hr_high = NULL,
  hr_rep_day = 10,
  hr_rep_sleep = 30,
  bin_minutes = 1440,
  append_daily_fitbit_qc,
  qc_threshold = 0.8,
  offset = "12:00",
  min_actv_minutes
)
}
\arguments{
\item{data_activity}{tbl. Data frame with \code{dtt} (timestamp), \code{hrate}
(heart rate), \code{steps}, \code{intnst} (intensity), \code{mets} and \code{is_slp} (sleep flag)
variables.}

\item{data_daily}{tbl. Daily-level Fitbit-generated summary data containing
\code{hrate_rest_fitb} (resting heart rate) and optionally step counts
(steps_fitb).}

\item{hr_low}{numeric. Lower bound threshold for valid heart rate values.}

\item{hr_high}{numeric or NULL. Optional upper bound threshold for valid
heart rate values.
If NULL, no upper threshold is applied.}

\item{hr_rep_day}{numeric. Threshold (number of epochs) for identifying
repeated heart rate
values during wake/activity periods.}

\item{hr_rep_sleep}{numeric. Threshold (number of epochs) for identifying
repeated heart rate
values during sleep periods.}

\item{bin_minutes}{numeric. Number of minutes used to bin activity data when
computing intensity scores (e.g., 1440 for daily aggregation).}

\item{append_daily_fitbit_qc}{logical. If TRUE, add Fitbit-provided step
count and QC measures.}

\item{qc_threshold}{numeric, between 0 and 1. Minimum percentage of Fitbit
step count that must be met by computed active step count for QC to pass
(Default: 0.8).}

\item{offset}{character. Time of day (HH:MM) cutoff.}

\item{min_actv_minutes}{numeric. Minimum number of active minutes required
for a day to pass quality control. Used to create a \code{{qc_Xmin}} flag
column in the output.}
}
\value{
tbl.  A daily-level summarized data frame with the following
components:

\strong{Identifiers and time variables:}
\itemize{
\item \code{participant_id}, \code{session_id}
\item \code{wk}: Study week index
\item \code{day}: Study day index
\item \code{dt}: Calendar date
\item \code{dt_day}: Day of week (labeled)
\item \code{dt_wknd}: Indicator for weekend days
}

\strong{Activity and sleep measures:}
\itemize{
\item \code{min_total}: Total valid minutes
\item \code{min_actv}: Active (non-sleep) minutes
\item \code{min_slp}: Sleep minutes
\item \code{min_nap_slp}: Nap sleep minutes
}

\strong{Step count measures:}
\itemize{
\item \code{steps_total}: Total steps after exclusions
\item \code{steps_actv}: Steps during active minutes after exclusions
\item \code{steps}: Total steps before exclusions
\item \code{steps_fitb}: Fitbit-reported daily steps
}

\strong{Energy expenditure and intensity-based  activity measures:}
\itemize{
\item \code{mets}: Mean METs
\item \code{mets_actv}: Mean METs during active minutes
\item \verb{min_intnst_*}: Minutes spent in sedentary, light, moderate, and
vigorous activity (total and active-only variants)
}

\strong{Heart rate exclusion summaries:}
\itemize{
\item \verb{excl_min_*}: Minutes excluded due to heart rate criteria (low, high,
missing, repeated) for both activity and sleep domains
}

\strong{Heart rate and QC metrics:}
\itemize{
\item \code{hrate_rest_fitb}: Resting heart rate (Fitbit daily summary)
\item \code{qc_600min}: Indicator for >= 600 valid active minutes
\item \code{qc_steps}: Indicator for valid step counts based on Fitbit comparison
\item \code{pcnt_steps_fitb}: Proportion of calculated steps relative to
Fitbit-reported steps
}

\strong{Flags:}
\itemize{
\item \code{flg_30sec}: Indicator that valid 30-second sleep data exists for the day
\item \code{flg_any}: Indicator that any valid data exists for the day
}
}
\description{
Pipeline wrapper that processes Fitbit minute-level activity data into a
daily summary table. Applies heart rate-based exclusions and recovery
identification, then aggregates minute totals, exclusion summaries, step
counts, intensity scores, and sleep presence into a single day-level data
frame. Optionally appends Fitbit-generated daily QC measures.
}
