inferno_core 0.2.0.rc4 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/inferno/apps/web/controllers/test_runs/create.rb +33 -14
- data/lib/inferno/apps/web/index.html.erb +21 -1
- data/lib/inferno/apps/web/serializers/result.rb +4 -0
- data/lib/inferno/apps/web/serializers/test.rb +1 -1
- data/lib/inferno/apps/web/serializers/test_group.rb +1 -1
- data/lib/inferno/apps/web/serializers/test_suite.rb +1 -0
- data/lib/inferno/dsl/configurable.rb +22 -8
- data/lib/inferno/dsl/fhir_validation.rb +3 -1
- data/lib/inferno/dsl/input_output_handling.rb +185 -0
- data/lib/inferno/dsl/runnable.rb +24 -133
- data/lib/inferno/entities/input.rb +121 -0
- data/lib/inferno/entities/test.rb +5 -5
- data/lib/inferno/ext/fhir_models.rb +59 -0
- data/lib/inferno/public/bundle.js +15 -15
- data/lib/inferno/public/bundle.js.LICENSE.txt +2 -0
- data/lib/inferno/test_runner.rb +24 -2
- data/lib/inferno/utils/preset_template_generator.rb +4 -5
- data/lib/inferno/version.rb +2 -1
- data/spec/factories/result.rb +1 -0
- metadata +11 -8
data/lib/inferno/test_runner.rb
CHANGED
@@ -60,8 +60,8 @@ module Inferno
|
|
60
60
|
|
61
61
|
def run_test(test, scratch)
|
62
62
|
inputs = load_inputs(test)
|
63
|
+
input_json_string = inputs_as_json(test, inputs)
|
63
64
|
|
64
|
-
input_json_string = JSON.generate(inputs)
|
65
65
|
test_instance = test.new(inputs: inputs, test_session_id: test_session.id, scratch: scratch)
|
66
66
|
|
67
67
|
result = begin
|
@@ -107,6 +107,16 @@ module Inferno
|
|
107
107
|
end
|
108
108
|
|
109
109
|
def run_group(group, scratch)
|
110
|
+
group_inputs_with_values = group.available_inputs.map do |_input_identifier, input|
|
111
|
+
{
|
112
|
+
name: input.name,
|
113
|
+
label: input.title,
|
114
|
+
description: input.description,
|
115
|
+
value: session_data_repo.load(test_session_id: test_session.id, name: input.name, type: input.type),
|
116
|
+
type: input.type
|
117
|
+
}
|
118
|
+
end
|
119
|
+
|
110
120
|
results = []
|
111
121
|
group.children.each do |child|
|
112
122
|
result = run(child, scratch)
|
@@ -116,7 +126,8 @@ module Inferno
|
|
116
126
|
|
117
127
|
results.flatten!
|
118
128
|
|
119
|
-
group_result = persist_result(group.reference_hash.merge(result: roll_up_result(results)
|
129
|
+
group_result = persist_result(group.reference_hash.merge(result: roll_up_result(results),
|
130
|
+
input_json: JSON.generate(group_inputs_with_values)))
|
120
131
|
|
121
132
|
update_parent_result(group.parent)
|
122
133
|
|
@@ -153,6 +164,17 @@ module Inferno
|
|
153
164
|
end
|
154
165
|
end
|
155
166
|
|
167
|
+
def inputs_as_json(runnable, input_values)
|
168
|
+
inputs_array = runnable.inputs.map do |input_identifier|
|
169
|
+
{
|
170
|
+
name: runnable.config.input_name(input_identifier),
|
171
|
+
value: input_values[input_identifier],
|
172
|
+
type: runnable.config.input_type(input_identifier)
|
173
|
+
}
|
174
|
+
end
|
175
|
+
JSON.generate(inputs_array)
|
176
|
+
end
|
177
|
+
|
156
178
|
def save_outputs(runnable_instance)
|
157
179
|
outputs =
|
158
180
|
runnable_instance.outputs_to_persist.map do |output_identifier, value|
|
@@ -7,17 +7,16 @@ module Inferno
|
|
7
7
|
self.runnable = runnable
|
8
8
|
end
|
9
9
|
|
10
|
-
def
|
11
|
-
@
|
10
|
+
def available_inputs
|
11
|
+
@available_inputs ||= runnable.available_inputs.transform_values(&:to_hash)
|
12
12
|
end
|
13
13
|
|
14
14
|
def inputs
|
15
15
|
# The rubocop rule is disabled because `each_value` returns the hash,
|
16
16
|
# while `values.each` will return the array of values. We want the array
|
17
17
|
# of values here.
|
18
|
-
|
19
|
-
|
20
|
-
(input_definition.delete(:default) if input_definition.key? :default)
|
18
|
+
available_inputs.values.each do |input| # rubocop:disable Style/HashEachMethods
|
19
|
+
input[:value] = (input.delete(:default) if input.key? :default)
|
21
20
|
end
|
22
21
|
end
|
23
22
|
|
data/lib/inferno/version.rb
CHANGED
data/spec/factories/result.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inferno_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen MacVicar
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2022-
|
13
|
+
date: 2022-04-12 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -520,6 +520,7 @@ files:
|
|
520
520
|
- lib/inferno/dsl/fhir_validation.rb
|
521
521
|
- lib/inferno/dsl/http_client.rb
|
522
522
|
- lib/inferno/dsl/http_client_builder.rb
|
523
|
+
- lib/inferno/dsl/input_output_handling.rb
|
523
524
|
- lib/inferno/dsl/oauth_credentials.rb
|
524
525
|
- lib/inferno/dsl/request_storage.rb
|
525
526
|
- lib/inferno/dsl/results.rb
|
@@ -530,6 +531,7 @@ files:
|
|
530
531
|
- lib/inferno/entities/entity.rb
|
531
532
|
- lib/inferno/entities/has_runnable.rb
|
532
533
|
- lib/inferno/entities/header.rb
|
534
|
+
- lib/inferno/entities/input.rb
|
533
535
|
- lib/inferno/entities/message.rb
|
534
536
|
- lib/inferno/entities/preset.rb
|
535
537
|
- lib/inferno/entities/request.rb
|
@@ -542,6 +544,7 @@ files:
|
|
542
544
|
- lib/inferno/entities/test_suite.rb
|
543
545
|
- lib/inferno/exceptions.rb
|
544
546
|
- lib/inferno/ext/fhir_client.rb
|
547
|
+
- lib/inferno/ext/fhir_models.rb
|
545
548
|
- lib/inferno/jobs.rb
|
546
549
|
- lib/inferno/jobs/execute_test_run.rb
|
547
550
|
- lib/inferno/jobs/resume_test_run.rb
|
@@ -588,13 +591,13 @@ files:
|
|
588
591
|
- spec/fixtures/basic_test_group.rb
|
589
592
|
- spec/fixtures/basic_test_suite.rb
|
590
593
|
- spec/support/factory_bot.rb
|
591
|
-
homepage: https://github.com/
|
594
|
+
homepage: https://github.com/inferno-framework/inferno-core
|
592
595
|
licenses:
|
593
596
|
- Apache-2.0
|
594
597
|
metadata:
|
595
|
-
homepage_uri: https://github.com/
|
596
|
-
source_code_uri: https://github.com/
|
597
|
-
changelog_uri: https://github.com/
|
598
|
+
homepage_uri: https://github.com/inferno-framework/inferno-core
|
599
|
+
source_code_uri: https://github.com/inferno-framework/inferno-core
|
600
|
+
changelog_uri: https://github.com/inferno-framework/inferno-core/blob/main/CHANGELOG.md
|
598
601
|
post_install_message:
|
599
602
|
rdoc_options: []
|
600
603
|
require_paths:
|
@@ -607,9 +610,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
607
610
|
version: 2.7.0
|
608
611
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
609
612
|
requirements:
|
610
|
-
- - "
|
613
|
+
- - ">="
|
611
614
|
- !ruby/object:Gem::Version
|
612
|
-
version:
|
615
|
+
version: '0'
|
613
616
|
requirements: []
|
614
617
|
rubygems_version: 3.1.6
|
615
618
|
signing_key:
|