Skip to content

Commit

Permalink
updated vignette
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewallenbruce committed Apr 9, 2024
1 parent 5e32c87 commit 4a11092
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 42 deletions.
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export(gt_style)
export(icd10api)
export(icd10cm)
export(is_valid_icd)
export(is_valid_icd10cm)
export(mount_board)
export(remove_dot)
export(search_edits)
Expand Down
22 changes: 14 additions & 8 deletions R/checks.R
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
#' Check if string is valid ICD-10-CM code
#' @param x `<chr>` string of `length(1)`
#'
#' @param x `<chr>` string of `length(x) == 1`
#'
#' @param arg `<chr>` function argument name in the current function
#' @param call `<environment>` environment the function is called from
#' @return `<lgl>` `TRUE` if valid, `FALSE` otherwise
#'
#' @param call `<env>` environment the function is called from
#'
#' @returns `<lgl>` vector; `TRUE` if valid, `FALSE` otherwise
#'
#' @examples
#' purrr::map_vec(
#' c("H00.019", "D50.1", "C4A.70", "Z20.818", "11646", "E8015"),
#' is_valid_icd)
#'
#' @export
#' @autoglobal
#'
#' @export
is_valid_icd <- function(x,
arg = rlang::caller_arg(x),
call = rlang::caller_env()) {
Expand All @@ -32,14 +38,14 @@ is_valid_icd <- function(x,

#' Check if an ICD-10-CM code is in a valid format
#'
#' @description
#' `is_valid_icd10cm` checks to see if the ICD-10-CM code is valid
#' `is_valid_icd10cm()` checks to see if the ICD-10-CM code is valid
#' and has between 3 and 8 characters, and starts with a letter and number.
#'
#' @param x A string
#'
#' @return Boolean
#' @export
#' @returns Boolean
#'
#' @noRd
#'
#' @examples
#' is_valid_icd10cm("F320") # valid
Expand Down
5 changes: 2 additions & 3 deletions R/icd_10_cm.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
#' @template returns
#'
#' @examples
#' icd10cm(
#' c("F50.8", "G40.311", "Q96.8", "Z62.890", "R45.4", "E06.3", "H00.019", "D50.1", "C4A.70")
#' )
#' icd10cm( c("F50.8", "G40.311", "Q96.8", "Z62.890", "R45.4", "E06.3",
#' "H00.019", "D50.1", "C4A.70") )
#'
#' @autoglobal
#'
Expand Down
5 changes: 2 additions & 3 deletions man/icd10cm.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/is_valid_icd.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 0 additions & 24 deletions man/is_valid_icd10cm.Rd

This file was deleted.

18 changes: 18 additions & 0 deletions vignettes/pathologie.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,21 @@ While the call below returns only the ICD-10 **codes** containing "Z":
icd10api(icd_code = "z", field = "code", limit = 50)
```


# ICD-10-CM Code Edits

```{r}
ex_data() |>
dplyr::mutate(patient_age = years_floor(date_of_birth,
date_of_service)) |>
dplyr::left_join(search_edits()) |>
dplyr::filter(icd_conflict_group == "Age") |>
dplyr::mutate(conflict = apply_age_edits(rule = icd_conflict_rule,
age = patient_age)) |>
dplyr::filter(!is.na(conflict)) |>
dplyr::select(-icd_conflict_group, -conflict) |>
gt(groupname_col = "icd_conflict_rule",
row_group_as_column = TRUE) |>
gt_style()
```

0 comments on commit 4a11092

Please sign in to comment.