-
Notifications
You must be signed in to change notification settings - Fork 3
FQM-323: Verify server prefetch support #87
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
Merged
karlnaden
merged 7 commits into
support-v2.2.0
from
fqm-323-verify-server-prefetch-support
May 22, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
80db999
add check for prefetch support
Jammjammjamm 5e79751
add spec for prefetch support
Jammjammjamm 467e996
regenerate coverage csv
Jammjammjamm 1740dc8
move prefetch check to separate test
Jammjammjamm fa12af3
regenerate coverage csv
Jammjammjamm 8a9a199
update prefetch support test description
Jammjammjamm cd10232
update spec description
Jammjammjamm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
lib/davinci_crd_test_kit/server/v2.2.1/discovery/discovery_prefetch_support_test.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| require_relative '../../server_test_helper' | ||
|
|
||
| module DaVinciCRDTestKit | ||
| module V221 | ||
| class DiscoveryPrefetchSupportTest < Inferno::Test | ||
| include DaVinciCRDTestKit::ServerTestHelper | ||
|
|
||
| title 'Server demonstrates ability to request the CDS Client perform prefetch queries' | ||
| id :crd_v221_discovery_prefetch_support | ||
| description %( | ||
| This test expects the server to demonstrate support for prefetch queries | ||
| by providing a prefetch query in at least one of the advertised service | ||
| in the discovery response. | ||
| ) | ||
|
|
||
| verifies_requirements 'hl7.fhir.us.davinci-crd_2.2.1@found-24' | ||
|
|
||
| input :cds_services | ||
| input :crd_discovery_service_ignore_list, | ||
| optional: true | ||
|
|
||
| run do | ||
| object = parse_json(cds_services) | ||
| assert object['services'], 'Discovery response did not contain `services`' | ||
|
|
||
| services = object['services'] | ||
| assert services.is_a?(Array), 'Services field of the CDS Discovery response object is not an array.' | ||
|
|
||
| ignored_service_ids = crd_discovery_service_ignore_list.to_s.split(',').map(&:strip).reject(&:blank?) | ||
| services | ||
| .select { |service| ignored_service_ids.include?(service['id']) } | ||
| .each do |service| | ||
| info "Ignoring service `#{service['id']}` because it is in the ignore list." | ||
| end | ||
| services_for_crd_validation = services.reject { |service| ignored_service_ids.include?(service['id']) } | ||
|
|
||
| prefetch_supported = services_for_crd_validation.any? { |service| service['prefetch'].present? } | ||
|
|
||
| skip_if !prefetch_supported, 'No CRD services advertised prefetch support' | ||
| end | ||
| end | ||
| end | ||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
spec/davinci_crd_test_kit/v2.2.1/discovery_prefetch_support_test_spec.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| RSpec.describe DaVinciCRDTestKit::V221::DiscoveryPrefetchSupportTest do | ||
| let(:suite_id) { 'crd_client' } | ||
| let(:runnable) { described_class } | ||
| let(:results_repo) { Inferno::Repositories::Results.new } | ||
| let(:cds_service) do | ||
| { | ||
| 'hook' => 'appointment-book', | ||
| 'title' => 'Appointment Booking CDS Service', | ||
| 'description' => 'An example of a CDS Service that is invoked when user of a CRD Client books an appointment', | ||
| 'id' => 'appointment-book-service', | ||
| 'prefetch' => { | ||
| 'user' => '{{context.userId}}', | ||
| 'patient' => 'Patient/{{context.patientId}}' | ||
| } | ||
| } | ||
| end | ||
|
|
||
| def entity_result_messages | ||
| results_repo.current_results_for_test_session_and_runnables(test_session.id, [runnable]) | ||
| .first | ||
| .messages | ||
| end | ||
|
|
||
| it 'succeeds when a service contains a prefetch query' do | ||
| service1 = cds_service.merge('extension' => { 'davinci-crd.version' => ['2.1', '2.2'] }) | ||
| service2 = cds_service.merge('extension' => { 'davinci-crd.version' => ['2.2'] }) | ||
|
|
||
| cds_services = { 'services' => [service1, service2] }.to_json | ||
|
|
||
| result = run(runnable, cds_services:) | ||
|
|
||
| expect(result.result).to eq('pass'), result.result_message | ||
| end | ||
|
|
||
| it 'skips if no services advertise prefetch support' do | ||
| service1 = cds_service.merge('extension' => { 'davinci-crd.version' => ['2.1', '2.2'] }) | ||
| service2 = cds_service.merge('extension' => { 'davinci-crd.version' => ['2.2'] }) | ||
|
|
||
| service1.delete 'prefetch' | ||
| service2.delete 'prefetch' | ||
|
|
||
| cds_services = { 'services' => [service1, service2] }.to_json | ||
|
|
||
| result = run(runnable, cds_services:) | ||
|
|
||
| expect(result.result).to eq('skip'), result.result_message | ||
| expect(result.result_message).to match(/No CRD services advertised prefetch support/) | ||
| end | ||
| end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.