hquery-patient-api 1.0.4 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,6 +3,8 @@
3
3
  # =require condition.js.coffee
4
4
  # =require encounter.js.coffee
5
5
  # =require procedure.js.coffee
6
+ # =require communication.js.coffee
7
+ # =require familyhistory.js.coffee
6
8
  # =require result.js.coffee
7
9
  # =require immunization.js.coffee
8
10
  # =require allergy.js.coffee
@@ -13,6 +15,8 @@
13
15
  # =require caregoal.js.coffee
14
16
  # =require medicalequipment.js.coffee
15
17
  # =require functionalstatus.js.coffee
18
+ # =require careexperience.js.coffee
19
+ # =require assessment.js.coffee
16
20
 
17
21
  ###*
18
22
  @namespace scoping into the hquery namespace
@@ -29,28 +33,28 @@ class hQuery.Supports
29
33
  @returns {DateRange}
30
34
  ###
31
35
  supportDate: -> new hQuery.DateRange @json['supportDate']
32
-
36
+
33
37
  ###*
34
- @returns {Person}
38
+ @returns {Person}
35
39
  ###
36
40
  guardian: -> new hQuery.Person @json['guardian']
37
-
41
+
38
42
  ###*
39
43
  @returns {String}
40
44
  ###
41
45
  guardianSupportType: -> @json['guardianSupportType']
42
-
46
+
43
47
  ###*
44
48
  @returns {Person}
45
49
  ###
46
50
  contact: -> new hQuery.Person @json['contact']
47
-
51
+
48
52
  ###*
49
53
  @returns {String}
50
54
  ###
51
55
  contactSupportType: -> @json['guardianSupportType']
52
-
53
-
56
+
57
+
54
58
  ###*
55
59
  @class Representation of a patient
56
60
  @augments hQuery.Person
@@ -66,8 +70,8 @@ class hQuery.Patient extends hQuery.Person
66
70
  @returns {Date} containing the patients birthdate
67
71
  ###
68
72
  birthtime: ->
69
- hQuery.dateFromUtcSeconds @json['birthdate']
70
-
73
+ hQuery.dateFromUtcSeconds @json['birthdate'] if @json['birthdate']
74
+
71
75
  ###*
72
76
  @param (Date) date the date at which the patient age is calculated, defaults to now.
73
77
  @returns {number} the patient age in years
@@ -76,7 +80,7 @@ class hQuery.Patient extends hQuery.Person
76
80
  oneDay = 24*60*60*1000;
77
81
  oneYear = 365*oneDay;
78
82
  return (date.getTime()-this.birthtime().getTime())/oneYear;
79
-
83
+
80
84
  ###*
81
85
  @returns {CodedValue} the domestic partnership status of the patient
82
86
  The following HL7 codeset is used:
@@ -90,53 +94,63 @@ class hQuery.Patient extends hQuery.Person
90
94
  T Domestic Partner
91
95
  W Widowed
92
96
  ###
93
- maritalStatus: ->
97
+ maritalStatus: ->
94
98
  if @json['maritalStatus']
95
99
  return hQuery.createCodedValue @json['maritalStatus']
96
-
100
+
97
101
  ###*
98
102
  @returns {CodedValue} of the spiritual faith affiliation of the patient
99
103
  It uses the HL7 codeset. http://www.hl7.org/memonly/downloads/v3edition.cfm#V32008
100
104
  ###
101
- religiousAffiliation: ->
105
+ religiousAffiliation: ->
102
106
  if @json['religiousAffiliation']
103
107
  return hQuery.createCodedValue @json['religiousAffiliation']
104
-
108
+
105
109
  ###*
106
110
  @returns {CodedValue} of the race of the patient
107
111
  CDC codes: http://phinvads.cdc.gov/vads/ViewCodeSystemConcept.action?oid=2.16.840.1.113883.6.238&code=1000-9
108
112
  ###
109
- race: ->
113
+ race: ->
110
114
  if @json['race']
111
- return hQuery.createCodedValue @json['race']
112
-
115
+ return hQuery.createCodedValue code: @json['race'], code_system: 'CDC Race'
116
+
117
+ ###*
118
+ @returns {CodedValue} of the payer of the patient
119
+ SOP codes: https://www.health.ny.gov/statistics/sparcs/sysdoc/appp.htm
120
+ ###
121
+ payer: ->
122
+ if @json['insurance_providers']?.length
123
+ ip = @json['insurance_providers'][0]
124
+ if ip.codes && ip.codes.SOP?.length
125
+ return hQuery.createCodedValue code: ip.codes.SOP[0], code_system: 'SOP'
126
+
113
127
  ###*
