<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://eotles.com/feed.xml" rel="self" type="application/atom+xml" /><link href="https://eotles.com/" rel="alternate" type="text/html" /><updated>2026-05-14T07:00:24+00:00</updated><id>https://eotles.com/feed.xml</id><title type="html">Erkin Ötleş</title><subtitle>Erkin Ötleş&apos; blog, portfolio, and website. Focused on engineering medicine.  Thoughts on artificial intelligence, operations research, healthcare and medicine.</subtitle><author><name>Erkin Ötleş</name></author><entry><title type="html">SAIL 2026, Forecasting Emergency Department Boarding</title><link href="https://eotles.com/blog/talk/SAIL-2026-Forecasting-ED-Boarding/" rel="alternate" type="text/html" title="SAIL 2026, Forecasting Emergency Department Boarding" /><published>2026-05-04T00:00:00+00:00</published><updated>2026-05-04T00:00:00+00:00</updated><id>https://eotles.com/blog/talk/SAIL-2026-Forecasting-ED-Boarding</id><content type="html" xml:base="https://eotles.com/blog/talk/SAIL-2026-Forecasting-ED-Boarding/"><![CDATA[<h1 id="forecasting-emergency-department-boarding">Forecasting emergency department boarding</h1>

<p>Presented at SAIL 2026, this poster describes a prospective evaluation of methods for forecasting emergency department (ED) boarding across two UC San Diego Health emergency departments. We compared classical econometric models, machine learning models, time-series foundation models, and hybrid approaches in a live operational setting.</p>

<p>The central finding is that, for this kind of short-horizon operational forecasting problem, classical multivariate forecasting remains very difficult to beat. A well-specified vector autoregression (VAR) model consistently improved on the operational moving-average baseline at both La Jolla and Hillcrest. More complex hybrid and foundation-model approaches were sometimes helpful, but their gains were more modest and site-dependent.</p>

<p>I think this is an important result for healthcare AI. There is a natural tendency to assume that newer model classes should dominate older methods, especially as foundation models become available for more data modalities. However, in operational medicine, the best model is often the one that fits the structure of the problem, can be retrained reliably, produces interpretable outputs, and can be placed into a real decision-making workflow. In this case, a transparent multivariate time-series model provided a strong practical foundation for forecast-driven operational planning.</p>

<h2 id="presentation">Presentation</h2>

<iframe src="https://eotles.com/assets/presentations/2026_SAIL/2026_SAIL.pdf" style="aspect-ratio: 16 / 9;" width="100%">
</iframe>

<p><a href="https://eotles.com/assets/presentations/2026_SAIL/2026_SAIL.pdf">Link to download.</a></p>

<h2 id="abstract">Abstract</h2>

<p><strong>Background:</strong> Emergency department boarding is a major driver of crowding, delays in care, and downstream operational harm. Short-horizon forecasts of boarding volume may support proactive health-system actions, including discharge acceleration, intra-system transfers, and elective surgical adjustments. However, much of the prior forecasting literature focuses on ED arrivals and is evaluated retrospectively, rather than prospectively in live operational settings.</p>

<p><strong>Methods:</strong> We prospectively compared six forecasting approaches spanning econometrics, machine learning, and time-series foundation models to predict daily ED boarding volume up to four days ahead (T+1 to T+4) across two UC San Diego Health EDs, La Jolla and Hillcrest. Daily covariates represented key operational drivers, including recent boarding volume, planned surgical volume, hospital census, and temporal indicators. Each morning at 07:10, models were retrained using all available data through day T and generated forecasts for T+1 to T+4 using an identical rolling evaluation framework. We evaluated vector autoregression (VAR), XGBoost, Google TimesFM, and two hybrid extensions (VAR+XGBoost and TimesFM+XReg), against a two-week moving-average operational baseline.</p>

<p><strong>Results:</strong> During a four-month prospective validation period, VAR consistently outperformed the operational baseline at both sites. The VAR+XGBoost hybrid achieved the lowest RMSE for three of four forecast horizons at La Jolla and two of four forecast horizons at Hillcrest. Relative to baseline RMSE, VAR+XGBoost reduced forecast error by 16 to 42% at La Jolla and 5 to 19% at Hillcrest. However, the incremental gain over VAR alone was modest, highlighting the continued value of interpretable econometric structure for multivariate operational time series. TimesFM performance was site-dependent, and the addition of external regressors through TimesFM+XReg improved accuracy at La Jolla and only at shorter horizons at Hillcrest. VAR was implemented in live operations, with forecasts emailed daily to Mission Control and reviewed in the morning huddle to inform same-day planning. Forecast uncertainty was communicated using 80% confidence intervals, which demonstrated good coverage during prospective use.</p>

<p><strong>Conclusion:</strong> This work demonstrates a practical learning health system workflow for forecast-driven decision support. It provides a prospective, real-world comparison of econometric, machine learning, and foundation-model approaches for ED boarding prediction, and suggests that classical multivariate forecasting remains a strong baseline even when modern foundation models and hybrid methods are available.</p>

<h2 id="what-we-studied">What we studied</h2>

<p>ED boarding is an operationally meaningful forecasting target because it sits at the intersection of emergency care, inpatient capacity, transfer decisions, discharge planning, and elective procedural scheduling. Unlike ED arrivals, which are often modeled as a demand signal, boarding reflects the interaction between demand, hospital throughput, and capacity constraints. That makes it a more difficult forecasting problem, but also a more actionable one.</p>

<p>We compared six approaches for daily ED boarding forecasts:</p>

<p>1) Two-week moving average, used as the operational baseline</p>

<p>2) Vector autoregression (VAR), a classical econometric model for multivariate time series</p>

<p>3) XGBoost, a flexible machine learning model</p>

<p>4) TimesFM, a time-series foundation model</p>

<p>5) VAR + XGBoost, a hybrid model designed to combine structured time-series forecasting with nonlinear residual modeling</p>

<p>6) TimesFM + XReg, a foundation-model extension incorporating external regressors</p>

<p>The models were evaluated prospectively from July through October 2024 at two UC San Diego Health emergency departments, La Jolla and Hillcrest.</p>

<h2 id="operational-implementation">Operational implementation</h2>

<p>The VAR model was implemented in live operations. Each morning at 07:10, updated forecasts were generated and emailed to Mission Control staff and health-system leaders. The forecasts were then reviewed during the daily huddle and used to support proactive operational planning, including discharge planning, intra-system transfers, and surgical-case scheduling.</p>

<p>This implementation detail matters. Retrospective forecasting studies can show whether a model might have been accurate under historical conditions, but prospective use tests a broader set of requirements. The data must be available on time. The pipeline must run reliably. The forecast must arrive early enough to shape operational decisions. The output must be understandable to the people who can act on it. In this project, the deployed forecast was not simply an academic prediction exercise, it was incorporated into the daily rhythm of health-system operations.</p>

<h2 id="key-findings">Key findings</h2>

<ul>
  <li>VAR consistently outperformed the operational moving-average baseline at both sites.</li>
  <li>VAR + XGBoost produced the best point performance across several horizons, but only modestly improved on VAR alone.</li>
  <li>TimesFM performance varied by site, performing worse than baseline at La Jolla and better than baseline at Hillcrest.</li>
  <li>Adding external regressors improved TimesFM at La Jolla and at shorter horizons at Hillcrest.</li>
  <li>Uncertainty estimates from the deployed VAR model were communicated as 80% confidence intervals and showed good prospective coverage.</li>
</ul>

<h2 id="why-this-matters">Why this matters</h2>

<p>For me, the most interesting part of this work is not that one model won. It is that the results complicate a simple narrative about model sophistication. Modern foundation models and flexible machine learning approaches are powerful, but operational healthcare forecasting is not only a model-selection problem. It is also a data availability problem, a workflow problem, and a decision-support problem.</p>

<p>In this setting, the classical VAR model had several advantages. It could directly model relationships among operational time series. It could be retrained in a straightforward rolling framework. It produced forecasts and uncertainty estimates that were relatively easy to communicate. It also fit the cadence of the operational workflow, where daily forecasts needed to be available early enough to support planning.</p>

<p>The broader lesson is that healthcare AI systems should be evaluated in the context in which they will be used. For operational forecasting, a useful system needs to be accurate enough, reliable enough, understandable enough, and timely enough to support action. Prospective evaluation is essential because it captures the frictions that retrospective experiments often miss.</p>

<h2 id="selected-links">Selected links</h2>

<ul>
  <li><a href="https://sail.health">SAIL conference website</a></li>
  <li><a href="https://research.google/blog/a-decoder-only-foundation-model-for-time-series-forecasting/">Google Research TimesFM</a></li>
  <li><a href="https://xgboost.readthedocs.io/">XGBoost documentation</a></li>
  <li><a href="https://www.statsmodels.org/stable/vector_ar.html">statsmodels VAR documentation</a></li>
</ul>

<h2 id="citation">Citation</h2>

<p>Poursoltan L, Ötleş E, Cao J, Clay B, Trimble B, Adrid L, Pan J, Chua A, Bell J, Longhurst CA, Zhu K, Singh K. Prospective comparison of econometric, machine learning, and foundation models for forecasting emergency department boarding patients. Presented at SAIL 2026.</p>

<p>Cheers, <br /></p>

<p>Erkin <br />
<a href="https://eotles.com">Go ÖN Home</a></p>]]></content><author><name>Erkin Ötleş</name></author><category term="Blog" /><category term="Talk" /><category term="medicine" /><category term="emergency medicine" /><category term="healthcare operations" /><category term="forecasting" /><category term="predictive models" /><category term="artificial intelligence" /><category term="machine learning" /><category term="foundation models" /><category term="vector autoregression" /><summary type="html"><![CDATA[A prospective comparison of econometric, machine learning, and foundation models for forecasting emergency department boarding.]]></summary></entry><entry><title type="html">UW Emergency Medicine Trauma Case Conference, ED Thoracotomy, Pediatric Hematuria, and Evaluating Predictive AI</title><link href="https://eotles.com/blog/talk/UW-Trauma-Case-Conference-and-AI-Evaluation/" rel="alternate" type="text/html" title="UW Emergency Medicine Trauma Case Conference, ED Thoracotomy, Pediatric Hematuria, and Evaluating Predictive AI" /><published>2026-02-19T00:00:00+00:00</published><updated>2026-02-19T00:00:00+00:00</updated><id>https://eotles.com/blog/talk/UW-Trauma-Case-Conference-and-AI-Evaluation</id><content type="html" xml:base="https://eotles.com/blog/talk/UW-Trauma-Case-Conference-and-AI-Evaluation/"><![CDATA[<h1 id="trauma-case-conference-plus-some-ai-evaluation">Trauma case conference, plus some AI evaluation</h1>

<p>Presentation for the University of Wisconsin - Madison, Department of Emergency Medicine Residency case conference.
Ostensibly, the theme was trauma, however after an excellent joint trauma conference last week, I used part of this session to cover my approach to evaluating predictive AI models.</p>

<p>(As always, details are educational, and cases are composites rather than identifiable real patients.)</p>

<h2 id="what-we-covered">What we covered</h2>

<p>1) When is an ED thoracotomy indicated?</p>

<p>2) Pediatric hematuria after blunt trauma, CT or observation?</p>

<p>3) How do you evaluate a predictive model that fires alerts?</p>

<h2 id="slides">Slides</h2>

<iframe src="https://eotles.com/assets/presentations/2026_UW_Trauma_AI_Case_Conference/2026_Trauma_AI_Case_Conference.pdf" style="aspect-ratio: 16 / 9;" width="100%">
</iframe>

<p><a href="https://eotles.com/assets/presentations/2026_UW_Trauma_AI_Case_Conference/2026_Trauma_AI_Case_Conference.pdf">Link to download presentation.</a></p>

<h2 id="ed-thoracotomy-supplemental-videos-and-resources">ED thoracotomy supplemental videos and resources</h2>

<h3 id="clamshell-approach">Clamshell Approach</h3>

<!-- Courtesy of embedresponsively.com -->

<div class="responsive-video-container">
    <iframe src="https://www.youtube-nocookie.com/embed/crWwSpv3Z8Q" title="YouTube video player" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen=""></iframe>
  </div>

<ul>
  <li><a href="https://www.youtube.com/watch?v=crWwSpv3Z8Q">Getting to the Heart of the Matter: Breaking Down the Resuscitative Thoracotomy (YouTube)</a></li>
</ul>

<h3 id="traumatic-effusions-second-half">Traumatic Effusions (second half)</h3>

<!-- Courtesy of embedresponsively.com -->

<div class="responsive-video-container">
    <iframe src="https://www.youtube-nocookie.com/embed/Jesl3piKW7c" title="YouTube video player" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen=""></iframe>
  </div>

<ul>
  <li><a href="https://www.youtube.com/watch?v=Jesl3piKW7c">Is This a Pericardial Effusion? (YouTube)</a></li>
</ul>

<h3 id="resuscitative-thoracotomy-step-by-step-procedure">Resuscitative thoracotomy: step-by-step procedure</h3>

<!-- Courtesy of embedresponsively.com -->

<div class="responsive-video-container">
    <iframe src="https://www.youtube-nocookie.com/embed/Y3c-4i80huw" title="YouTube video player" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen=""></iframe>
  </div>

<ul>
  <li><a href="https://www.youtube.com/watch?v=Y3c-4i80huw">Resuscitative Thoracotomy Procedure (YouTube)</a></li>
</ul>

<h3 id="tray-setup-and-practical-logistics">Tray setup and practical logistics</h3>

<!-- Courtesy of embedresponsively.com -->

<div class="responsive-video-container">
    <iframe src="https://www.youtube-nocookie.com/embed/924t8kpW-p4" title="YouTube video player" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen=""></iframe>
  </div>

<ul>
  <li><a href="https://www.youtube.com/watch?v=924t8kpW-p4">EMCrit: Abbreviated Thoracotomy Tray (YouTube)</a></li>
  <li><a href="https://litfl.com/resuscitative-thoracotomy/">LITFL: Resuscitative Thoracotomy</a></li>
</ul>

<!-- Courtesy of embedresponsively.com -->

<div class="responsive-video-container">
    <iframe src="https://www.youtube-nocookie.com/embed/GFX_tocJShA" title="YouTube video player" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen=""></iframe>
  </div>

<ul>
  <li><a href="https://www.youtube.com/watch?v=GFX_tocJShA">Hinds: Crack the Chest, Get Crucified (YouTube)</a></li>
</ul>

<h2 id="selected-references-as-cited-in-the-deck">Selected references (as cited in the deck)</h2>

<p><strong>ED thoracotomy</strong></p>
<ul>
  <li>Burlew CC, et al. Western Trauma Association critical decisions in trauma, resuscitative thoracotomy. <em>J Trauma Acute Care Surg.</em> 2012. <a href="https://doi.org/10.1097/TA.0b013e318270d2df">doi:10.1097/TA.0b013e318270d2df</a></li>
  <li>Seamon MJ, et al. An evidence-based approach to patient selection for emergency department thoracotomy. <em>J Trauma Acute Care Surg.</em> 2015. <a href="https://doi.org/10.1097/TA.0000000000000648">doi:10.1097/TA.0000000000000648</a></li>
  <li>Dewey EN, et al. Resuscitative thoracotomy, what you need to know. <em>J Trauma Acute Care Surg.</em> 2025. <a href="https://doi.org/10.1097/TA.0000000000004803">doi:10.1097/TA.0000000000004803</a></li>
  <li>Simms ER, et al. Bilateral anterior thoracotomy (clamshell incision) is the ideal emergency thoracotomy incision, an anatomic study. <em>World J Surg.</em> 2013. <a href="https://doi.org/10.1007/s00268-013-1961-5">doi:10.1007/s00268-013-1961-5</a></li>
  <li>Tacoma Trauma Trust. ED thoracotomy guidelines (2016). <a href="https://www.tacomatrauma.org/wp-content/uploads/2023/04/TacTrTrust-ED-thoracotomy-guidelines-2016.pdf">PDF</a></li>
</ul>

<p><strong>Traumatic hematuria and renal injury</strong></p>
<ul>
  <li>Coccolini F, et al. Kidney and uro-trauma, WSES-AAST guidelines. <em>World J Emerg Surg.</em> 2019. <a href="https://doi.org/10.1186/s13017-019-0274-x">doi:10.1186/s13017-019-0274-x</a></li>
  <li>Hosein PJ, et al. Coming Together, a review of the American Association for the Surgery of Trauma’s updated kidney injury scale. <em>AJR.</em> 2019. <a href="https://doi.org/10.2214/AJR.19.21486">doi:10.2214/AJR.19.21486</a></li>
  <li>Hagedorn JC, et al. Pediatric blunt renal trauma practice management guidelines, collaboration between EAST and the Pediatric Trauma Society. <em>J Trauma Acute Care Surg.</em> 2019. <a href="https://doi.org/10.1097/TA.0000000000002209">doi:10.1097/TA.0000000000002209</a></li>
  <li>UW Emergency Radiology. AAST kidney injury scale reference. <a href="https://sites.uw.edu/eradsite/trauma-radiology-reference-resource/6-abdomen/aast-kidney-injury-scale/">Link</a></li>
</ul>

<p><strong>Predictive AI model evaluation</strong></p>
<ul>
  <li>Wong A, et al. External validation of a widely implemented proprietary sepsis prediction model in hospitalized patients. <em>JAMA Intern Med.</em> 2021. <a href="https://doi.org/10.1001/jamainternmed.2021.2626">doi:10.1001/jamainternmed.2021.2626</a></li>
  <li>Tarabichi S, et al. Improving timeliness of antibiotic administration using a provider and pharmacist facing sepsis early warning system in the emergency department setting. <em>Crit Care Med.</em> 2022. <a href="https://doi.org/10.1097/CCM.0000000000005267">doi:10.1097/CCM.0000000000005267</a></li>
</ul>

<p>Cheers, <br /></p>

<p>Erkin <br />
<a href="https://eotles.com">Go ÖN Home</a></p>]]></content><author><name>Erkin Ötleş</name></author><category term="Blog" /><category term="Talk" /><category term="medicine" /><category term="emergency medicine" /><category term="trauma" /><category term="resuscitative thoracotomy" /><category term="pediatric trauma" /><category term="hematuria" /><category term="predictive models" /><category term="artificial intelligence" /><category term="healthcare AI" /><summary type="html"><![CDATA[Two trauma cases, plus a pragmatic approach to evaluating predictive AI models at the bedside.]]></summary></entry><entry><title type="html">AI Infrastructure: Technical Integration Testing</title><link href="https://eotles.com/blog/Healthcare-AI-Infrastructure-Technical-Integration-Testing/" rel="alternate" type="text/html" title="AI Infrastructure: Technical Integration Testing" /><published>2024-10-22T00:00:00+00:00</published><updated>2024-05-08T00:00:00+00:00</updated><id>https://eotles.com/blog/Healthcare-AI-Infrastructure-Technical-Integration-Testing</id><content type="html" xml:base="https://eotles.com/blog/Healthcare-AI-Infrastructure-Technical-Integration-Testing/"><![CDATA[<p>NB: this series is still a work in progress.</p>

<p>This post builds off of our previous discussions on healthcare AI infrastructure.
If you are unfamiliar with that infrastructure, it may be helpful to review the posts that cover the AI lifecycle or the general infrastructure landscape.</p>

<h1 id="overview">Overview</h1>

<h2 id="technical-integration-testing">Technical Integration Testing</h2>

<p>Although I’ve alluded to it, we haven’t formally discussed testing side of integration yet. 
Testing all the components needed to technically implement the system is something that I refer to as <em>technical integration testing</em>.
After careful consideration of clinical workflow it is one of the most important steps in the implementation process, imo.</p>

<p>The basic premise of technical integration testing is to double check that you get the expected results from implementation components and that the system functions correct.<br />
This can be tricky because you need a good end-to-end understanding of the system and should approach each of the components from several different perspectives (software engineer, data engineer, ML engineer).
Additionally, we don’t have a standard toolbox to use when we are conducting technical integration testing.</p>

<p>Although I didn’t have a guide book, I tried to approach this process in a systematic manner through the course of the M-CURES project.
I ended up creating several techniques that can be … [TODO: transition]</p>

<p>A couple of the techniques were simply around getting more information from the integration system.
These involved closely examining the way data was being passed to and from the model.
This is crucial because small changes in data format coming in can have big downstream consequences.
As such we developed some techniques that allowed us to debug how our model was receiving and processing data.
These techniques utilized the Python error console that Epic provided in the ECCP management dashboard.
We built custom errors that helped assure that we were receiving and processing data in the correct manner.
This process helped us refine our mental model of ECCP to align with the way it actually works.</p>

<p>Part of the ECCP production debugging was inspired by another line of testing that we had conducted, which was diffing predictions.
Diffing predictions grew out of a technique we had developed for <a href="https://proceedings.mlr.press/v149/otles21a/otles21a.pdf">analyzing prospective performance degradation</a>.
The basic premise is straightforward.
Run the same information through two different implementations of the same</p>

<p>These techniques were:</p>
<ul>
  <li>ECCP Production Debugging</li>
  <li>Diffing PatientLevel Predictions</li>
</ul>

<p>ECCP Production Debugging</p>

<p>During this implementation process I developed 2 techniques that could ev</p>

<p>some approaches for That being said, I did take a shot at doing a systematic</p>

<p>This is an area I’m particularly interested in and hopefully I can convince some peer reviewers that</p>

<p>It would be</p>

<p>Its tricky as you have to you need to approach the system from a c</p>

<p>During this process 
    - slate vs. manually running the model
    - production debugging</p>

<p>Cheers, <br />
Erkin <br />
<a href="https://eotles.com">Go ÖN Home</a></p>]]></content><author><name>Erkin Ötleş</name></author><category term="Blog" /><category term="medicine" /><category term="healthcare" /><category term="artificial intelligence" /><category term="machine learning" /><category term="data science" /><category term="FDA" /><category term="clinical decision support" /><category term="technology in medicine" /><category term="implementation" /><category term="implementation science" /><summary type="html"><![CDATA[How do we ensure what we built actually works in production?]]></summary></entry><entry><title type="html">AI Infrastructure Example: *C. difficile* Infection Risk</title><link href="https://eotles.com/blog/Healthcare-AI-Infrastructure-CDI/" rel="alternate" type="text/html" title="AI Infrastructure Example: *C. difficile* Infection Risk" /><published>2024-10-21T00:00:00+00:00</published><updated>2024-04-12T00:00:00+00:00</updated><id>https://eotles.com/blog/Healthcare-AI-Infrastructure-CDI</id><content type="html" xml:base="https://eotles.com/blog/Healthcare-AI-Infrastructure-CDI/"><![CDATA[<p>NB: this series is still a work in progress.</p>

<p>This post builds off of our previous discussions on healthcare AI infrastructure.
It may be helpful to review the posts that cover the general lay of healthcare IT land, development infrastructure, and implementation infrastructure.</p>

<h1 id="c-difficile-infection-model"><em>C. difficile</em> Infection Model</h1>

<p>We will be discussing the technical integration of a model that we have running at the University of Michigan.
We developed this model with the intent to <em>C. difficile</em> infection risk stratification</p>

<p>This is the model that we developed to integrated for <em>C. difficile</em> infection risk stratification.</p>

<figure>
 <img src="https://eotles.com/assets/post_assets/2024-Healthcare-AI-Lifecycle/implementation_infrastructure_self_hosted.png" alt="Architecture diagram for implementing custom models served outside of an EMR vendor's system. Research data warehouse generates reports that are then sent to the external model implementation environment, the model generates predictions which are then passed to the EMR system." />
 <figcaption>Architecture diagram for implementing custom models served outside of an EMR vendor's system. Research data warehouse generates reports that are then sent to the external model implementation environment, the model generates predictions which are then passed to the EMR system.</figcaption>
</figure>

<p>Data for this model comes from our research data warehouse then travels to the model posted on a Windows virtual machine.
The predictions from the model are then passed back to the EMR using web services.</p>

<p>We have a report that runs daily from the research state warehouse.
It’s a stored SQL procedure that runs at a set time very early in the morning about 5 AM.
This is essentially a large table of data for each of the patients that were interested in producing a prediction on rows our patients and columns are the various features that were interested in.
Stored procedures update information in a view inside of RDW.</p>

<p>The research data at warehouse and this view are accessible by a Windows machine that we have inside of the health IT secure computing environment.
This windows machine has a scheduled job that runs every morning about at about 6 AM.
This job pull the data down from the database runs a series of python files that you data pre-processing and apply the model to the data to the transform data, and then save the output, model predictions to a shared secured directory on the internal health system network.</p>

<p>We then returned the predictions to Chronicles, using infrastructure that our health IT colleagues helped to develop.
This infrastructure involves a scheduled job written in C# that reads the file that we have saved the shared directory does date of validation and then passes data into chronicles using epics web services framework.</p>

<p>These data end up as flow sheet values for each patient.
We then worked with our epic analyst colleagues to use the flow sheet data to trigger as practice alerts, and also to populate port.
The best practice alerts fire based off of some configuration that’s done inside of epic in order to be able to adjust the alerting threshold outside of Epic what we did was we modified the score such that the alerting information with someone distinct from the actual score so what we did is we packed an alert flag and the score together into a single decimal separated value and this is essentially a number however it’s unique and that it contains two pieces of information so we could take a patient to Oehlert on and we would say 1.56 a patient that we didn’t alert on would be zero point</p>

<p>Model predictions are passed to the EMR system using web services.
Predictions are then filed as either flowsheet rows (inpatient encounters) or smart data elements (outpatient encounters).
You have to build your own infrastructure to push the predictions to the EMR environment.</p>

<p>Cheers, <br />
Erkin <br />
<a href="https://eotles.com">Go ÖN Home</a></p>]]></content><author><name>Erkin Ötleş</name></author><category term="Blog" /><category term="medicine" /><category term="healthcare" /><category term="artificial intelligence" /><category term="machine learning" /><category term="data science" /><category term="FDA" /><category term="clinical decision support" /><category term="technology in medicine" /><category term="implementation" /><category term="implementation science" /><summary type="html"><![CDATA[Discussion of the technical integration for an in-hospital infection risk stratification model.]]></summary></entry><entry><title type="html">Healthcare AI Infrastructure - To be deprecated</title><link href="https://eotles.com/blog/Healthcare-AI-Infrastructure-Overview/" rel="alternate" type="text/html" title="Healthcare AI Infrastructure - To be deprecated" /><published>2024-09-30T00:00:00+00:00</published><updated>2024-04-11T00:00:00+00:00</updated><id>https://eotles.com/blog/Healthcare-AI-Infrastructure-Overview</id><content type="html" xml:base="https://eotles.com/blog/Healthcare-AI-Infrastructure-Overview/"><![CDATA[<p>NB: this series is still a work in progress.</p>

<h1 id="healthcare-ai-infrastructure">Healthcare AI Infrastructure</h1>
<p>This post started as a brief overview of healthcare AI infrastructure and then grew into an unwieldy saga incorporating my perspectives on building and implementing these tools.
As such, I split the post into a couple parts.
This part provides a general introduction, aiming to ground the discussion in the existing HIT landscape and setting up the general approaches for development and implementation.</p>

<p>This post is followed by detailed posts on development and implementation.
In addition to providing more technical details these posts also walk through a couple projects that I’ve taken through the AI lifecycle.
Discussing these projects will make the concepts a bit more concrete.</p>

<h2 id="basic-healthcare-it-infrastructure">Basic Healthcare IT Infrastructure</h2>

<p>Its important to ground our conversation in the basic healthcare information technology (HIT) infrastructure, primarily focusing on electronic medical records systems (EMRs).
The reason for this is that the EMR is usually the source and destination of information processed by healthcare AI systems.
Having a solid understanding of the parts of the EMR is the foundation to good healthcare AI infrastructure.</p>

<figure>
 <img src="https://eotles.com/assets/post_assets/2024-Healthcare-AI-Lifecycle/overview_emr.png" alt="Generic EMR architecture diagram backend database serves data to users via a client frontend." />
 <figcaption>Generic EMR architecture diagram. The EMR backend has an operational database which serve data to clinical users via a client frontend user interface.</figcaption>
</figure>

<p>You can think of an EMR system as having two main components a database and client.
The database’s primary job is to store the underlying data of the EMR - patient names, demographics, vitals, labs, all the good stuff.
The client’s job is to present the user the information in a way that a human can understand.
There’s a whole bunch of additional code, configuration, and data that we aren’t going to directly discuss, but we may obliquely refer to the amalgamation of that stuff along with our friends the database and client.
The term <em>front end</em> refers to the client and all of its supporting code, configuration, and data handling mechanisms.
<em>Back end</em> refers to the database and all of its supporting configuration and communication code along with any other code that drives the logic and behavior of the EMR.</p>

<figure>
 <img src="https://eotles.com/assets/post_assets/2024-Healthcare-AI-Lifecycle/overview_epic.png" alt="EMR architecture diagram backend database, Chronicles, serves data to users via a client frontend, Hyperspace." />
 <figcaption>High-level Epic architecture diagram. Epic has server running a database called Chronicles, which serves data to a front end interface called Hyperspace.</figcaption>
</figure>

<p>To make things more concrete I’ll briefly discuss the Epic specific names for these components.</p>

<h3 id="back-end-chronicles">Back end: Chronicles</h3>

<p>Epic has a large back end written in a programming language called <a href="https://en.wikipedia.org/wiki/MUMPS">MUMPS</a> (it is also known as M or Caché, which is a popular implementation of the language).
MUMPS is a pretty <strong>interesting</strong> language for a variety of reasons (integrated key-value database, compact syntax, permissive scoping) - so I might write about it more in the future.
The database management system that holds all of the operational real-time clinical data is called <a href="https://ehealth.connect-care.ca/epic-systems/epic-analytic-tools/chronicles">Chronicles</a>, it is implemented using MUMPS for both the data storage and code controlling database logic, schema, indexing, etc.</p>

<h3 id="front-end-hyperspace">Front end: Hyperspace</h3>

<p>There are several distinct front ends for Epic; however there’s one that’s by far the most important - Hyperspace.
<em>Hyperspace</em> is the big daddy interface that is found on all the computers in clinic and the hospital.
It started out as Visual Basic application (I once heard a rumor that it was the largest piece of software ever made with VB); however, it is now mostly a .NET application.
If you’re a doctor you may also interact with Epic’s other client software, like <em>Haiku</em> (client for mobile phone) and <em>Canto</em> (client for iPad). 
Hyperspace is the primary place that clinical work is done, notes are written, orders are placed, and lab values are reviewed here.
These workflows are the primary places where additional contextual information would be helpful or where you would want to serve a best practice alert.
Thus, since Hyperspace is the most likely end-target for most of our healthcare AI efforts.</p>

<p>There are a couple of ways to get information into Hyperspace.
The first is to put stuff into the underlying database, Chronicles, and have the information integrated into the underlying mechanics of the EMR.
The second is to have Hyperspace display a view of the information, but have it served from a different source (like your own web server).
This is usually done through a <a href="https://en.wikipedia.org/wiki/Frame_(World_Wide_Web)">iframe</a>.<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">1</a></sup>
These options are not limited to Epic EMRs, you should be able to take either approach with any type of modern EMR system.</p>

<p>Now that we have discussed the basic healthcare IT landscape we can start to talk about the specifics of making AI tools for healthcare.</p>

<h2 id="ai-development-infrastructure">AI Development Infrastructure</h2>

<p>Now we can start to dig into the fun stuff - the actual building of healthcare AI models.
At the most basic level you need two things to start building an AI model: data and development environment (a computer).
Data often comes in the form of a report or extract from a database (often the EMR’s database).
This data are then used to train a model using a computing environment that is set up for training models.
These environments tend to be computers that are configured with special software and hardware that allow model developers to write code that can be used to develop and evaluate a model.</p>

<p>The data report out of underlying clinical systems can take a variety of forms.
Their most basic embodiment is that of a simple table of data, where each patient is a row and columns represent different types of info about that patient.
Once you have research or QI access it is pretty straightforward to get extracts of data from the EMR, when working with your local Epic analysts (employed by the hospital) they will probably give you data in the form of an excel or CSV file.
You can also get data from other sources, like collaborative institutions (where you have a shared IRB or BAA) or open source datasets like those available on <a href="https://physionet.org/about/database/">PhysioNet</a>.</p>

<p>Healthcare AI model development has typically taken place on premises servers that were maintained by the health system or engineering departments capable of attaining HIPAA compliance.
Privacy is super important - worthy of its own set of posts - but we won’t be able to it justice here - so make sure to work with your compliance people to do the right thing.
In terms of software tts fairly standard to use a linux or windows operating system with a python development environment, you usually want to be able to allow python packages to be downloaded as there’s a lot of great open source software out there for this type of work (e.g., scikit-learn , pytorch, tensorflow).
You’ll want to make sure that you have a fairly capable machine (lots of RAM and CPU cores), ideally having access to GPUs will make your life easier as well.
Maintaining all this infrastructure can be pretty difficult, as such there’s been a growing consideration for using cloud-based computing environments.<sup id="fnref:2" role="doc-noteref"><a href="#fn:2" class="footnote" rel="footnote">2</a></sup></p>

<figure>
 <img src="https://eotles.com/assets/post_assets/2024-Healthcare-AI-Lifecycle/overview_development.png" alt="Development overview." />
 <figcaption>Development overview.</figcaption>
</figure>

<p>The above figure depicts the generic data flow for model development.
Generally the data will flow linearly from a source clinical system towards our model development environment.</p>

<p>To help make the owners of the different components I have employed a consistent color scheme throughout this post.
Everything that is made and maintained by the EMR vendor (or their proxies) is red <img src="https://placehold.co/15x15/B85450/B85450.png" alt="#B85450" />.
Components owned by AI model developers are colored green <img src="https://placehold.co/15x15/82B366/82B366.png" alt="#82B366" />.
Components represent shared research infrastructure that may be owned by the health system or research enterprise are blue <img src="https://placehold.co/15x15/6C8EBF/6C8EBF.png" alt="#B85450" />.
Elements that don’t fit directly in one of these buckets are outlined in black <img src="https://placehold.co/15x15/000000/000000.png" alt="#000000" />.</p>

<h3 id="research-infrastructure">Research Infrastructure</h3>
<p>Now we can start to talk about the specific infrastructure that you may have to deal with.
This infrastructure is often a shared resource that supports multiple different types of data driven research, like health services research, epidemiology, and multi-omics.</p>

<figure>
 <img src="https://eotles.com/assets/post_assets/2024-Healthcare-AI-Lifecycle/development_infrastructure_research.png" alt="Architecture diagram for typical healthcare organization research infrastructure. Several clinical databases, like the laboratory information system (LIS), EMR (Chronicles and Clarity), along with many other sources may get fed into a central research data warehouse (RDW). This is then queried to get reports that can be used to develop models." />
 <figcaption>Research infrastructure architecture diagram. Several clinical systems, like the laboratory information system (LIS), EMR, and other sources may get fed into a central research data warehouse (RDW). This is then queried to get reports that can be used to develop models.</figcaption>
</figure>

<p>If your institution uses Epic your research IT set up may be similar to what we have at Michigan (depicted above).
Our data makes several stops before it gets to model developers.
These stops are known as <em>ETLs</em> (<em>short for extract, transform, load</em>), processes that take data in certain format and convert to another format for entry into a database.
There are two ETLs, the first of which is pretty much mandatory.</p>

<h3 id="chronicles--clarity">Chronicles → Clarity</h3>
<p>Chronicles is a database meant to support healthcare operations, but its not optimized for massive queries on large populations of patients.
To offload and optimize these types of analytical queries Epic created <em>Clarity</em> a SQL database (its built using Microsoft SQL Server) that is a transformation of the data stored in Chronicles.
There is an ETL that runs every day that pulls data out of Chronicles and into Clarity.</p>

<h3 id="clarity--rdw">Clarity → RDW</h3>
<p>Some institutions allow researchers to directly access data from Clarity.
That’s not the case at Michigan, instead there is a database that is specifically designed for researchers, known as <em>research data warehouse</em> (<em>RDW</em>).
RDW is also a SQL database and is built on top of <a href="https://careevolution.com/orchestrate/">CareEvolution’s Orchestrate</a> tooling.
This additional layer imposes some additional transformations but also allows other types of data, such as information from wearables or insurers, to be merged alongside the EMR data.</p>

<p>Data are then queried from RDW and then passed to the model development infrastructure.
The engineers can then work diligently to produce a model.</p>

<h3 id="a-note-on-etls">A note on ETLs</h3>
<p>We have found that ETLs may impact the performance of AI models.
There may be subtle differences between the data that come out of an ETL process and the underlying real-time data.
This is a type of dataset shift that we termed <em>infrastructure shift</em> and it means that you can expect slightly worse model performance in these situations.
For more information check out our <a href="/blog/research/Mind-the-Performance-Gap/">Mind the Performance Gap paper</a>.</p>

<h3 id="transitioning-from-development-to-implementation">Transitioning from Development to Implementation</h3>
<p>As we start to finalize models we end up at the interface between development and implementation.
This interstitial space is tricky because it not only spans a couple steps of the lifecycle, but it also spans different types of infrastructure as well.
I use the arbitrary distinction of technical integration as the demarcating line.
If the model does not yet receive prospective data (not technically integrated) then its still in development.
Much of the discussion from here on out hinges on how the model developer is choosing to implement the model.
We will talk extensively about the choices and the implications in a little bit, but we’ve got to set up the last bit of development for one of these avenues.</p>

<h3 id="epic-development-infrastructure">Epic Development Infrastructure</h3>
<p>If you choose to implementation using Epic’s tooling (or any other vendor’s) you will have to get your model to work on their infrastructure.
This is a wonky space that will likely get better over time.
But in order to do technical integration with Epic you need to test and package your model using a custom development environment that they provide.
I won’t go into a ton of details here, as you’re best served by going to <a href="http://galaxy.epic.com/">Epic Galaxy</a> to see the latest and greatest documentation.</p>

<p>As a part of model development
Epic provides a Python environment with a load of standard Python AI/ML libraries (…list)
They also provide a couple custom Python libraries that help you interact with the data interfaces.</p>
<ul>
  <li>You can receive tabular data in a JSON structure that is parsed by their libraries
You can then pre-process the data and pass it to your model</li>
  <li>Once you have your predictions you packaged up the data using another set of Epic’s Python calls.</li>
</ul>

<p>Although the development environment is sandboxed, you are not overly constrained in terms of the code you want to include.
You can include additional python and data files in the model package
Additionally you can call external APIs from within this environment if they are whitelisted.
This means that you could include information from other sources or do data processing via another service.</p>

<p>You can take an existing model that was developed in and as long as you use epic approved list of libraries, you can use epic bundling tools to then convert it into a package that can be run on their ECP instance the way that the model receives, data is through a reporting workmen report so you’ll work with your epic analyst to set up a report essentially is the tabular data you want your models received so you specify all the columns and have this done you’ll also have an epic analyst.</p>

<figure>
 <img src="https://eotles.com/assets/post_assets/2024-Healthcare-AI-Lifecycle/development_infrastructure_epic.png" alt="Architecture diagram for developing models inside of an EMR vendor's system. Clinical database generates reports that are then sent to the model development environment, where developers write code for model development and validation which then lead to a model being created. This model is then tested and packaged using the vendor's software. Once tested the model can then be packaged and is ready for implementation." />
 <figcaption>Architecture diagram for developing models inside of an EMR vendor's system. Clinical database generates reports that are then sent to the model development environment, where developers write code for model development and validation which then lead to a model being created. This model is then tested and packaged using the vendor's software. Once tested the model can then be packaged and is ready for implementation.</figcaption>
</figure>

<p>In this workflow you assess and convert a model that you made with your own infrastructure into a package that can be run on Epic’s implementation infrastructure.
What’s crucial about the workflow depicted above is that there’s a data report that comes directly out of Chronicles (not Clarity) that you use as a part of this packaging workflow.
This is report is often a small extract representing current patients in the health system.
Thus, despite being small it is a very good representation of what the data will look like prospectively, as its generated by the prospective infrastructure.
I think its a really good opportunity to address infrastructure shift, if the model developer uses this data in additional to a larger retrospectively collected research dataset for development.
Maybe I’ll do some research in this direction…</p>

<h2 id="ai-implementation-infrastructure">AI Implementation Infrastructure</h2>

<p>Now we turn our attention to connecting models into care processes, <em>implementation</em>.
As discussed in the <a href="/blog/Healthcare-AI-Implementation/">previous post, implementation goes beyond the technology</a>, however, the primary focus of this section will be on the implementation step of <em>technical integration</em>, the nuts-and-bolts of connecting AI models to existing HIT systems.</p>

<h2 id="overview">Overview</h2>

<p>There are two primary ways to integrate a model into existing HIT systems and they are delineated by the relationship to the EMR: internal and external.</p>

<p><em>Internal integration</em> of models means that developers rely exclusively on the tooling provided by the EMR vendor to do the hosting of the model along with all of the logic around running it and filling the results.</p>

<figure>
 <img src="https://eotles.com/assets/post_assets/2024-Healthcare-AI-Lifecycle/overview_implementation_infrastructure_epic.png" alt="Implementation overview using Epic." />
 <figcaption>Implementation overview using Epic.</figcaption>
</figure>

<p><em>External integration</em> of models means that developers choose to own some of parts of the hosting, running, or filing (usually its the hosting piece).</p>

<figure>
 <img src="https://eotles.com/assets/post_assets/2024-Healthcare-AI-Lifecycle/overview_implementation_infrastructure_self_hosted.png" alt="Implementation overview using self-hosting." />
 <figcaption>Implementation overview using self-hosting.</figcaption>
</figure>

<p>In both scenarios data ends up flowing from the EMR database to the model, however the path that these data take can be drastically different and significant thought should be put into security of the data and the match between the infrastructure and model’s capabilities.</p>

<p>It is important to note that these approaches delegate the display of model results to the EMR system.
They do this by passing model results to the EMR and using EMR tools to display the results to users.</p>

<h2 id="internal-integration">Internal Integration</h2>

<p>The infrastructure choices of internal integration are fairly straightforward, as its all dictated by the EMR vendor so you may not have many options.
In the past this would have meant re-programming your model so that it could be called by code in the EMR (e.g., for Epic you would need to have it be a custom MUMPS routine).
Luckily now EMR vendors are building out tools that enable (relatively) easy integration of models.</p>

<h3 id="limitations">Limitations</h3>
<p>However, there are some major restrictions, because these are not servers that are totally under your control.
Instead they are platforms that are designed to be safe and effective for a variety of use cases.
Thus, they tend to have a couple attributes that may be problematic.</p>

<p>The first is sandboxing, the model code runs in a special environment that has a pre-specified library of code available.
As long as you only use code from that library your model code should function fine, however if you have an additional dependence outside that library you may run into significant issues.</p>

<p>The second is conforming to existing software architectures.
Expanding enterprise software often means grafting existing components together in order to create new functionality.
For example, existing reporting functionality may be used as the starting point for an AI hosting application.
While this makes sense (reporting gets you the input data for your model), it means that you maybe stuck with a framework that wasn’t explicitly designed for AI.</p>

<p>The sandboxing and working with existing design patterns means that square pegs (AI models) may need to be hammered into round holes (vendor infrastructure). 
Together this means that you seed a significant amount of control and flexibility.
While this could be viewed as procrustean, it may actually be a good thing as it does force AI models to adhere to certain standards and ensures that there’s a uniform data security floor.</p>

<h3 id="example">Example</h3>

<p>Generally, for this setup you have to a model package and some additional configuration.
The model package contains your model and the code necessary to 
package your model in a manner that can be run on the hosting service and that you have additional configuration that determines the data passed to the model</p>

<p>We set up our MCURES project using an internal integration approach.
MCURES was an in-hospital deterioration index tailored for patients admitted to the hospital for acute respiratory failure during the COVID-19 pandemic.
Since we were trying to get this model developed and implemented as fast a possible I chose to go down the internal integration pathway.
Additionally, we started doing the technical integration work in parallel to model development.</p>

<p>At the time we started the MCURES project Epic they offered two options for internal integration:</p>
<ul>
  <li>Epic Cognitive Computing Platform (ECCP) and</li>
  <li><a href="https://en.wikipedia.org/wiki/Predictive_Model_Markup_Language">Predictive Model Markup Language (PMML)</a>.</li>
</ul>

<p>Epic’s PMML approach is interesting because you essentially specify the model via configuration (using the PMML standard) and Epic builds a copy of the model based on their implementations of different model architectures.
I have not built anything using this approach; however, based on my research at the time it seemed fairly limited, as it supported a small handful of simple model architectures.</p>

<p>Because of the model architecture limitations of PMML we decided to go with ECCP for MCURES.
ECCP enables you to run models in you’ve developed in Python using a proprietary model serving infrastructure.
This model serving infrastructure is essentially a sandboxed Python AI environment hosted using Microsoft Azure.
At a high level data are passed from Chronicles to this special Azure instance, the model produces predictions, which are then passed back to Chronicles.
ECCP takes care of the data transitions and AI developers primarily need to worry about their AI code.</p>

<p>Model input data is passed out of chronicles using reporting workbench.
Reporting workbench is designed for different types of EMR reports.
You can configure special versions of these reports that would pull the necessary data for patients that could be used for an AI model.
Data are in a tabular structure, where rows represent patients or encounters, and columns represent attributes like age, current heart rate, etc..
I won’t go into a ton of details here, but this is the place where you can run into significant limitations, because the underlying data in Chronicles isn’t actually tabular, and the best representation of longitudinal health data is often also not tabular as well so there’s lots of engineering that needs to be done in order to get a good representation of the patients.</p>

<p>Data will then be passed and secure manner to the model, which is running on the special Azure instance.
We talked a little bit about model packaging so we won’t go into that here.
But there is some configuration that is needed when running the model in real time, in addition to the model we need a couple items:</p>
<ul>
  <li>input data report, and</li>
  <li>model run information.</li>
</ul>

<p>We need to explicitly connect the reporting workbench model discussed above to our configuration.
Additionally, we need to instantiate the logic that controls the frequency at which the model runs.
For this one creates a special Epic batch job that will run with a specified frequency.
This job runs the reporting workbench reports and passes that data to the model process that then calculated predictions.</p>

<p>The predictions computed by the model are then passed back to Chronicles.
These end up in special in a special part of the database that’s designed to store predictive model results
The kind of information that you can pass back are a little bit limited because the database is expecting certain types of information.</p>

<p>When the data is back in Chronicles you serve it to users in many different ways.
For example, you could use it to fire best practice alerts or have it be highlighted as an additional column in a list of patients stratify patients based on a risk score.
This is all fairly easy to do because you’ve already been working with your epic analysts to get the data directly into the status structure, and then they can work with their colleagues to set up the best practice alert, or column display.</p>

<p>Despite a couple technical limitations, the entire flow data from Chronicles to ECP and back to Chronicles controlled, unless you have pretty good guarantees about Safety and reliability.</p>

<p>One thing major limitation of this integration approach is that a significant amount of the model run configuration is controlled by health system analysts as opposed to model developers.
This is fine if there is really good communication between the two parties, but there’s often a big disconnect, because analysts sort of sit in a siloed place inside of health system IT And developers tend to be outside of direct health IT and structure.
Usually this ends up devolving into a big game of telephone, as these parties that don’t normally talk to one another or have good relationships.
So, as always, we need to work on this so part of our sociotechnical system.</p>

<figure>
 <img src="https://eotles.com/assets/post_assets/2024-Healthcare-AI-Lifecycle/implementation_infrastructure_epic_hosted.png" alt="Architecture diagram for implementing custom models served outside of an EMR vendor's system. Research data warehouse generates reports that are then sent to the external model implementation environment, the model generates predictions which are then passed to the EMR system." />
 <figcaption>Architecture diagram for implementing custom models served outside of an EMR vendor's system. Research data warehouse generates reports that are then sent to the external model implementation environment, the model generates predictions which are then passed to the EMR system.</figcaption>
</figure>

<p>This decision to do technical integration simultaneously with model development turned out to be fairly important.
The learnings from technical integration directly impacted our choices for model development. 
For example, we realized that building the reporting workbench report was a relatively laborious process.
Each column in the report took a good amount of time to build and validate.
These columns corresponded to a variable (also known as a feature) that the model took as input.
So the integration effort scaled linearly with the number of features we wanted to include in the model.</p>

<p>During early parts of development we were exploring models with thousands of features, as we had access to the features from RDW and had code to easily manage these features.
However, once we learned more about integration effort we decided to cap the number of features being used to a fairly small number (around 10).
We felt comfortable with this decision because we felt like we hit a good balance between performance and implementation time.
Our early experiments indicated that we wouldn’t lose a ton of performance going from thousands of features to ten (something on the order of less than 10% relative decrease in AUROC) and we were fairly sure that we could implement and test the report with the allocated Epic analyst built time.</p>

<h2 id="external-integration">External Integration</h2>

<p>External integration is the other side of the coin.
Model developers can pick out exactly how they want their model to be hosted and run as well as how they would like it to interface with the EMR.
This additional flexibility is great if you are working on cutting edge research, but it carries a significant burden in terms of guaranteeing that data are handled in a safe and secure manner.</p>

<p>External integration offers a path where innovation can meet clinical applications, allowing for a bespoke approach to deploying AI models.
This flexibility, however, comes with its own set of challenges and responsibilities, particularly in the realms of security, interoperability, and sustainability of the AI solutions.</p>

<h3 id="limitations-1">Limitations</h3>
<p>Below are key considerations and strategies for effective external integration of AI in healthcare:</p>
<ul>
  <li>Security and Compliance
When hosting AI models externally, ensuring the security of patient data and compliance with healthcare regulations such as HIPAA in the United States is paramount.
It is essential to employ robust encryption methods for data in transit and at rest, implement strict access controls, and regularly conduct security audits and vulnerability assessments.
Utilizing cloud services that are compliant with healthcare standards can mitigate some of these concerns, but it requires diligent vendor assessment and continuous monitoring.</li>
  <li>Interoperability and Data Standards
The AI model must interact with the EMR system to receive input data and return predictions.
Adopting interoperability standards such as HL7 FHIR can facilitate this communication, enabling the AI system to parse and understand data from diverse EMR systems and ensuring that the AI-generated outputs are usable within the clinical workflow.
An alternative is to use a data integration service, like <a href="https://www.redoxengine.com">Redox</a>.</li>
  <li>Scalability and Performance
External AI solutions must be designed to scale efficiently with usage demands of a healthcare organization.
This includes considerations (that some may consider boring) for load balancing, high availability, and the ability to update the AI models without disrupting the clinical workflow.
Performance metrics such as response time and accuracy under load should be continuously monitored to ensure that the AI integration does not negatively impact clinical operations.</li>
  <li>Support and Maintenance
External AI solutions require a commitment to ongoing maintenance and support to address any issues, update models based on new data or clinical guidelines, and adapt to changes in the IT infrastructure.
Establishing clear service level agreements (SLAs) with vendors or internal teams responsible for the AI solution is crucial to ensure timely support and updates.</li>
</ul>

<h3 id="example-1">Example</h3>

<p>I’ll detail the external integration of one of our models. 
This is the model that we developed to integrated for <em>C. difficile</em> infection risk stratification.</p>

<p>Data for this model comes from our research data warehouse then travels to the model posted on a Windows virtual machine.
The predictions from the model are then passed back to the EMR using web services.</p>

<p>We have a report that runs daily from the research state warehouse.
It’s a stored SQL procedure that runs at a set time very early in the morning about 5 AM.
This is essentially a large table of data for each of the patients that were interested in producing a prediction on rows our patients and columns are the various features that were interested in.
Stored procedures update information in a view inside of RDW.</p>

<p>The research data at warehouse and this view are accessible by a Windows machine that we have inside of the health IT secure computing environment.
This windows machine has a scheduled job that runs every morning about at about 6 AM.
This job pull the data down from the database runs a series of python files that you data pre-processing and apply the model to the data to the transform data, and then save the output, model predictions to a shared secured directory on the internal health system network.</p>

<p>We then returned the predictions to Chronicles, using infrastructure that our health IT colleagues helped to develop.
This infrastructure involves a scheduled job written in C# that reads the file that we have saved the shared directory does date of validation and then passes data into chronicles using epics web services framework.</p>

<p>These data end up as flow sheet values for each patient.
We then worked with our epic analyst colleagues to use the flow sheet data to trigger as practice alerts, and also to populate port.
The best practice alerts fire based off of some configuration that’s done inside of epic in order to be able to adjust the alerting threshold outside of Epic what we did was we modified the score such that the alerting information with someone distinct from the actual score so what we did is we packed an alert flag and the score together into a single decimal separated value and this is essentially a number however it’s unique and that it contains two pieces of information so we could take a patient to Oehlert on and we would say 1.56 a patient that we didn’t alert on would be zero point</p>

<figure>
 <img src="https://eotles.com/assets/post_assets/2024-Healthcare-AI-Lifecycle/implementation_infrastructure_self_hosted.png" alt="Architecture diagram for implementing custom models served outside of an EMR vendor's system. Research data warehouse generates reports that are then sent to the external model implementation environment, the model generates predictions which are then passed to the EMR system." />
 <figcaption>Architecture diagram for implementing custom models served outside of an EMR vendor's system. Research data warehouse generates reports that are then sent to the external model implementation environment, the model generates predictions which are then passed to the EMR system.</figcaption>
</figure>

<p>Model predictions are passed to the EMR system using web services.
Predictions are then filed as either flowsheet rows (inpatient encounters) or smart data elements (outpatient encounters).
You have to build your own infrastructure to push the predictions to the EMR environment.</p>

<h2 id="bonus-another-approach-to-external-integration">Bonus: Another Approach to External “Integration”</h2>

<p>A great deal of the effort involved in external integration is assuring that the data travels between the EMR and your hosted AI model in a safe and secure manner.
Setting up all the plumbing between the EMR and your system can take the vast majority of your development time.</p>

<p>Let’s say you didn’t want to go through the hassle, but still wanted to enable clinical users to interact with your model.
Well you could provide them with a (secure) way to access your model online and have them be the information intermediaries.</p>

<figure>
 <img src="https://eotles.com/assets/post_assets/2024-Healthcare-AI-Lifecycle/overview_implementation_user_driven.png" alt="Implementation overview using self-hosting." />
 <figcaption>Implementation overview using self-hosting with the user as the intermediary.</figcaption>
</figure>

<p>This is exactly what <a href="https://www.mdcalc.com">MDCalc</a> does.
They have lots of models that physicians can go and input data directly into.
They are super useful clinically, but they’re not integrated into the EMR.</p>

<p>If the amount of data that your model uses is small (a handful of simple data elements), then this could be a viable approach.
And if you don’t collect PHI/PII then you could set up your own MDCalc like interface to your hosted model.</p>

<p>We won’t talk about this architecture in depth, but I think its a potentially interesting way to make tools directly for clinicians.</p>

<p>Cheers, <br />
Erkin <br />
<a href="https://eotles.com">Go ÖN Home</a></p>

<div class="footnotes" role="doc-endnotes">
  <ol>
    <li id="fn:1" role="doc-endnote">
      <p>This can be complicated to do because you need to maintain you own application server and also deal with passing authentication between the EMR session and your application. <a href="#fnref:1" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:2" role="doc-endnote">
      <p>I’ve never done a cost break-down analysis for on-premises vs. cloud for healthcare AI research, but I’d love to see results if anyone has some handy. <a href="#fnref:2" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
  </ol>
</div>]]></content><author><name>Erkin Ötleş</name></author><category term="Blog" /><category term="medicine" /><category term="healthcare" /><category term="artificial intelligence" /><category term="machine learning" /><category term="data science" /><category term="FDA" /><category term="clinical decision support" /><category term="technology in medicine" /><category term="implementation" /><category term="implementation science" /><summary type="html"><![CDATA[Infrastructure is king.]]></summary></entry><entry><title type="html">M-CURES: AI Infrastructure for Predicting COVID-19 Deterioration in Hospitals</title><link href="https://eotles.com/blog/Healthcare-AI-Infrastructure-MCURES/" rel="alternate" type="text/html" title="M-CURES: AI Infrastructure for Predicting COVID-19 Deterioration in Hospitals" /><published>2024-09-20T00:00:00+00:00</published><updated>2024-09-22T00:00:00+00:00</updated><id>https://eotles.com/blog/Healthcare-AI-Infrastructure-MCURES</id><content type="html" xml:base="https://eotles.com/blog/Healthcare-AI-Infrastructure-MCURES/"><![CDATA[<p>#AI Infrastructure Example: COVID-19 In-Hospital Deterioration</p>

<p>In this post, we dive into a real-world application of healthcare AI infrastructure by exploring the Michigan Critical Care Utilization and Risk Evaluation System (M-CURES).
This project was developed during the early stages of the COVID-19 pandemic to predict in-hospital deterioration for patients suffering from acute respiratory failure.</p>

<p>This post builds on the broader concepts discussed in our previous posts on healthcare AI infrastructure.
If you’re unfamiliar with the foundational ideas behind AI development and implementation, I recommend starting with the <a href="/blog/Healthcare-AI-Lifecycle/">introduction to the healthcare AI lifecycle</a> and the technical <a href="/blog/Healthcare-AI-Infrastructure/">overview of healthcare AI infrastructure</a>.
These posts lay the groundwork for understanding how AI models are created and integrated into health systems, which will help contextualize the technical decisions made for M-CURES.</p>

<p>This post focuses on our technical integration challenges while implementing M-CURES using Epic’s internal tools and also demonstrates how you can parallelize development and integration.
This parallelization enabled us to move quickly in a fast-moving, high-stakes environment like the early pandemic.
By exploring the infrastructure and workflow that powered M-CURES, we’ll also highlight the importance of collaboration between AI developers and health system analysts.</p>

<p>This post builds off of our previous discussions on healthcare AI infrastructure.
If you are unfamiliar with that infrastructure, reviewing the posts that cover the AI lifecycle or the general infrastructure landscape may be helpful.</p>

<h2 id="the-need-implement-quickly">The Need: Implement Quickly</h2>
<p>In this post, we’ll discuss the technical side of the Michigan Critical Care Utilization and Risk Evaluation System (M-CURES) project.
We developed M-CURES as an in-hospital deterioration prediction system for patients admitted to the hospital for acute respiratory failure during the initial onset of the COVID-19 pandemic.</p>

<p>In the early days of the pandemic, everyone was concerned with quickly triaging patients between different levels of care.
We expected to see a massive influx of patients and wanted to be able to place them in the correct care setting (e.g., home, field hospital, regular hospital, ICU).
To meet this anticipated need, Michigan Medicine leadership asked us to develop and implement a predictive model to help with triage.</p>

<p>The development of the model and external validation are covered in a <a href="https://www.bmj.com/content/376/bmj-2021-068576">paper we published in the BMJ</a>.</p>

<p>We discussed implementation exceptionally early in the project to speed up the process.
Within the first week, we decided to implement the model we developed using Epic’s tools (internal integration).
Although it was our first time using Epic’s tooling, we felt it would give us the best chance at the fastest integration process.
After we decided to go with Epic’s tooling, we started technical integration immediately.
We did this work in parallel with model development to speed up the process as much as possible.</p>

<h2 id="epics-internal-integration-approaches">Epic’s Internal Integration Approaches</h2>

<p>As mentioned in the development infrastructure post, Epic provides tooling to facilitate internal technical integration.</p>

<p>At the time we started the M-CURES project, Epic offered two options for internal integration:</p>
<ul>
  <li>Epic Cognitive Computing Platform (ECCP) and</li>
  <li>Predictive Model Markup Language (PMML).</li>
</ul>

<p>Epic’s <a href="https://en.wikipedia.org/wiki/Predictive_Model_Markup_Language">PMML</a> approach is interesting because it implements the model by specifying a model configuration (using the <a href="https://dmg.org/pmml/v4-4-1/GeneralStructure.html">PMML standard</a>).
Epic builds/hosts a copy of the model based on their implementations of different model architectures. 
I have not built anything using this approach; however, my research at the time indicated that it was the more limited option, as only a handful of simple model architectures were supported.</p>

<p>Because of the model architecture limitations of PMML, we decided to go with ECCP for M-CURES.
ECCP enables you to host custom Python models using Epic’s model-serving infrastructure.
This model serving infrastructure is a sandboxed Python AI environment hosted using Microsoft Azure.</p>

<p>At a high level, data are passed from Chronicles to this Azure instance; the model runs and produces predictions, which are then passed back to Chronicles.
ECCP takes care of the data transitions, and AI developers primarily only need to worry about their AI code. </p>

<h2 id="overview-of-eccp">Overview of ECCP</h2>

<figure>
 <img src=" https://eotles.com/assets/post_assets/2024-Healthcare-AI-Lifecycle/implementation_infrastructure_epic_hosted.png" alt=" Architecture diagram for implementing custom models served outside of an EMR vendor's system. Research data warehouse generates reports sent to the external model implementation environment, and the model generates predictions that are then passed to the EMR system." />
 <figcaption> Epic's ECCP Implementation Architecture. AI Model serving is closely tied to the EMR functionality. Data transits between two different environments (Epic's regular backend and the Azure environment), but the tight integration between them enables high levels of reliability and makes serving information to users easy.</figcaption>
