From 4540edaba91c8032fbe60a2799fb57453e9aaa17 Mon Sep 17 00:00:00 2001 From: edward-burn <9583964+edward-burn@users.noreply.github.com> Date: Tue, 27 Aug 2024 12:22:12 +0100 Subject: [PATCH 1/2] miscellaneous updates --- DESCRIPTION | 6 ++-- R/cohortDiagnostics.R | 34 +++++++++++++++++- inst/shiny/server.R | 2 +- .../shinyDiagnostics/diagnostics-001.json | 11 ------ .../shinyDiagnostics/diagnostics-001_.png | Bin 7592 -> 0 bytes 5 files changed, 38 insertions(+), 15 deletions(-) delete mode 100644 tests/testthat/_snaps/shinyDiagnostics/diagnostics-001.json delete mode 100644 tests/testthat/_snaps/shinyDiagnostics/diagnostics-001_.png diff --git a/DESCRIPTION b/DESCRIPTION index 6c3506e..839aac6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -16,7 +16,9 @@ Suggests: omock, testthat (>= 3.0.0), knitr, - RPostgres + RPostgres, + PatientProfiles, + ggplot2 Config/testthat/edition: 3 RoxygenNote: 7.3.2 Imports: @@ -29,7 +31,6 @@ Imports: here, omopgenerics, magrittr, - PatientProfiles, purrr, rmarkdown, rlang, @@ -38,3 +39,4 @@ Imports: visOmopResults URL: https://oxford-pharmacoepi.github.io/phenotypeR/ VignetteBuilder: knitr + diff --git a/R/cohortDiagnostics.R b/R/cohortDiagnostics.R index 539ff23..de3670b 100644 --- a/R/cohortDiagnostics.R +++ b/R/cohortDiagnostics.R @@ -76,13 +76,45 @@ cohortDiagnostics <- function(cohort, attr(results[["cohort_summary"]], "settings")$result_id <- attr(results[["cohort_summary"]], "settings")$result_id * 10L + # cli::cli_bullets(c("*" = "{.strong Creating denominator for incidence and prevalence}")) + # denominatorTable <- omopgenerics::uniqueTableName() + # cdm <- IncidencePrevalence::generateDenominatorCohortSet( + # cdm = cdm, + # name = denominatorTable, + # ageGroup = list(c(0,17), + # c(18,64), + # c(65,199)), + # sex = c("Male", "Female", "Both"), + # daysPriorObservation = c(0, 180) + # ) + # + # cli::cli_bullets(c("*" = "{.strong Estimating incidence}")) + # results[["incidence"]] <- IncidencePrevalence::estimateIncidence( + # cdm = cdm, + # denominatorTable = denominatorTable, + # outcomeTable = cohortName, + # interval = "years", + # repeatedEvents = c(TRUE, FALSE), + # outcomeWashout = c(0, Inf), + # completeDatabaseIntervals = c(TRUE, FALSE), + # minCellCount = 0) + # + # cli::cli_bullets(c("*" = "{.strong Estimating prevalence}")) + # results[["prevalence"]] <- IncidencePrevalence::estimatePeriodPrevalence( + # cdm = cdm, + # denominatorTable = denominatorTable, + # outcomeTable = cohortName, + # interval = "years", + # completeDatabaseIntervals = c(TRUE, FALSE), + # fullContribution = c(TRUE, FALSE), + # minCellCount = 0) + cli::cli_bullets(c("*" = "{.strong Generating a age and sex matched cohorts}")) matchedCohortTable <- paste0(omopgenerics::tableName(cdm[[cohortName]]), "_matched") cdm[[matchedCohortTable]] <- CohortConstructor::matchCohorts(cdm[[cohortName]], name = matchedCohortTable) - cli::cli_bullets(c("*" = "{.strong Running large scale characterisation}")) results[["lsc"]] <- CohortCharacteristics::summariseLargeScaleCharacteristics( cohort = cdm[[matchedCohortTable]], diff --git a/inst/shiny/server.R b/inst/shiny/server.R index c0c5fbd..b1427a2 100644 --- a/inst/shiny/server.R +++ b/inst/shiny/server.R @@ -219,7 +219,7 @@ server <- function(input, output, session) { table[[7]] <- as.numeric(table[[7]]) } if(length(names(table))>=8){ - table[[8]] <- as.numeric(table[[7]]) + table[[8]] <- as.numeric(table[[8]]) } datatable(table, rownames= FALSE) diff --git a/tests/testthat/_snaps/shinyDiagnostics/diagnostics-001.json b/tests/testthat/_snaps/shinyDiagnostics/diagnostics-001.json deleted file mode 100644 index 8cfa0eb..0000000 --- a/tests/testthat/_snaps/shinyDiagnostics/diagnostics-001.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "input": { - - }, - "output": { - - }, - "export": { - - } -} diff --git a/tests/testthat/_snaps/shinyDiagnostics/diagnostics-001_.png b/tests/testthat/_snaps/shinyDiagnostics/diagnostics-001_.png deleted file mode 100644 index 06bd82a02f9f63c0d27a1b1883125af2ac15fe22..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7592 zcmeHM>rc~H7=9}V$lWYa7?-Na;KPs_aTqJ~hlI;W7&x{_#0`WnAzM=jcMwV$<6_v_ z51s2sX^Ufn2@x5MsR(VwhOn*(>j*12dc!ER{@OYyw9pGH`?73*!9JWX=S@!Dlk?`} zdCv2k_uRUilNsdyrau4#Wxbo02jHaxIQ+KXAfl!^7nF^!xkp_UMlB~2# zA2#&i>XUigYhDb!#a+z_{h;fKzGS>DJ1C&rc-?q8?gaaAzj3s9c$^Uy6VZK3c4zI= zabG&&hmO<<5l16QXoD&g^=Ah+vXTY~5N-NGRm*Z6%3!=(S|Z$0iJOI>P|yM=ovvgl-z!Bt<-?Woj(k zwKR7;afyhxU}1RvQ2oe9yjCGjuWfo%z{4Iqap8+B73RK50Nn#It>2PARH0f_nCd3g zG*a-f3c+cM%V;&N=}J5kBF>gtULWBqCr8vx{((yhNL`L;x-fc>t*or2P*$FjEF5u# z^=U~sFzPJ7o$7s_X(_#jXDcZf%< zmfkrM7Kv$uZd-^zH7q7U>O&pF7F!tw1 z=vmecb@O;q>-;S&x3bPe}lV z^u+;qi&{cLO!@0vd2faf=tN&Ta=*(bs=Bn!v!?)@F--@!d>x@M^?Si%OSWfB=}z$l zM(BTV?pFigck}?mr+y{Ci8Pe>uWJAu4*~_^%-@QLsDP+|sDP+|tO9aU|GblsDj-!r zs(@4hsRB|3qzb5)f;vd3!RBe7BU^}UA+m+Y79v~tKevT$>HBB=eU1X84}UW3X!_CH Q^Ysc@={aemsn Date: Tue, 27 Aug 2024 12:27:48 +0100 Subject: [PATCH 2/2] ggpubr --- DESCRIPTION | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 839aac6..60473ee 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -18,7 +18,8 @@ Suggests: knitr, RPostgres, PatientProfiles, - ggplot2 + ggplot2, + ggpubr Config/testthat/edition: 3 RoxygenNote: 7.3.2 Imports: