validate_lab_result {lab2clean} | R Documentation |
Validate Quantitative Laboratory Result Values
Description
This function is designed to validate quantitative laboratory result values.
It modifies the provided lab_data
dataframe in-place, adding one new column.
Usage
validate_lab_result(
lab_data,
result_value,
result_unit,
loinc_code,
patient_id,
lab_datetime,
report = TRUE
)
Arguments
lab_data |
A data frame containing laboratory data. |
result_value |
The column in |
result_unit |
The column in |
loinc_code |
The column in |
patient_id |
The column in |
lab_datetime |
The column in |
report |
A report is written in the console. Defaults to "TRUE". |
Details
The function employs the following validation methodology:
Reportable limits check: Identifies implausible values outside reportable limits.
Logic rules check: Identifies values that contradict some predefined logic rules.
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:
-
reportable_interval
: Contains information on reportable intervals. -
logic_rules
: Contains logic rules for validation.
Value
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
Note
This function is a component of a broader laboratory data cleaning pipeline and should be evaluated accordingly. The package's framework includes functions for cleaning result values, validating quantitative results, standardizing unit formats, performing unit conversion, and assisting in LOINC code mapping.
Concerning performance, the function's speed might be influenced by the size of lab_data
. Consider:
Limiting the number of records processed.
Optimize the function for larger datasets.
Implement pre-processing steps to divide the dataset chronologically.
Author(s)
Ahmed Zayed ahmed.zayed@kuleuvne.be, Arne Janssens arne.janssens@kuleuven.be
See Also
Function 1 for result value cleaning,