Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
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
3 changes: 1 addition & 2 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches:
[develop]
branches: [develop]
pull_request:
branches: develop
# allow manual action trigger
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches:
[develop]
branches: [develop]
pull_request:
branches: [develop]

Expand Down
30 changes: 15 additions & 15 deletions R/ATTAINSCrosswalks.R
Original file line number Diff line number Diff line change
Expand Up @@ -1257,10 +1257,10 @@ TADA_CreateParamRef <- function(.data, org_id = NULL, paramRef = NULL, auto_assi
# Excel ref files to be stored in the Downloads folder location.
# Define the OneDrive Downloads path
onedrive_downloads_path <- file.path(Sys.getenv("USERPROFILE"), "OneDrive", "Downloads", "myfileRef.xlsx")

# Define the default Downloads path
default_downloads_path <- file.path(Sys.getenv("USERPROFILE"), "Downloads", "myfileRef.xlsx")

# Check if the OneDrive Downloads path exists, and prioritize it
if (file.exists(onedrive_downloads_path)) {
downloads_path <- onedrive_downloads_path
Expand Down Expand Up @@ -1706,7 +1706,7 @@ TADA_CreateUseParamRef <- function(.data, org_id = NULL, paramRef = NULL, usePar

if (is.data.frame(useParamRef)) {
col.names <- c(
"ATTAINS.OrganizationIdentifier",
"ATTAINS.OrganizationIdentifier",
"ATTAINS.ParameterName", "ATTAINS.UseName"
)

Expand Down Expand Up @@ -1940,7 +1940,7 @@ TADA_CreateUseParamRef <- function(.data, org_id = NULL, paramRef = NULL, usePar
!paste(ATTAINS.OrganizationIdentifier, ATTAINS.ParameterName, ATTAINS.UseName) %in% paste(ATTAINS_param_all$ATTAINS.OrganizationIdentifier, ATTAINS_param_all$ATTAINS.ParameterName, ATTAINS_param_all$ATTAINS.UseName) &
ATTAINS.UseName %in% ATTAINS_param_all$ATTAINS.UseName ~
"Use name is listed as a prior cause in ATTAINS for this organization, but not for this parameter name.",
TRUE ~
TRUE ~
"Use name is not listed as a prior cause in ATTAINS."
)) %>%
dplyr::mutate(Flag.UseInput = dplyr::case_when(
Expand Down Expand Up @@ -1970,10 +1970,10 @@ TADA_CreateUseParamRef <- function(.data, org_id = NULL, paramRef = NULL, usePar

# Define the OneDrive Downloads path
onedrive_downloads_path <- file.path(Sys.getenv("USERPROFILE"), "OneDrive", "Downloads", "myfileRef.xlsx")

# Define the default Downloads path
default_downloads_path <- file.path(Sys.getenv("USERPROFILE"), "Downloads", "myfileRef.xlsx")

# Check if the OneDrive Downloads path exists, and prioritize it
if (file.exists(onedrive_downloads_path)) {
downloads_path <- onedrive_downloads_path
Expand Down Expand Up @@ -2859,10 +2859,10 @@ TADA_CreateMLSummaryRef <- function(.data, org_id = NULL, useParamRef = NULL, di
# default Downloads file location.
# Define the OneDrive Downloads path
onedrive_downloads_path <- file.path(Sys.getenv("USERPROFILE"), "OneDrive", "Downloads", "myfileRef.xlsx")

# Define the default Downloads path
default_downloads_path <- file.path(Sys.getenv("USERPROFILE"), "Downloads", "myfileRef.xlsx")

# Check if the OneDrive Downloads path exists, and prioritize it
if (file.exists(onedrive_downloads_path)) {
downloads_path <- onedrive_downloads_path
Expand Down Expand Up @@ -2968,7 +2968,7 @@ TADA_CreateMLSummaryRef <- function(.data, org_id = NULL, useParamRef = NULL, di
LongitudeMeasure, LatitudeMeasure, IncludeOrExclude, UniqueSpatialCriteria
) %>%
dplyr::distinct()

# data frame to only display sites that contains the parameter
CreateMLSummaryRef2 <- useParamRef %>%
tidyr::uncount(weights = length(unique_ML)) %>%
Expand All @@ -2988,7 +2988,7 @@ TADA_CreateMLSummaryRef <- function(.data, org_id = NULL, useParamRef = NULL, di
LongitudeMeasure, LatitudeMeasure, TADA.ParameterInSite.Flag, IncludeOrExclude, UniqueSpatialCriteria
) %>%
dplyr::distinct()

# joins the table back together and flag appropriately
CreateMLSummaryRef <- CreateMLSummaryRef %>%
# dplyr::bind_rows(CreateMLSummaryRef2)
Expand All @@ -3008,17 +3008,17 @@ TADA_CreateMLSummaryRef <- function(.data, org_id = NULL, useParamRef = NULL, di
) %>%
dplyr::arrange(MonitoringLocationIdentifier)
}

if (displayNA == TRUE && nrow(useParamRef) > 2000 || length(unique_ML) > 2000) {
warning(paste0(
"displayNA = TRUE: ",
"Too many sites or uses and parameters. Cannot assign all uses and parameters to each monitoring sites in the output. ",
"Defaulting to displayNA = FALSE"
))
displayNA = FALSE

displayNA <- FALSE
}

# If we want to exclude rows of sites with no specified parameters
if (displayNA == FALSE) {
print(paste0(
Expand All @@ -3044,7 +3044,7 @@ TADA_CreateMLSummaryRef <- function(.data, org_id = NULL, useParamRef = NULL, di
LongitudeMeasure, LatitudeMeasure, TADA.ParameterInSite.Flag, IncludeOrExclude, UniqueSpatialCriteria
) %>%
dplyr::distinct()

CreateMLSummaryRef <- CreateMLSummaryRef2 %>%
dplyr::arrange(MonitoringLocationIdentifier)
}
Expand Down
34 changes: 14 additions & 20 deletions R/CensoredDataSuite.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,19 @@
#'
#'
TADA_IDCensoredData <- function(.data) {
# check .data is data.frame
TADA_CheckType(.data, "data.frame", "Input object")

# Check if the input data frame is empty
if (nrow(.data) == 0) {
message("The entered data frame is empty. The function will not run.")
return(NULL) # Exit the function early
}

# check .data has all of the required columns
# check .data is data.frame and has required columns
expected_cols <- c(
"ResultDetectionConditionText",
"DetectionQuantitationLimitTypeName",
"TADA.ResultMeasureValueDataTypes.Flag"
)
TADA_CheckColumns(.data, expected_cols)
# Check if the input data frame is empty
if (nrow(.data) == 0) {
message("The entered data frame is empty. The function will not run.")
return(NULL) # Exit the function early
}


# this copies det lim result value and unit over to TADA result value and unit
# when the result value is TEXT but there is a specific text value that indicates
Expand Down Expand Up @@ -398,23 +395,20 @@ TADA_SimpleCensoredMethods <- function(.data, nd_method = "multiplier",
nd_multiplier = 0.5,
od_method = "as-is",
od_multiplier = "null") {
# check .data is data.frame
TADA_CheckType(.data, "data.frame", "Input object")

# Check if the input data frame is empty
if (nrow(.data) == 0) {
message("The entered data frame is empty. The function will not run.")
return(NULL) # Exit the function early
}

# check .data has all of the required columns
# check .data is data.frame and has required columns
expected_cols <- c(
"ResultDetectionConditionText",
"DetectionQuantitationLimitTypeName",
"TADA.ResultMeasureValueDataTypes.Flag"
)
TADA_CheckColumns(.data, expected_cols)

# Check if the input data frame is empty
if (nrow(.data) == 0) {
message("The entered data frame is empty. The function will not run.")
return(NULL) # Exit the function early
}

# check that multiplier is provided if method = "multiplier"
if (nd_method == "multiplier" & nd_multiplier == "null") {
stop("Please provide a multiplier for the lower detection limit handling method of 'multiplier'. Typically, the multiplier value is between 0 and 1.")
Expand Down
Loading