</figure>

<p>This infrastructure tightly integrates Epic’s various systems so that data can flow fairly seamlessly from Chronicles to the model and the end user.</p>

<p>Model input data is passed out of Chronicles using Reporting Workbench.
Reporting Workbench is designed for different types of EMR reporting.
Analysts can configure these reports to pull patient data that can be fed to AI models.
Data are in a tabular structure<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">1</a></sup> where rows represent patients or encounters, and columns represent attributes like age, current heart rate, etc.</p>

<p>These data are then passed securely to the model, which runs on the  Azure instance.
The model developer can then include various code and outside data to produce model outputs and related metadata (like explainability scores).
This information is passed back to Chronicles and ends up in a particular part of the database designed to store predictive model results.<sup id="fnref:2" role="doc-noteref"><a href="#fn:2" class="footnote" rel="footnote">2</a></sup></p>

<p>When the data is back in Chronicles, it can be served to users in several ways.
For example, the information could trigger best practice alerts or rank and order a patient list according to risk.
Building alerts and patient lists using the predictions is easy because we are working directly with Epic’s tools.
Throughout the integration process, developers should liaise with health system analysts who are experts in configuring Epic’s systems.
These analysts work with data directly in Chronicles and can then collaborate with their colleagues to set up the best practice alert or column display.</p>

<p>The entire flow of data from Chronicles to ECCP and back to Chronicles is tightly integrated and controlled, which yields good safety and reliability.</p>

<h3 id="chronicles-not-clarity">Chronicles Not Clarity</h3>
<p>What’s crucial about the workflow described above is that there’s a data report that comes directly out of Chronicles (not Clarity) that you use as a part of this packaging workflow.
This report often represents patients currently interacting with the health system (i.e., admitted patients).
By definition, this set of patients/encounters will be much smaller than Clarity’s and other data warehouses’ corpus of retrospective patients/encounters.
However, despite being smaller, it is a nearly perfect representation of what the data will look like prospectively, as the prospective infrastructure generates it and does not undergo any additional transformations.</p>

<h3 id="sandboxing">Sandboxing</h3>
<p>ECCP provides a Python environment with a load of standard Python AI/ML libraries (Numpy, Pandas, SKLearn, etc.)
They also offer custom Python functions that help you interact with the data interfaces.
These functions help with:</p>
<ul>
  <li>Receiving inputs: They provide function calls to receive input data exported from Chronicles and parse it into a dataframe.</li>
  <li>Returning outputs: After you have model predictions, you can use their function calls to package results and send them back to Chronicles.</li>
</ul>

<p>These functions help to bookend your model code and help developers automate data flow.</p>

<p>Although the ECCP environment is sandboxed, developers are not constrained in terms of the code they can include, as they can include additional Python and data files in the package.
Additionally, developers can call external APIs within this environment (if the health system’s IT teams safelist them).
External APIs enable developers to include information from other sources or process data via another service.
Thus, converting an existing Python model for use with ECCP is relatively easy.</p>

<h2 id="model-development">Model Development</h2>

<p>We will now discuss the technical side of how we developed M-CURES using ECCP.
Model development and validation details are in our <a href="https://www.bmj.com/content/376/bmj-2021-068576">BMJ paper</a>.
The short version is that model development primarily used <a href="">Michigan Medicine’s research infrastructure</a>.
Although we obtained most of our training and internal validation data from Michigan Medicine’s Research Data Warehouse (RDW), Epic’s implementation infrastructure reshaped our model development approach.</p>

<figure>
 <img src=" https://eotles.com/assets/post_assets/2024-Healthcare-AI-Lifecycle/development_infrastructure_epic.png" alt=" Architecture diagram for developing models inside of ECCP." />
 <figcaption>Architecture diagram for developing models capable of running on ECCP. A crucial part of model development and implementation using ECCP depends on setting up a Reporting Workbench report. This report can improve model development and should be used for validation and packaging.</figcaption>
</figure>

<h3 id="reporting-workbench-report">Reporting Workbench Report</h3>

<p>Differences in data pipelines led to a shift in how we built the model.
The research data pipeline we were familiar with for model development gave us a lot of control regarding pulling a wide array of features per patient.
However, this control came at the cost of accessing very low-level data.
We had to put significant development effort into getting the data in the right representational state.
For example, we could easily pull all the meds and vitals for a patient encounter.
But then, it was up to us to figure out how to filter and aggregate these data before feeding it into the model.</p>

<p>Epic’s reporting infrastructure for ECCP can be seen as “higher level,” where the balance between choice and preparation shifts.
The available data through Reporting Workbench reports is limited, but the advantage of automated data filtering and aggregation offsets this restriction.
For example, we can specify that we want the most recent vitals or check whether a patient has received beta-blocker medication.
Another benefit of this approach is that these data elements are standardized across the health system’s Epic reporting infrastructure, so analysts only need to create a column or feature once.</p>

<p>On the whole, this is a great benefit.
However, it does limit the choices available to developers.
Initially, we chafed at this a little.
But this was because we were so used to “rolling our own.”
Standard data components that can be reused and maintained by the health system are the future.
We just weren’t used to it.</p>

<p>We were assigned a small amount of analyst time for the M-CURES project to help build the Reporting Workbench report we would use.
Because this was so limited, we included minimal features in the model.
We selected features by performing several experiments with the training data (from RDW) and routinely checking with our analyst colleagues to ensure we could include them in the report.
Through this iterative process, we ended up with the logistic regression model we wanted to use.  </p>

<h3 id="epic-model-development-environment">Epic Model Development Environment</h3>

<p>At this stage, we had the model weights and Python code.
To run the model in ECCP, we needed to package these components in a format compatible with the sandboxed Azure instance.
This is where Epic’s model development environment, Slate, came into play.</p>

<p>The Slate tooling enables model developers to test and package their Python code.
It’s an Epic-developed docker container replicating the Azure hosting environment.
This environment has a battery of Python libraries commonly used for AI, like Numpy, Pandas, and SKLearn.
It also has custom Epic functions that enable you to test and package the model.</p>

<p>After setting up Slate on our development servers, we ported our logistic regression model to it.
Alongside the code, we also brought in an example report produced by our analyst.
This example report enabled us to use Epic’s tools to conduct aggressive testing.
Using the report, we tested the model with data that closely resembled what it would encounter in production, giving us insight into its real-world performance.
These testing tools enabled us to understand how ECCP worked and debug our model and preprocessing code.
I will describe one of the most valuable tests we conducted in a separate post on technical integration.</p>

<p>Once we were happy with how the model worked in the Slate testing environment, we used Epic’s tools to package the model and all the associated code.</p>

<h2 id="epic-implementation-environment">Epic Implementation Environment</h2>
<p>We then shared the packaged model with our Epic analyst colleague.
In addition to the model package, there is some configuration that is needed when running the model in real time:</p>
<ul>
  <li>Reporting Workbench report and </li>
  <li>model run information.</li>
</ul>

<p>We connected the Reporting Workbench model discussed above to our configuration.
Additionally, we instantiated the logic that controls the frequency at which the model runs.
Our analysts created an Epic batch job that ran at a specified frequency.<sup id="fnref:3" role="doc-noteref"><a href="#fn:3" class="footnote" rel="footnote">3</a></sup>
This job runs the Reporting Workbench reports and passes that data to the model process.</p>

<p>Once you have everything configured, you should be able to monitor the status of previous prediction jobs using Epic’s ECCP management dashboard.
Additionally, analysts can kick off a one-time run of the model.
This is very helpful for debugging, as errors in the Python runtime are displayed in the management dashboard.<sup id="fnref:4" role="doc-noteref"><a href="#fn:4" class="footnote" rel="footnote">4</a></sup></p>

<h2 id="workflow">Workflow</h2>
<p>After all the setup, our model began producing scores for all the eligible patients in the hospital every couple of hours.
The predictions were filed to Chronicles and displayed as a risk score column for Michigan Medicine’s rapid response team.
This team used the scores to screen patients at higher risk for deterioration.</p>

<h2 id="final-considerations">Final Considerations</h2>
<p>Our decision to do technical integration simultaneously with model development was significant.
The learnings from technical integration directly impacted our choices for model development. 
For example, building the Reporting Workbench report was relatively laborious.
Each column in the report took a reasonable amount of time to develop and validate.
These columns corresponded to a variable (also known as a feature) the model took as input.
So, the integration effort scaled linearly with the number of features we wanted to include in the model.</p>

<p>During the early stages of development, we explored models with thousands of features, as we had access to the features from RDW and had code to manage these features easily.
However, once we learned more about the integration effort, we decided to cap the number of features used to a small number (around 10).
We felt comfortable with this decision because we could balance performance and implementation time.
Our early experiments indicated that we wouldn’t lose a ton of performance going from thousands of features to ten (something on the order of less than a 10% relative decrease in AUROC), and we were sure that we could implement and test the report with the allocated Epic analywouldn’t time.</p>

<p>One final consideration of the internal integration approach is that a significant amount of the model configuration is outside the direct control of the AI developers.
Instead, a substantial portion of the configuration is under the purview of health system analysts.
This division could be great if there is good communication between the two parties.
However, there’s often a big disconnect.
This disconnect is due to the siloed nature of healthcare IT and AI R&amp;D.
Analysts are siloed inside health system IT, and developers tend to be outside of direct health IT and structure.
Usually, this devolves into a giant game of telephone, as these parties don’t usually talk to one another or have good relationships.
So, as always, we need to work on our sociotechnical system.
We can start by improving communication and tearing down silos.</p>

<p>Cheers, <br />
Erkin <br />
<a href="">Go ÖN Home</a></p>

<div class="footnotes" role="doc-endnotes">
  <ol>
    <li id="fn:1" role="doc-endnote">
      <p>This is where the non-tabular structure of healthcare data can pose challenges for AI novices. Since the underlying data in Chronicles isn’t organized in a tabular format—and because the best representation of longitudinal health data often isn’t tabular either—significant engineering is required to represent patients more accurately. <a href="#fnref:1" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:2" role="doc-endnote">
      <p>The information you can pass back is limited because the database only expects certain types of information (e.g., integer or float). <a href="#fnref:2" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:3" role="doc-endnote">
      <p>Care must be exercised with run frequency. I recommend thorough testing before changing the run frequency of a model. <a href="#fnref:3" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:4" role="doc-endnote">
      <p>This was a helpful avenue to improve the way my Python code ran in ECCP, as I could write custom exceptions that passed back information about who my code was running.  <a href="#fnref:4" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
  </ol>
</div>]]></content><author><name>Erkin Ötleş</name></author><category term="Blog" /><category term="medicine" /><category term="healthcare" /><category term="artificial intelligence" /><category term="machine learning" /><category term="data science" /><category term="FDA" /><category term="clinical decision support" /><category term="technology in medicine" /><category term="implementation" /><category term="implementation science" /><category term="COVID-19 AI model" /><category term="healthcare AI case study" /><category term="in-hospital deterioration prediction" /><category term="Epic integration" /><category term="clinical AI tools" /><category term="AI for acute care" /><summary type="html"><![CDATA[A detailed exploration of the development and implementation of M-CURES, a COVID-19 in-hospital deterioration model, highlighting the integration of AI models into clinical workflows using Epic’s internal tools]]></summary></entry><entry><title type="html">Healthcare AI Implementation Infrastructure: Technical Tools for AI Model Integration</title><link href="https://eotles.com/blog/Healthcare-AI-Infrastructure-Implementation/" rel="alternate" type="text/html" title="Healthcare AI Implementation Infrastructure: Technical Tools for AI Model Integration" /><published>2024-09-12T00:00:00+00:00</published><updated>2024-09-22T00:00:00+00:00</updated><id>https://eotles.com/blog/Healthcare-AI-Infrastructure-Implementation</id><content type="html" xml:base="https://eotles.com/blog/Healthcare-AI-Infrastructure-Implementation/"><![CDATA[<p>Welcome to the next installment in our healthcare AI infrastructure series.
If you’ve been following along, we’ve already explored the foundational components of healthcare AI in earlier posts, covering the overall <a href="/blog/Healthcare-AI-Lifecycle/">AI lifecycle</a> and diving deeper into <a href="/blog/Healthcare-AI-Development/">AI development</a> and <a href="/blog/Healthcare-AI-Implementation/">implementation</a> processes.
Most recently, we focused on the technical underpinnings of <a href="/blog/Healthcare-AI-Infrastructure-Development/">AI development infrastructure</a> and the broader <a href="/blog/Healthcare-AI-Infrastructure/">healthcare IT landscape</a> that makes modern AI models possible.</p>

<h1 id="healthcare-ai-implementation-infrastructure">Healthcare AI Implementation Infrastructure</h1>

<p>In this post, we shift gears to discuss the nuts and bolts of connecting AI models to real-world clinical workflows, an often overlooked but essential step in the AI lifecycle—implementation.
While development gets a lot of attention, the success of any healthcare AI tool is ultimately determined by how well it integrates into existing health IT systems.
As we explore the technical infrastructure needed to support these implementations, we’ll break down key concepts, such as internal versus external integration, and provide insights into how these choices shape AI deployments’ reliability, flexibility, and security.</p>

<p>A couple of notes before we start.
Although this might not seem that important to the engineers who are on the AI research and development side of things, I would argue that understanding the downstream will not only increase your success of projects eventually making a clinical impact but also that there are exciting and cool research ideas that can come out of thinking about development.
Although the implementation goes beyond the technology, this section primarily delves into the ‘nuts-and-bolts’ of the implementation step, known as technical integration. This is the process of connecting AI models to existing HIT systems.</p>

<p>By the end of this post, you’ll have a clearer understanding of the infrastructure choices that impact the successful implementation of healthcare AI models and how to navigate the complexities of this critical phase in the AI lifecycle.
Our goal is to provide you with the knowledge and insights you need to make informed decisions in your healthcare AI projects.</p>

<h2 id="two-approaches-to-implementation">Two Approaches to Implementation</h2>

<p>Before we delve into the details, it’s important to understand the two main approaches to integrating a model into health IT systems.
These are categorized as internal or external based on their relationship to the EMR.</p>

<p><em>Internal integration</em> of models means that developers rely exclusively on the tooling provided by the EMR vendor to host the model along with all of the logic around running it and filing the results.</p>

<figure>
 <img src="https://eotles.com/assets/post_assets/2024-Healthcare-AI-Lifecycle/overview_implementation_infrastructure_epic.png" alt="Implementation overview using Epic." />
 <figcaption>Implementation overview using Epic.</figcaption>
</figure>

<p><em>External integration</em> of models means that developers choose to own some parts of the hosting, running, or filing (usually the hosting piece).</p>

<figure>
 <img src="https://eotles.com/assets/post_assets/2024-Healthcare-AI-Lifecycle/overview_implementation_infrastructure_self_hosted.png" alt="Implementation overview using self-hosting." />
 <figcaption>Implementation overview using self-hosting.</figcaption>
</figure>

<p>In both scenarios, data flows from the EMR database to the model.
However, the path these data take can be drastically different, and significant thought should be put into the security of the data and the match between the infrastructure and the model’s capabilities.</p>

<p>It is important to note that these approaches delegate the display of model results to the EMR system.
They do this by passing model results to the EMR and delegating user displays to existing EMR tools.</p>

