Skip to content

Commit 12349bc

Browse files
authored
Personal/rshinde/empi deployment template (#211)
* Added ARM Template and README files * Added images to show EMPI Functionality * Document Updation for EMPI Deployment steps
1 parent ac4fbcc commit 12349bc

File tree

14 files changed

+219
-0
lines changed

14 files changed

+219
-0
lines changed
Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
# External Enterprise Master Patient Index (EMPI) Service integration with AHDS FHIR service
2+
3+
4+
Sample shows how an external EMPI service can be used in conjunction with the AHDS FHIR service by providing a unified endpoint for AHDS FHIR service as well as EMPI Operations.
5+
6+
## Architecture
7+
This architecture explains how a web application communicates with a EMPI service and FHIR service via an EMPI Connector (Azure Function App).
8+
9+
10+
![](./docs/images/Architecture.png)
11+
12+
13+
## The Architecture components
14+
- **Static Web App**: Blazor UI Application for $match and CRUD operations for patient on FHIR service ad EMPI service
15+
- **Event Hub**: It can process and store events, data and telemetry produced by FHIR Service.
16+
- **Events**: Events allow you to subscribe to and receive notifications of changes to health data in the FHIR service
17+
- **EMPI Connector App**: It executes $match operation and handles Events triggered.
18+
- **EMPI service**: It contains demographic data for patients
19+
- **AHDS FHIR service**: AHDS FHIR Service, contains healthcare data including patients
20+
21+
22+
## Prerequisites
23+
24+
* An Azure account with an active subscription.
25+
- You need access to create resource groups, resources, and role assignments in Azure
26+
27+
* AHDS FHIR service deployed in Azure. For information about how to deploy the FHIR service, see [Deploy a FHIR service](https://learn.microsoft.com/en-us/azure/healthcare-apis/fhir/fhir-portal-quickstart).
28+
29+
* Postman installed locally. For more information about Postman, see [Get Started with Postman](https://www.getpostman.com/).
30+
31+
* Knowledge of how to access the FHIR service using Postman, including [registering the client application to access the FHIR service](https://github.com/microsoft/azure-health-data-services-workshop/blob/main/resources/docs/Postman_FHIR_service_README.md#step-1---create-an-app-registration-for-postman-in-aad) and granting [FHIR Data Contributor](https://github.com/microsoft/azure-health-data-services-workshop/blob/main/resources/docs/Postman_FHIR_service_README.md#step-2---assign-fhir-data-contributor-role-in-azure-for-postman-service-client) permissions. In case you don't have postman setup to access FHIR Service, Please follow this tutorial: [Access using Postman | Microsoft Learn](https://learn.microsoft.com/en-us/azure/healthcare-apis/fhir/use-postman).
32+
33+
* Working External EMPI Service URL and authentication details.
34+
35+
* [.NET 6.0](https://dotnet.microsoft.com/download)
36+
37+
* [Azure Command-Line Interface (CLI)](https://docs.microsoft.com/cli/azure/install-azure-cli)
38+
39+
* [Azure Developer CLI](https://docs.microsoft.com/azure/developer/azure-developer-cli/get-started?tabs=bare-metal%2Cwindows&pivots=programming-language-csharp#prerequisites)
40+
41+
* Clone this repo.
42+
43+
### Prerequisite check
44+
45+
- In a terminal or command window, run `dotnet --version` to check that the .NET SDK is version 6.0 or later.
46+
- Run `az --version` and `azd version` to check that you have the appropriate Azure command-line tools installed.
47+
- Login to the Azure CLI
48+
- Launch Postman app.
49+
50+
### Static Web App (UI) and Postman queries
51+
52+
UI application and Postman queries use common endpoint for EMPI service operations and FHIR service Operations.
53+
54+
The UI application demonstartes $match and CRUD operations for patient, those operations are routed to external EMPI service by EMPI Connector app.
55+
56+
The UI Application also demonstartes operations for searching Observation resources from FHIR service and saving translated Observation resources to FHIR service, the search and save operations are routed to AHDS FHIR Service by APIM.
57+
58+
### Postman Queries
59+
60+
The postman queries to demonstare Common Endpoint Application routing calls to external EMPI service and AHDS FHIR Service via single endpoint are available under `FHIR-EMPI Integration` folder in `Fhir-EMPI Collection` postman collection available in this repo. For Queries in this collection, we are using APIM URL as our base URL and auth token of FHIR service to authenticate requests.
61+
62+
## Setting up application locally
63+
### Visual Studio
64+
65+
#### EMPI UI APP
66+
* Clone the repo, under path *\samples\fhir-empi-integration\ui-app, Open the `FhirBlaze.sln` project in Visual Studio.
67+
* This application is based on sample app [here](https://github.com/microsoft/azure-health-data-services-workshop/tree/main/Challenge-10%20-%20Optional%20-%20FhirBlaze%20(Blazor%20app%20dev%20%2B%20FHIR)), please refer Readme file for configuration of project. Follow step 1 & 3 only, skip step 2.
68+
* Set FhirBlaze project as StartUpProject
69+
* Run FhirBlaze Application.
70+
71+
#### EMPI Connector APP
72+
* Navigate to *\samples\fhir-empi-integration\empi-connector, Open the `EMPIShim.sln` project in Visual Studio.
73+
* Create `local.settings.json` file inside EMPIShim folder.
74+
* Add the following name and value:
75+
- `EMPIFHIRSystemId` : FHIR Service Url
76+
- `EMPIProvider` : `EMPIShim.NextGateEMPIProvider`
77+
- `evconnect` : Connection-String of Event Hub you created earlier
78+
- `FS-CLIENT-ID` : EMPI Connector App Registration Client ID you create earlier
79+
- `FS-ISMSI` : true/false
80+
- `FS-RESOURCE` : `https://<Expose-API-App-Registration-Name>.<tenant-name>.onmicrosoft.com`
81+
- `FS-SECRET` : EMPI Connector App Registration Secret you created earlier
82+
- `FS-TENANT-NAME` : Tenant ID
83+
- `FS-URL` : FHIR Service URL
84+
- `NEXTGATE-URL` : EMPI Server URL
85+
- `NEXTGATE-USERNAME` : EMPI Server User's Username
86+
- `NEXTGATE-PASSWORD` : EMPI Server User's Password
87+
* Set EMPIShim project as StartUpProject
88+
* Run EMPIShim Application.
89+
90+
## Deploying the Sample on Azure:
91+
92+
In order to deploy the EMPI Sample on Azure portal you will need to clone the repository, create certain resources, app registartions manually and later publish the application from Visual Studio:
93+
94+
1. Create FHIR Service: Follow this [link](https://learn.microsoft.com/en-us/azure/healthcare-apis/fhir/deploy-azure-portal) to create FHIR Service.
95+
- Add `FHIR Data Contributor` role to the test user.
96+
1. Create Event Hub: Follow this [link](https://learn.microsoft.com/en-us/azure/event-hubs/event-hubs-create) to create Event Hub
97+
1. Create Events for FHIR Service: Follow this [link](https://learn.microsoft.com/en-us/azure/healthcare-apis/events/events-deploy-portal) to create Events for FHIR Service.
98+
1. Create App Registration for EMPI Connector App:
99+
- Go to `App Registrations`
100+
- Create a new application.
101+
- Click `Register` (ignore redirect URI).
102+
- Go to `Certificates & secrets` and add new secret.
103+
- Save the secret and client id of this application.
104+
- Assign `FHIR Data Contributor` role to this application on FHIR Service.
105+
1. Create App Registration to Expose API:
106+
- Go to `App Registrations`
107+
- Create a new application.
108+
- Click `Register` (ignore redirect URI).
109+
- Go to `Expose an API`, add Application ID URI
110+
- Add the following URI `https://<Expose-API-App-Registration-Name>.<tenant-name>.onmicrosoft.com` and click save.
111+
- Click on Add a scope
112+
- Enter the following values
113+
- Scope name = user_impersonation
114+
- Who can consent = Admins and users
115+
- Admin consent display name = Access Azure Healthcare APIs
116+
- Admin consent description = Allow the application to access Azure Healthcare APIs on behalf of the signed-in user.
117+
- state = enabled
118+
- click save.
119+
1. Enable CORS and Update FHIR Service Audience:
120+
- Naviagte to FHIR Serivce you created earlier
121+
- Go to `CORS`
122+
- Add `*` inside Origins and Headers
123+
- Select all the methods and
124+
- Go to `Authentication`
125+
- Replace the value for Audience with `https://<Expose-API-App-Registration-Name>.<tenant-name>.onmicrosoft.com`
126+
- click save.
127+
1. Steps to Publish EMPI Connector App:
128+
- Navigate to `empi-connector` folder in the cloned repo and open the `EMPIShim.sln` solution using Visual Studio.
129+
- Navigate to `EMPIUpdate.cs` file update the value `empievents` with the name of Event Hub you created earlier.
130+
- Follow this [link](https://learn.microsoft.com/en-us/azure/azure-functions/functions-develop-vs?pivots=isolated#publish-to-azure) to publish EMPI Connector App to Azure portal.
131+
1. Enable CORS and Setup configuration for EMPI Connector App:
132+
- Go to the EMPI Connector Function App on Azure Portal which you created earlier.
133+
- Go to `CORS`, add `*` inside allowed Origins and click save.
134+
- Go to `Environment variables` and add the following name and value:
135+
- `EMPIFHIRSystemId` : FHIR Service Url
136+
- `EMPIProvider` : `EMPIShim.NextGateEMPIProvider`
137+
- `evconnect` : Connection-String of Event Hub you created earlier
138+
- `FS-CLIENT-ID` : EMPI Connector App Registration Client ID you create earlier
139+
- `FS-ISMSI` : true/false
140+
- `FS-RESOURCE` : `https://<Expose-API-App-Registration-Name>.<tenant-name>.onmicrosoft.com`
141+
- `FS-SECRET` : EMPI Connector App Registration Secret you created earlier
142+
- `FS-TENANT-NAME` : Tenant ID
143+
- `FS-URL` : FHIR Service URL
144+
- `NEXTGATE-URL` : EMPI Server URL
145+
- `NEXTGATE-USERNAME` : EMPI Server User's Username
146+
- `NEXTGATE-PASSWORD` : EMPI Server User's Password
147+
1. Create App Registration for EMPI UI App:
148+
- Go to `App Registrations`
149+
- Create a new application
150+
- Select single-page application (SPA) and add the redirect URL `https://localhost:5004/authentication/login-callback`
151+
- Localhost is useful for debugging - we will add the Azure redirect URI after deploying EMPI UI App.
152+
- Go to `API Permissions` and add the `user_impersonation` scope from your Expose API application.
153+
- Click `Add a Permission` then `APIs my organization uses`.
154+
- Select the Expose API applicatin you created earlier.
155+
- Choose `Delegated permissions` then `user_impersonation`.
156+
- Finally, click `Add permission` to save.
157+
- Save the client id of this application.
158+
1. Setup configuration for EMPI UI App:
159+
- Navigate to `ui-app` folder in the cloned repo and open the `FhirBlaze.sln` solution using Visual Studio.
160+
- Open the `appsettings.json` file from FhirBlaze/wwwroot folder.
161+
- Replace the values for following:
162+
- [clientId] : Client ID of the EMPI UI App Registration
163+
- [scope] : `https://<Expose-API-App-Registration-Name>.<tenant-name>.onmicrosoft.com/user_impersonation`
164+
- [fhir-url] : FHIR Service URL
165+
- [empi-connector-url] : Function App's url which you published earlier
166+
- [empi-connector-api-key] : add the App keys present in the Function App which you published earlier.
167+
- Add `https://<Expose-API-App-Registration-Name>.<tenant-name>.onmicrosoft.com/user_impersonation` along with openid and offline_access inside the GraphScopes.
168+
1. Steps to Publish EMPI UI App:
169+
- Follow this [link](https://learn.microsoft.com/en-us/aspnet/core/blazor/host-and-deploy/webassembly?view=aspnetcore-8.0#deploy-from-visual-studio) to publish EMPI UI App.
170+
- Add the redirect URL `https://{{empi-ui-app-url}}/authentication/login-callback` within your EMPI UI App Registration.
171+
172+
## UI Application Walkthrough:
173+
174+
1. After launching UI application user will be redirected to below landing page, Click on login, select/enter username and password.
175+
176+
<img src="./docs/images/image1.png" height="380">
177+
178+
2. On successful login, user can see the username in top right corner.
179+
180+
<img src="./docs/images/image2.png" height="380">
181+
182+
3. Submit form to find Sample Patient.
183+
184+
<img src="./docs/images/image3.png" height="380">
185+
186+
4. If there is a match for above Patient then the Sample Patient Json box is populated with Patient Json.
187+
188+
<img src="./docs/images/image4.png" height="380" >
189+
190+
5. If there is no match for above Patient then the Sample Patient Json box is populated with No Patient Found.
191+
192+
<img src="./docs/images/image5.png" height="380">
193+
6. Click the Match Patient button to match Patient from the FHIR Service. If no matches are found then you can add that patient to FHIR Service.
194+
195+
<img src="./docs/images/image6.png" height="380">
196+
197+
7. Click Add New Patient button to add the Patient to FHIR Service. You can see the result inside the textbox below the Add New Patient button.
198+
199+
<img src="./docs/images/image7.png" height="380">
200+
201+
8. If there is a Match for Patient then the list of matched patient will be displayed below in tabular format.
202+
203+
<img src="./docs/images/image8.png" height="380">
204+
205+
9. Select the particular patient which you want to update or delete using the button in the Actions column.
206+
207+
<img src="./docs/images/image9.png" height="380">
208+
209+
10. Enter the value inside the Update Patient Json form. You can update patient's last name, phone number and birth date. You can see the update result inside the textbox by clicking the Update Patient button.
210+
211+
<img src="./docs/images/image10.png" height="380">
212+
213+
11. Select the patient using the button from Actions column to delete the patient. On clicking Delete Patient button you will get a pop-up confirmation for deletion.
214+
215+
<img src="./docs/images/image11.png" height="380">
216+
217+
12. You can find the delete result inside the textbox below Delete Patient button.
218+
219+
<img src="./docs/images/image12.png" height="380">
32.4 KB
Loading
29.8 KB
Loading
57.5 KB
Loading
46.4 KB
Loading
41.7 KB
Loading
36.5 KB
Loading
30.3 KB
Loading
30 KB
Loading
22.7 KB
Loading

0 commit comments

Comments
 (0)