Blog

    EHR Analytics and Predictive Modeling

    By GauravNovember 26, 20268 mins read
    On this page

    EHR data looks ideal for prediction: years of visits, labs, medications and outcomes in one place. Models trained on it often score well in development and then disappoint in the clinic, because the data was recorded for care and billing, not for modeling.

    This post covers how to build a predictive model on EHR data that holds up after launch: choosing what to predict, preventing leakage, validating the right way, deploying carefully and watching for drift. It is written for data and product teams, not as clinical guidance.

    What is predictive modeling on EHR data?

    Planning a model on your EHR data?

    Our EHR integration services cover the data feeds, FHIR access and write-back a model depends on.

    Predictive modeling on EHR data uses past records to estimate the chance of a future event, such as a readmission, a missed appointment or a deteriorating lab trend, early enough for someone to act. Agnotic Technologies builds these models with the action defined first, so a prediction always arrives where a person can use it.

    A model without a named action is a report nobody reads.

    What should you predict?

    Start from a decision someone makes today with too little warning. The prediction target, timing and audience follow from that decision.

    • Action: what a person will do differently, such as call a patient or add a follow-up.
    • Timing: when the prediction must be ready for that action to help.
    • Audience: who sees it, and in which screen or queue.
    • Capacity: how many flagged cases the team can actually handle each day.

    How does leakage spoil EHR models?

    Leakage happens when the model learns from data that would not exist yet at the moment of prediction. It produces excellent test scores and useless real predictions.

    • Late codes: diagnosis or billing codes entered after discharge used to predict events during the stay.
    • Outcome-driven tests: an order placed because a clinician already suspected the outcome.
    • Timestamps: using the date a record was filed instead of when the event happened.

    Fix it by building every feature from data available at a fixed prediction time, and checking each feature's timestamp source.

    How should a model be validated?

    Validate the way the model will be used: on later data, at other sites, and across patient groups.

    • Time split: train on earlier periods, test on a later one.
    • Site split: test at a location the model did not train on, if you have more than one.
    • Calibration: check that predicted risks match observed rates, not only ranking.
    • Subgroups: compare performance across age, sex, language, payer and other groups that matter for fairness.
    • Workload: count how many alerts a threshold would produce per day.

    Which data needs preparing first?

    EHR data needs more preparation than most teams plan for. Most of the modeling effort goes into defining who is in the data and what each field really means.

    • Cohort: which patients and encounters the model applies to, with clear inclusion and exclusion rules.
    • Outcome: an exact definition of the event, checked against chart review on a sample.
    • Codes: local lab and medication codes mapped to standard terminologies, so a renamed test does not become a new feature.
    • Missing values: whether a missing lab means normal, not ordered or not recorded, which often carries meaning of its own.
    • Timestamps: when each value became available to clinicians, not when it was filed or billed.

    Write these definitions down and have a clinician sign them. Every later argument about the model's results comes back to them.

    Where should predictions appear?

    In the place where the action happens, at the time it can still help. For most operational models that is a worklist, not an interruptive alert.

    • Worklists: a ranked list of patients for a care manager or scheduler to work through.
    • Chart flags: a quiet indicator on the patient's chart with the score and its main reasons.
    • Alerts: only for urgent, time-critical cases, with a threshold set so alerts stay rare.

    Set the threshold from the team's capacity. If the team can call a certain number of patients a day, the threshold should produce about that many, starting with the highest risk.

    Which rules and frameworks apply?

    Two questions come up on every clinical model: is it a regulated device, and how is its risk managed?

    FDA's Clinical Decision Support Software guidance explains which decision support functions meet the non-device criteria in section 520(o)(1)(E) of the FD&C Act and which remain device software functions.

    The NIST AI Risk Management Framework is a voluntary framework that organizes AI risk work into four functions: Govern, Map, Measure and Manage.

    HIPAA allows two ways to de-identify health data: expert determination, or the safe harbor method, which removes 18 categories of identifiers.

    Use de-identified data for exploration where it is enough, and agree the device question with your regulatory adviser before the model reaches clinicians.

    How should a model be deployed?

    Run it silently first. The model scores live patients, nobody sees the results, and you compare predictions with what actually happens.

    When the silent run matches validation, show predictions to a small group in their normal workflow, with the reasons behind each score where the method allows it. Record every prediction and the action taken.

    Write predictions back to the EHR through its standard interfaces rather than a separate portal. If staff have to open another application to see the list, the model will be used for a few weeks and then forgotten.

    How do you explain a prediction to clinicians?

    Show the few factors that pushed the score up, in clinical language, with the dates of the data behind them. A clinician who can see why a patient was flagged can judge whether the reason still holds.

    • Reasons: a short list such as a recent admission or a rising lab value, not raw feature names from the pipeline.
    • Data age: the date of each value used, so a stale result is visible.
    • Limits: what the model does not see, such as care received outside the organization.
    • Feedback: a one-click way to mark a flag as not useful, with an optional reason, reviewed by the model owner.

    Never present the score as a diagnosis. It is a prompt to look, and the screen wording should say so.

    What should the validation report contain?

    Everything a reviewer needs to decide whether the model is fit for its intended use, on a few pages. Write it before deployment and update it at each retraining.

    • Purpose: the decision the model supports, the action and the audience.
    • Data: the cohort rules, outcome definition, data period and sites included.
    • Performance: results on the time split and site split, overall and by subgroup, with calibration.
    • Threshold: the chosen cut-off and the daily workload it produces.
    • Known limits: groups or situations where results were weaker or untested.
    • Ownership: the named owner, the monitoring plan and the next review date.

    How do you know the model is helping?

    Measure the actions and outcomes, not only the model's accuracy. A well-calibrated model that nobody acts on changes nothing.

    Track what happened to flagged patients: whether someone acted, how quickly, and whether the outcome the model predicted became less frequent. Compare with a period before the model or with a group that did not get flags, and agree the comparison with clinical leads before the results arrive.

    Why do EHR models drift?

    Because the EHR changes under them. New templates, new codes, a new lab analyzer or a new patient population all shift the data.

    • Input drift: feature distributions move, for example after a documentation change.
    • Outcome drift: the event rate changes, for example after a new care program.
    • Performance drift: calibration or ranking worsens on recent data.

    Monitor all three on a schedule, name an owner for each model, and set the conditions that trigger review, retraining or retirement.

    Mistakes in EHR modeling projects

    • Target first, action later: a model trained before anyone agreed who would act on it.
    • Random test split: patients shuffled across train and test, hiding how the model ages.
    • One overall score: a single accuracy figure that hides weak results in a subgroup.
    • Alert by default: every flag sent as an interruptive alert, so clinicians learn to dismiss them.
    • No retirement plan: a model left running years after the workflow it served has changed.

    What are EHR predictive modeling best practices?

    Define the action and capacity first, build features at a fixed prediction time, validate over time, site and subgroup, deploy silently, show reasons in the workflow, and monitor drift with a named owner. Retire a model that no longer helps rather than leaving it running.

    How Agnotic can help

    Agnotic builds the data pipelines, feature stores, validation reports and workflow integration around predictive models on EHR data. We work with your clinical leads on the action and threshold, and with your regulatory adviser on how the model is classified.

    Build an EHR model with Agnotic

    We set up the features, validation and silent deployment for one model first.

    Related reading on Agnotic

    The analytics platform, decision support and alert design.

    Sources

    Frequently Asked Questions

    It uses past EHR records to estimate the chance of a future event early enough for someone to act, such as a readmission or a missed appointment.

    Talk to an engineer about your project

    Tell us the decision you want to support. We will scope the data and validation for one model.