Blog

    Data Mining in Healthcare

    By GauravNovember 13, 202610 mins read
    On this page

    Someone asks the data team for 'everyone with heart failure' and receives a spreadsheet of diagnosis codes by Friday. Half the patients were ruled out by an echocardiogram the query never saw. A few were included because a problem-list entry was copied forward and never assessed. The spreadsheet still looks decisive.

    Data mining in healthcare is how you define that search so the pattern is real: a phenotype with inclusions and exclusions, a quality measure that does not drop encounters on the floor, and a privacy path decided before the file leaves the building. This guide is for the people who write those queries and the leaders who sign for them.

    What is data mining in healthcare?

    Mining EHR and claims data?

    Agnotic Technologies builds the cohort definitions, privacy controls, and query pipelines that make EHR and claims mining reviewable.

    Data mining in healthcare is the search for patterns in EHR and claims records: phenotypes, quality-measure gaps, and cohorts safe to study. It is not a dump of the warehouse. Each query needs a purpose, a privacy method, and a check that the pattern is not an artifact of how the chart was captured.

    The mining is useful when it changes a list a human will review: patients who appear to meet a measure and do not, sites whose documentation pattern hides a diagnosis, a trial cohort that can be chart-reviewed. It is not useful when it produces a score nobody can recompute. Write the purpose in one sentence before the SQL. If the sentence is 'see what we find,' you do not have a mine. You have a browse of protected data.

    How do you define a phenotype from the EHR?

    A phenotype is a written rule that decides who has the condition in the data: which codes, which labs or meds, over what time window, and which findings exclude the person. A single ICD code on any encounter is not a phenotype. It is a filter.

    Start from the clinical definition the requester actually means. Heart failure as a billing diagnosis, heart failure as a problem-list entry, and heart failure confirmed by a note or a study are three populations. Pick one. Then list inclusions, exclusions, and the encounter types that count. Run the rule, and hand a sample to a clinician for chart review before anyone publishes a rate. Record the version of the rule next to the result. When the value set changes, the old result must still be explainable. Patients who almost qualified belong in an exception file, because that file is where missing codes and copy-forward problems show up.

    • Inclusion: The codes, meds, or results that put a person in, and the window they must fall inside.
    • Exclusion: The findings that take a person out, including rule-out language if you can detect it.
    • Source: Problem list, encounter diagnosis, claim, or note. Name which sources are allowed to fire the rule.
    • Review: A chart sample before the count is treated as true.
    • Version: The rule text and the code-set date stored with the output.

    How do quality measures leak during mining?

    Quality measures leak when the mine and the official specification do not use the same value sets, the same time windows, or the same exclusions. The dashboard then shows a gap that is really a mapping gap.

    A measure that wants a result coded with a specific set will not see a result stored as free text, a local code, or a scan in a document. Those patients fall out of the numerator, the denominator, or both, and the leakage is invisible if you only count coded rows. Compare your mine to a period the quality team already reported. Where the lists differ, classify the reason: unmapped code, wrong encounter type, excluded payer, or a timing rule you shortened for convenience. Fix the map or label the mine as an operations list, not as the measure. Publishing the operations list as the measure is how a hospital argues with itself.

    • Value set: The codes the specification names, plus a count of local codes that never mapped.
    • Timing: The same lookback and follow-up windows as the specification, not a round number of days.
    • Exclusions: Hospice, enrollment, and encounter type applied before the rate is shown.
    • Reconciliation: One closed period compared to the quality team's official list.
    • Label: An operations worklist is marked as such when it is not the certified measure.

    When is mined data still protected health information?

    Mined data is still protected health information when it identifies a person or when there is a reasonable basis to believe it can be used to identify a person. Removing the name column does not finish the job.

    45 CFR 164.514(b) allows two methods. Expert determination requires a person with appropriate knowledge to decide that the risk of identification is very small, and to document the methods and results. Safe Harbor requires removal of a specific list of identifiers of the person and of relatives, employers, or household members, including names, many geographic units smaller than a state, and elements of dates except year, plus no actual knowledge that the remaining information could identify someone. A spreadsheet of rare procedures, a small ZIP code, and a birth year can fail both tests. If the file is still identifiable, the HIPAA Security Rule controls on the system that holds it still apply, including who can query it.

    When does mining become human subjects research?

    Mining becomes human subjects research when it is a systematic investigation designed to develop or contribute to generalizable knowledge and it uses identifiable private information. A medical record is the regulation's own example of private information. An internal operations count is a different activity from a study meant to generalize.

    45 CFR 46.102 defines research that way, and it defines a human subject to include a living individual about whom an investigator obtains, uses, studies, analyzes, or generates identifiable private information. Identifiable means the identity is or may readily be ascertained by the investigator or associated with the information. HHS has also noted that the Common Rule does not use the HIPAA list of identifiers and does not define de-identified the way the Privacy Rule does. A file that passed a HIPAA method can still be identifiable to an investigator who holds the link. Take the protocol to the IRB or the privacy board before the query runs on identifiable data for a generalizable purpose. Do not decide the Common Rule question by checking whether the name column was dropped.

    How do you catch bias in a healthcare data mine?

    You catch bias by asking who is missing from the data the mine can see, and whether the pattern is a difference in health or a difference in who gets coded, tested, or billed. A model trained on that pattern will repeat it.

    Split the cohort by site, by payer, and by whether the fact came from a claim or a chart. A condition that appears often in insured outpatient claims and rarely in a safety-net ED note is not, by itself, a difference in disease. It may be a difference in documentation. Missing labs are not the same as normal labs. Write that rule down so the query does not treat a blank as a negative. If a score will rank patients for outreach, review the false negatives with clinicians at more than one site before the score pages anyone. The review is part of the mine. A fairness slide added after go-live is not.

    • Missingness: Blank is not normal. Count how often the fact is absent, by site.
    • Source mix: Charts and claims reported separately before they are combined.
    • Site effect: Rates that move more by facility than by the clinical factor you meant to study.
    • Label quality: Copy-forward problem lists and rule-out diagnoses called out in the sample review.
    • Use: A ranking that contacts patients is reviewed on false negatives, not only on overall accuracy.

    What should a mining pipeline keep for each query?

    Each query should keep its purpose, its rule version, the date of the data, who ran it, and where the output went. Without that record you cannot explain a number six months later, and you cannot prove the file was allowed to leave.

    Store the SQL or the phenotype definition beside the output, not in someone's laptop. Stamp the load id of the warehouse tables that were read. If the output contains identifiers, the destination is a system with access control and audit, and the ticket that approved the use is on the row. If the output is de-identified, store which method was used and who signed the determination. Retention follows the purpose: a worklist for this month's care gap does not need to live for the life of a research study, and a research extract does not belong in the outreach tool.

    Which questions should you refuse to mine?

    Refuse a mine that has no clinical owner, no privacy method, and no decision it will change. Also refuse a request to re-identify a de-identified file because a result looked interesting, unless the re-identification path in 164.514(c) was approved for that purpose.

    Other refusals are practical. Do not mine free-text notes for a diagnosis the structured data already defines, unless a reviewed method exists for the text and the identifiers in the note have been handled. Do not build a rank of 'non-compliant patients' from missed appointments without a clinician who will say what the outreach is allowed to do. Do not join a marketing list to the EHR because both files have a phone number. The phone number is an identifier, and the purpose has changed. A refusal with a reason is part of running the platform. A yes to every extract is how the PHI zone leaks.

    How Agnotic can help

    Agnotic Technologies builds the mining path for the client: phenotype rules that can be versioned, reconciliation against a known quality period, and a split between identifiable worklists and de-identified extracts. Agnotic wires the audit of who ran the query and which method, HIPAA or IRB, allowed the output.

    The engagement starts from the question and the decision it is supposed to change. Queries that cannot name a purpose, a population, and a privacy method are not implemented as a convenience export.

    Make the cohort explainable

    Plan a mining pipeline with our engineers, or read the data engineering guides.

    Related reading on Agnotic

    Related work on EHR analytics, data at a larger scale, trial metrics, and protecting the data once it is collected.

    Sources

    Frequently Asked Questions

    A report repeats a known metric. Mining searches a population with a rule you may still be testing, which is why the rule version, the chart review, and the privacy method have to travel with the result. Once the rule is stable and the privacy path is settled, the same logic can become a report.

    Talk to an engineer about your project

    We build healthcare mining pipelines with versioned phenotypes, privacy methods, and an audit of every extract.

    Go deeper

    Services and solutions on this topic