114
128
  @returns {CodedValue} of the ethnicity of the patient
115
129
  CDC codes: http://phinvads.cdc.gov/vads/ViewCodeSystemConcept.action?oid=2.16.840.1.113883.6.238&code=1000-9
116
130
  ###
117
- ethnicity: ->
131
+ ethnicity: ->
118
132
  if @json['ethnicity']
119
- return hQuery.createCodedValue @json['ethnicity']
120
-
133
+ return hQuery.createCodedValue code: @json['ethnicity'], code_system: 'CDC Ethnicity'
134
+
121
135
  ###*
122
136
  @returns {CodedValue} This is the code specifying the level of confidentiality of the document.
123
137
  HL7 Confidentiality Code (2.16.840.1.113883.5.25)
124
138
  ###
125
- confidentiality: ->
139
+ confidentiality: ->
126
140
  if @json['confidentiality']
127
141
  return hQuery.createCodedValue @json['confidentiality']
128
-
142
+
129
143
  ###*
130
144
  @returns {Address} of the location where the patient was born
131
145
  ###
132
- birthPlace: ->
146
+ birthPlace: ->
133
147
  new hQuery.Address @json['birthPlace']
134
-
148
+
135
149
  ###*
136
150
  @returns {Supports} information regarding key support contacts relative to healthcare decisions, including next of kin
137
151
  ###
138
152
  supports: -> new hQuery.Supports @json['supports']
139
-
153
+
140
154
  ###*
141
155
  @returns {Organization}
142
156
  ###
@@ -146,8 +160,8 @@ class hQuery.Patient extends hQuery.Person
146
160
  @returns {Provider} the providers associated with the patient
147
161
  ###
148
162
  provider: -> new hQuery.Provider @json['provider']
149
-
150
-
163
+
164
+
151
165
  ###*
152
166
  @returns {hQuery.CodedEntryList} A list of {@link hQuery.LanguagesSpoken} objects
153
167
  Code from http://www.ietf.org/rfc/rfc4646.txt representing the name of the human language
@@ -164,11 +178,6 @@ class hQuery.Patient extends hQuery.Person
164
178
  ###
165
179
  expired: -> @json['expired']
166
180
 
167
- ###*
168
- @returns {Boolean} returns true if the patient participated in a clinical trial
169
- ###
170
- clinicalTrialParticipant: -> @json['clinicalTrialParticipant']
171
-
172
181
  ###*
173
182
  @returns {hQuery.CodedEntryList} A list of {@link hQuery.Encounter} objects
174
183
  ###
@@ -178,7 +187,7 @@ class hQuery.Patient extends hQuery.Person
178
187
  for encounter in @json['encounters']
179
188
  list.pushIfUsable(new hQuery.Encounter(encounter))
180
189
  list
181
-
190
+
182
191
  ###*
183
192
  @returns {hQuery.CodedEntryList} A list of {@link Medication} objects
184
193
  ###
@@ -188,7 +197,7 @@ class hQuery.Patient extends hQuery.Person
188
197
  for medication in @json['medications']
189
198
  list.pushIfUsable(new hQuery.Medication(medication))
190
199
  list
191
-
200
+
192
201
 
193
202
  ###*
194
203
  @returns {hQuery.CodedEntryList} A list of {@link Condition} objects
@@ -209,7 +218,47 @@ class hQuery.Patient extends hQuery.Person
209
218
  for procedure in @json['procedures']
210
219
  list.pushIfUsable(new hQuery.Procedure(procedure))
211
220
  list
212
-
221
+
222
+ ###*
223
+ @returns {hQuery.CodedEntryList} A list of {@link Communication} objects
224
+ ###
225
+ communications: ->
226
+ list = new hQuery.CodedEntryList
227
+ if @json['communications']
228
+ for communication in @json['communications']
229
+ list.pushIfUsable(new hQuery.Communication(communication))
230
+ list
231
+
232
+ ###*
233
+ @returns {hQuery.CodedEntryList} A list of {@link FamilyHistory} objects
234
+ ###
235
+ family_history: ->
236
+ list = new hQuery.CodedEntryList
237
+ if @json['family_history']
238
+ for familyhistory in @json['family_history']
239
+ list.pushIfUsable(new hQuery.FamilyHistory(familyhistory))
240
+ list
241
+
242
+ ###*
243
+ @returns {hQuery.CodedEntryList} A list of {@link CareExperience} objects
244
+ ###
245
+ careExperiences: ->
246
+ list = new hQuery.CodedEntryList
247
+ if @json['care_experiences']
248
+ for care_experience in @json['care_experiences']
249
+ list.pushIfUsable(new hQuery.CareExperience(care_experience))
250
+ list
251
+
252
+ ###*
253
+ @returns {hQuery.CodedEntryList} A list of {@link Assessment} objects
254
+ ###
255
+ assessments: ->
256
+ list = new hQuery.CodedEntryList
257
+ if @json['assessments']
258
+ for assessment in @json['assessments']
259
+ list.pushIfUsable(new hQuery.Assessment(assessment))
260
+ list
261
+
213
262
  ###*
