Class: MalawiHivProgramReports::Clinic::TptOutcome

Inherits:
Object
  • Object
show all
Includes:
Pepfar::Utils, Utils::CommonSqlQueryUtils, Utils::ModelUtils
Defined in:
app/services/malawi_hiv_program_reports/clinic/tpt_outcome.rb

Constant Summary

Constants included from Pepfar::Utils

Pepfar::Utils::COHORT_REGIMENS, Pepfar::Utils::FULL_3HP_COURSE_DAYS, Pepfar::Utils::FULL_6H_COURSE_PILLS

Instance Method Summary collapse

Methods included from Pepfar::Utils

#drug_refills_and_external_consultation_list, #isoniazid_rifapentine_concept, #patient_completed_tpt?, #patient_on_3hp?, #pepfar_age_groups, #pepfar_patient_drilldown_information, #pepfar_patient_identifier_type, #rifapentine_concept

Methods included from Utils::ModelUtils

#concept, #concept_id_to_name, #concept_name, #concept_name_to_id, #drug, #encounter_type, #global_property, #order_type, #patient_identifier_type, #program, #report_type, #user_property

Methods included from Utils::CommonSqlQueryUtils

#current_occupation_query, #external_client_query, #occupation_filter, #partition_by_site, #process_occupation

Constructor Details

#initialize(start_date:, end_date:, **kwargs) ⇒ TptOutcome

Returns a new instance of TptOutcome.



15
16
17
18
19
20
# File 'app/services/malawi_hiv_program_reports/clinic/tpt_outcome.rb', line 15

def initialize(start_date:, end_date:, **kwargs)
  @start_date = start_date.to_date
  @end_date = end_date.to_date
  @tb_prev = Pepfar::TbPrev3.new(start_date: @start_date, end_date: @end_date)
  @occupation = kwargs[:occupation]
end

Instance Method Details

#find_reportObject



22
23
24
25
26
27
28
29
30
31
32
# File 'app/services/malawi_hiv_program_reports/clinic/tpt_outcome.rb', line 22

def find_report
  report = init_report
  @param = 'tpt_type'
  load_patients_into_report report, process_tpt_clients
  response = []
  report.each do |key, value|
    response << { age_group: key, tpt_type: '3HP', **value['3HP'] }
    response << { age_group: key, tpt_type: '6H', **value['6H'] }
  end
  response
end

#moh_report(report, clients, start_date, end_date) ⇒ Object



34
35
36
37
38
39
40
# File 'app/services/malawi_hiv_program_reports/clinic/tpt_outcome.rb', line 34

def moh_report(report, clients, start_date, end_date)
  @first_day_of_month = start_date.to_date
  @last_day_of_month = end_date.to_date
  tpt_clients = process_tpt_clients(clients)
  @param = 'gender'
  load_moh_patients_into_report report, tpt_clients
end