Class: DaVinciUSDrugFormularyTestKit::Generator::IncludeSearchTestGenerator
Constant Summary
collapse
- INCLUDE_SEARCH_PARAMS =
{ 'Payer Insurance Plan' => 'coverage-type', 'Formulary Item' => 'code' }.freeze
Instance Attribute Summary collapse
#base_output_dir, #group_metadata, #search_metadata
Class Method Summary
collapse
Instance Method Summary
collapse
#array_of_strings, #base_output_file_name, #conformance_expectation, #description, #first_search?, #first_search_description, #fixed_value_search?, #fixed_value_search_param_name, #generate, #module_name, #needs_id?, #optional?, #output, #output_file_directory, #output_file_name, #path_for_value, #post_search_description, #profile_identifier, #reference_search_description, #required_comparators, #required_comparators_for_param, #required_comparators_string, #required_multiple_or_search_params, #required_multiple_or_search_params_string, #resource_type, #saves_delayed_references?, #search_definition, #search_param_name_string, #search_param_names, #search_param_names_array, #search_params, #search_test_properties_string, #search_title, #test_post_search?, #test_reference_variants?, #token_search_params, #token_search_params_string, #url_version
Constructor Details
#initialize(group_metadata, search_metadata, base_output_dir, include_param) ⇒ IncludeSearchTestGenerator
Returns a new instance of IncludeSearchTestGenerator.
28
29
30
31
|
# File 'lib/davinci_us_drug_formulary_test_kit/generator/include_search_test_generator.rb', line 28
def initialize(group_metadata, search_metadata, base_output_dir, include_param)
super(group_metadata, search_metadata, base_output_dir)
self.include_param = include_param
end
|
Instance Attribute Details
#include_param ⇒ Object
Returns the value of attribute include_param.
26
27
28
|
# File 'lib/davinci_us_drug_formulary_test_kit/generator/include_search_test_generator.rb', line 26
def include_param
@include_param
end
|
Class Method Details
.generate(ig_metadata, base_output_dir) ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/davinci_us_drug_formulary_test_kit/generator/include_search_test_generator.rb', line 9
def generate(ig_metadata, base_output_dir)
ig_metadata.groups
.reject { |group| group.profile_name == 'Formulary' }
.reject { |group| group.include_params.empty? }
.each do |group|
group.include_params.each do |include_param|
search_meta = group.searches.find do |search|
search[:names].include? INCLUDE_SEARCH_PARAMS[group.profile_name]
end
new(group, search_meta, base_output_dir, include_param).generate
end
end
end
|
Instance Method Details
#class_name ⇒ Object
45
46
47
|
# File 'lib/davinci_us_drug_formulary_test_kit/generator/include_search_test_generator.rb', line 45
def class_name
"#{Naming.upper_camel_case_for_profile(group_metadata)}#{search_title}IncludeSearchTest"
end
|
#include_param_resource ⇒ Object
73
74
75
76
77
|
# File 'lib/davinci_us_drug_formulary_test_kit/generator/include_search_test_generator.rb', line 73
def include_param_resource
res_type = group_metadata.search_definitions[:"#{include_search_look_up_param}"][:type]
res_type = group_metadata.search_definitions[:"#{include_search_look_up_param}"][:target] if res_type == 'Reference'
res_type
end
|
#include_param_string ⇒ Object
69
70
71
|
# File 'lib/davinci_us_drug_formulary_test_kit/generator/include_search_test_generator.rb', line 69
def include_param_string
"_include=#{include_param}"
end
|
#include_search_look_up_param ⇒ Object
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/davinci_us_drug_formulary_test_kit/generator/include_search_test_generator.rb', line 58
def include_search_look_up_param
params = include_param.split(':')
params.length > 1 ? params[1] : include_param
end
|
#search_identifier ⇒ Object
41
42
43
|
# File 'lib/davinci_us_drug_formulary_test_kit/generator/include_search_test_generator.rb', line 41
def search_identifier
include_search_look_up_param.gsub(/[-:]/, '_').underscore
end
|
#search_properties ⇒ Object
49
50
51
52
53
54
55
56
|
# File 'lib/davinci_us_drug_formulary_test_kit/generator/include_search_test_generator.rb', line 49
def search_properties
{}.tap do |properties|
properties[:resource_type] = "'#{resource_type}'"
properties[:search_param_names] = search_param_names
properties[:include_param] = "'#{include_param}'"
properties[:include_search_look_up_param] = "'#{include_search_look_up_param}'"
end
end
|
#template ⇒ Object
33
34
35
|
# File 'lib/davinci_us_drug_formulary_test_kit/generator/include_search_test_generator.rb', line 33
def template
@template ||= File.read(File.join(__dir__, 'templates', 'include_search.rb.erb'))
end
|
#test_id ⇒ Object
37
38
39
|
# File 'lib/davinci_us_drug_formulary_test_kit/generator/include_search_test_generator.rb', line 37
def test_id
"usdf_#{group_metadata.reformatted_version}_#{profile_identifier}_#{search_identifier}_include_search_test"
end
|