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 CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- M2Y1Y2Q5N2U3Yjk2MmVmMDk2MWU2ZjNkN2VkYjhhZGNiZGRjZjg3YQ==
5
- data.tar.gz: !binary |-
6
- Y2ViOGY3NTE2NmFkNmJiNTY5NWNhNzk0ZTA3ZDQ1NjlkNjE0YjkwYQ==
2
+ SHA1:
3
+ metadata.gz: 15289c54979a12c15e61172d0c4de64e3b48de57
4
+ data.tar.gz: c32fae07a30e84a81a532bfa8c2ce9c6d6907b61
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- YWIxNmM0OTYwZjQxNWQyYjgzMzgxNDdmMzYzYjY3OGE3YjMyYmVjYjVhZjE3
10
- NmRlNWU5ODgzNzc1Y2IwOTc5ZWQ2YjY1YTk1M2Q2MGQ1MWZlNWYwYmI1M2Ri
11
- OTZmOWUxNzVmZjBkOTljYWFjMGUzZWY1NzEzY2I0NDA1YjNhZmE=
12
- data.tar.gz: !binary |-
13
- MmNlYzQ4OWVlNzdmNWNmNTAxNmY2ZmYyN2Y5MGY0MWUxNGU4NzEwYTlhMzgx
14
- YjM4NDU1OGNiYjE3MjAxOGYzOGFiZGJjNmI4YWE5MmU0NGVjODhmMDFmMzNi
15
- NzdlY2E5MjhiMDNjZTcyNGM4NzM1MDZhMWMwOWZkMDljM2FlMDI=
6
+ metadata.gz: 740f709cec2ec05c320b53aaae72ab51543739a02d7963a4e26ee9e7772c11008f7669e5175ccaa94011c27b23404b1e49b2eb6ad5f008900f148af93969ca0e
7
+ data.tar.gz: 5baa93db647fef81863ae6ebdbeb04d88265f439e87d9d33424e6dc818e056d2d4262000a38a006a0a50a3b413fe7ac7f36f88dc46b7e9ebe1e807f546c19829
data/Gemfile CHANGED
@@ -1,21 +1,8 @@
1
1
  source 'https://rubygems.org'
2
+ gemspec
2
3
 
3
- gem 'sprockets', '2.2.2'
4
- gem 'coffee-script'
5
- gem 'uglifier'
6
- gem 'rake'
7
- gem 'tilt'
8
-
9
- group :test do
10
- gem 'minitest', '~> 4.0'
4
+ group :development, :test do
5
+ gem 'test-unit'
11
6
  gem 'turn', :require => false
12
-
13
- platforms :ruby do
14
- gem "libv8"
15
- gem "therubyracer", :require => 'v8'
16
- end
17
-
18
- platforms :jruby do
19
- gem "therubyrhino"
20
- end
7
+ gem 'rake'
21
8
  end
@@ -1,44 +1,56 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ hquery-patient-api (1.1.0)
5
+ coffee-script (~> 2.4)
6
+ libv8 (~> 3.16.14)
7
+ sprockets (= 2.2.2)
8
+ therubyracer (~> 0.12)
9
+ tilt (~> 1.4)
10
+ uglifier (~> 3.2)
11
+
1
12
  GEM
2
13
  remote: https://rubygems.org/
3
14
  specs:
4
- ansi (1.4.2)
5
- coffee-script (2.2.0)
15
+ ansi (1.5.0)
16
+ coffee-script (2.4.1)
6
17
  coffee-script-source
7
18
  execjs
8
- coffee-script-source (1.3.1)
9
- execjs (1.3.0)
10
- multi_json (~> 1.0)
19
+ coffee-script-source (1.12.2)
20
+ execjs (2.7.0)
11
21
  hike (1.2.3)
12
- libv8 (3.3.10.4)
22
+ libv8 (3.16.14.19)
13
23
  minitest (4.7.5)
14
- multi_json (1.3.2)
15
- rack (1.5.2)
16
- rake (0.9.2.2)
24
+ multi_json (1.12.2)
25
+ power_assert (0.2.6)
26
+ rack (1.6.8)
27
+ rake (12.2.1)
28
+ ref (2.0.0)
17
29
  sprockets (2.2.2)
18
30
  hike (~> 1.2)
19
31
  multi_json (~> 1.0)
20
32
  rack (~> 1.0)
21
33
  tilt (~> 1.1, != 1.3.0)
22
- therubyracer (0.10.2)
23
- libv8 (~> 3.3.10)
24
- tilt (1.3.3)
25
- turn (0.9.5)
34
+ test-unit (3.1.5)
35
+ power_assert
36
+ therubyracer (0.12.2)
37
+ libv8 (~> 3.16.14.0)
38
+ ref
39
+ tilt (1.4.1)
40
+ turn (0.9.7)
26
41
  ansi
27
- uglifier (1.2.4)
28
- execjs (>= 0.3.0)
29
- multi_json (>= 1.0.2)
42
+ minitest (~> 4)
43
+ uglifier (3.2.0)
44
+ execjs (>= 0.3.0, < 3)
30
45
 
31
46
  PLATFORMS
32
47
  ruby
33
48
 
34
49
  DEPENDENCIES
35
- coffee-script
36
- libv8
37
- minitest (~> 4.0)
50
+ hquery-patient-api!
38
51
  rake
39
- sprockets (= 2.2.2)
40
- therubyracer
41
- therubyrhino
42
- tilt
52
+ test-unit
43
53
  turn
44
- uglifier
54
+
55
+ BUNDLED WITH
56
+ 1.15.4
data/Rakefile CHANGED
@@ -7,39 +7,35 @@ require 'fileutils'
7
7
  task :default => [:test]
8
8
 
9
9
  desc "Run basic tests"
10
- Rake::TestTask.new(:test_unit) do |t|
11
- t.libs << "test"
10
+ Rake::TestTask.new(:test) do |t|
11
+ t.libs << "test" << "lib"
12
12
  t.test_files = FileList['test/**/*_test.rb']
13
13
  t.verbose = true
14
14
  end
15
15
 
16
- task :test => [:test_unit] do
17
-
18
- end
19
-
20
16
  namespace :doc do
21
17
  desc "Generate JS from CoffeeScript"
22
18
  task :generate_js do
23
19
  ctx = Sprockets::Environment.new(File.expand_path("../", __FILE__))
24
- Tilt::CoffeeScriptTemplate.default_bare=true
20
+ Tilt::CoffeeScriptTemplate.default_bare=true
25
21
  ctx.append_path "app/assets/javascripts"
26
22
  api = ctx.find_asset('patient')
27
-
23
+
28
24
  Dir.mkdir('tmp') unless Dir.exists?( 'tmp')
29
-
25
+
30
26
  File.open('tmp/patient.js', 'w+') do |js_file|
31
27
  js_file.write api
32
28
  end
33
29
  end
34
-
30
+
35
31
  desc "Generate docs for patient API"
36
32
  task :js => :generate_js do
37
33
  system 'java -jar ./doc/jsdoc-toolkit/jsrun.jar ./doc/jsdoc-toolkit/app/run.js -t=doc/jsdoc-toolkit/templates/jsdoc -a tmp/patient.js -d=doc/patient-api'
38
34
  end
39
-
35
+
40
36
  task :copydir do
41
37
  Dir.mkdir('patientapi') unless Dir.exists? ('patientapi')
42
38
  cp_r "doc/patient-api", "../query-composer/public/patientapi"
43
39
  end
44
-
40
+
45
41
  end
@@ -6,25 +6,25 @@ this.hQuery ||= {}
6
6
  # =require core.coffee
7
7
 
8
8
  ###*
9
- @class
9
+ @class
10
10
  @augments hQuery.CodedEntry
11
11
  @exports Allergy as hQuery.Allergy
12
12
  ###
13
13
  class hQuery.Allergy extends hQuery.CodedEntry
14
14
  constructor: (@json) ->
15
15
  super(@json)
16
-
16
+
17
17
  ###*
18
18
  Food and substance allergies use the Unique Ingredient Identifier(UNII) from the FDA
19
19
  http://www.fda.gov/ForIndustry/DataStandards/StructuredProductLabeling/ucm162523.htm
20
-
21
- Allegies to a class of medication Shall contain a value descending from the NDF-RT concept types
22
- of Mechanism of Action - N0000000223, Physiologic Effect - N0000009802 or
23
- Chemical Structure - N0000000002. NUI will be used as the concept code.
24
- For more information, please see the Web Site
20
+
21
+ Allegies to a class of medication Shall contain a value descending from the NDF-RT concept types
22
+ of Mechanism of Action - N0000000223, Physiologic Effect - N0000009802 or
23
+ Chemical Structure - N0000000002. NUI will be used as the concept code.
24
+ For more information, please see the Web Site
25
25
  http://www.cancer.gov/cancertopics/terminologyresources/page5
