Skip to content

Commit

Permalink
Merge pull request #2 from nextpagesoft/move-to-ecdc
Browse files Browse the repository at this point in the history
Prepare code for move to ECDC repository
  • Loading branch information
casparecdc authored Sep 16, 2024
2 parents 99cd23c + 881679c commit d4b56d5
Show file tree
Hide file tree
Showing 13 changed files with 83 additions and 19 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
on:
push
workflow_dispatch:
push:

name: R-CMD-check

Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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).
9 changes: 5 additions & 4 deletions Server/DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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
4 changes: 2 additions & 2 deletions Server/R/CaseDataManager.R
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down Expand Up @@ -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
Expand Down
18 changes: 18 additions & 0 deletions Server/R/Messages.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

#' PrintH1
#'
#' @param ... Text to be printed
Expand All @@ -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)) {
Expand Down
15 changes: 15 additions & 0 deletions Server/man/PrintStartHeader.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions Server/man/PrintStopHeader.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Server/man/hivPlatform.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Server/tests/testthat.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ library(data.table)
if (requireNamespace('testthat', quietly = TRUE)) {
testthat::test_package('hivPlatform')
} else {
PrintAlert('Skipping tests')
hivPlatform::PrintAlert('Skipping tests')
}
6 changes: 4 additions & 2 deletions Server/utils/Deploy.R
Original file line number Diff line number Diff line change
@@ -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'))
Expand All @@ -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)

Expand All @@ -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)

Expand Down
8 changes: 4 additions & 4 deletions Server/utils/Example.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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'))
Expand Down Expand Up @@ -497,7 +497,7 @@ input <- list(
)

# Create test dataset
test <- HivEstInfTime::PredictInf(input, params)
test <- hivEstInfTime::PredictInf(input, params)

# Reconcile
recon <- rbind(
Expand Down
2 changes: 1 addition & 1 deletion Server/utils/RcppTest.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
outputCD4VL <- readRDS('../../outputCD4VL.Rds')
params <- HivEstInfTime::GetMigrantParams()
params <- hivEstInfTime::GetMigrantParams()
uniqueId <- 209
dt <- outputCD4VL[UniqueId == uniqueId]

Expand Down
2 changes: 1 addition & 1 deletion workspace.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"path": "."
},
{
"path": "../HivEstInfTime"
"path": "../hivEstInfTime"
},
{
"path": "../hivModelling"
Expand Down

0 comments on commit d4b56d5

Please sign in to comment.