malawi_hiv_program_reports 1.0.19 → 1.0.20

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f86826f15ceb3f763a71ac85b14142481eb6177dea5e77d63b789c1f76955dfd
4
- data.tar.gz: ae2542a2e7bc462c5fca169abb73503dfac6f4074eedd6c837a38ff7dbbf6a27
3
+ metadata.gz: 20d2d8f58b51e76a9e2338c73f4649128827925aaea7bed0bf5c072fe047877a
4
+ data.tar.gz: 190ec9f058e23928a2295663cdea975eaf0a819860382728539bdb9d80b69895
5
5
  SHA512:
6
- metadata.gz: 2726026897b6c08fdfea543e57b82396897e2400849b39615135dff0b1a1caab8113c910cc1cdb98042ff2211a548c541d8e3c56b68157ca165142659830e4bb
7
- data.tar.gz: 164b30ad7ca003e832cf4a31ba222c92cee0d04fd0f3aa9875a45ef879d8f33b4dca863ac6afdb60de0f6cfe54a18e799e036d249df9f6ed7be30fb7d6d310c4
6
+ metadata.gz: e615fa021b3a87a7c40832513d64f9746ef35eaeb49ff60cb7c5ad4ffdd3d3f27f8672e86bc1fae3a5a7c2903f4faf49e1cbf7d912457d56a1358c6803fb6378
7
+ data.tar.gz: cb09473dc350e4afaafecda703f65958823a3ff91c06c0538bfb1dfbb6f955b873473d568e9cb3c2a56d09105cb008610224e9ae474b259f187b164952c60f01
@@ -50,8 +50,8 @@ module MalawiHivProgramReports
50
50
  disaggregated_age_group(p.birthdate, DATE('#{@end_date}')) age_group,
51
51
  p.patient_id, p.date_enrolled, p.birthdate, p.gender,
52
52
  outcome.cum_outcome AS outcome
53
- FROM temp_earliest_start_date p
54
- LEFT JOIN temp_patient_outcomes outcome USING(patient_id)
53
+ FROM cdr_temp_cohort_members #{current_partition} p
54
+ LEFT JOIN cdr_temp_patient_outcomes #{current_partition} outcome USING(patient_id)
55
55
  WHERE DATE(date_enrolled) <= DATE('#{@end_date}')
56
56
  AND cum_outcome = 'On antiretrovirals'
57
57
  #{@format == 'poc' ? "AND TIMESTAMPDIFF(year, p.birthdate, DATE('#{@end_date}')) BETWEEN #{@min_age} AND #{@max_age}" : ''};
@@ -127,26 +127,20 @@ module MalawiHivProgramReports
127
127
  o.patient_id, p.gender, p.birthdate, o.start_date,
128
128
  o.auto_expire_date, d.name, quantity, d.drug_id,
129
129
  TIMESTAMPDIFF(day, DATE(o.start_date), DATE(o.auto_expire_date)) prescribed_days
130
- FROM orders o
131
- INNER JOIN drug_order od ON od.order_id = o.order_id
132
- #{site_manager(operator: 'AND', column: 'od.site_id', location: @location)}
130
+ FROM orders #{current_partition} o
131
+ INNER JOIN drug_order #{current_partition} od ON od.order_id = o.order_id
133
132
  INNER JOIN drug d ON d.drug_id = od.drug_inventory_id
134
133
  INNER JOIN concept_set s ON s.concept_id = d.concept_id
135
- INNER JOIN person p ON p.person_id = o.patient_id
136
- #{site_manager(operator: 'AND', column: 'p.site_id', location: @location)}
137
- INNER JOIN encounter e ON e.patient_id = p.person_id
138
- #{site_manager(operator: 'AND', column: 'e.site_id', location: @location)}
134
+ INNER JOIN person #{current_partition} p ON p.person_id = o.patient_id
135
+ INNER JOIN encounter #{current_partition} e ON e.patient_id = p.person_id
139
136
  WHERE s.concept_set = #{arv_concept_set} AND o.voided = 0
140
- #{site_manager(operator: 'AND', column: 'o.site_id', location: @location)}
141
137
  AND DATE(o.start_date) = (
142
- SELECT DATE(MAX(t.start_date)) FROM orders t
143
- INNER JOIN drug_order t2 ON t2.order_id = t.order_id
144
- #{site_manager(operator: 'AND', column: 't2.site_id', location: @location)}
138
+ SELECT DATE(MAX(t.start_date)) FROM orders #{current_partition} t
139
+ INNER JOIN drug_order #{current_partition} t2 ON t2.order_id = t.order_id
145
140
  INNER JOIN drug t3 ON t3.drug_id = t2.drug_inventory_id
146
141
  INNER JOIN concept_set t4 ON t4.concept_id = t3.concept_id
147
142
  WHERE t.patient_id = #{patient_id}
148
143
  AND t.voided = 0 AND t.start_date <= '#{@end_date}'
149
- #{site_manager(operator: 'AND', column: 't.site_id', location: @location)}
150
144
  AND t4.concept_set = #{arv_concept_set} AND t2.quantity > 0
151
145
  ) AND e.program_id = #{program_id} AND o.patient_id = #{patient_id}
