Skip to contents

A fabricated dataset simulating a raw ESSENCE API data pull containing common data quality issues: duplicate records of multiple types, non-ED provider visits, out-of-state patient records, and OTHER_REGION entries. All facility names, visit identifiers, patient identifiers, and geographic values are entirely synthetic. No real patient or facility data are included.

Usage

essence_raw

Format

A data frame with approximately 193 rows and 18 columns:

HospitalName

Character. Synthetic facility name.

Hospital

Integer. Synthetic numeric facility identifier (C_BioSense_Facility_ID equivalent).

FacilityType

Character. ESSENCE facility type. Includes intentional misclassifications for two FSEDs ("Urgent Care") to demonstrate filter_care_setting() correction logic.

HospitalRegion

Character. Facility ESSENCE Region in {SITE}_{REGION} format (e.g., "KY_Jefferson").

HospitalZip

Character. Facility zip code.

Visit_ID

Character. Synthetic visit identifier, unique within a facility. Multiple rows with the same HospitalName x Visit_ID represent the duplicate patterns this package addresses.

C_BioSense_ID

Character. Synthetic BioSense record identifier. Multiple values per Visit_ID indicate visit_date_change duplication.

C_Unique_Patient_ID

Character. Synthetic patient identifier (MRN equivalent in Kentucky). Multiple values per Visit_ID indicate pid_change duplication.

Date

Date. Visit date.

C_Visit_Date_Time

POSIXct. Timestamp of the actual clinical encounter. Used by link_encounters() to chronologically order .patient_class_sequence when linking ED and direct-admit records.

Arrived_Date_Time

POSIXct. Timestamp when NSSP received the record. Use as order_by in dedupe() to retain the most recently transmitted version of each record.

HasBeenE

Integer. 1 if the visit has been classified as an emergency visit. 0 on the two patient_class_change duplicate rows (see Details), which represent a direct-admit continuation of an ED visit; all other records have HasBeenE = 1, consistent with a HasBeenE = 1 filtered ESSENCE pull.

HasBeenAdmitted

Integer. 1 if the visit resulted in inpatient admission (discharge-disposition aware).

C_Patient_Class

Character. ESSENCE-derived single-letter patient class ("E" for ED, "I" for inpatient). classify_duplicates() detects patient_class_change duplicates generically, from any two rows sharing a facility x Visit_ID key with distinct C_Patient_Class values, not a specific from/to pair. "E" to "I" is used here only as a common, realistic illustration; see Details.

Region

Character. Patient ESSENCE Region of residence in {SITE}_{REGION} format. Includes out-of-state values (e.g., "TN_Davidson") and "OTHER_REGION" entries to demonstrate assign_treating_geography().

ZipCode

Character. Patient zip code. May be NA for OTHER_REGION records.

Sex

Character. "M", "F", or "U" (unknown).

C_Patient_Age

Integer. Patient age in years.

Source

Entirely synthetic. Generated by data-raw/generate_synthetic_data.R. Column structure models an ESSENCE va_er (Patient Location, Full Details) pull, the data source against which sysPrep's functions have been validated. Encounter linkage (link_encounters()) expects a supplemental inpatient pull structured as va_hosp (Facility Location, Full Details).

Details

Duplicate patterns included

standard

5 visits with an extra row differing only in Arrived_Date_Time, representing a record retransmission.

visit_date_change

3 visits with a second row carrying a new C_BioSense_ID and a Date advanced by 1 day, representing a midnight-crossing visit where Admit_Date_Time was updated.

pid_change

2 visits with a second row carrying a different C_Unique_Patient_ID, representing a corrected patient identifier.

patient_class_change

2 visits with a second row carrying C_Patient_Class = "I" (HasBeenE/HasBeenAdmitted flipped to match) against the original row's "E", and later C_Visit_Date_Time/ Arrived_Date_Time values, representing an ED visit and its direct-admit continuation transmitted as two records sharing one Visit_ID rather than one record with an updated C_Patient_Class_List. Since dedupe(keep = "last") keeps the more recent row by Arrived_Date_Time, these two visits survive into essence_clean as c_patient_class = "I": the ED encounter is silently dropped by deduplication alone, illustrating the gap link_encounters() is designed to catch instead. essence_raw is not itself used to demonstrate link_encounters(); see essence_ed_raw/essence_inp_raw, which are purpose-built for that.

visit_date_change+pid_change

1 visit exhibiting both mechanisms simultaneously.

Non-ED providers

20 records from a "Primary Care" and a "Medical Specialty" facility are included. These should be excluded by filter_care_setting().

FSED misclassifications

"Hillside FSED" and "Downtown Emergency Services" are onboarded with FacilityType = "Urgent Care". These require correction via fix_facility_type_vector in filter_care_setting().

See also

essence_clean for the processed version of this dataset; dedupe(), filter_care_setting(), assign_treating_geography(); essence_ed_raw and essence_inp_raw for the datasets used to demonstrate link_encounters().