This project provides an example template to illustrate the use of Azure OpenAI to generate a patient-facing summary of incoming lab results, including explanation of what the results mean and the implications on the patient's health. The intent is to simulate an integration with an EHR, intercepting the incoming lab results from the in-basket and passing those results along with the notes from the last encounter to the Azure OpenAI LLM to create an explanation to the patient - reducing cognitive load an time spent by clinicians and getting result information to patients more quickly.
This template deploys an API built and hosted by an Azure Function App, with a Static Web App Blazor front end to illustrate a user selecting a lab result from an in-basket and requesting patient-facing summary from AI.
This template includes the reading of sample data from a local sample data file for simplicity. This could be extended with Databricks or other mechanism to pull near-real-time data, or other integration pattern, as in the example below.
This solution includes an API defined and deployed to an Azure Function App, developed on Python with the Semantic Kernal SDK to define and orchestration prompt function calls to Azure OpenAI.
- Receive request on /labsummary endpoint
- expected payload includes lab results and encounter notes
- see HTTP request example: fetch_patients.http
- The
summarize_labs
Semantic Kernel prompt function is called, with the lab results and encounter notes as input- see summarize_labs.yaml for prompt function definition
- As the
summarize_labs
prompt function requires subsections of the encounter notes, the following prompt functions are called to extract that data via the Semantic Kernal AzureChatCompletion service, before calling the service a final time withsummarize_labs
prompt
Reference Documentation:
- Semantic Kernel GitHub Repo
- Getting Started with Semantic Kernel (Python)
- Understanding the Kernel in Semantic Kernel
- Adding AI Services to the Kernel
To deploy to Azure, you can follow these steps after cloning the repo into your local IDE such as VS Code.
-
Install the Azure CLI: How to install the Azure CLI
-
Install the Azure Developer CLI (azd) extension for the Azure CLI.
-
Log in to your Azure account by running the following command and following the prompts:
azd auth login
-
Run the azd up command, and follow the prompts to indicate the subscription, region and resource group to deploy to
azd up
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.