-
Notifications
You must be signed in to change notification settings - Fork 5
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
Conversation
@@ -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], |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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"
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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| |
There was a problem hiding this comment.
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? |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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!
Summary
Completion of FI-2313
slice_name
and stores the full id (not path) underslice_id
fhir_resource_navigation
updated to be able to navigate slices using their discriminator.