canql 5.0.0 → 5.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/code_safety.yml +7 -7
- data/lib/canql/grammars/main.treetop +2 -2
- data/lib/canql/grammars/test_result_group.treetop +12 -0
- data/lib/canql/nodes/main.rb +27 -16
- data/lib/canql/nodes/test_result_group.rb +35 -0
- data/lib/canql/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7388b9b6f880c7c55b4db80358ff06f5ac5753f70f70aae5e4791b3ad2f886d9
|
4
|
+
data.tar.gz: 44c1a08147f5d7eee119242432184238388af321f311149cf498550e417af5fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e0eec913600a18381b348c94a466ebc2ef3f8d1a92b505be0975bd77adc63781f54d63f18b7a7c890e0dcea2f3e83303d963fc767e78ee0d1287e4690f59090
|
7
|
+
data.tar.gz: e0ffb6f335045c5238a3b42c4469504cc6a24eaa4eff90e9f9fa217e0e76f9f06d53c6f98572302cfd8737626f4a558afae93408938c64f1e1f6aa0b7bf7f05a
|
data/CHANGELOG.md
CHANGED
data/code_safety.yml
CHANGED
@@ -27,7 +27,7 @@ file safety:
|
|
27
27
|
CHANGELOG.md:
|
28
28
|
comments:
|
29
29
|
reviewed_by: josh.pencheon
|
30
|
-
safe_revision:
|
30
|
+
safe_revision: aea0d1a480e886a63b723135c7381cdcee0d4b25
|
31
31
|
CODE_OF_CONDUCT.md:
|
32
32
|
comments:
|
33
33
|
reviewed_by: drewthorp
|
@@ -103,7 +103,7 @@ file safety:
|
|
103
103
|
comments: It is a known issue that this is potentially susceptible to certain
|
104
104
|
kinds of DoS attack
|
105
105
|
reviewed_by: josh.pencheon
|
106
|
-
safe_revision:
|
106
|
+
safe_revision: 9bb663b220e76e78f3f0f48e4bc6334fe9451925
|
107
107
|
lib/canql/grammars/patient.treetop:
|
108
108
|
comments: It is a known issue that this is potentially susceptible to certain
|
109
109
|
kinds of DoS attack
|
@@ -130,7 +130,7 @@ file safety:
|
|
130
130
|
lib/canql/grammars/test_result_group.treetop:
|
131
131
|
comments:
|
132
132
|
reviewed_by: josh.pencheon
|
133
|
-
safe_revision:
|
133
|
+
safe_revision: 9bb663b220e76e78f3f0f48e4bc6334fe9451925
|
134
134
|
lib/canql/nodes.rb:
|
135
135
|
comments:
|
136
136
|
reviewed_by: josh.pencheon
|
@@ -162,7 +162,7 @@ file safety:
|
|
162
162
|
lib/canql/nodes/main.rb:
|
163
163
|
comments:
|
164
164
|
reviewed_by: josh.pencheon
|
165
|
-
safe_revision:
|
165
|
+
safe_revision: 361dea5dc6d64bdb7b03434dd2878f8c3b128c95
|
166
166
|
lib/canql/nodes/patient.rb:
|
167
167
|
comments:
|
168
168
|
reviewed_by: josh.pencheon
|
@@ -182,7 +182,7 @@ file safety:
|
|
182
182
|
lib/canql/nodes/test_result_group.rb:
|
183
183
|
comments:
|
184
184
|
reviewed_by: josh.pencheon
|
185
|
-
safe_revision:
|
185
|
+
safe_revision: 9bb663b220e76e78f3f0f48e4bc6334fe9451925
|
186
186
|
lib/canql/parser.rb:
|
187
187
|
comments:
|
188
188
|
reviewed_by: timgentry
|
@@ -194,7 +194,7 @@ file safety:
|
|
194
194
|
lib/canql/version.rb:
|
195
195
|
comments:
|
196
196
|
reviewed_by: josh.pencheon
|
197
|
-
safe_revision:
|
197
|
+
safe_revision: aea0d1a480e886a63b723135c7381cdcee0d4b25
|
198
198
|
test/anomaly_test_helper.rb:
|
199
199
|
comments:
|
200
200
|
reviewed_by: josh.pencheon
|
@@ -262,7 +262,7 @@ file safety:
|
|
262
262
|
test/nodes/test_result_groups_test.rb:
|
263
263
|
comments:
|
264
264
|
reviewed_by: josh.pencheon
|
265
|
-
safe_revision:
|
265
|
+
safe_revision: 9bb663b220e76e78f3f0f48e4bc6334fe9451925
|
266
266
|
test/nodes/test_results_test.rb:
|
267
267
|
comments:
|
268
268
|
reviewed_by: josh.pencheon
|
@@ -129,8 +129,8 @@ grammar Canql
|
|
129
129
|
|
130
130
|
rule case_with_conditions
|
131
131
|
anomalies / genetic_tests / test_results / perinatal_hospital /
|
132
|
-
case_field_existance /
|
133
|
-
action_or_ebr
|
132
|
+
case_field_existance / test_acceptance_existance / test_result_groups /
|
133
|
+
mother_conditions / action_or_ebr
|
134
134
|
end
|
135
135
|
|
136
136
|
rule patient_with_conditions
|
@@ -12,5 +12,17 @@ module Canql
|
|
12
12
|
rule test_result_group_names
|
13
13
|
space ('screening' / 'anomaly scan' / 'fetal medicine' / 'dating') word_break
|
14
14
|
end
|
15
|
+
|
16
|
+
rule test_acceptance_existance
|
17
|
+
and_keyword? existance_modifier:test_acceptance_existance_keyword acceptance:test_acceptance_names <Nodes::TestAcceptanceExistamce::WithCondition>
|
18
|
+
end
|
19
|
+
|
20
|
+
rule test_acceptance_existance_keyword
|
21
|
+
space ('missing required' / 'missing' ) word_break
|
22
|
+
end
|
23
|
+
|
24
|
+
rule test_acceptance_names
|
25
|
+
space ('screening acceptance status' / 'anomaly scan acceptance status' ) word_break
|
26
|
+
end
|
15
27
|
end
|
16
28
|
end
|
data/lib/canql/nodes/main.rb
CHANGED
@@ -29,27 +29,38 @@ module Canql #:nodoc: all
|
|
29
29
|
module WithConditions
|
30
30
|
def meta_data_item
|
31
31
|
conditions = {}
|
32
|
-
|
33
|
-
genetic_tests = []
|
34
|
-
test_results = []
|
35
|
-
test_result_groups = []
|
32
|
+
sub_clauses = build_sub_clauses
|
36
33
|
|
37
|
-
|
38
|
-
anomalies
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
test_result_groups << element.to_test_result_group
|
34
|
+
%i[
|
35
|
+
anomalies genetic_tests test_results test_result_groups test_acceptances
|
36
|
+
].each do |condition_key|
|
37
|
+
if sub_clauses[condition_key].present?
|
38
|
+
conditions[condition_key.to_s] = { Canql::ALL => sub_clauses[condition_key] }
|
43
39
|
end
|
44
40
|
end
|
41
|
+
conditions
|
42
|
+
end
|
45
43
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
44
|
+
def build_sub_clauses
|
45
|
+
sub_clauses = {}
|
46
|
+
|
47
|
+
post.elements.each do |element|
|
48
|
+
add_sub_clause(sub_clauses, element, :anomalies, :to_anomaly)
|
49
|
+
add_sub_clause(sub_clauses, element, :genetic_tests, :to_genetic_test)
|
50
|
+
add_sub_clause(sub_clauses, element, :test_results, :to_test_result)
|
51
|
+
add_sub_clause(
|
52
|
+
sub_clauses, element, :test_result_groups, :to_test_result_group
|
53
|
+
)
|
54
|
+
add_sub_clause(sub_clauses, element, :test_acceptances, :to_test_acceptance)
|
51
55
|
end
|
52
|
-
|
56
|
+
sub_clauses
|
57
|
+
end
|
58
|
+
|
59
|
+
def add_sub_clause(sub_clauses, element, key, condition)
|
60
|
+
return sub_clauses unless element.respond_to?(condition)
|
61
|
+
|
62
|
+
sub_clauses[key] ||= []
|
63
|
+
sub_clauses[key] << element.send(condition)
|
53
64
|
end
|
54
65
|
end
|
55
66
|
end
|
@@ -36,5 +36,40 @@ module Canql #:nodoc: all
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
39
|
+
|
40
|
+
module TestAcceptanceExistamce
|
41
|
+
module WithCondition
|
42
|
+
def test_acceptance
|
43
|
+
acceptance.text_value.strip.parameterize.underscore
|
44
|
+
end
|
45
|
+
|
46
|
+
def to_test_acceptance
|
47
|
+
test_acceptance_hash = { 'exists' => existance_filter }
|
48
|
+
test_acceptance_hash['required'] = requirement_filter
|
49
|
+
test_acceptance_hash['acceptance'] = test_acceptance_filter if test_acceptance.present?
|
50
|
+
test_acceptance_hash
|
51
|
+
end
|
52
|
+
|
53
|
+
def existance_filter
|
54
|
+
{
|
55
|
+
Canql::EQUALS => ['supplied required', 'supplied'].include?(
|
56
|
+
existance_modifier.text_value.strip
|
57
|
+
)
|
58
|
+
}
|
59
|
+
end
|
60
|
+
|
61
|
+
def requirement_filter
|
62
|
+
{
|
63
|
+
Canql::EQUALS => ['supplied required', 'missing required'].include?(
|
64
|
+
existance_modifier.text_value.strip
|
65
|
+
)
|
66
|
+
}
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_acceptance_filter
|
70
|
+
{ Canql::EQUALS => test_acceptance }
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
39
74
|
end
|
40
75
|
end
|
data/lib/canql/version.rb
CHANGED
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: 5.
|
4
|
+
version: 5.1.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: 2021-01-
|
11
|
+
date: 2021-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chronic
|