% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/missingness_func.R
\name{missingness_func}
\alias{missingness_func}
\title{Process Missing Data with Parallel Execution}
\usage{
missingness_func(
  subset_trial,
  missing_ids,
  n_post,
  cores,
  provider,
  multi_core = TRUE,
  verbose = TRUE
)
}
\arguments{
\item{subset_trial}{Data frame. The original data subset containing all posts.}

\item{missing_ids}{Numeric vector. IDs that failed processing and need retry.}

\item{n_post}{Integer. Number of posts to process in each API call.}

\item{cores}{Integer. Number of CPU cores available for parallel processing.}

\item{provider}{Character. AI provider to use, either "OpenAI" or "Groq".}

\item{multi_core}{Logical. If TRUE, uses multicore backend for parallel processing. If FALSE, uses multisession backend.}

\item{verbose}{Logical. If TRUE (default), progress and status messages are shown via \code{message()}. If FALSE, suppressed.}
}
\value{
Data frame. Successfully processed results from the missing data,
or NULL if no missing data was recovered. The function also outputs
debugging information about filtered posts with 4 or fewer characters.
}
\description{
This function handles data that failed to process in the initial parallel run
by reprocessing missing IDs with optimized batch sizes and parallel execution.
}
\details{
It continues until the number of missing items is reduced to a manageable level.
The function implements an adaptive retry strategy:
\itemize{
\item Continues processing while more than 15 rows remain to be processed
\item Filters out posts with 4 or fewer characters to avoid processing very short content
\item Dynamically adjusts the number of parallel workers based on data size
\item Ensures each worker has at least 15 posts to maintain efficiency
\item Uses the same processing pipeline as the main parallel execution
\item Accumulates successfully processed results across iterations
\item Provides progress feedback on remaining items and filtered posts
}

The function uses future-based parallel processing with automatic cleanup
and includes timing information for performance monitoring.
}
\seealso{
\code{\link[=parallel_execute]{parallel_execute()}}, \code{\link[=track_progress]{track_progress()}}
}
\keyword{internal}
