canql 4.3.0 → 4.4.0

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: 2b054c9d0f56e07afcd4521b2e56b23fc21647f419f9bef7f04104bd2544e3b5
4
- data.tar.gz: 48bf63bc902135454291778e23905535570bc5fd3019c13acb55709c9795e827
3
+ metadata.gz: 111a269a59bd7e152809bb8488f7f070b6f7fc74a12b0d154a5d88754c3c8cfa
4
+ data.tar.gz: 242095730ead9834f8f7a2a71ac5b662f07c7f031239f72b3aca329d550eb08d
5
5
  SHA512:
6
- metadata.gz: ad41792d7cfb4d5c79077ac53ca462e03cac72042095c51f41a03c53b92a01e3b16777e4f55d7c3167ab589be134cdf35547724a35b61b496bf9beb58f37ae1a
7
- data.tar.gz: ca725da517e80d207eaaed88a7128461bfdadc3a23e5754682e342367762d2dbc7d69ae9d1b462fc8529f7135a1486c90d57516882b972964642cacf8b265618
6
+ metadata.gz: adfa06b51ad500fb38a578c6cb82079daf699717c8d7f48fb1898edf71ca1031c249d81fc8eeba2013f0b8a7efbbb8cff12c7297c4d35ab27aefd6d1ff2487b3
7
+ data.tar.gz: ed4d2926c48c699b70a0c9a9c4ceff97e56eaf4a5c42e615b0368c0433623aee9efce6a4774b7e59fdbbd18f9d19a7e3fd26f5328080323ec82fed70617f802a
@@ -1,6 +1,10 @@
1
1
  ## [Unreleased]
2
2
  *no unreleased changes*
3
3
 
