From 596cf575841db4e9d5e33e11e5055ff12b68da22 Mon Sep 17 00:00:00 2001 From: Stef van Buuren Date: Wed, 8 May 2024 13:26:35 +0200 Subject: [PATCH 1/2] Improve chart side initialization when there are child data (#33) --- R/convert_tgt_chartadvice.R | 3 +++ R/select_chart.R | 14 ++++++-------- man/convert_tgt_chartadvice.Rd | 4 ++++ man/select_chart.Rd | 2 +- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/R/convert_tgt_chartadvice.R b/R/convert_tgt_chartadvice.R index 25f4a1b..e914643 100644 --- a/R/convert_tgt_chartadvice.R +++ b/R/convert_tgt_chartadvice.R @@ -44,6 +44,9 @@ #' @author Stef van Buuren 2020 #' @seealso [chartcatalog::parse_chartcode()] #' @keywords server +#' @examples +#' test25 <- system.file("extdata/bds_v3.0/test/test25.json", package = "jamesdemodata") +#' james:::convert_tgt_chartadvice(txt = test25) #' @export convert_tgt_chartadvice <- function(txt = "", session = "", diff --git a/R/select_chart.R b/R/select_chart.R index 3280b9a..f8dbe1a 100644 --- a/R/select_chart.R +++ b/R/select_chart.R @@ -36,7 +36,7 @@ select_chart <- function(target = NULL, sex = NULL, etn = NULL, ga = NULL, - side = "hgt", + side = NULL, language = "dutch") { # choose defaults depending on individual @@ -66,13 +66,11 @@ select_chart <- function(target = NULL, select_side <- function(tgt) { yname <- timedata(tgt)[["yname"]] - if (any(c("hgt", "wgt", "hdc") %in% yname)) { - return("hgt") - } - if (any(c("dsc") %in% yname)) { - return("dsc") - } - "hgt" + gro <- intersect(yname, c("hgt", "wgt", "hdc", "bmi", "wfh")) + dev <- intersect(yname, c("dsc")) + if (length(gro)) return(gro[1L]) + if (length(dev)) return(dev[1L]) + return("hgt") } select_ga <- function(tgt) { diff --git a/man/convert_tgt_chartadvice.Rd b/man/convert_tgt_chartadvice.Rd index a987e2d..d2e5136 100644 --- a/man/convert_tgt_chartadvice.Rd +++ b/man/convert_tgt_chartadvice.Rd @@ -94,6 +94,10 @@ and age range of the data. The function is called at initialization to automate setting of proper chart and analysis defaults according to the child data. } +\examples{ +test25 <- system.file("extdata/bds_v3.0/test/test25.json", package = "jamesdemodata") +james:::convert_tgt_chartadvice(txt = test25) +} \seealso{ \code{\link[chartcatalog:parse_chartcode]{chartcatalog::parse_chartcode()}} } diff --git a/man/select_chart.Rd b/man/select_chart.Rd index 21fdf0b..b32ffde 100644 --- a/man/select_chart.Rd +++ b/man/select_chart.Rd @@ -11,7 +11,7 @@ select_chart( sex = NULL, etn = NULL, ga = NULL, - side = "hgt", + side = NULL, language = "dutch" ) } From 4ce4f8aa043da7b817f0e3a551a69740beccd120 Mon Sep 17 00:00:00 2001 From: Stef van Buuren Date: Wed, 8 May 2024 13:52:22 +0200 Subject: [PATCH 2/2] Update to james 1.6.2 --- DESCRIPTION | 4 ++-- renv.lock | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 4a9c798..3707331 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: james Type: Package Title: Joint Automatic Measurement and Evaluation System -Version: 1.6.1 +Version: 1.6.2 Authors@R: c(person("Stef", "van Buuren", email = "stef.vanbuuren@tno.nl", role = c("cre", "aut")), person("Arjan", "Huizing", email = "arjan.huizing@tno.nl", role = "aut")) Maintainer: Stef van Buuren @@ -18,7 +18,7 @@ Depends: Imports: bdsreader (>= 0.25.0), chartbox (>= 1.15.0), - chartcatalog (>= 1.14.0), + chartcatalog (>= 1.15.0), chartplotter (>= 0.33.0), dplyr, curl, diff --git a/renv.lock b/renv.lock index 30af3f7..4ed762d 100644 --- a/renv.lock +++ b/renv.lock @@ -257,18 +257,18 @@ }, "chartcatalog": { "Package": "chartcatalog", - "Version": "1.14.0", + "Version": "1.15.0", "Source": "GitHub", "RemoteType": "github", "RemoteHost": "api.github.com", - "RemoteUsername": "growthcharts", "RemoteRepo": "chartcatalog", - "RemoteRef": "master", - "RemoteSha": "2965c368995d1aba5ec60876715fe0cacc2f6e66", + "RemoteUsername": "growthcharts", + "RemoteRef": "HEAD", + "RemoteSha": "7d70397852be5b632568929de9ade3c7e8d5aa30", "Requirements": [ "R" ], - "Hash": "36092c39c78b912d476f0d093fc7120f" + "Hash": "0a92495cbade86de4bf83bedbd785e2e" }, "chartplotter": { "Package": "chartplotter",