hqmf2js 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/.gitignore +10 -0
  2. data/.travis.yml +17 -0
  3. data/Gemfile +41 -0
  4. data/Gemfile.lock +202 -0
  5. data/README.md +7 -0
  6. data/Rakefile +22 -0
  7. data/VERSION +1 -0
  8. data/app/assets/javascripts/hqmf_util.js.coffee +776 -0
  9. data/app/assets/javascripts/logging_utils.js.coffee +150 -0
  10. data/app/assets/javascripts/patient_api_extension.js.coffee +36 -0
  11. data/app/assets/javascripts/specifics.js.coffee +462 -0
  12. data/bin/hqmf2js.rb +25 -0
  13. data/config/warble.rb +144 -0
  14. data/hqmf2js.gemspec +20 -0
  15. data/lib/config/codes.xml +1935 -0
  16. data/lib/generator/characteristic.js.erb +19 -0
  17. data/lib/generator/codes_to_json.rb +81 -0
  18. data/lib/generator/converter.rb +60 -0
  19. data/lib/generator/data_criteria.js.erb +47 -0
  20. data/lib/generator/derived_data.js.erb +5 -0
  21. data/lib/generator/js.rb +263 -0
  22. data/lib/generator/measure_period.js.erb +18 -0
  23. data/lib/generator/patient_data.js.erb +22 -0
  24. data/lib/generator/population_criteria.js.erb +4 -0
  25. data/lib/generator/precondition.js.erb +14 -0
  26. data/lib/hqmf2js.rb +20 -0
  27. data/lib/hquery/engine.rb +4 -0
  28. data/lib/tasks/codes.rake +12 -0
  29. data/lib/tasks/coffee.rake +15 -0
  30. data/lib/tasks/convert.rake +47 -0
  31. data/lib/tasks/cover_me.rake +8 -0
  32. data/test/fixtures/NQF59New.xml +1047 -0
  33. data/test/fixtures/codes/codes.xls +0 -0
  34. data/test/fixtures/codes/codes.xml +1941 -0
  35. data/test/fixtures/i2b2.xml +305 -0
  36. data/test/fixtures/invalid/missing_id.xml +18 -0
  37. data/test/fixtures/invalid/unknown_criteria_type.xml +16 -0
  38. data/test/fixtures/invalid/unknown_demographic_entry.xml +16 -0
  39. data/test/fixtures/invalid/unknown_population_type.xml +9 -0
  40. data/test/fixtures/invalid/unknown_value_type.xml +18 -0
  41. data/test/fixtures/js/59New.js +366 -0
  42. data/test/fixtures/js/test1.js +356 -0
  43. data/test/fixtures/js/test2.js +366 -0
  44. data/test/fixtures/json/0043.json +6 -0
  45. data/test/fixtures/json/0043_hqmf1.json +1 -0
  46. data/test/fixtures/json/0043_hqmf2.json +172 -0
  47. data/test/fixtures/json/59New.json +1352 -0
  48. data/test/fixtures/patient_api.js +2823 -0
  49. data/test/fixtures/patients/francis_drake.json +1180 -0
  50. data/test/fixtures/patients/larry_vanderman.json +645 -0
  51. data/test/test_helper.rb +58 -0
  52. data/test/unit/codes_to_json_test.rb +38 -0
  53. data/test/unit/effective_date_test.rb +48 -0
  54. data/test/unit/hqmf_from_json_javascript_test.rb +108 -0
  55. data/test/unit/hqmf_javascript_test.rb +175 -0
  56. data/test/unit/library_function_test.rb +553 -0
  57. data/test/unit/specifics_test.rb +757 -0
  58. metadata +183 -0
@@ -0,0 +1,2823 @@
1
+ /**
2
+ @namespace scoping into the hquery namespace
3
+ */
4
+
5
+ var __hasProp = {}.hasOwnProperty,
6
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; },
7
+ __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
8
+
9
+ this.hQuery || (this.hQuery = {});
10
+
11
+ /**
12
+ Converts a a number in UTC Seconds since the epoch to a date.
13
+ @param {number} utcSeconds seconds since the epoch in UTC
14
+ @returns {Date}
15
+ @function
16
+ @exports dateFromUtcSeconds as hQuery.dateFromUtcSeconds
17
+ */
18
+
19
+
20
+ hQuery.dateFromUtcSeconds = function(utcSeconds) {
21
+ return new Date(utcSeconds * 1000);
22
+ };
23
+
24
+ /**
25
+ @class Scalar - a representation of a unit and value
26
+ @exports Scalar as hQuery.Scalar
27
+ */
28
+
29
+
30
+ hQuery.Scalar = (function() {
31
+
32
+ Scalar.name = 'Scalar';
33
+
34
+ function Scalar(json) {
35
+ this.json = json;
36
+ }
37
+
38
+ Scalar.prototype.unit = function() {
39
+ return this.json['unit'];
40
+ };
41
+
42
+ Scalar.prototype.value = function() {
43
+ return this.json['value'];
44
+ };
45
+
46
+ return Scalar;
47
+
48
+ })();
49
+
50
+ /**
51
+ @class A code with its corresponding code system
52
+ @exports CodedValue as hQuery.CodedValue
53
+ */
54
+
55
+
56
+ hQuery.CodedValue = (function() {
57
+
58
+ CodedValue.name = 'CodedValue';
59
+
60
+ /**
61
+ @param {String} c value of the code
62
+ @param {String} csn name of the code system that the code belongs to
63
+ @constructs
64
+ */
65
+
66
+
67
+ function CodedValue(c, csn) {
68
+ this.c = c;
69
+ this.csn = csn;
70
+ }
71
+
72
+ /**
73
+ @returns {String} the code
74
+ */
75
+
76
+
77
+ CodedValue.prototype.code = function() {
78
+ return this.c;
79
+ };
80
+
81
+ /**
82
+ @returns {String} the code system name
83
+ */
84
+
85
+
86
+ CodedValue.prototype.codeSystemName = function() {
87
+ return this.csn;
88
+ };
89
+
90
+ /**
91
+ Returns true if the contained code and codeSystemName match a code in the supplied codeSet.
92
+ @param {Object} codeSet a hash with code system names as keys and an array of codes as values
93
+ @returns {boolean}
94
+ */
95
+
96
+
97
+ CodedValue.prototype.includedIn = function(codeSet) {
98
+ var code, codeSystemName, codes, _i, _len;
99
+ for (codeSystemName in codeSet) {
100
+ codes = codeSet[codeSystemName];
101
+ if (this.csn === codeSystemName) {
102
+ for (_i = 0, _len = codes.length; _i < _len; _i++) {
103
+ code = codes[_i];
104
+ if (code === this.c) {
105
+ return true;
106
+ }
107
+ }
108
+ }
109
+ }
110
+ return false;
111
+ };
112
+
113
+ return CodedValue;
114
+
115
+ })();
116
+
117
+ /**
118
+ Status as defined by value set 2.16.840.1.113883.5.14,
119
+ the ActStatus vocabulary maintained by HL7
120
+
121
+ @class Status
122
+ @augments hQuery.CodedEntry
123
+ @exports Status as hQuery.Status
124
+ */
125
+
126
+
127
+ hQuery.Status = (function(_super) {
128
+ var ABORTED, ACTIVE, CANCELLED, COMPLETED, HELD, NEW, NORMAL, NULLIFIED, OBSOLETE, SUSPENDED;
129
+
130
+ __extends(Status, _super);
131
+
132
+ Status.name = 'Status';
133
+
134
+ function Status() {
135
+ return Status.__super__.constructor.apply(this, arguments);
136
+ }
137
+
138
+ NORMAL = "normal";
139
+
140
+ ABORTED = "aborted";
141
+
142
+ ACTIVE = "active";
143
+
144
+ CANCELLED = "cancelled";
145
+
146
+ COMPLETED = "completed";
147
+
148
+ HELD = "held";
149
+
150
+ NEW = "new";
151
+
152
+ SUSPENDED = "suspended";
153
+
154
+ NULLIFIED = "nullified";
155
+
156
+ OBSOLETE = "obsolete";
157
+
158
+ Status.prototype.isNormal = function() {
159
+ return this.c === NORMAL;
160
+ };
161
+
162
+ Status.prototype.isAborted = function() {
163
+ return this.c === ABORTED;
164
+ };
165
+
166
+ Status.prototype.isActive = function() {
167
+ return this.c === ACTIVE;
168
+ };
169
+
170
+ Status.prototype.isCancelled = function() {
171
+ return this.c === CANCELLED;
172
+ };
173
+
174
+ Status.prototype.isCompleted = function() {
175
+ return this.c === COMPLETED;
176
+ };
177
+
178
+ Status.prototype.isHeld = function() {
179
+ return this.c === HELD;
180
+ };
181
+
182
+ Status.prototype.isNew = function() {
183
+ return this.c === NEW;
184
+ };
185
+
186
+ Status.prototype.isSuspended = function() {
187
+ return this.c === SUSPENDED;
188
+ };
189
+
190
+ Status.prototype.isNullified = function() {
191
+ return this.c === NULLIFIED;
192
+ };
193
+
194
+ Status.prototype.isObsolete = function() {
195
+ return this.c === OBSOLETE;
196
+ };
197
+
198
+ return Status;
199
+
200
+ })(hQuery.CodedValue);
201
+
202
+ /**
203
+ @class an Address for a person or organization
204
+ @exports Address as hQuery.Address
205
+ */
206
+
207
+
208
+ hQuery.Address = (function() {
209
+
210
+ Address.name = 'Address';
211
+
212
+ function Address(json) {
213
+ this.json = json;
214
+ }
215
+
216
+ /**
217
+ @returns {Array[String]} the street addresses
218
+ */
219
+
220
+
221
+ Address.prototype.street = function() {
222
+ return this.json['street'];
223
+ };
224
+
225
+ /**
226
+ @returns {String} the city
227
+ */
228
+
229
+
230
+ Address.prototype.city = function() {
231
+ return this.json['city'];
232
+ };
233
+
234
+ /**
235
+ @returns {String} the State
236
+ */
237
+
238
+
239
+ Address.prototype.state = function() {
240
+ return this.json['state'];
241
+ };
242
+
243
+ /**
244
+ @returns {String} the postal code
245
+ */
246
+
247
+
248
+ Address.prototype.postalCode = function() {
249
+ return this.json['zip'];
250
+ };
251
+
252
+ return Address;
253
+
254
+ })();
255
+
256
+ /**
257
+ @class An object that describes a means to contact an entity. This is used to represent
258
+ phone numbers, email addresses, instant messaging accounts etc.
259
+ @exports Telecom as hQuery.Telecom
260
+ */
261
+
262
+
263
+ hQuery.Telecom = (function() {
264
+
265
+ Telecom.name = 'Telecom';
266
+
267
+ function Telecom(json) {
268
+ this.json = json;
269
+ }
270
+
271
+ /**
272
+ @returns {String} the type of telecom entry, phone, sms, email ....
273
+ */
274
+
275
+
276
+ Telecom.prototype.type = function() {
277
+ return this.json['type'];
278
+ };
279
+
280
+ /**
281
+ @returns {String} the value of the entry - the actual phone number , email address , ....
282
+ */
283
+
284
+
285
+ Telecom.prototype.value = function() {
286
+ return this.json['value'];
287
+ };
288
+
289
+ /**
290
+ @returns {String} the use of the entry. Is it a home, office, .... type of contact
291
+ */
292
+
293
+
294
+ Telecom.prototype.use = function() {
295
+ return this.json['use'];
296
+ };
297
+
298
+ /**
299
+ @returns {Boolean} is this a preferred form of contact
300
+ */
301
+
302
+
303
+ Telecom.prototype.preferred = function() {
304
+ return this.json['preferred'];
305
+ };
306
+
307
+ return Telecom;
308
+
309
+ })();
310
+
311
+ /**
312
+ @class an object that describes a person. includes a persons name, addresses, and contact information
313
+ @exports Person as hQuery.Person
314
+ */
315
+
316
+
317
+ hQuery.Person = (function() {
318
+
319
+ Person.name = 'Person';
320
+
321
+ function Person(json) {
322
+ this.json = json;
323
+ }
324
+
325
+ /**
326
+ @returns {String} the given name of the person
327
+ */
328
+
329
+
330
+ Person.prototype.given = function() {
331
+ return this.json['first'];
332
+ };
333
+
334
+ /**
335
+ @returns {String} the last/family name of the person
336
+ */
337
+
338
+
339
+ Person.prototype.last = function() {
340
+ return this.json['last'];
341
+ };
342
+
343
+ /**
344
+ @returns {String} the display name of the person
345
+ */
346
+
347
+
348
+ Person.prototype.name = function() {
349
+ if (this.json['name']) {
350
+ return this.json['name'];
351
+ } else {
352
+ return this.json['first'] + ' ' + this.json['last'];
353
+ }
354
+ };
355
+
356
+ /**
357
+ @returns {Array} an array of {@link hQuery.Address} objects associated with the patient
358
+ */
359
+
360
+
361
+ Person.prototype.addresses = function() {
362
+ var address, list, _i, _len, _ref;
363
+ list = [];
364
+ if (this.json['addresses']) {
365
+ _ref = this.json['addresses'];
366
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
367
+ address = _ref[_i];
368
+ list.push(new hQuery.Address(address));
369
+ }
370
+ }
371
+ return list;
372
+ };
373
+
374
+ /**
375
+ @returns {Array} an array of {@link hQuery.Telecom} objects associated with the person
376
+ */
377
+
378
+
379
+ Person.prototype.telecoms = function() {
380
+ var tel, _i, _len, _ref, _results;
381
+ _ref = this.json['telecoms'];
382
+ _results = [];
383
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
384
+ tel = _ref[_i];
385
+ _results.push(new hQuery.Telecom(tel));
386
+ }
387
+ return _results;
388
+ };
389
+
390
+ return Person;
391
+
392
+ })();
393
+
394
+ /**
395
+ @class an actor is either a person or an organization
396
+ @exports Actor as hQuery.Actor
397
+ */
398
+
399
+
400
+ hQuery.Actor = (function() {
401
+
402
+ Actor.name = 'Actor';
403
+
404
+ function Actor(json) {
405
+ this.json = json;
406
+ }
407
+
408
+ Actor.prototype.person = function() {
409
+ if (this.json['person']) {
410
+ return new hQuery.Person(this.json['person']);
411
+ }
412
+ };
413
+
414
+ Actor.prototype.organization = function() {
415
+ if (this.json['organization']) {
416
+ return new hQuery.Organization(this.json['organization']);
417
+ }
418
+ };
419
+
420
+ return Actor;
421
+
422
+ })();
423
+
424
+ /**
425
+ @class an Organization
426
+ @exports Organization as hQuery.Organization
427
+ */
428
+
429
+
430
+ hQuery.Organization = (function() {
431
+
432
+ Organization.name = 'Organization';
433
+
434
+ function Organization(json) {
435
+ this.json = json;
436
+ }
437
+
438
+ /**
439
+ @returns {String} the id for the organization
440
+ */
441
+
442
+
443
+ Organization.prototype.organizationId = function() {
444
+ return this.json['organizationId'];
445
+ };
446
+
447
+ /**
448
+ @returns {String} the name of the organization
449
+ */
450
+
451
+
452
+ Organization.prototype.organizationName = function() {
453
+ return this.json['name'];
454
+ };
455
+
456
+ /**
457
+ @returns {Array} an array of {@link hQuery.Address} objects associated with the organization
458
+ */
459
+
460
+
461
+ Organization.prototype.addresses = function() {
462
+ var address, list, _i, _len, _ref;
463
+ list = [];
464
+ if (this.json['addresses']) {
465
+ _ref = this.json['addresses'];
466
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
467
+ address = _ref[_i];
468
+ list.push(new hQuery.Address(address));
469
+ }
470
+ }
471
+ return list;
472
+ };
473
+
474
+ /**
475
+ @returns {Array} an array of {@link hQuery.Telecom} objects associated with the organization
476
+ */
477
+
478
+
479
+ Organization.prototype.telecoms = function() {
480
+ var tel, _i, _len, _ref, _results;
481
+ _ref = this.json['telecoms'];
482
+ _results = [];
483
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
484
+ tel = _ref[_i];
485
+ _results.push(new hQuery.Telecom(tel));
486
+ }
487
+ return _results;
488
+ };
489
+
490
+ return Organization;
491
+
492
+ })();
493
+
494
+ /**
495
+ @class represents a DateRange in the form of hi and low date values.
496
+ @exports DateRange as hQuery.DateRange
497
+ */
498
+
499
+
500
+ hQuery.DateRange = (function() {
501
+
502
+ DateRange.name = 'DateRange';
503
+
504
+ function DateRange(json) {
505
+ this.json = json;
506
+ }
507
+
508
+ DateRange.prototype.hi = function() {
509
+ if (this.json['hi']) {
510
+ return hQuery.dateFromUtcSeconds(this.json['hi']);
511
+ }
512
+ };
513
+
514
+ DateRange.prototype.low = function() {
515
+ return hQuery.dateFromUtcSeconds(this.json['low']);
516
+ };
517
+
518
+ return DateRange;
519
+
520
+ })();
521
+
522
+ /**
523
+ @class Class used to describe an entity that is providing some form of information. This does not mean that they are
524
+ providing any treatment just that they are providing information.
525
+ @exports Informant as hQuery.Informant
526
+ */
527
+
528
+
529
+ hQuery.Informant = (function() {
530
+
531
+ Informant.name = 'Informant';
532
+
533
+ function Informant(json) {
534
+ this.json = json;
535
+ }
536
+
537
+ /**
538
+ an array of hQuery.Person objects as points of contact
539
+ @returns {Array}
540
+ */
541
+
542
+
543
+ Informant.prototype.contacts = function() {
544
+ var contact, _i, _len, _ref, _results;
545
+ _ref = this.json['contacts'];
546
+ _results = [];
547
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
548
+ contact = _ref[_i];
549
+ _results.push(new hQuery.Person(contact));
550
+ }
551
+ return _results;
552
+ };
553
+
554
+ /**
555
+ @returns {hQuery.Organization} the organization providing the information
556
+ */
557
+
558
+
559
+ Informant.prototype.organization = function() {
560
+ return new hQuery.Organization(this.json['organization']);
561
+ };
562
+
563
+ return Informant;
564
+
565
+ })();
566
+
567
+ /**
568
+ @class
569
+ @exports CodedEntry as hQuery.CodedEntry
570
+ */
571
+
572
+
573
+ hQuery.CodedEntry = (function() {
574
+
575
+ CodedEntry.name = 'CodedEntry';
576
+
577
+ function CodedEntry(json) {
578
+ this.json = json;
579
+ this._date = hQuery.dateFromUtcSeconds(this.json['time']);
580
+ this._startDate = hQuery.dateFromUtcSeconds(this.json['start_time']);
581
+ this._endDate = hQuery.dateFromUtcSeconds(this.json['end_time']);
582
+ this._type = hQuery.createCodedValues(this.json['codes']);
583
+ this._status = this.json['status'];
584
+ this._id = this.json['id'];
585
+ this._freeTextType = this.json['description'];
586
+ }
587
+
588
+ /**
589
+ Date and time at which the coded entry took place
590
+ @returns {Date}
591
+ */
592
+
593
+
594
+ CodedEntry.prototype.date = function() {
595
+ return this._date;
596
+ };
597
+
598
+ /**
599
+ Date and time at which the coded entry started
600
+ @returns {Date}
601
+ */
602
+
603
+
604
+ CodedEntry.prototype.startDate = function() {
605
+ return this._startDate;
606
+ };
607
+
608
+ /**
609
+ Date and time at which the coded entry ended
610
+ @returns {Date}
611
+ */
612
+
613
+
614
+ CodedEntry.prototype.endDate = function() {
615
+ return this._endDate;
616
+ };
617
+
618
+ /**
619
+ Tries to find a single point in time for this entry. Will first return date if it is present,
620
+ then fall back to startDate and finally endDate
621
+ @returns {Date}
622
+ */
623
+
624
+
625
+ CodedEntry.prototype.timeStamp = function() {
626
+ return this._date || this._startDate || this._endDate;
627
+ };
628
+
629
+ /**
630
+ Determines whether the entry specifies a time range or not
631
+ @returns {boolean}
632
+ */
633
+
634
+
635
+ CodedEntry.prototype.isTimeRange = function() {
636
+ return (this._startDate != null) && (this._endDate != null);
637
+ };
638
+
639
+ /**
640
+ An Array of CodedValues which describe what kind of coded entry took place
641
+ @returns {Array}
642
+ */
643
+
644
+
645
+ CodedEntry.prototype.type = function() {
646
+ return this._type;
647
+ };
648
+
649
+ /**
650
+ A free text description of the type of coded entry
651
+ @returns {String}
652
+ */
653
+
654
+
655
+ CodedEntry.prototype.freeTextType = function() {
656
+ return this._freeTextType;
657
+ };
658
+
659
+ /**
660
+ Unique identifier for this coded entry
661
+ @returns {String}
662
+ */
663
+
664
+
665
+ CodedEntry.prototype.id = function() {
666
+ return this._id;
667
+ };
668
+
669
+ /**
670
+ Status for this coded entry
671
+ @returns {String}
672
+ */
673
+
674
+
675
+ CodedEntry.prototype.status = function() {
676
+ return this._status;
677
+ };
678
+
679
+ /**
680
+ Returns true if any of this entry's codes match a code in the supplied codeSet.
681
+ @param {Object} codeSet a hash with code system names as keys and an array of codes as values
682
+ @returns {boolean}
683
+ */
684
+
685
+
686
+ CodedEntry.prototype.includesCodeFrom = function(codeSet) {
687
+ var codedValue, _i, _len, _ref;
688
+ _ref = this._type;
689
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
690
+ codedValue = _ref[_i];
691
+ if (codedValue.includedIn(codeSet)) {
692
+ return true;
693
+ }
694
+ }
695
+ return false;
696
+ };
697
+
698
+ return CodedEntry;
699
+
700
+ })();
701
+
702
+ /**
703
+ @class Represents a list of hQuery.CodedEntry instances. Offers utility methods for matching
704
+ entries based on codes and date ranges
705
+ @exports CodedEntryList as hQuery.CodedEntryList
706
+ */
707
+
708
+
709
+ hQuery.CodedEntryList = (function(_super) {
710
+
711
+ __extends(CodedEntryList, _super);
712
+
713
+ CodedEntryList.name = 'CodedEntryList';
714
+
715
+ function CodedEntryList() {
716
+ this.push.apply(this, arguments);
717
+ }
718
+
719
+ /**
720
+ Return the number of entries that match the
721
+ supplied code set where those entries occur between the supplied time bounds
722
+ @param {Object} codeSet a hash with code system names as keys and an array of codes as values
723
+ @param {Date} start the start of the period during which the entry must occur, a null value will match all times
724
+ @param {Date} end the end of the period during which the entry must occur, a null value will match all times
725
+ @return {Array[CodedEntry]} the matching entries
726
+ */
727
+
728
+
729
+ CodedEntryList.prototype.match = function(codeSet, start, end) {
730
+ var afterStart, beforeEnd, entry, matchingEntries, _i, _len;
731
+ matchingEntries = [];
732
+ for (_i = 0, _len = this.length; _i < _len; _i++) {
733
+ entry = this[_i];
734
+ afterStart = !start || entry.date() >= start;
735
+ beforeEnd = !end || entry.date() <= end;
736
+ if (afterStart && beforeEnd && entry.includesCodeFrom(codeSet)) {
737
+ matchingEntries.push(entry);
738
+ }
739
+ }
740
+ return matchingEntries;
741
+ };
742
+
743
+ /**
744
+ Return a new list of entries that is the result of concatenating the passed in entries with this list
745
+ @return {Array[CodedEntry]} the set of concatenated entries
746
+ */
747
+
748
+
749
+ CodedEntryList.prototype.concat = function(otherEntries) {
750
+ var cloned, entry, _i, _j, _len, _len1;
751
+ cloned = new hQuery.CodedEntryList();
752
+ for (_i = 0, _len = this.length; _i < _len; _i++) {
753
+ entry = this[_i];
754
+ cloned.push(entry);
755
+ }
756
+ for (_j = 0, _len1 = otherEntries.length; _j < _len1; _j++) {
757
+ entry = otherEntries[_j];
758
+ cloned.push(entry);
759
+ }
760
+ return cloned;
761
+ };
762
+
763
+ /**
764
+ Match entries with the specified statuses
765
+ @return {Array[CodedEntry]} the matching entries
766
+ */
767
+
768
+
769
+ CodedEntryList.prototype.withStatuses = function(statuses, includeUndefined) {
770
+ var cloned, entry, _i, _len, _ref;
771
+ if (includeUndefined == null) {
772
+ includeUndefined = true;
773
+ }
774
+ statuses = statuses.concat([void 0, null]);
775
+ cloned = new hQuery.CodedEntryList();
776
+ for (_i = 0, _len = this.length; _i < _len; _i++) {
777
+ entry = this[_i];
778
+ if (_ref = entry.status(), __indexOf.call(statuses, _ref) >= 0) {
779
+ cloned.push(entry);
780
+ }
781
+ }
782
+ return cloned;
783
+ };
784
+
785
+ return CodedEntryList;
786
+
787
+ })(Array);
788
+
789
+ /**
790
+ @private
791
+ @function
792
+ */
793
+
794
+
795
+ hQuery.createCodedValues = function(jsonCodes) {
796
+ var code, codeSystem, codedValues, codes, _i, _len;
797
+ codedValues = [];
798
+ for (codeSystem in jsonCodes) {
799
+ codes = jsonCodes[codeSystem];
800
+ for (_i = 0, _len = codes.length; _i < _len; _i++) {
801
+ code = codes[_i];
802
+ codedValues.push(new hQuery.CodedValue(code, codeSystem));
803
+ }
804
+ }
805
+ return codedValues;
806
+ };
807
+ /**
808
+ @namespace scoping into the hquery namespace
809
+ */
810
+
811
+ var __hasProp = {}.hasOwnProperty,
812
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
813
+
814
+ this.hQuery || (this.hQuery = {});
815
+
816
+ /**
817
+ @class MedicationInformation
818
+ @exports MedicationInformation as hQuery.MedicationInformation
819
+ */
820
+
821
+
822
+ hQuery.MedicationInformation = (function() {
823
+
824
+ MedicationInformation.name = 'MedicationInformation';
825
+
826
+ function MedicationInformation(json) {
827
+ this.json = json;
828
+ }
829
+
830
+ /**
831
+ An array of hQuery.CodedValue describing the medication
832
+ @returns {Array}
833
+ */
834
+
835
+
836
+ MedicationInformation.prototype.codedProduct = function() {
837
+ return hQuery.createCodedValues(this.json['codes']);
838
+ };
839
+
840
+ MedicationInformation.prototype.freeTextProductName = function() {
841
+ return this.json['description'];
842
+ };
843
+
844
+ MedicationInformation.prototype.codedBrandName = function() {
845
+ return this.json['codedBrandName'];
846
+ };
847
+
848
+ MedicationInformation.prototype.freeTextBrandName = function() {
849
+ return this.json['brandName'];
850
+ };
851
+
852
+ MedicationInformation.prototype.drugManufacturer = function() {
853
+ if (this.json['drugManufacturer']) {
854
+ return new hQuery.Organization(this.json['drugManufacturer']);
855
+ }
856
+ };
857
+
858
+ return MedicationInformation;
859
+
860
+ })();
861
+
862
+ /**
863
+ @class AdministrationTiming - the
864
+ @exports AdministrationTiming as hQuery.AdministrationTiming
865
+ */
866
+
867
+
868
+ hQuery.AdministrationTiming = (function() {
869
+
870
+ AdministrationTiming.name = 'AdministrationTiming';
871
+
872
+ function AdministrationTiming(json) {
873
+ this.json = json;
874
+ }
875
+
876
+ /**
877
+ Provides the period of medication administration as a Scalar. An example
878
+ Scalar that would be returned would be with value = 8 and units = hours. This would
879
+ mean that the medication should be taken every 8 hours.
880
+ @returns {hQuery.Scalar}
881
+ */
882
+
883
+
884
+ AdministrationTiming.prototype.period = function() {
885
+ return new hQuery.Scalar(this.json['period']);
886
+ };
887
+
888
+ /**
889
+ Indicates whether it is the interval (time between dosing), or frequency
890
+ (number of doses in a time period) that is important. If instititutionSpecified is not
891
+ present or is set to false, then the time between dosing is important (every 8 hours).
892
+ If true, then the frequency of administration is important (e.g., 3 times per day).
893
+ @returns {Boolean}
894
+ */
895
+
896
+
897
+ AdministrationTiming.prototype.institutionSpecified = function() {
898
+ return this.json['institutionSpecified'];
899
+ };
900
+
901
+ return AdministrationTiming;
902
+
903
+ })();
904
+
905
+ /**
906
+ @class DoseRestriction - restrictions on the medications dose, represented by a upper and lower dose
907
+ @exports DoseRestriction as hQuery.DoseRestriction
908
+ */
909
+
910
+
911
+ hQuery.DoseRestriction = (function() {
912
+
913
+ DoseRestriction.name = 'DoseRestriction';
914
+
915
+ function DoseRestriction(json) {
916
+ this.json = json;
917
+ }
918
+
919
+ DoseRestriction.prototype.numerator = function() {
920
+ return new hQuery.Scalar(this.json['numerator']);
921
+ };
922
+
923
+ DoseRestriction.prototype.denominator = function() {
924
+ return new hQuery.Scalar(this.json['denominator']);
925
+ };
926
+
927
+ return DoseRestriction;
928
+
929
+ })();
930
+
931
+ /**
932
+ @class Fulfillment - information about when and who fulfilled an order for the medication
933
+ @exports Fulfillment as hQuery.Fullfilement
934
+ */
935
+
936
+
937
+ hQuery.Fulfillment = (function() {
938
+
939
+ Fulfillment.name = 'Fulfillment';
940
+
941
+ function Fulfillment(json) {
942
+ this.json = json;
943
+ }
944
+
945
+ Fulfillment.prototype.dispenseDate = function() {
946
+ return hQuery.dateFromUtcSeconds(this.json['dispenseDate']);
947
+ };
948
+
949
+ Fulfillment.prototype.dispensingPharmacyLocation = function() {
950
+ return new hQuery.Address(this.json['dispensingPharmacyLocation']);
951
+ };
952
+
953
+ Fulfillment.prototype.quantityDispensed = function() {
954
+ return new hQuery.Scalar(this.json['quantityDispensed']);
955
+ };
956
+
957
+ Fulfillment.prototype.prescriptionNumber = function() {
958
+ return this.json['prescriptionNumber'];
959
+ };
960
+
961
+ Fulfillment.prototype.fillNumber = function() {
962
+ return this.json['fillNumber'];
963
+ };
964
+
965
+ Fulfillment.prototype.fillStatus = function() {
966
+ return new hQuery.Status(this.json['fillStatus']);
967
+ };
968
+
969
+ return Fulfillment;
970
+
971
+ })();
972
+
973
+ /**
974
+ @class OrderInformation - information abour an order for a medication
975
+ @exports OrderInformation as hQuery.OrderInformation
976
+ */
977
+
978
+
979
+ hQuery.OrderInformation = (function() {
980
+
981
+ OrderInformation.name = 'OrderInformation';
982
+
983
+ function OrderInformation(json) {
984
+ this.json = json;
985
+ }
986
+
987
+ OrderInformation.prototype.orderNumber = function() {
988
+ return this.json['orderNumber'];
989
+ };
990
+
991
+ OrderInformation.prototype.fills = function() {
992
+ return this.json['fills'];
993
+ };
994
+
995
+ OrderInformation.prototype.quantityOrdered = function() {
996
+ return new hQuery.Scalar(this.json['quantityOrdered']);
997
+ };
998
+
999
+ OrderInformation.prototype.orderExpirationDateTime = function() {
1000
+ return hQuery.dateFromUtcSeconds(this.json['orderExpirationDateTime']);
1001
+ };
1002
+
1003
+ OrderInformation.prototype.orderDateTime = function() {
1004
+ return hQuery.dateFromUtcSeconds(this.json['orderDateTime']);
1005
+ };
1006
+
1007
+ return OrderInformation;
1008
+
1009
+ })();
1010
+
1011
+ /**
1012
+ TypeOfMedication as defined by value set 2.16.840.1.113883.3.88.12.3221.8.19
1013
+ which pulls two values from SNOMED to describe whether a medication is
1014
+ prescription or over the counter
1015
+
1016
+ @class TypeOfMedication - describes whether a medication is prescription or
1017
+ over the counter
1018
+ @augments hQuery.CodedEntry
1019
+ @exports TypeOfMedication as hQuery.TypeOfMedication
1020
+ */
1021
+
1022
+
1023
+ hQuery.TypeOfMedication = (function(_super) {
1024
+ var OTC, PRESECRIPTION;
1025
+
1026
+ __extends(TypeOfMedication, _super);
1027
+
1028
+ TypeOfMedication.name = 'TypeOfMedication';
1029
+
1030
+ function TypeOfMedication() {
1031
+ return TypeOfMedication.__super__.constructor.apply(this, arguments);
1032
+ }
1033
+
1034
+ PRESECRIPTION = "73639000";
1035
+
1036
+ OTC = "329505003";
1037
+
1038
+ /**
1039
+ @returns {Boolean}
1040
+ */
1041
+
1042
+
1043
+ TypeOfMedication.prototype.isPrescription = function() {
1044
+ return this.c === PRESECRIPTION;
1045
+ };
1046
+
1047
+ /**
1048
+ @returns {Boolean}
1049
+ */
1050
+
1051
+
1052
+ TypeOfMedication.prototype.isOverTheCounter = function() {
1053
+ return this.c === OTC;
1054
+ };
1055
+
1056
+ return TypeOfMedication;
1057
+
1058
+ })(hQuery.CodedValue);
1059
+
1060
+ /**
1061
+ StatusOfMedication as defined by value set 2.16.840.1.113883.1.11.20.7
1062
+ The terms come from SNOMED and are managed by HL7
1063
+
1064
+ @class StatusOfMedication - describes the status of the medication
1065
+ @augments hQuery.CodedEntry
1066
+ @exports StatusOfMedication as hQuery.StatusOfMedication
1067
+ */
1068
+
1069
+
1070
+ hQuery.StatusOfMedication = (function(_super) {
1071
+ var ACTIVE, NO_LONGER_ACTIVE, ON_HOLD, PRIOR_HISTORY;
1072
+
1073
+ __extends(StatusOfMedication, _super);
1074
+
1075
+ StatusOfMedication.name = 'StatusOfMedication';
1076
+
1077
+ function StatusOfMedication() {
1078
+ return StatusOfMedication.__super__.constructor.apply(this, arguments);
1079
+ }
1080
+
1081
+ ON_HOLD = "392521001";
1082
+
1083
+ NO_LONGER_ACTIVE = "421139008";
1084
+
1085
+ ACTIVE = "55561003";
1086
+
1087
+ PRIOR_HISTORY = "73425007";
1088
+
1089
+ /**
1090
+ @returns {Boolean}
1091
+ */
1092
+
1093
+
1094
+ StatusOfMedication.prototype.isOnHold = function() {
1095
+ return this.c === ON_HOLD;
1096
+ };
1097
+
1098
+ /**
1099
+ @returns {Boolean}
1100
+ */
1101
+
1102
+
1103
+ StatusOfMedication.prototype.isNoLongerActive = function() {
1104
+ return this.c === NO_LONGER_ACTIVE;
1105
+ };
1106
+
1107
+ /**
1108
+ @returns {Boolean}
1109
+ */
1110
+
1111
+
1112
+ StatusOfMedication.prototype.isActive = function() {
1113
+ return this.c === ACTIVE;
1114
+ };
1115
+
1116
+ /**
1117
+ @returns {Boolean}
1118
+ */
1119
+
1120
+
1121
+ StatusOfMedication.prototype.isPriorHistory = function() {
1122
+ return this.c === PRIOR_HISTORY;
1123
+ };
1124
+
1125
+ return StatusOfMedication;
1126
+
1127
+ })(hQuery.CodedValue);
1128
+
1129
+ /**
1130
+ @class represents a medication entry for a patient.
1131
+ @augments hQuery.CodedEntry
1132
+ @exports Medication as hQuery.Medication
1133
+ */
1134
+
1135
+
1136
+ hQuery.Medication = (function(_super) {
1137
+
1138
+ __extends(Medication, _super);
1139
+
1140
+ Medication.name = 'Medication';
1141
+
1142
+ function Medication(json) {
1143
+ this.json = json;
1144
+ Medication.__super__.constructor.call(this, this.json);
1145
+ }
1146
+
1147
+ /**
1148
+ @returns {String}
1149
+ */
1150
+
1151
+
1152
+ Medication.prototype.freeTextSig = function() {
1153
+ return this.json['freeTextSig'];
1154
+ };
1155
+
1156
+ /**
1157
+ The actual or intended start of a medication. Slight deviation from greenCDA for C32 since
1158
+ it combines this with medication stop
1159
+ @returns {Date}
1160
+ */
1161
+
1162
+
1163
+ Medication.prototype.indicateMedicationStart = function() {
1164
+ return hQuery.dateFromUtcSeconds(this.json['start_time']);
1165
+ };
1166
+
1167
+ /**
1168
+ The actual or intended stop of a medication. Slight deviation from greenCDA for C32 since
1169
+ it combines this with medication start
1170
+ @returns {Date}
1171
+ */
1172
+
1173
+
1174
+ Medication.prototype.indicateMedicationStop = function() {
1175
+ return hQuery.dateFromUtcSeconds(this.json['end_time']);
1176
+ };
1177
+
1178
+ Medication.prototype.administrationTiming = function() {
1179
+ return new hQuery.AdministrationTiming(this.json['administrationTiming']);
1180
+ };
1181
+
1182
+ /**
1183
+ @returns {CodedValue} Contains routeCode or adminstrationUnitCode information.
1184
+ Route code shall have a a value drawn from FDA route of adminstration,
1185
+ and indicates how the medication is received by the patient.
1186
+ See http://www.fda.gov/Drugs/DevelopmentApprovalProcess/UCM070829
1187
+ The administration unit code shall have a value drawn from the FDA
1188
+ dosage form, source NCI thesaurus and represents the physical form of the
1189
+ product as presented to the patient.
1190
+ See http://www.fda.gov/Drugs/InformationOnDrugs/ucm142454.htm
1191
+ */
1192
+
1193
+
1194
+ Medication.prototype.route = function() {
1195
+ return new hQuery.CodedValue(this.json['route']['code'], this.json['route']['codeSystem']);
1196
+ };
1197
+
1198
+ /**
1199
+ @returns {hQuery.Scalar} the dose
1200
+ */
1201
+
1202
+
1203
+ Medication.prototype.dose = function() {
1204
+ return new hQuery.Scalar(this.json['dose']);
1205
+ };
1206
+
1207
+ /**
1208
+ @returns {CodedValue}
1209
+ */
1210
+
1211
+
1212
+ Medication.prototype.site = function() {
1213
+ return new hQuery.CodedValue(this.json['site']['code'], this.json['site']['codeSystem']);
1214
+ };
1215
+
1216
+ /**
1217
+ @returns {hQuery.DoseRestriction}
1218
+ */
1219
+
1220
+
1221
+ Medication.prototype.doseRestriction = function() {
1222
+ return new hQuery.DoseRestriction(this.json['doseRestriction']);
1223
+ };
1224
+
1225
+ /**
1226
+ @returns {String}
1227
+ */
1228
+
1229
+
1230
+ Medication.prototype.doseIndicator = function() {
1231
+ return this.json['doseIndicator'];
1232
+ };
1233
+
1234
+ /**
1235
+ @returns {String}
1236
+ */
1237
+
1238
+
1239
+ Medication.prototype.fulfillmentInstructions = function() {
1240
+ return this.json['fulfillmentInstructions'];
1241
+ };
1242
+
1243
+ /**
1244
+ @returns {CodedValue}
1245
+ */
1246
+
1247
+
1248
+ Medication.prototype.indication = function() {
1249
+ return new hQuery.CodedValue(this.json['indication']['code'], this.json['indication']['codeSystem']);
1250
+ };
1251
+
1252
+ /**
1253
+ @returns {CodedValue}
1254
+ */
1255
+
1256
+
1257
+ Medication.prototype.productForm = function() {
1258
+ return new hQuery.CodedValue(this.json['productForm']['code'], this.json['productForm']['codeSystem']);
1259
+ };
1260
+
1261
+ /**
1262
+ @returns {CodedValue}
1263
+ */
1264
+
1265
+
1266
+ Medication.prototype.vehicle = function() {
1267
+ return new hQuery.CodedValue(this.json['vehicle']['code'], this.json['vehicle']['codeSystem']);
1268
+ };
1269
+
1270
+ /**
1271
+ @returns {CodedValue}
1272
+ */
1273
+
1274
+
1275
+ Medication.prototype.reaction = function() {
1276
+ return new hQuery.CodedValue(this.json['reaction']['code'], this.json['reaction']['codeSystem']);
1277
+ };
1278
+
1279
+ /**
1280
+ @returns {CodedValue}
1281
+ */
1282
+
1283
+
1284
+ Medication.prototype.deliveryMethod = function() {
1285
+ return new hQuery.CodedValue(this.json['deliveryMethod']['code'], this.json['deliveryMethod']['codeSystem']);
1286
+ };
1287
+
1288
+ /**
1289
+ @returns {hQuery.MedicationInformation}
1290
+ */
1291
+
1292
+
1293
+ Medication.prototype.medicationInformation = function() {
1294
+ return new hQuery.MedicationInformation(this.json);
1295
+ };
1296
+
1297
+ /**
1298
+ @returns {hQuery.TypeOfMedication} Indicates whether this is an over the counter or prescription medication
1299
+ */
1300
+
1301
+
1302
+ Medication.prototype.typeOfMedication = function() {
1303
+ return new hQuery.TypeOfMedication(this.json['typeOfMedication']['code'], this.json['typeOfMedication']['codeSystem']);
1304
+ };
1305
+
1306
+ /**
1307
+ Values conform to value set 2.16.840.1.113883.1.11.20.7 - Medication Status
1308
+ Values may be: On Hold, No Longer Active, Active, Prior History
1309
+ @returns {hQuery.StatusOfMedication} Used to indicate the status of the medication.
1310
+ */
1311
+
1312
+
1313
+ Medication.prototype.statusOfMedication = function() {
1314
+ return new hQuery.StatusOfMedication(this.json['statusOfMedication']['code'], this.json['statusOfMedication']['codeSystem']);
1315
+ };
1316
+
1317
+ /**
1318
+ @returns {String} free text instructions to the patient
1319
+ */
1320
+
1321
+
1322
+ Medication.prototype.patientInstructions = function() {
1323
+ return this.json['patientInstructions'];
1324
+ };
1325
+
1326
+ /**
1327
+ @returns {Array} an array of {@link FulFillment} objects
1328
+ */
1329
+
1330
+
1331
+ Medication.prototype.fulfillmentHistory = function() {
1332
+ var order, _i, _len, _ref, _results;
1333
+ _ref = this.json['fulfillmentHistory'];
1334
+ _results = [];
1335
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1336
+ order = _ref[_i];
1337
+ _results.push(new hQuery.Fulfillment(order));
1338
+ }
1339
+ return _results;
1340
+ };
1341
+
1342
+ /**
1343
+ @returns {Array} an array of {@link OrderInformation} objects
1344
+ */
1345
+
1346
+
1347
+ Medication.prototype.orderInformation = function() {
1348
+ var order, _i, _len, _ref, _results;
1349
+ _ref = this.json['orderInformation'];
1350
+ _results = [];
1351
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1352
+ order = _ref[_i];
1353
+ _results.push(new hQuery.OrderInformation(order));
1354
+ }
1355
+ return _results;
1356
+ };
1357
+
1358
+ return Medication;
1359
+
1360
+ })(hQuery.CodedEntry);
1361
+ /**
1362
+ @namespace scoping into the hquery namespace
1363
+ */
1364
+
1365
+ var __hasProp = {}.hasOwnProperty,
1366
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
1367
+
1368
+ this.hQuery || (this.hQuery = {});
1369
+
1370
+ /**
1371
+ @class CauseOfDeath
1372
+ @exports CauseOfDeath as hQuery.CauseOfDeath
1373
+ */
1374
+
1375
+
1376
+ hQuery.CauseOfDeath = (function() {
1377
+
1378
+ CauseOfDeath.name = 'CauseOfDeath';
1379
+
1380
+ function CauseOfDeath(json) {
1381
+ this.json = json;
1382
+ }
1383
+
1384
+ /**
1385
+ @returns {hQuery.Date}
1386
+ */
1387
+
1388
+
1389
+ CauseOfDeath.prototype.timeOfDeath = function() {
1390
+ return new hQuery.dateFromUtcSeconds(this.json['timeOfDeath']);
1391
+ };
1392
+
1393
+ /**
1394
+ @returns {int}
1395
+ */
1396
+
1397
+
1398
+ CauseOfDeath.prototype.ageAtDeath = function() {
1399
+ return this.json['ageAtDeath'];
1400
+ };
1401
+
1402
+ return CauseOfDeath;
1403
+
1404
+ })();
1405
+
1406
+ /**
1407
+ @class hQuery.Condition
1408
+
1409
+ This section is used to describe a patients problems/conditions. The types of conditions
1410
+ described have been constrained to the SNOMED CT Problem Type code set. An unbounded
1411
+ number of treating providers for the particular condition can be supplied.
1412
+ @exports Condition as hQuery.Condition
1413
+ @augments hQuery.CodedEntry
1414
+ */
1415
+
1416
+
1417
+ hQuery.Condition = (function(_super) {
1418
+
1419
+ __extends(Condition, _super);
1420
+
1421
+ Condition.name = 'Condition';
1422
+
1423
+ function Condition(json) {
1424
+ this.json = json;
1425
+ Condition.__super__.constructor.call(this, this.json);
1426
+ }
1427
+
1428
+ /**
1429
+ @returns {Array, hQuery.Provider} an array of providers for the condition
1430
+ */
1431
+
1432
+
1433
+ Condition.prototype.providers = function() {
1434
+ var provider, _i, _len, _ref, _results;
1435
+ _ref = this.json['treatingProviders'];
1436
+ _results = [];
1437
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
1438
+ provider = _ref[_i];
1439
+ _results.push(new Provider(provider));
1440
+ }
1441
+ return _results;
1442
+ };
1443
+
1444
+ /**
1445
+ Diagnosis Priority
1446
+ @returns {int}
1447
+ */
1448
+
1449
+
1450
+ Condition.prototype.diagnosisPriority = function() {
1451
+ return this.json['diagnosisPriority'];
1452
+ };
1453
+
1454
+ /**
1455
+ age at onset
1456
+ @returns {int}
1457
+ */
1458
+
1459
+
1460
+ Condition.prototype.ageAtOnset = function() {
1461
+ return this.json['ageAtOnset'];
1462
+ };
1463
+
1464
+ /**
1465
+ cause of death
1466
+ @returns {hQuery.CauseOfDeath}
1467
+ */
1468
+
1469
+
1470
+ Condition.prototype.causeOfDeath = function() {
1471
+ return new hQuery.CauseOfDeath(this.json['causeOfDeath']);
1472
+ };
1473
+
1474
+ /**
1475
+ problem status
1476
+ @returns {hQuery.CodedValue}
1477
+ */
1478
+
1479
+
1480
+ Condition.prototype.problemStatus = function() {
1481
+ return new hQuery.CodedValue(this.json['problemStatus']['code'], this.json['problemStatus']['codeSystem']);
1482
+ };
1483
+
1484
+ /**
1485
+ comment
1486
+ @returns {String}
1487
+ */
1488
+
1489
+
1490
+ Condition.prototype.comment = function() {
1491
+ return this.json['comment'];
1492
+ };
1493
+
1494
+ return Condition;
1495
+
1496
+ })(hQuery.CodedEntry);
1497
+ /**
1498
+ @namespace scoping into the hquery namespace
1499
+ */
1500
+
1501
+ var __hasProp = {}.hasOwnProperty,
1502
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
1503
+
1504
+ this.hQuery || (this.hQuery = {});
1505
+
1506
+ /**
1507
+ An Encounter is an interaction, regardless of the setting, between a patient and a
1508
+ practitioner who is vested with primary responsibility for diagnosing, evaluating,
1509
+ or treating the patient's condition. It may include visits, appointments, as well
1510
+ as non face-to-face interactions. It is also a contact between a patient and a
1511
+ practitioner who has primary responsibility for assessing and treating the
1512
+ patient at a given contact, exercising independent judgment.
1513
+ @class An Encounter is an interaction, regardless of the setting, between a patient and a
1514
+ practitioner
1515
+ @augments hQuery.CodedEntry
1516
+ @exports Encounter as hQuery.Encounter
1517
+ */
1518
+
1519
+
1520
+ hQuery.Encounter = (function(_super) {
1521
+
1522
+ __extends(Encounter, _super);
1523
+
1524
+ Encounter.name = 'Encounter';
1525
+
1526
+ function Encounter(json) {
1527
+ this.json = json;
1528
+ Encounter.__super__.constructor.call(this, this.json);
1529
+ }
1530
+
1531
+ /**
1532
+ @returns {String}
1533
+ */
1534
+
1535
+
1536
+ Encounter.prototype.dischargeDisp = function() {
1537
+ return this.json['dischargeDisp'];
1538
+ };
1539
+
1540
+ /**
1541
+ A code indicating the priority of the admission (e.g., Emergency, Urgent, Elective, et cetera) from
1542
+ National Uniform Billing Committee (NUBC)
1543
+ @returns {CodedValue}
1544
+ */
1545
+
1546
+
1547
+ Encounter.prototype.admitType = function() {
1548
+ return new hQuery.CodedValue(this.json['admitType']['code'], this.json['admitType']['codeSystem']);
1549
+ };
1550
+
1551
+ /**
1552
+ @returns {hQuery.Actor}
1553
+ */
1554
+
1555
+
1556
+ Encounter.prototype.performer = function() {
1557
+ return new hQuery.Actor(this.json['performer']);
1558
+ };
1559
+
1560
+ /**
1561
+ @returns {hQuery.Organization}
1562
+ */
1563
+
1564
+
1565
+ Encounter.prototype.facility = function() {
1566
+ return new hQuery.Organization(this.json['facility']);
1567
+ };
1568
+
1569
+ /**
1570
+ @returns {hQuery.DateRange}
1571
+ */
1572
+
1573
+
1574
+ Encounter.prototype.encounterDuration = function() {
1575
+ return new hQuery.DateRange(this.json);
1576
+ };
1577
+
1578
+ /**
1579
+ @returns {hQuery.CodedEntry}
1580
+ */
1581
+
1582
+
1583
+ Encounter.prototype.reasonForVisit = function() {
1584
+ return new hQuery.CodedEntry(this.json['reason']);
1585
+ };
1586
+
1587
+ return Encounter;
1588
+
1589
+ })(hQuery.CodedEntry);
1590
+ /**
1591
+ @namespace scoping into the hquery namespace
1592
+ */
1593
+
1594
+ var __hasProp = {}.hasOwnProperty,
1595
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
1596
+
1597
+ this.hQuery || (this.hQuery = {});
1598
+
1599
+ /**
1600
+ This represents all interventional, surgical, diagnostic, or therapeutic procedures or
1601
+ treatments pertinent to the patient.
1602
+ @class
1603
+ @augments hQuery.CodedEntry
1604
+ @exports Procedure as hQuery.Procedure
1605
+ */
1606
+
1607
+
1608
+ hQuery.Procedure = (function(_super) {
1609
+
1610
+ __extends(Procedure, _super);
1611
+
1612
+ Procedure.name = 'Procedure';
1613
+
1614
+ function Procedure(json) {
1615
+ this.json = json;
1616
+ Procedure.__super__.constructor.call(this, this.json);
1617
+ }
1618
+
1619
+ /**
1620
+ @returns {hQuery.Actor} The provider that performed the procedure
1621
+ */
1622
+
1623
+
1624
+ Procedure.prototype.performer = function() {
1625
+ return new hQuery.Actor(this.json['performer']);
1626
+ };
1627
+
1628
+ /**
1629
+ @returns {hQuery.CodedValue} A SNOMED code indicating the body site on which the
1630
+ procedure was performed
1631
+ */
1632
+
1633
+
1634
+ Procedure.prototype.site = function() {
1635
+ return new hQuery.CodedValue(this.json['site']['code'], this.json['site']['codeSystem']);
1636
+ };
1637
+
1638
+ return Procedure;
1639
+
1640
+ })(hQuery.CodedEntry);
1641
+ /**
1642
+ @namespace scoping into the hquery namespace
1643
+ */
1644
+
1645
+ var __hasProp = {}.hasOwnProperty,
1646
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
1647
+
1648
+ this.hQuery || (this.hQuery = {});
1649
+
1650
+ /**
1651
+ Observations generated by laboratories, imaging procedures, and other procedures. The scope
1652
+ includes hematology, chemistry, serology, virology, toxicology, microbiology, plain x-ray,
1653
+ ultrasound, CT, MRI, angiography, cardiac echo, nuclear medicine, pathology, and procedure
1654
+ observations.
1655
+ @class
1656
+ @augments hQuery.CodedEntry
1657
+ @exports Result as hQuery.Result
1658
+ */
1659
+
1660
+
1661
+ hQuery.Result = (function(_super) {
1662
+
1663
+ __extends(Result, _super);
1664
+
1665
+ Result.name = 'Result';
1666
+
1667
+ function Result(json) {
1668
+ this.json = json;
1669
+ Result.__super__.constructor.call(this, this.json);
1670
+ }
1671
+
1672
+ /**
1673
+ ASTM CCR defines a restricted set of required result Type codes (see ResultTypeCode in section 7.3
1674
+ Summary of CCD value sets), used to categorize a result into one of several commonly accepted values
1675
+ (e.g. Hematology, Chemistry, Nuclear Medicine).
1676
+ @returns {CodedValue}
1677
+ */
1678
+
1679
+
1680
+ Result.prototype.resultType = function() {
1681
+ return this.type();
1682
+ };
1683
+
1684
+ /**
1685
+ A status from the HL7 ActStatusNormal vocabulary
1686
+ @returns {String}
1687
+ */
1688
+
1689
+
1690
+ Result.prototype.status = function() {
1691
+ return this.json['status'];
1692
+ };
1693
+
1694
+ /**
1695
+ Returns the value of the result. This will return an object. The properties of this
1696
+ object are dependent on the type of result.
1697
+ */
1698
+
1699
+
1700
+ Result.prototype.value = function() {
1701
+ return this.json['value'];
1702
+ };
1703
+
1704
+ /**
1705
+ @returns {CodedValue}
1706
+ */
1707
+
1708
+
1709
+ Result.prototype.interpretation = function() {
1710
+ return new hQuery.CodedValue(this.json['interpretation'].code, this.json['interpretation'].codeSystem);
1711
+ };
1712
+
1713
+ /**
1714
+ @returns {String}
1715
+ */
1716
+
1717
+
1718
+ Result.prototype.referenceRange = function() {
1719
+ return this.json['referenceRange'];
1720
+ };
1721
+
1722
+ /**
1723
+ @returns {String}
1724
+ */
1725
+
1726
+
1727
+ Result.prototype.comment = function() {
1728
+ return this.json['comment'];
1729
+ };
1730
+
1731
+ return Result;
1732
+
1733
+ })(hQuery.CodedEntry);
1734
+ /**
1735
+ @namespace scoping into the hquery namespace
1736
+ */
1737
+
1738
+ var __hasProp = {}.hasOwnProperty,
1739
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
1740
+
1741
+ this.hQuery || (this.hQuery = {});
1742
+
1743
+ /**
1744
+ NoImmunzation as defined by value set 2.16.840.1.113883.1.11.19717
1745
+ The terms come from Health Level Seven (HL7) Version 3.0 Vocabulary and are managed by HL7
1746
+ It indicates the reason an immunization was not administered.
1747
+
1748
+ @class NoImmunization - describes the status of the medication
1749
+ @augments hQuery.CodedEntry
1750
+ @exports NoImmunization as hQuery.NoImmunization
1751
+ */
1752
+
1753
+
1754
+ hQuery.NoImmunization = (function(_super) {
1755
+ var IMMUNITY, MED_PRECAUTION, OUT_OF_STOCK, PAT_OBJ, PHIL_OBJ, REL_OBJ, VAC_EFF, VAC_SAFETY;
1756
+
1757
+ __extends(NoImmunization, _super);
1758
+
1759
+ NoImmunization.name = 'NoImmunization';
1760
+
1761
+ function NoImmunization() {
1762
+ return NoImmunization.__super__.constructor.apply(this, arguments);
1763
+ }
1764
+
1765
+ IMMUNITY = "IMMUNE";
1766
+
1767
+ MED_PRECAUTION = "MEDPREC";
1768
+
1769
+ OUT_OF_STOCK = "OSTOCK";
1770
+
1771
+ PAT_OBJ = "PATOBJ";
1772
+
1773
+ PHIL_OBJ = "PHILISOP";
1774
+
1775
+ REL_OBJ = "RELIG";
1776
+
1777
+ VAC_EFF = "VACEFF";
1778
+
1779
+ VAC_SAFETY = "VACSAF";
1780
+
1781
+ /**
1782
+ @returns {Boolean}
1783
+ */
1784
+
1785
+
1786
+ NoImmunization.prototype.isImmune = function() {
1787
+ return this.c === IMMUNITY;
1788
+ };
1789
+
1790
+ /**
1791
+ @returns {Boolean}
1792
+ */
1793
+
1794
+
1795
+ NoImmunization.prototype.isMedPrec = function() {
1796
+ return this.c === MED_PRECAUTION;
1797
+ };
1798
+
1799
+ /**
1800
+ @returns {Boolean}
1801
+ */
1802
+
1803
+
1804
+ NoImmunization.prototype.isOstock = function() {
1805
+ return this.c === OUT_OF_STOCK;
1806
+ };
1807
+
1808
+ /**
1809
+ @returns {Boolean}
1810
+ */
1811
+
1812
+
1813
+ NoImmunization.prototype.isPatObj = function() {
1814
+ return this.c === PAT_OBJ;
1815
+ };
1816
+
1817
+ /**
1818
+ @returns {Boolean}
1819
+ */
1820
+
1821
+
1822
+ NoImmunization.prototype.isPhilisop = function() {
1823
+ return this.c === PHIL_OBJ;
1824
+ };
1825
+
1826
+ /**
1827
+ @returns {Boolean}
1828
+ */
1829
+
1830
+
1831
+ NoImmunization.prototype.isRelig = function() {
1832
+ return this.c === REL_OBJ;
1833
+ };
1834
+
1835
+ /**
1836
+ @returns {Boolean}
1837
+ */
1838
+
1839
+
1840
+ NoImmunization.prototype.isVacEff = function() {
1841
+ return this.c === VAC_EFF;
1842
+ };
1843
+
1844
+ /**
1845
+ @returns {Boolean}
1846
+ */
1847
+
1848
+
1849
+ NoImmunization.prototype.isVacSaf = function() {
1850
+ return this.c === VAC_SAFETY;
1851
+ };
1852
+
1853
+ return NoImmunization;
1854
+
1855
+ })(hQuery.CodedValue);
1856
+
1857
+ /**
1858
+ @class represents a immunization entry for a patient.
1859
+ @augments hQuery.CodedEntry
1860
+ @exports Immunization as hQuery.Immunization
1861
+ */
1862
+
1863
+
1864
+ hQuery.Immunization = (function(_super) {
1865
+
1866
+ __extends(Immunization, _super);
1867
+
1868
+ Immunization.name = 'Immunization';
1869
+
1870
+ function Immunization(json) {
1871
+ this.json = json;
1872
+ Immunization.__super__.constructor.call(this, this.json);
1873
+ }
1874
+
1875
+ /**
1876
+ @returns{hQuery.Scalar}
1877
+ */
1878
+
1879
+
1880
+ Immunization.prototype.medicationSeriesNumber = function() {
1881
+ return new hQuery.Scalar(this.json['medicationSeriesNumber']);
1882
+ };
1883
+
1884
+ /**
1885
+ @returns{hQuery.MedicationInformation}
1886
+ */
1887
+
1888
+
1889
+ Immunization.prototype.medicationInformation = function() {
1890
+ return new hQuery.MedicationInformation(this.json);
1891
+ };
1892
+
1893
+ /**
1894
+ @returns{Date} Date immunization was administered
1895
+ */
1896
+
1897
+
1898
+ Immunization.prototype.administeredDate = function() {
1899
+ return dateFromUtcSeconds(this.json['administeredDate']);
1900
+ };
1901
+
1902
+ /**
1903
+ @returns{hQuery.Actor} Performer of immunization
1904
+ */
1905
+
1906
+
1907
+ Immunization.prototype.performer = function() {
1908
+ return new hQuery.Actor(this.json['performer']);
1909
+ };
1910
+
1911
+ /**
1912
+ @returns {comment} human readable description of event
1913
+ */
1914
+
1915
+
1916
+ Immunization.prototype.comment = function() {
1917
+ return this.json['comment'];
1918
+ };
1919
+
1920
+ /**
1921
+ @returns {Boolean} whether the immunization has been refused by the patient.
1922
+ */
1923
+
1924
+
1925
+ Immunization.prototype.refusalInd = function() {
1926
+ return this.json['refusalInd'];
1927
+ };
1928
+
1929
+ /**
1930
+ NoImmunzation as defined by value set 2.16.840.1.113883.1.11.19717
1931
+ The terms come from Health Level Seven (HL7) Version 3.0 Vocabulary and are managed by HL7
1932
+ It indicates the reason an immunization was not administered.
1933
+ @returns {hQuery.NoImmunization} Used to indicate reason an immunization was not administered.
1934
+ */
1935
+
1936
+
1937
+ Immunization.prototype.refusalReason = function() {
1938
+ return new hQuery.NoImmunization(this.json['refusalReason']['code'], this.json['refusalReason']['codeSystem']);
1939
+ };
1940
+
1941
+ return Immunization;
1942
+
1943
+ })(hQuery.CodedEntry);
1944
+ /**
1945
+ @namespace scoping into the hquery namespace
1946
+ */
1947
+
1948
+ var __hasProp = {}.hasOwnProperty,
1949
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
1950
+
1951
+ this.hQuery || (this.hQuery = {});
1952
+
1953
+ /**
1954
+ @class
1955
+ @augments hQuery.CodedEntry
1956
+ @exports Allergy as hQuery.Allergy
1957
+ */
1958
+
1959
+
1960
+ hQuery.Allergy = (function(_super) {
1961
+
1962
+ __extends(Allergy, _super);
1963
+
1964
+ Allergy.name = 'Allergy';
1965
+
1966
+ function Allergy(json) {
1967
+ this.json = json;
1968
+ Allergy.__super__.constructor.call(this, this.json);
1969
+ }
1970
+
1971
+ /**
1972
+ Food and substance allergies use the Unique Ingredient Identifier(UNII) from the FDA
1973
+ http://www.fda.gov/ForIndustry/DataStandards/StructuredProductLabeling/ucm162523.htm
1974
+
1975
+ Allegies to a class of medication Shall contain a value descending from the NDF-RT concept types
1976
+ of Mechanism of Action - N0000000223, Physiologic Effect - N0000009802 or
1977
+ Chemical Structure - N0000000002. NUI will be used as the concept code.
1978
+ For more information, please see the Web Site
1979
+ http://www.cancer.gov/cancertopics/terminologyresources/page5
1980
+
1981
+ Allergies to a specific medication shall use RxNorm for the values.
1982
+ @returns {CodedValue}
1983
+ */
1984
+
1985
+
1986
+ Allergy.prototype.product = function() {
1987
+ return this.type();
1988
+ };
1989
+
1990
+ /**
1991
+ Date of allergy or adverse event
1992
+ @returns{Date}
1993
+ */
1994
+
1995
+
1996
+ Allergy.prototype.adverseEventDate = function() {
1997
+ return dateFromUtcSeconds(this.json['adverseEventDate']);
1998
+ };
1999
+
2000
+ /**
2001
+ Adverse event types SHALL be coded as specified in HITSP/C80 Section 2.2.3.4.2 Allergy/Adverse Event Type
2002
+ @returns {CodedValue}
2003
+ */
2004
+
2005
+
2006
+ Allergy.prototype.adverseEventType = function() {
2007
+ return new hQuery.CodedValue(this.json['type']['code'], this.json['type']['codeSystem']);
2008
+ };
2009
+
2010
+ /**
2011
+ This indicates the reaction that may be caused by the product or agent.
2012
+ It is defined by 2.16.840.1.113883.3.88.12.3221.6.2 and are SNOMED-CT codes.
2013
+ 420134006 Propensity to adverse reactions (disorder)
2014
+ 418038007 Propensity to adverse reactions to substance (disorder)
2015
+ 419511003 Propensity to adverse reactions to drug (disorder)
2016
+ 418471000 Propensity to adverse reactions to food (disorder)
2017
+ 419199007 Allergy to substance (disorder)
2018
+ 416098002 Drug allergy (disorder)
2019
+ 414285001 Food allergy (disorder)
2020
+ 59037007 Drug intolerance (disorder)
2021
+ 235719002 Food intolerance (disorder)
2022
+ @returns {CodedValue}
2023
+ */
2024
+
2025
+
2026
+ Allergy.prototype.reaction = function() {
2027
+ return new hQuery.CodedValue(this.json['reaction']['code'], this.json['reaction']['codeSystem']);
2028
+ };
2029
+
2030
+ /**
2031
+ This is a description of the level of the severity of the allergy or intolerance.
2032
+ Use SNOMED-CT Codes as defined by 2.16.840.1.113883.3.88.12.3221.6.8
2033
+ 255604002 Mild
2034
+ 371923003 Mild to Moderate
2035
+ 6736007 Moderate
2036
+ 371924009 Moderate to Severe
2037
+ 24484000 Severe
2038
+ 399166001 Fatal
2039
+ @returns {CodedValue}
2040
+ */
2041
+
2042
+
2043
+ Allergy.prototype.severity = function() {
2044
+ return new hQuery.CodedValue(this.json['severity']['code'], this.json['severity']['codeSystem']);
2045
+ };
2046
+
2047
+ /**
2048
+ Additional comment or textual information
2049
+ @returns {String}
2050
+ */
2051
+
2052
+
2053
+ Allergy.prototype.comment = function() {
2054
+ return this.json['comment'];
2055
+ };
2056
+
2057
+ return Allergy;
2058
+
2059
+ })(hQuery.CodedEntry);
2060
+ /**
2061
+ @namespace scoping into the hquery namespace
2062
+ */
2063
+
2064
+ this.hQuery || (this.hQuery = {});
2065
+
2066
+ /**
2067
+ @class
2068
+
2069
+ @exports Provider as hQuery.Provider
2070
+ */
2071
+
2072
+
2073
+ hQuery.Provider = (function() {
2074
+
2075
+ Provider.name = 'Provider';
2076
+
2077
+ function Provider(json) {
2078
+ this.json = json;
2079
+ }
2080
+
2081
+ /**
2082
+ @returns {hQuery.Person}
2083
+ */
2084
+
2085
+
2086
+ Provider.prototype.providerEntity = function() {
2087
+ return new hQuery.Person(this.json['providerEntity']);
2088
+ };
2089
+
2090
+ /**
2091
+ @returns {hQuery.DateRange}
2092
+ */
2093
+
2094
+
2095
+ Provider.prototype.careProvisionDateRange = function() {
2096
+ return new hQuery.DateRange(this.json['careProvisionDateRange']);
2097
+ };
2098
+
2099
+ /**
2100
+ @returns {hQuery.CodedValue}
2101
+ */
2102
+
2103
+
2104
+ Provider.prototype.role = function() {
2105
+ return new hQuery.CodedValue(this.json['role']['code'], this.json['role']['codeSystem']);
2106
+ };
2107
+
2108
+ /**
2109
+ @returns {String}
2110
+ */
2111
+
2112
+
2113
+ Provider.prototype.patientID = function() {
2114
+ return this.json['patientID'];
2115
+ };
2116
+
2117
+ /**
2118
+ @returns {hQuery.CodedValue}
2119
+ */
2120
+
2121
+
2122
+ Provider.prototype.providerType = function() {
2123
+ return new hQuery.CodedValue(this.json['providerType']['code'], this.json['providerType']['codeSystem']);
2124
+ };
2125
+
2126
+ /**
2127
+ @returns {String}
2128
+ */
2129
+
2130
+
2131
+ Provider.prototype.providerID = function() {
2132
+ return this.json['providerID'];
2133
+ };
2134
+
2135
+ /**
2136
+ @returns {hQuery.Organization}
2137
+ */
2138
+
2139
+
2140
+ Provider.prototype.organizationName = function() {
2141
+ return new hQuery.Organization(this.json);
2142
+ };
2143
+
2144
+ return Provider;
2145
+
2146
+ })();
2147
+ /**
2148
+ @namespace scoping into the hquery namespace
2149
+ */
2150
+
2151
+ var __hasProp = {}.hasOwnProperty,
2152
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
2153
+
2154
+ this.hQuery || (this.hQuery = {});
2155
+
2156
+ /**
2157
+ @class
2158
+ @augments hQuery.CodedEntry
2159
+ @exports Language as hQuery.Language
2160
+ */
2161
+
2162
+
2163
+ hQuery.Language = (function(_super) {
2164
+
2165
+ __extends(Language, _super);
2166
+
2167
+ Language.name = 'Language';
2168
+
2169
+ function Language(json) {
2170
+ this.json = json;
2171
+ Language.__super__.constructor.call(this, this.json);
2172
+ }
2173
+
2174
+ /**
2175
+ @returns {hQuery.CodedValue}
2176
+ */
2177
+
2178
+
2179
+ Language.prototype.modeCode = function() {
2180
+ return new hQuery.CodedValue(this.json['modeCode']['code'], this.json['modeCode']['codeSystem']);
2181
+ };
2182
+
2183
+ /**
2184
+ @returns {String}
2185
+ */
2186
+
2187
+
2188
+ Language.prototype.preferenceIndicator = function() {
2189
+ return this.json['preferenceIndicator'];
2190
+ };
2191
+
2192
+ return Language;
2193
+
2194
+ })(hQuery.CodedEntry);
2195
+ /**
2196
+ @namespace scoping into the hquery namespace
2197
+ */
2198
+
2199
+ var __hasProp = {}.hasOwnProperty,
2200
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
2201
+
2202
+ this.hQuery || (this.hQuery = {});
2203
+
2204
+ /**
2205
+ This includes information about the patients current and past pregnancy status
2206
+ The Coded Entry code system should be SNOMED-CT
2207
+ @class
2208
+ @augments hQuery.CodedEntry
2209
+ @exports Pregnancy as hQuery.Pregnancy
2210
+ */
2211
+
2212
+
2213
+ hQuery.Pregnancy = (function(_super) {
2214
+
2215
+ __extends(Pregnancy, _super);
2216
+
2217
+ Pregnancy.name = 'Pregnancy';
2218
+
2219
+ function Pregnancy(json) {
2220
+ this.json = json;
2221
+ Pregnancy.__super__.constructor.call(this, this.json);
2222
+ }
2223
+
2224
+ /**
2225
+ @returns {String}
2226
+ */
2227
+
2228
+
2229
+ Pregnancy.prototype.comment = function() {
2230
+ return this.json['comment'];
2231
+ };
2232
+
2233
+ return Pregnancy;
2234
+
2235
+ })(hQuery.CodedEntry);
2236
+ /**
2237
+ @namespace scoping into the hquery namespace
2238
+ */
2239
+
2240
+ var __hasProp = {}.hasOwnProperty,
2241
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
2242
+
2243
+ this.hQuery || (this.hQuery = {});
2244
+
2245
+ /**
2246
+
2247
+ The Social History Observation is used to define the patient's occupational, personal (e.g. lifestyle),
2248
+ social, and environmental history and health risk factors, as well as administrative data such as
2249
+ marital status, race, ethnicity and religious affiliation. The types of conditions
2250
+ described have been constrained to the SNOMED CT code system using constrained code set, 2.16.840.1.113883.3.88.12.80.60:
2251
+ 229819007 Tobacco use and exposure
2252
+ 256235009 Exercise
2253
+ 160573003 Alcohol Intake
2254
+ 364393001 Nutritional observable
2255
+ 364703007 Employment detail
2256
+ 425400000 Toxic exposure status
2257
+ 363908000 Details of drug misuse behavior
2258
+ 228272008 Health-related behavior
2259
+ 105421008 Educational achievement
2260
+
2261
+ note: Social History is not part of the existing green c32.
2262
+ @exports Socialhistory as hQuery.Socialhistory
2263
+ @augments hQuery.CodedEntry
2264
+ */
2265
+
2266
+
2267
+ hQuery.Socialhistory = (function(_super) {
2268
+
2269
+ __extends(Socialhistory, _super);
2270
+
2271
+ Socialhistory.name = 'Socialhistory';
2272
+
2273
+ function Socialhistory(json) {
2274
+ this.json = json;
2275
+ Socialhistory.__super__.constructor.call(this, this.json);
2276
+ }
2277
+
2278
+ /**
2279
+ Value returns the value of the result. This will return an object. The properties of this
2280
+ object are dependent on the type of result.
2281
+ */
2282
+
2283
+
2284
+ Socialhistory.prototype.value = function() {
2285
+ return this.json['value'];
2286
+ };
2287
+
2288
+ return Socialhistory;
2289
+
2290
+ })(hQuery.CodedEntry);
2291
+ /**
2292
+ @namespace scoping into the hquery namespace
2293
+ */
2294
+
2295
+ var __hasProp = {}.hasOwnProperty,
2296
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
2297
+
2298
+ this.hQuery || (this.hQuery = {});
2299
+
2300
+ /**
2301
+
2302
+ The plan of care contains data defining prospective or intended orders, interventions, encounters, services, and procedures for the patient.
2303
+
2304
+ @exports CareGoal as hQuery.CareGoal
2305
+ @augments hQuery.CodedEntry
2306
+ */
2307
+
2308
+
2309
+ hQuery.CareGoal = (function(_super) {
2310
+
2311
+ __extends(CareGoal, _super);
2312
+
2313
+ CareGoal.name = 'CareGoal';
2314
+
2315
+ function CareGoal(json) {
2316
+ this.json = json;
2317
+ }
2318
+
2319
+ return CareGoal;
2320
+
2321
+ })(hQuery.CodedEntry);
2322
+ /**
2323
+ @namespace scoping into the hquery namespace
2324
+ */
2325
+
2326
+ var __hasProp = {}.hasOwnProperty,
2327
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
2328
+
2329
+ this.hQuery || (this.hQuery = {});
2330
+
2331
+ /**
2332
+
2333
+ The Medical Equipment section contains information describing a patients implanted and external medical devices and equipment that their health status depends on, as well as any pertinent equipment or device history.
2334
+
2335
+ The template identifier for this section is 2.16.840.1.113883.3.88.11.83.128
2336
+
2337
+ C83-[CT-128-1] This section shall conform to the HL7 CCD section, and shall contain a templateId element whose root attribute is 2.16.840.1.113883.10.20.1.7.
2338
+ C83-[CT-128-2] This section SHALL conform to the IHE Medical Devices Section, and shall contain a templateId element whose root attribute is 1.3.6.1.4.1.19376.1.5.3.1.1.5.3.5
2339
+
2340
+ @exports MedicalEquipment as hQuery.MedicalEquipment
2341
+ @augments hQuery.CodedEntry
2342
+ */
2343
+
2344
+
2345
+ hQuery.MedicalEquipment = (function(_super) {
2346
+
2347
+ __extends(MedicalEquipment, _super);
2348
+
2349
+ MedicalEquipment.name = 'MedicalEquipment';
2350
+
2351
+ function MedicalEquipment(json) {
2352
+ this.json = json;
2353
+ }
2354
+
2355
+ return MedicalEquipment;
2356
+
2357
+ })(hQuery.CodedEntry);
2358
+ /**
2359
+ @namespace scoping into the hquery namespace
2360
+ */
2361
+
2362
+ var __hasProp = {}.hasOwnProperty,
2363
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; };
2364
+
2365
+ this.hQuery || (this.hQuery = {});
2366
+
2367
+ /**
2368
+ @class Supports
2369
+ @exports Supports as hQuery.Supports
2370
+ */
2371
+
2372
+
2373
+ hQuery.Supports = (function() {
2374
+
2375
+ Supports.name = 'Supports';
2376
+
2377
+ function Supports(json) {
2378
+ this.json = json;
2379
+ }
2380
+
2381
+ /**
2382
+ @returns {DateRange}
2383
+ */
2384
+
2385
+
2386
+ Supports.prototype.supportDate = function() {
2387
+ return new hQuery.DateRange(this.json['supportDate']);
2388
+ };
2389
+
2390
+ /**
2391
+ @returns {Person}
2392
+ */
2393
+
2394
+
2395
+ Supports.prototype.guardian = function() {
2396
+ return new hQuery.Person(this.json['guardian']);
2397
+ };
2398
+
2399
+ /**
2400
+ @returns {String}
2401
+ */
2402
+
2403
+
2404
+ Supports.prototype.guardianSupportType = function() {
2405
+ return this.json['guardianSupportType'];
2406
+ };
2407
+
2408
+ /**
2409
+ @returns {Person}
2410
+ */
2411
+
2412
+
2413
+ Supports.prototype.contact = function() {
2414
+ return new hQuery.Person(this.json['contact']);
2415
+ };
2416
+
2417
+ /**
2418
+ @returns {String}
2419
+ */
2420
+
2421
+
2422
+ Supports.prototype.contactSupportType = function() {
2423
+ return this.json['guardianSupportType'];
2424
+ };
2425
+
2426
+ return Supports;
2427
+
2428
+ })();
2429
+
2430
+ /**
2431
+ @class Representation of a patient
2432
+ @augments hQuery.Person
2433
+ @exports Patient as hQuery.Patient
2434
+ */
2435
+
2436
+
2437
+ hQuery.Patient = (function(_super) {
2438
+
2439
+ __extends(Patient, _super);
2440
+
2441
+ Patient.name = 'Patient';
2442
+
2443
+ function Patient() {
2444
+ return Patient.__super__.constructor.apply(this, arguments);
2445
+ }
2446
+
2447
+ /**
2448
+ @returns {String} containing M or F representing the gender of the patient
2449
+ */
2450
+
2451
+
2452
+ Patient.prototype.gender = function() {
2453
+ return this.json['gender'];
2454
+ };
2455
+
2456
+ /**
2457
+ @returns {Date} containing the patient's birthdate
2458
+ */
2459
+
2460
+
2461
+ Patient.prototype.birthtime = function() {
2462
+ return hQuery.dateFromUtcSeconds(this.json['birthdate']);
2463
+ };
2464
+
2465
+ /**
2466
+ @param (Date) date the date at which the patient age is calculated, defaults to now.
2467
+ @returns {number} the patient age in years
2468
+ */
2469
+
2470
+
2471
+ Patient.prototype.age = function(date) {
2472
+ var oneDay, oneYear;
2473
+ if (date == null) {
2474
+ date = new Date();
2475
+ }
2476
+ oneDay = 24 * 60 * 60 * 1000;
2477
+ oneYear = 365 * oneDay;
2478
+ return (date.getTime() - this.birthtime().getTime()) / oneYear;
2479
+ };
2480
+
2481
+ /**
2482
+ @returns {CodedValue} the domestic partnership status of the patient
2483
+ The following HL7 codeset is used:
2484
+ A Annulled
2485
+ D Divorced
2486
+ I Interlocutory
2487
+ L Legally separated
2488
+ M Married
2489
+ P Polygamous
2490
+ S Never Married
2491
+ T Domestic Partner
2492
+ W Widowed
2493
+ */
2494
+
2495
+
2496
+ Patient.prototype.maritalStatus = function() {
2497
+ if (this.json['maritalStatus']) {
2498
+ return new hQuery.CodedValue(this.json['maritalStatus']['code'], this.json['maritalStatus']['codeSystem']);
2499
+ }
2500
+ };
2501
+
2502
+ /**
2503
+ @returns {CodedValue} of the spiritual faith affiliation of the patient
2504
+ It uses the HL7 codeset. http://www.hl7.org/memonly/downloads/v3edition.cfm#V32008
2505
+ */
2506
+
2507
+
2508
+ Patient.prototype.religiousAffiliation = function() {
2509
+ if (this.json['religiousAffiliation']) {
2510
+ return new hQuery.CodedValue(this.json['religiousAffiliation']['code'], this.json['religiousAffiliation']['codeSystem']);
2511
+ }
2512
+ };
2513
+
2514
+ /**
2515
+ @returns {CodedValue} of the race of the patient
2516
+ CDC codes: http://phinvads.cdc.gov/vads/ViewCodeSystemConcept.action?oid=2.16.840.1.113883.6.238&code=1000-9
2517
+ */
2518
+
2519
+
2520
+ Patient.prototype.race = function() {
2521
+ if (this.json['race']) {
2522
+ return new hQuery.CodedValue(this.json['race']['code'], this.json['race']['codeSystem']);
2523
+ }
2524
+ };
2525
+
2526
+ /**
2527
+ @returns {CodedValue} of the ethnicity of the patient
2528
+ CDC codes: http://phinvads.cdc.gov/vads/ViewCodeSystemConcept.action?oid=2.16.840.1.113883.6.238&code=1000-9
2529
+ */
2530
+
2531
+
2532
+ Patient.prototype.ethnicity = function() {
2533
+ if (this.json['ethnicity']) {
2534
+ return new hQuery.CodedValue(this.json['ethnicity']['code'], this.json['ethnicity']['codeSystem']);
2535
+ }
2536
+ };
2537
+
2538
+ /**
2539
+ @returns {CodedValue} This is the code specifying the level of confidentiality of the document.
2540
+ HL7 Confidentiality Code (2.16.840.1.113883.5.25)
2541
+ */
2542
+
2543
+
2544
+ Patient.prototype.confidentiality = function() {
2545
+ if (this.json['confidentiality']) {
2546
+ return new hQuery.CodedValue(this.json['confidentiality']['code'], this.json['confidentiality']['codeSystem']);
2547
+ }
2548
+ };
2549
+
2550
+ /**
2551
+ @returns {Address} of the location where the patient was born
2552
+ */
2553
+
2554
+
2555
+ Patient.prototype.birthPlace = function() {
2556
+ return new hQuery.Address(this.json['birthPlace']);
2557
+ };
2558
+
2559
+ /**
2560
+ @returns {Supports} information regarding key support contacts relative to healthcare decisions, including next of kin
2561
+ */
2562
+
2563
+
2564
+ Patient.prototype.supports = function() {
2565
+ return new hQuery.Supports(this.json['supports']);
2566
+ };
2567
+
2568
+ /**
2569
+ @returns {Organization}
2570
+ */
2571
+
2572
+
2573
+ Patient.prototype.custodian = function() {
2574
+ return new hQuery.Organization(this.json['custodian']);
2575
+ };
2576
+
2577
+ /**
2578
+ @returns {Provider} the providers associated with the patient
2579
+ */
2580
+
2581
+
2582
+ Patient.prototype.provider = function() {
2583
+ return new hQuery.Provider(this.json['provider']);
2584
+ };
2585
+
2586
+ /**
2587
+ @returns {hQuery.CodedEntryList} A list of {@link hQuery.LanguagesSpoken} objects
2588
+ Code from http://www.ietf.org/rfc/rfc4646.txt representing the name of the human language
2589
+ */
2590
+
2591
+
2592
+ Patient.prototype.languages = function() {
2593
+ var language, list, _i, _len, _ref;
2594
+ list = new hQuery.CodedEntryList;
2595
+ if (this.json['languages']) {
2596
+ _ref = this.json['languages'];
2597
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
2598
+ language = _ref[_i];
2599
+ list.push(new hQuery.Language(language));
2600
+ }
2601
+ }
2602
+ return list;
2603
+ };
2604
+
2605
+ /**
2606
+ @returns {hQuery.CodedEntryList} A list of {@link hQuery.Encounter} objects
2607
+ */
2608
+
2609
+
2610
+ Patient.prototype.encounters = function() {
2611
+ var encounter, list, _i, _len, _ref;
2612
+ list = new hQuery.CodedEntryList;
2613
+ if (this.json['encounters']) {
2614
+ _ref = this.json['encounters'];
2615
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
2616
+ encounter = _ref[_i];
2617
+ list.push(new hQuery.Encounter(encounter));
2618
+ }
2619
+ }
2620
+ return list;
2621
+ };
2622
+
2623
+ /**
2624
+ @returns {hQuery.CodedEntryList} A list of {@link Medication} objects
2625
+ */
2626
+
2627
+
2628
+ Patient.prototype.medications = function() {
2629
+ var list, medication, _i, _len, _ref;
2630
+ list = new hQuery.CodedEntryList;
2631
+ if (this.json['medications']) {
2632
+ _ref = this.json['medications'];
2633
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
2634
+ medication = _ref[_i];
2635
+ list.push(new hQuery.Medication(medication));
2636
+ }
2637
+ }
2638
+ return list;
2639
+ };
2640
+
2641
+ /**
2642
+ @returns {hQuery.CodedEntryList} A list of {@link Condition} objects
2643
+ */
2644
+
2645
+
2646
+ Patient.prototype.conditions = function() {
2647
+ var condition, list, _i, _len, _ref;
2648
+ list = new hQuery.CodedEntryList;
2649
+ if (this.json['conditions']) {
2650
+ _ref = this.json['conditions'];
2651
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
2652
+ condition = _ref[_i];
2653
+ list.push(new hQuery.Condition(condition));
2654
+ }
2655
+ }
2656
+ return list;
2657
+ };
2658
+
2659
+ /**
2660
+ @returns {hQuery.CodedEntryList} A list of {@link Procedure} objects
2661
+ */
2662
+
2663
+
2664
+ Patient.prototype.procedures = function() {
2665
+ var list, procedure, _i, _len, _ref;
2666
+ list = new hQuery.CodedEntryList;
2667
+ if (this.json['procedures']) {
2668
+ _ref = this.json['procedures'];
2669
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
2670
+ procedure = _ref[_i];
2671
+ list.push(new hQuery.Procedure(procedure));
2672
+ }
2673
+ }
2674
+ return list;
2675
+ };
2676
+
2677
+ /**
2678
+ @returns {hQuery.CodedEntryList} A list of {@link Result} objects
2679
+ */
2680
+
2681
+
2682
+ Patient.prototype.results = function() {
2683
+ var list, result, _i, _len, _ref;
2684
+ list = new hQuery.CodedEntryList;
2685
+ if (this.json['results']) {
2686
+ _ref = this.json['results'];
2687
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
2688
+ result = _ref[_i];
2689
+ list.push(new hQuery.Result(result));
2690
+ }
2691
+ }
2692
+ return list;
2693
+ };
2694
+
2695
+ /**
2696
+ @returns {hQuery.CodedEntryList} A list of {@link Result} objects
2697
+ */
2698
+
2699
+
2700
+ Patient.prototype.vitalSigns = function() {
2701
+ var list, vital, _i, _len, _ref;
2702
+ list = new hQuery.CodedEntryList;
2703
+ if (this.json['vital_signs']) {
2704
+ _ref = this.json['vital_signs'];
2705
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
2706
+ vital = _ref[_i];
2707
+ list.push(new hQuery.Result(vital));
2708
+ }
2709
+ }
2710
+ return list;
2711
+ };
2712
+
2713
+ /**
2714
+ @returns {hQuery.CodedEntryList} A list of {@link Immunization} objects
2715
+ */
2716
+
2717
+
2718
+ Patient.prototype.immunizations = function() {
2719
+ var immunization, list, _i, _len, _ref;
2720
+ list = new hQuery.CodedEntryList;
2721
+ if (this.json['immunizations']) {
2722
+ _ref = this.json['immunizations'];
2723
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
2724
+ immunization = _ref[_i];
2725
+ list.push(new hQuery.Immunization(immunization));
2726
+ }
2727
+ }
2728
+ return list;
2729
+ };
2730
+
2731
+ /**
2732
+ @returns {hQuery.CodedEntryList} A list of {@link Allergy} objects
2733
+ */
2734
+
2735
+
2736
+ Patient.prototype.allergies = function() {
2737
+ var allergy, list, _i, _len, _ref;
2738
+ list = new hQuery.CodedEntryList;
2739
+ if (this.json['allergies']) {
2740
+ _ref = this.json['allergies'];
2741
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
2742
+ allergy = _ref[_i];
2743
+ list.push(new hQuery.Allergy(allergy));
2744
+ }
2745
+ }
2746
+ return list;
2747
+ };
2748
+
2749
+ /**
2750
+ @returns {hQuery.CodedEntryList} A list of {@link Pregnancy} objects
2751
+ */
2752
+
2753
+
2754
+ Patient.prototype.pregnancies = function() {
2755
+ var list, pregnancy, _i, _len, _ref;
2756
+ list = new hQuery.CodedEntryList;
2757
+ if (this.json['pregnancies']) {
2758
+ _ref = this.json['pregnancies'];
2759
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
2760
+ pregnancy = _ref[_i];
2761
+ list.push(new hQuery.Pregnancy(pregnancy));
2762
+ }
2763
+ }
2764
+ return list;
2765
+ };
2766
+
2767
+ /**
2768
+ @returns {hQuery.CodedEntryList} A list of {@link Socialhistory} objects
2769
+ */
2770
+
2771
+
2772
+ Patient.prototype.socialHistories = function() {
2773
+ var list, socialhistory, _i, _len, _ref;
2774
+ list = new hQuery.CodedEntryList;
2775
+ if (this.json['socialhistories']) {
2776
+ _ref = this.json['socialhistories'];
2777
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
2778
+ socialhistory = _ref[_i];
2779
+ list.push(new hQuery.Socialhistory(socialhistory));
2780
+ }
2781
+ }
2782
+ return list;
2783
+ };
2784
+
2785
+ /**
2786
+ @returns {hQuery.CodedEntryList} A list of {@link CareGoal} objects
2787
+ */
2788
+
2789
+
2790
+ Patient.prototype.careGoals = function() {
2791
+ var caregoal, list, _i, _len, _ref;
2792
+ list = new hQuery.CodedEntryList;
2793
+ if (this.json['care_goals']) {
2794
+ _ref = this.json['care_goals'];
2795
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
2796
+ caregoal = _ref[_i];
2797
+ list.push(new hQuery.CareGoal(caregoal));
2798
+ }
2799
+ }
2800
+ return list;
2801
+ };
2802
+
2803
+ /**
2804
+ @returns {hQuery.CodedEntryList} A list of {@link MedicalEquipment} objects
2805
+ */
2806
+
2807
+
2808
+ Patient.prototype.medicalEquipment = function() {
2809
+ var equipment, list, _i, _len, _ref;
2810
+ list = new hQuery.CodedEntryList;
2811
+ if (this.json['medical_equipment']) {
2812
+ _ref = this.json['medical_equipment'];
2813
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
2814
+ equipment = _ref[_i];
2815
+ list.push(new hQuery.MedicalEquipment(equipment));
2816
+ }
2817
+ }
2818
+ return list;
2819
+ };
2820
+
2821
+ return Patient;
2822
+
2823
+ })(hQuery.Person);