emr_ohsp_interface 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 145e8b4a017e7cbec4cc4ace99ca78f853f16bf5048a7043e1c8eba6b5486a54
|
4
|
+
data.tar.gz: 741d47d437d4334b0218b9dbce8cdb328df9839ee68c95a71dc285c780a96425
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b5c9d1df00c1e00065fd95966924a4c28f130cdf9f7302ed7a7b7071288dcce42f9d1995c2e7d22307bd81749abf28879ef40a1c6f9abef4c1cb2990fe20ceb
|
7
|
+
data.tar.gz: 78e83895b4a74c5d45bc1abdd420aff1003380bc0ba474f6b4d64dfb879309ef1989113f56e178c6f6a2fd52a16549810d3a077547d2482cb46b809ecbba1377
|
@@ -105,7 +105,12 @@ module EmrOhspInterface
|
|
105
105
|
type = EncounterType.find_by_name 'Outpatient diagnosis'
|
106
106
|
collection = {}
|
107
107
|
|
108
|
-
special_indicators = ["Malaria in Pregnancy",
|
108
|
+
special_indicators = ["Malaria in Pregnancy",
|
109
|
+
"HIV New Initiated on ART",
|
110
|
+
"Diarrhoea In Under 5",
|
111
|
+
"Malnutrition In Under 5",
|
112
|
+
"Underweight Newborns < 2500g in Under 5 Cases",
|
113
|
+
"Severe Pneumonia in under 5 cases"]
|
109
114
|
|
110
115
|
diag_map.each do |key,value|
|
111
116
|
options = {"<5yrs"=>nil,">=5yrs"=>nil}
|
@@ -172,6 +177,76 @@ module EmrOhspInterface
|
|
172
177
|
|
173
178
|
collection[key] = options
|
174
179
|
end
|
180
|
+
|
181
|
+
if key.eql?("Diarrhoea In Under 5")
|
182
|
+
data = Encounter.where('encounter_datetime BETWEEN ? AND ?
|
183
|
+
AND encounter_type = ? AND value_coded IN (?)
|
184
|
+
AND concept_id IN(6543, 6542)',
|
185
|
+
start_date.to_date.strftime('%Y-%m-%d 00:00:00'),
|
186
|
+
end_date.to_date.strftime('%Y-%m-%d 23:59:59'),type.id,concept_ids).\
|
187
|
+
joins('INNER JOIN obs ON obs.encounter_id = encounter.encounter_id
|
188
|
+
INNER JOIN person p ON p.person_id = encounter.patient_id').\
|
189
|
+
select('encounter.encounter_type, obs.value_coded, p.*')
|
190
|
+
|
191
|
+
#under_five
|
192
|
+
under_five = data.select{|record| calculate_age(record["birthdate"]) < 5}.\
|
193
|
+
collect{|record| record.person_id}
|
194
|
+
options["<5yrs"] = under_five
|
195
|
+
collection[key] = options
|
196
|
+
end
|
197
|
+
|
198
|
+
|
199
|
+
if key.eql?("Malnutrition In Under 5")
|
200
|
+
data = Encounter.where('encounter_datetime BETWEEN ? AND ?
|
201
|
+
AND encounter_type = ? AND value_coded IN (?)
|
202
|
+
AND concept_id IN(6543, 6542)',
|
203
|
+
start_date.to_date.strftime('%Y-%m-%d 00:00:00'),
|
204
|
+
end_date.to_date.strftime('%Y-%m-%d 23:59:59'),type.id,concept_ids).\
|
205
|
+
joins('INNER JOIN obs ON obs.encounter_id = encounter.encounter_id
|
206
|
+
INNER JOIN person p ON p.person_id = encounter.patient_id').\
|
207
|
+
select('encounter.encounter_type, obs.value_coded, p.*')
|
208
|
+
|
209
|
+
#under_five
|
210
|
+
under_five = data.select{|record| calculate_age(record["birthdate"]) < 5}.\
|
211
|
+
collect{|record| record.person_id}
|
212
|
+
options["<5yrs"] = under_five
|
213
|
+
collection[key] = options
|
214
|
+
end
|
215
|
+
|
216
|
+
|
217
|
+
if key.eql?("Underweight Newborns < 2500g in Under 5 Cases")
|
218
|
+
data = Encounter.where('encounter_datetime BETWEEN ? AND ?
|
219
|
+
AND encounter_type = ? AND value_coded IN (?)
|
220
|
+
AND concept_id IN(6543, 6542)',
|
221
|
+
start_date.to_date.strftime('%Y-%m-%d 00:00:00'),
|
222
|
+
end_date.to_date.strftime('%Y-%m-%d 23:59:59'),type.id,concept_ids).\
|
223
|
+
joins('INNER JOIN obs ON obs.encounter_id = encounter.encounter_id
|
224
|
+
INNER JOIN person p ON p.person_id = encounter.patient_id').\
|
225
|
+
select('encounter.encounter_type, obs.value_coded, p.*')
|
226
|
+
|
227
|
+
#under_five
|
228
|
+
under_five = data.select{|record| calculate_age(record["birthdate"]) < 5}.\
|
229
|
+
collect{|record| record.person_id}
|
230
|
+
options["<5yrs"] = under_five
|
231
|
+
collection[key] = options
|
232
|
+
end
|
233
|
+
|
234
|
+
if key.eql?("Severe Pneumonia in under 5 cases")
|
235
|
+
data = Encounter.where('encounter_datetime BETWEEN ? AND ?
|
236
|
+
AND encounter_type = ? AND value_coded IN (?)
|
237
|
+
AND concept_id IN(6543, 6542)',
|
238
|
+
start_date.to_date.strftime('%Y-%m-%d 00:00:00'),
|
239
|
+
end_date.to_date.strftime('%Y-%m-%d 23:59:59'),type.id,concept_ids).\
|
240
|
+
joins('INNER JOIN obs ON obs.encounter_id = encounter.encounter_id
|
241
|
+
INNER JOIN person p ON p.person_id = encounter.patient_id').\
|
242
|
+
select('encounter.encounter_type, obs.value_coded, p.*')
|
243
|
+
|
244
|
+
#under_five
|
245
|
+
under_five = data.select{|record| calculate_age(record["birthdate"]) < 5}.\
|
246
|
+
collect{|record| record.person_id}
|
247
|
+
options["<5yrs"] = under_five
|
248
|
+
collection[key] = options
|
249
|
+
end
|
175
250
|
end
|
176
251
|
end
|
177
252
|
if request == nil
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: emr_ohsp_interface
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Manda and Petros Kayange
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-01-
|
11
|
+
date: 2022-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|