diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index a527b9fa..847b53f4 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -1,5 +1,6 @@ on: - push + workflow_dispatch: + push: name: R-CMD-check @@ -30,10 +31,16 @@ jobs: r-version: ${{ matrix.config.r }} use-public-rspm: true + - name: Install libcurl on Linux + if: runner.os == 'Linux' + run: sudo apt-get update -y && sudo apt-get install -y libcurl4-openssl-dev + - uses: r-lib/actions/setup-r-dependencies@v2 with: dependencies: '"hard"' - extra-packages: any::rcmdcheck + extra-packages: | + any::rcmdcheck + any::testthat working-directory: Server - uses: r-lib/actions/check-r-package@v2 diff --git a/README.md b/README.md index d4d979f8..4b070d5d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Status -[![R-CMD-check](https://github.com/nextpagesoft/hivEstimatesAccuracy2/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/nextpagesoft/hivEstimatesAccuracy2/actions/workflows/R-CMD-check.yaml) +[![R-CMD-check](../../actions/workflows/R-CMD-check.yaml/badge.svg)](../../actions/workflows/R-CMD-check.yaml) # European Centre for Disease Prevention and Control @@ -20,5 +20,5 @@ further analysis. # License -See the [LICENSE](https://github.com/nextpagesoft/hivEstimatesAccuracy2/blob/master/LICENSE) file +See the [LICENSE](LICENSE) file for license rights and limitations (EUPL-1.2). diff --git a/Server/DESCRIPTION b/Server/DESCRIPTION index f9a3ec02..4279c532 100644 --- a/Server/DESCRIPTION +++ b/Server/DESCRIPTION @@ -20,8 +20,9 @@ Imports: fansi (>= 0.4.1), foreign (>= 0.8-81), ggplot2 (>= 3.3.3), + glue (>= 1.7.0), hivModelling (>= 0.9.14), - HivEstInfTime (>= 1.0.0), + hivEstInfTime (>= 1.0.0), jomo (>= 2.6-10), jsonlite (>= 1.7.2), knitr (>= 1.28), @@ -42,9 +43,9 @@ Imports: yaml (>= 2.2.1), xml2 (>= 1.3.2) Remotes: - nextpagesoft/hivModelling, - nextpagesoft/HivEstInfTime + github::EU-ECDC/hivModelling, + github::EU-ECDC/hivEstInfTime Encoding: UTF-8 LazyData: true -RoxygenNote: 7.3.1 +RoxygenNote: 7.3.2 Suggests: testthat, rcmdcheck, pak, miniCRAN diff --git a/Server/R/CaseDataManager.R b/Server/R/CaseDataManager.R index dc231e2a..0ce44d05 100644 --- a/Server/R/CaseDataManager.R +++ b/Server/R/CaseDataManager.R @@ -467,7 +467,7 @@ CaseDataManager <- R6::R6Class( # nolint # 7. Migration --------------------------------------------------------------------------------- RunMigration = function( - params = HivEstInfTime::GetMigrantParams() + params = hivEstInfTime::GetMigrantParams() ) { if (!is.null(private$AppMgr) && !is.element( private$AppMgr$Steps['CASE_BASED_ORIGIN_GROUPING'], @@ -495,7 +495,7 @@ CaseDataManager <- R6::R6Class( # nolint .Random.seed <- randomSeed # nolint input <- hivPlatform::PrepareMigrantData(data) - output <- HivEstInfTime::PredictInf(input, params) + output <- hivEstInfTime::PredictInf(input, params) data[output, ProbPre := i.ProbPre, on = .(UniqueId)] # Enrich data with extra dimensions from the input preparation step diff --git a/Server/R/Messages.R b/Server/R/Messages.R index 68b79b06..918c5e75 100644 --- a/Server/R/Messages.R +++ b/Server/R/Messages.R @@ -1,3 +1,4 @@ + #' PrintH1 #' #' @param ... Text to be printed @@ -21,11 +22,28 @@ PrintH1 <- function( invisible(NULL) } +#' PrintStartHeader +#' +#' @return NULL +#' +#' @examples +#' PrintStartHeader() +#' #' @export PrintStartHeader <- function() { PrintAlert('{format(Sys.time())} - START') } +#' PrintStopHeader +#' +#' @param startTime Start time as POSIXct +#' @param stopTime End time as POSIXct +#' +#' @return NULL +#' +#' @examples +#' PrintStopHeader() +#' #' @export PrintStopHeader <- function(startTime = NULL, stopTime = NULL) { if (!is.null(startTime) && !is.null(stopTime)) { diff --git a/Server/man/PrintStartHeader.Rd b/Server/man/PrintStartHeader.Rd new file mode 100644 index 00000000..ce4213fc --- /dev/null +++ b/Server/man/PrintStartHeader.Rd @@ -0,0 +1,15 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/Messages.R +\name{PrintStartHeader} +\alias{PrintStartHeader} +\title{PrintStartHeader} +\usage{ +PrintStartHeader() +} +\description{ +PrintStartHeader +} +\examples{ +PrintStartHeader() + +} diff --git a/Server/man/PrintStopHeader.Rd b/Server/man/PrintStopHeader.Rd new file mode 100644 index 00000000..87cefc5d --- /dev/null +++ b/Server/man/PrintStopHeader.Rd @@ -0,0 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/Messages.R +\name{PrintStopHeader} +\alias{PrintStopHeader} +\title{PrintStopHeader} +\usage{ +PrintStopHeader(startTime = NULL, stopTime = NULL) +} +\arguments{ +\item{startTime}{Start time as POSIXct} + +\item{stopTime}{End time as POSIXct} +} +\description{ +PrintStopHeader +} +\examples{ +PrintStopHeader() + +} diff --git a/Server/man/hivPlatform.Rd b/Server/man/hivPlatform.Rd index 9fae6a16..f8bd887b 100644 --- a/Server/man/hivPlatform.Rd +++ b/Server/man/hivPlatform.Rd @@ -2,6 +2,7 @@ % Please edit documentation in R/hivPlatform-package.R \docType{package} \name{hivPlatform} +\alias{hivPlatform-package} \alias{hivPlatform} \title{Improving Accuracy of HIV Estimates in EU/EEA Countries} \description{ diff --git a/Server/tests/testthat.R b/Server/tests/testthat.R index ad44645f..598133a1 100644 --- a/Server/tests/testthat.R +++ b/Server/tests/testthat.R @@ -4,5 +4,5 @@ library(data.table) if (requireNamespace('testthat', quietly = TRUE)) { testthat::test_package('hivPlatform') } else { - PrintAlert('Skipping tests') + hivPlatform::PrintAlert('Skipping tests') } diff --git a/Server/utils/Deploy.R b/Server/utils/Deploy.R index 0fdf9cc6..abe4adde 100644 --- a/Server/utils/Deploy.R +++ b/Server/utils/Deploy.R @@ -1,4 +1,6 @@ # 1. Update local packages ------------------------------------------------------------------------- +dir.create('library', showWarnings = FALSE) +.libPaths('./library') pak::local_install_deps(root = '.', dependencies = 'hard', upgrade = TRUE) pkgDescr <- as.data.frame(read.dcf('DESCRIPTION')) @@ -20,7 +22,7 @@ depPkgs <- unname(sapply( )) depPkgs <- setdiff( depPkgs, - c('R', 'hivModelling', 'HivEstInfTime', 'grid', 'graphics', 'parallel', 'stats', 'tools', 'utils') + c('R', 'hivModelling', 'hivEstInfTime', 'grid', 'graphics', 'parallel', 'stats', 'tools', 'utils') ) depPkgList <- miniCRAN::pkgDep(depPkgs, repos = repoCRAN, type = 'source', suggests = FALSE) @@ -41,7 +43,7 @@ buildPath <- file.path(rootPath, 'build') dir.create(buildPath, showWarnings = FALSE, recursive = TRUE) # HIV Estimate Infection Time -hivEstInfTimePkgPath <- 'D:/_REPOSITORIES/HivEstInfTime' +hivEstInfTimePkgPath <- 'D:/_REPOSITORIES/hivEstInfTime' pkgbuild::build(path = hivEstInfTimePkgPath, dest_path = buildPath, binary = FALSE) pkgbuild::build(path = hivEstInfTimePkgPath, dest_path = buildPath, binary = TRUE, args = args) diff --git a/Server/utils/Example.R b/Server/utils/Example.R index 9365cdbe..2a8c1b8e 100644 --- a/Server/utils/Example.R +++ b/Server/utils/Example.R @@ -167,10 +167,10 @@ json <- ConvertObjToJSON(appMgr$CaseMgr$MigrationResult$Artifacts$OutputPlots, d writeLines(json, 'json.txt') appMgr$CaseMgr$MigrationResult$Artifacts$ConfBounds -params <- HivEstInfTime::GetMigrantParams() +params <- hivEstInfTime::GetMigrantParams() data <- copy(appMgr$CaseMgr$Data) input <- hivPlatform::PrepareMigrantData(data) -output <- HivEstInfTime::PredictInf(input, params) +output <- hivEstInfTime::PredictInf(input, params) output.copy <- copy(output) output <- copy(output.copy) @@ -447,7 +447,7 @@ appMgr$HIVModelMgr$BootstrapFitStats$ThetaStats # Migration ---------------------------------------------------------------------------------------- -params <- HivEstInfTime::GetMigrantParams() +params <- hivEstInfTime::GetMigrantParams() # Recon data set reconAIDS <- data.table::setDT(haven::read_dta('D:/VirtualBox_Shared/Migrant_test/baseAIDS.dta')) @@ -497,7 +497,7 @@ input <- list( ) # Create test dataset -test <- HivEstInfTime::PredictInf(input, params) +test <- hivEstInfTime::PredictInf(input, params) # Reconcile recon <- rbind( diff --git a/Server/utils/RcppTest.R b/Server/utils/RcppTest.R index 426cedde..48834336 100644 --- a/Server/utils/RcppTest.R +++ b/Server/utils/RcppTest.R @@ -1,5 +1,5 @@ outputCD4VL <- readRDS('../../outputCD4VL.Rds') -params <- HivEstInfTime::GetMigrantParams() +params <- hivEstInfTime::GetMigrantParams() uniqueId <- 209 dt <- outputCD4VL[UniqueId == uniqueId] diff --git a/workspace.code-workspace b/workspace.code-workspace index 191f5b75..d2125c48 100644 --- a/workspace.code-workspace +++ b/workspace.code-workspace @@ -4,7 +4,7 @@ "path": "." }, { - "path": "../HivEstInfTime" + "path": "../hivEstInfTime" }, { "path": "../hivModelling"