26
-
27
- Allergies to a specific medication shall use RxNorm for the values.
26
+
27
+ Allergies to a specific medication shall use RxNorm for the values.
28
28
  @returns {CodedValue}
29
29
  ###
30
30
  product: -> this.type()
@@ -42,7 +42,7 @@ class hQuery.Allergy extends hQuery.CodedEntry
42
42
  adverseEventType: -> hQuery.createCodedValue @json['type']
43
43
 
44
44
  ###*
45
- This indicates the reaction that may be caused by the product or agent.
45
+ This indicates the reaction that may be caused by the product or agent.
46
46
  It is defined by 2.16.840.1.113883.3.88.12.3221.6.2 and are SNOMED-CT codes.
47
47
  420134006 Propensity to adverse reactions (disorder)
48
48
  418038007 Propensity to adverse reactions to substance (disorder)
@@ -53,7 +53,7 @@ class hQuery.Allergy extends hQuery.CodedEntry
53
53
  414285001 Food allergy (disorder)
54
54
  59037007 Drug intolerance (disorder)
55
55
  235719002 Food intolerance (disorder)
56
- @returns {CodedValue}
56
+ @returns {CodedValue}
57
57
  ###
58
58
  reaction: -> hQuery.createCodedValue @json['reaction']
59
59
 
@@ -66,7 +66,7 @@ class hQuery.Allergy extends hQuery.CodedEntry
66
66
  371924009 Moderate to Severe
67
67
  24484000 Severe
68
68
  399166001 Fatal
69
- @returns {CodedValue}
69
+ @returns {CodedValue}
70
70
  ###
71
71
  severity: -> hQuery.createCodedValue @json['severity']
72
72
 
@@ -75,5 +75,3 @@ class hQuery.Allergy extends hQuery.CodedEntry
75
75
  @returns {String}
76
76
  ###
77
77
  comment: -> @json['comment']
78
-
79
-
@@ -0,0 +1,21 @@
1
+ ###*
2
+ @namespace scoping into the hquery namespace
3
+ ###
4
+ this.hQuery ||= {}
5
+
6
+
7
+ # =require core.coffee
8
+ ###*
9
+ This represents all care experience.
10
+ @class
11
+ @augments hQuery.CodedEntry
12
+ @exports Assessment as hQuery.Assessment
13
+ ###
14
+ class hQuery.Assessment extends hQuery.CodedEntry
15
+ constructor: (@json) ->
16
+ super(@json)
17
+
18
+ ###*
19
+ @returns {CodedValue}
20
+ ###
21
+ method: -> hQuery.createCodedValue @json['method']
@@ -0,0 +1,23 @@
1
+ ###*
2
+ @namespace scoping into the hquery namespace
3
+ ###
4
+ this.hQuery ||= {}
5
+
6
+
7
+ # =require core.coffee
8
+ ###*
9
+ This represents all care experience.
10
+ @class
11
+ @augments hQuery.CodedEntry
12
+ @exports CareExperience as hQuery.CareExperience
13
+ ###
14
+ class hQuery.CareExperience extends hQuery.CodedEntry
15
+ constructor: (@json) ->
16
+ super(@json)
17
+
18
+
19
+ ###*
20
+ Value returns the value of the result. This will return an object. The properties of this
21
+ object are dependent on the type of result.
22
+ ###
23
+ value: -> @json['value']
@@ -9,10 +9,25 @@ this.hQuery ||= {}
9
9
 
10
10
  The plan of care contains data defining prospective or intended orders, interventions, encounters, services, and procedures for the patient.
11
11
 
12
- @exports CareGoal as hQuery.CareGoal
12
+ @exports CareGoal as hQuery.CareGoal
13
13
  @augments hQuery.CodedEntry
14
- ###
14
+ ###
15
15
  class hQuery.CareGoal extends hQuery.CodedEntry
16
-
16
+
17
17
  constructor: (@json) ->
18
18
  super(@json)
