Skip to content

Commit

Permalink
FHIR-2327 Restore component.dataAbsentReason MS for BloodPressure pro…
Browse files Browse the repository at this point in the history
…file (#141)

* create draft

* fix comment

---------

Co-authored-by: Yunwei Wang <>
  • Loading branch information
yunwwang authored Dec 7, 2023
1 parent 52b9667 commit 62a84c8
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 10 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/us_core_test_kit/generated/v5.0.1/metadata.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/us_core_test_kit/generated/v6.1.0/metadata.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 22 additions & 10 deletions lib/us_core_test_kit/generator/must_support_metadata_extractor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ def must_support_elements

def handle_special_cases
remove_vital_sign_component
remove_blood_pressure_value
remove_blood_pressure_value_data_absent_reason
remove_observation_data_absent_reason

case profile.version
Expand Down Expand Up @@ -345,30 +345,42 @@ def is_blood_pressure?

# Exclude Observation.component from vital sign profiles except observation-bp and observation-pulse-ox
def remove_vital_sign_component
if is_vital_sign? && !is_blood_pressure? && profile.name != 'USCorePulseOximetryProfile'
return if is_blood_pressure? || profile.name == 'USCorePulseOximetryProfile'

if is_vital_sign?
@must_supports[:elements].delete_if do |element|
element[:path].start_with?('component')
end
end
end

# Exclude Observation.value[x] from observation-bp
def remove_blood_pressure_value
if is_blood_pressure?
@must_supports[:elements].delete_if do |element|
element[:path].start_with?('value[x]') || element[:original_path]&.start_with?('value[x]')
end
@must_supports[:slices].delete_if do |slice|
slice[:path].start_with?('value[x]')
end
def remove_blood_pressure_value_data_absent_reason
return unless is_blood_pressure?

@must_supports[:elements].delete_if do |element|
element[:path].start_with?('value[x]') ||
element[:original_path]&.start_with?('value[x]') ||
element[:path] == ('dataAbsentReason') ||
(
element[:path] == ('component.dataAbsentReason') &&
['3.1.1', '4.0.0'].include?(ig_resources.ig.version)
)
end

@must_supports[:slices].delete_if do |slice|
slice[:path].start_with?('value[x]')
end
end

# ONC and US Core 4.0.0 both clarified that health IT developers that always provide HL7 FHIR "observation" values
# are not required to demonstrate Health IT Module support for "dataAbsentReason" elements.
# Remove MS check for dataAbsentReason and component.dataAbsentReason from vital sign profiles and observation lab profile
# Smoking status profile does not have MS on dataAbsentReason. It is safe to use profile.type == 'Observation'
# Since US Core 5.0.1, Blood Pressure profile restores component.dataAbsentReason as MustSupport.
def remove_observation_data_absent_reason
return if is_blood_pressure?

if profile.type == 'Observation'
@must_supports[:elements].delete_if do |element|
['dataAbsentReason', 'component.dataAbsentReason'].include?(element[:path])
Expand Down

0 comments on commit 62a84c8

Please sign in to comment.