Exercise - Validate the data model

Completed

The Dataverse tables, columns, and relationships that represent a relational version of the ServiceRequest FHIR resource, including the expansion tables and multi-table lookups, are now part of the solution. You created New Entity and Attribute maps representing the ServiceRequest FHIR resource so you can ingest data using the Dataverse Healthcare APIs.

Next, you validate the updated data model and related transformation maps by sending sample FHIR resource bundles to the Dataverse Healthcare APIs.

In this exercise, you configure a model driven app to display the Service Request record and its expansion relations, configure Insomnia to connect to the Dataverse Healthcare APIs, and post FHIR bundles to the endpoint.

For details and examples on the Dataverse Healthcare APIs for FHIR bundle ingestion, see Overview of Dataverse healthcare APIs - Upsert bundle API and Use the Dataverse healthcare APIs on Microsoft Learn.

Prerequisites

You need to meet the following prerequisites:

  • Microsoft Cloud for Healthcare trial with the Data integration toolkit installed.

  • Sample data is deployed in your instance.

  • Access to the developer tools that allow you to call the REST API endpoints.

  • Access to the following sample FHIR Bundles.

    • ServiceRequest_One.json – contains a ServiceRequest FHIR resource and related resources like Patient, Practitioner, Location, Encounter, and Organization

    • ServiceRequest_Two.json – contains an additional ServiceRequest resource with references to the ones in ServiceRequest_One.json

    • ServiceRequest_Three.json – contains an additional ServiceRequest resource with references to the ones in ServiceRequest_One.json

  • System Administrator rights are granted for the user on a Microsoft Dataverse instance. For more information, see Microsoft Cloud for Healthcare training environment preparation.

Create a model driven app

To view the Service Request data, you need to configure the primary form and some associated views. Once you create the records using the Dataverse Healthcare APIs, you can view the list of records and open the Service Request main form to view the detailed column data and the related child records.

  1. Sign in to the Power Apps maker portal.

  2. Open the ServiceRequest solution.

  3. In the left navigation pane, select Apps. Select New > App > Model-driven app.

  4. In the New model-driven app window, enter the following details.

    Property Value
    Name Service Request Testing
    Description Testing data model and transformation maps
    Use components from a solution Checked
    Solution Service Request
    Site map Default site map
  5. Select Create.

  6. In the App designer Pages pane, under All other pages, select the Service Request views item horizontal ellipses.

  7. Select Add to navigation.

    Screenshot shows adding the new app to the navigation.

  8. Once the designer loads, select Save.

Modify the Service Request form

  1. Select the Service Request form item, and select the edit tool to edit the form.

    Screenshot shows how to edit the service request form.

  2. In the main Form editor, select the Component toolbar item, and from the left navigation, expand Layout, and select a new section from the list of available layouts.

    Screenshot shows how to select a new section from the list of available layouts.

  3. Change the Label property to Details and Name to tab_main_section_details.

  4. In the left navigation, select Table columns, and filter by Custom in the Search area.

    Screenshot shows how to filter by Custom in the Search area.

  5. In the new section, add the custom columns for Service Request. You can organize the columns as you prefer.

    Screenshot shows users can organize the columns as they prefer.

  6. Select Save and publish.

  7. In the main Form editor, select the Component toolbar item, and from the left navigation, expand Layout, and select a new tab from the list of available layouts.

  8. Change the Label property to Service Request Category and Name to tab_category.

  9. Select the default section and change the Label property to Main and Name to tab_category_section_main.

  10. Select the Component toolbar item, and from the left navigation, expand Grid, and select Subgrid.

  11. In the Select subgrid views panel, select Show related records.

  12. Select Service Request Categories from the Table list.

  13. Select the grid and change the Label property to Categories and the name to subgrid_category.

  14. Repeat the steps regarding subgrid tabs for the following expansion tables.

    • Service Request Replaces

    • Service Request Location Codes

    • Service Request Location References

    • Service Request Reason Codes

  15. Select Save and publish.

Modify the Service Request and expansion views

You can modify the expansion table views to make it easier to view related records on the parent Service Request form by adding columns to the default view.

  1. Open the ServiceRequest solution.

  2. In the left navigation, expand Tables, expand the Service Request Category table, and select Views.

  3. Select the view named Active Service Request Categories to edit.

  4. Add the following columns to the view:

    • Service Request

    • Category

  5. Select Save and Publish.

  6. Repeat these steps for the following expansion tables.

    Table View Columns
    Service Request Location Code Active Service Request Location Codes • Service Request
    • Location Code
    Service Request Location Reference Active Service Request Location References • Service Request
    • Location
    Service Request Reason Code Active Service Reason Codes • Service Request
    • Code
    Service Request Replaces Active Service Request Replaces • Service Request
    • Replaces
    Service Request Active Service Requests • Azure FHIR Id
    • Created On
    • Quantity Code
    • Quantity Value
    • Quantity Uri
  7. Navigate to the main overview are of the Service Request Solution, in the main.

    Screenshot shows the main overview of the Service Request Solution.

