Learn R Programming

lab2clean (version 2.0.0)

validate_lab_result: 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
)

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

Arguments

lab_data

A data frame containing laboratory data.

result_value

The column in `lab_data` with quantitative result values for validation.

result_unit

The column in `lab_data` with result units in a UCUM-valid format.

loinc_code

The column in `lab_data` indicating the LOINC code of the laboratory test.

patient_id

The column in `lab_data` indicating the identifier of the tested patient.

lab_datetime

The column in `lab_data` with the date or datetime of the laboratory test.

report

A report is written in the console. Defaults to "TRUE".

Author

Ahmed Zayed <ahmed.zayed@kuleuvne.be>, Arne Janssens <arne.janssens@kuleuven.be>

Details

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.

See Also

Function 1 for result value cleaning,