The CCSR function (icdDxToCCSR
collapses ICD-10 codes into a smaller number of clinically meaningful categories that are more useful for presenting descriptive statistics than individual ICD-10 diagnostic codes are.
CCSR classification for ICD-10 codes is a diagnostic categorization scheme that can employ in many types of projects analyzing data on diagnoses.
icdDxToCCSR(
dxDataFile,
idColName,
icdColName,
dateColName,
icdVerColName = NULL,
icd10usingDate = NULL,
isDescription = TRUE
)
A data frame object of clinical diagnostic data with at least 3 columns: ID, ICD, and Date. As for date column, the data format should be YYYY/MM/DD or YYYY-MM-DD.
Column name of ID column in dxDataFile. Data type of this argumant should be string without quotation marks.
Column name of ICD column in dxDataFile. Data type of this argumant should be string without quotation marks.
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.
(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.
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.
Binary. If true, category description of classification methods will be used in the group column. If false, category name will be used. By default, it is set to be True
(standard category description).
Three new data.table
s. 1) groupedDT
: Based on dxDataFile
with two new columns for uniform format diagnostic codes and classified categories. 2) summarised_groupedDT
: Summarized the groupedDT
dataset and sorted by memberID. 3) Error
: Potential error codes from standardization step: dxUniform
(icdDxShortToDecimal and icdDxDecimalToShort).
Notice: CCSR is only applicable to ICD-10. To process ICD-9 data, please use dxCCS
(icdDxToCCS) function.
Other code classification functions: dxCCS
(icdDxToCCS), dxPheWAS
(icdDxToPheWAS), dxCustom
(icdDxToCustom and icdDxToCustomGrep), dxComorbid
(icdDxToComorbid).
# sample file for example
head(sampleDxFile)
#> ID ICD Date Version
#> 1: A2 Z992 2020-05-22 10
#> 2: A5 Z992 2020-01-24 10
#> 3: A8 Z992 2015-10-27 10
#> 4: A13 Z992 2020-04-26 10
#> 5: A13 Z992 2025-02-02 10
#> 6: A15 Z992 2023-05-12 10
# Group diagnostic codes into single level of CCSR classification
icdDxToCCSR(sampleDxFile, ID, ICD, Date, icdVerCol = Version, isDescription = TRUE)
#> Wrong ICD format: total 9 ICD codes (the number of occurrences is in brackets)
#> c("A0.11 (20)", "E114 (8)", "Z9.90 (6)", "F42 (6)", "001 (5)", "75.52 (4)", "755.2 (3)", "123.45 (3)", "7552 (2)")
#>
#> Wrong ICD version: total 7 ICD codes (the number of occurrences is in brackets)
#> c("V27.0 (18)", "A01.05 (8)", "42761 (7)", "V24.1 (6)", "A0105 (5)", "E03.0 (4)", "650 (4)")
#>
#> Warning: The ICD mentioned above matches to "NA" due to the format or other issues.
#> Warning: "Wrong ICD format" means the ICD has wrong format
#> Warning: "Wrong ICD version" means the ICD classify to wrong ICD version (cause the "icd10usingDate" or other issues)
#> $groupedDT
#> Short ID ICD Date Version CCSR_CATEGORY_DESCRIPTION
#> 1: Z992 A2 Z992 2020-05-22 10 Other specified status
#> 2: Z992 A5 Z992 2020-01-24 10 Other specified status
#> 3: Z992 A8 Z992 2015-10-27 10 Other specified status
#> 4: Z992 A13 Z992 2020-04-26 10 Other specified status
#> 5: Z992 A13 Z992 2025-02-02 10 Other specified status
#> ---
#> 304: 650 C2 650 2017-10-10 10 <NA>
#> 305: 650 D4 650 2022-04-04 10 <NA>
#> 306: 123.45 C3 123.45 2022-09-28 10 <NA>
#> 307: 123.45 D8 123.45 2018-06-17 10 <NA>
#> 308: 123.45 C0 123.45 2017-05-09 10 <NA>
#>
#> $summarised_groupedDT
#> ID
#> 1: A13
#> 2: A15
#> 3: A2
#> 4: A5
#> 5: A8
#> 6: B0
#> 7: B0
#> 8: B1
#> 9: B1
#> 10: B2
#> 11: B2
#> 12: B3
#> 13: B4
#> 14: C0
#> 15: C0
#> 16: C0
#> 17: C0
#> 18: C0
#> 19: C1
#> 20: C1
#> 21: C1
#> 22: C1
#> 23: C1
#> 24: C2
#> 25: C2
#> 26: C2
#> 27: C2
#> 28: C2
#> 29: C2
#> 30: C2
#> 31: C3
#> 32: C3
#> 33: C3
#> 34: C3
#> 35: C3
#> 36: C4
#> 37: C4
#> 38: C4
#> 39: C4
#> 40: C4
#> 41: C4
#> 42: C4
#> 43: D0
#> 44: D0
#> 45: D0
#> 46: D0
#> 47: D0
#> 48: D1
#> 49: D1
#> 50: D1
#> 51: D2
#> 52: D2
#> 53: D2
#> 54: D2
#> 55: D3
#> 56: D3
#> 57: D3
#> 58: D3
#> 59: D3
#> 60: D4
#> 61: D4
#> 62: D4
#> 63: D4
#> 64: D4
#> 65: D4
#> 66: D4
#> 67: D5
#> 68: D5
#> 69: D5
#> 70: D6
#> 71: D6
#> 72: D6
#> 73: D6
#> 74: D7
#> 75: D8
#> 76: D8
#> ID
#> CCSR_CATEGORY_DESCRIPTION
#> 1: Other specified status
#> 2: Other specified status
#> 3: Other specified status
#> 4: Other specified status
#> 5: Other specified status
#> 6: Chronic kidney disease
#> 7: Acute and unspecified renal failure
#> 8: Acute and unspecified renal failure
#> 9: Chronic kidney disease
#> 10: Chronic kidney disease
#> 11: Acute and unspecified renal failure
#> 12: Chronic kidney disease
#> 13: Chronic kidney disease
#> 14: Skin cancers - melanoma
#> 15: Urinary system cancers - bladder
#> 16: Nervous system cancers - all other types
#> 17: Head and neck cancers - salivary gland
#> 18: Head and neck cancers - lip and oral cavity
#> 19: Nervous system cancers - all other types
#> 20: Head and neck cancers - laryngeal
#> 21: Breast cancer - all other types
#> 22: Respiratory cancers
#> 23: Skin cancers - all other types
#> 24: Mesothelioma
#> 25: Respiratory cancers
#> 26: Malignant neuroendocrine tumors
#> 27: Cancer of other sites
#> 28: Head and neck cancers - lip and oral cavity
#> 29: Head and neck cancers - eye
#> 30: Obsessive-compulsive and related disorders
#> 31: Skin cancers - melanoma
#> 32: Gastrointestinal cancers - colorectal
#> 33: Urinary system cancers - urethra
#> 34: Skin cancers - all other types
#> 35: Breast cancer - all other types
#> 36: Female reproductive system cancers - cervix
#> 37: Urinary system cancers - bladder
#> 38: Male reproductive system cancers - testis
#> 39: Skin cancers - all other types
#> 40: Breast cancer - all other types
#> 41: Head and neck cancers - hypopharyngeal
#> 42: Obsessive-compulsive and related disorders
#> 43: Juvenile arthritis
#> 44: Gastrointestinal hemorrhage
#> 45: Bipolar and related disorders
#> 46: Spondylopathies/spondyloarthropathy (including infective)
#> 47: Obsessive-compulsive and related disorders
#> 48: Rheumatoid arthritis and related disease
#> 49: Hepatic failure
#> 50: Coma; stupor; and brain damage
#> 51: Other specified complications in pregnancy
#> 52: Sedative-related disorders
#> 53: Non-Hodgkin lymphoma
#> 54: Nonrheumatic and unspecified valve disorders
#> 55: Epilepsy; convulsions
#> 56: Peripheral and visceral vascular disease
#> 57: Obesity
#> 58: Drug induced or toxic related condition
#> 59: Obsessive-compulsive and related disorders
#> 60: Non-Hodgkin lymphoma
#> 61: Diabetes mellitus with complication
#> 62: Diabetes mellitus, Type 2
#> 63: Retinal and vitreous conditions
#> 64: Hypertension with complications and secondary hypertension
#> 65: Hypertension and hypertensive-related conditions complicating pregnancy; childbirth; and the puerperium
#> 66: Sequela of cerebral infarction and other cerebrovascular disease
#> 67: Non-Hodgkin lymphoma
#> 68: Rheumatoid arthritis and related disease
#> 69: Polyneuropathies
#> 70: Diabetes mellitus with complication
#> 71: Diabetes mellitus, due to underlying condition, drug or chemical induced, or other specified type
#> 72: Retinal and vitreous conditions
#> 73: Juvenile arthritis
#> 74: Rheumatoid arthritis and related disease
#> 75: Peripheral and visceral vascular disease
#> 76: Non-Hodgkin lymphoma
#> CCSR_CATEGORY_DESCRIPTION
#> firstCaseDate endCaseDate count period
#> 1: 2020-04-26 2025-02-02 2 1743 days
#> 2: 2023-05-12 2023-05-12 1 0 days
#> 3: 2020-05-22 2020-05-22 1 0 days
#> 4: 2020-01-24 2020-01-24 1 0 days
#> 5: 2015-10-27 2015-10-27 1 0 days
#> 6: 2015-12-26 2023-08-28 4 2802 days
#> 7: 2023-11-18 2024-02-12 2 86 days
#> 8: 2016-09-07 2016-09-07 1 0 days
#> 9: 2016-08-08 2024-03-04 5 2765 days
#> 10: 2016-03-20 2024-09-20 5 3106 days
#> 11: 2024-04-07 2024-04-07 1 0 days
#> 12: 2019-05-07 2025-05-25 6 2210 days
#> 13: 2015-12-02 2025-07-21 6 3519 days
#> 14: 2018-05-07 2025-01-12 2 2442 days
#> 15: 2015-12-05 2015-12-05 1 0 days
#> 16: 2016-08-29 2016-08-29 1 0 days
#> 17: 2025-02-21 2025-02-21 1 0 days
#> 18: 2016-07-05 2016-07-05 1 0 days
#> 19: 2020-12-25 2022-11-20 2 695 days
#> 20: 2018-02-13 2018-02-13 1 0 days
#> 21: 2023-12-18 2023-12-18 1 0 days
#> 22: 2025-02-20 2025-02-20 1 0 days
#> 23: 2019-09-28 2019-09-28 1 0 days
#> 24: 2024-12-12 2024-12-12 1 0 days
#> 25: 2020-02-28 2020-02-28 1 0 days
#> 26: 2025-09-17 2025-09-17 1 0 days
#> 27: 2022-05-30 2022-05-30 1 0 days
#> 28: 2016-09-09 2016-09-09 1 0 days
#> 29: 2024-01-14 2024-01-14 1 0 days
#> 30: 2020-03-24 2020-03-24 1 0 days
#> 31: 2018-12-19 2018-12-19 1 0 days
#> 32: 2015-12-06 2018-01-16 2 772 days
#> 33: 2021-10-22 2021-10-22 1 0 days
#> 34: 2024-02-07 2024-02-07 1 0 days
#> 35: 2021-04-06 2021-04-06 1 0 days
#> 36: 2024-09-05 2024-09-05 1 0 days
#> 37: 2025-09-05 2025-09-05 1 0 days
#> 38: 2017-08-29 2017-08-29 1 0 days
#> 39: 2020-08-12 2020-08-12 1 0 days
#> 40: 2017-12-19 2017-12-19 1 0 days
#> 41: 2022-10-23 2022-10-23 1 0 days
#> 42: 2022-01-23 2022-09-27 2 247 days
#> 43: 2020-02-01 2020-02-01 1 0 days
#> 44: 2017-12-24 2017-12-24 1 0 days
#> 45: 2022-12-01 2022-12-01 1 0 days
#> 46: 2024-12-24 2024-12-24 1 0 days
#> 47: 2021-02-26 2024-07-15 2 1235 days
#> 48: 2016-12-06 2016-12-06 1 0 days
#> 49: 2024-04-04 2024-04-04 1 0 days
#> 50: 2024-04-04 2024-04-04 1 0 days
#> 51: 2023-10-23 2023-10-23 1 0 days
#> 52: 2022-09-15 2022-09-15 1 0 days
#> 53: 2019-10-13 2019-10-13 1 0 days
#> 54: 2016-11-21 2016-11-21 1 0 days
#> 55: 2024-01-27 2024-01-27 1 0 days
#> 56: 2017-11-19 2017-11-19 1 0 days
#> 57: 2016-01-22 2016-01-22 1 0 days
#> 58: 2016-01-22 2016-01-22 1 0 days
#> 59: 2022-02-22 2022-02-22 1 0 days
#> 60: 2020-03-10 2020-03-10 1 0 days
#> 61: 2019-01-03 2019-01-03 1 0 days
#> 62: 2019-01-03 2019-01-03 1 0 days
#> 63: 2019-01-03 2019-01-03 1 0 days
#> 64: 2020-01-12 2020-01-12 1 0 days
#> 65: 2020-01-12 2020-01-12 1 0 days
#> 66: 2020-10-06 2020-10-06 1 0 days
#> 67: 2021-02-13 2021-02-13 1 0 days
#> 68: 2022-10-10 2022-10-10 1 0 days
#> 69: 2022-10-10 2022-10-10 1 0 days
#> 70: 2015-10-29 2015-10-29 1 0 days
#> 71: 2015-10-29 2015-10-29 1 0 days
#> 72: 2015-10-29 2015-10-29 1 0 days
#> 73: 2024-05-21 2024-05-21 1 0 days
#> 74: 2021-12-03 2021-12-03 1 0 days
#> 75: 2021-03-18 2021-03-18 1 0 days
#> 76: 2025-09-10 2025-09-10 1 0 days
#> firstCaseDate endCaseDate count period
#>
#> $Error
#> ICD count IcdVersionInFile WrongType Suggestion
#> 1: A0.11 20 ICD 10 Wrong format
#> 2: V27.0 18 ICD 10 Wrong version
#> 3: E114 8 ICD 10 Wrong format
#> 4: A01.05 8 ICD 9 Wrong version
#> 5: 42761 7 ICD 10 Wrong version
#> 6: Z9.90 6 ICD 10 Wrong format
#> 7: F42 6 ICD 10 Wrong format
#> 8: V24.1 6 ICD 10 Wrong version
#> 9: A0105 5 ICD 9 Wrong version
#> 10: 001 5 ICD 9 Wrong format 0019
#> 11: 75.52 4 ICD 9 Wrong format
#> 12: E03.0 4 ICD 9 Wrong version
#> 13: 650 4 ICD 10 Wrong version
#> 14: 123.45 3 ICD 10 Wrong format
#> 15: 755.2 3 ICD 9 Wrong format 755.29
#> 16: 7552 2 ICD 9 Wrong format 75529
#>