davinci_us_drug_formulary_test_kit 0.10.0 → 0.10.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e65817122b43903b0e36cf5321d955c85c84e242c62d551f2788c4e39a6d15f3
4
- data.tar.gz: 65a4dd64907aeb998e66f6aa082c4360e3bc73c820ae45f12f30d470582bfd2a
3
+ metadata.gz: c1d80f365197a7b85d33e06ac063779f8f9ee3a96ce65fec1755bca0e268a997
4
+ data.tar.gz: cdf090825199aa640c155ba2059759b516efedddfb62996ee4adfda3fa31c74c
5
5
  SHA512:
6
- metadata.gz: 651f8926d9e60874efa3b8879fb89fa2814a20287569ede857422ebf7a254bcda0ca31480161d5af07993441d2804fc141ae9ef33b4f8baf121421e043604ba7
7
- data.tar.gz: 7d1cab5b5d87618aa7667a46db081bba38cd108dfc07b1f9210c049f01e0cc46201291d7fc26fe4584584dd450300eee51318f39fa613615baa02e2996794bd2
6
+ metadata.gz: e16f6ae0f5f5dc1eeb20d0bad1e5a21e16dac1c15bf188b77bd3eed62bb509640bfc17bedf9d0c9b41a033b5928f432b98dcdd2a19678460dcf8524743e6942f
7
+ data.tar.gz: 98eeb731bfda89af7d039609558f8ce40a4ce96bee3f278b25ea6dd77a11a4459d42c68844aefbe6a63ae75d2a7ad2cfcab4be756d00f5dda3b19ad292bd04b4
@@ -6,11 +6,11 @@ module DaVinciUSDrugFormularyTestKit
6
6
  class BasicFormularyIncludeSearchTest < Inferno::Test
7
7
  include DaVinciUSDrugFormularyTestKit::SearchTest
8
8
 
9
- title 'Server returns InsurancePlan resources from Basic search by _include=formulary'
9
+ title 'Server returns InsurancePlan resources from Basic search by _include=Basic:formulary'
10
10
  description %(
11
- A server SHALL be capable of supporting _includes for formulary.
11
+ A server SHALL be capable of supporting _includes for Basic:formulary.
12
12
 
13
- This test will perform a search using _include=formulary and
13
+ This test will perform a search using _include=Basic:formulary and
14
14
  will pass if the referenced InsurancePlan is included in the response.
15
15
  )
16
16
 
@@ -20,7 +20,8 @@ module DaVinciUSDrugFormularyTestKit
20
20
  @properties ||= SearchTestProperties.new(
21
21
  resource_type: 'Basic',
22
22
  search_param_names: ["code"],
23
- include_param: 'formulary'
23
+ include_param: 'Basic:formulary',
24
+ include_search_look_up_param: 'formulary'
24
25
  )
25
26
  end
26
27
 
@@ -6,11 +6,11 @@ module DaVinciUSDrugFormularyTestKit
6
6
  class BasicSubjectIncludeSearchTest < Inferno::Test
7
7
  include DaVinciUSDrugFormularyTestKit::SearchTest
8
8
 
9
- title 'Server returns MedicationKnowledge resources from Basic search by _include=subject'
9
+ title 'Server returns MedicationKnowledge resources from Basic search by _include=Basic:subject'
10
10
  description %(
11
- A server SHALL be capable of supporting _includes for subject.
11
+ A server SHALL be capable of supporting _includes for Basic:subject.
12
12
 
13
- This test will perform a search using _include=subject and
13
+ This test will perform a search using _include=Basic:subject and
14
14
  will pass if the referenced MedicationKnowledge is included in the response.
15
15
  )
16
16
 
@@ -20,7 +20,8 @@ module DaVinciUSDrugFormularyTestKit
20
20
  @properties ||= SearchTestProperties.new(
21
21
  resource_type: 'Basic',
22
22
  search_param_names: ["code"],
23
- include_param: 'subject'
23
+ include_param: 'Basic:subject',
24
+ include_search_look_up_param: 'subject'
24
25
  )
25
26
  end
26
27
 
@@ -205,8 +205,8 @@
205
205
  :contains_multiple: false
206
206
  :multiple_or: true
207
207
  :include_params:
208
- - subject
209
- - formulary
208
+ - Basic:subject
209
+ - Basic:formulary
210
210
  :must_supports:
211
211
  :extensions:
212
212
  - :id: Basic.extension:usdf-FormularyReference-extension
@@ -205,7 +205,7 @@
205
205
  :contains_multiple: true
206
206
  :multiple_or: true
207
207
  :include_params:
208
- - formulary-coverage
208
+ - InsurancePlan:formulary-coverage
209
209
  :must_supports:
210
210
  :extensions: []
211
211
  :slices: []
@@ -215,7 +215,7 @@
215
215
  :contains_multiple: true
216
216
  :multiple_or: true
217
217
  :include_params: &1
218
- - formulary-coverage
218
+ - InsurancePlan:formulary-coverage
219
219
  :must_supports:
220
220
  :extensions:
221
221
  - :id: InsurancePlan.coverage:drug-coverage.extension:usdf-FormularyReference-extension
@@ -791,8 +791,8 @@
791
791
  :contains_multiple: false
792
792
  :multiple_or: true
793
793
  :include_params:
794
- - subject
795
- - formulary
794
+ - Basic:subject
795
+ - Basic:formulary
796
796
  :must_supports:
797
797
  :extensions:
798
798
  - :id: Basic.extension:usdf-FormularyReference-extension
@@ -213,7 +213,7 @@
213
213
  :contains_multiple: true
214
214
  :multiple_or: true
