hquery-patient-api 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. data/.gitignore +6 -0
  2. data/.travis.yml +17 -0
  3. data/Gemfile +14 -0
  4. data/LICENSE +57 -0
  5. data/README.md +34 -0
  6. data/Rakefile +41 -0
  7. data/VERSION +1 -0
  8. data/app/assets/javascripts/allergy.js.coffee +79 -0
  9. data/app/assets/javascripts/caregoal.js.coffee +18 -0
  10. data/app/assets/javascripts/condition.js.coffee +88 -0
  11. data/app/assets/javascripts/core.js.coffee +556 -0
  12. data/app/assets/javascripts/encounter.js.coffee +56 -0
  13. data/app/assets/javascripts/functionalstatus.js.coffee +48 -0
  14. data/app/assets/javascripts/immunization.js.coffee +115 -0
  15. data/app/assets/javascripts/languages.js.coffee +29 -0
  16. data/app/assets/javascripts/medicalequipment.js.coffee +28 -0
  17. data/app/assets/javascripts/medication.js.coffee +280 -0
  18. data/app/assets/javascripts/patient.js.coffee +302 -0
  19. data/app/assets/javascripts/pregnancy.js.coffee +24 -0
  20. data/app/assets/javascripts/procedure.js.coffee +28 -0
  21. data/app/assets/javascripts/provider.js.coffee +55 -0
  22. data/app/assets/javascripts/result.js.coffee +43 -0
  23. data/app/assets/javascripts/socialhistory.js.coffee +40 -0
  24. data/doc/jsdoc-toolkit/README.txt +183 -0
  25. data/doc/jsdoc-toolkit/app/frame.js +33 -0
  26. data/doc/jsdoc-toolkit/app/frame/Chain.js +102 -0
  27. data/doc/jsdoc-toolkit/app/frame/Dumper.js +144 -0
  28. data/doc/jsdoc-toolkit/app/frame/Hash.js +84 -0
  29. data/doc/jsdoc-toolkit/app/frame/Link.js +173 -0
  30. data/doc/jsdoc-toolkit/app/frame/Namespace.js +10 -0
  31. data/doc/jsdoc-toolkit/app/frame/Opt.js +134 -0
  32. data/doc/jsdoc-toolkit/app/frame/Reflection.js +26 -0
  33. data/doc/jsdoc-toolkit/app/frame/String.js +93 -0
  34. data/doc/jsdoc-toolkit/app/frame/Testrun.js +129 -0
  35. data/doc/jsdoc-toolkit/app/handlers/FOODOC.js +26 -0
  36. data/doc/jsdoc-toolkit/app/handlers/XMLDOC.js +26 -0
  37. data/doc/jsdoc-toolkit/app/handlers/XMLDOC/DomReader.js +159 -0
  38. data/doc/jsdoc-toolkit/app/handlers/XMLDOC/XMLDoc.js +16 -0
  39. data/doc/jsdoc-toolkit/app/handlers/XMLDOC/XMLParse.js +292 -0
  40. data/doc/jsdoc-toolkit/app/lib/JSDOC.js +106 -0
  41. data/doc/jsdoc-toolkit/app/lib/JSDOC/DocComment.js +204 -0
  42. data/doc/jsdoc-toolkit/app/lib/JSDOC/DocTag.js +294 -0
  43. data/doc/jsdoc-toolkit/app/lib/JSDOC/JsDoc.js +140 -0
  44. data/doc/jsdoc-toolkit/app/lib/JSDOC/JsPlate.js +109 -0
  45. data/doc/jsdoc-toolkit/app/lib/JSDOC/Lang.js +144 -0
  46. data/doc/jsdoc-toolkit/app/lib/JSDOC/Parser.js +146 -0
  47. data/doc/jsdoc-toolkit/app/lib/JSDOC/PluginManager.js +33 -0
  48. data/doc/jsdoc-toolkit/app/lib/JSDOC/Symbol.js +644 -0
  49. data/doc/jsdoc-toolkit/app/lib/JSDOC/SymbolSet.js +243 -0
  50. data/doc/jsdoc-toolkit/app/lib/JSDOC/TextStream.js +41 -0
  51. data/doc/jsdoc-toolkit/app/lib/JSDOC/Token.js +18 -0
  52. data/doc/jsdoc-toolkit/app/lib/JSDOC/TokenReader.js +332 -0
  53. data/doc/jsdoc-toolkit/app/lib/JSDOC/TokenStream.js +133 -0
  54. data/doc/jsdoc-toolkit/app/lib/JSDOC/Util.js +32 -0
  55. data/doc/jsdoc-toolkit/app/lib/JSDOC/Walker.js +507 -0
  56. data/doc/jsdoc-toolkit/app/main.js +111 -0
  57. data/doc/jsdoc-toolkit/app/plugins/commentSrcJson.js +20 -0
  58. data/doc/jsdoc-toolkit/app/plugins/frameworkPrototype.js +16 -0
  59. data/doc/jsdoc-toolkit/app/plugins/functionCall.js +10 -0
  60. data/doc/jsdoc-toolkit/app/plugins/publishSrcHilite.js +62 -0
  61. data/doc/jsdoc-toolkit/app/plugins/symbolLink.js +10 -0
  62. data/doc/jsdoc-toolkit/app/plugins/tagParamConfig.js +31 -0
  63. data/doc/jsdoc-toolkit/app/plugins/tagSynonyms.js +43 -0
  64. data/doc/jsdoc-toolkit/app/run.js +348 -0
  65. data/doc/jsdoc-toolkit/app/t/TestDoc.js +144 -0
  66. data/doc/jsdoc-toolkit/app/t/runner.js +13 -0
  67. data/doc/jsdoc-toolkit/app/test.js +342 -0
  68. data/doc/jsdoc-toolkit/app/test/addon.js +24 -0
  69. data/doc/jsdoc-toolkit/app/test/anon_inner.js +14 -0
  70. data/doc/jsdoc-toolkit/app/test/augments.js +31 -0
  71. data/doc/jsdoc-toolkit/app/test/augments2.js +26 -0
  72. data/doc/jsdoc-toolkit/app/test/borrows.js +46 -0
  73. data/doc/jsdoc-toolkit/app/test/borrows2.js +23 -0
  74. data/doc/jsdoc-toolkit/app/test/config.js +22 -0
  75. data/doc/jsdoc-toolkit/app/test/constructs.js +18 -0
  76. data/doc/jsdoc-toolkit/app/test/encoding.js +10 -0
  77. data/doc/jsdoc-toolkit/app/test/encoding_other.js +12 -0
  78. data/doc/jsdoc-toolkit/app/test/event.js +54 -0
  79. data/doc/jsdoc-toolkit/app/test/exports.js +14 -0
  80. data/doc/jsdoc-toolkit/app/test/functions_anon.js +39 -0
  81. data/doc/jsdoc-toolkit/app/test/functions_nested.js +33 -0
  82. data/doc/jsdoc-toolkit/app/test/global.js +13 -0
  83. data/doc/jsdoc-toolkit/app/test/globals.js +25 -0
  84. data/doc/jsdoc-toolkit/app/test/ignore.js +10 -0
  85. data/doc/jsdoc-toolkit/app/test/inner.js +16 -0
  86. data/doc/jsdoc-toolkit/app/test/jsdoc_test.js +477 -0
  87. data/doc/jsdoc-toolkit/app/test/lend.js +33 -0
  88. data/doc/jsdoc-toolkit/app/test/memberof.js +19 -0
  89. data/doc/jsdoc-toolkit/app/test/memberof2.js +38 -0
  90. data/doc/jsdoc-toolkit/app/test/memberof3.js +33 -0
  91. data/doc/jsdoc-toolkit/app/test/memberof_constructor.js +17 -0
  92. data/doc/jsdoc-toolkit/app/test/module.js +17 -0
  93. data/doc/jsdoc-toolkit/app/test/multi_methods.js +25 -0
  94. data/doc/jsdoc-toolkit/app/test/name.js +19 -0
  95. data/doc/jsdoc-toolkit/app/test/namespace_nested.js +23 -0
  96. data/doc/jsdoc-toolkit/app/test/nocode.js +13 -0
  97. data/doc/jsdoc-toolkit/app/test/oblit_anon.js +20 -0
  98. data/doc/jsdoc-toolkit/app/test/overview.js +20 -0
  99. data/doc/jsdoc-toolkit/app/test/param_inline.js +37 -0
  100. data/doc/jsdoc-toolkit/app/test/params_optional.js +8 -0
  101. data/doc/jsdoc-toolkit/app/test/prototype.js +17 -0
  102. data/doc/jsdoc-toolkit/app/test/prototype_nested.js +9 -0
  103. data/doc/jsdoc-toolkit/app/test/prototype_oblit.js +13 -0
  104. data/doc/jsdoc-toolkit/app/test/prototype_oblit_constructor.js +24 -0
  105. data/doc/jsdoc-toolkit/app/test/public.js +10 -0
  106. data/doc/jsdoc-toolkit/app/test/scripts/code.js +5 -0
  107. data/doc/jsdoc-toolkit/app/test/scripts/notcode.txt +5 -0
  108. data/doc/jsdoc-toolkit/app/test/shared.js +42 -0
  109. data/doc/jsdoc-toolkit/app/test/shared2.js +2 -0
  110. data/doc/jsdoc-toolkit/app/test/shortcuts.js +22 -0
  111. data/doc/jsdoc-toolkit/app/test/static_this.js +13 -0
  112. data/doc/jsdoc-toolkit/app/test/synonyms.js +31 -0
  113. data/doc/jsdoc-toolkit/app/test/tosource.js +23 -0
  114. data/doc/jsdoc-toolkit/app/test/variable_redefine.js +14 -0
  115. data/doc/jsdoc-toolkit/conf/sample.conf +31 -0
  116. data/doc/jsdoc-toolkit/java/build.xml +36 -0
  117. data/doc/jsdoc-toolkit/java/build_1.4.xml +36 -0
  118. data/doc/jsdoc-toolkit/java/classes/js.jar +0 -0
  119. data/doc/jsdoc-toolkit/java/src/JsDebugRun.java +21 -0
  120. data/doc/jsdoc-toolkit/java/src/JsRun.java +21 -0
  121. data/doc/jsdoc-toolkit/jsdebug.jar +0 -0
  122. data/doc/jsdoc-toolkit/jsrun.jar +0 -0
  123. data/doc/jsdoc-toolkit/jsrun.sh +52 -0
  124. data/doc/jsdoc-toolkit/out/jsdoc/files.html +218 -0
  125. data/doc/jsdoc-toolkit/out/jsdoc/index.html +218 -0
  126. data/doc/jsdoc-toolkit/out/jsdoc/symbols/Patient.html +546 -0
  127. data/doc/jsdoc-toolkit/out/jsdoc/symbols/_global_.html +463 -0
  128. data/doc/jsdoc-toolkit/out/jsdoc/symbols/src/tmp_patient.js.html +89 -0
  129. data/doc/jsdoc-toolkit/templates/jsdoc/allclasses.tmpl +17 -0
  130. data/doc/jsdoc-toolkit/templates/jsdoc/allfiles.tmpl +56 -0
  131. data/doc/jsdoc-toolkit/templates/jsdoc/class.tmpl +649 -0
  132. data/doc/jsdoc-toolkit/templates/jsdoc/index.tmpl +39 -0
  133. data/doc/jsdoc-toolkit/templates/jsdoc/publish.js +201 -0
  134. data/doc/jsdoc-toolkit/templates/jsdoc/static/default.css +162 -0
  135. data/doc/jsdoc-toolkit/templates/jsdoc/static/header.html +2 -0
  136. data/doc/jsdoc-toolkit/templates/jsdoc/static/index.html +19 -0
  137. data/doc/jsdoc-toolkit/templates/jsdoc/symbol.tmpl +35 -0
  138. data/hquery_patientapi.gemspec +14 -0
  139. data/lib/hquery-patient-api.rb +4 -0
  140. data/lib/hquery/engine.rb +4 -0
  141. data/lib/hquery/generator.rb +18 -0
  142. data/test/fixtures/patient/barry_berry.json +466 -0
  143. data/test/test_helper.rb +25 -0
  144. data/test/unit/patient_api_test.rb +178 -0
  145. metadata +193 -0
@@ -0,0 +1,56 @@
1
+ ###*
2
+ @namespace scoping into the hquery namespace
3
+ ###
4
+ this.hQuery ||= {}
5
+
6
+
7
+ # =require core.coffee
8
+
9
+ ###*
10
+ An Encounter is an interaction, regardless of the setting, between a patient and a
11
+ practitioner who is vested with primary responsibility for diagnosing, evaluating,
12
+ or treating the patient's condition. It may include visits, appointments, as well
13
+ as non face-to-face interactions. It is also a contact between a patient and a
14
+ practitioner who has primary responsibility for assessing and treating the
15
+ patient at a given contact, exercising independent judgment.
16
+ @class An Encounter is an interaction, regardless of the setting, between a patient and a
17
+ practitioner
18
+ @augments hQuery.CodedEntry
19
+ @exports Encounter as hQuery.Encounter
20
+ ###
21
+ class hQuery.Encounter extends hQuery.CodedEntry
22
+ constructor: (@json) ->
23
+ super(@json)
24
+
25
+ ###*
26
+ @returns {String}
27
+ ####
28
+ dischargeDisp: -> @json['dischargeDisp']
29
+
30
+ ###*
31
+ A code indicating the priority of the admission (e.g., Emergency, Urgent, Elective, et cetera) from
32
+ National Uniform Billing Committee (NUBC)
33
+ @returns {CodedValue}
34
+ ###
35
+ admitType: -> new hQuery.CodedValue @json['admitType']['code'], @json['admitType']['codeSystem']
36
+
37
+ ###*
38
+ @returns {hQuery.Actor}
39
+ ###
40
+ performer: -> new hQuery.Actor @json['performer']
41
+
42
+ ###*
43
+ @returns {hQuery.Organization}
44
+ ###
45
+ facility: -> new hQuery.Facility @json['facility']
46
+
47
+ ###*
48
+ @returns {hQuery.DateRange}
49
+ ###
50
+ encounterDuration: -> new hQuery.DateRange @json
51
+
52
+ ###*
53
+ @returns {hQuery.CodedEntry}
54
+ ###
55
+ reasonForVisit: -> new hQuery.CodedEntry @json['reason']
56
+
@@ -0,0 +1,48 @@
1
+ ###*
2
+ @namespace scoping into the hquery namespace
3
+ ###
4
+ this.hQuery ||= {}
5
+
6
+ # =require core.coffee
7
+ ###*
8
+ This class can be used to represnt a functional status for a patient. Currently,
9
+ it is not a very close representation of functional status as it is represented
10
+ in the HL7 CCD, HITSP C32 or Consolidated CDA.
11
+
12
+ In the previously mentioned specifications, functional status may represented
13
+ using either a condition or result. Having "mixed" types of entries in a section
14
+ is currently not well supported in the existing Record class
15
+
16
+ Additionally, there is a mismatch between the data needed to calculate Stage 2
17
+ Meaningful Use Quailty Measures and the data contained in patient summary
18
+ standards. The CQMs are checking to see if a functional status represented by
19
+ a result was patient supplied. Right now, results do not have a source, and
20
+ even if we were to use Provider as a source, it would need to be extended
21
+ to support patients.
22
+
23
+ To avoid this, the patient sumamry style functional status has been "flattened"
24
+ into this class. This model supports the information needed to calculate
25
+ Stage 2 MU CQMs. If importers are created from C32 or CCDA, the information
26
+ can be stored here, but it will be a lossy transformation.
27
+ @class
28
+ @augments hQuery.CodedEntry
29
+ @exports FunctionalStatus as hQuery.FunctionalStatus
30
+ ###
31
+ class hQuery.FunctionalStatus extends hQuery.CodedEntry
32
+ constructor: (@json) ->
33
+ super(@json)
34
+
35
+ ###*
36
+ Either "condition" or "result"
37
+ @returns {String}
38
+ ###
39
+ type: -> @json["type"]
40
+
41
+ ###*
42
+ A coded value. Like a code for patient supplied.
43
+ @returns {hQuery.CodedValue}
44
+ ###
45
+ source: ->
46
+ if @json["source"]?
47
+ new hQuery.CodedValue @json["source"]["code"], @json["source"]["codeSystem"]
48
+
@@ -0,0 +1,115 @@
1
+ ###*
2
+ @namespace scoping into the hquery namespace
3
+ ###
4
+ this.hQuery ||= {}
5
+
6
+ # =require core.coffee
7
+ # =require medication.coffee
8
+
9
+ ###*
10
+ NoImmunzation as defined by value set 2.16.840.1.113883.1.11.19717
11
+ The terms come from Health Level Seven (HL7) Version 3.0 Vocabulary and are managed by HL7
12
+ It indicates the reason an immunization was not administered.
13
+
14
+ @class NoImmunization - describes the status of the medication
15
+ @augments hQuery.CodedEntry
16
+ @exports NoImmunization as hQuery.NoImmunization
17
+ ###
18
+ class hQuery.NoImmunization extends hQuery.CodedValue
19
+ IMMUNITY = "IMMUNE"
20
+ MED_PRECAUTION = "MEDPREC"
21
+ OUT_OF_STOCK = "OSTOCK"
22
+ PAT_OBJ = "PATOBJ"
23
+ PHIL_OBJ = "PHILISOP"
24
+ REL_OBJ = "RELIG"
25
+ VAC_EFF = "VACEFF"
26
+ VAC_SAFETY = "VACSAF"
27
+
28
+ ###*
29
+ @returns {Boolean}
30
+ ###
31
+ isImmune: -> @c is IMMUNITY
32
+
33
+ ###*
34
+ @returns {Boolean}
35
+ ###
36
+ isMedPrec: -> @c is MED_PRECAUTION
37
+
38
+ ###*
39
+ @returns {Boolean}
40
+ ###
41
+ isOstock: -> @c is OUT_OF_STOCK
42
+
43
+ ###*
44
+ @returns {Boolean}
45
+ ###
46
+ isPatObj: -> @c is PAT_OBJ
47
+
48
+ ###*
49
+ @returns {Boolean}
50
+ ###
51
+ isPhilisop: -> @c is PHIL_OBJ
52
+
53
+ ###*
54
+ @returns {Boolean}
55
+ ###
56
+ isRelig: -> @c is REL_OBJ
57
+
58
+ ###*
59
+ @returns {Boolean}
60
+ ###
61
+ isVacEff: -> @c is VAC_EFF
62
+
63
+ ###*
64
+ @returns {Boolean}
65
+ ###
66
+ isVacSaf: -> @c is VAC_SAFETY
67
+
68
+
69
+ ###*
70
+ @class represents a immunization entry for a patient.
71
+ @augments hQuery.CodedEntry
72
+ @exports Immunization as hQuery.Immunization
73
+ ###
74
+ class hQuery.Immunization extends hQuery.CodedEntry
75
+ constructor: (@json) ->
76
+ super(@json)
77
+
78
+ ###*
79
+ @returns{hQuery.Scalar}
80
+ ###
81
+ medicationSeriesNumber: -> new hQuery.Scalar @json['medicationSeriesNumber']
82
+
83
+ ###*
84
+ @returns{hQuery.MedicationInformation}
85
+ ###
86
+ medicationInformation: ->new hQuery.MedicationInformation @json
87
+
88
+ ###*
89
+ @returns{Date} Date immunization was administered
90
+ ###
91
+ administeredDate: -> dateFromUtcSeconds @json['administeredDate']
92
+
93
+ ###*
94
+ @returns{hQuery.Actor} Performer of immunization
95
+ ###
96
+ performer:-> new hQuery.Actor @json['performer']
97
+
98
+ ###*
99
+ @returns {comment} human readable description of event
100
+ ###
101
+ comment: -> @json['comment']
102
+
103
+ ###*
104
+ @returns {Boolean} whether the immunization has been refused by the patient.
105
+ ###
106
+ refusalInd: -> @json['negationInd']
107
+
108
+ ###*
109
+ NoImmunzation as defined by value set 2.16.840.1.113883.1.11.19717
110
+ The terms come from Health Level Seven (HL7) Version 3.0 Vocabulary and are managed by HL7
111
+ It indicates the reason an immunization was not administered.
112
+ @returns {hQuery.NoImmunization} Used to indicate reason an immunization was not administered.
113
+ ###
114
+ refusalReason: -> new hQuery.NoImmunization @json['negationReason']['code'], @json['negationReason']['codeSystem']
115
+
@@ -0,0 +1,29 @@
1
+ ###*
2
+ @namespace scoping into the hquery namespace
3
+ ###
4
+ this.hQuery ||= {}
5
+
6
+
7
+ # =require core.coffee
8
+ ###*
9
+ @class
10
+ @augments hQuery.CodedEntry
11
+ @exports Language as hQuery.Language
12
+ ###
13
+ class hQuery.Language extends hQuery.CodedEntry
14
+ constructor: (@json) ->
15
+ super(@json)
16
+
17
+ ###*
18
+ @returns {hQuery.CodedValue}
19
+ ###
20
+ modeCode: -> new hQuery.CodedValue @json['modeCode']['code'], @json['modeCode']['codeSystem']
21
+
22
+ ###*
23
+ @returns {String}
24
+ ###
25
+ preferenceIndicator: -> @json['preferenceIndicator']
26
+
27
+
28
+
29
+
@@ -0,0 +1,28 @@
1
+ ###*
2
+ @namespace scoping into the hquery namespace
3
+ ###
4
+ this.hQuery ||= {}
5
+
6
+ # =require core.coffee
7
+
8
+ ###*
9
+
10
+ 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.
11
+
12
+ The template identifier for this section is 2.16.840.1.113883.3.88.11.83.128
13
+
14
+ 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.
15
+ 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
16
+
17
+ @exports MedicalEquipment as hQuery.MedicalEquipment
18
+ @augments hQuery.CodedEntry
19
+ ###
20
+ class hQuery.MedicalEquipment extends hQuery.CodedEntry
21
+
22
+ constructor: (@json) ->
23
+ super(@json)
24
+
25
+ ###*
26
+ @returns {CodedValue}
27
+ ###
28
+ anatomicalStructure: -> new hQuery.CodedValue @json['anatomicalStructure']['code'], @json['anatomicalStructure']['codeSystem']
@@ -0,0 +1,280 @@
1
+ ###*
2
+ @namespace scoping into the hquery namespace
3
+ ###
4
+ this.hQuery ||= {}
5
+
6
+
7
+ # =require core.coffee
8
+ ###*
9
+ @class MedicationInformation
10
+ @exports MedicationInformation as hQuery.MedicationInformation
11
+ ###
12
+ class hQuery.MedicationInformation
13
+ constructor: (@json) ->
14
+
15
+ ###*
16
+ An array of hQuery.CodedValue describing the medication
17
+ @returns {Array}
18
+ ####
19
+ codedProduct: -> hQuery.createCodedValues @json['codes']
20
+ freeTextProductName: -> @json['description']
21
+ codedBrandName: -> @json['codedBrandName']
22
+ freeTextBrandName: -> @json['brandName']
23
+ drugManufacturer: ->
24
+ if(@json['drugManufacturer'])
25
+ new hQuery.Organization(@json['drugManufacturer'])
26
+
27
+ ###*
28
+ @class AdministrationTiming - the
29
+ @exports AdministrationTiming as hQuery.AdministrationTiming
30
+ ###
31
+ class hQuery.AdministrationTiming
32
+ constructor: (@json) ->
33
+
34
+ ###*
35
+ Provides the period of medication administration as a Scalar. An example
36
+ Scalar that would be returned would be with value = 8 and units = hours. This would
37
+ mean that the medication should be taken every 8 hours.
38
+ @returns {hQuery.Scalar}
39
+ ###
40
+ period: -> new hQuery.Scalar @json['period']
41
+
42
+ ###*
43
+ Indicates whether it is the interval (time between dosing), or frequency
44
+ (number of doses in a time period) that is important. If instititutionSpecified is not
45
+ present or is set to false, then the time between dosing is important (every 8 hours).
46
+ If true, then the frequency of administration is important (e.g., 3 times per day).
47
+ @returns {Boolean}
48
+ ###
49
+ institutionSpecified: -> @json['institutionSpecified']
50
+
51
+ ###*
52
+ @class DoseRestriction - restrictions on the medications dose, represented by a upper and lower dose
53
+ @exports DoseRestriction as hQuery.DoseRestriction
54
+ ###
55
+ class hQuery.DoseRestriction
56
+ constructor: (@json) ->
57
+ numerator: -> new hQuery.Scalar @json['numerator']
58
+ denominator: -> new hQuery.Scalar @json['denominator']
59
+
60
+
61
+ ###*
62
+ @class Fulfillment - information about when and who fulfilled an order for the medication
63
+ @exports Fulfillment as hQuery.Fullfilement
64
+ ###
65
+ class hQuery.Fulfillment
66
+ constructor: (@json) ->
67
+
68
+ dispenseDate: -> hQuery.dateFromUtcSeconds @json['dispenseDate']
69
+ dispensingPharmacyLocation: -> new hQuery.Address @json['dispensingPharmacyLocation']
70
+ quantityDispensed: -> new hQuery.Scalar @json['quantityDispensed']
71
+ prescriptionNumber: -> @json['prescriptionNumber']
72
+ fillNumber: -> @json['fillNumber']
73
+ fillStatus: -> new hQuery.Status @json['fillStatus']
74
+
75
+ ###*
76
+ @class OrderInformation - information abour an order for a medication
77
+ @exports OrderInformation as hQuery.OrderInformation
78
+ ###
79
+ class hQuery.OrderInformation
80
+ constructor: (@json) ->
81
+
82
+ orderNumber: -> @json['orderNumber']
83
+ fills: -> @json['fills']
84
+ quantityOrdered: -> new hQuery.Scalar @json['quantityOrdered']
85
+ orderExpirationDateTime: -> hQuery.dateFromUtcSeconds @json['orderExpirationDateTime']
86
+ orderDateTime: -> hQuery.dateFromUtcSeconds @json['orderDateTime']
87
+
88
+
89
+ ###*
90
+ TypeOfMedication as defined by value set 2.16.840.1.113883.3.88.12.3221.8.19
91
+ which pulls two values from SNOMED to describe whether a medication is
92
+ prescription or over the counter
93
+
94
+ @class TypeOfMedication - describes whether a medication is prescription or
95
+ over the counter
96
+ @augments hQuery.CodedEntry
97
+ @exports TypeOfMedication as hQuery.TypeOfMedication
98
+ ###
99
+ class hQuery.TypeOfMedication extends hQuery.CodedValue
100
+ PRESECRIPTION = "73639000" # SNOMED code for preseciption medications
101
+ OTC = "329505003" # SNOMED code for over the counter medications
102
+
103
+ ###*
104
+ @returns {Boolean}
105
+ ###
106
+ isPrescription: -> @c is PRESECRIPTION
107
+
108
+ ###*
109
+ @returns {Boolean}
110
+ ###
111
+ isOverTheCounter: -> @c is OTC
112
+
113
+
114
+ ###*
115
+ StatusOfMedication as defined by value set 2.16.840.1.113883.1.11.20.7
116
+ The terms come from SNOMED and are managed by HL7
117
+
118
+ @class StatusOfMedication - describes the status of the medication
119
+ @augments hQuery.CodedEntry
120
+ @exports StatusOfMedication as hQuery.StatusOfMedication
121
+ ###
122
+ class hQuery.StatusOfMedication extends hQuery.CodedValue
123
+ ON_HOLD = "392521001"
124
+ NO_LONGER_ACTIVE = "421139008"
125
+ ACTIVE = "55561003"
126
+ PRIOR_HISTORY = "73425007"
127
+
128
+ ###*
129
+ @returns {Boolean}
130
+ ###
131
+ isOnHold: -> @c is ON_HOLD
132
+
133
+ ###*
134
+ @returns {Boolean}
135
+ ###
136
+ isNoLongerActive: -> @c is NO_LONGER_ACTIVE
137
+
138
+ ###*
139
+ @returns {Boolean}
140
+ ###
141
+ isActive: -> @c is ACTIVE
142
+
143
+ ###*
144
+ @returns {Boolean}
145
+ ###
146
+ isPriorHistory: -> @c is PRIOR_HISTORY
147
+
148
+ ###*
149
+ @class represents a medication entry for a patient.
150
+ @augments hQuery.CodedEntry
151
+ @exports Medication as hQuery.Medication
152
+ ###
153
+ class hQuery.Medication extends hQuery.CodedEntry
154
+ constructor: (@json) ->
155
+ super(@json)
156
+
157
+ ###*
158
+ @returns {String}
159
+ ####
160
+ freeTextSig: -> @json['freeTextSig']
161
+
162
+ ###*
163
+ The actual or intended start of a medication. Slight deviation from greenCDA for C32 since
164
+ it combines this with medication stop
165
+ @returns {Date}
166
+ ###
167
+ indicateMedicationStart: -> hQuery.dateFromUtcSeconds @json['start_time']
168
+
169
+ ###*
170
+ The actual or intended stop of a medication. Slight deviation from greenCDA for C32 since
171
+ it combines this with medication start
172
+ @returns {Date}
173
+ ###
174
+ indicateMedicationStop: -> hQuery.dateFromUtcSeconds @json['end_time']
175
+
176
+ administrationTiming: -> new hQuery.AdministrationTiming @json['administrationTiming']
177
+
178
+ ###*
179
+ @returns {CodedValue} Contains routeCode or adminstrationUnitCode information.
180
+ Route code shall have a a value drawn from FDA route of adminstration,
181
+ and indicates how the medication is received by the patient.
182
+ See http://www.fda.gov/Drugs/DevelopmentApprovalProcess/UCM070829
183
+ The administration unit code shall have a value drawn from the FDA
184
+ dosage form, source NCI thesaurus and represents the physical form of the
185
+ product as presented to the patient.
186
+ See http://www.fda.gov/Drugs/InformationOnDrugs/ucm142454.htm
187
+ ###
188
+ route: -> new hQuery.CodedValue @json['route']['code'], @json['route']['codeSystem']
189
+
190
+ ###*
191
+ @returns {hQuery.Scalar} the dose
192
+ ###
193
+ dose: -> new hQuery.Scalar @json['dose']
194
+
195
+ ###*
196
+ @returns {CodedValue}
197
+ ###
198
+ site: -> new hQuery.CodedValue @json['site']['code'], @json['site']['codeSystem']
199
+
200
+ ###*
201
+ @returns {hQuery.DoseRestriction}
202
+ ###
203
+ doseRestriction: -> new hQuery.DoseRestriction @json['doseRestriction']
204
+
205
+ ###*
206
+ @returns {String}
207
+ ###
208
+ doseIndicator: -> @json['doseIndicator']
209
+
210
+ ###*
211
+ @returns {String}
212
+ ###
213
+ fulfillmentInstructions: -> @json['fulfillmentInstructions']
214
+
215
+ ###*
216
+ @returns {CodedValue}
217
+ ###
218
+ indication: -> new hQuery.CodedValue @json['indication']['code'], @json['indication']['codeSystem']
219
+
220
+ ###*
221
+ @returns {CodedValue}
222
+ ###
223
+ productForm: -> new hQuery.CodedValue @json['productForm']['code'], @json['productForm']['codeSystem']
224
+
225
+ ###*
226
+ @returns {CodedValue}
227
+ ###
228
+ vehicle: -> new hQuery.CodedValue @json['vehicle']['code'], @json['vehicle']['codeSystem']
229
+
230
+ ###*
231
+ @returns {CodedValue}
232
+ ###
233
+ reaction: -> new hQuery.CodedValue @json['reaction']['code'], @json['reaction']['codeSystem']
234
+
235
+ ###*
236
+ @returns {CodedValue}
237
+ ###
238
+ deliveryMethod: -> new hQuery.CodedValue @json['deliveryMethod']['code'], @json['deliveryMethod']['codeSystem']
239
+
240
+ ###*
241
+ @returns {hQuery.MedicationInformation}
242
+ ###
243
+ medicationInformation: -> new hQuery.MedicationInformation @json
244
+
245
+ ###*
246
+ @returns {hQuery.TypeOfMedication} Indicates whether this is an over the counter or prescription medication
247
+ ###
248
+ typeOfMedication: -> new hQuery.TypeOfMedication @json['typeOfMedication']['code'], @json['typeOfMedication']['codeSystem']
249
+
250
+ ###*
251
+ Values conform to value set 2.16.840.1.113883.1.11.20.7 - Medication Status
252
+ Values may be: On Hold, No Longer Active, Active, Prior History
253
+ @returns {hQuery.StatusOfMedication} Used to indicate the status of the medication.
254
+ ###
255
+ statusOfMedication: -> new hQuery.StatusOfMedication @json['statusOfMedication']['code'], @json['statusOfMedication']['codeSystem']
256
+
257
+ ###*
258
+ @returns {String} free text instructions to the patient
259
+ ###
260
+ patientInstructions: -> @json['patientInstructions']
261
+
262
+ ###*
263
+ The duration over which this medication has been active. For example, 5 days.
264
+ @returns {Hash} with two keys: unit and scalar
265
+ ###
266
+ cumulativeMedicationDuration: -> @json['cumulativeMedicationDuration']
267
+
268
+ ###*
269
+ @returns {Array} an array of {@link FulFillment} objects
270
+ ###
271
+ fulfillmentHistory: ->
272
+ for order in @json['fulfillmentHistory']
273
+ new hQuery.Fulfillment order
274
+
275
+ ###*
276
+ @returns {Array} an array of {@link OrderInformation} objects
277
+ ###
278
+ orderInformation: ->
279
+ for order in @json['orderInformation']
280
+ new hQuery.OrderInformation order