Skip to content

Commit f8ce3a1

Browse files
Introduce imms_api_search_job
- This mostly replaces `immunisations_fhir_api_integration_search`, but has a slightly different meaning; it is instead used only to restrict the automated jobs which trigger the search requests, rather than blocking the search requests themselves. - This allows the CLI tools to be used without this feature flag being enabled, allowing operational use without the automated searching. The CLI tools are still restricted by `imms_api_integration`.
1 parent 5b9fbb6 commit f8ce3a1

File tree

5 files changed

+5
-28
lines changed

5 files changed

+5
-28
lines changed

app/lib/mavis_cli/vaccination_records/create_from_fhir.rb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@ class CreateFromFHIR < Dry::CLI::Command
2424
def call(patient_id:, team_id: nil, file: nil, json: nil, **)
2525
MavisCLI.load_rails
2626

27-
unless Flipper.enabled?(:immunisations_fhir_api_integration_search)
28-
puts "Error: Feature flag :immunisations_fhir_api_integration_search is not enabled"
29-
return
30-
end
31-
3227
unless Flipper.enabled?(:imms_api_integration)
3328
puts "Error: Feature flag :imms_api_integration is not enabled"
3429
return

app/lib/mavis_cli/vaccination_records/search_imms_api.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ def call(
2727
MavisCLI.load_rails
2828

2929
unless Flipper.enabled?(:imms_api_integration)
30-
puts "Cannot search: one of the feature flags is disabled " \
31-
"(immunisations_fhir_api_integration, immunisations_fhir_api_integration_search)"
30+
puts "Cannot search: Feature flag :imms_api_integration is not enabled"
3231
return
3332
end
3433

app/lib/nhs/immunisations_api.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,7 @@ def should_be_in_immunisations_api?(
216216
end
217217

218218
def search_immunisations(patient, programmes:, date_from: nil, date_to: nil)
219-
unless Flipper.enabled?(:imms_api_integration) &&
220-
Flipper.enabled?(:immunisations_fhir_api_integration_search)
219+
unless Flipper.enabled?(:imms_api_integration)
221220
Rails.logger.info(
222221
"Not searching for vaccination records in the immunisations API as the" \
223222
"feature flag is disabled: Patient #{patient.id}"

config/feature_flags.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ dev_tools: Developer tools useful for testing and debugging.
88

99
imms_api_integration: Umbrella flag to switch off ALL API integration (including CLI tools).
1010

11-
immunisations_fhir_api_integration_search: Master switch to control whether
12-
search requests can be made to the NHS Immunisations FHIR API.
11+
imms_api_search_job: Flag to switch off any automated receipt of vaccination records (Read, Search),
12+
via scheduled jobs.
1313

1414
imms_api_sync_job: Flag to switch off any automated sending of vaccination records
1515
(Create, Update, Delete), triggered by the creation/edit/delete of any vaccination records.

spec/lib/nhs/immunisations_api_spec.rb

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
# frozen_string_literal: true
22

33
describe NHS::ImmunisationsAPI do
4-
before do
5-
Flipper.enable(:immunisations_fhir_api_integration_search)
6-
Flipper.enable(:imms_api_integration)
7-
end
4+
before { Flipper.enable(:imms_api_integration) }
85

96
let(:team) { create(:team, ods_code: "A9A5A") }
107
let(:patient) do
@@ -58,18 +55,6 @@
5855
end
5956
let(:notify_parents) { true }
6057

61-
shared_examples "an immunisations_fhir_api_integration_search feature flag check" do
62-
context "the immunisations_fhir_api_integration_search feature flag is disabled" do
63-
before { Flipper.disable(:immunisations_fhir_api_integration_search) }
64-
65-
it "does not make a request to the NHS API" do
66-
perform_request
67-
68-
expect(request_stub).not_to have_been_made
69-
end
70-
end
71-
end
72-
7358
shared_examples "an imms_api_integration feature flag check" do
7459
context "the imms_api_integration feature flag is disabled" do
7560
before { Flipper.disable(:imms_api_integration) }
@@ -770,7 +755,6 @@
770755
include_examples "generic error handling"
771756
include_examples "unexpected response status", 250, "searching"
772757

773-
include_examples "an immunisations_fhir_api_integration_search feature flag check"
774758
include_examples "an imms_api_integration feature flag check"
775759
end
776760
end

0 commit comments

Comments
 (0)