Configure Insomnia

In a previous exercise, you connected to the Dataverse SDK APIs to create multi-table lookups. The Dataverse Healthcare APIs can be accessed in a similar way. Because the authentication is the same, you can reuse this method when calling the Dataverse Healthcare APIs.

  1. Open the Insomnia tool.

  2. Select the HTTP request named MultiColumnLookups and right-click to open the context menu.

  3. Select Duplicate from the context menu.

    Screenshot shows the selection of Duplicate from the context menu.

  4. Name the new HTTP request POSTFHIRtoDataverse.

  5. Set the request Method to POST and the URL to {{url}}/api/data/v9.2/msind_UpsertBundle, replacing {{url}} with your Dataverse server URL.

  6. Select the Scripts tab.

  7. Add the following script to the Pre-request script section:

    const fhirBundle={};
    insomnia.environment.set('fhirbundlestring',
    JSON.stringify(JSON.stringify(fhirBundle)))
    
  8. Select the Body tab.

  9. Update the body to the following JSON:

    {
        "msind_BundleTag": "PatientDatatest",
        "msind_JSON": "{{fhirbundlestring}}"
    }
    

    Screenshot shows how to update the body of the JSON file.

Your Insomnia HTTP request should now be configured to post to the Dataverse Healthcare API endpoint for Upsert.

Post FHIR messages

To validate the schema and maps, you post FHIR bundles to the Dataverse Healthcare APIs. This means a ServiceRequest FHIR message and related messages for the references. The sample JSON files include ServiceRequest FHIR resources and related FHIR resources that are referenced by the ServiceRequest elements. ServiceRequest_One.json posts Patient and other resources, while posting.

You post these messages to the Upsert API endpoint and validate that they have been ingested into Dataverse correctly. Before posting the messages, you must first enable maps for the messages included in the sample bundles. This ensures that related FHIR resources included in the bundles are processed.

  1. Sign in to your Dataverse instance and open the Data Integration Toolkit application.

  2. In the left navigation, select Map Setup > Entity Maps.

  3. For each Entity map in the list, perform the following steps:

    1. Open the Entity map record to edit.

    2. Set Disable to No.

    3. Select Save & Close.

    Following are the Entity Maps that you must enable.

    Entity Name Azure FHIR Resource
    msemr_device Device
    msemr_devicecontactpoint Device
    msemr_devicedevicename Device
    msemr_deviceproperty Device
    msemr_devicesafety Device
    msemr_devicespecialization Device
    msemr_devicestatus Device
    msemr_deviceversion Device
    msemr_identifier Device
    msemr_encounter Encounter
    msemr_encounteraccount Encounter
    msemr_encounterclasshistory Encounter
    msemr_encounterdiagnosis Encounter
    msemr_encounterepisodeofcare Encounter
    msemr_encounterhospitalizationarrangement Encounter
    msemr_encounterhospitalizationcourtesy Encounter
    msemr_encounterhospitalizationdiet Encounter
    msemr_encounterlocation Encounter
    msemr_encounterreason Encounter
    msemr_group Group
    msemr_groupcharacteristic Group
    msemr_groupmember Group
    msemr_identifier Group
    msemr_daysofweek Location
    msemr_identifier Location
    msemr_location Location
    msemr_locationhoursofoperation Location
    msemr_locationtelecom Location
    msemr_locationtype Location
    account Organization
    contact Patient
    msemr_contactlink Patient
    msemr_medicalidentifier Patient
    contact Practitioner
    msemr_daysofweek PractitionerRole
    msemr_identifier PractitionerRole
    msemr_practitionerrole PractitionerRole
    msemr_practitionerroleavailabletime PractitionerRole
    msemr_practitionerrolecode PractitionerRole
    msemr_practitionerrolelocation PractitionerRole
    msemr_practitionerrolenotavailable PractitionerRole
    msemr_practitionerrolespecialty PractitionerRole
    msemr_practitionerroletelecom PractitionerRole
  4. Open the Insomnia tool.

  5. Select the HTTP request named POSTFHIRtoDataverse select the Scripts tab.

  6. In the Pre-request script, replace the value of the fhirBundle constant, currently set to {}, with the contents of ServiceRequest_One.json.

    Screenshot shows how to replace the value of the fhirBundle constant.

  7. Select Send.

  8. Once completed, you see the response from the UpsertBundle API call in the results window.

  9. Navigate to your Service Request Testing model driven app.

  10. In the main view, you should see new Service Request records.

    Screenshot shows the new Service Request records.

  11. Repeat these steps using the bundles found in ServiceRequest_Two.json and ServiceRequest_Three.json.

  12. You might create extra messages and test the extra maps.

Next Steps

You can take extra steps to validate maps by:

  • Updating the sample ServiceRequest messages.

  • Adding items to the expansion maps.

  • Changing Codeable Concept references.

  • Linking to new Encounter references.

This depends on the types of messages you expect to see in your environment.