Closed stefvanbuuren closed 6 months ago
Here's a reprex. Select preterm chart and age group, then gestational age is initialised at 36 instead of 32.
# Check whether the pre-term slider initialises at correct GA when
# a preterm child has no data during ages 0-4 years
# If needed
# remotes::install_github("growthcharts/bdsreader")
# remotes::install_github("growthcharts/jamesclient")
# remotes::install_github("growthcharts/jamesdemodata")
library(jamesclient)
library(bdsreader)
library(httr)
library(jsonlite)
fn <- system.file("extdata", "bds_v3.0", "terneuzen", "T_5270.json",
package = "jamesdemodata", mustWork = TRUE)
data <- bdsreader::read_bds(fn)
# set ga to 224 days and remove measures <4 years
data$psn$gad <- 224
data$psn$bw <- 2000
data$xyz <- data$xyz[data$xyz$age > 4, ]
js <- bdsreader::write_bds(data)
# upload to james
host <- "https://james.groeidiagrammen.nl" # 1.6.2
# host <- "http://localhost" # 1.6.3
r <- james_post(host = host, path = "site/request/json", sitehost = host, txt = js)
browseURL(r$parsed)
Created on 2024-05-12 with reprex v2.1.0
james 1.6.4
resolves this issue. It saves the ga
field from the data and uses it to initialize the week sliders for ga.
For a pre-term child with only data over 4 years the week slider is not initialised at always to 36 weeks. In that case, the app will first properly display charts for terms (since there are no preterm charts over age > 4y). When the user then requests a preterm chart, it will be initialised at 36 week rather than the real gestational age. For the correct chart, the user needs to manually set the proper week, which is inconvenient and error-prone.
This is unexpected behaviour. The desired situation is that JAMES presents the chart on the observed gestational age.