hqmf2js 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +5 -13
  2. data/.travis.yml +1 -1
  3. data/Gemfile +1 -25
  4. data/Gemfile.lock +170 -146
  5. data/app/assets/javascripts/crosswalk.js.coffee +17 -19
  6. data/app/assets/javascripts/custom_calculations.js.coffee +44 -17
  7. data/app/assets/javascripts/hqmf_util.js.coffee +559 -161
  8. data/app/assets/javascripts/logging_utils.js.coffee +6 -4
  9. data/app/assets/javascripts/patient_api_extension.js.coffee +41 -9
  10. data/app/assets/javascripts/specifics.js.coffee +163 -69
  11. data/hqmf2js.gemspec +7 -12
  12. data/lib/assets/javascripts/libraries/map_reduce_utils.js +151 -64
  13. data/lib/generator/characteristic.js.erb +23 -12
  14. data/lib/generator/codes_to_json.rb +1 -1
  15. data/lib/generator/data_criteria.js.erb +15 -3
  16. data/lib/generator/derived_data.js.erb +5 -0
  17. data/lib/generator/execution.rb +41 -11
  18. data/lib/generator/js.rb +74 -41
  19. data/lib/generator/patient_data.js.erb +1 -1
  20. data/lib/hqmf2js.rb +0 -1
  21. data/lib/hquery/engine.rb +3 -1
  22. data/lib/tasks/convert.rake +20 -12
  23. data/test/fixtures/NQF59New.json +1423 -0
  24. data/test/fixtures/fulfills.xml +917 -0
  25. data/test/fixtures/patients/larry_vanderman.json +573 -654
  26. data/test/{simplecov.rb → simplecov_init.rb} +0 -0
  27. data/test/test_helper.rb +2 -3
  28. data/test/unit/cmd_test.rb +145 -19
  29. data/test/unit/codes_to_json_test.rb +12 -12
  30. data/test/unit/custom_calculations_test.rb +2 -6
  31. data/test/unit/effective_date_test.rb +3 -4
  32. data/test/unit/erb_context_test.rb +12 -12
  33. data/test/unit/filter_by_reference_test.rb +39 -0
  34. data/test/unit/hqmf_from_json_javascript_test.rb +2 -1
  35. data/test/unit/hqmf_javascript_test.rb +12 -13
  36. data/test/unit/js_object_test.rb +2 -2
  37. data/test/unit/library_function_test.rb +210 -42
  38. data/test/unit/specifics_test.rb +402 -321
  39. metadata +57 -15
  40. data/config/warble.rb +0 -144
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- YTFiZDJjMjNmZGViNTU3MGE1MzY2M2YwYzBhZDVmOTViMjRhNDk1Zg==
5
- data.tar.gz: !binary |-
6
- ZGRlMTYwNmRmODBlZjNkNmQwY2E1Yjg4NmY2YmMwZjIxMjNmYjNkZA==
2
+ SHA1:
3
+ metadata.gz: 6b37462ee793775f39e1c4f8643e1c42742975a0
4
+ data.tar.gz: e5ddf36cee338dca7c37b5a58c1a9a72f91e97d6
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- ZWM3NDBhMzBmYzg5YjE0ODAyZmEzNDliMDgzODIyZmI0MGIxM2FlZDY3ZTBm
10
- NDkwZjhhMjMyMGZkZWNjYzk1ZDI0OWFlYjdiYzFmMzU5YmU2MTM3YWMxMGQ5
11
- ZDcyMmZiNTdlMTdmMGZhZWVjYmI0YWFiNmUwNzM2MzhlYzcyNjY=
12
- data.tar.gz: !binary |-
13
- YTg5ZDhiZjZlOTYxNzY5ZTlkNjI3NDI2NGQzM2M4YzVkZDEwMTAxZDJmYjQ5
14
- ZjJkNWFkZmY3N2UyZDZhYWI1NWY5ZjJkOWU2OGMzZjA4NjhjOTM5ZGM3MjRj
15
- MDYzODYwMDAyODU2ZWNhMjhmMWIzMDJjNDAxN2ZmNzNkZjcxZDQ=
6
+ metadata.gz: acc7bb75ffe1f3462232e19540a0dfadc41d837abf631d060b09f625f8cadfe11e22f29824084092b3162fd43fac76d2e0c702c42a1f07df2e384306b36d8a74
7
+ data.tar.gz: 94b2caf1516a4aa58d1b21ac561229d064bd4cdf87e90b4afb83b364dce10fcaa3bcf0806078e1212fb0eaf0a5393eda63874ac4d6551f0b9bdefae0c60ccea5
@@ -1,6 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.3
3
+ - "2.3.5"
4
4
  script: bundle exec rake test
