hquery-patient-api 1.0.4 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/Gemfile +4 -17
- data/Gemfile.lock +36 -24
- data/Rakefile +8 -12
- data/app/assets/javascripts/allergy.js.coffee +12 -14
- data/app/assets/javascripts/assessment.js.coffee +21 -0
- data/app/assets/javascripts/careexperience.js.coffee +23 -0
- data/app/assets/javascripts/caregoal.js.coffee +18 -3
- data/app/assets/javascripts/communication.js.coffee +22 -0
- data/app/assets/javascripts/condition.js.coffee +28 -13
- data/app/assets/javascripts/core.js.coffee +30 -14
- data/app/assets/javascripts/encounter.js.coffee +37 -9
- data/app/assets/javascripts/familyhistory.js.coffee +26 -0
- data/app/assets/javascripts/functionalstatus.js.coffee +14 -5
- data/app/assets/javascripts/immunization.js.coffee +20 -15
- data/app/assets/javascripts/languages.js.coffee +3 -7
- data/app/assets/javascripts/medicalequipment.js.coffee +26 -3
- data/app/assets/javascripts/medication.js.coffee +58 -12
- data/app/assets/javascripts/patient.js.coffee +87 -38
- data/app/assets/javascripts/pregnancy.js.coffee +2 -3
- data/app/assets/javascripts/procedure.js.coffee +54 -6
- data/app/assets/javascripts/provider.js.coffee +9 -13
- data/app/assets/javascripts/result.js.coffee +21 -4
- data/app/assets/javascripts/socialhistory.js.coffee +6 -8
- data/hquery_patientapi.gemspec +10 -4
- data/test/fixtures/patient/barry_berry.json +31 -11
- data/test/test_helper.rb +5 -8
- data/test/unit/patient_api_test.rb +24 -22
- metadata +98 -14
@@ -7,8 +7,8 @@ this.hQuery ||= {}
|
|
7
7
|
|
8
8
|
###*
|
9
9
|
|
10
|
-
The Social History Observation is used to define the patient's occupational, personal (e.g. lifestyle),
|
11
|
-
social, and environmental history and health risk factors, as well as administrative data such as
|
10
|
+
The Social History Observation is used to define the patient's occupational, personal (e.g. lifestyle),
|
11
|
+
social, and environmental history and health risk factors, as well as administrative data such as
|
12
12
|
marital status, race, ethnicity and religious affiliation. The types of conditions
|
13
13
|
described have been constrained to the SNOMED CT code system using constrained code set, 2.16.840.1.113883.3.88.12.80.60:
|
14
14
|
229819007 Tobacco use and exposure
|
@@ -22,19 +22,17 @@ described have been constrained to the SNOMED CT code system using constrained c
|
|
22
22
|
105421008 Educational achievement
|
23
23
|
|
24
24
|
note: Social History is not part of the existing green c32.
|
25
|
-
@exports Socialhistory as hQuery.Socialhistory
|
25
|
+
@exports Socialhistory as hQuery.Socialhistory
|
26
26
|
@augments hQuery.CodedEntry
|
27
|
-
###
|
27
|
+
###
|
28
28
|
class hQuery.Socialhistory extends hQuery.CodedEntry
|
29
|
-
|
29
|
+
|
30
30
|
constructor: (@json) ->
|
31
31
|
super(@json)
|
32
32
|
|
33
|
-
|
33
|
+
|
34
34
|
###*
|
35
35
|
Value returns the value of the result. This will return an object. The properties of this
|
36
36
|
object are dependent on the type of result.
|
37
37
|
###
|
38
38
|
value: -> @json['value']
|
39
|
-
|
40
|
-
|
data/hquery_patientapi.gemspec
CHANGED
@@ -4,11 +4,17 @@ Gem::Specification.new do |s|
|
|
4
4
|
s.name = "hquery-patient-api"
|
5
5
|
s.summary = "A javascript library abstraction for dealing with patients in hQuery map reduce functions"
|
6
6
|
s.description = "A javascript library abstraction for dealing with patients in hQuery map reduce functions"
|
7
|
-
s.email = "
|
7
|
+
s.email = "tacoma-list@lists.mitre.org"
|
8
8
|
s.homepage = "http://github.com/hquery/patient_api"
|
9
|
-
s.authors = ["
|
10
|
-
s.version = '1.0
|
9
|
+
s.authors = ["The MITRE Corporation"]
|
10
|
+
s.version = '1.1.0'
|
11
11
|
|
12
12
|
s.files = `git ls-files`.split("\n")
|
13
|
-
end
|
14
13
|
|
14
|
+
s.add_dependency "sprockets", '2.2.2'
|
15
|
+
s.add_dependency "coffee-script", "~> 2.4"
|
16
|
+
s.add_dependency "uglifier", "~> 3.2"
|
17
|
+
s.add_dependency 'tilt', "~> 1.4"
|
18
|
+
s.add_dependency "libv8", "~> 3.16.14"
|
19
|
+
s.add_dependency "therubyracer", "~> 0.12"
|
20
|
+
end
|
@@ -14,14 +14,8 @@
|
|
14
14
|
"code": "1013",
|
15
15
|
"code_system": "HL7"
|
16
16
|
},
|
17
|
-
"race":
|
18
|
-
|
19
|
-
"code_system": "CDC"
|
20
|
-
},
|
21
|
-
"ethnicity": {
|
22
|
-
"code": "2186-5",
|
23
|
-
"code_system": "CDC"
|
24
|
-
},
|
17
|
+
"race": "2131-1",
|
18
|
+
"ethnicity": "2186-5",
|
25
19
|
"birthPlace": {
|
26
20
|
"city": "Washington",
|
27
21
|
"state": "DC"
|
@@ -452,7 +446,7 @@
|
|
452
446
|
"codes": {
|
453
447
|
"SNOMED-CT": [
|
454
448
|
"273447005"
|
455
|
-
]
|
449
|
+
]
|
456
450
|
},
|
457
451
|
"start_time": 1269762691,
|
458
452
|
"end_time": 1269762693,
|
@@ -468,11 +462,37 @@
|
|
468
462
|
"codes": {
|
469
463
|
"SNOMED-CT": [
|
470
464
|
"273447005"
|
471
|
-
]
|
465
|
+
]
|
472
466
|
},
|
473
467
|
"start_time": 1269762691,
|
474
468
|
"end_time": 1269762693,
|
475
469
|
"anatomicalStructure" : {"code": "13648007", "code_system": "SNOMED-CT"}
|
476
470
|
}
|
471
|
+
],
|
472
|
+
"care_goals" : [
|
473
|
+
{
|
474
|
+
"codes": {
|
475
|
+
"SNOMED-CT": [
|
476
|
+
"273447005"
|
477
|
+
]
|
478
|
+
},
|
479
|
+
"start_time": 1269762691,
|
480
|
+
"end_time": 1269762693,
|
481
|
+
"relatedTo": { "code": "414285001","code_system": "SNOMED-CT" },
|
482
|
+
"targetOutcome": {
|
483
|
+
"unit": "points",
|
484
|
+
"value": 132
|
485
|
+
}
|
486
|
+
},{
|
487
|
+
"codes": {
|
488
|
+
"SNOMED-CT": [
|
489
|
+
"273447005"
|
490
|
+
]
|
491
|
+
},
|
492
|
+
"start_time": 1269762691,
|
493
|
+
"end_time": 1269762693,
|
494
|
+
"relatedTo": { "code": "414285001", "code_system": "SNOMED-CT" },
|
495
|
+
"targetOutcome": { "code": "414285002", "code_system": "SNOMED-CT" }
|
496
|
+
}
|
477
497
|
]
|
478
|
-
}
|
498
|
+
}
|
data/test/test_helper.rb
CHANGED
@@ -2,18 +2,15 @@ require 'tilt'
|
|
2
2
|
require 'coffee_script'
|
3
3
|
require 'sprockets'
|
4
4
|
require 'execjs'
|
5
|
-
|
6
|
-
require 'minitest/autorun'
|
7
|
-
|
8
5
|
require 'bundler/setup'
|
9
6
|
require 'test/unit'
|
10
|
-
|
7
|
+
|
11
8
|
|
12
9
|
Tilt::CoffeeScriptTemplate.default_bare=true
|
13
10
|
class QueryExecutor
|
14
11
|
@@ctx = nil
|
15
|
-
|
16
|
-
def self.ctx
|
12
|
+
|
13
|
+
def self.ctx
|
17
14
|
unless @@ctx
|
18
15
|
@@ctx = Sprockets::Environment.new(File.expand_path("../../", __FILE__))
|
19
16
|
@@ctx.append_path "app/assets/javascripts"
|
@@ -24,5 +21,5 @@ class QueryExecutor
|
|
24
21
|
def self.patient_api_javascript
|
25
22
|
self.ctx.find_asset('patient')
|
26
23
|
end
|
27
|
-
|
28
|
-
end
|
24
|
+
|
25
|
+
end
|
@@ -1,9 +1,5 @@
|
|
1
1
|
require File.expand_path("../../test_helper", __FILE__)
|
2
|
-
|
3
|
-
require 'rhino'
|
4
|
-
else
|
5
|
-
require 'v8'
|
6
|
-
end
|
2
|
+
require 'v8'
|
7
3
|
|
8
4
|
class PatientApiTest < Test::Unit::TestCase
|
9
5
|
def setup
|
@@ -12,21 +8,18 @@ class PatientApiTest < Test::Unit::TestCase
|
|
12
8
|
initialize_patient = 'var patient = new hQuery.Patient(barry);'
|
13
9
|
date = Time.new(2010,1,1)
|
14
10
|
initialize_date = "var sampleDate = new Date(#{date.to_i*1000});"
|
15
|
-
|
16
|
-
|
17
|
-
else
|
18
|
-
@context = V8::Context.new
|
19
|
-
end
|
11
|
+
|
12
|
+
@context = V8::Context.new
|
20
13
|
|
21
14
|
@context.eval(patient_api + "\nvar barry = " + fixture_json + ";\n" + initialize_patient + "\n" + initialize_date)
|
22
15
|
end
|
23
|
-
|
16
|
+
|
24
17
|
def test_utils
|
25
18
|
@context.eval('var encounter = patient.encounters()[0]')
|
26
19
|
assert_equal 2005, @context.eval('encounter.startDate().getFullYear()')
|
27
20
|
@context.eval('encounter.setTimestamp(new Date(2010,1,1))')
|
28
21
|
assert_equal 2010, @context.eval('encounter.startDate().getFullYear()')
|
29
|
-
end
|
22
|
+
end
|
30
23
|
|
31
24
|
def test_demographics
|
32
25
|
assert_equal 'Barry', @context.eval('patient.given()')
|
@@ -51,7 +44,6 @@ class PatientApiTest < Test::Unit::TestCase
|
|
51
44
|
assert_equal 'Care', @context.eval('patient.provider().providerEntity().last()')
|
52
45
|
assert_equal 'en', @context.eval('patient.languages()[0].type()[0].code()')
|
53
46
|
assert_equal true, @context.eval('patient.expired()')
|
54
|
-
assert_equal false, @context.eval('patient.clinicalTrialParticipant()')
|
55
47
|
end
|
56
48
|
|
57
49
|
def test_encounters
|
@@ -100,7 +92,7 @@ class PatientApiTest < Test::Unit::TestCase
|
|
100
92
|
assert_equal '8480-6', @context.eval('patient.vitalSigns()[1].resultType()[0].code()')
|
101
93
|
assert_equal 'BP taken sitting', @context.eval('patient.vitalSigns()[1].comment()')
|
102
94
|
end
|
103
|
-
|
95
|
+
|
104
96
|
def test_results
|
105
97
|
assert_equal 1, @context.eval('patient.results().length')
|
106
98
|
assert_equal '104150001', @context.eval('patient.results()[0].type()[0].code()')
|
@@ -125,7 +117,7 @@ class PatientApiTest < Test::Unit::TestCase
|
|
125
117
|
assert_equal 1, @context.eval('patient.medications().length')
|
126
118
|
assert_equal 24, @context.eval('patient.medications()[0].administrationTiming().period().value()')
|
127
119
|
assert @context.eval('patient.medications()[0].administrationTiming().institutionSpecified()')
|
128
|
-
assert_equal 'tablet', @context.eval('patient.medications()[0].dose().
|
120
|
+
assert_equal 'tablet', @context.eval('patient.medications()[0].dose().units')
|
129
121
|
assert_equal 'Multivitamin', @context.eval('patient.medications()[0].medicationInformation().freeTextProductName()')
|
130
122
|
assert_equal 1, @context.eval('patient.medications().match({"RxNorm": ["89905"]}).length')
|
131
123
|
assert_equal 'C38288', @context.eval('patient.medications()[0].route().code()')
|
@@ -137,7 +129,7 @@ class PatientApiTest < Test::Unit::TestCase
|
|
137
129
|
assert_equal 3, @context.eval('patient.medications()[0].cumulativeMedicationDuration()["scalar"]')
|
138
130
|
assert_equal "195911009", @context.eval('patient.medications()[0].reason().code()')
|
139
131
|
end
|
140
|
-
|
132
|
+
|
141
133
|
def test_immunizations
|
142
134
|
assert_equal 3, @context.eval('patient.immunizations().length')
|
143
135
|
assert_equal 2, @context.eval('patient.immunizations().withoutNegation().length')
|
@@ -162,7 +154,7 @@ class PatientApiTest < Test::Unit::TestCase
|
|
162
154
|
assert_equal 'MD', @context.eval('patient.immunizations()[1].performer().person().addresses()[0].state()')
|
163
155
|
assert_equal '20899', @context.eval('patient.immunizations()[1].performer().person().addresses()[0].postalCode()')
|
164
156
|
end
|
165
|
-
|
157
|
+
|
166
158
|
def test_allergies
|
167
159
|
assert_equal 1, @context.eval('patient.allergies().length')
|
168
160
|
assert_equal 'Carries Epipen',@context.eval('patient.allergies()[0].comment()')
|
@@ -176,17 +168,17 @@ class PatientApiTest < Test::Unit::TestCase
|
|
176
168
|
assert_equal 1269762693000, @context.eval('patient.allergies()[0].endDate().getTime()')
|
177
169
|
assert @context.eval('patient.allergies()[0].isTimeRange()')
|
178
170
|
end
|
179
|
-
|
171
|
+
|
180
172
|
def test_pregnancies
|
181
173
|
assert_equal 1, @context.eval('patient.pregnancies().length')
|
182
174
|
assert_equal 1, @context.eval('patient.pregnancies().match({"SNOMED-CT": ["77386006"]}).length')
|
183
175
|
end
|
184
|
-
|
176
|
+
|
185
177
|
def test_socialhistory
|
186
178
|
assert_equal 1, @context.eval('patient.socialHistories().length')
|
187
179
|
assert_equal 1, @context.eval('patient.socialHistories().match({"SNOMED-CT": ["229819007"]}).length')
|
188
180
|
end
|
189
|
-
|
181
|
+
|
190
182
|
def test_functional_status
|
191
183
|
assert_equal 1, @context.eval('patient.functionalStatuses().length')
|
192
184
|
assert_equal 'result', @context.eval('patient.functionalStatuses()[0].type()')
|
@@ -197,5 +189,15 @@ class PatientApiTest < Test::Unit::TestCase
|
|
197
189
|
assert_equal 1, @context.eval('patient.medicalEquipment().length')
|
198
190
|
assert_equal '13648007', @context.eval('patient.medicalEquipment()[0].anatomicalStructure().code()')
|
199
191
|
end
|
200
|
-
|
201
|
-
|
192
|
+
|
193
|
+
def test_care_goals
|
194
|
+
assert_equal 2, @context.eval('patient.careGoals().length')
|
195
|
+
assert_equal '414285001', @context.eval('patient.careGoals()[0].relatedTo().code()')
|
196
|
+
assert_equal 'SNOMED-CT', @context.eval('patient.careGoals()[0].relatedTo().codeSystemName()')
|
197
|
+
assert_equal 132, @context.eval('patient.careGoals()[0].targetOutcome().value()')
|
198
|
+
assert_equal 'points', @context.eval('patient.careGoals()[0].targetOutcome().unit()')
|
199
|
+
assert_equal '414285002', @context.eval('patient.careGoals()[1].targetOutcome().code()')
|
200
|
+
assert_equal 'SNOMED-CT', @context.eval('patient.careGoals()[1].targetOutcome().codeSystemName()')
|
201
|
+
end
|
202
|
+
|
203
|
+
end
|
metadata
CHANGED
@@ -1,27 +1,108 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hquery-patient-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
8
|
-
- Andy Gregorowicz
|
9
|
-
- Rob Dingwell
|
10
|
-
- Andre Quina
|
7
|
+
- The MITRE Corporation
|
11
8
|
autorequire:
|
12
9
|
bindir: bin
|
13
10
|
cert_chain: []
|
14
|
-
date:
|
15
|
-
dependencies:
|
11
|
+
date: 2017-11-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: sprockets
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.2.2
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.2.2
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: coffee-script
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.4'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.4'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: uglifier
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.2'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: tilt
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.4'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.4'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: libv8
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 3.16.14
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 3.16.14
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: therubyracer
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.12'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.12'
|
16
97
|
description: A javascript library abstraction for dealing with patients in hQuery
|
17
98
|
map reduce functions
|
18
|
-
email:
|
99
|
+
email: tacoma-list@lists.mitre.org
|
19
100
|
executables: []
|
20
101
|
extensions: []
|
21
102
|
extra_rdoc_files: []
|
22
103
|
files:
|
23
|
-
- .gitignore
|
24
|
-
- .travis.yml
|
104
|
+
- ".gitignore"
|
105
|
+
- ".travis.yml"
|
25
106
|
- Gemfile
|
26
107
|
- Gemfile.lock
|
27
108
|
- LICENSE
|
@@ -29,10 +110,14 @@ files:
|
|
29
110
|
- Rakefile
|
30
111
|
- VERSION
|
31
112
|
- app/assets/javascripts/allergy.js.coffee
|
113
|
+
- app/assets/javascripts/assessment.js.coffee
|
114
|
+
- app/assets/javascripts/careexperience.js.coffee
|
32
115
|
- app/assets/javascripts/caregoal.js.coffee
|
116
|
+
- app/assets/javascripts/communication.js.coffee
|
33
117
|
- app/assets/javascripts/condition.js.coffee
|
34
118
|
- app/assets/javascripts/core.js.coffee
|
35
119
|
- app/assets/javascripts/encounter.js.coffee
|
120
|
+
- app/assets/javascripts/familyhistory.js.coffee
|
36
121
|
- app/assets/javascripts/functionalstatus.js.coffee
|
37
122
|
- app/assets/javascripts/immunization.js.coffee
|
38
123
|
- app/assets/javascripts/languages.js.coffee
|
@@ -174,20 +259,19 @@ require_paths:
|
|
174
259
|
- lib
|
175
260
|
required_ruby_version: !ruby/object:Gem::Requirement
|
176
261
|
requirements:
|
177
|
-
- -
|
262
|
+
- - ">="
|
178
263
|
- !ruby/object:Gem::Version
|
179
264
|
version: '0'
|
180
265
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
181
266
|
requirements:
|
182
|
-
- -
|
267
|
+
- - ">="
|
183
268
|
- !ruby/object:Gem::Version
|
184
269
|
version: '0'
|
185
270
|
requirements: []
|
186
271
|
rubyforge_project:
|
187
|
-
rubygems_version: 2.
|
272
|
+
rubygems_version: 2.6.12
|
188
273
|
signing_key:
|
189
274
|
specification_version: 4
|
190
275
|
summary: A javascript library abstraction for dealing with patients in hQuery map
|
191
276
|
reduce functions
|
192
277
|
test_files: []
|
193
|
-
has_rdoc:
|