-
Notifications
You must be signed in to change notification settings - Fork 35
Fi 601 Pass comma-separated patients to US Core #419
Conversation
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 think this is a reasonable approach.
generator/uscore/uscore_generator.rb
Outdated
|
||
revinclude_test[:test_code] += %( | ||
end | ||
skip 'No Provenance resources were returned from this search' unless any_provenances |
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.
It would be nice to use our skip_unless
helper wherever possible.
generator/uscore/uscore_generator.rb
Outdated
revinclude_test[:test_code] = %( | ||
any_provenances = false | ||
could_not_resolve_all = [] | ||
resolved_one = false |
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.
These aren't always needed, for example in the AllergyIntolerance sequence.
generator/uscore/uscore_generator.rb
Outdated
@@ -250,10 +258,17 @@ def create_revinclude_test(sequence) | |||
assert_response_ok(reply) | |||
assert_bundle_response(reply) | |||
#{resource_variable} = fetch_all_bundled_resources(reply.resource).select { |resource| resource.resourceType == '#{resource_name}'} | |||
skip 'No #{resource_name} resources were returned from this search' unless #{resource_variable}.present? | |||
any_provenances ||= provenance_results.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.
Should we break
out of the iteration once we've found some?
search_test[:test_code] = | ||
if is_first_search | ||
# rcs question: are comparators ever be in the first search? |
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.
They are not currently and I'd say they are unlikely to be in the future.
generator/uscore/uscore_generator.rb
Outdated
revinclude_test[:test_code] = search_params | ||
revinclude_test[:test_code] = %( | ||
any_provenances = false | ||
could_not_resolve_all = [] |
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.
Could this be given a more clear name? Maybe something along the lines of required_search_params
?
generator/uscore/uscore_generator.rb
Outdated
reply = get_resource_by_params(versioned_resource_class('#{sequence[:resource]}'), search_params) | ||
assert_response_ok(reply) | ||
assert_bundle_response(reply) | ||
@#{sequence[:resource].underscore}_ary = {} |
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.
Since this is now a hash, I'd love it if it wasn't named *_ary
. The US Core resources work out so that *s
works as a plural for them all.
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 was wondering if this would make more sense, and quickly scanned to see if we could just replace with 's'. But I didn't end up doing it because it is easy to drop an s
in places by mistake in the generator. But I can readd.
@@ -1,46 +0,0 @@ | |||
{ |
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.
These fixtures are not generated and need to be restored.
conformance_supports :<%=resource%><%=" | ||
delayed_sequence" if delayed_sequence%> | ||
<%=search_validator%> | ||
details %( | ||
The #{title} Sequence tests `#{title.gsub(/\s+/, '')}` resources associated with the provided patient. | ||
) | ||
|
||
def patient_ids |
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.
Should this go in SequenceBase? I know putting more stuff in SequnceBase is unfortunate, but I think it makes sense since this method seems necessary to support the new field in TestingInstance.
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 don't think so -- to me it is a matter of scope. Should all tests everywhere need access to this method? I don't think so. Yeah it's unfortunate that all testing instances will have this field, but hopefully we can fix that at some point.
@@ -759,7 +816,7 @@ def get_search_param_hash(search_parameters, sequence, grab_first_value = false) | |||
search_parameters.each_with_object({}) do |param, params| | |||
params[param] = | |||
if param == 'patient' | |||
'@instance.patient_id' | |||
'patient' |
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.
What's this change?
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.
Hah, we should just remove it. I didn't look too closely at the logic, was doing a replace any time we are doing @instance.patient_id
because they are now in a loop block where patient
is defined.
style fix for block Co-Authored-By: Stephen MacVicar <Jammjammjamm@users.noreply.github.com>
generator/uscore/uscore_generator.rb
Outdated
reply = get_resource_by_params(versioned_resource_class('#{sequence[:resource]}'), search_params) | ||
assert_response_ok(reply) | ||
assert_bundle_response(reply) | ||
could_not_resolve_all = [] |
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.
We don't need the resolved_one logic in any of the first searches because we're not resolving the values from the resources. They're all either just patient or patient + some fixed value.
I think the only thing that needs to loop through patients are the first searches for patient-based resources. Once all the resources are in the array, we can use |
fix rubocop issues and remove unit tests
Note: temporarily removed the generated unit tests because major refactor needed. We have decided to go this route though so our plan is to merge to allow end-to-end tests with other downstream updates and backfill unit tests to catch edge cases over the coming weeks. |
Pass a comma separated list of patients to US Core. A few loose ends need fixing, and unit tests need to be updated. For discussion. FYI @czh-orz @Jammjammjamm
Submitter:
Reviewer 1:
Name:
where appropriate, and accomplishes the task's purpose
Reviewer 2:
Name:
where appropriate, and accomplishes the task's purpose