5
5
  notifications:
6
6
  email:
data/Gemfile CHANGED
@@ -1,23 +1,7 @@
1
1
  source "http://rubygems.org"
2
+ gemspec
2
3
 
3
- gem 'rails', '3.2.14'
4
-
5
- group :assets do
6
- gem 'sass-rails'
7
- gem 'coffee-rails'
8
- gem 'uglifier'
9
- end
10
-
11
- gem 'hquery-patient-api', '1.0.4'
12
- gem 'health-data-standards', :git => 'https://github.com/projectcypress/health-data-standards.git', :branch => 'master'
13
-
14
- gem 'nokogiri'
15
- gem 'sprockets'
16
- gem 'coffee-script'
17
- gem 'uglifier'
18
- gem 'tilt'
19
4
  gem 'rake'
20
- gem 'pry'
21
5
 
22
6
  group :test do
23
7
  gem 'simplecov', :require => false
@@ -25,12 +9,4 @@ group :test do
25
9
  gem 'minitest'
26
10
  gem 'turn', :require => false
27
11
  gem 'awesome_print', :require => 'ap'
28
-
29
- platforms :ruby do
30
- gem "therubyracer", :require => 'v8'
31
- end
32
-
33
- platforms :jruby do
34
- gem "therubyrhino"
35
- end
36
12
  end
@@ -1,179 +1,203 @@
1
- GIT
2
- remote: https://github.com/projectcypress/health-data-standards.git
3
- revision: 7a5673f90ab59b1350e22a71aefc1de5b569d98b
4
- branch: master
1
+ PATH
2
+ remote: .
5
3
  specs:
6
- health-data-standards (3.4.3)
7
- activesupport (~> 3.2.14)
8
- builder (~> 3.0.0)
9
- erubis (~> 2.7.0)
10
- log4r (~> 1.1.10)
11
- memoist (~> 0.9.1)
12
- mongoid (~> 3.1.4)
13
- mongoid-tree (~> 1.0.4)
14
- nokogiri (= 1.6.0)
15
- rest-client (~> 1.6.7)
16
- rubyzip (= 0.9.9)
17
- uuid (~> 2.3.7)
4
+ hqmf2js (1.4.0)
5
+ health-data-standards (~> 4.0)
6
+ hquery-patient-api (~> 1.1)
7
+ rails (~> 4.2)
18
8
 
19
9
  GEM
20
10
  remote: http://rubygems.org/
21
11
  specs:
22
- actionmailer (3.2.14)
23
- actionpack (= 3.2.14)
24
- mail (~> 2.5.4)
25
- actionpack (3.2.14)
26
- activemodel (= 3.2.14)
27
- activesupport (= 3.2.14)
28
- builder (~> 3.0.0)
12
+ actionmailer (4.2.10)
13
+ actionpack (= 4.2.10)
14
+ actionview (= 4.2.10)
15
+ activejob (= 4.2.10)
16
+ mail (~> 2.5, >= 2.5.4)
17
+ rails-dom-testing (~> 1.0, >= 1.0.5)
18
+ actionpack (4.2.10)
19
+ actionview (= 4.2.10)
20
+ activesupport (= 4.2.10)
21
+ rack (~> 1.6)
22
+ rack-test (~> 0.6.2)
23
+ rails-dom-testing (~> 1.0, >= 1.0.5)
24
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
25
+ actionview (4.2.10)
26
+ activesupport (= 4.2.10)
27
+ builder (~> 3.1)
29
28
  erubis (~> 2.7.0)
