data_01: Data-01 Calculation

View source: R/data_01.R

data_01R Documentation

Data-01 Calculation

Description

The data_01() function summarizes EMS registry record validity scores. Validity scores are assumed to be pre-calculated by an EMS software vendor or EMS repository and supplied at the record level. Validity scores must be numeric values bounded to the interval ⁠[0, 1]⁠, where larger values indicate greater record validity. Validity scores typically represent the proportion of data elements within a patient care record that satisfy registry-defined validation requirements, including field completeness, allowable values, formatting rules, and other data quality checks.

The function calculates validity score distribution statistics and validity score range frequencies for all patients, adult patients, and pediatric patients. Optional subgroup analyses may be performed using variables supplied through group_vars.

Data-01 is not an official NEMSQA measure. It was developed to support EMS registry data quality assessment and quality improvement initiatives related to record validity and completeness.

Usage

data_01(
  df = NULL,
  patient_scene_table = NULL,
  audit_table = NULL,
  disposition_table = NULL,
  erecord_01_col,
  incident_date_col = NULL,
  patient_DOB_col = NULL,
  epatient_15_col,
  epatient_16_col,
  patient_care_col,
  validity_score_col,
  confidence_interval = FALSE,
  method = c("wilson", "clopper-pearson"),
  conf.level = 0.95,
  correct = TRUE,
  group_vars = NULL
)

Arguments

df

A dataframe or tibble contianing EMS data where each row represents an observation and columns represent features.

patient_scene_table

A data.frame or tibble containing at least ePatient, and eScene as a fact table.

audit_table

A data.frame or tibble containing audit-related fields, such as record creation timestamps and record-level validity scores. The contents of this table are typically registry- or vendor-specific and may not correspond to elements defined within the National EMS Information System (NEMSIS) data standard.

disposition_table

A data.frame or tibble containing only the edisposition fields needed for this measure's calculations.

erecord_01_col

The column representing the EMS record unique identifier.

incident_date_col

Column that contains the incident date. This defaults to NULL as it is optional in case not available due to PII restrictions.

patient_DOB_col

Column that contains the patient's date of birth. This defaults to NULL as it is optional in case not available due to PII restrictions.

epatient_15_col

Column representing the patient's numeric age agnostic of unit.

epatient_16_col

Column representing the patient's age unit ("Years", "Months", "Days", "Hours", or "Minutes").

patient_care_col

Disposition variable used to identify patient contact encounters.

validity_score_col

Numeric validity score variable bounded to ⁠[0, 1]⁠.

confidence_interval

Logical. If TRUE, the function calculates a confidence interval for the proportion estimate.

method

Character. Specifies the method used to calculate confidence intervals. Options are "wilson" (Wilson score interval) and "clopper-pearson" (exact binomial interval). Partial matching is supported, so "w" and "c" can be used as shorthand.

conf.level

Numeric. The confidence level for the interval, expressed as a proportion (e.g., 0.95 for a 95% confidence interval). Defaults to 0.95.

correct

Logical. If TRUE, applies a continuity correction to the Wilson score interval when method = "wilson". Defaults to TRUE.

group_vars

Optional character vector of column names used to perform subgroup analyses.

Value

A named list with two primary elements:

  • distribution: Validity score distribution summaries.

  • counts: Validity score range counts and proportions.

Both elements contain:

  • overall: Results for the selected populations (All, Adults, and Peds).

  • stratified: Results stratified by group_vars (when requested).

Population-specific results are combined within each output and identified by the pop variable.

Distribution summaries include:

  • Number of observations.

  • Number of missing validity scores.

  • Minimum, maximum, mean, and standard deviation.

  • Percentiles: 25, median, 75, and 90.

Count summaries include:

  • Validity score range.

  • Count (numerator).

  • Population total (denominator).

  • Proportion (prop).

  • Confidence intervals when requested.

Author(s)

Nicolas Foss, Ed.D., MS

Examples


# Synthetic example data
test_data <- tibble::tibble(
  erecord_01 = paste0("R", 1:10),
  incident_date = as.Date("2024-01-01"),
  patient_dob = as.Date(c(
    "1980-01-01", "1975-01-01", "1990-01-01", "1985-01-01",
    "1970-01-01", "2015-01-01", "2012-01-01", "2010-01-01",
    "2018-01-01", "2016-01-01"
  )),
  epatient_15 = c(44, 49, 34, 39, 54, 9, 12, 14, 6, 8),
  epatient_16 = rep("Years", 10),
  patient_disposition = rep(
    "Patient Treated, Transported by this EMS Unit (4212033)",
    10
  ),
  incident_validity_score = c(
    1.00, 0.98, 0.96, 0.92, 0.89,
    0.84, 0.77, 0.65, 0.54, 0.41
  )
)

# Run the Data-01 validity score analysis
data_01(
  df = test_data,
  erecord_01_col = erecord_01,
  incident_date_col = incident_date,
  patient_DOB_col = patient_dob,
  epatient_15_col = epatient_15,
  epatient_16_col = epatient_16,
  patient_care_col = patient_disposition,
  validity_score_col = incident_validity_score
)

# Stratified analysis
test_data$vendor <- rep(c("Vendor A", "Vendor B"), each = 5)

data_01(
  df = test_data,
  erecord_01_col = erecord_01,
  incident_date_col = incident_date,
  patient_DOB_col = patient_dob,
  epatient_15_col = epatient_15,
  epatient_16_col = epatient_16,
  patient_care_col = patient_disposition,
  validity_score_col = incident_validity_score,
  group_vars = "vendor"
)


nemsqar documentation built on Dec. 4, 2026, 1:06 a.m.