Skip to contents

Generate aggregate metrics for reporting and analytics dashboards. Provides breakdown by user type, authentication status, and time period. Use this for executive summaries, investor reports, or trend analysis. Optionally filter to a specific date range for period-over-period comparisons.

Usage

get_whitepaper_stats(start_date = NULL, end_date = NULL, cn = NULL)

Arguments

start_date

Date or POSIXct or NULL. Start of filter range (inclusive). If NULL, includes all downloads from the beginning of time. Combine with end_date to analyze specific periods (e.g., monthly reports).

end_date

Date or POSIXct or NULL. End of filter range (inclusive). If NULL, includes all downloads through the present. Use Sys.Date() for "up to today" queries.

cn

DBI connection object or NULL. Database connection from artcore::dbc("artsite"). If NULL (default), creates and closes connection automatically.

Value

List with named elements containing aggregate statistics:

  • total_downloads: Integer total download count in the period

  • unique_emails: Integer count of unique email addresses

  • by_user_type: Data frame with columns user_type and count

  • authenticated: Integer count of logged-in user downloads

  • anonymous: Integer count of anonymous downloads

  • date_range: List with start and end values used for the query

Examples

if (FALSE) { # \dontrun{
# Get all-time statistics
stats <- get_whitepaper_stats()
print(stats$total_downloads)
print(stats$by_user_type)

# Get statistics for a specific month
stats <- get_whitepaper_stats(
  start_date = as.Date("2024-01-01"),
  end_date = as.Date("2024-01-31")
)
} # }