From 9c2e83ceb9ebaf4ab0823e9a178ddf60e5e7e528 Mon Sep 17 00:00:00 2001 From: Matthew Storer Date: Fri, 8 Mar 2024 11:57:05 -0800 Subject: [PATCH] fix to ensure that the home-setting extension is added to resources *before* getting bundled, for #182 --- .../coach/fhir/transform/DefaultVendorTransformer.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/edu/ohsu/cmp/coach/fhir/transform/DefaultVendorTransformer.java b/src/main/java/edu/ohsu/cmp/coach/fhir/transform/DefaultVendorTransformer.java index 3d614d44..673eea39 100644 --- a/src/main/java/edu/ohsu/cmp/coach/fhir/transform/DefaultVendorTransformer.java +++ b/src/main/java/edu/ohsu/cmp/coach/fhir/transform/DefaultVendorTransformer.java @@ -108,13 +108,14 @@ public Bundle transformOutgoingBloodPressureReading(BloodPressureModel model) th // ensure BP panel Observations are tagged with the common panel coding Observation sourceBPObservation = model.getSourceBPObservation().copy(); appendIfMissing(sourceBPObservation, fcm.getBpPanelCommonCoding()); - FhirUtil.appendResourceToBundle(bundle, sourceBPObservation); // CQF Ruler needs to see the Home Setting extension to positively identify the reading as Home if (model.isHomeReading() && ! FhirUtil.hasHomeSettingExtension(sourceBPObservation)) { FhirUtil.addHomeSettingExtension(sourceBPObservation); } + FhirUtil.appendResourceToBundle(bundle, sourceBPObservation); + if (model.getSourceEncounter() != null) { FhirUtil.appendResourceToBundle(bundle, model.getSourceEncounter().copy()); } @@ -126,22 +127,24 @@ public Bundle transformOutgoingBloodPressureReading(BloodPressureModel model) th // ensure BP systolic and diastolic Observations are tagged with the common systolic and diastolic codings Observation systolicObservation = model.getSourceSystolicObservation().copy(); appendIfMissing(systolicObservation, fcm.getBpSystolicCommonCoding()); - FhirUtil.appendResourceToBundle(bundle,systolicObservation); // CQF Ruler needs to see the Home Setting extension to positively identify the reading as Home if (model.isHomeReading() && ! FhirUtil.hasHomeSettingExtension(systolicObservation)) { FhirUtil.addHomeSettingExtension(systolicObservation); } + FhirUtil.appendResourceToBundle(bundle, systolicObservation); + Observation diastolicObservation = model.getSourceDiastolicObservation().copy(); appendIfMissing(diastolicObservation, fcm.getBpDiastolicCommonCoding()); - FhirUtil.appendResourceToBundle(bundle, diastolicObservation); // CQF Ruler needs to see the Home Setting extension to positively identify the reading as Home if (model.isHomeReading() && ! FhirUtil.hasHomeSettingExtension(diastolicObservation)) { FhirUtil.addHomeSettingExtension(diastolicObservation); } + FhirUtil.appendResourceToBundle(bundle, diastolicObservation); + if (model.getSourceEncounter() != null) { FhirUtil.appendResourceToBundle(bundle, model.getSourceEncounter()); }