214
263
  @returns {hQuery.CodedEntryList} A list of {@link Result} objects
215
264
  ###
@@ -239,8 +288,8 @@ class hQuery.Patient extends hQuery.Person
239
288
  for immunization in @json['immunizations']
240
289
  list.pushIfUsable(new hQuery.Immunization(immunization))
241
290
  list
242
-
243
-
291
+
292
+
244
293
  ###*
245
294
  @returns {hQuery.CodedEntryList} A list of {@link Allergy} objects
246
295
  ###
@@ -260,7 +309,7 @@ class hQuery.Patient extends hQuery.Person
260
309
  for pregnancy in @json['pregnancies']
261
310
  list.pushIfUsable(new hQuery.Pregnancy(pregnancy))
262
311
  list
263
-
312
+
264
313
  ###*
265
314
  @returns {hQuery.CodedEntryList} A list of {@link Socialhistory} objects
266
315
  ###
@@ -10,15 +10,14 @@ This includes information about the patients current and past pregnancy status
10
10
  The Coded Entry code system should be SNOMED-CT
11
11
  @class
12
12
  @augments hQuery.CodedEntry
13
- @exports Pregnancy as hQuery.Pregnancy
13
+ @exports Pregnancy as hQuery.Pregnancy
14
14
  ###
15
15
  class hQuery.Pregnancy extends hQuery.CodedEntry
16
16
  constructor: (@json) ->
17
17
  super(@json)
18
-
18
+
19
19
 
20
20
  ###*
21
21
  @returns {String}
22
22
  ###
23
23
  comment: -> @json['comment']
24
-
@@ -6,23 +6,28 @@ this.hQuery ||= {}
6
6
 
7
7
  # =require core.coffee
8
8
  ###*
9
- This represents all interventional, surgical, diagnostic, or therapeutic procedures or
9
+ This represents all interventional, surgical, diagnostic, or therapeutic procedures or
10
10
  treatments pertinent to the patient.
11
11
  @class
12
12
  @augments hQuery.CodedEntry
13
- @exports Procedure as hQuery.Procedure
13
+ @exports Procedure as hQuery.Procedure
14
14
  ###
15
15
  class hQuery.Procedure extends hQuery.CodedEntry
16
16
  constructor: (@json) ->
17
17
  super(@json)
18
-
18
+ @_facility = new hQuery.Facility @json['facility'] if @json['facility']
19
+
20
+
21
+ facility: -> @_facility
22
+ facilityArrival: -> @_facility?.startDate()
23
+ facilityDeparture: -> @_facility?.endDate()
19
24
  ###*
20
25
  @returns {hQuery.Actor} The provider that performed the procedure
21
26
  ###
22
27
  performer: -> new hQuery.Actor @json['performer'] if @json['performer']
23
-
28
+
24
29
  ###*
25
- @returns {hQuery.CodedValue} A SNOMED code indicating the body site on which the
30
+ @returns {hQuery.CodedValue} A SNOMED code indicating the body site on which the
26
31
  procedure was performed
27
32
  ###
28
33
  site: -> new hQuery.CodedValue @json['site']?['code'], @json['site']?['code_system']
@@ -30,7 +35,7 @@ class hQuery.Procedure extends hQuery.CodedEntry
30
35
  ###*
31
36
  @returns {hQuery.CodedValue} A SNOMED code indicating where the procedure was performed.
32
37
  ###
33
- source: ->
38
+ source: ->
34
39
  hQuery.createCodedValue @json['source']
35
40
 
36
41
  ###*
@@ -43,3 +48,46 @@ class hQuery.Procedure extends hQuery.CodedEntry
43
48
  @returns {CodedValue}
44
49
  ###
45
50
  ordinality: -> hQuery.createCodedValue @json['ordinality']
