diff --git a/.openpublishing.redirection.healthcare-apis.json b/.openpublishing.redirection.healthcare-apis.json index 933588d5aa2d5..1734f7f71ae83 100644 --- a/.openpublishing.redirection.healthcare-apis.json +++ b/.openpublishing.redirection.healthcare-apis.json @@ -542,6 +542,18 @@ "redirect_url": "/azure/healthcare-apis/iot/how-to-enable-diagnostic-settings", "redirect_document_id": false }, + { "source_path_from_root": "/articles/healthcare-apis/iot/how-to-use-collection-content-mappings.md", + "redirect_url": "/azure/healthcare-apis/iot/how-to-use-device-mappings", + "redirect_document_id": false + }, + { "source_path_from_root": "/articles/healthcare-apis/iot/how-to-use-jsonpath-content-mappings.md", + "redirect_url": "/azure/healthcare-apis/iot/how-to-use-device-mappings", + "redirect_document_id": false + }, + { "source_path_from_root": "/articles/healthcare-apis/iot/how-to-use-iot-central-json-content-mappings.md", + "redirect_url": "/azure/healthcare-apis/iot/how-to-use-iot-jsonpath-content-mappings", + "redirect_document_id": false + }, { "source_path_from_root": "/articles/healthcare-apis/events/events-display-metrics.md", "redirect_url": "/azure/healthcare-apis/events/events-use-metrics", "redirect_document_id": false @@ -549,6 +561,6 @@ { "source_path_from_root": "/articles/healthcare-apis/events/events-export-logs-metrics.md", "redirect_url": "/azure/healthcare-apis/events/events-enable-diagnostic-settings", "redirect_document_id": false - } + } ] } diff --git a/articles/healthcare-apis/iot/how-to-use-calculated-functions-mappings.md b/articles/healthcare-apis/iot/how-to-use-calculated-functions-mappings.md index fa0057a8c8346..7968156fcee8e 100644 --- a/articles/healthcare-apis/iot/how-to-use-calculated-functions-mappings.md +++ b/articles/healthcare-apis/iot/how-to-use-calculated-functions-mappings.md @@ -5,15 +5,12 @@ author: msjasteppe ms.service: healthcare-apis ms.subservice: fhir ms.topic: how-to -ms.date: 02/16/2022 +ms.date: 10/25/2022 ms.author: jasteppe --- # How to use CalculatedContentTemplate mappings -> [!TIP] -> Check out the [IoMT Connector Data Mapper](https://github.com/microsoft/iomt-fhir/tree/master/tools/data-mapper) tool for editing, testing, and troubleshooting MedTech service Device and FHIR destination mappings. Export mappings for uploading to MedTech service in the Azure portal or use with the [open-source version](https://github.com/microsoft/iomt-fhir) of MedTech service. - This article describes how to use CalculatedContentTemplate mappings with MedTech service Device mappings templates. ## CalculatedContentTemplate @@ -93,14 +90,14 @@ When specifying the language to use for the expression, the below values are val | JSONPath | **JsonPath** | | JmesPath | **JmesPath** | ->[!TIP] ->For more information on JSONPath, see [JSONPath](https://goessner.net/articles/JsonPath/). The [CalculatedContentTemplate](#calculatedcontenttemplate) uses the [JSON .NET implementation](https://www.newtonsoft.com/json/help/html/QueryJsonSelectTokenJsonPath.htm) for resolving JSONPath expressions. +>[ !TIP] +> For more information on JSONPath, see [JSONPath](https://goessner.net/articles/JsonPath/). The [CalculatedContentTemplate](#calculatedcontenttemplate) uses the [JSON .NET implementation](https://www.newtonsoft.com/json/help/html/QueryJsonSelectTokenJsonPath.htm) for resolving JSONPath expressions. > ->For more information on JmesPath, see [JmesPath](https://jmespath.org/specification.html). The [CalculatedContentTemplate](#calculatedcontenttemplate) uses the [JmesPath .NET implementation](https://github.com/jdevillard/JmesPath.Net) for resolving JmesPath expressions. +> For more information on JmesPath, see [JmesPath](https://jmespath.org/specification.html). The [CalculatedContentTemplate](#calculatedcontenttemplate) uses the [JmesPath .NET implementation](https://github.com/jdevillard/JmesPath.Net) for resolving JmesPath expressions. ### Custom Functions -A set of MedTech service Custom Functions is also available. These Custom Functions are outside of the functions provided as part of the JmesPath specification. For more information on Custom Functions, see [MedTech service Custom Functions](./how-to-use-custom-functions.md). +A set of MedTech service Custom Functions is also available. These Custom Functions are outside of the functions provided as part of the JmesPath specification. For more information on Custom Functions, see [MedTech service Custom Functions](how-to-use-custom-functions.md). ### Matched Token @@ -541,13 +538,13 @@ In the below example, height data arrives in either inches or meters. We want al ``` > [!TIP] -> See MedTech service [troubleshooting guide](./iot-troubleshoot-guide.md) for assistance fixing common errors and issues. +> See the MedTech service article [Troubleshoot MedTech service Device and FHIR destination mappings](iot-troubleshoot-mappings.md) for assistance fixing common errors and issues related to MedTech service mappings. ## Next steps In this article, you learned how to use Device mappings. To learn how to use FHIR destination mappings, see ->[!div class="nextstepaction"] ->[How to use FHIR destination mappings](how-to-use-fhir-mappings.md) +> [!div class="nextstepaction"] +> [How to use FHIR destination mappings](how-to-use-fhir-mappings.md) -(FHIR®) is a registered trademark of [HL7](https://hl7.org/fhir/) and is used with the permission of HL7. +(FHIR®) is a registered trademark of Health Level Seven International, registered in the U.S. Trademark Office and is used with their permission. diff --git a/articles/healthcare-apis/iot/how-to-use-collection-content-mappings.md b/articles/healthcare-apis/iot/how-to-use-collection-content-mappings.md deleted file mode 100644 index 4599821cecd95..0000000000000 --- a/articles/healthcare-apis/iot/how-to-use-collection-content-mappings.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -title: CollectionContentTemplate mappings in MedTech service Device mappings - Azure Health Data Services -description: This article describes how to use CollectionContentTemplate mappings with MedTech service Device mappings. -author: msjasteppe -ms.service: healthcare-apis -ms.subservice: fhir -ms.topic: how-to -ms.date: 03/22/2022 -ms.author: jasteppe ---- - -# How to use CollectionContentTemplate mappings - -> [!TIP] -> Check out the [IoMT Connector Data Mapper](https://github.com/microsoft/iomt-fhir/tree/master/tools/data-mapper) tool for editing, testing, and troubleshooting MedTech service Device and FHIR destination mappings. Export mappings for uploading to the MedTech service in the Azure portal or use with the [open-source version](https://github.com/microsoft/iomt-fhir) of the MedTech service. - -This article describes how to use CollectionContentTemplate mappings with the MedTech service Device mappings templates. - -## CollectionContentTemplate - -The CollectionContentTemplate may be used to represent a list of templates that will be used during normalization. - -### Example - -```json -{ - "templateType": "CollectionContent", - "template": [ - { - "templateType": "CalculatedContent", - "template": { - "typeName": "heartrate", - "typeMatchExpression": "$..[?(@heartRate)]", - "deviceIdExpression": "$.matchedToken.deviceId", - "timestampExpression": "$.matchedToken.endDate", - "values": [ - { - "required": "true", - "valueExpression": "$.matchedToken.heartRate", - "valueName": "hr" - } - ] - } - }, - { - "templateType": "CalculatedContent", - "template": { - "typeName": "stepcount", - "typeMatchExpression": "$..[?(@steps)]", - "deviceIdExpression": "$.matchedToken.deviceId", - "timestampExpression": "$.matchedToken.endDate", - "values": [ - { - "required": "true", - "valueExpression": "$.matchedToken.steps", - "valueName": "steps" - } - ] - } - } - ] -} -``` -> [!TIP] -> See the MedTech service [troubleshooting guide](./iot-troubleshoot-guide.md) for assistance fixing common errors and issues. - -## Next steps - -In this article, you learned how to use Device mappings. To learn how to use FHIR destination mappings, see - ->[!div class="nextstepaction"] ->[How to use FHIR destination mappings](how-to-use-fhir-mappings.md) - -(FHIR®) is a registered trademark of [HL7](https://hl7.org/fhir/) and is used with the permission of HL7. diff --git a/articles/healthcare-apis/iot/how-to-use-custom-functions.md b/articles/healthcare-apis/iot/how-to-use-custom-functions.md index 753c8e4e82f9d..0f6aec2604c5f 100644 --- a/articles/healthcare-apis/iot/how-to-use-custom-functions.md +++ b/articles/healthcare-apis/iot/how-to-use-custom-functions.md @@ -182,13 +182,13 @@ Examples: | {"unix": 0} | fromUnixTimestampMs(unix) | "1970-01-01T00:00:00+0" | > [!TIP] -> See the MedTech service [troubleshooting guide](./iot-troubleshoot-guide.md) for assistance fixing common errors and issues. +> See the MedTech service article [Troubleshoot MedTech service Device and FHIR destination mappings](iot-troubleshoot-mappings.md) for assistance fixing common errors and issues related to MedTech service mappings. ## Next steps In this article, you learned how to use the MedTech service custom functions. To learn how to use custom functions with the MedTech service device mapping, see ->[!div class="nextstepaction"] ->[How to use device mappings](how-to-use-device-mappings.md) +> [!div class="nextstepaction"] +> [How to use device mappings](how-to-use-device-mappings.md) FHIR® is a registered trademark of Health Level Seven International, registered in the U.S. Trademark Office and is used with their permission. diff --git a/articles/healthcare-apis/iot/how-to-use-device-mappings.md b/articles/healthcare-apis/iot/how-to-use-device-mappings.md index 6ebe2cecddab1..7705df5039732 100644 --- a/articles/healthcare-apis/iot/how-to-use-device-mappings.md +++ b/articles/healthcare-apis/iot/how-to-use-device-mappings.md @@ -5,7 +5,7 @@ author: msjasteppe ms.service: healthcare-apis ms.subservice: fhir ms.topic: how-to -ms.date: 09/27/2022 +ms.date: 10/25/2022 ms.author: jasteppe --- @@ -21,13 +21,7 @@ The second type, **Fast Healthcare Interoperability Resources (FHIR®) desti > Device and FHIR destination mappings are stored in an underlying blob storage and loaded from blob per compute execution. Once updated they should take effect immediately. The two types of mappings are composed into a JSON document based on their type. These JSON documents are then added to your MedTech service through the Azure portal. The device mapping is added through the **Device mapping** page and the FHIR destination mapping through the **Destination** page. - -> [!TIP] -> Check out the [IoMT Connector Data Mapper](https://github.com/microsoft/iomt-fhir/tree/master/tools/data-mapper) tool for editing, testing, and troubleshooting the MedTech service device and FHIR destination mappings; and export mappings for uploading to the MedTech service in the Azure portal or use with the [open-source version](https://github.com/microsoft/iomt-fhir) of the MedTech service. - -> [!IMPORTANT] -> Links to OSS projects on the GitHub website are for informational purposes only and do not constitute an endorsement or guarantee of any kind. You should review the information and licensing terms on the OSS projects on GitHub before using it. - + ## Device mappings overview Device mappings provide functionality to extract device message content into a common format for further evaluation. Each device message received is evaluated against all device mapping templates. @@ -48,12 +42,10 @@ The normalized data model has a few required properties that must be found and e > [!IMPORTANT] > The full normalized model is defined by the [IMeasurement](https://github.com/microsoft/iomt-fhir/blob/master/src/lib/Microsoft.Health.Fhir.Ingest.Schema/IMeasurement.cs) interface. -Below are conceptual examples of what happens during normalization and transformation process within the MedTech service: +Below is an example of what happens during normalization and transformation process within the MedTech service. For the purposes of the device mapping, we will be focusing on the **Normalized data** process: :::image type="content" source="media/iot-data-transformation/iot-data-normalization-high-level.png" alt-text="Diagram of IoT data normalization flow example zoomed out." lightbox="media/iot-data-transformation/iot-data-normalization-high-level.png"::: -:::image type="content" source="media/concepts-iot-mapping-templates/normalization-example.png" alt-text="Diagram of IoT data normalization flow example zoomed in." lightbox="media/concepts-iot-mapping-templates/normalization-example.png"::: - The content payload itself is an Azure Event Hubs message, which is composed of three parts: Body, Properties, and SystemProperties. The `Body` is a byte array representing an UTF-8 encoded string. During template evaluation, the byte array is automatically converted into the string value. `Properties` is a key value collection for use by the message creator. `SystemProperties` is also a key value collection reserved by the Azure Event Hubs framework with entries automatically populated by it. ```json @@ -73,32 +65,131 @@ The content payload itself is an Azure Event Hubs message, which is composed of } } ``` +## CollectionContentTemplate + +The CollectionContentTemplate is the **default** template type used by the MedTech service device mapping and may be used to represent a list of templates that will be used during normalization. + +### Example + +```json +{ + "templateType": "CollectionContent", + "template": [ + { + "templateType": "CalculatedContent", + "template": { + "typeName": "heartrate", + "typeMatchExpression": "$..[?(@heartRate)]", + "deviceIdExpression": "$.matchedToken.deviceId", + "timestampExpression": "$.matchedToken.endDate", + "values": [ + { + "required": "true", + "valueExpression": "$.matchedToken.heartRate", + "valueName": "hr" + } + ] + } + }, + { + "templateType": "CalculatedContent", + "template": { + "typeName": "stepcount", + "typeMatchExpression": "$..[?(@steps)]", + "deviceIdExpression": "$.matchedToken.deviceId", + "timestampExpression": "$.matchedToken.endDate", + "values": [ + { + "required": "true", + "valueExpression": "$.matchedToken.steps", + "valueName": "steps" + } + ] + } + } + ] +} +``` + ## Mapping with JSONPath -The five device content-mapping types supported today rely on JSONPath to both match the required mapping and extracted values. More information on JSONPath can be found [here](https://goessner.net/articles/JsonPath/). All five template types use the [JSON .NET implementation](https://www.newtonsoft.com/json/help/html/QueryJsonSelectTokenJsonPath.htm) for resolving JSONPath expressions. +The device mapping content types supported by the MedTech service rely on JSONPath to both match the required mapping and extracted values. More information on JSONPath can be found [here](https://goessner.net/articles/JsonPath/). All template types use the [JSON .NET implementation](https://www.newtonsoft.com/json/help/html/QueryJsonSelectTokenJsonPath.htm) for resolving JSONPath expressions. -You can define one or more templates within the MedTech service device mapping. Each event hub device message received is evaluated against all device mapping templates. +The below example is from a device message received by the MedTech service from an Azure Event Hubs event hub: -A single inbound device message can be separated into multiple outbound messages that are later mapped to different observations in the FHIR service. +**Heart rate** -Various template types exist and may be used when building the MedTech service device mapping. +*Device message from the Azure Event Hubs event hub* -|Name | Description | -|-------------------------------------------------------------------------|-------------------------------------------------------------------------------| -|[JsonPathContentTemplate](./how-to-use-jsonpath-content-mappings.md) |A template that supports writing expressions using JsonPath -|[CollectionContentTemplate](./how-to-use-collection-content-mappings.md) |A template used to represent a list of templates that will be used during the normalization. | -|[CalculatedContentTemplate](./how-to-use-calculated-functions-mappings.md)|A template that supports writing expressions using one of several expression languages. Supports data transformation via the use of JmesPath functions.| -|[IotJsonPathContentTemplate](./how-to-use-iot-jsonpath-content-mappings.md)|A template that supports messages sent from Azure Iot Hub or the Legacy Export Data feature of Azure Iot Central.| -|[IotCentralJsonPathContentTemplate](./how-to-use-iot-central-json-content-mappings.md)|A template that supports messages sent via the Export Data feature of Azure Iot Central.| +```json +{ + "Body": { + "heartRate": "78", + "endDate": "2021-02-01T22:46:01.8750000Z", + "deviceId": "device123" + }, + "Properties": {}, + "SystemProperties": {} +} +``` + +*MedTech service device mapping template* +```json +{ + "templateType": "CollectionContent", + "template": [ + { + "templateType": "JsonPathContent", + "template": { + "typeName": "heartrate", + "typeMatchExpression": "$..[?(@heartRate)]", + "deviceIdExpression": "$.deviceId", + "timestampExpression": "$.endDate", + "values": [ + { + "required": "true", + "valueExpression": "$.heartRate", + "valueName": "hr" + } + ] + } + } + ] +} +``` +JSONPath allows matching on and extracting values from a device message. + +|Property|Description|Example| +|--------|-----------|-------| +|TypeName|The type to associate with measurements that match the template|`heartrate`| +|TypeMatchExpression|The JSONPath expression that is evaluated against the EventData payload. If a matching JToken is found, the template is considered a match. All later expressions are evaluated against the extracted JToken matched here.|`$..[?(@heartRate)]`| +|DeviceIdExpression|The JSONPath expression to extract the device identifier.|`$.matchedToken.deviceId`| +|TimestampExpression|The JSONPath expression to extract the timestamp value for the measurement's OccurrenceTimeUtc.|`$.matchedToken.endDate`| +|PatientIdExpression|*Required* when IdentityResolution is in **Create** mode and *Optional* when IdentityResolution is in **Lookup** mode. The expression to extract the patient identifier.|`$.matchedToken.patientId`| +|EncounterIdExpression|*Optional*: The expression to extract the encounter identifier.|`$.matchedToken.encounterId`| +|CorrelationIdExpression|*Optional*: The expression to extract the correlation identifier. This output can be used to group values into a single observation in the FHIR destination mappings.|`$.matchedToken.correlationId`| +|Values[].ValueName|The name to associate with the value extracted by the next expression. Used to bind the wanted value/component in the FHIR destination mapping template.|`hr`| +|Values[].ValueExpression|The JSONPath expression to extract the wanted value.|`$.matchedToken.heartRate`| +|Values[].Required|Will require the value to be present in the payload. If not found, a measurement won't be generated and an InvalidOperationException will be created.|`true`| + +## Additional template types + +You can define one or more templates within the MedTech service device mapping. Each device message received is evaluated against all device mapping templates. + +|Template Type|Description| +|-------------|-----------| +|[CalculatedContentTemplate](how-to-use-calculated-functions-mappings.md)|A template that supports writing expressions using one of several expression languages. Supports data transformation via the use of JmesPath functions.| +|[IotJsonPathContentTemplate](how-to-use-iot-jsonpath-content-mappings.md)|A template that supports messages sent from Azure Iot Hub or the Legacy Export Data feature of Azure Iot Central. + > [!TIP] -> See the MedTech service [troubleshooting guide](./iot-troubleshoot-guide.md) for assistance fixing common errors and issues. +> See the MedTech service article [Troubleshoot MedTech service Device and FHIR destination mappings](iot-troubleshoot-mappings.md) for assistance fixing common errors and issues related to MedTech service mappings. ## Next steps In this article, you learned how to use Device mappings. To learn how to use FHIR destination mappings, see ->[!div class="nextstepaction"] ->[How to use the FHIR destination mapping](how-to-use-fhir-mappings.md) +> [!div class="nextstepaction"] +> [How to use the FHIR destination mapping](how-to-use-fhir-mappings.md) -FHIR® is a registered trademark of Health Level Seven International, registered in the U.S. Trademark Office and is used with their permission. +FHIR® is a registered trademark of Health Level Seven International, registered in the U.S. Trademark Office and is used with their permission. \ No newline at end of file diff --git a/articles/healthcare-apis/iot/how-to-use-iot-central-json-content-mappings.md b/articles/healthcare-apis/iot/how-to-use-iot-central-json-content-mappings.md deleted file mode 100644 index b442a87083653..0000000000000 --- a/articles/healthcare-apis/iot/how-to-use-iot-central-json-content-mappings.md +++ /dev/null @@ -1,147 +0,0 @@ ---- -title: IotCentralJsonPathContentTemplate mappings in MedTech service device mappings - Azure Health Data Services -description: This article describes how IotCentralJsonPathContent mappings with MedTech service device mappings templates. -author: msjasteppe -ms.service: healthcare-apis -ms.subservice: fhir -ms.topic: how-to -ms.date: 09/16/2022 -ms.author: jasteppe ---- - -# How to use IotCentralJsonPathContentTemplate mappings - -> [!TIP] -> Check out the [IoMT Connector Data Mapper](https://github.com/microsoft/iomt-fhir/tree/master/tools/data-mapper) tool for editing, testing, and troubleshooting the MedTech service device and FHIR destination mappings. Export mappings for uploading to MedTech service in the Azure portal or use with the [open-source version](https://github.com/microsoft/iomt-fhir) of the MedTech service. - -This article describes how to use IoTCentralJsonPathContentTemplate mappings with the MedTech service device mappings. - -## IotCentralJsonPathContentTemplate - -The IotCentralJsonPathContentTemplate also doesn't require DeviceIdExpression and TimestampExpression. It gets used when the messages being evaluated are sent through the [Export Data](../../iot-central/core/howto-export-data.md) feature of [Azure IoT Central](../../iot-central/core/overview-iot-central.md). - -If you're using Azure IoT Central's Data Export feature and custom properties in the message body for the device identity or measurement timestamp, you can still use the JsonPathContentTemplate. - -> [!NOTE] -> When using `IotCentralJsonPathContentTemplate`, `TypeMatchExpression` should resolve to the entire message as a JToken. For more information, see the following examples: - -### Examples - -**Heart rate** - -*Message* - -```json -{ - "applicationId": "1dffa667-9bee-4f16-b243-25ad4151475e", - "messageSource": "telemetry", - "deviceId": "1vzb5ghlsg1", - "schema": "default@v1", - "templateId": "urn:qugj6vbw5:___qbj_27r", - "enqueuedTime": "2020-08-05T22:26:55.455Z", - "telemetry": { - "Activity": "running", - "BloodPressure": { - "Diastolic": 7, - "Systolic": 71 - }, - "BodyTemperature": 98.73447010562934, - "HeartRate": 88, - "HeartRateVariability": 17, - "RespiratoryRate": 13 - }, - "enrichments": { - "userSpecifiedKey": "sampleValue" - }, - "messageProperties": { - "messageProp": "value" - } -} -``` - -*Template* - -```json -{ - "templateType": "IotCentralJsonPathContent", - "template": { - "typeName": "heartrate", - "typeMatchExpression": "$..[?(@telemetry.HeartRate)]", - "values": [ - { - "required": "true", - "valueExpression": "$.telemetry.HeartRate", - "valueName": "hr" - } - ] - } -} -``` - -**Blood pressure** - -*Message* - -```json -{ - "applicationId": "1dffa667-9bee-4f16-b243-25ad4151475e", - "messageSource": "telemetry", - "deviceId": "1vzb5ghlsg1", - "schema": "default@v1", - "templateId": "urn:qugj6vbw5:___qbj_27r", - "enqueuedTime": "2020-08-05T22:26:55.455Z", - "telemetry": { - "Activity": "running", - "BloodPressure": { - "Diastolic": 7, - "Systolic": 71 - }, - "BodyTemperature": 98.73447010562934, - "HeartRate": 88, - "HeartRateVariability": 17, - "RespiratoryRate": 13 - }, - "enrichments": { - "userSpecifiedKey": "sampleValue" - }, - "messageProperties": { - "messageProp": "value" - } -} -``` - -*Template* - -```json -{ - "templateType": "IotCentralJsonPathContent", - "template": { - "typeName": "bloodPressure", - "typeMatchExpression": "$..[?(@telemetry.BloodPressure.Diastolic && @telemetry.BloodPressure.Systolic)]", - "values": [ - { - "required": "true", - "valueExpression": "$.telemetry.BloodPressure.Diastolic", - "valueName": "bp_diastolic" - }, - { - "required": "true", - "valueExpression": "$.telemetry.BloodPressure.Systolic", - "valueName": "bp_systolic" - } - ] - } -} -``` - -> [!TIP] -> See the MedTech service [troubleshooting guide](./iot-troubleshoot-guide.md) for assistance fixing common errors and issues. - -## Next steps - -In this article, you learned how to use IotCentralJsonPathContentTemplate with your MedTech service device mappings. To learn how to use FHIR destination mappings, see - ->[!div class="nextstepaction"] ->[How to use FHIR destination mappings](how-to-use-fhir-mappings.md) - -FHIR® is a registered trademark of Health Level Seven International, registered in the U.S. Trademark Office and is used with their permission. diff --git a/articles/healthcare-apis/iot/how-to-use-iot-jsonpath-content-mappings.md b/articles/healthcare-apis/iot/how-to-use-iot-jsonpath-content-mappings.md index 08e17a88ef8c3..f075334d9ad85 100644 --- a/articles/healthcare-apis/iot/how-to-use-iot-jsonpath-content-mappings.md +++ b/articles/healthcare-apis/iot/how-to-use-iot-jsonpath-content-mappings.md @@ -5,7 +5,7 @@ author: msjasteppe ms.service: healthcare-apis ms.subservice: fhir ms.topic: how-to -ms.date: 10/03/2022 +ms.date: 10/25/2022 ms.author: jasteppe --- @@ -21,8 +21,8 @@ The assumption, when using this template, is the messages being evaluated were s When you're using these SDKs, the device identity and the timestamp of the message are known. ->[!IMPORTANT] ->Make sure that you're using a device identifier from Azure Iot Hub or Azure IoT Central that is registered as an identifier for a device resource on the destination Fast Healthcare Interoperability Resource (FHIR®) service. +> [!IMPORTANT] +> Make sure that you're using a device identifier from Azure Iot Hub or Azure IoT Central that is registered as an identifier for a device resource on the destination Fast Healthcare Interoperability Resource (FHIR®) service. If you're using Azure IoT Hub Device SDKs, you can still use the JsonPathContentTemplate, assuming that you're using custom properties in the message body for the device identity or measurement timestamp. @@ -265,13 +265,13 @@ With each of these examples, you're provided with: ``` > [!TIP] -> See the MedTech service [troubleshooting guide](./iot-troubleshoot-guide.md) for assistance fixing common errors and issues. +> See the MedTech service article [Troubleshoot MedTech service Device and FHIR destination mappings](iot-troubleshoot-mappings.md) for assistance fixing common errors and issues related to MedTech service mappings. ## Next steps In this article, you learned how to use IotJsonPathContentTemplate mappings with the MedTech service device mapping. To learn how to use MedTech service FHIR destination mapping, see ->[!div class="nextstepaction"] ->[How to use the FHIR destination mapping](how-to-use-fhir-mappings.md) +> [!div class="nextstepaction"] +> [How to use the FHIR destination mapping](how-to-use-fhir-mappings.md) FHIR® is a registered trademark of Health Level Seven International, registered in the U.S. Trademark Office and is used with their permission. \ No newline at end of file diff --git a/articles/healthcare-apis/iot/how-to-use-jsonpath-content-mappings.md b/articles/healthcare-apis/iot/how-to-use-jsonpath-content-mappings.md deleted file mode 100644 index ce0aa6f61e9e5..0000000000000 --- a/articles/healthcare-apis/iot/how-to-use-jsonpath-content-mappings.md +++ /dev/null @@ -1,230 +0,0 @@ ---- -title: JsonPathContentTemplate mappings in MedTech service Device mappings - Azure Health Data Services -description: This article describes how to use JsonPathContentTemplate mappings with the MedTech service Device mappings templates. -author: msjasteppe -ms.service: healthcare-apis -ms.subservice: fhir -ms.topic: how-to -ms.date: 02/16/2022 -ms.author: jasteppe ---- - -# How to use JsonPathContentTemplate mappings - -> [!TIP] -> Check out the [IoMT Connector Data Mapper](https://github.com/microsoft/iomt-fhir/tree/master/tools/data-mapper) tool for editing, testing, and troubleshooting the MedTech service Device and FHIR destination mappings. Export mappings for uploading to the MedTech service in the Azure portal or use with the [open-source version](https://github.com/microsoft/iomt-fhir) of the MedTech service. - -This article describes how to use JsonPathContentTemplate mappings with the MedTech service Device mappings templates. - -## JsonPathContentTemplate - -The JsonPathContentTemplate allows matching on and extracting values from an Azure Event Hub message using JSONPath. - -|Property|Description|Example| -|--------|-----------|-------| -|TypeName|The type to associate with measurements that match the template|`heartrate`| -|TypeMatchExpression|The JSONPath expression that is evaluated against the EventData payload. If a matching JToken is found, the template is considered a match. All later expressions are evaluated against the extracted JToken matched here.|`$..[?(@heartRate)]`| -|TimestampExpression|The JSONPath expression to extract the timestamp value for the measurement's OccurrenceTimeUtc.|`$.matchedToken.endDate`| -|DeviceIdExpression|The JSONPath expression to extract the device identifier.|`$.matchedToken.deviceId`| -|PatientIdExpression|*Required* when IdentityResolution is in **Create** mode and *Optional* when IdentityResolution is in **Lookup** mode. The expression to extract the patient identifier.|`$.matchedToken.patientId`| -|EncounterIdExpression|*Optional*: The expression to extract the encounter identifier.|`$.matchedToken.encounterId`| -|CorrelationIdExpression|*Optional*: The expression to extract the correlation identifier. This output can be used to group values into a single observation in the FHIR destination mappings.|`$.matchedToken.correlationId`| -|Values[].ValueName|The name to associate with the value extracted by the next expression. Used to bind the wanted value/component in the FHIR destination mapping template.|`hr`| -|Values[].ValueExpression|The JSONPath expression to extract the wanted value.|`$.matchedToken.heartRate`| -|Values[].Required|Will require the value to be present in the payload. If not found, a measurement won't be generated and an InvalidOperationException will be created.|`true`| - -### Examples - -**Heart rate** - -*Message* - -```json -{ - "Body": { - "heartRate": "78", - "endDate": "2021-02-01T22:46:01.8750000Z", - "deviceId": "device123" - }, - "Properties": {}, - "SystemProperties": {} -} -``` - -*Template* - -```json -{ - "templateType": "JsonPathContent", - "template": { - "typeName": "heartrate", - "typeMatchExpression": "$..[?(@heartRate)]", - "deviceIdExpression": "$.deviceId", - "timestampExpression": "$.endDate", - "values": [ - { - "required": "true", - "valueExpression": "$.heartRate", - "valueName": "hr" - } - ] - } -} -``` -**Blood pressure** - -*Message* - -```json -{ - "Body": { - "systolic": "123", - "diastolic" : "87", - "endDate": "2021-02-01T22:46:01.8750000Z", - "deviceId": "device123" - }, - "Properties": {}, - "SystemProperties": {} -} -``` - -*Template* - -```json -{ - "typeName": "bloodpressure", - "typeMatchExpression": "$..[?(@systolic && @diastolic)]", - "deviceIdExpression": "$.deviceId", - "timestampExpression": "$.endDate", - "values": [ - { - "required": "true", - "valueExpression": "$.systolic", - "valueName": "systolic" - }, - { - "required": "true", - "valueExpression": "$.diastolic", - "valueName": "diastolic" - } - ] -} -``` -**Project multiple measurements from single message** - -*Message* - -```json -{ - "Body": { - "heartRate": "78", - "steps": "2", - "endDate": "2021-02-01T22:46:01.8750000Z", - "deviceId": "device123" - }, - "Properties": {}, - "SystemProperties": {} -} -``` - -*Template 1* - -```json -{ - "templateType": "JsonPathContent", - "template": { - "typeName": "heartrate", - "typeMatchExpression": "$..[?(@heartRate)]", - "deviceIdExpression": "$.deviceId", - "timestampExpression": "$.endDate", - "values": [ - { - "required": "true", - "valueExpression": "$.heartRate", - "valueName": "hr" - } - ] - } -} -``` - -*Template 2* - -```json -{ - "templateType": "JsonPathContent", - "template": { - "typeName": "stepcount", - "typeMatchExpression": "$..[?(@steps)]", - "deviceIdExpression": "$.deviceId", - "timestampExpression": "$.endDate", - "values": [ - { - "required": "true", - "valueExpression": "$.steps", - "valueName": "steps" - } - ] - } -} -``` - -**Project multiple measurements from array in message** - -*Message* - -```json -{ - "Body": [ - { - "heartRate": "78", - "endDate": "2021-02-01T22:46:01.8750000Z", - "deviceId": "device123" - }, - { - "heartRate": "81", - "endDate": "2021-02-01T23:46:01.8750000Z", - "deviceId": "device123" - }, - { - "heartRate": "72", - "endDate": "2021-02-01T24:46:01.8750000Z", - "deviceId": "device123" - } - ], - "Properties": {}, - "SystemProperties": {} -} -``` -*Template* - -```json -{ - "templateType": "JsonPathContent", - "template": { - "typeName": "heartrate", - "typeMatchExpression": "$..[?(@heartRate)]", - "deviceIdExpression": "$.deviceId", - "timestampExpression": "$.endDate", - "values": [ - { - "required": "true", - "valueExpression": "$.heartRate", - "valueName": "hr" - } - ] - } -} -``` - -> [!TIP] -> See the MedTech service [troubleshooting guide](./iot-troubleshoot-guide.md) for assistance fixing common errors and issues. - -## Next steps - -In this article, you learned how to use Device mappings. To learn how to use FHIR destination mappings, see - ->[!div class="nextstepaction"] ->[How to use FHIR destination mappings](how-to-use-fhir-mappings.md) - -(FHIR®) is a registered trademark of [HL7](https://hl7.org/fhir/) and is used with the permission of HL7. diff --git a/articles/healthcare-apis/iot/toc.yml b/articles/healthcare-apis/iot/toc.yml index 7046a10a36a10..00e492d1e74a5 100644 --- a/articles/healthcare-apis/iot/toc.yml +++ b/articles/healthcare-apis/iot/toc.yml @@ -39,20 +39,13 @@ items: - name: Device expanded: false items: - - name: Device mappings + - name: Device mappings overview href: how-to-use-device-mappings.md - - name: JsonPathContentTemplate mappings - href: how-to-use-jsonpath-content-mappings.md - name: Calculated Functions mappings href: how-to-use-calculated-functions-mappings.md - - name: CollectionContentTemplate mappings - href: how-to-use-collection-content-mappings.md - - name: Custom Functions mappings - href: how-to-use-custom-functions.md - name: IotJsonPathContentTemplate mappings - href: how-to-use-iot-jsonpath-content-mappings.md - - name: IotCentralJsonContentTemplate mappings - href: how-to-use-iot-central-json-content-mappings.md + - name: Custom Functions + href: how-to-use-custom-functions.md - name: Destination expanded: false items: @@ -90,8 +83,8 @@ items: - name: Resources expanded: false items: - - name: FAQs - MedTech service - href: iot-connector-faqs.md - - name: Open-source projects - href: iot-git-projects.md + - name: FAQs - MedTech service + href: iot-connector-faqs.md + - name: Open-source projects + href: iot-git-projects.md \ No newline at end of file