knitr::opts_chunk$set(echo = FALSE)
The following chunk runs the datapack model on the posit server, this model is run and built with the data-raw/model_calculations.R
file. This is just a wrapper, all changes are made to the model_calculations.R
file. This RMD can be knit locally or run published on posit server. Note that when this report runs, it produces the capacity to download the datapack model run below.
start_time <- as.POSIXlt(Sys.time()) paste0("Datapack model started ", start_time, " America/NY time") source("model_calculations.R") end_time <- as.POSIXlt(Sys.time()) paste0("Datapack model ended ", end_time, " America/NY time") print( paste0( "Job run time: ", round(difftime(end_time, start_time, units = "mins"), 2), " mins" ) )
if there are deltas below we see which ous and indicators there are deltas for:
``` {r ou_indicators, include = TRUE, echo = TRUE, message = TRUE, eval = T}
print(unique(deltas$ou)) print(unique(deltas$indicator_code))
print(table(deltas_summary$indicator_type))
New NA values are summarized below (these are usually a sign something is wrong): ```r # what about new na values? new_nas <- deltas_summary %>% filter(count_new_nas > 0) %>% pull(indicator_code) %>% unique() print(new_nas)
if there are deltas below is a summary grouped by ou and indicator code with the indicator codes labeled as targets or results - DOWNLOAD FOR ANALYSIS WITH THE CSV BUTTON:
DT::datatable( deltas_summary, rownames = FALSE, filter = "top", extensions = "Buttons", options = list( dom = "Bftrip", buttons = c("csv") ) )
Below we mark which combos are IN the datapack schema BUT NOT IN the datapack model (missing combos are not necessarily an issue if they can be explained) - DOWNLOAD FOR ANALYSIS WITH THE CSV BUTTON:
``` {r missing_combos, include = TRUE, echo = FALSE, message = FALSE, eval = T}
DT::datatable( missing_schema_combos, rownames = FALSE, filter = "top", extensions = "Buttons", options = list( dom = "Bftrip", buttons = c("csv") ) )
Below we display the unique missing combo indicators from the above dataframe: ```r unique(missing_schema_combos$indicator_code)
If there exist deltas between this model run and the latest production model then you can download the latest run below to validate and update in test s3 and prod:
if (NROW(deltas) > 0) { print("current server directory files: ") print(list.files()) datapackcommons::flattenDataPackModel_21(cop_data) %>% downloadthis::download_this( output_name = new_dpm_file_name, output_extension = ".rds", button_label = "Download latest model run", button_type = "default", has_icon = TRUE, icon = "fa fa-save", class = "button_large" ) } else { print("No Differences in Model so no Model to Download") }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.