This function is designed to validate quantitative laboratory result values. It modifies the provided `lab_data` dataframe in-place, adding one new column.
validate_lab_result(
lab_data,
result_value,
result_unit,
loinc_code,
patient_id,
lab_datetime,
report = TRUE
)A modified `lab_data` data frame with additional columns: * `flag`: specifies the flag detected in the result records that violated one or more of the validation checks
A data frame containing laboratory data.
The column in `lab_data` with quantitative result values for validation.
The column in `lab_data` with result units in a UCUM-valid format.
The column in `lab_data` indicating the LOINC code of the laboratory test.
The column in `lab_data` indicating the identifier of the tested patient.
The column in `lab_data` with the date or datetime of the laboratory test.
A report is written in the console. Defaults to "TRUE".
Ahmed Zayed <ahmed.zayed@kuleuvne.be>, Arne Janssens <arne.janssens@kuleuven.be>
The function employs the following validation methodology: 1. Reportable limits check: Identifies implausible values outside reportable limits. 2. Logic rules check: Identifies values that contradict some predefined logic rules. 3. Delta limits check: Flags values with excessive change from prior results for the same test and patient.
Internal Datasets: The function uses two internal datasets included with the package: 1. `reportable_interval`: Contains information on reportable intervals. 2. `logic_rules`: Contains logic rules for validation.
Function 1 for result value cleaning,