215
215
  :include_params:
216
- - formulary-coverage
216
+ - InsurancePlan:formulary-coverage
217
217
  :must_supports:
218
218
  :extensions:
219
219
  - :id: InsurancePlan.coverage:drug-coverage.extension:usdf-FormularyReference-extension
@@ -6,11 +6,11 @@ module DaVinciUSDrugFormularyTestKit
6
6
  class PayerInsurancePlanFormularyCoverageIncludeSearchTest < Inferno::Test
7
7
  include DaVinciUSDrugFormularyTestKit::SearchTest
8
8
 
9
- title 'Server returns InsurancePlan resources from InsurancePlan search by _include=formulary-coverage'
9
+ title 'Server returns InsurancePlan resources from InsurancePlan search by _include=InsurancePlan:formulary-coverage'
10
10
  description %(
11
- A server SHALL be capable of supporting _includes for formulary-coverage.
11
+ A server SHALL be capable of supporting _includes for InsurancePlan:formulary-coverage.
12
12
 
13
- This test will perform a search using _include=formulary-coverage and
13
+ This test will perform a search using _include=InsurancePlan:formulary-coverage and
14
14
  will pass if the referenced InsurancePlan is included in the response.
15
15
  )
16
16
 
@@ -20,7 +20,8 @@ module DaVinciUSDrugFormularyTestKit
20
20
  @properties ||= SearchTestProperties.new(
21
21
  resource_type: 'InsurancePlan',
22
22
  search_param_names: ["coverage-type"],
23
- include_param: 'formulary-coverage'
23
+ include_param: 'InsurancePlan:formulary-coverage',
24
+ include_search_look_up_param: 'formulary-coverage'
24
25
  )
25
26
  end
26
27
 
@@ -19,11 +19,18 @@ module DaVinciUSDrugFormularyTestKit
19
19
  end
20
20
 
21
21
  def load
22
+ # `IGResources` uses the first resource it finds for a resource type.
23
+ # To "supercede" resources, load them first. Any duplicate resources will
24
+ # be accessed instead of the IG resources because they are "first."
25
+ # To "supplement" resources, load them last. Any duplicate resources will
26
+ # be ignored because the IG resources are "first."
27
+ load_supersede_resources
22
28
  load_ig
23
- load_standalone_resources
29
+ load_supplement_resources
24
30
  end
25
31
 
26
32
  def load_ig
33
+
27
34
  tar = Gem::Package::TarReader.new(
28
35
  Zlib::GzipReader.open(ig_file_name)
29
36
  )
@@ -51,8 +58,16 @@ module DaVinciUSDrugFormularyTestKit
51
58
  ig_resources
52
59
  end
53
60
 
54
- def load_standalone_resources
55
- ig_directory = ig_file_name.chomp('.tgz')
61
+ def load_supersede_resources
62
+ load_standalone_resources('_supersede')
63
+ end
64
+
65
+ def load_supplement_resources
66
+ load_standalone_resources('_supplement')
67
+ end
68
+
69
+ def load_standalone_resources(appendage = '')
70
+ ig_directory = "#{ig_file_name.chomp('.tgz')}#{appendage}"
56
71
 
57
72
  Dir.glob(File.join(ig_directory, '*.json')).each do |file_path|
58
73
  resource = FHIR.from_contents(File.read(file_path))
@@ -63,6 +78,8 @@ module DaVinciUSDrugFormularyTestKit
63
78
  resource_arr.each do |entry|
64
79
  ig_resources.add(entry.resource)
65
80
  end
81
+ else
82
+ ig_resources.add(resource)
66
83
  end
67
84
  rescue StandardError
68
85
  file_name = file_path.split('/').last
@@ -39,7 +39,7 @@ module DaVinciUSDrugFormularyTestKit
39
39
  end
40
40
 
41
41
  def search_identifier
42
- include_param.gsub(/[-:]/, '_').underscore
42
+ include_search_look_up_param.gsub(/[-:]/, '_').underscore
43
43
  end
44
44
 
45
45
  def class_name
@@ -51,16 +51,28 @@ module DaVinciUSDrugFormularyTestKit
51
51
  properties[:resource_type] = "'#{resource_type}'"
52
52
  properties[:search_param_names] = search_param_names
53
53
  properties[:include_param] = "'#{include_param}'"
54
+ properties[:include_search_look_up_param] = "'#{include_search_look_up_param}'"
54
55
  end
55
56
  end
56
57
 
58
+ def include_search_look_up_param
59
+ # Returns the `searchParam` part of the `include_param` string, which should be
60
+ # formatted as `SourceType:searchParam(:targetType)`. See (https://hl7.org/fhir/R4/search.html#table)
61
+ # If the `include_param` is formatted incorrectly, returns `include_param`.
62
+ #
63
+ # The `searchParam` part of `include_param` is necessary for indexing dictionaries generated
64
+ # from the `searchParams` list in the Capability Statement.
65
+ params = include_param.split(':')
66
+ params.length > 1 ? params[1] : include_param
67
+ end
68
+
57
69
  def include_param_string
58
70
  "_include=#{include_param}"
59
71
  end
60
72
 
61
73
  def include_param_resource
62
- res_type = group_metadata.search_definitions[:"#{include_param}"][:type]
63
- res_type = group_metadata.search_definitions[:"#{include_param}"][:target] if res_type == 'Reference'
74
+ res_type = group_metadata.search_definitions[:"#{include_search_look_up_param}"][:type]
75
+ res_type = group_metadata.search_definitions[:"#{include_search_look_up_param}"][:target] if res_type == 'Reference'
64
76
  res_type
65
77
  end
66
78
  end