From 0c495cf5973e36a560b46f9a036f5ffcd9e71a8a Mon Sep 17 00:00:00 2001 From: yunwwang Date: Mon, 4 Nov 2024 07:47:01 -0600 Subject: [PATCH] fix bulk data valueQuantity not found error (#582) Co-authored-by: Yunwei Wang <> --- lib/onc_certification_g10_test_kit/g10_options.rb | 4 ++++ lib/onc_certification_g10_test_kit/profile_selector.rb | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/lib/onc_certification_g10_test_kit/g10_options.rb b/lib/onc_certification_g10_test_kit/g10_options.rb index 7ec23cc2..dcb39278 100644 --- a/lib/onc_certification_g10_test_kit/g10_options.rb +++ b/lib/onc_certification_g10_test_kit/g10_options.rb @@ -56,6 +56,10 @@ def using_us_core_7? us_core_version == US_CORE_7 end + def us_core_7_and_above? + us_core_version[-1].to_i > 6 + end + def versioned_us_core_module case us_core_version when US_CORE_7 diff --git a/lib/onc_certification_g10_test_kit/profile_selector.rb b/lib/onc_certification_g10_test_kit/profile_selector.rb index c7cbee84..fdcd9bb2 100644 --- a/lib/onc_certification_g10_test_kit/profile_selector.rb +++ b/lib/onc_certification_g10_test_kit/profile_selector.rb @@ -60,6 +60,14 @@ def select_profile(resource) # rubocop:disable Metrics/CyclomaticComplexity when 'Observation' profiles << extract_profile('Smokingstatus') if observation_contains_code?(resource, '72166-2') + if us_core_7_and_above? && ( + observation_contains_code?(resource, '11367-0') || + observation_contains_code?(resource, '401201003') || + observation_contains_code?(resource, '782516008') + ) + profiles << extract_profile('Smokingstatus') + end + profiles << extract_profile('ObservationLab') if resource_contains_category?(resource, 'laboratory', 'http://terminology.hl7.org/CodeSystem/observation-category') profiles << extract_profile('PediatricBmiForAge') if observation_contains_code?(resource, '59576-9')