Section 5-1 : Case Study openEMR
AI Case Study
This tutorial is based on case study, where AI data solution is used as in a real-world example of a customer using it.
Please review important aspects and key considerations on How To Use AI Data Solutions in previous chapter.
Healthcare App openEMR Case Study
Of: openEMR App for healthcare
Summary Highlights
The case study sought to leverage the power of AI models to unlock the full potential of openEMR health system data with EasyManage help.
Successfully achieved key objectives:
1. | Get Data modeling suggestions from AI | ✅ |
2. | Ask AI For Sensitive Data Analysis | ✅ |
3. | Make openEMR data AI-Ready in 10 Min | ✅ |
4. | Build, deploy and Customize MCP Server | ✅ |
5. | AI Model Analysis performed on openEMR data | ✅ |
6. | Ask AI What Insights and Trends Can Get | ✅ |
7. | Ask AI What AI Workflows Can Implement | ✅ |
Brief Synopsis
Leverage opportunities for AI data solutions such as AI-driven insights & trends and AI workflow automation for healthcare App openEMR as demo installation.
Steps
Following steps were taken towards implementing solutions using EasyManage AI.
Import Tables And Download Schema
Import Tables
- App Tables from MySQL/mariaDB cloud database imported into EasyManage.
Search tables, listed
- Tables Imported
- Search metadata, search tables for field
patient_id
- Download Table Schema from EasyManage.
- Downloaded SQL file.
TableSchemaDnld_openEMR.sql
- Markdown format here : openEMR Table Schema Downloaded
Get Data modeling suggestions from AI
- Open Cursor and start new project workspace at e.g.
C:\openEMR
- Copy
TableSchemaDnld_openEMR.sql
to project root. - Using above table schema SQL file as context, Ask AI model
Give suggestions for data modeling i.e. table joins up to 4 nested levels, specify one-to-many or one-to-one
- Context given
- Asked for data modeling suggestions
- Response for data modeling suggestions
- Please see response doc:
Configure Data Modeling
Define and configure data modeling, table joins in EasyManage Builder Studio for
- Medication and Prescription Data Model
- Level 1: Patient Medications
patient_data | 1:M | prescriptions | 1:M | drugs
- Refer to tutorial on Data Modeling
- Medication and Prescription Data Model
Data modeling configured for Patient Medications
patient_data
←→prescriptions
(viapatient_id
)prescriptions
←→drugs
(viadrug_id
)
In this order: 1.
prescriptions
←→drugs
- Then: 2.
patient_data
←→prescriptions
Ask AI For Sensitive Data Analysis
- Giving as context
TableSchemaDnld_openEMR.sql
, Ask AI model
Study columns and mark columns , put comment on right side, for columns that come under Sensitive data, PII (Personally Identifiable Information), Confidential Business Information, Data revealing sensitive personal informatio
OR
Analyze the OpenEMR database schema to identify columns that contain sensitive data, PII, confidential business information, or data revealing sensitive personal information
- Tip: For healthcare databases also check for
PHI fields
i.e. sensitivePHI identifiers under HIPAA
.
- Chat input
- Chat Response Progress
NOTE: Using the 1st prompt, AI was not able to edit file, but decided to create a new file:
- Please see response doc:
- How to implement the sensitive data recommendations?
- Before generating code, use EasyManage field hide option to exclude columns, having sensitive data, from API and MCP Layers, so that AI models will not have access to them. Use via menu links:
- Data Table Explorer → navigate to folder having table → Select option on right side of table listed → Field Prop - Hide → Set for required columns → Field Prompt Properties → Hide [Yes] and Data Display Properties → Hide [Yes]
- Before generating code, use EasyManage field hide option to exclude columns, having sensitive data, from API and MCP Layers, so that AI models will not have access to them. Use via menu links:
EasyManage Builder Studio Project Configure Settings
MCP Server Module Bundling for V1
It is recommended to keep 5-10 tables in one MCP Server module. Along with data modeling of those tables.
- Select 16 tables for AI solution module building.
- Bookmarked tables for generating code
- Build Selection
- Build/Generate : Included will be MCP Server REST with APIs REST.
- This will be version V1.
- Download generated code.
- Create Folder structure for easymanage and cursor workspace.
Copy below projects from extracted code to workspace
openEMR_workspace
.backend\spring-java\emapi
mcp\spring-java\emmcp
APIs REST : Open project, Build
- Run APIs - CMD Prompt
cd openEMR_workspace
java -jar emapi\app\dbrest\target\dbrest-1.0-SNAPSHOT.jar
- Run APIs - Check Swagger Home
- Run APIs - Check Swagger Data Modeling endpoint
- MCP Server REST : Open project, Build
Use MCP Server V1
Configure and Use MCP Server V1 in Cursor.
Sample
mcp.json
{
"mcpServers": {
"easymanage": {
"command": "C:/ProgFiles/Java/jdk-17/bin/java.exe",
"args":
["-jar",
"path_to_workspace/openEMR_workspace/emmcp/app/mcprest/target/mcprest-1.0-SNAPSHOT.jar"
],
"env": {
"em.mcp.apiUrl": "http://127.0.0.1:9080/emdbrest",
"em.mcp.authType": "None",
"em.mcp.authToken": ""
}
}
}
}
Exceeding Total Tools Limit
- Warning is displayed as total tools 102 are exceeding 40.
Try chat input:
easymanage get and study all table schema and suggest what insights and trends can be derived from tables
AI model sees no relevant tool call available and tries to suggest insights from static SQL file available in workspace:
Please see response doc:
Now delete
TableSchemaDnld_openEMR.sql
from project root- We want AI model to call tool
get_all_table_schema
once available later.
- We want AI model to call tool
Customize MCP Server as V2
Customize MCP Server REST V1, disable some table level tools globally.
- Please see section:
How to Enable/Disable Tools
inREADME-mcprest.md
- Please see section:
Verify and Disable Tools as indicated below and try out.
- Table Level - Disable
- TOOL-ViewAll
- TOOL-ViewAllPaged
- Table Level - Keep
- TOOL-SelectWhere
- TOOL-Query
- AI Transactions - Disable All
- AI-TRAN-ADD
- AI-TRAN-EDIT
- AI-TRAN-DEL
- Table Joins Data Modeling Level - Disable
- TOOL-DM-ViewAll
- TOOL-DM-ViewAllPaged
- Table Joins Data Modeling Level - Keep
- TOOL-DM-SelectWhere
- TOOL-DM-Query
- Table Level - Disable
Disable Tools using VS Code
- Build/Generate MCP Server REST.
- This will be version V2.
- Configure MCP Server in Cursor.
- Shows: Found 40 Tools
AI Model Analysis
Results from AI analysis is given in response docs below.
Presented below and listed are few analysis and solutions being recommended by AI models.
Ask AI What Insights and Trends Can Get
easymanage get and study all table schema and suggest what insights and trends can be derived from tables
- Chat input
- Chat Response Progress 1
- Chat Response Progress 2
Please refer to response doc
Ask AI What AI Workflows Can Implement
easymanage get and study all table schema and suggest what AI workflows can be implemented based on tables
- Chat input
- Chat Response Progress 1
- Chat Response Progress 2
- Chat Response Progress 3
Please refer to response doc
- Also see the generated markdown files by AI model in this response:
- Below 3 documents generated.
- AI Workflows Analysis
- AI Workflows - AI Implementation Guide
- AI Workflows README
Next Steps
After AI Transaction Tools enabled, can ask AI What AI Transactions Can Implement
.
Enable AI Transaction Tools
- Customize MCP Server REST V2 to build V3, where in enable AI transaction table level tools globally.
- Please see section:
How to Enable/Disable Tools
inREADME-mcprest.md
- Please see section:
Ask AI What AI Transactions Can Implement
easymanage get and study all table schema and suggest what AI transactions can be implemented