<h2 id="internal-integration">Internal Integration</h2>

<p>The infrastructure choices for internal integration are pretty straightforward; they are all dictated by the EMR vendor, so you might not have any options.
In the past, this would have meant re-programming your model to be called by code in the EMR (e.g., for Epic, you would need to have it be a custom MUMPS routine).
Luckily, EMR vendors are now building out tools that enable (relatively) easy integration of models.</p>

<figure>
 <img src=" https://eotles.com/assets/post_assets/2024-Healthcare-AI-Lifecycle/implementation_infrastructure_epic_hosted.png" alt=" Architecture diagram for implementing custom models served outside of an EMR vendor's system. Research data warehouse generates reports sent to the external model implementation environment, and the model generates predictions that are then passed to the EMR system." />
 <figcaption>Architecture diagram for implementing custom models served outside an EMR vendor's system. Research data warehouse generates reports sent to the external model implementation environment, and the model generates predictions that are then passed to the EMR system.</figcaption>
</figure>

<h3 id="limitations">Limitations</h3>
<p>However, some major restrictions exist because these servers are not totally under your control.
Instead, they are platforms designed to safely and effectively support a myriad of clinical use cases.
Thus, they have a couple of attributes that may be problematic.</p>

<p>The first attribute is sandboxing; the model code runs in a special environment with a pre-specified code library available.
As long as you only use code from that library, your model code should function fine.
However, you may run into significant issues if you have an additional dependence outside that library.</p>

<p>The second is conforming to existing software architectures.
Expanding enterprise software often means grafting existing components together to create new functionality.
For example, existing reporting functionality may be used as the starting point for an AI hosting application.
While this makes sense (reporting gets you the input data for your model), you may be stuck with a framework that wasn’t explicitly designed for AI.</p>

<p>The sandboxing and working with existing design patterns means that square pegs (AI models) may need to be hammered into round holes (vendor infrastructure). 
Together, this means that you seed a significant amount of control and flexibility.
While this could be viewed as procrustean, it forces AI models to adhere to specific standards and ensures a uniform data security floor. </p>

<h2 id="external-integration">External Integration</h2>

<p>External integration offers the opposite approach.
Model developers can choose how their model is hosted and operates and how it interfaces with the EMR.
This flexibility is especially valuable for cutting-edge research.
However, it also comes with the significant responsibility of ensuring that data is handled safely and securely.</p>

<p>External integration offers a path where innovation can meet clinical applications, allowing for a bespoke approach to deploying AI models.
This flexibility, however, comes with its own set of challenges and responsibilities, particularly in the realms of security, interoperability, and sustainability of AI solutions.</p>

<figure>
 <img src=" https://eotles.com/assets/post_assets/2024-Healthcare-AI-Lifecycle/implementation_infrastructure_self_hosted.png" alt=" Architecture diagram for implementing custom models served outside of an EMR vendor's system. Research data warehouse generates reports sent to the external model implementation environment, and the model generates predictions that are then passed to the EMR system." />
 <figcaption>Architecture diagram for implementing custom models served outside of an EMR vendor's system. Research data warehouse generates reports sent to the external model implementation environment, and the model generates predictions that are then passed to the EMR system.</figcaption>
</figure>

<h3 id="limitations-1">Limitations</h3>
<p>Below are key considerations and strategies for effective external integration of AI in healthcare:</p>
<ul>
  <li>Security and Compliance
When hosting AI models externally, ensuring the security of patient data and compliance with healthcare regulations such as HIPAA in the United States is paramount.
It is essential to employ robust encryption methods for data in transit and at rest, implement strict access controls, and regularly conduct security audits and vulnerability assessments.
Utilizing cloud services compliant with healthcare standards can mitigate some of these concerns, but diligent vendor assessment and continuous monitoring are required.</li>
  <li>Interoperability and Data Standards
The AI model must interact with the EMR system to receive input data and return predictions.
Adopting interoperability standards such as HL7 FHIR can facilitate this communication, enabling the AI system to parse and understand data from diverse EMR systems and ensuring that the AI-generated outputs are usable within the clinical workflow.
An alternative is to use a data integration service like <a href="https://www.redoxengine.com">Redox</a>.</li>
  <li>Scalability and Performance
External AI solutions must be designed to scale efficiently with the usage demands of a healthcare organization.
This includes considerations (that some may consider boring) for load balancing, high availability, and the ability to update the AI models without disrupting the clinical workflow.
Performance metrics such as response time and accuracy under load should be continuously monitored to ensure that the AI integration does not negatively impact clinical operations.</li>
  <li>Support and Maintenance
External AI solutions require a commitment to ongoing maintenance and support to address any issues, update models based on new data or clinical guidelines, and adapt to changes in the IT infrastructure.
Establishing clear service level agreements (SLAs) with vendors or internal teams responsible for the AI solution is crucial to ensure timely support and updates.</li>
</ul>

<h2 id="bonus-another-approach-to-external-integration">Bonus: Another Approach to External “Integration”</h2>

<p>Safety and security can be a significant obstacle to external integration.
Setting up the necessary connections and infrastructure between the EMR and your system can consume most of your development time.
 
If you wanted to avoid the complexity of full integration but still allow clinical users to interact with your model, you could offer them a secure online interface.
In this setup, the users act as intermediaries, manually inputting and retrieving information from the model.</p>

<figure>
 <img src="https://eotles.com/assets/post_assets/2024-Healthcare-AI-Lifecycle/overview_implementation_user_driven.png" alt="Implementation overview using self-hosting." />
 <figcaption>Implementation overview using self-hosting with the user as the intermediary.</figcaption>
</figure>

<p><a href="https://www.mdcalc.com">MDCalc</a> follows this approach, offering numerous models for physicians to input data directly.
These tools are handy in clinical practice but not integrated into the EMR.</p>

<p>If the amount of data your model uses is small (a handful of simple data elements), this could be a viable approach.
If you don’t collect PHI/PII, you could set up your own MDCalc-like interface for your hosted model.</p>

<p>We won’t discuss this architecture in-depth, but it’s an exciting way to make tools directly for clinicians.</p>

<h2 id="parting-thoughts">Parting Thoughts</h2>

<p>In choosing between internal and external integration for healthcare AI models, you must weigh the benefits and limitations of each approach.
Internal integration offers simplicity and security by operating within the confines of existing EMR systems, but this comes at the cost of flexibility.
External integration provides greater control and customization, which can be invaluable for cutting-edge AI tools, but this flexibility comes with increased responsibility for security, compliance, and interoperability.</p>

<p>Ultimately, the decision between these approaches hinges on your specific needs—whether you’re focused on rapid deployment with minimal disruption or seeking a more customized, innovative solution that can push the boundaries of what’s possible.</p>

<h2 id="looking-ahead">Looking Ahead</h2>
<p>The infrastructure supporting these systems must adapt as healthcare AI continues to evolve.
With increasing pressures on health systems to integrate advanced AI solutions, understanding the nuances of technical integration will be critical for success.
The ability to connect models to clinical workflows effectively, ensure data security, and maintain operational efficiency will separate successful AI projects from those that never make it to the bedside.</p>

<p>In the next few blog posts, I’ll dive deeper into some real-world applications and examples of how these concepts play out.
I’ll explore our C. difficile infection model integration, the M-CURES system for COVID-19 deterioration, and best practices for technical integration testing.
These case studies will provide more concrete examples of the challenges and solutions that arise when moving from theory to practice.</p>

<p>Whether you’re developing a new AI tool or preparing to integrate one into your health system, remember that implementation is not just about technology—it’s about aligning people, processes, and tools to ensure that AI improves patient care.</p>

<p>Cheers, <br />
Erkin <br />
<a href="https://eotles.com">Go ÖN Home</a></p>]]></content><author><name>Erkin Ötleş</name></author><category term="Blog" /><category term="medicine" /><category term="healthcare" /><category term="artificial intelligence" /><category term="machine learning" /><category term="data science" /><category term="FDA" /><category term="clinical decision support" /><category term="technology in medicine" /><category term="implementation" /><category term="implementation science" /><category term="AI model integration" /><category term="clinical AI infrastructure" /><category term="EMR AI integration" /><category term="healthcare system AI" /><category term="AI implementation tools" /><summary type="html"><![CDATA[A guide to the technical infrastructure needed to integrate AI models into clinical workflows, covering both internal and external integration approaches and their impact on data security and system performance.]]></summary></entry><entry><title type="html">Healthcare AI Development Infrastructure: Tools and Data for Model Creation</title><link href="https://eotles.com/blog/Healthcare-AI-Infrastructure-Development/" rel="alternate" type="text/html" title="Healthcare AI Development Infrastructure: Tools and Data for Model Creation" /><published>2024-09-11T00:00:00+00:00</published><updated>2024-09-22T00:00:00+00:00</updated><id>https://eotles.com/blog/Healthcare-AI-Infrastructure-Development</id><content type="html" xml:base="https://eotles.com/blog/Healthcare-AI-Infrastructure-Development/"><![CDATA[<h1 id="healthcare-ai-development-infrastructure">Healthcare AI Development Infrastructure</h1>
<p>This post is a part of the healthcare AI infrastructure series.
Check out the <a href="/blog/Healthcare-AI-Infrastructure/">intro post for a general lay of the land</a>.</p>

<h2 id="implementation-should-inform-development">Implementation Should Inform Development</h2>
<p>This post introduces several tools for developing healthcare AI models.
Although AI models can be developed in isolation and implemented later, it’s more effective to approach development and implementation as interconnected processes.
Projects are more successful when this connection is recognized, as most healthcare AI initiatives fail during implementation.
These failures often stem from neglecting the constraints imposed by real-world applications.
By understanding implementation challenges early on and designing with them in mind, you significantly increase the chances of success when it’s time to deploy the model.</p>

<p>While this post focuses on development, it’s written from the perspective of someone who has been through the entire process many times.
I encourage you to read the upcoming post on implementation as well so you can fully understand the lifecycle before beginning your journey.</p>

<h2 id="overview">Overview</h2>

<p>As mentioned in the <a href="/blog/Healthcare-AI-Infrastructure/">last post</a>, two key components are needed to build a model: data and a development environment (a computer).
Data often comes from clinical databases, such as those in an EMR or other clinical systems.
Once obtained, this data is transferred to computing environments designed specifically for model development, typically equipped with specialized software and hardware.</p>

<figure>
 <img src="https://eotles.com/assets/post_assets/2024-Healthcare-AI-Lifecycle/overview_development.png" alt="Overview of model development. Data are extracted from clinical systems, like the EMR. These data are then transferred to model development environments, where developers can write code that develop and validate AI models." />
 <figcaption>Overview of model development. Data are extracted from clinical systems, like the EMR. These data are then transferred to model development environments, where engineers can write code that they use to develop and validate AI models.</figcaption>
</figure>

<p>The above figure depicts the environments and data flows between them for model development.
It’s straightforward, with data being extracted from the clinical system and then moved into a model development environment, where most development work is done.</p>

<h3 id="data">Data</h3>
<p>Data extracted from clinical systems can take many forms, with the most basic being a simple table where each row represents a patient and each column contains different types of information about them.
Once you have research or quality improvement (QI) access, obtaining data from the EMR is relatively straightforward. When collaborating with your local Epic analysts (typically employed by the hospital), they will likely provide the data in Excel or CSV files.
You can also access data from other sources, such as collaborative institutions (with shared IRB or BAA agreements) or open-source datasets like those available on <a href="https://physionet.org/about/database/">PhysioNet</a>.</p>

<h3 id="development-environments">Development Environments</h3>
<p>Healthcare AI model development typically occurs on on-premises servers maintained by the health system or engineering departments that can ensure HIPAA compliance.
Privacy is crucial—and deserves a dedicated post—suffice it to say that it’s essential to collaborate with your compliance and security teams to handle privacy correctly.</p>

<p>Regarding software, using a Linux or Windows operating system with a Python development environment is common.
You’ll want to enable access to Python packages via a package/environment manager (like PyPi or Anaconda) since there’s a wealth of excellent open-source tools for this work (e.g., scikit-learn, PyTorch, TensorFlow).
A powerful machine with plenty of RAM and CPU cores is essential; access to GPUs will significantly speed up your work.</p>

<p>Maintaining this infrastructure can be complex, which is why many are increasingly turning to cloud-based computing environments for these tasks<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">1</a></sup></p>

<h2 id="research-infrastructure">Research Infrastructure</h2>
<p>Now, we can discuss the specific infrastructure you may have to deal with.
This infrastructure is often a shared resource supporting multiple types of data-driven research activities, such as health services research, epidemiology, and multi-omics.</p>

<figure>
 <img src="https://eotles.com/assets/post_assets/2024-Healthcare-AI-Lifecycle/development_infrastructure_research.png" alt="Architecture diagram for typical healthcare organization research infrastructure. Several clinical databases, like the laboratory information system (LIS), EMR (Chronicles and Clarity), and many other sources, may get fed into a central research data warehouse (RDW). RDW is then queried to get reports that can be used to develop models." />
 <figcaption>Research infrastructure architecture diagram. Several clinical systems, like the laboratory information system (LIS), EMR, and other sources, may get fed into a central research data warehouse (RDW). RDW is then queried to get reports that can be used to develop models.</figcaption>
</figure>

<p>If your institution uses Epic, your research IT setup may be similar to what we have at Michigan (depicted above).
Our data makes several stops before it gets to model developers.
These stops are known as <em>ETLs</em> (<em>short for extract, transform, load</em>), processes that take data in a specific format and convert it to another format for entry into a database.
There are two ETLs, the first of which is essentially mandatory.</p>

<h3 id="chronicles--clarity">Chronicles → Clarity </h3>
<p>Chronicles is a database meant to support healthcare operations, which means it’s excellent at enabling the millions of transactions needed daily for patient care.
But it’s not optimized for massive queries on large populations of patients.
To offload and optimize these types of analytical queries, Epic created <em>Clarity</em>, a SQL database (built on top of SQL products like Microsoft SQL Server and Oracle Database) that is a transformation of the data stored in Chronicles.
There is an ETL that runs every day that pulls data out of Chronicles and into Clarity.</p>

<h3 id="clarity--rdw">Clarity → RDW</h3>
<p>Researchers can access data directly from Clarity at some institutions, but that’s not the case at Michigan.
Instead, a dedicated database for researchers, known as the <em>research data warehouse</em> (<em>RDW</em>), is used.
RDW is an SQL database built on <a href="https://careevolution.com/orchestrate/">CareEvolution’s Orchestrate</a> platform.
This additional layer introduces some transformations but also enables the integration of other data types, such as wearable or insurer data, alongside EMR data.</p>

<p>Once data is queried from the RDW, it is transferred to the model development infrastructure, where engineers can work meticulously to build the model.</p>

<h3 id="a-note-on-etls">A note on ETLs</h3>
<p>We have found that ETLs can impact the performance of AI models.
There may be subtle differences between the data produced by an ETL process and the underlying real-time data.
These differences are a form of dataset shift that we refer to as <em>infrastructure shift</em>.
You can generally expect slightly reduced model performance when implementing models developed using data that have undergone ETL processes.
For more information, check out our <a href="/blog/research/Mind-the-Performance-Gap/">Mind the Performance Gap paper</a>.</p>

