data_02_population: Data-02 Population

View source: R/data_02_population.R

data_02_populationR Documentation

Data-02 Population

Description

Creates the analysis populations for the Data-02 documentation timeliness measure. The function prepares a computing population, overall denominator population, adult population, and pediatric population for subsequent documentation timeliness analyses.

Data-02 evaluates the timeliness of EMS patient care documentation using user-defined date-time variables that represent when documentation could reasonably begin and when documentation occurred. Elapsed documentation time is calculated in hours and days and categorized into predefined reporting intervals.

The function supports two data input workflows:

  • A single analytic dataset supplied through df.

  • Separate patient, audit, disposition, and times tables supplied through patient_scene_table, audit_table, disposition_table, and times_table.

Records are restricted to patients with documented patient evaluation, refusal, death, or treatment dispositions indicating patient contact.

When incident and date-of-birth variables are supplied, both reported and calculated ages are utilized to derive adult and pediatric populations.

Data-02 is not an official NEMSQA measure. It was developed to support EMS registry data quality assessment and quality improvement initiatives related to EMS documenation timeliness.

Usage

data_02_population(
  df = NULL,
  patient_scene_table = NULL,
  audit_table = NULL,
  disposition_table = NULL,
  times_table = NULL,
  erecord_01_col,
  incident_date_col = NULL,
  patient_DOB_col = NULL,
  epatient_15_col,
  epatient_16_col,
  patient_care_col,
  time_available_to_document_col,
  time_documentation_occurred_col
)

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.

times_table

A data.frame or tibble containing event date-time variables used to evaluate documentation timeliness. These variables may include NEMSIS time elements (e.g., unit back in service date/time) or registry-, vendor-, or agency-specific timestamps related to record creation, modification, submission, approval, or other documentation workflow events. The contents of this table may not correspond entirely to elements defined within the National EMS Information System (NEMSIS) data standard.

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.

time_available_to_document_col

Date-time variable representing the point at which patient care documentation could reasonably begin. Examples may include unit back in service time, back at home location time, ems call completed time, and others.

time_documentation_occurred_col

Date-time variable representing when patient care documentation was completed or first entered into the EMS software, registry, or other documentation system. This variable is typically vendor- or registry-specific and may not correspond to a NEMSIS data element. Examples include incident created time, incident completed time, and others.

Details

Adult and pediatric populations are determined using NEMSIS patient age fields. When both incident_date_col and patient_DOB_col are supplied, calculated age is used in conjunction with reported age variables to improve population classification.

Documentation timeliness is calculated as the elapsed time between time_available_to_document_col and time_documentation_occurred_col. Elapsed time is reported in both hours and days and categorized into predefined documentation timeliness bands.

A chronology flag (DOCUMENTATION_OCCURRED_BEFORE_AVAILABLE) is created when documentation occurs before the documentation-available timestamp. Such records are retained because they may reflect registry workflows, CAD-generated records, automated record creation processes, or agency- specific documentation practices.

Value

A list that contains the following:

  • a tibble with counts for each filtering step,

  • a tibble for each population of interest

  • a tibble for the initial population

  • a tibble for the total dataset with computations

  • a tibble with a summary of missingness for each column in each table

Additional variables are created in the returned populations including:

  • PATIENT_CARE

  • RECORD_COMPLETION_HOURS

  • RECORD_COMPLETION_DAYS

  • RECORD_COMPLETION_DAYS_RANGE

  • RECORD_COMPLETION_DAYS_LABEL

  • DOCUMENTATION_OCCURRED_BEFORE_AVAILABLE

Author(s)

Nicolas Foss, Ed.D., MS

Examples


# Synthetic Data-02 example
test_data <- tibble::tibble(
  erecord_01 = paste0("R", 1:10),

  # Incident and demographic variables
  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 contact disposition
  patient_disposition = rep(
    "Patient Treated, Transported by this EMS Unit (4212033)",
    10
  ),

  # Time documentation became available
  unit_back_in_service = as.POSIXct(
    "2024-01-01 08:00:00",
    tz = "UTC"
  ) + c(
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0
  ) * 86400,

  # Time documentation occurred
  incident_created = as.POSIXct(
    c(
      "2024-01-01 11:00:00",  # 3 hours
      "2024-01-01 18:00:00",  # 10 hours
      "2024-01-02 04:00:00",  # 20 hours
      "2024-01-02 12:00:00",  # 28 hours
      "2024-01-03 12:00:00",  # 52 hours
      "2024-01-05 12:00:00",  # 4 days
      "2024-01-10 12:00:00",  # 9 days
      "2024-01-20 12:00:00",  # 19 days
      "2024-02-15 12:00:00",  # 45 days
      "2024-04-15 12:00:00"   # >60 days
    ),
    tz = "UTC"
  )
)

# Create the Data-02 populations
data_02_population(
  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,
  time_available_to_document_col = unit_back_in_service,
  time_documentation_occurred_col = incident_created
)


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