diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml
index a3ea0c3d..605a5775 100644
--- a/.github/workflows/check.yaml
+++ b/.github/workflows/check.yaml
@@ -6,55 +6,55 @@ on:
branches:
- main
-name: check
-
jobs:
- check:
- runs-on: ${{ matrix.config.os }}
-
- name: ${{ matrix.config.os }} (${{ matrix.config.r }})
+ R-CMD-check:
+ name: R CMD check (${{ matrix.os }})
+ runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
- config:
- - {os: macOS-latest, r: 'release'}
- - {os: windows-latest, r: 'release'}
- - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- - {os: ubuntu-latest, r: 'release'}
- - {os: ubuntu-latest, r: 'oldrel-1'}
-
- env:
- R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
- GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
- R_KEEP_PKG_SOURCE: yes
+ os: ['ubuntu-latest']
steps:
- - uses: actions/checkout@v2
-
- - uses: r-lib/actions/setup-tinytex@v2
- - run: tlmgr --version
-
- - uses: r-lib/actions/setup-pandoc@v2
-
- - uses: r-lib/actions/setup-r@v2
- with:
- r-version: ${{ matrix.config.r }}
- http-user-agent: ${{ matrix.config.http-user-agent }}
- use-public-rspm: true
-
- - uses: r-lib/actions/setup-r-dependencies@v2
+ - uses: actions/checkout@v4
+ - name: Set up Conda env
+ uses: mamba-org/provision-with-micromamba@e2b397b12d0a38069451664382b769c9456e3d6d
with:
- extra-packages: |
- any::rcmdcheck
- eth-mds/mimic-demo
- eth-mds/eicu-demo
- nbenn/mockthat
-
- - uses: r-lib/actions/check-r-package@v2
+ cache-env: true
+ - name: Install TinyTex
+ shell: bash -l {0}
+ run: |
+ Rscript -e 'tinytex::install_tinytex()'
+ - name: Install demo datasets
+ shell: bash -l {0}
+ run: |
+ Rscript -e 'install.packages("eicu.demo", repos="https://eth-mds.github.io/physionet-demo")'
+ - name: Run R CMD check
+ shell: bash -l {0}
+ run: |
+ R CMD build . && R CMD check --no-manual --as-cran $(ls -t . | head -n1)
env:
_R_CHECK_CRAN_INCOMING_: false
_R_CHECK_FORCE_SUGGESTS_: false
- _R_CHECK_DOC_SIZES_: false
- with:
- upload-snapshots: true
+ # R CMD check raises a warning by qpdf that the generated docs PDF is large and
+ # should be compressed. Currently we ignore this warning via the grep below.
+ - name: Check for warnings
+ shell: bash -l {0}
+ run: |
+ CHECK_LOG_FILE=ricu.Rcheck/00check.log
+ CHECK_INSTALL_FILE=ricu.Rcheck/00install.out
+ if ! [[ -f "$CHECK_LOG_FILE" ]]; then
+ echo "Log-file not found."
+ exit 1
+ fi
+ if cat $CHECK_LOG_FILE | grep -q "ERROR"; then
+ cat $CHECK_INSTALL_FILE
+ cat $CHECK_LOG_FILE
+ exit 1
+ fi
+ if cat $CHECK_LOG_FILE | grep -q "WARNING" | grep -q -v -e "checking sizes of PDF files under ‘inst/doc’ ... WARNING"; then
+ echo "Found warnings, treated as errors."
+ cat $CHECK_LOG_FILE
+ exit 1
+ fi
\ No newline at end of file
diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml
deleted file mode 100644
index 393a7a9a..00000000
--- a/.github/workflows/coverage.yaml
+++ /dev/null
@@ -1,36 +0,0 @@
-on:
- push:
- branches:
- - main
- pull_request:
- branches:
- - main
-
-name: coverage
-
-jobs:
- coverage:
- runs-on: ubuntu-latest
- env:
- GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
-
- steps:
- - uses: actions/checkout@v2
-
- - uses: r-lib/actions/setup-r@v2
- with:
- use-public-rspm: true
-
- - uses: r-lib/actions/setup-pandoc@v2
-
- - uses: r-lib/actions/setup-r-dependencies@v2
- with:
- extra-packages: |
- any::covr
- eth-mds/mimic-demo
- eth-mds/eicu-demo
- nbenn/mockthat
-
- - name: Test coverage
- run: covr::codecov(quiet = FALSE)
- shell: Rscript {0}
diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml
deleted file mode 100644
index a80a385a..00000000
--- a/.github/workflows/pkgdown.yaml
+++ /dev/null
@@ -1,48 +0,0 @@
-on:
- push:
- branches:
- - main
- pull_request:
- branches:
- - main
-
-name: pkgdown
-
-jobs:
- pkgdown:
- runs-on: ubuntu-latest
- env:
- GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
-
- steps:
- - uses: actions/checkout@v2
-
- - uses: r-lib/actions/setup-tinytex@v2
- - run: tlmgr --version
-
- - uses: r-lib/actions/setup-pandoc@v2
-
- - uses: r-lib/actions/setup-r@v2
- with:
- use-public-rspm: true
-
- - uses: r-lib/actions/setup-r-dependencies@v2
- with:
- extra-packages: |
- any::pkgdown
- local::.
- eth-mds/mimic-demo
- eth-mds/eicu-demo
- nbenn/mockthat
-
- - name: Build site
- run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
- shell: Rscript {0}
-
- - name: Deploy to GitHub pages 🚀
- if: github.event_name != 'pull_request'
- uses: JamesIves/github-pages-deploy-action@4.1.4
- with:
- clean: false
- branch: gh-pages
- folder: docs
diff --git a/DESCRIPTION b/DESCRIPTION
index c04c3c3e..0d1a966b 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -70,7 +70,7 @@ Suggests:
pdftools,
magick,
pillar
-RoxygenNote: 7.2.3
+RoxygenNote: 7.3.1
Additional_repositories: https://eth-mds.github.io/physionet-demo
VignetteBuilder: knitr
Config/testthat/edition: 3
diff --git a/NAMESPACE b/NAMESPACE
index e189dc15..919b9727 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -92,12 +92,14 @@ S3method(do_callback,fun_itm)
S3method(do_callback,hrd_itm)
S3method(do_callback,itm)
S3method(do_callback,rec_cncpt)
+S3method(do_callback,sic_itm)
S3method(do_itm_load,col_itm)
S3method(do_itm_load,default)
S3method(do_itm_load,fun_itm)
S3method(do_itm_load,hrd_itm)
S3method(do_itm_load,itm)
S3method(do_itm_load,nul_itm)
+S3method(do_itm_load,sic_itm)
S3method(downgrade_id,default)
S3method(downgrade_id,id_tbl)
S3method(downgrade_id,ts_tbl)
@@ -126,6 +128,7 @@ S3method(id_map_helper,default)
S3method(id_map_helper,src_env)
S3method(id_orig_helper,default)
S3method(id_orig_helper,miiv_env)
+S3method(id_orig_helper,sic_env)
S3method(id_orig_helper,src_env)
S3method(id_vars,col_cfg)
S3method(id_vars,default)
@@ -139,6 +142,7 @@ S3method(id_win_helper,eicu_env)
S3method(id_win_helper,hirid_env)
S3method(id_win_helper,miiv_env)
S3method(id_win_helper,mimic_env)
+S3method(id_win_helper,picdb_env)
S3method(id_win_helper,sic_env)
S3method(import_src,aumc_cfg)
S3method(import_src,character)
@@ -164,6 +168,7 @@ S3method(init_itm,hrd_itm)
S3method(init_itm,itm)
S3method(init_itm,rgx_itm)
S3method(init_itm,sel_itm)
+S3method(init_itm,sic_itm)
S3method(interval,default)
S3method(interval,difftime)
S3method(interval,itm)
@@ -188,6 +193,7 @@ S3method(load_difftime,eicu_tbl)
S3method(load_difftime,hirid_tbl)
S3method(load_difftime,miiv_tbl)
S3method(load_difftime,mimic_tbl)
+S3method(load_difftime,picdb_tbl)
S3method(load_difftime,sic_tbl)
S3method(load_id,character)
S3method(load_id,default)
@@ -232,6 +238,7 @@ S3method(prepare_query,default)
S3method(prepare_query,hrd_itm)
S3method(prepare_query,rgx_itm)
S3method(prepare_query,sel_itm)
+S3method(prepare_query,sic_itm)
S3method(print,cncpt)
S3method(print,id_tbl)
S3method(print,itm)
diff --git a/R/data-env.R b/R/data-env.R
index 5f409e85..7e141ced 100644
--- a/R/data-env.R
+++ b/R/data-env.R
@@ -239,6 +239,10 @@ NULL
#' @rdname data_env
NULL
+#' @name picdb
+#' @rdname data_env
+NULL
+
data_env <- function() get("data", envir = pkg_env(), mode = "environment")
#' Data source environments
diff --git a/environment.yaml b/environment.yaml
deleted file mode 100644
index f8cb700d..00000000
--- a/environment.yaml
+++ /dev/null
@@ -1,21 +0,0 @@
-name: ricu
-channels:
- - nodefaults
- - conda-forge
-dependencies:
- - r-base
- - r-data.table
- - r-curl
- - r-assertthat
- - r-fst
- - r-readr
- - r-jsonlite
- - r-prt>=0.1.2
- - r-tibble
- - r-backports
- - r-rlang
- - r-vctrs
- - r-cli>=2.1.0
- - r-fansi
- - r-openssl
- - r-utils
\ No newline at end of file
diff --git a/test_environment.yaml b/environment.yml
similarity index 76%
rename from test_environment.yaml
rename to environment.yml
index 9c0c12a8..c94682a9 100644
--- a/test_environment.yaml
+++ b/environment.yml
@@ -1,4 +1,4 @@
-name: ricu-test
+name: ricu
channels:
- nodefaults
- conda-forge
@@ -18,7 +18,6 @@ dependencies:
- r-cli>=2.1.0
- r-fansi
- r-openssl
- - r-units
# optional
- r-rticles
- r-forestmodel
@@ -29,4 +28,13 @@ dependencies:
- r-cowplot
- r-knitr
- r-pdftools
- - r-covr
\ No newline at end of file
+ - r-covr
+ - r-units
+ - r-tinytex
+ - r-testthat
+ - r-mockthat
+ - r-pkgload
+ - r-codetools
+ - r-qpdf
+ - qpdf
+ - r-mimic.demo
\ No newline at end of file
diff --git a/man/change_id.Rd b/man/change_id.Rd
index 6193adf5..561869a9 100644
--- a/man/change_id.Rd
+++ b/man/change_id.Rd
@@ -57,19 +57,34 @@ and \code{downgrade_id()} when the target ID system is of lower cardinality
}
\details{
In order to provide ID system conversion for a data source, the (internal)
-function [id_map()] must be able to construct an ID mapping for that data
+function \code{\link[=id_map]{id_map()}} must be able to construct an ID mapping for that data
source. Constructing such a mapping can be expensive w.r.t. the frequency
-it might be re-used and therefore, [id_map()] provides caching
+it might be re-used and therefore, \code{\link[=id_map]{id_map()}} provides caching
infrastructure. The mapping itself is constructed by the (internal)
-function [id_map_helper()], which is expected to provide source and
+function \code{\link[=id_map_helper]{id_map_helper()}}, which is expected to provide source and
destination ID columns as well as start and end columns corresponding to
the destination ID, relative to the source ID system. In the following
-example, we request for `mimic_demo`, with ICU stay IDs as source and
+example, we request for \code{mimic_demo}, with ICU stay IDs as source and
hospital admissions as destination IDs.
-```{r, eval = is_data_avail("mimic_demo")}
-id_map_helper(mimic_demo, "icustay_id", "hadm_id")
-```
+\if{html}{\out{
}}\preformatted{id_map_helper(mimic_demo, "icustay_id", "hadm_id")
+#> # An `id_tbl`: 136 x 4
+#> # Id var: `icustay_id`
+#> icustay_id hadm_id hadm_id_start hadm_id_end
+#>
+#> 1 201006 198503 -3291 mins 9113 mins
+#> 2 201204 114648 -2 mins 6949 mins
+#> 3 203766 126949 -1336 mins 8818 mins
+#> 4 204132 157609 -1 mins 10103 mins
+#> 5 204201 177678 -369 mins 9444 mins
+#> ...
+#> 132 295043 170883 -10413 mins 31258 mins
+#> 133 295741 176805 -2 mins 3152 mins
+#> 134 296804 110244 -1295 mins 4598 mins
+#> 135 297782 167612 -1 mins 207 mins
+#> 136 298685 151323 -1 mins 19082 mins
+#> # i 131 more rows
+}\if{html}{\out{
}}
Both start and end columns encode the hospital admission windows relative
to each corresponding ICU stay start time. It therefore comes as no
@@ -78,22 +93,21 @@ occurs before ICU stay start time), while end times are often days in the
future (as hospital discharge typically occurs several days after ICU
admission).
-In order to use the ID conversion infrastructure offered by `ricu` for a
-new dataset, it typically suffices to provide an `id_cfg` entry in the
-source configuration (see [load_src_cfg()]), outlining the available ID
+In order to use the ID conversion infrastructure offered by \code{ricu} for a
+new dataset, it typically suffices to provide an \code{id_cfg} entry in the
+source configuration (see \code{\link[=load_src_cfg]{load_src_cfg()}}), outlining the available ID
systems alongside an ordering, as well as potentially a class specific
-implementation of [id_map_helper()] for the given source class, specifying
+implementation of \code{\link[=id_map_helper]{id_map_helper()}} for the given source class, specifying
the corresponding time windows in 1 minute resolution (for every possible
pair of IDs).
-While both up- and downgrades for `id_tbl` objects, as well as downgrades
-for `ts_tbl` objects are simple merge operations based on the ID mapping
-provided by [id_map()], ID upgrades for `ts_tbl` objects are slightly more
-involved. As an example, consider the following setting: we have `data`
-associated with `hadm_id` IDs and times relative to hospital admission:
+While both up- and downgrades for \code{id_tbl} objects, as well as downgrades
+for \code{ts_tbl} objects are simple merge operations based on the ID mapping
+provided by \code{\link[=id_map]{id_map()}}, ID upgrades for \code{ts_tbl} objects are slightly more
+involved. As an example, consider the following setting: we have \code{data}
+associated with \code{hadm_id} IDs and times relative to hospital admission:
-```
- 1 2 3 4 5 6 7 8
+\if{html}{\out{}}\preformatted{ 1 2 3 4 5 6 7 8
data ---*------*-------*--------*-------*-------*--------*------*---
3h 10h 18h 27h 35h 43h 52h 59h
@@ -103,17 +117,17 @@ hadm_id |-------------------------------------------------------------|
icustay_id |------------------| |---------------|
0h 19h 0h 16h
ICU_1 ICU_2
-```
+}\if{html}{\out{
}}
-The mapping of data points from `hadm_id` to `icustay_id` is created as
+The mapping of data points from \code{hadm_id} to \code{icustay_id} is created as
follows: ICU stay end times mark boundaries and all data that is recorded
after the last ICU stay ended is assigned to the last ICU stay. Therefore
-data points 1-3 are assigned to `ICU_1`, while 4-8 are assigned to `ICU_2`.
+data points 1-3 are assigned to \code{ICU_1}, while 4-8 are assigned to \code{ICU_2}.
Times have to be shifted as well, as timestamps are expected to be relative
to the current ID system. Data points 1-3 therefore are assigned to time
stamps -4h, 3h and 11h, while data points 4-8 are assigned to -10h, -2h,
6h, 15h and 22h. Implementation-wise, the mapping is computed using an
-efficient `data.table` rolling join.
+efficient \code{data.table} rolling join.
}
\examples{
if (require(mimic.demo)) {
diff --git a/man/data_env.Rd b/man/data_env.Rd
index 1e4e4430..0f064f8d 100644
--- a/man/data_env.Rd
+++ b/man/data_env.Rd
@@ -12,6 +12,7 @@
\alias{aumc}
\alias{miiv}
\alias{sic}
+\alias{picdb}
\title{ICU datasets}
\format{
The exported \code{data} environment contains all datasets that have been made
@@ -43,57 +44,100 @@ hosted data source is available as well. As with the PhysioNet datasets,
access is public but has to be granted by the data collectors.
}
\details{
-Setting up a dataset for use with `ricu` requires a configuration object.
+Setting up a dataset for use with \code{ricu} requires a configuration object.
For the included datasets, configuration can be loaded from
-```
-system.file("extdata", "config", "data-sources.json", package = "ricu")
-```
+\if{html}{\out{}}\preformatted{system.file("extdata", "config", "data-sources.json", package = "ricu")
+}\if{html}{\out{
}}
-by calling [load_src_cfg()] and for dataset that are external to `ricu`,
+by calling \code{\link[=load_src_cfg]{load_src_cfg()}} and for dataset that are external to \code{ricu},
additional configuration can be made available by setting the environment
-variable `RICU_CONFIG_PATH` (for more information, refer to
-[load_src_cfg()]). Using the dataset configuration object, data can be
-downloaded ([download_src()]), imported ([import_src()]) and attached
-([attach_src()]). While downloading and importing are one-time procedures,
+variable \code{RICU_CONFIG_PATH} (for more information, refer to
+\code{\link[=load_src_cfg]{load_src_cfg()}}). Using the dataset configuration object, data can be
+downloaded (\code{\link[=download_src]{download_src()}}), imported (\code{\link[=import_src]{import_src()}}) and attached
+(\code{\link[=attach_src]{attach_src()}}). While downloading and importing are one-time procedures,
attaching of the dataset is repeated every time the package is loaded.
Briefly, downloading loads the raw dataset from the internet (most likely
-in `.csv` format), importing consists of some preprocessing to make the
-data available more efficiently (by converting it to [`.fst`][fst::fst()]
+in \code{.csv} format), importing consists of some preprocessing to make the
+data available more efficiently (by converting it to \code{\link[fst:fst]{.fst}}
format) and attaching sets up the data for use by the package. For more
information on the individual steps, refer to the respective documentation
pages.
A dataset that has been successfully made available can interactively be
explored by typing its name into the console and individual tables can be
-inspected using the `$` function. For example for the MIMIC-III demo
-dataset and the `icustays` table, this gives
+inspected using the \code{$} function. For example for the MIMIC-III demo
+dataset and the \code{icustays} table, this gives
-```{r, eval = is_data_avail("mimic_demo")}
-mimic_demo
+\if{html}{\out{}}\preformatted{mimic_demo
+#>
+#> admissions callout caregivers chartevents
+#> [129 x 19] [77 x 24] [7,567 x 4] [758,355 x 15]
+#> cptevents d_cpt d_icd_diagnoses d_icd_procedures
+#> [1,579 x 12] [134 x 9] [14,567 x 4] [3,882 x 4]
+#> d_items d_labitems datetimeevents diagnoses_icd
+#> [12,487 x 10] [753 x 6] [15,551 x 14] [1,761 x 5]
+#> drgcodes icustays inputevents_cv inputevents_mv
+#> [297 x 8] [136 x 12] [34,799 x 22] [13,224 x 31]
+#> labevents microbiologyevents outputevents patients
+#> [76,074 x 9] [2,003 x 16] [11,320 x 13] [100 x 8]
+#> prescriptions procedureevents_mv procedures_icd services
+#> [10,398 x 19] [753 x 25] [506 x 5] [163 x 6]
+#> transfers
+#> [524 x 13]
mimic_demo$icustays
-```
+#> # : [136 x 12]
+#> # ID options: subject_id (patient) < hadm_id (hadm) < icustay_id (icustay)
+#> # Defaults: `intime` (index), `last_careunit` (val)
+#> # Time vars: `intime`, `outtime`
+#> row_id subject_id hadm_id icustay_id dbsource first_careunit last_careunit
+#>
+#> 1 12742 10006 142345 206504 carevue MICU MICU
+#> 2 12747 10011 105331 232110 carevue MICU MICU
+#> 3 12749 10013 165520 264446 carevue MICU MICU
+#> 4 12754 10017 199207 204881 carevue CCU CCU
+#> 5 12755 10019 177759 228977 carevue MICU MICU
+#> ...
+#> 132 42676 44083 198330 286428 metavision CCU CCU
+#> 133 42691 44154 174245 217724 metavision MICU MICU
+#> 134 42709 44212 163189 239396 metavision MICU MICU
+#> 135 42712 44222 192189 238186 metavision CCU CCU
+#> 136 42714 44228 103379 217992 metavision SICU SICU
+#> # i 131 more rows
+#> # i 5 more variables: first_wardid , last_wardid , intime ,
+#> # outtime , los
+}\if{html}{\out{
}}
Table subsets can be loaded into memory for example using the
-[base::subset()] function, which uses non-standard evaluation (NSE) to
+\code{\link[base:subset]{base::subset()}} function, which uses non-standard evaluation (NSE) to
determine a row-subsetting. This design choice stems form the fact that
some tables can have on the order of 10^8 rows, which makes loading full
tables into memory an expensive operation. Table subsets loaded into
-memory are represented as [`data.table`][data.table::data.table()] objects.
+memory are represented as \code{\link[data.table:data.table]{data.table}} objects.
Extending the above example, if only ICU stays corresponding to the patient
-with `subject_id == 10124` are of interest, the respective data can be
+with \code{subject_id == 10124} are of interest, the respective data can be
loaded as
-```{r, eval = is_data_avail("mimic_demo")}
-subset(mimic_demo$icustays, subject_id == 10124)
-```
+\if{html}{\out{}}\preformatted{subset(mimic_demo$icustays, subject_id == 10124)
+#> row_id subject_id hadm_id icustay_id dbsource first_careunit last_careunit
+#>
+#> 1: 12863 10124 182664 261764 carevue MICU MICU
+#> 2: 12864 10124 170883 222779 carevue MICU MICU
+#> 3: 12865 10124 170883 295043 carevue CCU CCU
+#> 4: 12866 10124 170883 237528 carevue MICU MICU
+#> first_wardid last_wardid intime outtime los
+#>
+#> 1: 23 23 2192-03-29 10:46:51 2192-04-01 06:36:00 2.8258
+#> 2: 50 50 2192-04-16 20:58:32 2192-04-20 08:51:28 3.4951
+#> 3: 7 7 2192-04-24 02:29:49 2192-04-26 23:59:45 2.8958
+#> 4: 23 23 2192-04-30 14:50:44 2192-05-15 23:34:21 15.3636
+}\if{html}{\out{ }}
-Much care has been taken to make `ricu` extensible to new datasets. For
-example the publicly available ICU database [AmsterdamUMCdb
-](https://amsterdammedicaldatascience.nl/amsterdamumcdb/)
+Much care has been taken to make \code{ricu} extensible to new datasets. For
+example the publicly available ICU database \href{https://amsterdammedicaldatascience.nl/amsterdamumcdb/}{AmsterdamUMCdb }
provided by the Amsterdam University Medical Center, currently is not part
-of the core datasets of `ricu`, but code for integrating this dataset is
-available on [github](https://github.com/eth-mds/aumc).
+of the core datasets of \code{ricu}, but code for integrating this dataset is
+available on \href{https://github.com/eth-mds/aumc}{github}.
}
\section{MIMIC-III}{
diff --git a/man/data_items.Rd b/man/data_items.Rd
index e9fb9414..5255e5b2 100644
--- a/man/data_items.Rd
+++ b/man/data_items.Rd
@@ -6,6 +6,7 @@
\alias{init_itm}
\alias{init_itm.sel_itm}
\alias{init_itm.hrd_itm}
+\alias{init_itm.sic_itm}
\alias{init_itm.col_itm}
\alias{init_itm.rgx_itm}
\alias{init_itm.fun_itm}
@@ -26,6 +27,8 @@ init_itm(x, ...)
\method{init_itm}{hrd_itm}(x, table, sub_var, ids, callback = "identity_callback", ...)
+\method{init_itm}{sic_itm}(x, table, sub_var, ids, callback = "identity_callback", ...)
+
\method{init_itm}{col_itm}(x, table, unit_val = NULL, callback = "identity_callback", ...)
\method{init_itm}{rgx_itm}(x, table, sub_var, regex, callback = "identity_callback", ...)
diff --git a/man/data_utils.Rd b/man/data_utils.Rd
index 32216a45..765ac3c2 100644
--- a/man/data_utils.Rd
+++ b/man/data_utils.Rd
@@ -5,6 +5,7 @@
\alias{id_orig_helper}
\alias{id_orig_helper.src_env}
\alias{id_orig_helper.miiv_env}
+\alias{id_orig_helper.sic_env}
\alias{id_windows}
\alias{id_win_helper}
\alias{id_win_helper.mimic_env}
@@ -13,6 +14,7 @@
\alias{id_win_helper.hirid_env}
\alias{id_win_helper.aumc_env}
\alias{id_win_helper.miiv_env}
+\alias{id_win_helper.picdb_env}
\alias{id_map}
\alias{id_map_helper}
\alias{id_map_helper.src_env}
@@ -26,6 +28,8 @@ id_orig_helper(x, id)
\method{id_orig_helper}{miiv_env}(x, id)
+\method{id_orig_helper}{sic_env}(x, id)
+
id_windows(x, copy = TRUE)
id_win_helper(x)
@@ -42,6 +46,8 @@ id_win_helper(x)
\method{id_win_helper}{miiv_env}(x)
+\method{id_win_helper}{picdb_env}(x)
+
id_map(x, id_var, win_var, in_time = NULL, out_time = NULL)
id_map_helper(x, id_var, win_var)
diff --git a/man/file_utils.Rd b/man/file_utils.Rd
index b9955f9b..a732de84 100644
--- a/man/file_utils.Rd
+++ b/man/file_utils.Rd
@@ -31,7 +31,8 @@ directory}
\item{srcs}{Character vector of data source names, an object for which an
\code{src_name()} method is defined or an arbitrary-length list thereof.}
-\item{name}{File name of the configuration file (\code{.json} will be appended)}
+\item{name}{File name of the configuration file (\code{.json} will be appended)
+or name of a folder containing multiple configuration files.}
\item{cfg_dirs}{Character vector of directories searched for config files}
diff --git a/man/label_sep3.Rd b/man/label_sep3.Rd
index 9fd07593..e9ac7d43 100644
--- a/man/label_sep3.Rd
+++ b/man/label_sep3.Rd
@@ -55,7 +55,90 @@ increase in SOFA score.
The Sepsis-3 Consensus (Singer et. al.) defines sepsis as an acute
increase in the SOFA score (see \code{\link[=sofa_score]{sofa_score()}}) of 2 points or more within
the suspected infection (SI) window (see \code{\link[=susp_inf]{susp_inf()}}):
-\figure{sofa-sep-3-1.png}
+
+\if{html}{\out{}}\preformatted{#| sofa-sep-3,
+#| echo = FALSE,
+#| engine.opts = list(
+#| extra.preamble = c(
+#| "\\\\usepackage\{pgfplots\}", "\\\\pgfplotsset\{compat=newest\}"
+#| )
+#| )
+
+\\begin\{tikzpicture\}
+
+ \\draw (-5.5, 0) -- (3.5, 0);
+ \\draw (-5.5, -0.2) -- (-5.5, 0.2);
+ \\draw (3.5, -0.2) -- (3.5, 0.2);
+ \\draw (0.5, -0.2) -- (0.5, 0.2);
+
+ \\node[align = center] at (0.5, 0.5) \{SI time\};
+ \\node[align = center] at (3.5, 0.5) \{SI window end\};
+ \\node[align = center] at (-5.5, -0.5) \{SI window start\};
+
+ \\draw (-1.5, -0.2) -- (-1.5, 0.2);
+ \\draw[dashed] (-1.5, 2) -- (-1.5, 0);
+ \\node[align = center] at (-1.5, -0.5) \{Sepsis-3 time\};
+
+ \\node[align = center] at (-2.75, 0.5) \{-48 hours\};
+ \\node[align = center] at (2, -0.5) \{24 hours\};
+
+ \\draw[dashed] (0.5, 0) -- (0.5, -1);
+
+ \\draw (0.5, -1) -- (3.5, -1);
+ \\draw (3.5, -1.2) -- (3.5, -0.8);
+ \\draw (0.5, -1.2) -- (0.5, -0.8);
+
+ \\node at (5.25, -1) \{within 24 hours\};
+
+ \\node[align = center] at (0.5, -1.5) \{ABX\};
+ \\node[align = center] at (3.5, -1.5) \{Sampling\};
+
+ \\draw (0.5, -2) -- (9.5, -2);
+ \\draw (9.5, -2.2) -- (9.5, -1.8);
+ \\draw (0.5, -2.2) -- (0.5, -1.8);
+
+ \\node[align = center] at (5.25, -2.5) \{within 72 hours\};
+
+ \\node[align = center] at (0.5, -2.5) \{Sampling\};
+ \\node[align = center] at (9.5, -2.5) \{ABX\};
+
+ \\draw [decorate, decoration = \{brace, mirror, amplitude=5pt, raise=4pt\},
+ yshift=0pt] (0, -0.9) -- (0, -2.1);
+ \\node at (-3, -1.5) \{Either option is permissible\};
+
+ \\filldraw (-6, 1.5) circle (1pt);
+ \\draw (-6, 1.5) -- (-5.5, 1.5);
+ \\filldraw (-5.5, 1.5) circle (1pt);
+ \\draw (-5.5, 1.5) -- (-5, 1);
+ \\filldraw (-5, 1) circle (1pt);
+ \\draw (-5, 1) -- (-4.5, 1);
+ \\filldraw (-4.5, 1) circle (1pt);
+ \\draw (-4.5, 1) -- (-4, 1);
+ \\filldraw (-4, 1) circle (1pt);
+ \\draw (-4, 1) -- (-3.5, 1);
+ \\filldraw (-3.5, 1) circle (1pt);
+ \\draw (-3.5, 1) -- (-3, 1.5);
+ \\filldraw (-3, 1.5) circle (1pt);
+ \\draw (-3, 1.5) -- (-2.5, 1.5);
+ \\filldraw (-2.5, 1.5) circle (1pt);
+ \\draw (-2.5, 1.5) -- (-2, 1.5);
+ \\filldraw (-2, 1.5) circle (1pt);
+ \\draw (-2, 1.5) -- (-1.5, 2.0);
+ \\filldraw (-1.5, 2.0) circle (1pt);
+
+ \\draw [decorate, decoration = \{brace, amplitude=5pt, mirror, raise=4pt\},
+ yshift=0pt] (-1.25, 1) -- (-1.25, 2);
+ \\node [black] at (0.25, 1.5) \{$\\Delta$SOFA $\\geq 2$\};
+
+ \\draw (-6.5, 1) -- (-6.5, 2.5);
+ \\node at (-6.5, 3) \{SOFA\};
+ \\draw (-6.5, 1) -- (-6.6, 1) node[left]\{0\};
+ \\draw (-6.5, 1.5) -- (-6.6, 1.5) node[left]\{1\};
+ \\draw (-6.5, 2) -- (-6.6, 2) node[left]\{2\};
+ \\draw (-6.5, 2.5) -- (-6.6, 2.5) node[left]\{3\};
+
+\\end\{tikzpicture\}
+}\if{html}{\out{
}}
A patient can potentially have multiple SI windows. The argument
\code{si_window} is used to control which SI window we focus on (options are
diff --git a/man/load_src.Rd b/man/load_src.Rd
index cf0c3dbc..a20ec4d3 100644
--- a/man/load_src.Rd
+++ b/man/load_src.Rd
@@ -11,6 +11,7 @@
\alias{load_difftime.aumc_tbl}
\alias{load_difftime.miiv_tbl}
\alias{load_difftime.sic_tbl}
+\alias{load_difftime.picdb_tbl}
\alias{load_difftime.character}
\title{Low level functions for loading data}
\usage{
@@ -76,6 +77,15 @@ load_difftime(x, ...)
...
)
+\method{load_difftime}{picdb_tbl}(
+ x,
+ rows,
+ cols = colnames(x),
+ id_hint = id_vars(x),
+ time_vars = ricu::time_vars(x),
+ ...
+)
+
\method{load_difftime}{character}(x, src, ...)
}
\arguments{
diff --git a/vignettes/ricu.Rmd b/vignettes/ricu.Rmd
index 63e74a9b..06ce22e8 100644
--- a/vignettes/ricu.Rmd
+++ b/vignettes/ricu.Rmd
@@ -73,7 +73,9 @@ pkgdown:
options(
width = 76,
kableExtra.latex.load_packages = FALSE,
- crayon.enabled = FALSE
+ crayon.enabled = FALSE,
+ message = FALSE,
+ warning = FALSE
)
library(ricu)
@@ -653,7 +655,7 @@ subset(mimic_demo$admissions, subject_id > 44000, language:ethnicity)
This syntax makes it possible to read row-subsets of *long* tables into memory with little memory overhead. While terseness of such an API does introduce potential ambiguity, this is mostly overcome by using the tidy eval framework provided by \pkg{rlang} \citep{wickham2020}:
-```{r mimic-tidy, eval = srcs_avail("mimic_demo")}
+```{r mimic-tidy, eval = srcs_avail("mimic_demo"), message = FALSE}
subject_id <- 44000:45000
subset(mimic_demo$admissions, .data$subject_id %in% .env$subject_id,
subject_id:dischtime)