Skip to content

Commit

Permalink
Merge pull request #99 from ramses-antibiotics/develop
Browse files Browse the repository at this point in the history
Merge Ramses v0.5.0
  • Loading branch information
peterdutey committed Aug 27, 2022
2 parents c32bec1 + f70636f commit b152a5a
Show file tree
Hide file tree
Showing 93 changed files with 5,356 additions and 3,436 deletions.
2 changes: 1 addition & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
^\.idea
^_pkgdown\.yml$
^pkgdown$
^.*\.sqlite$
^.*\.duckdb$
^travis$
^vignettes/Mechanics-of-entities\.Rmd$
^vignettes/.*\.R$
Expand Down
46 changes: 29 additions & 17 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ on:
- develop
- 'feature/**'
- 'bug_fix/**'
pull_request:
branches:
- master
- develop

name: R-CMD-check

Expand Down Expand Up @@ -50,11 +46,11 @@ jobs:
steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}

- uses: r-lib/actions/setup-pandoc@v1
- uses: r-lib/actions/setup-pandoc@v2

- name: Query dependencies
run: |
Expand Down Expand Up @@ -86,23 +82,12 @@ jobs:
remotes::install_cran("rcmdcheck")
shell: Rscript {0}

# - name: Unit tests
# run: devtools::test()
# shell: Rscript {0}

- name: Check
env:
_R_CHECK_CRAN_INCOMING_REMOTE_: false
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
shell: Rscript {0}

# - name: Upload check results
# if: failure()
# uses: actions/upload-artifact@main
# with:
# name: ${{ runner.os }}-r${{ matrix.config.r }}-results
# path: check

- name: Code coverage
if: github.ref == 'refs/heads/master' && github.event_name == 'push' && matrix.config.os == 'ubuntu-20.04' && matrix.config.r == 'release'
run: covr::codecov(type = "all", quiet = FALSE, token = Sys.getenv("CODECOVETOKEN"))
Expand All @@ -121,3 +106,30 @@ jobs:
env:
PROJECT_ID: ramses-antibiotics
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}

- uses: r-lib/actions/setup-tinytex@v2
if: (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') && github.event_name == 'push' && matrix.config.os == 'ubuntu-20.04' && matrix.config.r == 'release'

- name: Install TeX
run: tlmgr --version
if: (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') && github.event_name == 'push' && matrix.config.os == 'ubuntu-20.04' && matrix.config.r == 'release'

- name: Build source and PDF manual
if: (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') && github.event_name == 'push' && matrix.config.os == 'ubuntu-20.04' && matrix.config.r == 'release'
run: |
devtools::install()
devtools::build(".", vignettes = TRUE, path = "~")
devtools::build_manual(".", path = "~")
shell: Rscript {0}

- uses: actions/upload-artifact@v3
if: (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') && github.event_name == 'push' && matrix.config.os == 'ubuntu-20.04' && matrix.config.r == 'release'
with:
name: Ramses package source
path: ~/Ramses_[0-9].[0-9].[0-9].tar.gz

- uses: actions/upload-artifact@v3
if: (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') && github.event_name == 'push' && matrix.config.os == 'ubuntu-20.04' && matrix.config.r == 'release'
with:
name: Ramses package manual
path: ~/Ramses_[0-9].[0-9].[0-9].pdf
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
doc
Meta
.idea
*.sqlite
*.duckdb
inst/doc
docs
22 changes: 13 additions & 9 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: Ramses
Type: Package
Title: R Package for Antimicrobial Stewardship & Surveillance
Version: 0.4.4
Version: 0.5.0
Authors@R: c(
person(given = "Peter",
family = "Dutey-Magni",
Expand All @@ -14,24 +14,26 @@ Authors@R: c(
email = "l.shallcross@ucl.ac.uk",
comment = c(ORCID = "0000-0003-1713-2555")),
person("University College London", role = c("cph")))
Description: A one-stop shop for antimicrobial stewardship data warehousing for hospitals.
Ramses supports the modelling and analysis of hospital electronic health records
(episodes of care, drug prescriptions and administrations, microbiology and
investigations results) to help keep antibiotics working for years to come.
Description: A package for data-driven hospital antimicrobial stewardship and
infection surveillance. Ramses supports the validation and analysis of
routine electronic health records (episodes of care, drug prescriptions and
administrations, microbiology and investigations results) to help monitor
prescribing and keep antibiotics working for years to come.
License: GPL-3
URL: https://github.com/ramses-antibiotics/ramses-package
BugReports: https://github.com/ramses-antibiotics/ramses-package/issues
Encoding: UTF-8
LazyData: true
Depends:
R (>= 3.2.0),
R (>= 3.6.0),
AMR (>= 1.8.0)
Imports:
RSQLite (>= 2.1.4),
DBI,
rlang,
dplyr (>= 1.0.1),
dbplyr (>= 2.1.0),
dbplyr (>= 2.2.0),
magrittr,
duckdb (>= 0.4.0),
Rdpack (>= 0.7),
data.table,
units (>= 0.7-0),
Expand All @@ -55,13 +57,15 @@ Suggests:
pkgdown (>= 2.0.0),
R.utils,
comorbidity,
RPostgres
RPostgres,
gh (>= 1.3.0)
Remotes:
ramses-antibiotics/snomedizer
RdMacros: Rdpack
RoxygenNote: 7.2.0
VignetteBuilder: knitr,rmarkdown
Collate:
'Ramses-deprecated.R'
'Ramses-package.R'
'objects.R'
'clinical_features.R'
Expand Down
25 changes: 17 additions & 8 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# Generated by roxygen2: do not edit by hand

export(Encounter)
export(MedicationRequest)
export(Patient)
export(Patient.DBIConnection)
export(Patient.RamsesObject)
export(TherapyEpisode)
export(TherapyEpisode.DBIConnection)
export(TherapyEpisode.RamsesObject)
export(TherapyEpisode.MedicationRequest)
export(bridge_encounter_therapy_overlap)
export(bridge_episode_prescription_initiation)
export(bridge_episode_prescription_overlap)
export(bridge_spell_therapy_overlap)
Expand All @@ -13,7 +17,8 @@ export(clinical_feature_interval)
export(clinical_feature_last)
export(clinical_feature_mean)
export(clinical_feature_ols_trend)
export(collect_ramses_tbl)
export(collect)
export(compute)
export(compute_DDDs)
export(connect_local_database)
export(create_mock_database)
Expand All @@ -26,6 +31,7 @@ export(load_inpatient_episodes)
export(load_inpatient_investigations)
export(load_inpatient_microbiology)
export(load_medications)
export(longitudinal_table)
export(map_ICD10_CCS)
export(map_ICD10_CCSR)
export(map_charlson_comorbidities)
Expand All @@ -40,6 +46,7 @@ export(validate_inpatient_episodes)
export(validate_investigations)
export(validate_microbiology)
export(validate_prescriptions)
exportClasses(Encounter)
exportClasses(MedicationRequest)
exportClasses(Patient)
exportClasses(RamsesObject)
Expand All @@ -48,20 +55,22 @@ exportMethods(clinical_feature_interval)
exportMethods(clinical_feature_last)
exportMethods(clinical_feature_mean)
exportMethods(clinical_feature_ols_trend)
exportMethods(therapy_table)
exportMethods(collect)
exportMethods(compute)
exportMethods(longitudinal_table)
exportMethods(show)
exportMethods(therapy_timeline)
import(methods)
importClassesFrom(RSQLite,SQLiteConnection)
importClassesFrom(duckdb,duckdb_connection)
importFrom(AMR,ab_atc)
importFrom(DBI,dbConnect)
importFrom(DBI,dbDisconnect)
importFrom(Rdpack,reprompt)
importFrom(data.table,":=")
importFrom(data.table,data.table)
importFrom(dbplyr,sql)
importFrom(dplyr,collect)
importFrom(dplyr,compute)
importFrom(dplyr,tbl)
importFrom(magrittr,"%>%")
importFrom(methods,is)
importFrom(methods,show)
importFrom(rlang,.data)
importFrom(stats,na.omit)
importFrom(units,set_units)
34 changes: 34 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,37 @@

# Ramses 0.5.0

*27 August 2022*

## Improvements

* Local databases (`connect_local_database()` and `create_mock_database()`)
are now powered by [DuckDB](https://duckdb.org/) rather than SQLite, bringing support for
datetime variable types and increased performance. Ramses now depends on
the [`duckdb`](https://CRAN.R-project.org/package=duckdb) library
* Added new S4 class `Encounter` [#92](https://github.com/ramses-antibiotics/ramses-package/issues/92)
to manipulate hospitalisations (admissions)
with associated methods for `show()`, `compute()`, `collect()`, `Patient()`,
`longitudinal_table()`, `clinical_feature_*()`, `therapy_timeline()`
* `TherapyEpisode()` and `Encounter()` have a new optional `extend_table_start` input
controlling their longitudinal table's start. This allows the creation of longitudinal
tables starting before the `therapy_start` or `admission_date`, respectively. More
detail is available from [`vignette("therapy-episodes")`](https://ramses-antibiotics.web.app/articles/therapy-episodes.html)
* Added `Patient()` function to create a `Patient` object from any other object
of class `RamsesObject`
* Improved documentation and export of S4 methods `compute()` and `collect()`.

## Breaking changes

* `therapy_table()` is now deprecated: use `longitudinal_table()` instead [#86](https://github.com/ramses-antibiotics/ramses-package/issues/86)
* `bridge_spell_therapy_overlap()` is now deprecated : use
`bridge_encounter_therapy_overlap()` instead [#86](https://github.com/ramses-antibiotics/ramses-package/issues/86)
* Database table `inpatient_episodes` and documentation now refer to 'encounters'
rather than 'spells'. Variable `spell_id` is now known as `encounter_id` [#86](https://github.com/ramses-antibiotics/ramses-package/issues/86).
Databases built with previous versions of Ramses will not work with Ramses 0.5.0
* Function signatures for all methods are standardised: function arguments
`object` are now changed to `x`, except for `show(object)`.
* Support for SQLite databases is withdrawn.

# Ramses 0.4.4

Expand All @@ -9,6 +42,7 @@
* `clinical_feature_*()` functions trigger a warning rather than an error if
no value matching `observation_code` is found in the`inpatient_investigations` table.


# Ramses 0.4.3

*2 August 2022*
Expand Down
56 changes: 56 additions & 0 deletions R/Ramses-deprecated.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@


#' Deprecated functions in package \pkg{Ramses}.
#'
#' @description The functions listed below are deprecated and will be defunct in
#' the near future. When possible, alternative functions with similar
#' functionality are also mentioned. Help pages for deprecated functions are
#' available at \code{help("<function>-deprecated")}.
#' \itemize{
#' \item{\code{\link[Ramses]{therapy_table}()} is now known as
#' \code{\link[Ramses]{longitudinal_table}()}}
#' }
#' @name Ramses-deprecated
#' @keywords internal
NULL


#' Get the therapy table (DEPRECATED)
#'
#' @param object an object of class \code{TherapyEpisode}
#' @param collect if \code{TRUE}, collect the remote \code{tbl_sql} and return a local
#' \code{tbl_df}. The default is \code{FALSE}, and simply returns the remote \code{tbl_sql}
#' @return an object of class \code{tbl}
#' @rdname therapy_table-deprecated
#' @description This function is now deprecated. Please use
#' \code{\link{longitudinal_table}()}.
#' @seealso \code{\link{Ramses-deprecated}}
#' @export
therapy_table <- function(object, collect = FALSE) {
.Deprecated("longitudinal_table")
longitudinal_table(
x = object,
collect = collect
)
}


#' Create database bridge tables
#'
#' @param conn a database connection
#' @param overwrite if \code{TRUE}, will overwrite any existing
#' database table. The default is \code{FALSE}
#' @rdname bridge_spell_therapy_overlap-deprecated
#' @description This function is now deprecated. Please use
#' \code{\link{bridge_encounter_therapy_overlap}()}.
#' @seealso \code{\link{bridge_tables}}, \code{\link{Ramses-deprecated}}
#' @export
bridge_spell_therapy_overlap <- function(conn,
overwrite = FALSE) {
.Deprecated("bridge_encounter_therapy_overlap")
bridge_encounter_therapy_overlap(
conn = conn,
overwrite = overwrite
)
}

Loading

0 comments on commit b152a5a

Please sign in to comment.