30
- journey (~> 1.0.4)
31
- rack (~> 1.4.5)
32
- rack-cache (~> 1.2)
33
- rack-test (~> 0.6.1)
34
- sprockets (~> 2.2.1)
35
- activemodel (3.2.14)
36
- activesupport (= 3.2.14)
37
- builder (~> 3.0.0)
38
- activerecord (3.2.14)
39
- activemodel (= 3.2.14)
40
- activesupport (= 3.2.14)
41
- arel (~> 3.0.2)
42
- tzinfo (~> 0.3.29)
43
- activeresource (3.2.14)
44
- activemodel (= 3.2.14)
45
- activesupport (= 3.2.14)
46
- activesupport (3.2.14)
47
- i18n (~> 0.6, >= 0.6.4)
48
- multi_json (~> 1.0)
49
- ansi (1.4.3)
50
- arel (3.0.3)
51
- awesome_print (1.1.0)
52
- builder (3.0.4)
53
- coderay (1.0.8)
54
- coffee-rails (3.2.2)
55
- coffee-script (>= 2.2.0)
56
- railties (~> 3.2.0)
57
- coffee-script (2.2.0)
29
+ rails-dom-testing (~> 1.0, >= 1.0.5)
30
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
31
+ activejob (4.2.10)
32
+ activesupport (= 4.2.10)
33
+ globalid (>= 0.3.0)
34
+ activemodel (4.2.10)
35
+ activesupport (= 4.2.10)
36
+ builder (~> 3.1)
37
+ activerecord (4.2.10)
38
+ activemodel (= 4.2.10)
39
+ activesupport (= 4.2.10)
40
+ arel (~> 6.0)
41
+ activesupport (4.2.10)
42
+ i18n (~> 0.7)
43
+ minitest (~> 5.1)
44
+ thread_safe (~> 0.3, >= 0.3.4)
45
+ tzinfo (~> 1.1)
46
+ ansi (1.5.0)
47
+ arel (6.0.4)
48
+ awesome_print (1.8.0)
49
+ bson (4.2.2)
50
+ builder (3.2.3)
51
+ coffee-script (2.4.1)
58
52
  coffee-script-source
59
53
  execjs
60
- coffee-script-source (1.4.0)
54
+ coffee-script-source (1.12.2)
55
+ concurrent-ruby (1.0.5)
56
+ crass (1.0.2)
57
+ docile (1.1.5)
58
+ domain_name (0.5.20170404)
59
+ unf (>= 0.0.5, < 1.0.0)
61
60
  erubis (2.7.0)
62
- execjs (1.4.0)
63
- multi_json (~> 1.0)
61
+ execjs (2.7.0)
62
+ globalid (0.4.1)
63
+ activesupport (>= 4.2.0)
64
+ health-data-standards (4.0.0)
65
+ activesupport (~> 4.2.0)
66
+ builder (~> 3.1)
67
+ erubis (~> 2.7.0)
68
+ highline (~> 1.7.0)
69
+ log4r (~> 1.1.10)
70
+ memoist (~> 0.9.1)
71
+ mongoid (~> 5.0.0)
72
+ mongoid-tree (~> 2.0.0)
73
+ nokogiri (~> 1.8.1)
74
+ protected_attributes (~> 1.0.5)
75
+ rest-client (~> 1.8.0)
76
+ rubyzip (~> 1.2.1)
77
+ uuid (~> 2.3.7)
78
+ zip-zip (~> 0.3)
79
+ highline (1.7.8)
64
80
  hike (1.2.3)
65
- hquery-patient-api (1.0.4)
66
- i18n (0.6.9)
67
- journey (1.0.4)
68
- json (1.8.1)
69
- libv8 (3.3.10.4)
81
+ hquery-patient-api (1.1.1)
82
+ coffee-script (~> 2.4)
83
+ libv8 (~> 3.16.14)
84
+ sprockets (~> 2.2)
85
+ therubyracer (~> 0.12)
86
+ tilt (~> 1.4)
87
+ uglifier (~> 2.7)
88
+ http-cookie (1.0.3)
89
+ domain_name (~> 0.5)
90
+ i18n (0.9.1)
91
+ concurrent-ruby (~> 1.0)
92
+ json (2.1.0)
93
+ libv8 (3.16.14.19)
70
94
  log4r (1.1.10)
71
- macaddr (1.6.7)
95
+ loofah (2.1.1)
96
+ crass (~> 1.0.2)
97
+ nokogiri (>= 1.5.9)
98
+ macaddr (1.7.1)
72
99
  systemu (~> 2.6.2)
