canql 5.1.0 → 5.2.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: 7388b9b6f880c7c55b4db80358ff06f5ac5753f70f70aae5e4791b3ad2f886d9
4
- data.tar.gz: 44c1a08147f5d7eee119242432184238388af321f311149cf498550e417af5fd
3
+ metadata.gz: c11d88eb61eaebcc1fee8bbcf02c3528a26799b7a62800971c34517619b98668
4
+ data.tar.gz: ac2d55b1fcf88636a1ccfdf3a2f11b4d4ef7e878ba886fceddd2dcdce26a6fb6
5
5
  SHA512:
6
- metadata.gz: 3e0eec913600a18381b348c94a466ebc2ef3f8d1a92b505be0975bd77adc63781f54d63f18b7a7c890e0dcea2f3e83303d963fc767e78ee0d1287e4690f59090
7
- data.tar.gz: e0ffb6f335045c5238a3b42c4469504cc6a24eaa4eff90e9f9fa217e0e76f9f06d53c6f98572302cfd8737626f4a558afae93408938c64f1e1f6aa0b7bf7f05a
6
+ metadata.gz: 767d7da5878ba53e624db9090a0bce25ee2b17c039b5ecce4bbb65126f0d32bc988851f7b31e41be235f9911919051a07a7e5478b54d11bc0aefdf7c6a939389
7
+ data.tar.gz: bd874eb46ba2641c84ba40d2a521db212b218879cf6e789777514d36bea0672fd9b38e24804ca4a86b54b722c62b5a7a89003d3040cd8179991b134ebb7543ab
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
- *no unreleased changes*
2
+ * no relevent changes
3
+
4
+ ## 5.2.0 / 2021-03-04
5
+
6
+ * Added new FASP anomaly RAG rating filters (#63)
3
7
 
4
8
  ## 5.1.0 / 2021-01-25
5
9
 
data/code_safety.yml CHANGED
@@ -26,8 +26,8 @@ file safety:
26
26
  safe_revision: 146b255b240b0efc928d39dd1b70ab221ddc3138
27
27
  CHANGELOG.md:
28
28
  comments:
29
- reviewed_by: josh.pencheon
30
- safe_revision: aea0d1a480e886a63b723135c7381cdcee0d4b25
29
+ reviewed_by: ollietulloch
30
+ safe_revision: 9af6ea0bcdac493fe5f31d62b504b285658867c4
31
31
  CODE_OF_CONDUCT.md:
32
32
  comments:
33
33
  reviewed_by: drewthorp
@@ -80,8 +80,8 @@ file safety:
80
80
  lib/canql/grammars/anomaly.treetop:
81
81
  comments: It is a known issue that this is potentially susceptible to certain
82
82
  kinds of DoS attack
83
- reviewed_by: josh.pencheon
84
- safe_revision: b7778ca1d536022a807420cc9fe0f1c2df7f73ef
83
+ reviewed_by: ollietulloch
84
+ safe_revision: e549c0dcafdd6004ec279bd256fae8b9964c9629
85
85
  lib/canql/grammars/batch_types.treetop:
86
86
  comments:
87
87
  reviewed_by: josh.pencheon
@@ -141,8 +141,8 @@ file safety:
141
141
  safe_revision: 6932d590299ad4a9d2ba24b425b158c67142bf74
142
142
  lib/canql/nodes/anomaly.rb:
143
143
  comments:
144
- reviewed_by: josh.pencheon
145
- safe_revision: b7778ca1d536022a807420cc9fe0f1c2df7f73ef
144
+ reviewed_by: ollietulloch
145
+ safe_revision: e549c0dcafdd6004ec279bd256fae8b9964c9629
146
146
  lib/canql/nodes/batch_types.rb:
147
147
  comments:
148
148
  reviewed_by: josh.pencheon
@@ -193,12 +193,12 @@ file safety:
193
193
  safe_revision: 6932d590299ad4a9d2ba24b425b158c67142bf74
194
194
  lib/canql/version.rb:
195
195
  comments:
196
- reviewed_by: josh.pencheon
197
- safe_revision: aea0d1a480e886a63b723135c7381cdcee0d4b25
196
+ reviewed_by: ollietulloch
197
+ safe_revision: 9af6ea0bcdac493fe5f31d62b504b285658867c4
198
198
  test/anomaly_test_helper.rb:
199
199
  comments:
200
- reviewed_by: josh.pencheon
201
- safe_revision: 73a7dac17b20fcc77bcbd9d38777c8aa4d524816
200
+ reviewed_by: ollietulloch
201
+ safe_revision: e549c0dcafdd6004ec279bd256fae8b9964c9629
202
202
  test/canql_test.rb:
203
203
  comments:
204
204
  reviewed_by: timgentry
@@ -221,8 +221,8 @@ file safety:
221
221
  safe_revision: 7490099869e368dcd5c26ded11eb90229baf4cae
222
222
  test/nodes/code_test.rb:
223
223
  comments:
224
- reviewed_by: josh.pencheon
225
- safe_revision: b7778ca1d536022a807420cc9fe0f1c2df7f73ef
224
+ reviewed_by: ollietulloch
225
+ safe_revision: e549c0dcafdd6004ec279bd256fae8b9964c9629
226
226
  test/nodes/e_base_records_test.rb:
227
227
  comments:
228
228
  reviewed_by: josh.pencheon
@@ -35,7 +35,7 @@ module Canql
35
35
  end
36
36
 
37
37
  rule anomalies_icd_code
38
- (icd_code_name / code_group)
38
+ (fasp_rating / icd_code_name / code_group)
39
39
  end
40
40
 
41
41
  rule icd_code_name
@@ -45,5 +45,9 @@ module Canql
45
45
  rule code_group
46
46
  ('fasp plus' / 'plus' / 'fasp' / 'structural' / 'trisomy') <Nodes::Anomaly::SingleCodeGroupNode>
47
47
  end
48
+
49
+ rule fasp_rating
50
+ ('fasp red and amber' / 'fasp amber and red' / 'fasp red' / 'fasp amber' / 'fasp green') <Nodes::Anomaly::SingleFaspRatingNode>
51
+ end
48
52
  end
49
53
  end
@@ -23,13 +23,21 @@ module Canql #:nodoc: all
23
23
  if anomaly_screening_status_type.present?
24
24
  anomaly_hash['screening_status'] = anomaly_screening_status_type_filter
25
25
  end
26
- anomaly_hash['icd_codes'] = code_filter[:icd_code] if code_filter[:icd_code].present?
27
- return anomaly_hash if code_filter[:code_group].blank?
26
+ code_filters(anomaly_hash)
28
27
 
29
- anomaly_hash['code_groups'] = code_filter[:code_group]
30
28
  anomaly_hash
31
29
  end
32
30
 
31
+ def code_filters(anomaly_hash)
32
+ anomaly_hash['icd_codes'] = code_filter[:icd_code] if code_filter[:icd_code].present?
33
+ if code_filter[:code_group].present?
34
+ anomaly_hash['code_groups'] = code_filter[:code_group]
35
+ end
36
+ return if code_filter[:fasp_rating].blank?
37
+
38
+ anomaly_hash['fasp_rating'] = code_filter[:fasp_rating]
39
+ end
40
+
33
41
  def existance_filter
34
42
  { Canql::EQUALS => existance_modifier.text_value.strip != 'no' }
35
43
  end
@@ -49,36 +57,50 @@ module Canql #:nodoc: all
49
57
  def code_type(code)
50
58
  return :icd_code if code.respond_to?(:to_code) && code.to_code.present?
51
59
  return :code_group if code.respond_to?(:to_code_group) && code.to_code_group.present?
60
+ return :fasp_rating if code.respond_to?(:to_fasp_rating) && code.to_fasp_rating.present?
52
61
 
53
62
  raise 'Unable to find code type'
54
63
  end
55
64
 
56
65
  def code_value(code)
57
66
  return code.to_code if :icd_code == code_type(code)
67
+ return code.to_code_group if :code_group == code_type(code)
58
68
 
59
- code.to_code_group
69
+ code.to_fasp_rating
60
70
  end
61
71
 
62
72
  def prepare_code_filters(code_array)
63
- code_array[:icd_code].flatten!
64
- code_array[:icd_code].delete_if(&:blank?)
65
- code_array[:code_group].flatten!
66
- code_array[:code_group].delete_if(&:blank?)
73
+ clean_code_array(code_array)
67
74
 
68
75
  code_filters = {}
69
76
  if code_array[:icd_code].any?
70
77
  code_filters[:icd_code] = { Canql::BEGINS => code_array[:icd_code] }
71
78
  end
72
- return code_filters if code_array[:code_group].blank?
73
79
 
74
- code_filters[:code_group] = { Canql::EQUALS => code_array[:code_group] }
80
+ if code_array[:code_group].any?
81
+ code_filters[:code_group] = { Canql::EQUALS => code_array[:code_group] }
82
+ end
83
+
84
+ if code_array[:fasp_rating].any?
85
+ code_filters[:fasp_rating] = { Canql::EQUALS => code_array[:fasp_rating] }
86
+ end
87
+
75
88
  code_filters
76
89
  end
77
90
 
91
+ def clean_code_array(code_array)
92
+ code_array[:icd_code].flatten!
93
+ code_array[:icd_code].delete_if(&:blank?)
94
+ code_array[:code_group].flatten!
95
+ code_array[:code_group].delete_if(&:blank?)
96
+ code_array[:fasp_rating].flatten!
97
+ code_array[:fasp_rating].delete_if(&:blank?)
98
+ end
99
+
78
100
  def code_filter
79
101
  return {} if code_data.text_value.blank?
80
102
 
81
- code_arrays = { icd_code: [], code_group: [] }
103
+ code_arrays = { icd_code: [], code_group: [], fasp_rating: [] }
82
104
  code_arrays[code_type(code_data.first)] << code_value(code_data.first)
83
105
  code_data.rest.elements.each do |code|
84
106
  code_arrays[code_type(code)] << code_value(code)
@@ -90,8 +112,9 @@ module Canql #:nodoc: all
90
112
  module AdditionalCodeNode
91
113
  def code_type
92
114
  return :icd_code if anomalies_icd_code.respond_to?(:to_code)
115
+ return :code_group if anomalies_icd_code.respond_to?(:to_code_group)
93
116
 
94
- :code_group
117
+ :fasp_rating
95
118
  end
96
119
 
97
120
  def to_code
@@ -101,6 +124,10 @@ module Canql #:nodoc: all
101
124
  def to_code_group
102
125
  anomalies_icd_code.to_code_group if :code_group == code_type
103
126
  end
127
+
128
+ def to_fasp_rating
129
+ anomalies_icd_code.to_fasp_rating if :fasp_rating == code_type
130
+ end
104
131
  end
105
132
 
106
133
  module SingleIcdCodeNode
@@ -114,6 +141,14 @@ module Canql #:nodoc: all
114
141
  text_value.gsub(/( )/, '_').upcase
115
142
  end
116
143
  end
144
+
145
+ module SingleFaspRatingNode
146
+ def to_fasp_rating
147
+ text_value.gsub(/( )/, '_').upcase.split('_AND_').map do |value|
148
+ value.start_with?('FASP_') ? value : "FASP_#{value}"
149
+ end
150
+ end
151
+ end
117
152
  end
118
153
  end
119
154
  end
data/lib/canql/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  # This stores the current version of the Canql gem
4
4
  module Canql
5
- VERSION = '5.1.0'
5
+ VERSION = '5.2.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: 5.1.0
4
+ version: 5.2.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-25 00:00:00.000000000 Z
11
+ date: 2021-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chronic