Skip to content

Commit

Permalink
Added vignette and updated README
Browse files Browse the repository at this point in the history
Merge pull request #37 from alwinw/rc0.9.6
  • Loading branch information
alwinw authored Jun 6, 2021
2 parents 72529cf + a55b68e commit f4570fa
Show file tree
Hide file tree
Showing 26 changed files with 807 additions and 64 deletions.
39 changes: 20 additions & 19 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
^renv$
^renv\.lock$
^CRAN-RELEASE$
^Meta$
^doc$
.covrignore
^_pkgdown\.yml$
^.*\.Rproj$
^\.Rproj\.user$
^packrat/
^.pytest_cache
^\.github$
^\.png$
^\.Rprofile$
^\.Rproj\.user$
^\.travis\.yml$
^README\.Rmd$
^README\.md$
^README-.*\.png$
^appveyor\.yml$
^cran-comments.md$
^\.png$
^README_cache/
^codecov\.yml$
.covrignore
^resources$
^_pkgdown\.yml$
^cran-comments.md$
^CRAN-RELEASE$
^data-raw$
^doc$
^docs$
^LICENSE\.md$
^Meta$
^packrat/
^pkgdown$
^\.github$
^data-raw$
^.pytest_cache
^README_cache/
^README-.*\.png$
^README\.md$
^README\.Rmd$
^renv\.lock$
^renv$
^resources$
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ vignettes/*.pdf
# R Environment Variables
.Renviron
.Rproj.user
inst/doc
10 changes: 7 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: epocakir
Title: Clinical Coding of Patients with Kidney Disease using Clinical Practice
Guidelines
Version: 0.9.5
Version: 0.9.6
Authors@R:
c(person(given = "Alwin",
family = "Wang",
Expand All @@ -16,7 +16,7 @@ Authors@R:
Description: Clinical coding and diagnosis of patients with kidney using
clinical practice guidelines. The guidelines used are the evidence-based
KDIGO guidelines. This package covers acute kidney injury (AKI), anemia,
and chronic liver disease(CKD).
and chronic liver disease (CKD).
License: MIT + file LICENSE
URL: https://github.com/alwinw/epocakir
BugReports: https://github.com/alwinw/epocakir/issues
Expand All @@ -36,8 +36,12 @@ Imports:
Suggests:
usethis,
testthat,
covr
covr,
knitr,
rmarkdown
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.1
VignetteBuilder: knitr
Language: en-US
23 changes: 2 additions & 21 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,2 @@
# MIT License

Copyright (c) 2021 Alwin Wang, Lisa Toh

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
YEAR: 2020
COPYRIGHT HOLDER: Alwin Wang, Lisa Toh
19 changes: 19 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2020 Alwin Wang, Lisa Toh

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export(as_metric)
export(binary2factor)
export(combine_date_time_cols)
export(combn_changes)
export(conversion_factors)
export(dob2age)
export(eGFR)
export(eGFR_adult_SCr)
Expand Down
141 changes: 141 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# epocakir 0.9.6

Initial CRAN submission

## Improvements

- Added vignette *Introduction to epocakir* with basic usage examples
- Updated README
- Added sample `clinical_obvs` to demonstrate utility functions

## Bug fixes

- Exported `conversion_factors`, similar to ordered factors like `aki_stages`
- Corrected mis-spelled words

# epocakir 0.9.5

Added sample data and better examples

## Improvements

- Added sample data based on test data
- Cleaned up code comments
- Added examples to methods

## Breaking Changes

- Renamed `aki()` to `aki_staging()` for more consistent method names

## Bug fixes

- Fixed bug when n < m for combn() in combn_changes()
- Changed methods from `method.default()` to `method.data.frame()` to prevent infinite recursion on incorrectly specified function arguments

# epocakir 0.9.0

Improved high level API functions

## Improvements

- Wrote new combined `eGFR()` function that automatically selects the appropriate `eGFR_method()` formula to use
- Wrote new combined `aki()` function that automatically calculates AKI based on all criteria and determines most severe stage
- Added additional tests including warnings

## Breaking Changes

- Added `No AKI` and `No Albuminuria` to stages ordered factors to prevent users have to handle `NAs` mixed with ordered factors

## Bug fixes

- Fixed bug in `eGFR_internal()` where it was looking for `!is.na(black)` to select `eGFR_adult_SCysC()`, when `black` was not required

# epocakir 0.8.0

Initial full-featured release of epocakir methods

## Improvements

- Wrote `aki_SCr()` function
- Methods now include `aki_bCr`, `aki_SCr`, `aki_UO`, `anemia`, `eGFR_adult_SCr`, `eGFR_adult_SCysC`, `eGFR_adult_SCr_SCysC`, `eGFR_child_SCr`, `eGFR_child_SCr_BUN`, `eGFR_child_SCysC`, `GFR_staging`, `Albuminuria_staging_AER`, `Albuminuria_staging_ACR` and `combn_changes`

## Bug fixes

- Used `tibble::tibble()` instead of `data.frame()` to prevent issue with `stringsasfactors` difference between R 3.x and R 4.x
- Fixed sorting error in `aki_UO()

# epocakir 0.7.0

Re-wrote methods for consistency

## Improvements

- Removed duplicate `GFR_staging()` code
- Stricter `expect_identical()` instead of `expect_equal()` assertions
- Rewrote `anemia()` to make method selection consistent with other functions

## Bug fixes

- Consistent parameter naming

# epocakir 0.6.0

Re-wrote all eGFR functions as S3 methods

## Improvements

- Wrote `eGFR_adult_SCr`, `eGFR_adult_SCysC`, `eGFR_adult_SCr_SCysC`, `eGFR_child_SCr`, `eGFR_child_SCr_BUN`, `eGFR_child_SCysC` methods

## Breaking changes

- Instead of individual functions, use methods for all low-level functions
- Renamed functions to snake_case, e.g. `eGFR.adult.SCr_SCysC` to `eGFR_adult_SCr_SCysC`

# epocakir 0.5.0

Improved handling of function arguments

## Improvements

- Changed from `forcats::fct_c` to `vctrs::vec_c` for improved `NA` handling (<https://github.com/tidyverse/forcats/issues/250>)
- Wrote `aki_bCr()` method
- Allow symbols to be passed to methods

## Breaking changes

- Added version numbers to dependencies

# epocakir 0.4.0

Added testing and additional utility functions to package

## Improvements

- Testing of edge-cases for `as_metric(NULL)`, `as_metric(1)` and unknown measurements
- Wrote `as_metric()`
- Additional KDIGO guidelines (<https://kdigo.org/guidelines/>) added
- Added Albuminuria levels as an ordered factor

## Bug fix

- Correctly use `pmin` instead of `min` in eGFR calculation

# epocakir 0.1.5

dplyr compatible functions

## Improvements

- Proper handling of column names using dplyr programming (<https://dplyr.tidyverse.org/articles/programming.html>)
- Wrote `aki_bCr` calculation as part of `aki()` staging
- Wrote `.dob2age()` function to calculate a patient's age

# epocakir 0.1.0

Initial release

## Improvements

- Wrote `combn_changes()`
- Wrote `conversion_factors()`
- Wrote initial functions based on KDIGO guidelines (<https://kdigo.org/guidelines/>)
2 changes: 1 addition & 1 deletion R/aki.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ aki_stages <- factor(
#' The staging (1, 2, 3) of AKI is returned.
#'
#' When multiple columns are provided, `aki_staging()` will automatically
#' calculate whether or not AKI has occurred using each KDIGIO definition.
#' calculate whether or not AKI has occurred using each KDIGO definition.
#'
#' \itemize{
#' \item{[`aki_bCr()`]: Staging of AKI based on baseline serum creatinine}
Expand Down
2 changes: 1 addition & 1 deletion R/anemia.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#' See <https://kdigo.org/guidelines/anemia-in-ckd/> for more details.
#'
#' @param .data (data.frame) A data.frame, optional
#' @param Hb Hemoglobin concenration
#' @param Hb Hemoglobin concentration
#' column name, or vector of units or numeric if `.data` is not provided
#' @param age Age of patient
#' column name, or vector of units or numeric if `.data` is not provided
Expand Down
2 changes: 1 addition & 1 deletion R/ckd.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#' column name, or vector of logical (TRUE/FALSE) if `.data` is not provided
#' @param black Black race or not
#' column name, or vector of logical (TRUE/FALSE) if `.data` is not provided
#' @param pediatric (logical) Paediatric or not
#' @param pediatric (logical) Pediatric or not
#' column name, or vector of logical (TRUE/FALSE) if `.data` is not provided
#' @param ... Further optional arguments
#'
Expand Down
7 changes: 7 additions & 0 deletions R/data-clinical_obs.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#' Clinical Patient Data
#'
#' A sample dataset to demonstrate utility functions in `epocakir`
#'
#' @examples
#' clinical_obvs
"clinical_obvs"
5 changes: 4 additions & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ NULL
#' \item{mol_weight}{Molecular weight (where required)}
#' \item{description}{Full name}
#' }
#' @export
#' @examples
#' epocakir:::conversion_factors
#' conversion_factors
conversion_factors <- tibble::tribble(
~parameter, ~metric_units, ~mol_weight, ~description,
# General
Expand Down Expand Up @@ -60,6 +61,8 @@ conversion_factors <- tibble::tribble(

#' Convert a measured value to metric units
#'
#' Refer to [`conversion_factors`] for a full list of available conversions
#'
#' @param param (character) Name of measurement, e.g. param = "SCr"
#' @param meas (units) Measurement or vector of measurements
#' @param ... (units) One of conversion_factors$parameter,
Expand Down
Loading

0 comments on commit f4570fa

Please sign in to comment.