dxUniform: Code format transformation

dxUniformR Documentation

Code format transformation

Description

These two functions can convert the ICD diagnostic codes to a uniform format.

Usage

icdDxDecimalToShort(
  dxDataFile,
  icdColName,
  dateColName,
  icdVerColName = NULL,
  icd10usingDate = NULL
)

icdDxShortToDecimal(
  dxDataFile,
  icdColName,
  dateColName,
  icdVerColName = NULL,
  icd10usingDate = NULL
)

Arguments

dxDataFile

A data frame object of clinical diagnostic data with at least 2 columns: ICD, and Date. As for date column, the data format should be YYYY/MM/DD or YYYY-MM-DD.

icdColName

Column name of ICD column in dxDataFile. Data type of this argumant should be string without quotation marks.

dateColName

Column name of date column in dxDataFile, and the type of date column should be a date format in R or a string format with date information in YYYY/MM/DD or YYYY-MM-DD. Data type of this argumant should be string without quotation marks.

icdVerColName

(Optional) Column name if there is a columns to record ICD-9/10 version used in dxDataFile. In this column, data format should be numeric 9L or 10L to indicate which ICD version is used for each cell. See examples below to get more information.

icd10usingDate

The date that ICD-10 was started to be used in dxDataFile dataset. The data format should be YYYY/MM/DD or YYYY-MM-DD. Necessary if icdVerColName is null.

Details

icdDxShortToDecimal can be used for grouping diagnostic code to PheWAS classification (dxPheWAS: icdDxToPheWAS). icdDxDecimalToShort can be used for grouping to the other classification methods (dxCCS: icdDxToCCS & icdDxToCCSLvl; dxComorbid: icdDxToComorbid). These transformation functions do not only convert the ICD codes to uniform format but also check potential coding error of the ICD format and version.

Value

Two new data.tables. 1) ICD: Uniform format diagnostic codes with column name "ICD". 2) Error: Potential error codes with 5 columns: ICD, count, IcdVersionInFile, WrongType and Suggestion.

Examples

# sample file for example

head(sampleDxFile)

# convert the diagnostic codes to the decimal format

icdDxShortToDecimal(sampleDxFile,ICD,Date, icd10usingDate = "2015/10/01")

# convert the diagnostic codes to the short format

icdDxDecimalToShort(sampleDxFile,ICD,Date, icd10usingDate = "2015/10/01")

DHLab-CGU/emr documentation built on Sept. 2, 2023, 9:16 p.m.