canql 5.9.0 → 6.0.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 +9 -0
- data/lib/canql/grammars/e_base_records.treetop +4 -2
- data/lib/canql/grammars/events.treetop +39 -0
- data/lib/canql/grammars/main.treetop +3 -3
- data/lib/canql/grammars/patient.treetop +2 -2
- data/lib/canql/grammars.rb +1 -1
- data/lib/canql/nodes/events.rb +40 -0
- data/lib/canql/nodes/main.rb +2 -2
- data/lib/canql/nodes/patient.rb +1 -0
- data/lib/canql/nodes/patient_events.rb +36 -0
- data/lib/canql/nodes.rb +1 -1
- data/lib/canql/version.rb +1 -1
- metadata +6 -5
- data/lib/canql/grammars/hes_event.treetop +0 -15
- data/lib/canql/nodes/hes_event.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3c990a0548eca6080965ce9c1ef4d2a32f14557420941fbffa0f54051b4c79b
|
4
|
+
data.tar.gz: 82ecc585caca911ae3c7462f54e307fb75ec8ac261aa742c87dd49dca056ab29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7526043f1b2789fdd4c934b1616296e6742ede5e0f96ef55e6eb6e52fef981056b6288cee3fd863ca6705f269b72965e2d77c51dac47c9f3e3ec2f7c5308528f
|
7
|
+
data.tar.gz: b2b8feddac3280ebc84c053db3e5ec9c4f4eac641cbb23ad6b873e26e1f8df2e2b3c69827a024caeb019eebe2978ff17d4a54bfcc78c792074f93699df817ee9
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## 6.0.0 / 2024-09-30
|
4
|
+
### Changed
|
5
|
+
* Changed the hes event filter to align with other new event filter
|
6
|
+
### Added
|
7
|
+
* Added event filters for birth, death, pregnancy loss and MSDS
|
8
|
+
* Added 'number of fetuses in early pregnancy' to field existence modifier
|
9
|
+
* Removed 'CODING_CLINIC' & 'REG_GROUP' actions from the action filter
|
10
|
+
* Added 'BADGER_CHECKED', 'DELETE', 'FASP_CATEGORISATION', 'MSDS_SENT', 'RARE_DISEASE_TEAM', 'REG_CODING_FORUM' & 'SOURCES_CHECKED' actions to the action filter
|
11
|
+
|
3
12
|
## 5.9.0 / 2023-01-17
|
4
13
|
* Added 'other' option to anomaly screening status filter (#90)
|
5
14
|
|
@@ -49,8 +49,10 @@ module Canql
|
|
49
49
|
end
|
50
50
|
|
51
51
|
rule accepted_action
|
52
|
-
'badger_search' / '
|
53
|
-
'
|
52
|
+
'badger_search' / 'badger_checked' / 'coding_group' / 'complete' /
|
53
|
+
'delete' / 'fasp_categorisation' / 'msds_sent' / 'qa' /
|
54
|
+
'rare_disease_team' / 'reg_coding_forum' /
|
55
|
+
'scr_checked' / 'scr_check' / 'search' / 'sources_checked' / 'technical'
|
54
56
|
end
|
55
57
|
|
56
58
|
rule all_or_none_actions
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Canql
|
2
|
+
grammar Events
|
3
|
+
rule events
|
4
|
+
and_keyword? existance_modifier:events_no_keyword? events_name event_object_keyword <Nodes::Events::WithCondition>
|
5
|
+
end
|
6
|
+
|
7
|
+
rule events_no_keyword
|
8
|
+
space ('no' / 'some') word_break
|
9
|
+
end
|
10
|
+
|
11
|
+
rule events_keywords
|
12
|
+
space ('birth' / 'death' / 'hes' / 'preg loss hes' / 'pregnancy loss hes' / 'preg loss bpas' / 'pregnancy loss bpas' / 'msds') word_break
|
13
|
+
end
|
14
|
+
|
15
|
+
rule relevant_events_keywords
|
16
|
+
space ('preg loss hes' / 'pregnancy loss hes' / 'preg loss bpas' / 'pregnancy loss bpas' / 'msds') word_break
|
17
|
+
end
|
18
|
+
|
19
|
+
rule events_name
|
20
|
+
(relevant_events / non_relevant_events)
|
21
|
+
end
|
22
|
+
|
23
|
+
rule non_relevant_events
|
24
|
+
event_type:events_keywords
|
25
|
+
end
|
26
|
+
|
27
|
+
rule relevant_events
|
28
|
+
event_relevance:event_relevant_keyword event_type:relevant_events_keywords
|
29
|
+
end
|
30
|
+
|
31
|
+
rule event_relevant_keyword
|
32
|
+
space ('linked' / 'relevant' / 'related' / 'unlinked' / 'irrelevant' / 'unrelated') word_break
|
33
|
+
end
|
34
|
+
|
35
|
+
rule event_object_keyword
|
36
|
+
space ('events' / 'event' / 'records' / 'record') word_break
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -6,7 +6,7 @@ grammar Canql
|
|
6
6
|
include GeneticTest
|
7
7
|
include TestResult
|
8
8
|
include TestResultGroup
|
9
|
-
include
|
9
|
+
include Events
|
10
10
|
include Dates
|
11
11
|
include EBaseRecords
|
12
12
|
include BatchTypes
|
@@ -131,11 +131,11 @@ grammar Canql
|
|
131
131
|
rule case_with_conditions
|
132
132
|
anomalies / genetic_tests / test_results / perinatal_hospital /
|
133
133
|
case_field_existance / test_acceptance_existance / test_result_groups /
|
134
|
-
mother_conditions / action_or_ebr /
|
134
|
+
mother_conditions / action_or_ebr / events
|
135
135
|
end
|
136
136
|
|
137
137
|
rule patient_with_conditions
|
138
138
|
anomalies / genetic_tests / test_results / patient_field_existance /
|
139
|
-
action_or_ebr /
|
139
|
+
action_or_ebr / events
|
140
140
|
end
|
141
141
|
end
|
@@ -56,8 +56,8 @@ module Canql
|
|
56
56
|
'delivery postcode' / 'booking postcode' / 'birth weight' /
|
57
57
|
'place of delivery' / 'sex' / 'outcome' / 'edd' /
|
58
58
|
'expected delivery date' / 'booking hospital' / 'screening status' /
|
59
|
-
'number of fetuses at delivery' / '
|
60
|
-
'booking date'
|
59
|
+
'number of fetuses at delivery' / 'number of fetuses in early pregnancy' /
|
60
|
+
'malformed in set' / 'gestation at delivery' / 'booking date'
|
61
61
|
)
|
62
62
|
end
|
63
63
|
|
data/lib/canql/grammars.rb
CHANGED
@@ -14,5 +14,5 @@ Treetop.load File.expand_path('grammars/patient', File.dirname(__FILE__))
|
|
14
14
|
Treetop.load File.expand_path('grammars/registry', File.dirname(__FILE__))
|
15
15
|
Treetop.load File.expand_path('grammars/provider', File.dirname(__FILE__))
|
16
16
|
Treetop.load File.expand_path('grammars/perinatal_hospital', File.dirname(__FILE__))
|
17
|
-
Treetop.load File.expand_path('grammars/
|
17
|
+
Treetop.load File.expand_path('grammars/events', File.dirname(__FILE__))
|
18
18
|
Treetop.load File.expand_path('grammars/main', File.dirname(__FILE__))
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Canql #:nodoc: all
|
4
|
+
module Nodes
|
5
|
+
module Events
|
6
|
+
module WithCondition
|
7
|
+
def to_events
|
8
|
+
event_type = text_values_for_marker(:event_type).first.strip
|
9
|
+
event_relevance = text_values_for_marker(:event_relevance).first.to_s.strip
|
10
|
+
hash = existence_filter
|
11
|
+
hash['type'] = event_type_name[event_type]
|
12
|
+
hash['relevant'] = event_relevance_flag(event_relevance) || false
|
13
|
+
|
14
|
+
hash
|
15
|
+
end
|
16
|
+
|
17
|
+
def event_type_name
|
18
|
+
{
|
19
|
+
'birth' => 'birth',
|
20
|
+
'death' => 'death',
|
21
|
+
'hes' => 'hes',
|
22
|
+
'preg loss hes' => 'pregnancy_loss_hes',
|
23
|
+
'pregnancy loss hes' => 'pregnancy_loss_hes',
|
24
|
+
'preg loss bpas' => 'pregnancy_loss_bpas',
|
25
|
+
'pregnancy loss bpas' => 'pregnancy_loss_bpas',
|
26
|
+
'msds' => 'msds'
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
def event_relevance_flag(relevance)
|
31
|
+
%w[linked relevant related].include?(relevance)
|
32
|
+
end
|
33
|
+
|
34
|
+
def existence_filter
|
35
|
+
{ Canql::EQUALS => existance_modifier.text_value.strip != 'no' }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/canql/nodes/main.rb
CHANGED
@@ -32,7 +32,7 @@ module Canql #:nodoc: all
|
|
32
32
|
sub_clauses = build_sub_clauses
|
33
33
|
|
34
34
|
%i[
|
35
|
-
anomalies genetic_tests test_results test_result_groups test_acceptances
|
35
|
+
anomalies genetic_tests test_results test_result_groups test_acceptances events
|
36
36
|
].each do |condition_key|
|
37
37
|
if sub_clauses[condition_key].present?
|
38
38
|
conditions[condition_key.to_s] = { Canql::ALL => sub_clauses[condition_key] }
|
@@ -52,7 +52,7 @@ module Canql #:nodoc: all
|
|
52
52
|
sub_clauses, element, :test_result_groups, :to_test_result_group
|
53
53
|
)
|
54
54
|
add_sub_clause(sub_clauses, element, :test_acceptances, :to_test_acceptance)
|
55
|
-
add_sub_clause(sub_clauses, element, :
|
55
|
+
add_sub_clause(sub_clauses, element, :events, :to_events)
|
56
56
|
end
|
57
57
|
sub_clauses
|
58
58
|
end
|
data/lib/canql/nodes/patient.rb
CHANGED
@@ -55,6 +55,7 @@ module Canql # :nodoc: all
|
|
55
55
|
'booking hospital': { patient: 'booking_hospital' },
|
56
56
|
'screening status': { patient: 'screeningstatus' },
|
57
57
|
'number of fetuses at delivery': { patient: 'numoffetusesatdelivery' },
|
58
|
+
'number of fetuses in early pregnancy': { patient: 'numberoffetuses' },
|
58
59
|
'malformed in set': { patient: 'malformedinset' },
|
59
60
|
'gestation at delivery': { patient: 'gestationallength' },
|
60
61
|
'booking date': { patient: 'firstbookingdate' }
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Canql #:nodoc: all
|
4
|
+
module Nodes
|
5
|
+
module PatientEvents
|
6
|
+
module WithCondition
|
7
|
+
def to_events
|
8
|
+
event_name = event_type_name()
|
9
|
+
{ "#{event_name}_event" => existence_filter }
|
10
|
+
end
|
11
|
+
|
12
|
+
def maternal_relevant_event_types
|
13
|
+
%w[pregnancy_loss_hes pregnancy_loss_bpas msds]
|
14
|
+
end
|
15
|
+
|
16
|
+
def event_type_name
|
17
|
+
map = {
|
18
|
+
'birth' => 'birth',
|
19
|
+
'death' => 'death',
|
20
|
+
'hes' => 'hes',
|
21
|
+
'preg loss hes' => 'pregnancy_loss_hes',
|
22
|
+
'pregnancy loss hes' => 'pregnancy_loss_hes',
|
23
|
+
'preg loss bpas' => 'pregnancy_loss_bpas',
|
24
|
+
'pregnancy loss bpas' => 'pregnancy_loss_bpas',
|
25
|
+
'msds' => 'msds'
|
26
|
+
}
|
27
|
+
map[event_type.text_value.strip]
|
28
|
+
end
|
29
|
+
|
30
|
+
def existence_filter
|
31
|
+
{ Canql::EQUALS => existance_modifier.text_value.strip != 'no' }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/lib/canql/nodes.rb
CHANGED
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: 6.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- NHSD NDRS Development Team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chronic
|
@@ -229,8 +229,8 @@ files:
|
|
229
229
|
- lib/canql/grammars/batch_types.treetop
|
230
230
|
- lib/canql/grammars/dates.treetop
|
231
231
|
- lib/canql/grammars/e_base_records.treetop
|
232
|
+
- lib/canql/grammars/events.treetop
|
232
233
|
- lib/canql/grammars/genetic_test.treetop
|
233
|
-
- lib/canql/grammars/hes_event.treetop
|
234
234
|
- lib/canql/grammars/main.treetop
|
235
235
|
- lib/canql/grammars/patient.treetop
|
236
236
|
- lib/canql/grammars/perinatal_hospital.treetop
|
@@ -244,10 +244,11 @@ files:
|
|
244
244
|
- lib/canql/nodes/batch_types.rb
|
245
245
|
- lib/canql/nodes/dates.rb
|
246
246
|
- lib/canql/nodes/e_base_records.rb
|
247
|
+
- lib/canql/nodes/events.rb
|
247
248
|
- lib/canql/nodes/genetic_test.rb
|
248
|
-
- lib/canql/nodes/hes_event.rb
|
249
249
|
- lib/canql/nodes/main.rb
|
250
250
|
- lib/canql/nodes/patient.rb
|
251
|
+
- lib/canql/nodes/patient_events.rb
|
251
252
|
- lib/canql/nodes/perinatal_hospital.rb
|
252
253
|
- lib/canql/nodes/registry.rb
|
253
254
|
- lib/canql/nodes/test_result.rb
|
@@ -274,7 +275,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
274
275
|
- !ruby/object:Gem::Version
|
275
276
|
version: '0'
|
276
277
|
requirements: []
|
277
|
-
rubygems_version: 3.
|
278
|
+
rubygems_version: 3.4.10
|
278
279
|
signing_key:
|
279
280
|
specification_version: 4
|
280
281
|
summary: Congenital Anomaly Natural Query Language
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module Canql
|
2
|
-
grammar HesEvent
|
3
|
-
rule hes_events
|
4
|
-
and_keyword? existance_modifier:hes_no_keyword? hes_keyword <Nodes::HesEvent::WithCondition>
|
5
|
-
end
|
6
|
-
|
7
|
-
rule hes_no_keyword
|
8
|
-
space ('no' / 'some') word_break
|
9
|
-
end
|
10
|
-
|
11
|
-
rule hes_keyword
|
12
|
-
space ('hes events' / 'hes records') word_break
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Canql #:nodoc: all
|
4
|
-
module Nodes
|
5
|
-
module HesEvent
|
6
|
-
module WithCondition
|
7
|
-
def to_hes
|
8
|
-
{ 'exists' => existance_filter }
|
9
|
-
end
|
10
|
-
|
11
|
-
def existance_filter
|
12
|
-
{ Canql::EQUALS => existance_modifier.text_value.strip != 'no' }
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|