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

icdPrDecimalToShort(
  prDataFile,
  icdColName,
  dateColName,
  icdVerColName = NULL,
  icd10usingDate = NULL
)

icdPrShortToDecimal(
  prDataFile,
  icdColName,
  dateColName,
  icdVerColName = NULL,
  icd10usingDate = NULL
)

Arguments

prDataFile

A data frame object of clinical procedure 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 prDataFile. Data type of this argumant should be string without quotation marks.

dateColName

Column name of date column in prDataFile (with date in YYYY/MM/DD or YYYY-MM-DD format). Data type of this argumant should be string without quotation marks.

icdVerColName

(Optional) Column name of ICD-9/10 version recorded in prDataFile. Data format in this column should be numeric 9L or 10L.

icd10usingDate

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

Value

Two new data.tables. 1) ICD: Uniformly formatted procedure codes. 2) Error: Potential error codes.

Details

These transformation functions do not only convert the ICD to uniform format, but also check the potential coding error of the ICD codes’ format or version.

Examples

# sample file for example

head(samplePrFile)
#>    ID   ICD       Date
#> 1:  B  5681 2008-01-14
#> 2:  A  9774 2009-01-11
#> 3:  B 44.99 2009-05-10
#> 4:  C 07.59 2009-01-21
#> 5:  B  0205 2008-07-06
#> 6:  B  8812 2007-06-27

# convert the procedure codes to the short format

icdPrDecimalToShort(samplePrFile,ICD,Date, icdVerColName = NULL, "2015/10/01")
#> $ICD
#>          ICD
#>   1:    5681
#>   2:    9774
#>   3:    4499
#>   4:    0759
#>   5:    0205
#>  ---        
#> 166: 00UH4KZ
#> 167: 001U074
#> 168: 02160AQ
#> 169: 02134KC
#> 170: 00WU0YZ
#> 

# convert the procedure codes to the decimal format

icdPrShortToDecimal(samplePrFile,ICD,Date, icdVerColName = NULL, "2015/10/01")
#> $ICD
#>          ICD
#>   1:   56.81
#>   2:   97.74
#>   3:   44.99
#>   4:   07.59
#>   5:   02.05
#>  ---        
#> 166: 00UH4KZ
#> 167: 001U074
#> 168: 02160AQ
#> 169: 02134KC
#> 170: 00WU0YZ
#>