Load concept dictionaries
Data concepts can be specified in JSON format as a concept dictionary which
can be read and parsed into concept
/item
objects. Dictionary loading
can either be performed on the default included dictionary or on a user-
specified custom dictionary. Furthermore, a mechanism is provided for adding
concepts and/or data sources to the existing dictionary (see the Details
section).
load_dictionary( src = NULL, concepts = NULL, name = "concept-dict", cfg_dirs = NULL )
src |
|
concepts |
A character vector used to subset the concept dictionary or
|
name |
Name of the dictionary to be read |
cfg_dirs |
File name of the dictionary |
A default dictionary is provided at
system.file( file.path("extdata", "config", "concept-dict.json"), package = "ricu" )
and can be loaded in to an R session by calling
get_config("concept-dict")
. The default dictionary can be extended by
adding a file concept-dict.json
to the path specified by the environment
variable RICU_CONFIG_PATH
. New concepts can be added to this file and
existing concepts can be extended (by adding new data sources).
Alternatively, load_dictionary()
can be called on non-default
dictionaries using the file
argument.
In order to specify a concept as JSON object, for example the numeric concept for glucose, is given by
{ "glu": { "unit": "mg/dL", "min": 0, "max": 1000, "description": "glucose", "category": "chemistry", "sources": { "mimic_demo": [ { "ids": [50809, 50931], "table": "labevents", "sub_var": "itemid" } ] } } }
concept( name = "glu", items = item( src = "mimic_demo", table = "labevents", sub_var = "itemid", ids = list(c(50809L, 50931L)) ), description = "glucose", category = "chemistry", unit = "mg/dL", min = 0, max = 1000 )
The arguments src
and concepts
can be used to only load a subset of a
dictionary by specifying a character vector of data sources and/or concept
names.
A concept
object containing several data concepts as cncpt
objects.
if (require(mimic.demo)) { head(load_dictionary("mimic_demo")) load_dictionary("mimic_demo", c("glu", "lact")) }
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.