73
- mail (2.5.4)
74
- mime-types (~> 1.16)
75
- treetop (~> 1.4.8)
76
- memoist (0.9.1)
77
- method_source (0.8.1)
78
- mime-types (1.25.1)
79
- mini_portile (0.5.3)
80
- minitest (4.3.2)
81
- mongoid (3.1.6)
82
- activemodel (~> 3.2)
83
- moped (~> 1.4)
84
- origin (~> 1.0)
85
- tzinfo (~> 0.3.29)
86
- mongoid-tree (1.0.4)
87
- mongoid (>= 3.0, <= 4.0)
88
- moped (1.5.2)
89
- multi_json (1.9.2)
90
- nokogiri (1.6.0)
91
- mini_portile (~> 0.5.0)
92
- origin (1.1.0)
93
- polyglot (0.3.4)
94
- pry (0.9.10)
95
- coderay (~> 1.0.5)
96
- method_source (~> 0.8)
97
- slop (~> 3.3.1)
98
- rack (1.4.5)
99
- rack-cache (1.2)
100
- rack (>= 0.4)
101
- rack-ssl (1.3.4)
102
- rack
103
- rack-test (0.6.2)
100
+ mail (2.7.0)
101
+ mini_mime (>= 0.1.1)
102
+ memoist (0.9.3)
103
+ mime-types (2.99.3)
104
+ mini_mime (1.0.0)
105
+ mini_portile2 (2.3.0)
106
+ minitest (5.10.3)
107
+ mongo (2.4.3)
108
+ bson (>= 4.2.1, < 5.0.0)
109
+ mongoid (5.0.2)
110
+ activemodel (~> 4.0)
111
+ mongo (~> 2.1)
112
+ origin (~> 2.1)
113
+ tzinfo (>= 0.3.37)
114
+ mongoid-tree (2.0.1)
115
+ mongoid (>= 4.0, < 6.0)
116
+ multi_json (1.12.2)
117
+ netrc (0.11.0)
118
+ nokogiri (1.8.1)
119
+ mini_portile2 (~> 2.3.0)
120
+ origin (2.3.1)
121
+ protected_attributes (1.0.9)
122
+ activemodel (>= 4.0.1, < 5.0)
123
+ rack (1.6.8)
124
+ rack-test (0.6.3)
104
125
  rack (>= 1.0)
105
- rails (3.2.14)
106
- actionmailer (= 3.2.14)
107
- actionpack (= 3.2.14)
108
- activerecord (= 3.2.14)
109
- activeresource (= 3.2.14)
110
- activesupport (= 3.2.14)
111
- bundler (~> 1.0)
112
- railties (= 3.2.14)
113
- railties (3.2.14)
114
- actionpack (= 3.2.14)
115
- activesupport (= 3.2.14)
116
- rack-ssl (~> 1.3.2)
126
+ rails (4.2.10)
127
+ actionmailer (= 4.2.10)
128
+ actionpack (= 4.2.10)
129
+ actionview (= 4.2.10)
130
+ activejob (= 4.2.10)
131
+ activemodel (= 4.2.10)
132
+ activerecord (= 4.2.10)
133
+ activesupport (= 4.2.10)
134
+ bundler (>= 1.3.0, < 2.0)
135
+ railties (= 4.2.10)
136
+ sprockets-rails
137
+ rails-deprecated_sanitizer (1.0.3)
138
+ activesupport (>= 4.2.0.alpha)
139
+ rails-dom-testing (1.0.8)
140
+ activesupport (>= 4.2.0.beta, < 5.0)
141
+ nokogiri (~> 1.6)
142
+ rails-deprecated_sanitizer (>= 1.0.1)
143
+ rails-html-sanitizer (1.0.3)
144
+ loofah (~> 2.0)
145
+ railties (4.2.10)
146
+ actionpack (= 4.2.10)
147
+ activesupport (= 4.2.10)
117
148
  rake (>= 0.8.7)
118
- rdoc (~> 3.4)
119
- thor (>= 0.14.6, < 2.0)
120
- rake (10.2.0)
121
- rdoc (3.12.2)
122
- json (~> 1.4)
123
- rest-client (1.6.7)
124
- mime-types (>= 1.16)
125
- rubyzip (0.9.9)
126
- sass (3.2.3)
127
- sass-rails (3.2.5)
128
- railties (~> 3.2.0)
129
- sass (>= 3.1.10)
130
- tilt (~> 1.3)
131
- simplecov (0.7.1)
132
- multi_json (~> 1.0)
133
- simplecov-html (~> 0.7.1)
134
- simplecov-html (0.7.1)
135
- slop (3.3.3)
136
- sprockets (2.2.2)
149
+ thor (>= 0.18.1, < 2.0)
150
+ rake (12.2.1)
151
+ ref (2.0.0)
152
+ rest-client (1.8.0)
153
+ http-cookie (>= 1.0.2, < 2.0)
154
+ mime-types (>= 1.16, < 3.0)
155
+ netrc (~> 0.7)
156
+ rubyzip (1.2.1)
157
+ simplecov (0.15.1)
158
+ docile (~> 1.1.0)
159
+ json (>= 1.8, < 3)
160
+ simplecov-html (~> 0.10.0)
161
+ simplecov-html (0.10.2)
162
+ sprockets (2.12.4)
137
163
  hike (~> 1.2)
138
164
  multi_json (~> 1.0)
139
165
  rack (~> 1.0)
