...
In this example, we’re going to track the distribution of messages by MSH-4 (Sending Facility) and create both pie and line charts. Let’s assume the following channel, which receives messages over a network.
We want our device to track the value from MSH-4 (sending facility). To do this, add a new line item by clicking the Add Metric
button:
...
Next, double-click in the Name column and enter SendingFacility
. This is the label used in Prometheus/Grafana. Next, enter the HL7 path into the Expression column.
...
Ensure the HL7v2 metric is enabled, and run some messages through the test channel.
...
You should be able to visit Grafana and create the following visualizations:
...
The line chart shows the rate messages are received (by Sending Facility / MSH-4), and the pie chart shows the proportion of messages from each Sending Facility.
Now let’s add another metric based on the contents of OBR
segments. For this sample, add another metric with the following settings:
...
Duplicate the visualizations done previously, and update the Name
to Diagnostic
. Running some sample messages through produces the following visualizations:
...
We now have charts for both Sending Facility (MSH-4)
and Diagnostic Type (OBR-24.1)
. However, what if we want to create a visualization which shows the Diagnostic Type
by Sending Facility? For example, show a visualization for Diagnostic Type based on Sending Facility. To accomplish this, we need to update our configuration and change the Type
column for the Sending Facility
row.
...
Info |
---|
Metric
|
In Grafana, you can now create queries which filter based on any additional labels you’ve defined:
...
You could also leverage Grafana’s variables feature to create a drop-down list which let’s users choose which Sending Facility
to view:
...