51
+
52
+ ###*
53
+ @returns {hQuery.CodedValue} A code indicating the approach body site on which the
54
+ procedure was performed
55
+ ###
56
+ anatomicalApproach: -> new hQuery.CodedValue @json['anatomicalApproach']?['code'], @json['anatomicalApproach']?['code_system']
57
+
58
+ ###*
59
+ @returns {hQuery.CodedValue} A code indicating the body site on which the
60
+ procedure was performed
61
+ ###
62
+ anatomicalLocation: ->
63
+ #backwards compatibility with older patient records. site was used for anatomicalLocation
64
+ at = @json['anatomicalLocation']
65
+ if at? then new hQuery.CodedValue(at['code'], at['code_system']) else @site()
66
+
67
+ ###*
68
+ @returns {CodedValue}
69
+ ###
70
+ method: -> new hQuery.createCodedValue @json['method']
71
+
72
+ ###*
73
+ @returns {CodedValue}
74
+ ###
75
+ reaction: -> new hQuery.createCodedValue @json['reaction']
76
+
77
+ ###*
78
+ @returns {CodedValue}
79
+ ###
80
+ radiationDose: -> new hQuery.createCodedValue @json['radiationDose']
81
+
82
+ ###*
83
+ @returns {CodedValue}
84
+ ###
85
+ radiationDuration: -> new hQuery.createCodedValue @json['radiationDuration']
86
+
87
+ ###*
88
+ The resulting status of a procedure as defined in the QDM documentation. This is different
89
+ than the status_code associated with the `CodedEntry` object, which relates to the data criteria
90
+ status as defined in health-data-standards/lib/hqmf-model/data_criteria.json.
91
+ @returns {CodedValue}
92
+ ###
93
+ qdmStatus: -> new hQuery.createCodedValue @json['qdm_status']
@@ -6,7 +6,7 @@ this.hQuery ||= {}
6
6
 
7
7
  # =require core.coffee
8
8
  ###*
9
- @class
9
+ @class
10
10
 
11
11
  @exports Provider as hQuery.Provider
12
12
  ###
@@ -17,39 +17,35 @@ class hQuery.Provider
17
17
  @returns {hQuery.Person}
18
18
  ###
19
19
  providerEntity: -> new hQuery.Person @json['providerEntity'] if @json['providerEntity']
20
-
20
+
21
21
  ###*
22
22
  @returns {hQuery.DateRange}
23
23
  ###
24
24
  careProvisionDateRange: -> new hQuery.DateRange @json['careProvisionDateRange'] if @json['careProvisionDateRange']
25
-
25
+
26
26
  ###*
27
27
  @returns {hQuery.CodedValue}
28
28
  ###
29
29
  role: -> hQuery.createCodedValue @json['role']
30
-
30
+
31
31
  ###*
32
32
  @returns {String}
33
33
  ###
34
34
  patientID: -> @json['patientID']
35
-
36
-
35
+
36
+
37
37
  ###*
38
38
  @returns {hQuery.CodedValue}
39
39
  ###
40
40
  providerType: -> hQuery.createCodedValue @json['providerType']
41
-
42
-
41
+
42
+
43
43
  ###*
44
44
  @returns {String}
45
45
  ###
46
46
  providerID: -> @json['providerID']
47
-
47
+
48
48
  ###*
49
49
  @returns {hQuery.Organization}
50
50
  ###
51
51
  organizationName: -> new hQuery.Organization @json
52
-
53
-
54
-
55
-
@@ -12,7 +12,7 @@ ultrasound, CT, MRI, angiography, cardiac echo, nuclear medicine, pathology, and
12
12
  observations.
13
13
  @class
14
14
  @augments hQuery.CodedEntry
15
- @exports Result as hQuery.Result
15
+ @exports Result as hQuery.Result
16
16
  ###
17
17
  class hQuery.Result extends hQuery.CodedEntry
18
18
  constructor: (@json) ->
@@ -30,14 +30,31 @@ class hQuery.Result extends hQuery.CodedEntry
30
30
  @returns {CodedValue}
31
31
  ###
32
32
  interpretation: -> hQuery.createCodedValue @json['interpretation']
33
-
33
+
34
34
  ###*
35
35
  @returns {String}
36
36
  ###
37
37
  referenceRange: -> @json['referenceRange']
38
-
38
+
39
+ ###*
40
+ @returns {String}
41
+ ###
42
+ referenceRangeHigh: -> @json['referenceRangeHigh']
43
+
44
+ ###*
45
+ @returns {String}
46
+ ###
47
+ referenceRangeLow: -> @json['referenceRangeLow']
48
+
39
49
  ###*
40
50
  @returns {String}
41
51
  ###
42
52
  comment: -> @json['comment']
43
-
53
+
54
+ ###*
55
+ The resulting status of a procedure as defined in the QDM documentation. This is different
56
+ than the status_code associated with the `CodedEntry` object, which relates to the data criteria
57
+ status as defined in health-data-standards/lib/hqmf-model/data_criteria.json.
58
+ @returns {CodedValue}
59
+ ###
60
+ qdmStatus: -> hQuery.createCodedValue @json['qdm_status']