<h2 id="the-interface-between-development-and-implementation">The Interface Between Development and Implementation</h2>
<p>As we finalize models, we enter the interface between development and implementation.
This transitional phase is tricky because it spans not only multiple steps in the lifecycle but also different types of infrastructure.
I use the arbitrary distinction of <em>technical integration</em> as the dividing line: if the model is not yet receiving prospective data (i.e., it’s not technically integrated), it remains in development.
From here on, much of the discussion depends on how the model developer implements the model.
We will save most of this discussion for upcoming posts.
However, we will quickly discuss the final stages of development necessary for projects that choose to implement using an EMR’s internal integration tooling.</p>

<h3 id="epic-development-infrastructure">Epic Development Infrastructure</h3>
<p>If you decide to implement using Epic’s platform (or another vendor’s), you must ensure your model works on their infrastructure.
AI-EMR internal integration is a complex area that will likely improve over time.
However, to integrate technically within Epic, you’ll need to test and package your model using their custom development environment.
I won’t dive into the details here, as your best resource is <a href="http://galaxy.epic.com/">Epic Galaxy</a> for the most up-to-date documentation.</p>

<p>As part of model development, Epic provides a Python environment equipped with standard AI/ML libraries (e.g., NumPy, Pandas, scikit-learn). They also offer custom Python libraries to facilitate interaction with their data interfaces.</p>
<ul>
  <li>You can receive tabular data in a JSON format, which their libraries parse for you.</li>
  <li>After pre-processing the data, you can pass it to your model.</li>
  <li>Once your model generates predictions, you package them back to the EMR using another set of Epic’s Python functions.</li>
</ul>

<p>Although the development environment is sandboxed, you are not overly constrained in the code you want to include.
You can include additional Python and data files in the model package
Additionally, you can call external APIs from within this environment if your organization safelists them.
External API calls enable you to include information from other sources or to process data via another service. </p>

<figure>
 <img src=" https://eotles.com/assets/post_assets/2024-Healthcare-AI-Lifecycle/development_infrastructure_epic.png" alt=" Architecture diagram for developing models within an EMR vendor's system. A clinical database generates reports, which are sent to the model development environment. In this environment, developers write code for model development and validation, leading to the creation of the model. The model is then tested and packaged using the vendor's software. Once tested, the model is packaged and ready for implementation." />
 <figcaption>Architecture diagram for developing models within an EMR vendor's system. A clinical database generates reports, which are sent to the model development environment. In this environment, developers write code for model development and validation, leading to the creation of the model. The model is then tested and packaged using the vendor's software. Once tested, the model is packaged and ready for implementation.</figcaption>
</figure>

<p>In this workflow, you take a model developed in your infrastructure and convert it into a package that can be run on Epic’s implementation infrastructure.
A vital aspect of the workflow shown above is using a data report that comes directly from Chronicles (not Clarity) as part of this packaging process.
This report is typically a small extract representing current patients in the health system.
While small, it provides a highly accurate representation of prospective data since it is generated by the same infrastructure.</p>

<p>This small report creates a valuable opportunity to address <em>infrastructure shift</em> by using this real-time data alongside a more extensive, retrospectively collected research dataset during development. I think this approach could be worth exploring further—I might even consider researching this in the future.</p>

<h2 id="wrapping-up">Wrapping Up</h2>

<p>In this post, we’ve covered the foundational aspects of healthcare AI model development, briefly touching on data acquisition and development environment setup.
This brief discussion on the intersection of development and implementation highlights a key recurring theme: the importance of foresight and integrated planning in AI projects.
By understanding how data is handled, transformed, and utilized throughout the process, developers can better anticipate the practical challenges that emerge during model implementation.
This proactive approach streamlines the transition from development to deployment and improves the adaptability and effectiveness of the solutions we create.</p>

<p>In the next post, we will cover the infrastructure required to support AI implementation. Learn more in the <a href="/blog/Healthcare-AI-Infrastructure-Implementation/">AI Implementation Infrastructure</a> post.</p>

<p>Cheers, <br />
Erkin <br />
<a href="https://eotles.com">Go ÖN Home</a></p>

<div class="footnotes" role="doc-endnotes">
  <ol>
    <li id="fn:1" role="doc-endnote">
      <p>I’ve never done a cost breakdown analysis for on-premises vs. cloud for healthcare AI research, but I’d love to see results if anyone has some handy. <a href="#fnref:1" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
  </ol>
</div>]]></content><author><name>Erkin Ötleş</name></author><category term="Blog" /><category term="medicine" /><category term="healthcare" /><category term="artificial intelligence" /><category term="machine learning" /><category term="data science" /><category term="FDA" /><category term="clinical decision support" /><category term="technology in medicine" /><category term="implementation" /><category term="implementation science" /><category term="AI development environments" /><category term="healthcare data infrastructure" /><category term="research data warehouses" /><category term="clinical AI tools" /><category term="model development tools" /><summary type="html"><![CDATA[An in-depth look at the tools and environments needed to develop AI models for healthcare, emphasizing the importance of integrating implementation considerations early in the development process.]]></summary></entry><entry><title type="html">Healthcare AI Infrastructure: Key Systems for Making &amp;amp; Using Clinical AI Models</title><link href="https://eotles.com/blog/Healthcare-AI-Infrastructure/" rel="alternate" type="text/html" title="Healthcare AI Infrastructure: Key Systems for Making &amp;amp; Using Clinical AI Models" /><published>2024-09-10T00:00:00+00:00</published><updated>2024-09-22T00:00:00+00:00</updated><id>https://eotles.com/blog/Healthcare-AI-Infrastructure</id><content type="html" xml:base="https://eotles.com/blog/Healthcare-AI-Infrastructure/"><![CDATA[<h1 id="healthcare-ai-infrastructure">Healthcare AI Infrastructure</h1>
<p>For a general overview of the healthcare AI lifecycle, check out the <a href="/blog/Healthcare-AI-Lifecycle/">introductory post</a>.</p>

<p>This post started as a brief overview of healthcare AI infrastructure and then grew into an unwieldy saga incorporating my perspectives on building and implementing these tools.
As such, I split the post into a couple of parts.</p>

<p>In this post we will review the existing HIT landscape and provide a general set of approaches for development and implementation.
This’ll be followed by detailed posts on development and implementation.
These posts provide more technical details and discuss a couple of projects I’ve shepherded through the AI lifecycle.</p>

<p>Additionally, this series will focus on AI models that interact with electronic medical records (EMR) and related enterprise IT systems used by health systems.
This focus is partly due to my expertise—I worked for an EMR vendor and have built and deployed several models in this setting.
However, it is also a natural interaction point.
We connect AI models with EMRs because EMRs are the software systems most closely tied to care delivery.
Given this framing, we will now lay out the significant components.
   </p>

<h2 id="basic-healthcare-it-infrastructure">Basic Healthcare IT Infrastructure</h2>

<p>Let’s start by grounding our conversation on the most fundamental healthcare information technology (HIT) infrastructure component: electronic medical records systems (EMRs).
We will focus on EMRs because they are often the source and destination of information processed by healthcare AI systems.
A solid understanding of the subcomponents of the EMR is necessary for creating healthcare AI infrastructure.</p>

<figure>
 <img src="https://eotles.com/assets/post_assets/2024-Healthcare-AI-Lifecycle/overview_emr.png" alt="Generic EMR architecture diagram backend database serves data to users via a client frontend." />
 <figcaption>Generic EMR architecture diagram. The EMR backend has an operational database that serves data to clinical users via a client frontend user interface.</figcaption>
</figure>

<p>You can think of an EMR system as having two main components: a database and a client.
The database’s primary job is to store the EMR’s underlying data—patient names, demographics, vitals, labs, notes, and any other necessary clinical data.
The client’s job is to present the information in a way that the user can understand.</p>

<p>There’s a lot of additional code, configuration, and data that we won’t discuss directly, but these supporting artifacts help to round out the functionality of the database and the client. 
There are special names for these amalgamations: front end and back end.
The term <em>front end</em> refers to the client and its supporting code, configuration, and data handling mechanisms.
<em>Back end</em> refers to the database and all of its supporting configuration and communication code, along with any other code that drives the logic and behavior of the EMR.</p>

<figure>
 <img src="https://eotles.com/assets/post_assets/2024-Healthcare-AI-Lifecycle/overview_epic.png" alt="EMR architecture diagram backend database, Chronicles, serves data to users via a client frontend, Hyperspace." />
 <figcaption>High-level Epic architecture diagram. Epic has a server running a database called Chronicles, which serves data to a front end interface called Hyperspace.</figcaption>
</figure>

<p>To make things more concrete, we will briefly discuss the Epic-specific names for these components.</p>

<h3 id="back-end-chronicles">Back end: Chronicles</h3>

<p>Epic has a large back end written in a programming language called <a href="https://en.wikipedia.org/wiki/MUMPS">MUMPS</a> (it is also known as M or Caché, which is a popular implementation of the language).
MUMPS is an <strong>interesting</strong> language for various reasons (integrated key-value database, compact syntax, permissive scoping).
So I might write about it more in the future, but <a href="https://acorntalks.com/blog/the-code-parser/">Aaron Cornelius has some nice posts on the vagaries of MUMPS code</a>.
The database management system that holds all of the operational real-time clinical data is called <a href="https://ehealth.connect-care.ca/epic-systems/epic-analytic-tools/chronicles">Chronicles</a>, it is implemented using MUMPS for both the data storage and code controlling database logic, schema, indexing, etc.</p>

<h3 id="front-end-hyperspace">Front end: Hyperspace</h3>

<p>There are several distinct front ends for Epic; however, one is by far the most important: Hyperspace.
<em>Hyperspace</em> is the big daddy interface found on all the computers in the clinic and the hospital.
It started life as a Visual Basic application (I once heard a rumor that it was the largest Visual Basic application ever made); however, it is now primarily a .NET application.
If you’re a doctor, you may also interact with Epic’s other client software, such as <em>Haiku</em> (a mobile phone client) and <em>Canto</em> (an iPad client). 
There’s also <em>MyChart</em>, a front end that enables patients to review their records and communicate with their healthcare team.</p>

<p>Hyperspace is the primary place where clinical work is done.
It is where notes are written, orders are placed, and lab values are reviewed.
These workflows are the primary places where additional contextual information is helpful or where you want to serve a best practice alert.
Thus, Hyperspace is the most likely end-target for most of our healthcare AI efforts.</p>

<p>There are a couple of ways to get information into Hyperspace.
The first is to insert data into the underlying database, Chronicles, and integrate the information into the EMR’s underlying mechanics.
The second is to have Hyperspace display a view of the information but serve it from a different source (like your own web server).
This is usually done through a <a href="https://en.wikipedia.org/wiki/Frame_(World_Wide_Web)">iframe</a>.<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">1</a></sup>
These options are not limited to Epic EMRs; you should be able to take either approach with any modern EMR system.</p>

<p>Now that we have discussed the basic healthcare IT landscape, we can start to discuss the specifics of making AI tools for healthcare.</p>

<h2 id="ai-development-infrastructure">AI Development Infrastructure</h2>

<p>Now, we can start to dig into the fun stuff - the actual building of healthcare AI models.
To start building an AI model, you need two things: data and a development environment (a computer).
Data often comes in the form of a report or extract from a database (usually the EMR’s database).
These data are then used to train a model using a computing environment set up for this purpose.
These environments tend to be configured with special software and hardware, which allow model developers to write code to develop and evaluate a model.</p>

<figure>
 <img src="https://eotles.com/assets/post_assets/2024-Healthcare-AI-Lifecycle/overview_development.png" alt="Development overview." />
 <figcaption>Architecture of development. Data comes from the EMR and is then transferred to development environments (usually in the form of reports).</figcaption>
</figure>

<p>The above figure depicts the generic data flow for model development.
Generally, the data will flow linearly from a source clinical system to our model development environment.</p>

<h2 id="ai-implementation-infrastructure">AI Implementation Infrastructure</h2>

<p>Now we focus on connecting models into care processes, <em>implementation</em>.
As discussed in the <a href="/blog/Healthcare-AI-Implementation/">previous post, implementation goes beyond the technology</a>, however, the primary focus of this section will be on the implementation step of <em>technical integration</em>, the nuts-and-bolts of connecting AI models to existing HIT systems.</p>

<p>There are two primary ways to integrate a model into existing HIT systems, and the relationship to the EMR delineates them as internal and external.</p>

<p><em>Internal integration</em> of models means that developers rely exclusively on the tooling provided by the EMR vendor to host the model along with all of the logic that controls the running of the model and filing of its results.</p>

<figure>
 <img src="https://eotles.com/assets/post_assets/2024-Healthcare-AI-Lifecycle/overview_implementation_infrastructure_epic.png" alt="Implementation overview using Epic." />
 <figcaption>Internal integration. Model runs on services provided by the EMR vendor. Data doesn't leave environment secured by vendor.</figcaption>
</figure>

<p><em>External integration</em> of models means that developers own some parts of the hosting, running, or filing (usually the hosting piece).</p>

<figure>
 <img src="https://eotles.com/assets/post_assets/2024-Healthcare-AI-Lifecycle/overview_implementation_infrastructure_self_hosted.png" alt="Implementation overview using self-hosting." />
 <figcaption>External integration. Model runs on services external to the EMR and data are passed back and forth.</figcaption>
</figure>

<p>In both scenarios, data flows from the EMR database to the model; however, the path these data take can be drastically different, and significant thought should be put into the security of the data and the match between the infrastructure and the model’s capabilities.</p>

<p>It is important to note that these approaches delegate the display of model results to the EMR system.
They do this by passing model results to the EMR and using EMR tools to display the results to users.</p>

<h2 id="a-note-on-color-coding">A Note on Color Coding</h2>
<p>Throughout this series, I have employed a consistent color coding scheme to identify the owners of different HIT components.
Everything made and maintained by the EMR vendor (or their proxies) is red <img src="https://placehold.co/15x15/B85450/B85450.png" alt="#B85450" />.
Components owned by AI model developers are colored green <img src="https://placehold.co/15x15/82B366/82B366.png" alt="#82B366" />.
Components that the health system or research enterprise may own are blue <img src="https://placehold.co/15x15/6C8EBF/6C8EBF.png" alt="#B85450" />.
Elements that don’t fit directly in one of these buckets are outlined in black <img src="https://placehold.co/15x15/000000/000000.png" alt="#000000" />.  </p>

<h2 id="whats-next">What’s next?</h2>
<p>Because it’s a shiny new toy, healthcare AI can sometimes seem like it should be in a class of its own compared to existing technologies.
This is absolutely not the case; good healthcare AI is good HIT.
I think there is no real distinction between HIT and healthcare AI because they interact with the same data and users.</p>

<p>A comprehensive understanding of EMRs and associated clinical care systems is paramount in developing and implementing healthcare AI models.
This post is followed by detailed posts on <a href="/blog/Healthcare-AI-Infrastructure-Development/">AI development infrastructure</a> and <a href="/blog/Healthcare-AI-Infrastructure-Implementation/">implementation infrastructure</a>.</p>

<p>Cheers, <br />
Erkin <br />
<a href="https://eotles.com">Go ÖN Home</a></p>

<div class="footnotes" role="doc-endnotes">
  <ol>
    <li id="fn:1" role="doc-endnote">
      <p>This can be complicated because you need to maintain your own application server and also deal with passing authentication between the EMR session and your application. <a href="#fnref:1" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
  </ol>
</div>]]></content><author><name>Erkin Ötleş</name></author><category term="Blog" /><category term="medicine" /><category term="healthcare" /><category term="artificial intelligence" /><category term="machine learning" /><category term="data science" /><category term="FDA" /><category term="clinical decision support" /><category term="technology in medicine" /><category term="implementation" /><category term="implementation science" /><category term="AI development environments" /><category term="healthcare data infrastructure" /><category term="research data warehouses" /><category term="clinical AI tools" /><category term="model development tools" /><category term="AI infrastructure in healthcare" /><category term="healthcare IT infrastructure" /><category term="EMR integration" /><category term="AI system infrastructure" /><category term="clinical AI development" /><summary type="html"><![CDATA[Infrastructure is king. An intro to the foundational healthcare IT systems that power AI, focusing on how electronic medical records & technical integration shape the development and deployment of healthcare AI models.]]></summary></entry><entry><title type="html">Healthcare AI Implementation: Steps for Successful Clinical Integration</title><link href="https://eotles.com/blog/Healthcare-AI-Implementation/" rel="alternate" type="text/html" title="Healthcare AI Implementation: Steps for Successful Clinical Integration" /><published>2024-09-03T00:00:00+00:00</published><updated>2024-09-20T00:00:00+00:00</updated><id>https://eotles.com/blog/Healthcare-AI-Implementation</id><content type="html" xml:base="https://eotles.com/blog/Healthcare-AI-Implementation/"><![CDATA[<p><em>You’ve developed an AI model that could “revolutionize” patient care—but how do you ensure it truly impacts the clinical workflow and improves outcomes?
This is where implementation becomes paramount.</em></p>

<h1 id="implementing-healthcare-ai">Implementing Healthcare AI</h1>

<p>This post builds off of a <a href="/blog/Healthcare-AI-Lifecycle/">previous introduction to the healthcare AI lifecycle</a> and a discussion on healthcare <a href="/blog/Healthcare-AI-Development/">AI development</a>.
These are not necessary pre-reading, but they provide a good background for the main focus of this post: Implementation 
<em>Implementation</em> is the work of integrating and utilizing an AI model into clinical care.</p>

<p>This post will first cover key implementation steps and general challenges associated with implementing AI tools in healthcare.</p>

<figure>
 <img src="https://eotles.com/assets/post_assets/2024-Healthcare-AI-Lifecycle/healthcare_ai_lifecycle_implementation.png" alt="Healthcare AI implementation portion of the lifecycle. Implementation is the creation of models and involves predictive task selection, data access, data preparation, model training, and model validation." />
 <figcaption>Healthcare AI implementation portion of the lifecycle. Implementation is the integration of models into workflows and generally has the following steps: technical integration, prospective validation, workflow integration, monitoring, and updating.</figcaption>
</figure>

<h2 id="implementation-steps">Implementation Steps</h2>
<p>Like the development process, I break down implementation into five steps.</p>
<ul>
  <li>Technical Integration</li>
  <li>Prospective Validation</li>
  <li>Workflow Integration</li>
  <li>Monitoring</li>
  <li>Updating
There may be some non-linearity and blurring of these steps; however, implementation tends to work better the more structured this process is.
That’s because there’s more “on the line” the further along the lifecycle you get.
So, it’s best to be sure you’ve perfected a step before moving on to the next.</li>
</ul>

<h3 id="technical-integration">Technical Integration</h3>

<p>Technical integration is the first step, and it involves getting the AI model to communicate with existing healthcare IT systems.
Model developers will need to work closely with IT departments to ensure that data can flow smoothly (and securely) from care systems, such as electronic medical records (EMRs), to the AI model and back.</p>

<p>Significant effort will need to be expended at this stage.
Although model developers and healthcare IT (HIT) administrators are technically inclined, they may need help working together initially due to their focus on different technologies and differing priorities.
Thus, it can take a lot of work for a model developer to explain the needs of their model, and HIT administrators may need to expend additional effort to make their existing technology stacks compatible with AI models.</p>

<p>I’ll have several blog posts detailing some technical approaches, but it’s important to note that all of these steps are complex socio-technical processes.
We should push to use a layer of technology standards, like <a href="https://www.hl7.org/fhir/">FHIR</a>, but we should also develop good governance and processes around technical integration.</p>

<p>Finally, technical integration must be conducted before assessing whether an AI model will work well for a given health system.
That’s because the model’s performance isn’t truly known until it starts running in situ.</p>

<h3 id="prospective-validation">Prospective Validation</h3>

<p>Prospective validation is the first high-fidelity test of the model.
It’s about running the model in the real world but in a controlled manner.
The aim is to see how the model performs with live data without directly impacting patient care.
This step is critical for assessing the model’s readiness for full-scale implementation and identifying any unforeseen issues that might not have been apparent during development.</p>

<p>I recommend that all model developers and implementers aim to conduct a <em>silent prospective validation</em>, which is where the model’s predictions are tested in a live clinical data environment without affecting clinical decisions (scores/alerts are not shown to users).</p>

<p>Prospective validation is sometimes the only way to assess if your model development and technical integration worked correctly.
We did a deep dive into an AI model we developed and implemented for the health system.
This work is cataloged in the <a href="/blog/research/Mind-the-Performance-Gap/">Mind the Performance Gap: Dataset Shift During Prospective Validation paper</a>.
In addition to discussing prospective validation, we uncovered a new type of dataset shift driven primarily by issues in our health IT infrastructure.
The difference between the data our model saw during development and implementation environments caused a noticeable degradation in performance.
So, we needed to rework our model and the technical integration to ameliorate this performance degradation.</p>

<h3 id="workflow-integration">Workflow Integration</h3>

<p>Integrating an AI model into clinical workflows is more art than science.
Fundamentally, you need to understand how healthcare professionals work, what information they seek, and when they need it.
Ultimately, we want AI tools to fit into physician routines and not disrupt them.</p>

<p>The default has been to “alert” clinicians by sending a push of information as a page or pop-up (best practice alert).
While these may have a place in some workflows, I find them particularly irksome in my daily practice as they tend to break my mental flow.
We should push for other ways to integrate the outputs of AI tools into our workflows.</p>

<p>One approach might involve designing intuitive user interfaces for clinicians or setting up alert systems that are less disruptive but still provide actionable insights.
For example, it would be great if there was a chat-like interface that enabled AI tools to ping me with messages that were previously BPAs.
I could work through these messages and query the AI system with follow-up questions.</p>

<h3 id="monitoring">Monitoring</h3>

<p>The job isn’t over once an AI model is up and running.
Continuous monitoring ensures the model remains performant and relevant over time.
This process involves tracking the model’s performance, identifying any drifts in accuracy, and being alert to changes in clinical practices that might affect how the model should be used.</p>

<p>Keeping track of basic model performance statistics, such as the number of alerts, sensitivity, and positive predictive value, can be challenging.
That is because we need better infrastructure to do this automatically.
So even if a model developer completes all the implementation work, they may have to manually set up all the logging necessary to collect all these statistics.
Hopefully, this will become easier as we develop more robust tools, like <a href="https://github.com/epic-open-source/seismometer?tab=readme-ov-file">Epic’s Seismometer</a>.</p>

<p>It would be great to transcend beyond basic monitoring.
I imagine a future in which AI tool users can provide real-time performance feedback, and developers can use that feedback to improve models.</p>

<h3 id="updating">Updating</h3>

<p>You don’t “set it and forget it” with AI models in healthcare.
Models must be maintained as medical knowledge advances and patient populations change.
Updating models might involve:</p>
<ul>
  <li>retraining with new data,</li>
  <li>incorporating feedback from users, or</li>
  <li>Redesigning the model to accommodate new clinical guidelines or technologies. </li>
</ul>

<p>Ensuring models remain current and relevant involves more than just routine retraining with new datasets.
It demands a thoughtful approach, considering how updates might impact the user’s trust and the model’s usability in clinical settings.
This challenge is where our recent work on <a href="/blog/research/Updating-Clinical-Risk-Stratification-Models-Using-Rank-Based-Compatibility/">Updating Clinical Risk Stratification Models Using Rank-Based Compatibility</a> comes into play.
We developed mathematical techniques to ensure that updated models maintain the correct behavior of previous models that physicians may have come to depend on. </p>

<p>Updating models to maintain or enhance their performance is crucial, especially as new data become available or when data shifts occur.
However, these updates must maintain the user’s expectations and the established workflow.
Our research introduced a novel rank-based compatibility measure that allows us to evaluate and ensure that the updated model’s rankings align with those of the original model, preserving the clinician’s trust in the AI tool.</p>

<h2 id="challenges">Challenges</h2>
<p>Implementing AI models into clinical care can be challenging.
During model implementation, the goal is to use models to estimate unknown information that can be used to guide various healthcare processes.
This real-world usage exposes models to the transient behaviors of the healthcare system.
Over time, we expect the model’s performance to change.
Even though the model in use may not be changing, the healthcare system is, and these changes in the healthcare system may reflect new patterns that the model was not trained to identify.</p>

<p>Contrasting this with the fact that the model may also change over time is essential.<sup id="fnref:1" role="doc-noteref"><a href="#fn:1" class="footnote" rel="footnote">1</a></sup>
Although we often talk about static models (which model developers may update occasionally), it is important to note that some are inherently dynamic.
These models change their behavior over time.
Employing updating and dynamic models produces a second set of factors impacting how a model’s performance could change over time.
Thus, it could be hard to disentangle issues arising from new model behaviors or changes in the healthcare system.</p>

<p>To make things more concrete, here are some examples:</p>
<ul>
  <li>A model flags patients based on their risk of developing sepsis.
There is an increase in the population of patients admitted with respiratory complaints due to a viral pandemic.
This change in patient population leads to a massive increase in the number of patients the model flags, and the overall model performance drops because these patients do not end up experiencing sepsis.
It serves as <a href="https://jamanetwork.com/journals/jamanetworkopen/fullarticle/2786356">an example</a> of a static model being impacted by the changes in the healthcare system over time.</li>
  <li>A model identifies physicians who could benefit from additional training.
The model uses a limited set of specially collected information. 
Model developers create a new model version that utilizes EMR data.
After implementation, the updated model identifies physicians with better accuracy.
This improvement is an example of a static model being updated to improve performance over time.</li>
</ul>

<h3 id="transition-from-bench-to-bedside">Transition from Bench-to-Bedside</h3>
<p>Implementation into clinical care requires the model to be connected to systems that can present it with real-time data.
We refer to these systems as infrastructure.
Infrastructure refers to the systems (primarily IT systems) needed to take data recorded during clinical care operations and present it in a format accessible to ML models.
This infrastructure determines the availability, format, and content of information.
Although data may be collected in the same source HIT system (e.g., an EMR system), the data may be passed through a different series of extract, transform, and load (ETL) processes (sometimes referred to as pipelines) depending on the data use target.</p>

<p>Once connected to clinical care, ML models need monitoring and updating.
For example, developers may want to incorporate knowledge about a new biomarker that changes how a disease is diagnosed and managed.
Model developers may thus consider updating models as a part of their regular maintenance.</p>

<h3 id="physician-ai-teams">Physician-AI Teams</h3>
<p>This maintenance is complicated because models do not operate in a vacuum.
In many application areas, users interact with models and learn about their behavior over time.
In safety-critical applications, like healthcare, models and users may function as a team.
The user and model each individually assess patients.
The decision maker, usually the user, considers both assessments (their own and the model’s) and then makes a decision based on all available information.
The performance of this decision is the user-model team performance.</p>

<h2 id="a-note-on-deployment-vs-integration-vs-implementation">A Note on <em>Deployment</em> vs <em>Integration</em> vs <em>Implementation</em></h2>

<p>As we finish, I want to make a quick note on terminology.
We often use the terms implementation, deployment, and integration interchangeably; however, there are subtle but important distinctions between them.
I want to bring about a precision in language between these three terms.
Clearly defining them will help us discuss connecting AI tools to care processes more effectively.</p>

<ul>
  <li><em>Deployment</em>—This one has a heavy-handed vibe; it may conjure up images of a military operation.
In the tech realm, it’s about pushing out code or updates from one side (developers) without much say from the other (users).
I view it as a one-way street, with the developers calling the shots.
However, this mindset doesn’t yield great results in healthcare, where the stakes are high, and workflow and subject matter expertise are paramount.
We can deploy code, but we should be wary of deploying workflows. Instead, we should co-develop workflows with all the necessary stakeholders.</li>
  <li><em>Integration</em>—This is the process of getting an AI model to work with the existing tech stack, like fitting a new piece into a complex puzzle.
But just because the piece fits doesn’t mean it will be used effectively or at all.
Integration focuses on the technical handshake between systems, but it can miss the bigger picture – workflow needs and human factors.</li>
  <li><em>Implementation</em> – This is where the magic happens.
It’s not just about the technical melding of AI into healthcare systems; it’s about weaving it into the fabric of clinical workflows and practices.
It’s a two-way street, a dialogue between developers and end-users (clinicians and sometimes patients).
Implementation is a collaborative evolving process that treats users as partners in the socio-technical development of an AI system.
It acknowledges that for AI to make a difference, it needs to be embraced and utilized by those on the front lines of patient care.</li>
</ul>

<p>So, when discussing AI in healthcare, let’s lean more towards implementation.
It’s about more than just getting the tech right; it’s about fostering a collaborative ecosystem where we can make tools that genuinely contribute to better health outcomes by meeting the needs of clinical users and workflows.</p>

<h2 id="wrapping-up">Wrapping Up</h2>

<p>We’ve traversed through technical integration, prospective validation, workflow integration, monitoring, and updating, each with its challenges and nuances.
We’ve also untangled some jargon—implementation, deployment, integration—words that might seem interchangeable but have different implications in healthcare AI.
Implementation is more than just a technical task; it’s a collaborative endeavor that requires developers and clinicians to collaborate, ensuring AI tools fit into healthcare workflows and genuinely enhance patient care.</p>

<p>This post wraps up our overview of the healthcare AI lifecycle.
To understand the technical infrastructure that powers these models, check out the post on <a href="/blog/Healthcare-AI-Infrastructure/">Healthcare AI Infrastructure</a>.</p>

<p>Some of this content was adapted from the introductory chapter of my doctoral thesis, <a href="https://deepblue.lib.umich.edu/handle/2027.42/193446"><em>Machine Learning for Healthcare: Model Development and Implementation in Longitudinal Settings</em></a>.</p>

<p>Cheers, <br />
Erkin <br />
<a href="https://eotles.com">Go ÖN Home</a></p>
<div class="footnotes" role="doc-endnotes">
  <ol>
    <li id="fn:1" role="doc-endnote">
      <p>Herein lies an essential point for clarification with lay audiences. Most people unfamiliar with ML/AI have some expectation that models in use have a default dynamic updating behavior (i.e., that models are learning continuously over time). Dynamic updating hasn’t generally been the case with models deployed in healthcare. <a href="#fnref:1" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
  </ol>
</div>]]></content><author><name>Erkin Ötleş</name></author><category term="Blog" /><category term="medicine" /><category term="healthcare" /><category term="artificial intelligence" /><category term="machine learning" /><category term="data science" /><category term="FDA" /><category term="clinical decision support" /><category term="technology in medicine" /><category term="implementation" /><category term="implementation science" /><category term="AI implementation in healthcare" /><category term="clinical AI integration" /><category term="healthcare AI workflow" /><category term="model integration" /><category term="prospective validation" /><summary type="html"><![CDATA[A look at the crucial steps in AI implementation, covering technical integration, prospective validation, and model monitoring to ensure AI tools make a meaningful impact in healthcare.]]></summary></entry></feed>