1. Introduction
Electronic health records (EHRs) support clinical operations, quality reporting, research, and machine-learning development, but downstream conclusions depend on the reliability of source data. Digital-health datasets contain missing values, incompatible formats, duplication, delayed events, implausible measurements, and inconsistencies across related tables [
1,
2]. The consequences are not limited to model accuracy: quality defects can alter cohort definitions, bias subgroup estimates, and increase the burden of manual review.
Data quality is multidimensional and use-dependent. Classical work distinguishes completeness, consistency, accuracy, timeliness, and representational quality [
3,
4], while healthcare frameworks organize assessment around conformance, completeness, and plausibility [
2]. The same value can have different interpretations across patients, encounters, laboratory items, and workflows. A missing numerical laboratory result can be legitimate when a categorical result is recorded; a value outside a reference interval can be clinically abnormal yet correctly represented; and a missing admission identifier can be valid for an outpatient event.
Operational tools already address important parts of this problem. The OHDSI Data Quality Dashboard (DQD) implements parameterized table-, field-, and concept-level checks for the Observational Medical Outcomes Partnership (OMOP) Common Data Model (CDM) and resolves approximately 4000 checks through the Kahn framework [
5]. H-StreamQ is not proposed as a replacement for DQD or an OMOP validation tool. Its narrower contribution is to examine how linked native EHR entities, training-derived local boundaries, anomaly scores, explainable rules, and sequential quality-rate monitoring can be combined and evaluated without treating clinical abnormality as corruption.
Evaluating such a framework credibly imposes specific design requirements. A benchmark assembled only from the constraints a system already implements will overstate its performance; thresholds derived after removing records that existing alerts have flagged will yield optimistic estimates; and repeated corruptions of a small patient cohort do not constitute independent experimental units. This study therefore uses the full MIMIC-IV laboratory file for cohort construction, performs patient-disjoint training, calibration, and testing, retains naturally unusual records, introduces less rule-aligned and clustered defects, adds independent anomaly baselines, and quantifies uncertainty with patient-cluster bootstrap intervals rather than tests that assume independent observations.
The contribution is deliberately scoped as a rigorous proof-of-concept evaluation rather than evidence of real-world clinical effectiveness. The objectives are to: (i) formalize entity- and context-aware features and alert provenance; (ii) quantify performance on a substantially larger patient-level laboratory benchmark; (iii) compare deterministic rules, Isolation Forest variants, Local Outlier Factor (LOF), and One-Class support vector machine (OCSVM) methods; (iv) report patient-cluster uncertainty, event-micro and patient-macro results, error-specific recall, and subgroup alert-rate audits; and (v) evaluate sequential monitors under six drift mechanisms.
The study addresses five research questions. RQ1 asks how well training-derived rules and anomaly methods detect heterogeneous laboratory quality defects in a patient-disjoint test cohort. RQ2 asks whether adding a context-aware Isolation Forest to deterministic rules improves performance at a threshold fixed on an independent calibration cohort. RQ3 examines variation by error mechanism, event-micro versus patient-macro averaging, and patient-cluster uncertainty. RQ4 examines whether context conditioning or subgroup-calibrated thresholds consistently reduce background-alert-rate disparities. RQ5 compares adaptive, EWMA, and fixed-window monitors in terms of detection, delay, and false alarms across six simulated quality-drift mechanisms.
The remainder of the paper is organized as follows.
Section 2 positions H-StreamQ relative to established data-quality and anomaly monitoring approaches.
Section 3 describes the framework, linked entities, quality dimensions, and mathematical features.
Section 4 presents the data, patient-level experimental design, comparators, statistical analysis, and drift simulations.
Section 5 reports the empirical results.
Section 6 discusses interpretation, operational governance, and limitations, and
Section 7 concludes the paper.
4. Materials and Methods
4.1. Dataset, Full Scan, and Patient-Level Splits
The study uses MIMIC-IV v3.1 under credentialed PhysioNet access [
25,
26,
27]. The complete labevents.csv.gz file was scanned with DuckDB 1.4.5 rather than loaded into memory. It contained 158,374,764 laboratory events from 313,442 patients, 447,689 admissions, and 976 laboratory item identifiers; 136,884,423 events had a numeric value. No alert-supported or clinically unusual record was excluded before cohort formation.
Patients with numeric laboratory events were ranked into five activity quintiles. Two thousand patients were sampled without replacement from each quintile with seed 2026. Within every quintile, patients were assigned 60%/20%/20% to training, threshold calibration, and testing. Consequently, no patient appeared in more than one split. Training-derived item, unit, context, delay, and rule profiles were never recomputed from calibration or test observations.
Table 3 separates the components that were empirically evaluated against labels from those implemented but audited descriptively, and from those that remain conceptual. Claims of measured detection performance in this study apply only to the first category.
Table 3.
Implemented, audited, and conceptual components of H-StreamQ.
| Component | Status | Evidence in This Study |
|---|
| Numeric laboratory value, unit and delay checks | Implemented and empirically evaluated | Injection benchmark; 918,651 test events (Section 5.2) |
| Context-conditioned anomaly scoring (age x gender) | Implemented and empirically evaluated | Section 5.2, Section 5.3 and Section 5.4; Figure 3, Figure 4 and Figure 5 |
| Anomaly baselines (IF, LOF, linear and RBF OCSVM) | Implemented and empirically evaluated | Section 5.2 |
| Batch-level drift monitoring | Implemented; evaluated on simulated streams | Section 5.5; not validated on replayed EHR streams |
| Entity linkage across patients, admissions, diagnoses, transfers, dictionaries | Implemented; descriptively audited | Section 5.1; review candidates, not labeled outcomes |
| Cross-entity temporal and referential rules | Implemented; descriptively audited | Section 3.1; no adjudicated labels available |
| Subgroup alert-rate audit | Implemented; descriptive only | Section 5.4; not a validated fairness assessment |
| Streaming deployment, quarantine and governance workflow | Conceptual | Section 6.6; no prospective implementation |
Figure 3.
Event-micro F1-scores with patient-cluster bootstrap 95% confidence intervals. The deterministic rule baseline achieved the highest point estimate.
Figure 4.
Recall by injected error mechanism at the primary operating point. No method was uniformly the strongest across mechanisms.
Figure 5.
Maximum–minus–minimum background-alert rate across supported subgroups. Rates are descriptive because unmodified events were not clinically adjudicated.
As
Table 4 shows, the calibration and test cohorts are large enough to support independent operating-point selection and final evaluation, while patient-level separation prevents repeated measurements from the same patient from crossing splits. Similar median activity across splits reduces the chance that one group is dominated by unusually high-volume patients.
The complete patients (364,627 rows), admissions (546,028), diagnoses_icd (6,364,488), d_icd_diagnoses (112,107), transfers (2,413,581), and dictionary tables remained available for entity linkage and context attachment. The predictive benchmark focuses on numeric laboratory events because these tables supply the largest volume of directly comparable numeric observations for which item-, unit-, and context-level reference statistics can be derived entirely from training patients.
6. Discussion
6.6. Integration into Hospital Data Governance
A hospital deployment should begin in silent-monitoring mode rather than by automatically rejecting records. H-StreamQ alerts would enter an existing data-quality dashboard or ticketing queue with the source entity, affected field, rule/model provenance, severity, and supporting context. Data stewards could triage structural and referential defects; laboratory informatics teams could assess units, mappings, and device-related changes; and clinical domain owners could adjudicate plausibility signals. Only locally approved deterministic failures should be eligible for staging quarantine, while anomaly and subgroup signals should remain review-only until prospective validation establishes action thresholds.
A specific risk arises when quality signals are used upstream of secondary data use rather than only at the point of care. If clinical data from a minority group are flagged as quality errors at an unjustifiably high rate, and if flagged records are then filtered from the construction of machine-learning training sets or clinical study cohorts, the exclusion compounds. Models trained on the surviving records become progressively better fitted to the majority population, their residuals on the under-represented group grow, and any subsequent quality model calibrated on those residuals flags the same group more often still. The result is a self-reinforcing cycle in which a data-quality tool intended to improve reliability instead narrows the population that downstream evidence describes, undermining health equity through an accumulation of individually defensible filtering decisions. This risk is the principal reason the framework is specified as review-generating rather than record-filtering, and it is why subgroup alert rates should be audited routinely rather than only at deployment.
Reasonable accommodation in this setting means declining to discard data on the basis of a uniform algorithmic threshold, and designing instead for human adjudication. Two design commitments follow. First, an alert should never impose a hard stop on a clinical order or medication workflow; it should present as a soft warning requiring acknowledgement, so that a clinician retains the ability to proceed with a value that is unusual for the reference population but correct for the patient in front of them. Second, the alert should carry the contextual information needed to make that judgment rather than a bare anomaly flag: the locally applicable reference range for the patient’s age, sex, and where clinically appropriate ancestry, alongside the observed value, the expected condition, and the provenance of the rule or model that generated the signal. Displaying the local distribution rather than a single global boundary converts the alert from an assertion that the value is wrong into evidence the clinician can weigh, which is the only form in which a quality signal can be safely surfaced in a population whose normal ranges the training data may not fully represent.
Governance would require a versioned registry of rules, training cohorts, thresholds, model artifacts, owners, approvals, and rollback criteria; routine subgroup and alert-volume audits; and escalation paths from data stewards to clinical safety, privacy, and information-technology governance. Technical barriers include heterogeneous identifiers and units, EHR-vendor interfaces, transformation lineage, delayed or replayed messages, compute and latency constraints, and restricted access to patient context. Organizational barriers include unclear data ownership, limited adjudication capacity, alert fatigue, competing definitions of fitness for use, change-management burden, and the need to demonstrate benefit without worsening subgroup exclusion. A staged pathway—silent observation, retrospective adjudication, prospective shadow validation, and only then controlled intervention—is therefore more appropriate than immediate production filtering.
6.7. Limitations
First, the larger evaluation uses one institution’s MIMIC-IV laboratory data and synthetic benchmark labels. It does not establish external, temporal, or production validity. Second, naturally occurring quality problems in unmodified events were not independently adjudicated; consequently, background-alert rate is not a definitive clinical false-positive rate. Third, although the complete laboratory file was scanned, the model benchmark uses a stratified 10,000-patient cohort and computationally bounded training samples for LOF, OCSVM, and Isolation Forest.
Fourth, the five mechanisms are more realistic than uniform rule-matched injections but cannot reproduce every coding change, device malfunction, mapping failure, or MNAR process. Fifth, subgroup analyses are descriptive and race/insurance information is unavailable for many events without linked admissions. Sixth, the custom adaptive-window implementation is not official ADWIN, and all drift results remain Monte Carlo simulations of batch quality rates rather than replayed EHR streams. Seventh, although the fixed 4.72 value boundary is mathematically equivalent to 3.5 interquartile ranges, it was adopted as a design constant rather than derived from a cohort-specific quantile, and all rule thresholds require prospective prespecification and independent validation. Eighth, the benchmark reflects a single corruption realization under one seed, so the reported intervals capture variation across patients but not across alternative assignments of the injected defects; a multi-seed replication was identified as valuable during review but could not be completed within the revision window because it requires re-executing the full benchmark and evaluation pipeline against the credentialed extract, and is accordingly listed as the first priority for a subsequent study. Ninth, the completed hyperparameter analysis was a targeted 16-configuration grid rather than exhaustive optimization. It varied forest size and subsample size for the context-aware Isolation Forest, neighborhood size for LOF, and kernel scale for the RBF OCSVM with nu fixed at 0.01. It did not sweep the context-free Isolation Forest, linear OCSVM, alternative RBF OCSVM nu values, feature sets, or interactions across the full parameter space. The finding that none of the 16 tested configurations outperformed rules therefore strengthens the result only within this targeted grid; the conclusion that context conditioning did not improve aggregate Isolation Forest performance remains limited to the primary configurations directly compared.
Finally, the study evaluates detection, not automatic correction, throughput, alert actionability, or clinical benefit. Future work should include independently adjudicated natural cases, external and temporal validation, OMOP conversion for direct DQD comparison, hierarchical patient/admission modeling, prospective stream replay, and stakeholder assessment of alert costs.