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-2313 MS Slice Subelement Support #140

Merged
merged 10 commits into from
Dec 7, 2023
Merged

Conversation

360dgries
Copy link
Contributor

@360dgries 360dgries commented Nov 21, 2023

Summary

Completion of FI-2313

  • metadata extraction now collects both the tail end of slices and stores it under slice_name and stores the full id (not path) under slice_id
  • areas that referenced slice[:name] correctly use slice_id
  • fhir_resource_navigation updated to be able to navigate slices using their discriminator.

@@ -77,7 +77,8 @@ def must_support_pattern_slice_elements
def pattern_slices
must_support_pattern_slice_elements.map do |current_element|
{
name: current_element.id,
slice_id: current_element.id,
slice_name: current_element.id.split(':')[1],
Copy link
Contributor

@yunwwang yunwwang Nov 22, 2023

Choose a reason for hiding this comment

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

slice_name is coming from ElementDefinition.sliceName. Example

{
      "id" : "Coverage.class:group",
      "path" : "Coverage.class",
      "sliceName" : "group",
      ...
}

But from the navigator changes, navigator may not need slice_name. So if navigator does not need slice_name, then generator can skip creating this in metadata.

@@ -20,7 +20,7 @@ def find_a_value_at(element, path, include_dar: false)
return nil if element.nil?

elements = Array.wrap(element)

path = (path.include?(':') && !path.include?('url')) ? path.gsub(/:.*\./, '.') : path
Copy link
Contributor

@yunwwang yunwwang Nov 22, 2023

Choose a reason for hiding this comment

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

This is not simply remove the slice name from the path. What need here is that if there is slice name in the middle, then navigates to the element at the specific path in a spcific slice.

Example, US Core Coverage.class

...
"class": [
  {
    "type": {
      "coding": [
        {
          "system": "http://example.com"
          "code": "local-code"
        }
      ]
    },
    "value": "abc"
  },
  {
    "type": {
      "coding": [
        {
          "system": "http://terminology.hl7.org/CodeSystem/coverage-class"
          "code": "group"
        }
      ]
    },
    "value": "def"
  },
    {
    "type": {
      "coding": [
        {
          "system": "http://terminology.hl7.org/CodeSystem/coverage-class"
          "code": "plan"
        }
      ]
    },
    "value": "ghi"
  },
]

The path class.value navigates to any one of these three elements (most likely the first occurance), while path class:group.value navigates to the 2nd element with value "def"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, gotchya. I had a misunderstanding of slices, and thought it could only have one. Will patch this, thanks for the catch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added support for this -- currently it is looking through type.coding.code to pull the slice out. I think the other slices I've looked at are also defined through this path, but let me know if you are aware of any that are not and this needs a more robust solution.

FHIR::Coverage.new.tap{ |cov|
cov.local_class = [FHIR::Coverage::Class.new.tap{ |loc_class|
loc_class.type = FHIR::CodeableConcept.new.tap{ |code_concept|
code_concept.coding = FHIR::Coding.new.tap{ |coding|
Copy link
Contributor

Choose a reason for hiding this comment

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

CodeableConcept.coding is an array. So here should be

code_concept.coding = [ FHIR::Coding.new.tap{ |coding|

This does not affect unit test result.


handle_must_support_choices if metadata.must_supports[:choices].present?
# handle_must_support_choices if metadata.must_supports[:choices].present?
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be added back to handle MustSupport choices

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just went through and re-added any code I had commented out. Should be good now, sorry about that!

@360dgries 360dgries merged commit 4fbd620 into main Dec 7, 2023
2 checks passed
@360dgries 360dgries deleted the FI-2313-MS-Slice-Subelements branch December 7, 2023 19:18
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.

2 participants