152
146
  AND od.quantity > 0 AND e.encounter_type = #{encounter_type}
@@ -219,7 +213,6 @@ module MalawiHivProgramReports
219
213
  concept_id = ::ConceptName.find_by_name('Weight (Kg)').concept_id
220
214
  weight_details = ::Observation.where("person_id = ? AND concept_id = ?
221
215
  AND obs_datetime <= ?
222
- #{site_manager(operator: 'AND', column: 'site_id', location: @location)}
223
216
  AND ( CAST(value_numeric as DECIMAL(4,1)) > 0 OR
224
217
  CAST(value_text as DECIMAL(4,1)) > 0)", patient_id,
225
218
  concept_id, @end_date).order('obs_datetime DESC, date_created DESC')
@@ -255,30 +248,24 @@ module MalawiHivProgramReports
255
248
  o.patient_id, p.gender, p.birthdate, o.start_date,
256
249
  o.auto_expire_date, d.name, quantity, d.drug_id, identifier arv_number,
257
250
  TIMESTAMPDIFF(day, DATE(o.start_date), DATE(o.auto_expire_date)) prescribed_days
258
- FROM orders o
259
- INNER JOIN drug_order od ON od.order_id = o.order_id
260
- #{site_manager(operator: 'AND', column: 'od.site_id', location: @location)}
251
+ FROM orders #{current_partition} o
252
+ INNER JOIN drug_order #{current_partition} od ON od.order_id = o.order_id
261
253
  INNER JOIN drug d ON d.drug_id = od.drug_inventory_id
262
254
  INNER JOIN concept_set s ON s.concept_id = d.concept_id
263
- INNER JOIN person p ON p.person_id = o.patient_id
264
- #{site_manager(operator: 'AND', column: 'p.site_id', location: @location)}
265
- INNER JOIN encounter e ON e.patient_id = p.person_id
266
- #{site_manager(operator: 'AND', column: 'e.site_id', location: @location)}
255
+ INNER JOIN person #{current_partition} p ON p.person_id = o.patient_id
256
+ INNER JOIN encounter #{current_partition} e ON e.patient_id = p.person_id
267
257
  AND e.program_id = #{program_id}
268
- LEFT JOIN patient_identifier i ON i.patient_id = o.patient_id
258
+ LEFT JOIN patient_identifier #{current_partition} i ON i.patient_id = o.patient_id
269
259
  AND i.identifier_type = #{identifier_type}
270
260
  AND LENGTH(identifier) > 0 AND i.voided = 0
271
261
  WHERE s.concept_set = #{arv_concept_set} AND o.voided = 0
272
- #{site_manager(operator: 'AND', column: 'o.site_id', location: @location)}
273
262
  AND DATE(o.start_date) = (
274
263
  SELECT DATE(MAX(t.start_date)) FROM orders t
275
- INNER JOIN drug_order t2 ON t2.order_id = t.order_id
276
- #{site_manager(operator: 'AND', column: 't2.site_id', location: @location)}
264
+ INNER JOIN drug_order #{current_partition} t2 ON t2.order_id = t.order_id
277
265
  INNER JOIN drug t3 ON t3.drug_id = t2.drug_inventory_id
278
266
  INNER JOIN concept_set t4 ON t4.concept_id = t3.concept_id
279
267
  WHERE t.patient_id = #{patient_id}
280
268
  AND t.voided = 0 AND t.start_date <= '#{@end_date}'
281
- #{site_manager(operator: 'AND', column: 't.site_id', location: @location)}
282
269
  AND t4.concept_set = #{arv_concept_set} AND t2.quantity > 0
283
270
  )AND e.program_id = #{program_id} AND o.patient_id = #{patient_id}
284
271
  AND od.quantity > 0 GROUP BY o.order_id;
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MalawiHivProgramReports
4
- VERSION = '1.0.19'
4
+ VERSION = '1.0.20'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: malawi_hiv_program_reports
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.19
4
+ version: 1.0.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roy Chanunkha
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-25 00:00:00.000000000 Z
11
+ date: 2024-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails