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.
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_IDequivalent).- FacilityType
Character. ESSENCE facility type. Includes intentional misclassifications for two FSEDs (
"Urgent Care") to demonstratefilter_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_IDrepresent the duplicate patterns this package addresses.- C_BioSense_ID
Character. Synthetic BioSense record identifier. Multiple values per
Visit_IDindicatevisit_date_changeduplication.- C_Unique_Patient_ID
Character. Synthetic patient identifier (MRN equivalent in Kentucky). Multiple values per
Visit_IDindicatepid_changeduplication.- Date
Date. Visit date.
- C_Visit_Date_Time
POSIXct. Timestamp of the actual clinical encounter. Used by
link_encounters()to chronologically order.patient_class_sequencewhen linking ED and direct-admit records.- Arrived_Date_Time
POSIXct. Timestamp when NSSP received the record. Use as
order_byindedupe()to retain the most recently transmitted version of each record.- HasBeenE
Integer.
1if the visit has been classified as an emergency visit.0on the twopatient_class_changeduplicate rows (see Details), which represent a direct-admit continuation of an ED visit; all other records haveHasBeenE = 1, consistent with aHasBeenE = 1filtered ESSENCE pull.- HasBeenAdmitted
Integer.
1if 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()detectspatient_class_changeduplicates generically, from any two rows sharing afacility x Visit_IDkey with distinctC_Patient_Classvalues, 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 demonstrateassign_treating_geography().- ZipCode
Character. Patient zip code. May be
NAforOTHER_REGIONrecords.- 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
standard5 visits with an extra row differing only in
Arrived_Date_Time, representing a record retransmission.visit_date_change3 visits with a second row carrying a new
C_BioSense_IDand aDateadvanced by 1 day, representing a midnight-crossing visit whereAdmit_Date_Timewas updated.pid_change2 visits with a second row carrying a different
C_Unique_Patient_ID, representing a corrected patient identifier.patient_class_change2 visits with a second row carrying
C_Patient_Class = "I"(HasBeenE/HasBeenAdmittedflipped to match) against the original row's"E", and laterC_Visit_Date_Time/Arrived_Date_Timevalues, representing an ED visit and its direct-admit continuation transmitted as two records sharing oneVisit_IDrather than one record with an updatedC_Patient_Class_List. Sincededupe(keep = "last")keeps the more recent row byArrived_Date_Time, these two visits survive into essence_clean asc_patient_class = "I": the ED encounter is silently dropped by deduplication alone, illustrating the gaplink_encounters()is designed to catch instead.essence_rawis not itself used to demonstratelink_encounters(); see essence_ed_raw/essence_inp_raw, which are purpose-built for that.visit_date_change+pid_change1 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().
