canql 4.1.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/CODEOWNERS +2 -0
- data/.github/workflows/lint.yml +23 -0
- data/.github/workflows/test.yml +65 -0
- data/.rubocop.yml +1 -11
- data/CHANGELOG.md +25 -0
- data/README.md +2 -2
- data/canql.gemspec +2 -2
- data/code_safety.yml +51 -31
- data/lib/canql/grammars.rb +1 -0
- data/lib/canql/grammars/main.treetop +4 -1
- data/lib/canql/grammars/patient.treetop +7 -5
- data/lib/canql/grammars/registry.treetop +41 -13
- data/lib/canql/grammars/test_result_group.treetop +16 -0
- data/lib/canql/nodes.rb +1 -0
- data/lib/canql/nodes/main.rb +7 -0
- data/lib/canql/nodes/patient.rb +19 -12
- data/lib/canql/nodes/test_result_group.rb +40 -0
- data/lib/canql/version.rb +1 -1
- metadata +11 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 99a2f7ebbb5ae3c1cbdd8368b020f8eb7c54d969278db3bdd90277f113095ce9
|
|
4
|
+
data.tar.gz: fb4f6561d61cc9da30dd9a30562c7374a95e52d615b014bc16e5e282529c4975
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 93cc26e76a35a5b47600368d7208f81c6cd6457c416f942be852536952d54b9a1bbcb49df7c17f95fb09b5bdaa4581fda91b70e36ad229aae5213914d9d7db39
|
|
7
|
+
data.tar.gz: 2a8bf966e8a0b93411117a09f790f20825c6b27850f1903cea53fd636855d920ec4fdc5dc9bb903b11ec0c2e34275af88ca2e49e4c09b3ea206a6ff2620d626b
|
data/.github/CODEOWNERS
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
name: Lint
|
|
2
|
+
|
|
3
|
+
on: [pull_request]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
rubocop:
|
|
7
|
+
name: RuboCop
|
|
8
|
+
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v2
|
|
13
|
+
with:
|
|
14
|
+
fetch-depth: 0 # fetch everything
|
|
15
|
+
- name: Set up Ruby
|
|
16
|
+
uses: ruby/setup-ruby@v1
|
|
17
|
+
with:
|
|
18
|
+
ruby-version: 3.0
|
|
19
|
+
- name: Install dependencies
|
|
20
|
+
run: bundle install
|
|
21
|
+
- name: Run RuboCop against BASE..HEAD changes
|
|
22
|
+
run: bundle exec rake rubocop:diff origin/${GITHUB_BASE_REF#*/}
|
|
23
|
+
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
|
|
3
|
+
on: [push, pull_request]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
test:
|
|
7
|
+
strategy:
|
|
8
|
+
matrix:
|
|
9
|
+
ruby-version:
|
|
10
|
+
- 2.6
|
|
11
|
+
- 2.7
|
|
12
|
+
- 3.0
|
|
13
|
+
|
|
14
|
+
name: Ruby ${{ matrix.ruby-version }}
|
|
15
|
+
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v2
|
|
20
|
+
- name: Set up Ruby
|
|
21
|
+
uses: ruby/setup-ruby@v1
|
|
22
|
+
with:
|
|
23
|
+
ruby-version: ${{ matrix.ruby-version }}
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: bundle install
|
|
26
|
+
- name: Run tests
|
|
27
|
+
run: bundle exec rake
|
|
28
|
+
|
|
29
|
+
# A utility job upon which Branch Protection can depend,
|
|
30
|
+
# thus remaining agnostic of the matrix.
|
|
31
|
+
test_matrix:
|
|
32
|
+
if: ${{ always() }}
|
|
33
|
+
runs-on: ubuntu-latest
|
|
34
|
+
name: Matrix
|
|
35
|
+
needs: test
|
|
36
|
+
steps:
|
|
37
|
+
- name: Check build matrix status
|
|
38
|
+
if: ${{ needs.test.result != 'success' }}
|
|
39
|
+
run: exit 1
|
|
40
|
+
|
|
41
|
+
notify:
|
|
42
|
+
# Run only on master, but regardless of whether tests past:
|
|
43
|
+
if: ${{ always() && github.ref == 'refs/heads/master' }}
|
|
44
|
+
|
|
45
|
+
needs: test_matrix
|
|
46
|
+
|
|
47
|
+
runs-on: ubuntu-latest
|
|
48
|
+
|
|
49
|
+
steps:
|
|
50
|
+
- uses: 8398a7/action-slack@v3
|
|
51
|
+
with:
|
|
52
|
+
status: custom
|
|
53
|
+
fields: workflow,commit,author
|
|
54
|
+
custom_payload: |
|
|
55
|
+
{
|
|
56
|
+
channel: 'C7FQWGDHP',
|
|
57
|
+
username: 'CI – ' + '${{ github.repository }}'.split('/')[1],
|
|
58
|
+
icon_emoji: ':hammer_and_wrench:',
|
|
59
|
+
attachments: [{
|
|
60
|
+
color: '${{ needs.test_matrix.result }}' === 'success' ? 'good' : '${{ needs.test_matrix.result }}' === 'failure' ? 'danger' : 'warning',
|
|
61
|
+
text: `${process.env.AS_WORKFLOW} against \`${{ github.ref }}\` (${process.env.AS_COMMIT}) for ${{ github.actor }} resulted in *${{ needs.test_matrix.result }}*.`
|
|
62
|
+
}]
|
|
63
|
+
}
|
|
64
|
+
env:
|
|
65
|
+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
data/.rubocop.yml
CHANGED
|
@@ -1,11 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Rails:
|
|
4
|
-
Enabled: false
|
|
5
|
-
|
|
6
|
-
AllCops:
|
|
7
|
-
TargetRailsVersion: 4.2
|
|
8
|
-
TargetRubyVersion: 2.3
|
|
9
|
-
|
|
10
|
-
Style/FrozenStringLiteralComment:
|
|
11
|
-
Enabled: true
|
|
1
|
+
require: ndr_dev_support
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
*no unreleased changes*
|
|
3
3
|
|
|
4
|
+
## 5.0.0 / 2021-01-19
|
|
5
|
+
|
|
6
|
+
### Changed
|
|
7
|
+
* Changed the values of registry to use registry name rather than codes and added new supra-region options (#54)
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
* Added fetal medicine and dating options to the test group filter (#50)
|
|
11
|
+
* Added new gestation at delivery and booking date to case field existance filter (#52)
|
|
12
|
+
|
|
13
|
+
## 4.4.1 / 2021-01-13
|
|
14
|
+
### Fixed
|
|
15
|
+
* Relax constraints to support Rails 6.x
|
|
16
|
+
|
|
17
|
+
## 4.4.0 / 2020-07-08
|
|
18
|
+
### Added
|
|
19
|
+
* Added filter for missing and supplied required test result groups (#47)
|
|
20
|
+
|
|
21
|
+
## 4.3.0 / 2020-06-10
|
|
22
|
+
### Added
|
|
23
|
+
* Added additional field existance options (#45)
|
|
24
|
+
|
|
25
|
+
## 4.2.0 / 2020-03-25
|
|
26
|
+
### Added
|
|
27
|
+
* Added additional EUROCAT category filters for RAG combination
|
|
28
|
+
|
|
4
29
|
## 4.1.0 / 2020-03-19
|
|
5
30
|
### Added
|
|
6
31
|
* Added filters for EUROCAT RAG rating (#39)
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# CANQL [](https://github.com/publichealthengland/canql/actions?query=workflow%3Atest) [](https://rubygems.org/gems/canql)
|
|
2
2
|
|
|
3
|
-
Congenital Anomaly Natural Query Language (CANQL) is a [Treetop](http://treetop.rubyforge.org/)
|
|
3
|
+
Congenital Anomaly Natural Query Language (CANQL) is a [Treetop](http://treetop.rubyforge.org/)-driven Domain Specific Language (DSL) used by the Public Health England (PHE) National Congenital Anomaly and Rare Disease Registration Service (NCARDRS) to identify cohorts of cases.
|
|
4
4
|
|
|
5
5
|
Used for analysis, research and day-to-day operations to empower non-technical users to write sophisticated human readable queries without the need to know or understand the underlying datastore and/or schema.
|
|
6
6
|
|
data/canql.gemspec
CHANGED
|
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
|
|
|
28
28
|
|
|
29
29
|
spec.add_dependency 'chronic', '~> 0.3'
|
|
30
30
|
spec.add_dependency 'ndr_support', '>= 3.0', '< 6'
|
|
31
|
-
spec.add_dependency 'rails', '>= 4.1', '<
|
|
31
|
+
spec.add_dependency 'rails', '>= 4.1', '< 7'
|
|
32
32
|
spec.add_dependency 'treetop', '>= 1.4.10'
|
|
33
33
|
|
|
34
34
|
spec.add_development_dependency 'bundler'
|
|
@@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
|
|
|
36
36
|
spec.add_development_dependency 'guard-minitest'
|
|
37
37
|
spec.add_development_dependency 'guard-rubocop'
|
|
38
38
|
spec.add_development_dependency 'minitest'
|
|
39
|
-
spec.add_development_dependency 'ndr_dev_support', '~> 5.
|
|
39
|
+
spec.add_development_dependency 'ndr_dev_support', '~> 5.9'
|
|
40
40
|
spec.add_development_dependency 'pry'
|
|
41
41
|
spec.add_development_dependency 'rake'
|
|
42
42
|
spec.add_development_dependency 'terminal-notifier-guard' if RUBY_PLATFORM =~ /darwin/
|
data/code_safety.yml
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
---
|
|
2
2
|
file safety:
|
|
3
|
+
".github/CODEOWNERS":
|
|
4
|
+
comments:
|
|
5
|
+
reviewed_by: josh.pencheon
|
|
6
|
+
safe_revision: a964c47962d47724afd66ba59660589fc3c8b02c
|
|
7
|
+
".github/workflows/lint.yml":
|
|
8
|
+
comments:
|
|
9
|
+
reviewed_by: josh.pencheon
|
|
10
|
+
safe_revision: 71f6a631758a5a38814d3eafec407e0fde30101f
|
|
11
|
+
".github/workflows/test.yml":
|
|
12
|
+
comments:
|
|
13
|
+
reviewed_by: josh.pencheon
|
|
14
|
+
safe_revision: 865fc970554fee9207f8e3cd0247133c6a849b24
|
|
3
15
|
".gitignore":
|
|
4
16
|
comments:
|
|
5
17
|
reviewed_by: timgentry
|
|
@@ -9,17 +21,13 @@ file safety:
|
|
|
9
21
|
reviewed_by: timgentry
|
|
10
22
|
safe_revision: 0b34688f1198eace9310f47060aa8915f5b44985
|
|
11
23
|
".rubocop.yml":
|
|
12
|
-
comments:
|
|
13
|
-
reviewed_by: timgentry
|
|
14
|
-
safe_revision: 5bc563431f7822e2baf37bbeac9861c36675602d
|
|
15
|
-
".travis.yml":
|
|
16
24
|
comments:
|
|
17
25
|
reviewed_by: josh.pencheon
|
|
18
|
-
safe_revision:
|
|
26
|
+
safe_revision: 146b255b240b0efc928d39dd1b70ab221ddc3138
|
|
19
27
|
CHANGELOG.md:
|
|
20
28
|
comments:
|
|
21
|
-
reviewed_by:
|
|
22
|
-
safe_revision:
|
|
29
|
+
reviewed_by: josh.pencheon
|
|
30
|
+
safe_revision: f84cb2190f46ee550db796a17455980ab00d3187
|
|
23
31
|
CODE_OF_CONDUCT.md:
|
|
24
32
|
comments:
|
|
25
33
|
reviewed_by: drewthorp
|
|
@@ -35,7 +43,7 @@ file safety:
|
|
|
35
43
|
README.md:
|
|
36
44
|
comments:
|
|
37
45
|
reviewed_by: josh.pencheon
|
|
38
|
-
safe_revision:
|
|
46
|
+
safe_revision: 8c07968aa84db92b6f1cc528180f73530ddc6ff5
|
|
39
47
|
Rakefile:
|
|
40
48
|
comments:
|
|
41
49
|
reviewed_by: timgentry
|
|
@@ -50,8 +58,8 @@ file safety:
|
|
|
50
58
|
safe_revision: 6a666fcabe027056b1c774b2eabb3fdf686911d2
|
|
51
59
|
canql.gemspec:
|
|
52
60
|
comments:
|
|
53
|
-
reviewed_by:
|
|
54
|
-
safe_revision:
|
|
61
|
+
reviewed_by: josh.pencheon
|
|
62
|
+
safe_revision: 146b255b240b0efc928d39dd1b70ab221ddc3138
|
|
55
63
|
lib/canql.rb:
|
|
56
64
|
comments:
|
|
57
65
|
reviewed_by: timgentry
|
|
@@ -63,7 +71,7 @@ file safety:
|
|
|
63
71
|
lib/canql/grammars.rb:
|
|
64
72
|
comments:
|
|
65
73
|
reviewed_by: josh.pencheon
|
|
66
|
-
safe_revision:
|
|
74
|
+
safe_revision: c5f8f76b2c335a8554f39a14d6165bf5cd8f9b67
|
|
67
75
|
lib/canql/grammars/age.treetop:
|
|
68
76
|
comments: It is a known issue that this is potentially susceptible to certain
|
|
69
77
|
kinds of DoS attack
|
|
@@ -94,13 +102,13 @@ file safety:
|
|
|
94
102
|
lib/canql/grammars/main.treetop:
|
|
95
103
|
comments: It is a known issue that this is potentially susceptible to certain
|
|
96
104
|
kinds of DoS attack
|
|
97
|
-
reviewed_by:
|
|
98
|
-
safe_revision:
|
|
105
|
+
reviewed_by: josh.pencheon
|
|
106
|
+
safe_revision: 42bb9bd177a761b9d04d728e53fcf0ebd0083ae4
|
|
99
107
|
lib/canql/grammars/patient.treetop:
|
|
100
108
|
comments: It is a known issue that this is potentially susceptible to certain
|
|
101
109
|
kinds of DoS attack
|
|
102
|
-
reviewed_by:
|
|
103
|
-
safe_revision:
|
|
110
|
+
reviewed_by: josh.pencheon
|
|
111
|
+
safe_revision: 7490099869e368dcd5c26ded11eb90229baf4cae
|
|
104
112
|
lib/canql/grammars/perinatal_hospital.treetop:
|
|
105
113
|
comments:
|
|
106
114
|
reviewed_by: josh.pencheon
|
|
@@ -113,16 +121,20 @@ file safety:
|
|
|
113
121
|
comments: It is a known issue that this is potentially susceptible to certain
|
|
114
122
|
kinds of DoS attack
|
|
115
123
|
reviewed_by: josh.pencheon
|
|
116
|
-
safe_revision:
|
|
124
|
+
safe_revision: 293248a17d087d7557a6aacdcb5bf3fbec946b87
|
|
117
125
|
lib/canql/grammars/test_result.treetop:
|
|
118
126
|
comments: It is a known issue that this is potentially susceptible to certain
|
|
119
127
|
kinds of DoS attack
|
|
120
128
|
reviewed_by: timgentry
|
|
121
129
|
safe_revision: c39d24bb500719971969762e94545e82866bf92f
|
|
130
|
+
lib/canql/grammars/test_result_group.treetop:
|
|
131
|
+
comments:
|
|
132
|
+
reviewed_by: josh.pencheon
|
|
133
|
+
safe_revision: 8ea906ca663b98edee2592fc5b0731881573f06b
|
|
122
134
|
lib/canql/nodes.rb:
|
|
123
135
|
comments:
|
|
124
136
|
reviewed_by: josh.pencheon
|
|
125
|
-
safe_revision:
|
|
137
|
+
safe_revision: c5f8f76b2c335a8554f39a14d6165bf5cd8f9b67
|
|
126
138
|
lib/canql/nodes/age.rb:
|
|
127
139
|
comments:
|
|
128
140
|
reviewed_by: timgentry
|
|
@@ -150,11 +162,11 @@ file safety:
|
|
|
150
162
|
lib/canql/nodes/main.rb:
|
|
151
163
|
comments:
|
|
152
164
|
reviewed_by: josh.pencheon
|
|
153
|
-
safe_revision:
|
|
165
|
+
safe_revision: c5f8f76b2c335a8554f39a14d6165bf5cd8f9b67
|
|
154
166
|
lib/canql/nodes/patient.rb:
|
|
155
167
|
comments:
|
|
156
|
-
reviewed_by:
|
|
157
|
-
safe_revision:
|
|
168
|
+
reviewed_by: josh.pencheon
|
|
169
|
+
safe_revision: 7490099869e368dcd5c26ded11eb90229baf4cae
|
|
158
170
|
lib/canql/nodes/perinatal_hospital.rb:
|
|
159
171
|
comments:
|
|
160
172
|
reviewed_by: josh.pencheon
|
|
@@ -167,6 +179,10 @@ file safety:
|
|
|
167
179
|
comments:
|
|
168
180
|
reviewed_by: timgentry
|
|
169
181
|
safe_revision: c39d24bb500719971969762e94545e82866bf92f
|
|
182
|
+
lib/canql/nodes/test_result_group.rb:
|
|
183
|
+
comments:
|
|
184
|
+
reviewed_by: josh.pencheon
|
|
185
|
+
safe_revision: 42bb9bd177a761b9d04d728e53fcf0ebd0083ae4
|
|
170
186
|
lib/canql/parser.rb:
|
|
171
187
|
comments:
|
|
172
188
|
reviewed_by: timgentry
|
|
@@ -177,8 +193,8 @@ file safety:
|
|
|
177
193
|
safe_revision: 6932d590299ad4a9d2ba24b425b158c67142bf74
|
|
178
194
|
lib/canql/version.rb:
|
|
179
195
|
comments:
|
|
180
|
-
reviewed_by:
|
|
181
|
-
safe_revision:
|
|
196
|
+
reviewed_by: josh.pencheon
|
|
197
|
+
safe_revision: cfe2f76a07880e268e1f29fbac5f6cd380202ce3
|
|
182
198
|
test/anomaly_test_helper.rb:
|
|
183
199
|
comments:
|
|
184
200
|
reviewed_by: josh.pencheon
|
|
@@ -201,8 +217,8 @@ file safety:
|
|
|
201
217
|
safe_revision: 511e4238f83eb5b32839c25d94ec2a59145539bb
|
|
202
218
|
test/nodes/case_test.rb:
|
|
203
219
|
comments:
|
|
204
|
-
reviewed_by:
|
|
205
|
-
safe_revision:
|
|
220
|
+
reviewed_by: josh.pencheon
|
|
221
|
+
safe_revision: 7490099869e368dcd5c26ded11eb90229baf4cae
|
|
206
222
|
test/nodes/code_test.rb:
|
|
207
223
|
comments:
|
|
208
224
|
reviewed_by: josh.pencheon
|
|
@@ -210,7 +226,7 @@ file safety:
|
|
|
210
226
|
test/nodes/e_base_records_test.rb:
|
|
211
227
|
comments:
|
|
212
228
|
reviewed_by: josh.pencheon
|
|
213
|
-
safe_revision:
|
|
229
|
+
safe_revision: 293248a17d087d7557a6aacdcb5bf3fbec946b87
|
|
214
230
|
test/nodes/genetic_tests_test.rb:
|
|
215
231
|
comments:
|
|
216
232
|
reviewed_by: josh.pencheon
|
|
@@ -233,8 +249,8 @@ file safety:
|
|
|
233
249
|
safe_revision: 511e4238f83eb5b32839c25d94ec2a59145539bb
|
|
234
250
|
test/nodes/patient_test.rb:
|
|
235
251
|
comments:
|
|
236
|
-
reviewed_by:
|
|
237
|
-
safe_revision:
|
|
252
|
+
reviewed_by: josh.pencheon
|
|
253
|
+
safe_revision: 43425805d9ad4a99e63eeb5d50495fa14eaa053b
|
|
238
254
|
test/nodes/perinatal_hospital_test.rb:
|
|
239
255
|
comments:
|
|
240
256
|
reviewed_by: josh.pencheon
|
|
@@ -242,16 +258,20 @@ file safety:
|
|
|
242
258
|
test/nodes/registry_test.rb:
|
|
243
259
|
comments:
|
|
244
260
|
reviewed_by: josh.pencheon
|
|
245
|
-
safe_revision:
|
|
261
|
+
safe_revision: 293248a17d087d7557a6aacdcb5bf3fbec946b87
|
|
262
|
+
test/nodes/test_result_groups_test.rb:
|
|
263
|
+
comments:
|
|
264
|
+
reviewed_by: josh.pencheon
|
|
265
|
+
safe_revision: 8ea906ca663b98edee2592fc5b0731881573f06b
|
|
246
266
|
test/nodes/test_results_test.rb:
|
|
247
267
|
comments:
|
|
248
268
|
reviewed_by: josh.pencheon
|
|
249
269
|
safe_revision: 511e4238f83eb5b32839c25d94ec2a59145539bb
|
|
250
270
|
test/parser_test.rb:
|
|
251
271
|
comments:
|
|
252
|
-
reviewed_by:
|
|
253
|
-
safe_revision:
|
|
272
|
+
reviewed_by: josh.pencheon
|
|
273
|
+
safe_revision: 293248a17d087d7557a6aacdcb5bf3fbec946b87
|
|
254
274
|
test/test_helper.rb:
|
|
255
275
|
comments:
|
|
256
276
|
reviewed_by: josh.pencheon
|
|
257
|
-
safe_revision:
|
|
277
|
+
safe_revision: 42bb9bd177a761b9d04d728e53fcf0ebd0083ae4
|
data/lib/canql/grammars.rb
CHANGED
|
@@ -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 /
|
|
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
|
|
@@ -13,7 +13,7 @@ module Canql
|
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
rule category
|
|
16
|
-
space category:('eurocat red' / 'eurocat amber' / 'eurocat green' / 'eurocat') word_break <Nodes::Patient::CategoryNode>
|
|
16
|
+
space category:('eurocat amber and green' / 'eurocat red and amber' / 'eurocat red' / 'eurocat amber' / 'eurocat green' / 'eurocat') word_break <Nodes::Patient::CategoryNode>
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
rule expected_keyword
|
|
@@ -46,16 +46,18 @@ module Canql
|
|
|
46
46
|
|
|
47
47
|
rule case_field_names
|
|
48
48
|
patient_field_name:(
|
|
49
|
-
'date of birth' / 'dob' / '
|
|
50
|
-
'booking postcode' / 'birth weight' /
|
|
49
|
+
'date of birth' / 'dob' / 'date of vital status' / 'nhs number' /
|
|
50
|
+
'delivery postcode' / 'booking postcode' / 'birth weight' /
|
|
51
51
|
'place of delivery' / 'sex' / 'outcome' / 'edd' /
|
|
52
|
-
'expected delivery date' / 'booking hospital' / 'screening status'
|
|
52
|
+
'expected delivery date' / 'booking hospital' / 'screening status' /
|
|
53
|
+
'number of fetuses at delivery' / 'malformed in set' / 'gestation at delivery' /
|
|
54
|
+
'booking date'
|
|
53
55
|
)
|
|
54
56
|
end
|
|
55
57
|
|
|
56
58
|
rule patient_field_names
|
|
57
59
|
patient_field_name:(
|
|
58
|
-
'date of birth' / 'dob' / 'nhs number' / 'sex'
|
|
60
|
+
'date of birth' / 'dob' / 'date of vital status' / 'nhs number' / 'sex'
|
|
59
61
|
)
|
|
60
62
|
end
|
|
61
63
|
|
|
@@ -14,14 +14,15 @@ module Canql
|
|
|
14
14
|
|
|
15
15
|
rule registry_abbr
|
|
16
16
|
(england / east_mids / thames / east / yorkshire / north_east / north_west /
|
|
17
|
-
west_mids / south_west / wessex / london / limbo
|
|
17
|
+
west_mids / south_west_supra / south_west / wessex / london / limbo /
|
|
18
|
+
northern_supra / midlands_east_supra)
|
|
18
19
|
end
|
|
19
20
|
|
|
20
21
|
rule thames
|
|
21
22
|
('thames valley' / 'thames')
|
|
22
23
|
{
|
|
23
24
|
def to_registrycode
|
|
24
|
-
'
|
|
25
|
+
'thames'
|
|
25
26
|
end
|
|
26
27
|
}
|
|
27
28
|
end
|
|
@@ -30,7 +31,7 @@ module Canql
|
|
|
30
31
|
('east mids' / 'east midlands and south yorkshire' / 'east midlands')
|
|
31
32
|
{
|
|
32
33
|
def to_registrycode
|
|
33
|
-
'
|
|
34
|
+
'east_mids'
|
|
34
35
|
end
|
|
35
36
|
}
|
|
36
37
|
end
|
|
@@ -39,7 +40,7 @@ module Canql
|
|
|
39
40
|
'yorkshire'
|
|
40
41
|
{
|
|
41
42
|
def to_registrycode
|
|
42
|
-
'
|
|
43
|
+
'yorkshire'
|
|
43
44
|
end
|
|
44
45
|
}
|
|
45
46
|
end
|
|
@@ -48,7 +49,7 @@ module Canql
|
|
|
48
49
|
'north east'
|
|
49
50
|
{
|
|
50
51
|
def to_registrycode
|
|
51
|
-
'
|
|
52
|
+
'north_east'
|
|
52
53
|
end
|
|
53
54
|
}
|
|
54
55
|
end
|
|
@@ -57,7 +58,7 @@ module Canql
|
|
|
57
58
|
'north west'
|
|
58
59
|
{
|
|
59
60
|
def to_registrycode
|
|
60
|
-
'
|
|
61
|
+
'north_west'
|
|
61
62
|
end
|
|
62
63
|
}
|
|
63
64
|
end
|
|
@@ -66,7 +67,7 @@ module Canql
|
|
|
66
67
|
('west mids' / 'west midlands')
|
|
67
68
|
{
|
|
68
69
|
def to_registrycode
|
|
69
|
-
'
|
|
70
|
+
'west_mids'
|
|
70
71
|
end
|
|
71
72
|
}
|
|
72
73
|
end
|
|
@@ -75,7 +76,7 @@ module Canql
|
|
|
75
76
|
'south west'
|
|
76
77
|
{
|
|
77
78
|
def to_registrycode
|
|
78
|
-
'
|
|
79
|
+
'south_west'
|
|
79
80
|
end
|
|
80
81
|
}
|
|
81
82
|
end
|
|
@@ -84,7 +85,7 @@ module Canql
|
|
|
84
85
|
'wessex'
|
|
85
86
|
{
|
|
86
87
|
def to_registrycode
|
|
87
|
-
'
|
|
88
|
+
'wessex'
|
|
88
89
|
end
|
|
89
90
|
}
|
|
90
91
|
end
|
|
@@ -93,7 +94,7 @@ module Canql
|
|
|
93
94
|
('london and south east' / 'london')
|
|
94
95
|
{
|
|
95
96
|
def to_registrycode
|
|
96
|
-
'
|
|
97
|
+
'london'
|
|
97
98
|
end
|
|
98
99
|
}
|
|
99
100
|
end
|
|
@@ -102,7 +103,7 @@ module Canql
|
|
|
102
103
|
('east of england' / 'east')
|
|
103
104
|
{
|
|
104
105
|
def to_registrycode
|
|
105
|
-
'
|
|
106
|
+
'east'
|
|
106
107
|
end
|
|
107
108
|
}
|
|
108
109
|
end
|
|
@@ -111,7 +112,7 @@ module Canql
|
|
|
111
112
|
'limbo'
|
|
112
113
|
{
|
|
113
114
|
def to_registrycode
|
|
114
|
-
'
|
|
115
|
+
'limbo'
|
|
115
116
|
end
|
|
116
117
|
}
|
|
117
118
|
end
|
|
@@ -120,7 +121,34 @@ module Canql
|
|
|
120
121
|
'england'
|
|
121
122
|
{
|
|
122
123
|
def to_registrycode
|
|
123
|
-
'
|
|
124
|
+
'england'
|
|
125
|
+
end
|
|
126
|
+
}
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
rule northern_supra
|
|
130
|
+
('northern supra' / 'northern')
|
|
131
|
+
{
|
|
132
|
+
def to_registrycode
|
|
133
|
+
'northern_supra'
|
|
134
|
+
end
|
|
135
|
+
}
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
rule midlands_east_supra
|
|
139
|
+
('midlands & east supra' / 'midlands & east')
|
|
140
|
+
{
|
|
141
|
+
def to_registrycode
|
|
142
|
+
'midlands_east_supra'
|
|
143
|
+
end
|
|
144
|
+
}
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
rule south_west_supra
|
|
148
|
+
'south west supra'
|
|
149
|
+
{
|
|
150
|
+
def to_registrycode
|
|
151
|
+
'south_west_supra'
|
|
124
152
|
end
|
|
125
153
|
}
|
|
126
154
|
end
|
|
@@ -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' / 'fetal medicine' / 'dating') word_break
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
data/lib/canql/nodes.rb
CHANGED
|
@@ -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'
|
data/lib/canql/nodes/main.rb
CHANGED
|
@@ -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
|
data/lib/canql/nodes/patient.rb
CHANGED
|
@@ -30,6 +30,8 @@ module Canql #:nodoc: all
|
|
|
30
30
|
return 'eurocat_red' if 'eurocat red' == category.text_value
|
|
31
31
|
return 'eurocat_amber' if 'eurocat amber' == category.text_value
|
|
32
32
|
return 'eurocat_green' if 'eurocat green' == category.text_value
|
|
33
|
+
return 'eurocat_amber_green' if 'eurocat amber and green' == category.text_value
|
|
34
|
+
return 'eurocat_red_amber' if 'eurocat red and amber' == category.text_value
|
|
33
35
|
|
|
34
36
|
category.text_value
|
|
35
37
|
end
|
|
@@ -37,19 +39,24 @@ module Canql #:nodoc: all
|
|
|
37
39
|
|
|
38
40
|
module FieldExists
|
|
39
41
|
FIELDS = {
|
|
40
|
-
'date of birth':
|
|
41
|
-
'dob':
|
|
42
|
-
'
|
|
43
|
-
'
|
|
44
|
-
'
|
|
45
|
-
'
|
|
46
|
-
'
|
|
47
|
-
'
|
|
48
|
-
'
|
|
49
|
-
'
|
|
42
|
+
'date of birth': { patient: 'birthdate', mother: 'birthdate' },
|
|
43
|
+
'dob': { patient: 'birthdate', mother: 'birthdate' },
|
|
44
|
+
'date of vital status': { patient: 'dateofvitalstatus', mother: 'dateofvitalstatus' },
|
|
45
|
+
'delivery postcode': { patient: 'delivery_postcode' },
|
|
46
|
+
'booking postcode': { patient: 'booking_postcode' },
|
|
47
|
+
'nhs number': { patient: 'nhsnumber', mother: 'nhsnumber' },
|
|
48
|
+
'birth weight': { patient: 'weight' },
|
|
49
|
+
'place of delivery': { patient: 'placeofdelivery' },
|
|
50
|
+
'sex': { patient: 'sex' },
|
|
51
|
+
'outcome': { patient: 'outcome' },
|
|
52
|
+
'edd': { patient: 'expecteddeliverydate' },
|
|
50
53
|
'expected delivery date': { patient: 'expecteddeliverydate' },
|
|
51
|
-
'booking hospital':
|
|
52
|
-
'screening status':
|
|
54
|
+
'booking hospital': { patient: 'booking_hospital' },
|
|
55
|
+
'screening status': { patient: 'screeningstatus' },
|
|
56
|
+
'number of fetuses at delivery': { patient: 'numoffetusesatdelivery' },
|
|
57
|
+
'malformed in set': { patient: 'malformedinset' },
|
|
58
|
+
'gestation at delivery': { patient: 'gestationallength' },
|
|
59
|
+
'booking date': { patient: 'firstbookingdate' }
|
|
53
60
|
}.freeze
|
|
54
61
|
|
|
55
62
|
def meta_data_item
|
|
@@ -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
|
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:
|
|
4
|
+
version: 5.0.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:
|
|
11
|
+
date: 2021-01-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: chronic
|
|
@@ -53,7 +53,7 @@ dependencies:
|
|
|
53
53
|
version: '4.1'
|
|
54
54
|
- - "<"
|
|
55
55
|
- !ruby/object:Gem::Version
|
|
56
|
-
version: '
|
|
56
|
+
version: '7'
|
|
57
57
|
type: :runtime
|
|
58
58
|
prerelease: false
|
|
59
59
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -63,7 +63,7 @@ dependencies:
|
|
|
63
63
|
version: '4.1'
|
|
64
64
|
- - "<"
|
|
65
65
|
- !ruby/object:Gem::Version
|
|
66
|
-
version: '
|
|
66
|
+
version: '7'
|
|
67
67
|
- !ruby/object:Gem::Dependency
|
|
68
68
|
name: treetop
|
|
69
69
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -154,14 +154,14 @@ dependencies:
|
|
|
154
154
|
requirements:
|
|
155
155
|
- - "~>"
|
|
156
156
|
- !ruby/object:Gem::Version
|
|
157
|
-
version: '5.
|
|
157
|
+
version: '5.9'
|
|
158
158
|
type: :development
|
|
159
159
|
prerelease: false
|
|
160
160
|
version_requirements: !ruby/object:Gem::Requirement
|
|
161
161
|
requirements:
|
|
162
162
|
- - "~>"
|
|
163
163
|
- !ruby/object:Gem::Version
|
|
164
|
-
version: '5.
|
|
164
|
+
version: '5.9'
|
|
165
165
|
- !ruby/object:Gem::Dependency
|
|
166
166
|
name: pry
|
|
167
167
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -210,6 +210,9 @@ executables: []
|
|
|
210
210
|
extensions: []
|
|
211
211
|
extra_rdoc_files: []
|
|
212
212
|
files:
|
|
213
|
+
- ".github/CODEOWNERS"
|
|
214
|
+
- ".github/workflows/lint.yml"
|
|
215
|
+
- ".github/workflows/test.yml"
|
|
213
216
|
- ".gitignore"
|
|
214
217
|
- ".hound.yml"
|
|
215
218
|
- ".rubocop.yml"
|
|
@@ -238,6 +241,7 @@ files:
|
|
|
238
241
|
- lib/canql/grammars/provider.treetop
|
|
239
242
|
- lib/canql/grammars/registry.treetop
|
|
240
243
|
- lib/canql/grammars/test_result.treetop
|
|
244
|
+
- lib/canql/grammars/test_result_group.treetop
|
|
241
245
|
- lib/canql/nodes.rb
|
|
242
246
|
- lib/canql/nodes/age.rb
|
|
243
247
|
- lib/canql/nodes/anomaly.rb
|
|
@@ -250,6 +254,7 @@ files:
|
|
|
250
254
|
- lib/canql/nodes/perinatal_hospital.rb
|
|
251
255
|
- lib/canql/nodes/registry.rb
|
|
252
256
|
- lib/canql/nodes/test_result.rb
|
|
257
|
+
- lib/canql/nodes/test_result_group.rb
|
|
253
258
|
- lib/canql/parser.rb
|
|
254
259
|
- lib/canql/treetop/extensions.rb
|
|
255
260
|
- lib/canql/version.rb
|