Main server function for the modFrames module. Orchestrates the timelapse playback and frame comparison sub-modules, coordinating reactive data flow between parent app and child modules.
Use this function with [modFramesUI()] to create a complete frames analysis interface. The server manages shared reactive context and delegates functionality to specialized sub-modules for timelapse and comparison.
The module requires rich frame analytics data from [artutils::get_frame_analytics()] which provides 21 columns of per-frame statistics for storytelling insights and visualization.
Arguments
- id
Character. Shiny namespace ID for the module instance. Used by [shiny::moduleServer()] to isolate module reactivity. Must match the `id` passed to [modFramesUI()] for proper module binding.
- r
Reactive list from parent app containing artwork context and frame analytics. Must contain:
- `r$appdata$artwork$stats$artist_uuid`
Character. Artist UUID for CDN path construction.
- `r$appdata$artwork$stats$art_uuid`
Character. Artwork UUID for CDN path construction.
- `r$appdata$config$n_frames`
Numeric. Total number of frames available for this artwork.
- `r$appdata$artwork$frame_stats`
data.table. 21-column frame analytics from [artutils::get_frame_analytics()]. Contains temporal metrics (`elapsed_minutes`, `elapsed_hours`, `cumulative_strokes`), color metrics (`unique_colors`, `color_diversity`, `dominant_hex`), delta metrics (`colors_added`, `palette_change_score`), and phase classification (`technique_phase`).
Parent app is responsible for populating this structure via [artutils::get_appdata()].
Value
NULL (invisibly). Module operates via side effects, rendering outputs to the UI and managing reactive state.
See also
* [modFramesUI()] for the corresponding UI function * [playTimelapseServer()] for timelapse sub-module * [compareFramesServer()] for comparison sub-module * [artutils::get_appdata()] for reactive data source
Other frames-core:
modFramesUI()
Examples
if (FALSE) { # \dontrun{
# Integration with appPlatform
server <- function(input, output, session) {
r <- reactiveValues()
# Populate appdata when artist/artwork selection changes
observe({
req(r$artist, r$artwork)
r$appdata <- artutils::get_appdata(r$artist, r$artwork)
})
# Initialize frames module
modFramesServer("frames", r)
}
# r$appdata structure after get_appdata():
# list(
# artwork = list(
# stats = list(artist_uuid = "...", art_uuid = "..."),
# frame_stats = data.table(21 columns...)
# ),
# config = list(n_frames = 150)
# )
} # }
