generated from inferno-framework/inferno-template
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Rakefile
140 lines (117 loc) · 4.75 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
require 'pry'
require 'pry-byebug'
require_relative 'lib/inferno/terminology'
require_relative 'lib/inferno/terminology/fhir_package_manager'
require_relative 'lib/inferno/terminology/tasks'
begin
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
task default: :spec
rescue LoadError # rubocop:disable Lint/SuppressedException
end
namespace :db do
desc 'Apply changes to the database'
task :migrate do
require 'inferno/config/application'
require 'inferno/utils/migration'
Inferno::Utils::Migration.new.run
end
end
def Inferno.logger
@logger ||= Logger.new($stdout)
end
Inferno.logger.formatter = proc do |_severity, _datetime, _progname, message|
"#{message}\n"
end
default_version = '2023'
namespace :terminology do |_argv|
desc 'download and execute UMLS terminology data'
task :download_umls, [:apikey, :version] do |_t, args|
args.with_defaults(version: default_version)
Inferno::Terminology::Tasks::DownloadUMLS.new(**args.to_hash).run
end
desc 'unzip umls zip'
task :unzip_umls, [:version] do |_t, args|
args.with_defaults(version: default_version)
Inferno::Terminology::Tasks::UnzipUMLS.new(**args.to_hash).run
end
desc 'run umls jar'
task :run_umls, [:version] do |_t, args|
args.with_defaults(version: default_version)
Inferno::Terminology::Tasks::RunUMLSJar.new(**args.to_hash).run
end
desc 'cleanup all terminology files'
task :cleanup, [] do |_t, _args|
Inferno::Terminology::Tasks::Cleanup.new.run
end
desc 'cleanup terminology files except umls.db'
task :cleanup_precursors, [:version] do |_t, args|
args.with_defaults(version: default_version)
Inferno::Terminology::Tasks::CleanupPrecursors.new(**args.to_hash).run
end
desc 'post-process UMLS terminology file'
task :process_umls, [:version] do |_t, args|
args.with_defaults(version: default_version)
Inferno::Terminology::Tasks::ProcessUMLS.new(**args.to_hash).run
end
desc 'post-process UMLS terminology file for translations'
task :process_umls_translations, [] do |_t, _args|
Inferno::Terminology::Tasks::ProcessUMLSTranslations.new.run
end
# desc 'Create only non-UMLS validators'
# task :create_non_umls_vs_validators, [:minimum_binding_strength, :delete_existing] do |_t, args|
# args.with_defaults(type: 'bloom',
# minimum_binding_strength: 'example',
# delete_existing: true)
# validator_type = args.type.to_sym
# Inferno::Terminology::Loader.load_value_sets_from_directory(Inferno::Terminology::PACKAGE_DIR, true)
# Inferno::Terminology::Loader.create_validators(type: validator_type,
# minimum_binding_strength: args.minimum_binding_strength,
# include_umls: false,
# delete_existing: args.delete_existing)
# end
desc 'Create ValueSet Validators'
task :create_vs_validators, [:minimum_binding_strength, :version, :delete_existing, :type] do |_t, args|
args.with_defaults(
minimum_binding_strength: 'example',
delete_existing: true,
version: default_version,
type: 'bloom'
)
Inferno::Terminology::Tasks::CreateValueSetValidators.new(**args.to_hash).run
end
desc 'Number of codes in ValueSet'
task :codes_in_valueset, [:vs] do |_t, args|
Inferno::Terminology::Tasks::CountCodesInValueSet.new(**args.to_hash).run
end
desc 'Expand and Save ValueSet to a file'
task :expand_valueset_to_file, [:vs, :filename, :type] do |_t, args|
Inferno::Terminology::Tasks::ExpandValueSetToFile.new(**args.to_hash).run
end
desc 'Download FHIR Package'
task :download_package, [:package, :location] do |_t, args|
Inferno::Terminology::FHIRPackageManager.get_package(args.package, args.location)
end
desc 'Download Terminology from FHIR Package'
task :download_program_terminology do |_t, _args|
Inferno::Terminology::Tasks::DownloadFHIRTerminology.new.run
end
desc 'Check if the code is in the specified ValueSet. Omit the ValueSet to check against CodeSystem'
task :check_code, [:code, :system, :valueset] do |_t, args|
args.with_defaults(system: nil, valueset: nil)
Inferno::Terminology::Tasks::ValidateCode.new(**args.to_hash).run
end
desc 'Check if the terminology filters have been built correctly'
task :check_built_terminology do |_t, _args|
Inferno::Terminology::Tasks::CheckBuiltTerminology.new.run
end
end
namespace :g10_test_kit do
desc 'Generate ONC Certification (g)(10) Test Kit Matrix'
task :generate_matrix do
require 'inferno'
Inferno::Application.start(:suites)
require_relative 'lib/onc_certification_g10_test_kit/tasks/generate_matrix'
ONCCertificationG10TestKit::Tasks::GenerateMatrix.new.run
end
end