Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions R/create_measurement_dimension_set.R
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ create_measurement_dimension_set <- function(mpp_group = NA
,sub_value)
,threshold = FALSE
,template = 'default'
,calc_date = measurement_list[[characteristic_summary_obj]]$calc_date
,calc_sha = measurement_list[[characteristic_summary_obj]]$calc_sha
)

return(dimensions)
Expand Down
9 changes: 9 additions & 0 deletions R/get_sha_info.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
get_sha_info <- function(){
sha_file <- tryCatch(paste0(readLines("/app/R/install-packages.R"), collapse = "")
,warning=function(w) 1)
if(sha_file==1) {
sha_value <- 'SHA information not available'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we just return from inside the if/else here we could eliminate the assignment to sha_value as well as line 8

} else
sha_value <- stringr::str_extract(sha_file, stringr::regex('(?<=oliveR@).*(?=\\")', multiline = TRUE))
return(sha_value)
}
8 changes: 7 additions & 1 deletion R/measurement_single_value_class.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ measurement_single_value <- R6Class("measurement_single_value",
,data_out_type = NULL
,summary_function = NULL
,na_rm = NULL
,calc_date = NULL
,calc_sha = NULL
,initialize = function(metric_key = NA
,group_key = 'id_organization'
,measurement_name = NA
Expand All @@ -48,7 +50,9 @@ measurement_single_value <- R6Class("measurement_single_value",
,rename_var = NA
,data_out_type = NA
,summary_function = 'mean'
,na_rm = TRUE) {
,na_rm = TRUE
,calc_date = NA
,calc_sha = NA) {
self$metric_key <- metric_key
self$group_key <- group_key
self$measurement_name <- measurement_name
Expand All @@ -70,6 +74,8 @@ measurement_single_value <- R6Class("measurement_single_value",
,data_out_type = self$data_out_type
,summary_function = self$summary_function
,na_rm = self$na_rm)
self$calc_date <- lubridate::today()
self$calc_sha <- get_sha_info()
}
,get_value = function(group_id) {
filter_criteria <- interp(~ which_column == group_id
Expand Down