Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FI-2316 Label Reference target profile as MustSupport is there is only one #139

Merged
merged 9 commits into from
Dec 8, 2023

Conversation

yunwwang
Copy link
Contributor

@yunwwang yunwwang commented Nov 20, 2023

Summary

This fixes https://oncprojectracking.healthit.gov/support/browse/FI-2316
This fixes GitHub Issue onc-healthit/onc-certification-g10-test-kit#470

When there is only one target profile for a MustSupport Reference, this profile shall also be treated as MustSupport. This does not affect MustSupport test but enforced reference validation test using the correct profile.

This change exculde US Core v3.1.1 which does not have any target_profile marked, and any FHIR base profiles.

Testing Guidance

@@ -254,17 +254,25 @@ def get_type_must_support_metadata(current_metadata, current_element)
end

def handle_type_must_support_target_profiles(type, metadata)
index = 0
return if profile.version == '3.1.1'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

US Core 3 also includes the base FHIR vital signs profiles, which have a different version. I'm guessing that those don't have target profiles and therefore aren't impacted by this change, though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is correct. I will also exclude FHIR R4 profiles for completeness.

target_profiles << type.targetProfile.first
else
index = 0
type.source_hash['_targetProfile']&.each do |hash|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ruby can handle the index for you: &.each_with_index do |hash, index|

element = FHIR::Element.new(hash)
target_profiles << type.targetProfile[index] if type_must_support_extension?(element.extension)
end
index += 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one needs to go, too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, got it. So the index increase automatically.

@arscan arscan changed the title FI-2316 Label Reference target profile as MastSupport is there is only one FI-2316 Label Reference target profile as MustSupport is there is only one Dec 7, 2023
end

def unresolved_references_strings
unresolved_reference_hash =
unresolved_references.each_with_object(Hash.new { |hash, key| hash[key] = [] }) do |missing, hash|
hash[missing[:path]] << missing[:target_profile]
end
unresolved_reference_hash.map { |path, profiles| "#{path}#{"(#{profiles.join('|')})" unless profiles.first.empty?}" }
unresolved_reference_hash.map { |path, profiles| "#{path} element: Reference(#{profiles.join('|')})" unless profiles.first.empty?}" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a syntax error here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot to push the last commit

@yunwwang yunwwang merged commit 06eda24 into main Dec 8, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants