@@ -14,7 +14,7 @@ class Client < Common::Client::Base
14
14
include Common ::Client ::Concerns ::MhvFhirSessionClient
15
15
16
16
# Default number of records to request per call when searching
17
- DEFAULT_COUNT = 9999
17
+ DEFAULT_COUNT = 3000
18
18
19
19
# LOINC codes for clinical notes
20
20
PHYSICIAN_PROCEDURE_NOTE = '11506-3' # Physician procedure note
@@ -43,7 +43,11 @@ class Client < Common::Client::Base
43
43
# @return [String] Base path for dependent URLs
44
44
#
45
45
def base_path
46
- "#{ Settings . mhv . medical_records . host } /fhir/"
46
+ if Flipper . enabled? ( :mhv_medical_records_migrate_to_api_gateway )
47
+ "#{ Settings . mhv . api_gateway . hosts . fhir } /fhir/"
48
+ else
49
+ "#{ Settings . mhv . medical_records . host } /fhir/"
50
+ end
47
51
end
48
52
49
53
##
@@ -214,6 +218,10 @@ def fhir_search(fhir_model, params)
214
218
#
215
219
def fhir_search_query ( fhir_model , params )
216
220
default_headers = { 'Cache-Control' : 'no-cache' }
221
+ if Flipper . enabled? ( :mhv_medical_records_migrate_to_api_gateway )
222
+ default_headers . merge ( 'x-api-key' => Settings . mhv . medical_records . x_api_key )
223
+ end
224
+
217
225
params [ :headers ] = default_headers . merge ( params . fetch ( :headers , { } ) )
218
226
219
227
params [ :search ] [ :parameters ] . merge! ( _count : DEFAULT_COUNT )
@@ -224,7 +232,12 @@ def fhir_search_query(fhir_model, params)
224
232
end
225
233
226
234
def fhir_read ( fhir_model , id )
227
- result = fhir_client . read ( fhir_model , id )
235
+ default_headers = { }
236
+ if Flipper . enabled? ( :mhv_medical_records_migrate_to_api_gateway )
237
+ default_headers . merge! ( 'x-api-key' => Settings . mhv . medical_records . x_api_key )
238
+ end
239
+
240
+ result = fhir_client . read ( fhir_model , id , nil , nil , { headers : default_headers } )
228
241
handle_api_errors ( result ) if result . resource . nil?
229
242
result . resource
230
243
end
0 commit comments