{
  "abstract": "Objective: To evaluate large language model (LLM) generation of type 2 diabetes (T2DM) phenotyping SQL and the effect of database implementation context. Materials and Methods: Eight publicly accessible LLM-based systems generated SQL under progressively richer prompts using synthetic and University of North Carolina (UNC) Health electronic health record (EHR) data, both based on the Observational Medical Outcomes Partnership (OMOP) model. Outputs were compared with the Electronic Medical Records and Genomics (eMERGE) T2DM reference phenotype using SQL executability, F1, positive predictive value (PPV), and recall. Results: Fewer than 55% of limited-context synthetic outputs and no limited-context UNC EHR outputs executed without modification. Detailed codebooks (L3) increased executability to 81.3% in synthetic OMOP and 100% in UNC EHR; adding sample rows (L4) increased synthetic executability to 100%. Limited-context recall was as low as 0.01, whereas high-context outputs achieved recall [≥]0.99 at synthetic L4 and >0.90 at UNC L3, although UNC PPV remained substantially lower than recall. At the highest available context levels, Beta F1 ranged from 0.72-0.99 in synthetic OMOP and 0.57-0.68 in UNC EHR; all UNC models exceeded the diagnosis-code baseline (F1=0.54). The top synthetic performer fell from F1=0.99 to 0.64 on UNC EHR. Discussion: Richer database context was associated with more consistent SQL executability and recall, while model rankings varied across datasets. Conclusion: LLMs can generate clinically meaningful T2DM phenotyping SQL when provided with sufficient database context, but limited PPV in real-world data underscores the need for local validation.",
  "abstract_shown": true,
  "affiliations": [],
  "article_type": "PUBLISHAHEADOFPRINT",
  "arxiv": null,
  "author_total": 7,
  "authors": [
    {
      "name": "Mengshuo Ye",
      "orcid": "0009-0005-0713-9069"
    },
    {
      "name": "Harlin Lee",
      "orcid": "0000-0001-6128-9942"
    },
    {
      "name": "Selen Gizlice"
    },
    {
      "name": "Madeline Tobias"
    },
    {
      "name": "Shawn O’Neil"
    },
    {
      "name": "Emily Pfaff"
    },
    {
      "name": "Stanley C Ahalt"
    }
  ],
  "bibtex": "https://research.draconitic.com/paper/5s7tbj1ywqx28.bib",
  "cited_by": 0,
  "doi": "10.64898/2026.10.27.26366654",
  "fulltext_url": "https://www.medrxiv.org/content/10.64898/2026.10.27.26366654v1.full",
  "id": "5s7tbj1ywqx28",
  "issns": [],
  "landing_url": "https://www.medrxiv.org/content/10.64898/2026.10.27.26366654v1",
  "language": "en",
  "licence": "CC-BY",
  "licence_label": "CC BY",
  "licence_source": "article",
  "licence_url": "https://creativecommons.org/licenses/by/4.0/",
  "metadata_licence": null,
  "native_subjects": [
    [
      "heading",
      "Article"
    ],
    [
      "medrxiv",
      "health informatics"
    ],
    [
      "openalex",
      "1702|Machine Learning in Healthcare"
    ]
  ],
  "openalex": "W7224094723",
  "pdf_url": "https://www.medrxiv.org/content/10.64898/2026.10.27.26366654v1.full.pdf",
  "pmcid": "PMC13734226",
  "pmid": "42990722",
  "published": "2026-10-27",
  "publisher": "Cold Spring Harbor Laboratory Preprints",
  "ris": "https://research.draconitic.com/paper/5s7tbj1ywqx28.ris",
  "sources": [
    {
      "first_seen": "2026-10-30T12:21:58Z",
      "native_id": "10.64898/2026.10.27.26366654",
      "source": "medrxiv",
      "url": "https://www.medrxiv.org/content/10.64898/2026.10.27.26366654v1"
    },
    {
      "first_seen": "2026-11-08T12:23:51Z",
      "native_id": "PMC13734226",
      "source": "pmc",
      "url": "https://doi.org/10.64898/2026.10.27.26366654"
    }
  ],
  "subjects": [
    {
      "field": "medicine",
      "origin": "medrxiv:health informatics",
      "subfield": "epidemiology-public-health"
    }
  ],
  "title": "Richer database context improves LLM-generated EHR phenotyping algorithms",
  "title_text": "Richer database context improves LLM-generated EHR phenotyping algorithms",
  "type": "preprint",
  "updated_at": "2026-11-08T12:23:51Z",
  "url": "https://research.draconitic.com/paper/5s7tbj1ywqx28",
  "venue": "medRxiv",
  "versions": []
}