View source: R/validate_data.R
| validate_inpatient_diagnoses | R Documentation |
Validate constraints on diagnosis records, namely that the
minimum variables are present, and that all icd_code values can be
looked up in an ICD-10 reference table
validate_inpatient_diagnoses(diagnoses_data, diagnoses_lookup)
diagnoses_data |
a data frame containing clinical diagnoses, with,
at minimum, variables |
diagnoses_lookup |
a data frame containing an ICD-10 reference look up
table with, at minimum, variables |
A logical value indicating success
patient_ida patient identifier with no missing value
encounter_ida hospital encounter identifier with no missing value
episode_numbera strictly positive integer indicating the number of the episode within an admission. Must not be missing.
icd_codea code corresponding to the International Classification of Diseases without a "." separator
diagnosis_positionan integer describing the diagnosis position on the discharge summary (1 = primary cause of admission
Some record systems track dates when clinical diagnoses were first noted and
when they were considered resolved (eg: problem lists). diagnosis_start
and diagnosis_end should be used to store this information.
diagnosis_starta vector of POSIXct timestamps when
the clinical problems were first noted or manifested
diagnosis_enda vector of POSIXct timestamp when the
clinical problems were considered resolved
If no data are provided, Ramses functions such as therapy_timeline
will use episode start and end dates from the inpatient_episodes table instead.
icd_codecharacter diagnosis codes corresponding to the International Classification of Diseases formatted without a "." separator (eg "A0101")
icd_displaylaid-out diagnosis codes for display (eg: "A01.01")
icd_descriptionfull text descriptions of the diagnoses
category_codethree-character heading codes (eg "A01")
category_descriptionfull text descriptions of three-character heading codes
Note: import_icd() can produce this lookup data frame from
a standard ICD release archive file.
data_icd <- dplyr::filter(Ramses::inpatient_diagnoses, !is.na(icd_code))
lookup_icd <- dplyr::distinct(data_icd, icd_code)
lookup_icd$icd_display <- lookup_icd$icd_code
lookup_icd$icd_description <- "ICD-10 code label text"
lookup_icd$category_code <- substr(lookup_icd$icd_code, 0, 3)
lookup_icd$category_description <- "ICD-10 category label text"
validate_inpatient_diagnoses(data_icd, lookup_icd)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.