From 83d6cdea08faef591a7dc4a7695c3d8eb7cbb92d Mon Sep 17 00:00:00 2001 From: Jason Kulatunga Date: Sun, 3 Mar 2024 14:52:14 -0800 Subject: [PATCH] correctly handle complex Observations (ComponentValueQuantity - used by Blood Pressure - Diastolic vs Systolic) --- .../ips/templates/includes/observation-unit.gohtml | 2 ++ .../ips/templates/includes/observation-value.gohtml | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/backend/pkg/utils/ips/templates/includes/observation-unit.gohtml b/backend/pkg/utils/ips/templates/includes/observation-unit.gohtml index d6dac18d..10a0de7c 100644 --- a/backend/pkg/utils/ips/templates/includes/observation-unit.gohtml +++ b/backend/pkg/utils/ips/templates/includes/observation-unit.gohtml @@ -6,4 +6,6 @@ {{.ValueDate | date "2006-01-02" }} {{else if not (empty (.ValueConcept | parseList)) }} {{.ValueConcept}} +{{else if not (empty (.ComponentValueQuantity | parseList)) }} + {{.ComponentValueQuantity | parseList | pluckList "unit" | join "," }} {{end}} diff --git a/backend/pkg/utils/ips/templates/includes/observation-value.gohtml b/backend/pkg/utils/ips/templates/includes/observation-value.gohtml index 409f62e9..c57d17bb 100644 --- a/backend/pkg/utils/ips/templates/includes/observation-value.gohtml +++ b/backend/pkg/utils/ips/templates/includes/observation-value.gohtml @@ -9,4 +9,15 @@ {{.entry.ValueDate | date "2006-01-02" }} {{else if not (empty (.entry.ValueConcept | parseList)) }} {{.entry.ValueConcept}} +{{else if not (empty (.entry.ComponentValueQuantity | parseList)) }} + {{$componentCodeText := $.entry.ComponentCode | parseList | pluckList "text" }} + {{$componentValueQuantity := $.entry.ComponentValueQuantity | parseList | pluckList "value" | roundList 2 }} + + {{range $index, $text := $componentCodeText }} + {{$text}} - {{index $componentValueQuantity $index}} + {{end}} + + {{if (get . "include_unit")}} + {{.ComponentValueQuantity | parseList | pluckList "unit" | join "," }} + {{end}} {{end}}