Skip to content

Commit

Permalink
Merge pull request #55 from OxfordIHTM/dev
Browse files Browse the repository at this point in the history
refactor cod_check_code
  • Loading branch information
ernestguevarra authored Jun 24, 2024
2 parents a33d2d4 + 5ae7919 commit e75a989
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 29 deletions.
3 changes: 2 additions & 1 deletion R/cod_check_code.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ cod_check_code <- function(cod, version = c("icd10", "icd11"), sex) {
.data$cod_check_sex
),
na.rm = TRUE
)
) |>
(\(x) ifelse(x == 0, 0, 1))()
)
}

Expand Down
26 changes: 0 additions & 26 deletions R/create_ill_defined_icd11.R

This file was deleted.

27 changes: 27 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,30 @@ list_ill_defined_icd11 <- function() {
c(set1, set2, set3)
}


#'
#' Create vector of ill-defined ICD 11 codes
#'
#' Based on https://icdcdn.who.int/icd11referenceguide/en/html/index.html#list-of-illdefined-conditions
#'

list_ill_defined_icd11 <- function() {
## Create vector of ill-defined heart failure BD10-BD1Z ----
set1 <- codigo::icd11_linearization_mms |>
dplyr::filter(
.data$ChapterNo == 11 & stringr::str_detect(.data$Code, pattern = "BD")
) |>
dplyr::slice(1:11) |>
dplyr::pull(.data$Code)

## Create vector of ill-defined others ----
set2 <- c("BA2Z", "BE2Y", "BE2Z", "CB41.0", "CB41.2", "KB2D", "KB2E")

## Get codes for Chapter 21 except MA15, MG43, MG44.1, MH11, MH15 ----
set3 <- codigo::icd11_linearization_mms |>
dplyr::filter(.data$ChapterNo == 21) |>
dplyr::filter(!.data$Code %in% c("MA15", "MG43", "MG44.1", "MH11", "MH15")) |>
dplyr::pull(.data$Code)

c(set1, set2, set3)
}
4 changes: 2 additions & 2 deletions man/list_ill_defined_icd11.Rd

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

0 comments on commit e75a989

Please sign in to comment.