Skip to content

Commit

Permalink
add icd10lookups + dev status
Browse files Browse the repository at this point in the history
  • Loading branch information
dosgillespie committed Nov 28, 2020
1 parent 8914583 commit 46102ca
Show file tree
Hide file tree
Showing 109 changed files with 1,617 additions and 488 deletions.
9 changes: 5 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: tobalcepi
Type: Package
Title: Risk Functions and Attributable Fractions for Tobacco and Alcohol
Version: 1.2.2
Version: 1.3.0
Authors@R:
c(
person(given = "Duncan",
Expand Down Expand Up @@ -42,9 +42,10 @@ Imports:
testthat,
dplyr,
data.table,
Rdpack
RdMacros: Rdpack
Rdpack,
lifecycle
RdMacros: Rdpack, lifecycle
VignetteBuilder: knitr
RoxygenNote: 7.1.0
RoxygenNote: 7.1.1
Depends:
R (>= 2.10)
14 changes: 3 additions & 11 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
# Generated by roxygen2: do not edit by hand

export(AlcBinge)
export(AlcBinge_stapm)
export(AlcLags)
export(ExpandCodes)
export(PArisk)
export("\\lifecycle{experimental}")
export("\\lifecycle{maturing}")
export("\\lifecycle{stable}")
export(RRFunc)
export(RRTobDR)
export(RRalc)
export(RRtob)
export(TobAlcInt)
export(TobLags)
export(WArisk_acute)
export(subgroupRisk)
import(data.table)
importFrom(Rdpack,reprompt)
importFrom(data.table,":=")
Expand Down
2 changes: 2 additions & 0 deletions R/AlcBinge.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#' @return Returns data plus the estimated variables.
#' @importFrom data.table := setDT setnames
#' @export
#'
#' \lifecycle{stable}
#'
#' @examples
#'
Expand Down
2 changes: 2 additions & 0 deletions R/AlcBinge_stapm.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#' @return Returns data plus the estimated variables.
#' @importFrom data.table := setDT setnames
#' @export
#'
#' \lifecycle{maturing}
#'
#' @examples
#'
Expand Down
2 changes: 2 additions & 0 deletions R/AlcLags.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#' on an individual's relative risk of disease has so far emerged.
#' @importFrom data.table := setDT setnames
#' @export
#'
#' \lifecycle{stable}
#'
#' @examples
#' \dontrun{
Expand Down
2 changes: 2 additions & 0 deletions R/ExpandCodes.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#' @importFrom data.table := setDT setnames
#' @export
#'
#' \lifecycle{stable}
#'
#' @examples
#'
#' \dontrun{
Expand Down
2 changes: 2 additions & 0 deletions R/PArisk.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
#' @importFrom data.table := setDT setnames
#' @export
#'
#' \lifecycle{stable}
#'
#' @examples
#'
#' \dontrun{
Expand Down
2 changes: 2 additions & 0 deletions R/RRAlc.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
#' @return Returns a numeric vector of each individual's relative risks for the alcohol related disease specified by "disease".
#' @importFrom data.table := setDT setnames
#' @export
#'
#' \lifecycle{stable}
#'
#' @examples
#'
Expand Down
1 change: 1 addition & 0 deletions R/RRFunc.R
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
#' @seealso \code{\link{RRalc}} for alcohol-specific risks, \code{\link{RRtob}} for tobacco-specific risks,
#' \code{\link{AlcLags}} for alcohol-specific lag times, and \code{\link{TobLags}} for tobacco-specific lag times.
#'
#' \lifecycle{maturing}
#'
#' @examples
#' \dontrun{
Expand Down
3 changes: 3 additions & 0 deletions R/RRTobDR.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
#' @importFrom data.table := setDT setnames
#' @export
#'
#' \lifecycle{experimental}
#'
#'
#' @examples
#'
#' \dontrun{
Expand Down
2 changes: 2 additions & 0 deletions R/RRtob.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
#' specified by "disease".
#' @importFrom data.table := setDT setnames
#' @export
#'
#' \lifecycle{maturing}
#'
#' @examples
#'\dontrun{
Expand Down
2 changes: 2 additions & 0 deletions R/TobAlcInt.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#'
#' \insertRef{Prabhu2014}{tobalcepi}
#'
#' \lifecycle{maturing}
#'
#' @examples
#'
#' \dontrun{
Expand Down
2 changes: 2 additions & 0 deletions R/TobLags.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
#' @importFrom data.table := setDT setnames
#' @export
#'
#' \lifecycle{stable}
#'
#' @examples
#'
#' TobLags("Pharynx")
Expand Down
2 changes: 2 additions & 0 deletions R/WArisk_acute.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
#' @return Returns a numeric vector of each individual's relative risk of the acute consequences of drinking.
#' @importFrom data.table := setDT setnames
#' @export
#'
#' \lifecycle{stable}
#'
#' @examples
#'
Expand Down
18 changes: 18 additions & 0 deletions R/alc_icd10_lookups.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

#' Diseases related to alcohol and their ICD-10 defintions
#'
#' Deaths in the mortality data are assigned a single ICD-10 code e.g. C00,
#' but for our analysis we need to group these into cause-groups according to groups e.g. C00-C06.
#' To do this, we define each group by its consituent ICD-10 codes e.g. C00, C01, C02, C03, C04, C05, C06.
#'
#' @docType data
#'
#' @format A data table
#'
#' @source Our alcohol disease list in the folder PR_Disease_Risk_TA
#'
#'
#'
#'
#'
"alc_icd10_lookups"
2 changes: 2 additions & 0 deletions R/subgroupRisk.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#' @return Returns a data table containing the subgroup specific summaries for each disease.
#' @importFrom data.table := setDT setnames
#' @export
#'
#' \lifecycle{stable}
#'
#' @examples
#' \dontrun{
Expand Down
18 changes: 18 additions & 0 deletions R/tob_icd10_lookups.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

#' Diseases related to tobacco and their ICD-10 defintions
#'
#' Deaths in the mortality data are assigned a single ICD-10 code e.g. C00,
#' but for our analysis we need to group these into cause-groups according to groups e.g. C00-C06.
#' To do this, we define each group by its consituent ICD-10 codes e.g. C00, C01, C02, C03, C04, C05, C06.
#'
#' @docType data
#'
#' @format A data table
#'
#' @source Our tobacco disease list in the folder PR_Disease_Risk_TA
#'
#'
#'
#'
#'
"tob_icd10_lookups"
18 changes: 18 additions & 0 deletions R/tobalc_icd10_lookups.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

#' Diseases related to both tobacco and alcohol and their ICD-10 defintions
#'
#' Deaths in the mortality data are assigned a single ICD-10 code e.g. C00,
#' but for our analysis we need to group these into cause-groups according to groups e.g. C00-C06.
#' To do this, we define each group by its consituent ICD-10 codes e.g. C00, C01, C02, C03, C04, C05, C06.
#'
#' @docType data
#'
#' @format A data table
#'
#' @source Our joint tobacco and alcohol disease list in the folder PR_Disease_Risk_TA
#'
#'
#'
#'
#'
"tobalc_icd10_lookups"
4 changes: 3 additions & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ knitr::opts_chunk$set(
```
# tobalcepi <img src="tools/tobalcepi_hex.png" align="right" style="padding-left:10px;background-color:white;" width="100" height="100" />

<!-- badges: start -->
[![Lifecycle: maturing](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://www.tidyverse.org/lifecycle/#maturing)
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
<!-- badges: end -->

**DRAFT WORKING VERSION** - Some code and documentation is still incomplete or in need of being refined. The code and documentation are still undergoing internal review by the analyst team.

## Motivation
The motivation for `tobalcepi` was to organise how we store, process and use the information on the risks of disease that stem from tobacco and/or alcohol consumption, including to provide functions to easily use these risk estimates in modelling.
Expand Down
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@

# tobalcepi <img src="tools/tobalcepi_hex.png" align="right" style="padding-left:10px;background-color:white;" width="100" height="100" />

<!-- badges: start -->

[![Lifecycle:
maturing](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://www.tidyverse.org/lifecycle/#maturing)
[![Project Status: Active – The project has reached a stable, usable
state and is being actively
developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)

**DRAFT WORKING VERSION** - Some code and documentation is still
incomplete or in need of being refined. The code and documentation are
still undergoing internal review by the analyst team.
developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
<!-- badges: end -->

## Motivation

Expand Down Expand Up @@ -217,8 +218,8 @@ Tobacco and Alcohol. R package version x.x.x.

Angus, Colin, M Henney, L Webster, and Duncan Gillespie. 2018.
“Alcohol-Attributable Diseases and Dose-Response Curves for the
Sheffield Alcohol Policy Model Version 4.0.”
<https://doi.org/10.15131/shef.data.6819689.v1>.
Sheffield Alcohol Policy Model Version 4.0.” The University of
Sheffield. <https://doi.org/10.15131/shef.data.6819689.v2>.

</div>

Expand Down
3 changes: 3 additions & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ reference:
- subtitle: Disease definitions and relative risks
contents:
- tob_disease_names
- tob_icd10_lookups
- tobacco_relative_risks
- RRtob
- RRTobDR
Expand All @@ -41,6 +42,7 @@ reference:
- subtitle: Disease definitions and relative risks
contents:
- alc_disease_names
- alc_icd10_lookups
- RRalc
- subtitle: Disease risk linked to intoxication
contents:
Expand All @@ -58,6 +60,7 @@ reference:
contents:
- TobAlcInt
- tob_alc_risk_int
- tobalc_icd10_lookups

- title: Misc
contents:
Expand Down
58 changes: 58 additions & 0 deletions data-raw/alcohol_disease_names.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@

# This code stores the list of the names of diseases that are attributable to tobacco and alcohol

# doing this helps to keep the formatting of disease names consistent

library(data.table)
library(readxl)

# Set the file path to point to the University of Sheffield X drive
root_dir <- "/Volumes/"


##########################################

# Load the data


AlcList <- readxl::read_excel(paste0(root_dir,
"ScHARR/PR_Disease_Risk_TA/Code/tables/16102018tobaccoandalcoholDiseaseListandRiskFunctions.xlsx"),
sheet = "Alcohol")

# Set it as a data table
data.table::setDT(AlcList)

# Columns names to consistent lower case
setnames(AlcList, colnames(AlcList), tolower(colnames(AlcList)))

##########################################

# Save disease names

alc_disease_names <- as.character(c(unique(AlcList$condition)))


usethis::use_data(alc_disease_names, overwrite = T)

##########################################

# Save ICD-10 lookups

# The aim of this code is to prepare lists of tobacco and alcohol related diseases
# with their corresponding ICD-10 codes

# These data are used to search for the relevant conditions
# in the process of preparing the mortality and hospitalisation rates
# for use in the modelling


alc_icd10_lookups <- AlcList[ , c("condition", "icd10_lookups")]

alc_icd10_lookups[stringr::str_detect(condition, "Oesoph"), condition := "Oesophageal"]

alc_icd10_lookups <- unique(alc_icd10_lookups, by = "icd10_lookups")

usethis::use_data(alc_icd10_lookups, overwrite = T)



21 changes: 0 additions & 21 deletions data-raw/disease_names.R

This file was deleted.

Loading

0 comments on commit 46102ca

Please sign in to comment.