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 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".

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.

Value

A modified lab_data data frame with additional columns:

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:

Author(s)

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

See Also

Function 1 for result value cleaning,


[Package lab2clean version 1.0.0 Index]