19
+
20
+ ###*
21
+ @returns {CodedValue}
22
+ ###
23
+ relatedTo: -> hQuery.createCodedValue @json['relatedTo']
24
+
25
+
26
+ ###*
27
+ @returns {CodedValue}
28
+ ###
29
+ targetOutcome: ->
30
+ if @json['targetOutcome']?['unit']?
31
+ new hQuery.Scalar @json['targetOutcome']
32
+ else if @json['targetOutcome']?
33
+ hQuery.createCodedValue @json['targetOutcome']
@@ -0,0 +1,22 @@
1
+ ###*
2
+ @namespace scoping into the hquery namespace
3
+ ###
4
+ this.hQuery ||= {}
5
+
6
+
7
+ # =require core.coffee
8
+ ###*
9
+ This represents all communications.
10
+ @class
11
+ @augments hQuery.CodedEntry
12
+ @exports Communication as hQuery.Communication
13
+ ###
14
+ class hQuery.Communication extends hQuery.CodedEntry
15
+ constructor: (@json) ->
16
+ super(@json)
17
+
18
+ ###*
19
+ @returns {CodedValue}
20
+ ###
21
+ direction: -> new hQuery.createCodedValue @json['direction']
22
+
@@ -29,20 +29,20 @@ class hQuery.CauseOfDeath
29
29
  This section is used to describe a patients problems/conditions. The types of conditions
30
30
  described have been constrained to the SNOMED CT Problem Type code set. An unbounded
31
31
  number of treating providers for the particular condition can be supplied.
32
- @exports Condition as hQuery.Condition
32
+ @exports Condition as hQuery.Condition
33
33
  @augments hQuery.CodedEntry
34
- ###
34
+ ###
35
35
  class hQuery.Condition extends hQuery.CodedEntry
36
-
36
+
37
37
  constructor: (@json) ->
38
38
  super(@json)
39
-
39
+
40
40
  ###*
41
41
  @returns {Array, hQuery.Provider} an array of providers for the condition
42
42
  ###
43
43
  providers: ->
44
- for provider in @json['treatingProviders']
45
- new Provider provider
44
+ for provider in @json['treatingProviders']
45
+ new Provider provider
46
46
 
47
47
  ###*
48
48
  Diagnosis Priority
@@ -61,28 +61,43 @@ class hQuery.Condition extends hQuery.CodedEntry
61
61
  @returns {int}
62
62
  ###
63
63
  ageAtOnset: -> @json['ageAtOnset']
64
-
65
-
64
+
65
+
66
66
  ###*
67
67
  cause of death
68
68
  @returns {hQuery.CauseOfDeath}
69
69
  ###
70
70
  causeOfDeath: -> new hQuery.CauseOfDeath @json['causeOfDeath'] if @json['causeOfDeath']
71
-
71
+
72
72
  ###*
73
73
  problem status
74
74
  @returns {hQuery.CodedValue}
75
75
  ###
76
76
  problemStatus: -> hQuery.createCodedValue @json['problemStatus']
77
-
77
+
78
78
  ###*
79
79
  comment
80
80
  @returns {String}
81
81
  ###
82
82
  comment: -> @json['comment']
83
-
83
+
84
84
  ###*
85
85
  This is a description of the level of the severity of the condition.
86
- @returns {CodedValue}
86
+ @returns {CodedValue}
87
+ ###
88
+ severity: -> hQuery.createCodedValue @json['severity']
89
+
90
+ ###*
91
+ @returns {CodedValue}
92
+ ###
93
+ reaction: -> new hQuery.createCodedValue @json['reaction']
94
+
95
+ ###*
96
+ @returns {CodedValue}
97
+ ###
98
+ laterality: -> hQuery.createCodedValue @json['laterality']
99
+
100
+ ###*
101
+ @returns {CodedValue}
87
102
  ###
88
- severity: -> hQuery.createCodedValue @json['severity']
103
+ anatomicalLocation: -> hQuery.createCodedValue @json['anatomical_location']
@@ -52,7 +52,7 @@ class hQuery.CodedValue
52
52
  @returns {String} the code system name
53
53
  ###
54
54
  codeSystemName: -> @csn
55
-
55
+
56
56
  @normalize: (val) ->
57
57
  String(val).toLowerCase()
58
58
 
@@ -171,11 +171,11 @@ class hQuery.Person
171
171
  @returns {String} the last/family name of the person