140
166
  tilt (~> 1.1, != 1.3.0)
141
- systemu (2.6.4)
142
- therubyracer (0.10.2)
143
- libv8 (~> 3.3.10)
144
- thor (0.19.1)
167
+ sprockets-rails (0.0.1)
168
+ sprockets (>= 1.0.2)
169
+ systemu (2.6.5)
170
+ therubyracer (0.12.3)
171
+ libv8 (~> 3.16.14.15)
172
+ ref
173
+ thor (0.20.0)
174
+ thread_safe (0.3.6)
145
175
  tilt (1.4.1)
146
- treetop (1.4.15)
147
- polyglot
148
- polyglot (>= 0.3.1)
149
176
  turn (0.9.6)
150
177
  ansi
151
- tzinfo (0.3.39)
152
- uglifier (1.3.0)
178
+ tzinfo (1.2.4)
179
+ thread_safe (~> 0.1)
180
+ uglifier (2.7.2)
153
181
  execjs (>= 0.3.0)
154
- multi_json (~> 1.0, >= 1.0.2)
155
- uuid (2.3.7)
182
+ json (>= 1.8.0)
183
+ unf (0.1.4)
184
+ unf_ext
185
+ unf_ext (0.0.7.4)
186
+ uuid (2.3.8)
156
187
  macaddr (~> 1.0)
188
+ zip-zip (0.3)
189
+ rubyzip (>= 1.0.0)
157
190
 
158
191
  PLATFORMS
159
192
  ruby
160
193
 
161
194
  DEPENDENCIES
162
195
  awesome_print
163
- coffee-rails
164
- coffee-script
165
- health-data-standards!
166
- hquery-patient-api (= 1.0.4)
196
+ hqmf2js!
167
197
  minitest
168
- nokogiri
169
- pry
170
- rails (= 3.2.14)
171
198
  rake
172
- sass-rails
173
199
  simplecov
174
- sprockets
175
- therubyracer
176
- therubyrhino
177
- tilt
178
200
  turn
179
- uglifier
201
+
202
+ BUNDLED WITH
203
+ 1.15.4
@@ -47,26 +47,24 @@ hQuery.CodedEntry::includesCodeFrom = (codeSet) ->
47
47
  oneTrue
48
48
 
49
49
  instrumentTrueCrosswalk = (hqmfjs) ->
50
- # CrosswalkManager.clearValidateCodeSystemData()
51
- # _.each(_.functions(hqmfjs), (method) ->
52
- # hqmfjs[method] = _.wrap(hqmfjs[method], (func) ->
50
+ # Wrap all of the data criteria functions generated from HQMF
51
+ _.each(_.functions(hqmfjs), (method) ->
52
+ if method != 'initializeSpecifics'
53
+ hqmfjs[method] = _.wrap(hqmfjs[method], (func) ->
53
54
 
54
- # args = Array.prototype.slice.call(arguments,1)
55
+ args = Array.prototype.slice.call(arguments,1)
55
56
 
56
- # results = func.apply(this, args)
57
- # tmp_results = results
58
- # tmp_results = [results] unless _.isArray(tmp_results)
57
+ isDataCriteria = method.match(/precondition_[0-9]+/)
59
58
 
60
- # _.each(tmp_results, (result) ->
61
- # if result.json? && CrosswalkManager.tmpTrueMatchedSystems[result.id]?
62
- # tmpTrueMatchedSystems = CrosswalkManager.tmpTrueMatchedSystems[result.id]
63
- # CrosswalkManager.trueMatchedSystems[result.id] = {} unless CrosswalkManager.trueMatchedSystems[result.id]
64
- # Logger.info("TRUE_MATCHED: #{result.json['description']} - #{_.keys(tmpTrueMatchedSystems)}!!!")
65
- # _.each(_.keys(tmpTrueMatchedSystems), (key) ->
66
- # CrosswalkManager.trueMatchedSystems[result.id][key] = CrosswalkManager.trueMatchedSystems[result.id][key] || tmpTrueMatchedSystems[key]
67
- # )
68
- # )
69
- # results
70
- # )
71
- # )
59
+ if isDataCriteria
60
+ tmpCrosswalk = $.extend(true, {}, CrosswalkManager.matchedSystems)
61
+
62
+ result = func.apply(this, args)
63
+
64
+ if isDataCriteria && result.isFalse()
65
+ CrosswalkManager.matchedSystems = tmpCrosswalk
66
+
67
+ return result;
68
+ );
69
+ );
72
70
  @instrumentTrueCrosswalk = instrumentTrueCrosswalk