Class: DaVinciUSDrugFormularyTestKit::Generator::SuiteGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ig_metadata, base_output_dir) ⇒ SuiteGenerator

Returns a new instance of SuiteGenerator.



14
15
16
17
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 14

def initialize(, base_output_dir)
  self. = 
  self.base_output_dir = base_output_dir
end

Instance Attribute Details

#base_output_dirObject

Returns the value of attribute base_output_dir.



12
13
14
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 12

def base_output_dir
  @base_output_dir
end

#ig_metadataObject

Returns the value of attribute ig_metadata.



12
13
14
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 12

def 
  @ig_metadata
end

Class Method Details

.generate(ig_metadata, base_output_dir) ⇒ Object



7
8
9
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 7

def generate(, base_output_dir)
  new(, base_output_dir).generate
end

Instance Method Details

#base_output_file_nameObject



31
32
33
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 31

def base_output_file_name
  'usdf_test_suite.rb'
end

#capability_statement_file_nameObject



86
87
88
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 86

def capability_statement_file_name
  "../../custom_groups/#{.ig_version}/capability_statement_group"
end

#capability_statement_group_idObject



90
91
92
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 90

def capability_statement_group_id
  "usdf_#{.reformatted_version}_capability_statement"
end

#class_nameObject



35
36
37
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 35

def class_name
  'USDFTestSuite'
end

#generateObject



68
69
70
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 68

def generate
  File.write(output_file_name, output)
end

#group_file_listObject



81
82
83
84
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 81

def group_file_list
  @group_file_list ||=
    groups.map { |group| group.file_name.delete_suffix('.rb') }
end

#group_id_listObject



76
77
78
79
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 76

def group_id_list
  @group_id_list ||=
    groups.map(&:id)
end

#groupsObject



72
73
74
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 72

def groups
  .ordered_groups
end

#ig_identifierObject



59
60
61
62
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 59

def ig_identifier
  version = .ig_version[1..] # Remove leading 'v'
  "hl7.fhir.us.davinci-drug-formulary##{version}"
end


64
65
66
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 64

def ig_link
  'https://hl7.org/fhir/us/davinci-drug-formulary/STU2.0.1/'
end

#module_nameObject



39
40
41
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 39

def module_name
  "USDF#{.reformatted_version.upcase}"
end

#outputObject



27
28
29
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 27

def output
  @output ||= ERB.new(template).result(binding)
end

#output_file_nameObject



43
44
45
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 43

def output_file_name
  File.join(base_output_dir, base_output_file_name)
end

#short_titleObject



55
56
57
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 55

def short_title
  "US Drug Formulary #{.ig_version}"
end

#suite_idObject



47
48
49
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 47

def suite_id
  "davinci_us_drug_formulary_#{.reformatted_version}"
end

#templateObject



23
24
25
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 23

def template
  @template ||= File.read(File.join(__dir__, 'templates', 'suite.rb.erb'))
end

#titleObject



51
52
53
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 51

def title
  "DaVinci US Drug Formulary #{.ig_version}"
end

#version_specific_message_filtersObject



19
20
21
# File 'lib/davinci_us_drug_formulary_test_kit/generator/suite_generator.rb', line 19

def version_specific_message_filters
  []
end