172
172
  ###
173
173
  last: -> @json['last']
174
-
174
+
175
175
  ###*
176
176
  @returns {String} the display name of the person
177
177
  ###
178
- name: ->
178
+ name: ->
179
179
  if @json['name']
180
180
  @json['name']
181
181
  else
@@ -190,7 +190,7 @@ class hQuery.Person
190
190
  for address in @json['addresses']
191
191
  list.push(new hQuery.Address(address))
192
192
  list
193
-
193
+
194
194
  ###*
195
195
  @returns {Array} an array of {@link hQuery.Telecom} objects associated with the person
196
196
  ###
@@ -219,17 +219,17 @@ class hQuery.Actor
219
219
  ###
220
220
  class hQuery.Organization
221
221
  constructor: (@json) ->
222
-
222
+
223
223
  ###*
224
224
  @returns {String} the id for the organization
225
225
  ###
226
226
  organizationId: -> @json['organizationId']
227
-
227
+
228
228
  ###*
229
229
  @returns {String} the name of the organization
230
230
  ###
231
231
  organizationName: -> @json['name']
232
-
232
+
233
233
  ###*
234
234
  @returns {Array} an array of {@link hQuery.Address} objects associated with the organization
235
235
  ###
@@ -239,7 +239,7 @@ class hQuery.Organization
239
239
  for address in @json['addresses']
240
240
  list.push(new hQuery.Address(address))
241
241
  list
242
-
242
+
243
243
  ###*
244
244
  @returns {Array} an array of {@link hQuery.Telecom} objects associated with the organization
245
245
  ###
@@ -346,7 +346,7 @@ class hQuery.CodedEntry
346
346
  # id of the entry from the source document if available
347
347
  @source_id = @json['id']
348
348
  @_freeTextType = @json['description']
349
-
349
+
350
350
  ###*
351
351
  Adjust the start and end times of this event to the supplied timestamp
352
352
  ###
@@ -385,12 +385,12 @@ class hQuery.CodedEntry
385
385
  isTimeRange: -> @_startDate? && @_endDate?
386
386
 
387
387
  ###*
388
- Determines whether a coded entry contains sufficient information (code and at least
388
+ Determines whether a coded entry contains sufficient information (code and at least
389
389
  one time stamp) to be usable
390
390
  @returns {boolean}
391
391
  ###
392
392
  isUsable: -> @_type.length>0 && (@_date || @_startDate || @_endDate)
393
-
393
+
394
394
  ###*
395
395
  An Array of CodedValues which describe what kind of coded entry took place
396
396
  @returns {Array}
@@ -441,7 +441,7 @@ class hQuery.CodedEntry
441
441
  @returns {Boolean} whether the entry was negated
442
442
  ###
443
443
  negationInd: -> @json['negationInd'] || false
444
-
444
+
445
445
  ###*
446
446
  Returns the values of the result. This will return an array that contains
447
447
  PhysicalQuantity or CodedValue objects depending on the result type.
@@ -469,7 +469,23 @@ class hQuery.CodedEntry
469
469
  @returns {hQuery.CodedValue} Used to explain the rationale for a given entry.
470
470
  ###
471
471
  reason: -> hQuery.createCodedValue @json['reason']
472
-
472
+
473
+ ###*
474
+ @returns {CodedEntryList}
475
+ ###
476
+ providerPreference: -> new hQuery.CodedEntryList @json['providerPreference']
477
+
478
+
479
+ ###*
480
+ @returns {CodedEntryList}
481
+ ###
482
+ patientPreference: -> new hQuery.CodedEntryList @json['patientPreference']
483
+
484
+ ###*
485
+ The health record field is the location within an electronic record where the data should be found
486
+ @returns {CodedValue}
487
+ ###
488
+ healthRecordField: -> hQuery.createCodedValue @json['health_record_field']
473
489
 
474
490
  ###*
475
491
  @class Represents a list of hQuery.CodedEntry instances. Offers utility methods for matching
@@ -487,7 +503,7 @@ class hQuery.CodedEntryList extends Array
487
503
  pushIfUsable: (entry) ->
488
504
  if entry.isUsable()
489
505
  this.push(entry)
490
-
506
+
491
507
  ###*
492
508
  Return the number of entries that match the
493
509
  supplied code set where those entries occur between the supplied time bounds