Derive advice on chart choice from data
Source:R/convert_tgt_chartadvice.R
convert_tgt_chartadvice.RdThe function loads individual data from an url, calculates the chartcode and returns a list of parsed chartcode 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.
Usage
convert_tgt_chartadvice(
txt = "",
session = "",
format = "1.0",
chartcode = "",
selector = c("data", "chartcode"),
loc = "",
ind_loc = "",
...
)Arguments
- txt
A JSON string, URL, or file with BDS data in JSON format. Data should conform to the BDS JGZ 3.2.5 specification.
- session
OpenCPU session key with the uploaded data
- format
JSON schema version, e.g.,
"3.0". Used when uploading.- chartcode
Optional. The code of the requested growth chart.
- selector
Either
"chartcode","data"or"derive". The function can calculate the chart code by looking at the child data (method"data") or user input (method"derive"). More in detail, the following behaviour decides between growth charts:"data"Calculate chart code from the individual data. This setting chooses the "optimal" chart for a given individual set of data.
"derive"Calculate chart code from a combination of user data:
chartgrp,agegrp,side,sex,etn,ga. The method does not use individual data. Use this setting when chart choice needs to be reactive on user input."chartcode"Take string specified in
chartcode
If there is a valid
tgtobject, then the function simply obeys theselectorsetting. If no validtgtobject is found, the"chartcode"argument is taken. However, if the"chartcode"is empty, then the function selects method"derive".- loc
Deprecated. Use
sessioninstead.- ind_loc
Legacy. Will disappear in Nov 2022. Use
locinstead.- ...
Ignored
Value
A list with the following elements
populationA string identifying the population, e.g.
'NL','MA','TU'or'PT'.sexA string
"male","female"or"undifferentiated".designA letter indicating the chart design:
'A'= 0-15m,'B'= 0-4y,'C'= 1-21y,'D'= 0-21y,'E'= 0-4ya.sideA string indicating the side or
yname:'front','back','both','hgt','wgt','hdc','bmi','wfh'languageThe language in which the chart is drawn. Currently only
"dutch"charts are implemented, but forpopulation == "PT"we may also have"english".weekA scalar indicating the gestational age at birth. Only used if
population == "PT".chartcodeA string indicating the chart code.
chartgrpA string indicating the chart group, either
"nl2010","preterm","who","gsed1","gsed1pt".agegrpA string indicating the age group, either
"0-15m","0-4y","1-21y"or"0-21y".dnrA string indicating the donor dataset for matching, either
"smocc","lollypop","terneuzen"or"pops".slider_listA string indicating the set of slider labels, either
"0_2","0_4"or"0_29".periodA character vector of two elements, indicating the first and last period for the matching analysis, e.g. like
c("3m", "14m").
Examples
test25 <- system.file("extdata/bds_v3.0/test/test25.json", package = "jamesdemodata")
james:::convert_tgt_chartadvice(txt = test25)
#> $population
#> [1] "WHOpink"
#>
#> $sex
#> [1] "female"
#>
#> $design
#> [1] "A"
#>
#> $side
#> [1] "dsc"
#>
#> $language
#> [1] "dutch"
#>
#> $week
#> [1] 39
#>
#> $chartcode
#> [1] "WMADN40"
#>
#> $chartgrp
#> [1] "who"
#>
#> $agegrp
#> [1] "0-15m"
#>
#> $dnr
#> [1] "0-2"
#>
#> $slider_list
#> [1] "0_2"
#>
#> $period
#> [1] "14m" "14m"
#>
#> $accordion
#> [1] "ontwikkeling"
#>