% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/TreatmentPatternsQueries.R
\name{getEventDuration}
\alias{getEventDuration}
\title{Extracts summary of event duration}
\usage{
getEventDuration(
  connectionHandler,
  schema,
  analysisIds,
  tpTablePrefix = "tp_",
  databaseTable = "database_meta_data",
  databaseIds = NULL,
  databaseNames = NULL,
  targetIds = NULL
)
}
\arguments{
\item{connectionHandler}{A connection handler that connects to the database and extracts sql queries.  Create a connection handler via `ResultModelManager::ConnectionHandler$new()`.}

\item{schema}{The result database schema (e.g., 'main' for sqlite)}

\item{analysisIds}{A vector of analysis ids to restrict to}

\item{tpTablePrefix}{The prefix used for the cohort generator results tables}

\item{databaseTable}{The name of the table with the database details (default 'database_meta_data')}

\item{databaseIds}{(optional) A vector of database ids to restrict to}

\item{databaseNames}{(optional) A vector of database Names to restrict to}

\item{targetIds}{(optional) A vector of target cohort ids to restrict to}
}
\value{
Returns a data.frame with the columns:
\itemize{
 \item{databaseName the name of the database}
 \item{databaseId the unique identifier of the database}
 \item{analysisId the unique identifier of a treament patterns run}
 \item{targetCohortId the target cohort unique identifier}
 \item{targetCohortName the target cohort name}
 \item{eventName a string representing an events for a target. Uses '+' for combination of event cohorts}
 \item{rank the step number of event occurance}
 \item{eventCount the count of event occurance at rank}
 \item{durationAverage the average duration of event}
 \item{durationMax the maximum duration of event}
 \item{durationMin the minimum duration of event}
 \item{durationMedian the median duration of event}
 \item{p25Value the 25th percentile for duration of event}
 \item{p75Value the 75th percentile for duration of event}
 \item{standardDeviation the standard deviation for duration of event}
 }
}
\description{
This function extracts results summary stats of event duration for specified analysis ids and target cohorts
}
\details{
Specify the connectionHandler, the schema, and the analysisIds
}
\examples{
conDet <- getExampleConnectionDetails()

connectionHandler <- ResultModelManager::ConnectionHandler$new(conDet)

ed <- getEventDuration(
  connectionHandler = connectionHandler,
  schema = "main",
  analysisIds = c(1)
)
}
\seealso{
Other TreatmentPatterns: 
\code{\link{getAnalysisCohorts}()},
\code{\link{getTreatmentPathways}()}
}
\concept{TreatmentPatterns}
