Class: QDM::Patient
- Inherits:
-
Object
- Object
- QDM::Patient
- Includes:
- Mongoid::Document
- Defined in:
- app/models/qdm/patient.rb
Overview
app/models/qdm/patient.rb
Instance Method Summary collapse
-
#adverse_events ⇒ Object
Helper method; returns adverse_event data element types on this patient.
-
#allergies ⇒ Object
Helper method; returns allergy data element types on this patient.
-
#assessments ⇒ Object
Helper method; returns assessment data element types on this patient.
-
#care_experiences ⇒ Object
Helper method; returns care_experience data element types on this patient.
-
#care_goals ⇒ Object
Helper method; returns care_goal data element types on this patient.
-
#communications ⇒ Object
Helper method; returns communication data element types on this patient.
-
#conditions ⇒ Object
Helper method; returns condition data element types on this patient.
-
#devices ⇒ Object
Helper method; returns device data element types on this patient.
-
#diagnostic_studies ⇒ Object
Helper method; returns diagnostic_study data element types on this patient.
-
#encounters ⇒ Object
Helper method; returns encounter data element types on this patient.
-
#family_history ⇒ Object
Helper method; returns family_history data element types on this patient.
-
#functional_statuses ⇒ Object
Helper method; returns functional_status data element types on this patient.
-
#get_by_hqmf_oid(hqmf_oid) ⇒ Object
Returns an array of elements that exist on this patient, that match the given HQMF data criteria OID.
-
#get_by_qrda_oid(qrda_oid) ⇒ Object
Returns an array of elements that exist on this patient, that match the given QRDA data criteria OID.
-
#get_data_elements(category = nil, status = nil) ⇒ Object
Returns an array of elements that exist on this patient.
-
#id ⇒ Object
Return the Mongo id.
-
#immunizations ⇒ Object
Helper method; returns immunization data element types on this patient.
-
#interventions ⇒ Object
Helper method; returns intervention data element types on this patient.
-
#laboratory_tests ⇒ Object
Helper method; returns laboratory_test data element types on this patient.
-
#medical_equipment ⇒ Object
Helper method; returns medical_equipment data element types on this patient.
-
#medications ⇒ Object
Helper method; returns medication data element types on this patient.
-
#patient_characteristics ⇒ Object
Helper method; returns patient_characteristic data element types on this patient.
-
#physical_exams ⇒ Object
Helper method; returns physical_exam data element types on this patient.
-
#preferences ⇒ Object
Helper method; returns preference data element types on this patient.
-
#procedures ⇒ Object
Helper method; returns procedure data element types on this patient.
-
#provider_characteristics ⇒ Object
Helper method; returns provider_characteristic data element types on this patient.
-
#results ⇒ Object
Helper method; returns result data element types on this patient.
-
#risk_category_assessments ⇒ Object
Helper method; returns risk_category_assessment data element types on this patient.
-
#shift_dates(seconds) ⇒ Object
Shift all data element fields that deal with dates by the given value.
-
#social_history ⇒ Object
Helper method; returns social_history data element types on this patient.
-
#substances ⇒ Object
Helper method; returns substance data element types on this patient.
-
#symptoms ⇒ Object
Helper method; returns symptom data element types on this patient.
-
#system_characteristics ⇒ Object
Helper method; returns system_characteristic data element types on this patient.
-
#to_json(options = nil) ⇒ Object
Include ‘_type’ in any JSON output.
-
#transfers ⇒ Object
Helper method; returns transfer data element types on this patient.
-
#vital_signs ⇒ Object
Helper method; returns vital_sign data element types on this patient.
Instance Method Details
#adverse_events ⇒ Object
Helper method; returns adverse_event data element types on this patient.
56 57 58 |
# File 'app/models/qdm/patient.rb', line 56 def adverse_events get_data_elements('adverse_event') end |
#allergies ⇒ Object
Helper method; returns allergy data element types on this patient.
61 62 63 |
# File 'app/models/qdm/patient.rb', line 61 def allergies get_data_elements('allergy') end |
#assessments ⇒ Object
Helper method; returns assessment data element types on this patient.
66 67 68 |
# File 'app/models/qdm/patient.rb', line 66 def assessments get_data_elements('assessment') end |
#care_experiences ⇒ Object
Helper method; returns care_experience data element types on this patient.
71 72 73 |
# File 'app/models/qdm/patient.rb', line 71 def care_experiences get_data_elements('care_experience') end |
#care_goals ⇒ Object
Helper method; returns care_goal data element types on this patient.
76 77 78 |
# File 'app/models/qdm/patient.rb', line 76 def care_goals get_data_elements('care_goal') end |
#communications ⇒ Object
Helper method; returns communication data element types on this patient.
81 82 83 |
# File 'app/models/qdm/patient.rb', line 81 def communications get_data_elements('communication') end |
#conditions ⇒ Object
Helper method; returns condition data element types on this patient.
86 87 88 |
# File 'app/models/qdm/patient.rb', line 86 def conditions get_data_elements('condition') end |
#devices ⇒ Object
Helper method; returns device data element types on this patient.
91 92 93 |
# File 'app/models/qdm/patient.rb', line 91 def devices get_data_elements('device') end |
#diagnostic_studies ⇒ Object
Helper method; returns diagnostic_study data element types on this patient.
96 97 98 |
# File 'app/models/qdm/patient.rb', line 96 def diagnostic_studies get_data_elements('diagnostic_study') end |
#encounters ⇒ Object
Helper method; returns encounter data element types on this patient.
101 102 103 |
# File 'app/models/qdm/patient.rb', line 101 def encounters get_data_elements('encounter') end |
#family_history ⇒ Object
Helper method; returns family_history data element types on this patient.
106 107 108 |
# File 'app/models/qdm/patient.rb', line 106 def family_history get_data_elements('family_history') end |
#functional_statuses ⇒ Object
Helper method; returns functional_status data element types on this patient.
111 112 113 |
# File 'app/models/qdm/patient.rb', line 111 def functional_statuses get_data_elements('functional_status') end |
#get_by_hqmf_oid(hqmf_oid) ⇒ Object
Returns an array of elements that exist on this patient, that match the given HQMF data criteria OID.
20 21 22 |
# File 'app/models/qdm/patient.rb', line 20 def get_by_hqmf_oid(hqmf_oid) dataElements.where(hqmfOid: hqmf_oid) || [] end |
#get_by_qrda_oid(qrda_oid) ⇒ Object
Returns an array of elements that exist on this patient, that match the given QRDA data criteria OID.
26 27 28 |
# File 'app/models/qdm/patient.rb', line 26 def get_by_qrda_oid(qrda_oid) dataElements.where(qrdaOid: qrda_oid) || [] end |
#get_data_elements(category = nil, status = nil) ⇒ Object
Returns an array of elements that exist on this patient. Optionally takes a category and/or, which returns all elements of that QDM category. Example: patient.get_data_elements(‘encounters’) will return all Encounter QDM data types active on the patient.
45 46 47 48 49 50 51 52 53 |
# File 'app/models/qdm/patient.rb', line 45 def get_data_elements(category = nil, status = nil) if category && status dataElements.where(qdmCategory: category, qdmStatus: status) || [] elsif category dataElements.where(qdmCategory: category) || [] else dataElements || [] end end |
#id ⇒ Object
Return the Mongo id.
206 207 208 |
# File 'app/models/qdm/patient.rb', line 206 def id _id end |
#immunizations ⇒ Object
Helper method; returns immunization data element types on this patient.
116 117 118 |
# File 'app/models/qdm/patient.rb', line 116 def immunizations get_data_elements('immunization') end |
#interventions ⇒ Object
Helper method; returns intervention data element types on this patient.
121 122 123 |
# File 'app/models/qdm/patient.rb', line 121 def interventions get_data_elements('intervention') end |
#laboratory_tests ⇒ Object
Helper method; returns laboratory_test data element types on this patient.
126 127 128 |
# File 'app/models/qdm/patient.rb', line 126 def laboratory_tests get_data_elements('laboratory_test') end |
#medical_equipment ⇒ Object
Helper method; returns medical_equipment data element types on this patient.
131 132 133 |
# File 'app/models/qdm/patient.rb', line 131 def medical_equipment get_data_elements('medical_equipment') end |
#medications ⇒ Object
Helper method; returns medication data element types on this patient.
136 137 138 |
# File 'app/models/qdm/patient.rb', line 136 def medications get_data_elements('medication') end |
#patient_characteristics ⇒ Object
Helper method; returns patient_characteristic data element types on this patient.
141 142 143 |
# File 'app/models/qdm/patient.rb', line 141 def patient_characteristics get_data_elements('patient_characteristic') end |
#physical_exams ⇒ Object
Helper method; returns physical_exam data element types on this patient.
146 147 148 |
# File 'app/models/qdm/patient.rb', line 146 def physical_exams get_data_elements('physical_exam') end |
#preferences ⇒ Object
Helper method; returns preference data element types on this patient.
151 152 153 |
# File 'app/models/qdm/patient.rb', line 151 def preferences get_data_elements('preference') end |
#procedures ⇒ Object
Helper method; returns procedure data element types on this patient.
161 162 163 |
# File 'app/models/qdm/patient.rb', line 161 def procedures get_data_elements('procedure') end |
#provider_characteristics ⇒ Object
Helper method; returns provider_characteristic data element types on this patient.
156 157 158 |
# File 'app/models/qdm/patient.rb', line 156 def provider_characteristics get_data_elements('provider_characteristic') end |
#results ⇒ Object
Helper method; returns result data element types on this patient.
166 167 168 |
# File 'app/models/qdm/patient.rb', line 166 def results get_data_elements('result') end |
#risk_category_assessments ⇒ Object
Helper method; returns risk_category_assessment data element types on this patient.
171 172 173 |
# File 'app/models/qdm/patient.rb', line 171 def risk_category_assessments get_data_elements('risk_category_assessment') end |
#shift_dates(seconds) ⇒ Object
Shift all data element fields that deal with dates by the given value. Given value should be in seconds. Positive values shift forward, negative values shift backwards.
Note: This will shift dates of the birthdate and dates on the data elements that exist on the patient.
36 37 38 39 |
# File 'app/models/qdm/patient.rb', line 36 def shift_dates(seconds) self.birthDatetime = (birthDatetime.utc.to_time + seconds.seconds).to_datetime dataElements.each { |element| element.shift_dates(seconds) } end |
#social_history ⇒ Object
Helper method; returns social_history data element types on this patient.
176 177 178 |
# File 'app/models/qdm/patient.rb', line 176 def get_data_elements('social_history') end |
#substances ⇒ Object
Helper method; returns substance data element types on this patient.
181 182 183 |
# File 'app/models/qdm/patient.rb', line 181 def substances get_data_elements('substance') end |
#symptoms ⇒ Object
Helper method; returns symptom data element types on this patient.
186 187 188 |
# File 'app/models/qdm/patient.rb', line 186 def symptoms get_data_elements('symptom') end |
#system_characteristics ⇒ Object
Helper method; returns system_characteristic data element types on this patient.
191 192 193 |
# File 'app/models/qdm/patient.rb', line 191 def system_characteristics get_data_elements('system_characteristic') end |
#to_json(options = nil) ⇒ Object
Include ‘_type’ in any JSON output. This is necessary for deserialization.
211 212 213 |
# File 'app/models/qdm/patient.rb', line 211 def to_json( = nil) serializable_hash(methods: :_type, include: :_type).to_json() end |
#transfers ⇒ Object
Helper method; returns transfer data element types on this patient.
196 197 198 |
# File 'app/models/qdm/patient.rb', line 196 def transfers get_data_elements('transfer') end |
#vital_signs ⇒ Object
Helper method; returns vital_sign data element types on this patient.
201 202 203 |
# File 'app/models/qdm/patient.rb', line 201 def vital_signs get_data_elements('vital_sign') end |