4
+ ## 4.4.0 / 2020-07-08
5
+ ### Added
6
+ * Added filter for missing and supplied required test result groups (#47)
7
+
4
8
  ## 4.3.0 / 2020-06-10
5
9
  ### Added
6
10
  * Added additional field existance options (#45)
@@ -19,7 +19,7 @@ file safety:
19
19
  CHANGELOG.md:
20
20
  comments:
21
21
  reviewed_by: josh.pencheon
22
- safe_revision: 23852bc731fdf82a87fd06070a89ec81affe8155
22
+ safe_revision: 7b5bc84b813b7ff156665a1a37cfe5dd5b53afe7
23
23
  CODE_OF_CONDUCT.md:
24
24
  comments:
25
25
  reviewed_by: drewthorp
@@ -63,7 +63,7 @@ file safety:
63
63
  lib/canql/grammars.rb:
64
64
  comments:
65
65
  reviewed_by: josh.pencheon
66
- safe_revision: c431b8a476b84d077e9c39a2a13c2b17a296773d
66
+ safe_revision: c5f8f76b2c335a8554f39a14d6165bf5cd8f9b67
67
67
  lib/canql/grammars/age.treetop:
68
68
  comments: It is a known issue that this is potentially susceptible to certain
69
69
  kinds of DoS attack
@@ -94,8 +94,8 @@ file safety:
94
94
  lib/canql/grammars/main.treetop:
95
95
  comments: It is a known issue that this is potentially susceptible to certain
96
96
  kinds of DoS attack
97
- reviewed_by: timgentry
98
- safe_revision: 05ccd47fcbba92bf5525c4d36118274696169d61
97
+ reviewed_by: josh.pencheon
98
+ safe_revision: 42bb9bd177a761b9d04d728e53fcf0ebd0083ae4
99
99
  lib/canql/grammars/patient.treetop:
100
100
  comments: It is a known issue that this is potentially susceptible to certain
101
101
  kinds of DoS attack
@@ -119,10 +119,14 @@ file safety:
119
119
  kinds of DoS attack
120
120
  reviewed_by: timgentry
121
121
  safe_revision: c39d24bb500719971969762e94545e82866bf92f
122
+ lib/canql/grammars/test_result_group.treetop:
123
+ comments:
124
+ reviewed_by: josh.pencheon
125
+ safe_revision: 42bb9bd177a761b9d04d728e53fcf0ebd0083ae4
122
126
  lib/canql/nodes.rb:
123
127
  comments:
124
128
  reviewed_by: josh.pencheon
125
- safe_revision: c431b8a476b84d077e9c39a2a13c2b17a296773d
129
+ safe_revision: c5f8f76b2c335a8554f39a14d6165bf5cd8f9b67
126
130
  lib/canql/nodes/age.rb:
127
131
  comments:
128
132
  reviewed_by: timgentry
@@ -150,7 +154,7 @@ file safety:
150
154
  lib/canql/nodes/main.rb:
151
155
  comments:
152
156
  reviewed_by: josh.pencheon
153
- safe_revision: 511e4238f83eb5b32839c25d94ec2a59145539bb
157
+ safe_revision: c5f8f76b2c335a8554f39a14d6165bf5cd8f9b67
154
158
  lib/canql/nodes/patient.rb:
155
159
  comments:
156
160
  reviewed_by: josh.pencheon
@@ -167,6 +171,10 @@ file safety:
167
171
  comments:
168
172
  reviewed_by: timgentry
169
173
  safe_revision: c39d24bb500719971969762e94545e82866bf92f
174
+ lib/canql/nodes/test_result_group.rb:
175
+ comments:
176
+ reviewed_by: josh.pencheon
177
+ safe_revision: 42bb9bd177a761b9d04d728e53fcf0ebd0083ae4
170
178
  lib/canql/parser.rb:
171
179
  comments:
172
180
  reviewed_by: timgentry
@@ -178,7 +186,7 @@ file safety:
178
186
  lib/canql/version.rb:
179
187
  comments:
180
188
  reviewed_by: josh.pencheon
181
- safe_revision: 23852bc731fdf82a87fd06070a89ec81affe8155
189
+ safe_revision: 7b5bc84b813b7ff156665a1a37cfe5dd5b53afe7
182
190
  test/anomaly_test_helper.rb:
183
191
  comments:
184
192
  reviewed_by: josh.pencheon
@@ -243,6 +251,10 @@ file safety:
243
251
  comments:
244
252
  reviewed_by: josh.pencheon
245
253
  safe_revision: 511e4238f83eb5b32839c25d94ec2a59145539bb
254
+ test/nodes/test_result_groups_test.rb:
255
+ comments:
256
+ reviewed_by: josh.pencheon
257
+ safe_revision: 42bb9bd177a761b9d04d728e53fcf0ebd0083ae4
246
258
  test/nodes/test_results_test.rb:
247
259
  comments:
248
260
  reviewed_by: josh.pencheon
@@ -254,4 +266,4 @@ file safety:
254
266
  test/test_helper.rb:
255
267
  comments:
256
268
  reviewed_by: josh.pencheon
257
- safe_revision: 511e4238f83eb5b32839c25d94ec2a59145539bb
269
+ safe_revision: 42bb9bd177a761b9d04d728e53fcf0ebd0083ae4
@@ -9,6 +9,7 @@ Treetop.load File.expand_path('grammars/batch_types', File.dirname(__FILE__))
9
9
  Treetop.load File.expand_path('grammars/e_base_records', File.dirname(__FILE__))
10
10
  Treetop.load File.expand_path('grammars/genetic_test', File.dirname(__FILE__))
11
11
  Treetop.load File.expand_path('grammars/test_result', File.dirname(__FILE__))
12
+ Treetop.load File.expand_path('grammars/test_result_group', File.dirname(__FILE__))
12
13
  Treetop.load File.expand_path('grammars/patient', File.dirname(__FILE__))
13
14
  Treetop.load File.expand_path('grammars/registry', File.dirname(__FILE__))
14
15
  Treetop.load File.expand_path('grammars/provider', File.dirname(__FILE__))
@@ -5,6 +5,7 @@ grammar Canql
5
5
  include Anomaly
6
6
  include GeneticTest
7
7
  include TestResult
8
+ include TestResultGroup
8
9
  include Dates
9
10
  include EBaseRecords
10
11
  include BatchTypes
@@ -127,7 +128,9 @@ grammar Canql
127
128
  end
128
129
 
129
130
  rule case_with_conditions
130
- anomalies / genetic_tests / test_results / perinatal_hospital / case_field_existance / mother_conditions / action_or_ebr
131
+ anomalies / genetic_tests / test_results / perinatal_hospital /
132
+ case_field_existance / test_result_groups / mother_conditions /
133
+ action_or_ebr
131
134
  end
132
135
 
133
136
  rule patient_with_conditions
@@ -0,0 +1,16 @@
1
+ module Canql
2
+ grammar TestResultGroup
3
+ rule test_result_groups
4
+ and_keyword? existance_modifier:test_result_group_existance_keyword group:test_result_group_names <Nodes::TestResultGroup::WithCondition>
5
+ end
6
+
7
+ rule test_result_group_existance_keyword
8
+ # If in furture the reverse is needed use 'supplied require'
9
+ space ('missing required' / 'missing' / 'supplied required' / 'supplied') word_break
10
+ end
11
+
12
+ rule test_result_group_names
13
+ space ('screening' / 'anomaly scan') word_break
14
+ end
15
+ end
16
+ end
@@ -17,6 +17,7 @@ require 'canql/nodes/batch_types'
17
17
  require 'canql/nodes/anomaly'
18
18
  require 'canql/nodes/genetic_test'
19
19
  require 'canql/nodes/test_result'
20
+ require 'canql/nodes/test_result_group'
20
21
  require 'canql/nodes/patient'
21
22
  require 'canql/nodes/main'
22
23
  require 'canql/nodes/registry'
@@ -32,16 +32,23 @@ module Canql #:nodoc: all
32
32
  anomalies = []
33
33
  genetic_tests = []
34
34
  test_results = []
35
+ test_result_groups = []
35
36
 
36
37
  post.elements.each do |element|
37
38
  anomalies << element.to_anomaly if element.respond_to?(:to_anomaly)
38
39
  genetic_tests << element.to_genetic_test if element.respond_to?(:to_genetic_test)
39
40
  test_results << element.to_test_result if element.respond_to?(:to_test_result)
41
+ if element.respond_to?(:to_test_result_group)
42
+ test_result_groups << element.to_test_result_group
43
+ end
40
44
  end
41
45
 
42
46
  conditions['anomalies'] = { Canql::ALL => anomalies } if anomalies.any?
43
47
  conditions['genetic_tests'] = { Canql::ALL => genetic_tests } if genetic_tests.any?
44
48
  conditions['test_results'] = { Canql::ALL => test_results } if test_results.any?
49
+ if test_result_groups.any?
50
+ conditions['test_result_groups'] = { Canql::ALL => test_result_groups }
51
+ end
45
52
  conditions
46
53
  end
47
54
  end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Canql #:nodoc: all
4
+ module Nodes
5
+ module TestResultGroup
6
+ module WithCondition
7
+ def test_result_group
8
+ group.text_value.strip.parameterize.underscore
9
+ end
10
+
11
+ def to_test_result_group
12
+ test_result_group_hash = { 'exists' => existance_filter }
13
+ test_result_group_hash['required'] = requirement_filter
14
+ test_result_group_hash['group'] = test_result_group_filter if test_result_group.present?
15
+ test_result_group_hash
16
+ end
17
+
18
+ def existance_filter
19
+ {
20
+ Canql::EQUALS => ['supplied required', 'supplied'].include?(
21
+ existance_modifier.text_value.strip
22
+ )
23
+ }
24
+ end
25
+
26
+ def requirement_filter
27
+ {
28
+ Canql::EQUALS => ['supplied required', 'missing required'].include?(
29
+ existance_modifier.text_value.strip
30
+ )
31
+ }
32
+ end
33
+
34
+ def test_result_group_filter
35
+ { Canql::EQUALS => test_result_group }
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -2,5 +2,5 @@
2
2
 
3
3
  # This stores the current version of the Canql gem
4
4
  module Canql
5
- VERSION = '4.3.0'
5
+ VERSION = '4.4.0'
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: canql
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.0
4
+ version: 4.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - PHE NDR Development Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-10 00:00:00.000000000 Z
11
+ date: 2020-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chronic
@@ -238,6 +238,7 @@ files:
238
238
  - lib/canql/grammars/provider.treetop
239
239
  - lib/canql/grammars/registry.treetop
240
240
  - lib/canql/grammars/test_result.treetop
241
+ - lib/canql/grammars/test_result_group.treetop
241
242
  - lib/canql/nodes.rb
242
243
  - lib/canql/nodes/age.rb
243
244
  - lib/canql/nodes/anomaly.rb
@@ -250,6 +251,7 @@ files:
250
251
  - lib/canql/nodes/perinatal_hospital.rb
251
252
  - lib/canql/nodes/registry.rb
252
253
  - lib/canql/nodes/test_result.rb
254
+ - lib/canql/nodes/test_result_group.rb
253
255
  - lib/canql/parser.rb
254
256
  - lib/canql/treetop/extensions.rb
255
257
  - lib/canql/version.rb