Class: MalawiHivProgramReports::ArvRefillPeriods

Inherits:
Object
  • Object
show all
Includes:
MalawiHivProgramReports::Adapters::Moh::Custom, Pepfar::Utils, Utils, Utils::CommonSqlQueryUtils, Utils::ModelUtils
Defined in:
app/services/malawi_hiv_program_reports/arv_refill_periods.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?, #patient_on_tb_treatment?, #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 MalawiHivProgramReports::Adapters::Moh::Custom

#cast_manager, #current_partition, #exe_create_drill_down_table, #exe_temp_cohort_members_table, #exe_temp_order_details_table, #exe_temp_other_patient_types, #exe_temp_register_start_date_table, #exe_tmp_patient_table, #function_manager, #group_by_columns, #in_manager, #interval_manager, #min_filt, #site_manager, #timestampdiff_manager

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:, min_age:, max_age:, org:, initialize_tables:, **kwargs) ⇒ ArvRefillPeriods

Returns a new instance of ArvRefillPeriods.



12
13
14
15
16
17
18
19
20
21
22
# File 'app/services/malawi_hiv_program_reports/arv_refill_periods.rb', line 12

def initialize(start_date:, end_date:, min_age:, max_age:, org:, initialize_tables:, **kwargs)
  @start_date = start_date.to_date.strftime('%Y-%m-%d 00:00:00')
  @end_date = end_date.to_date.strftime('%Y-%m-%d 23:59:59')
  @min_age = min_age
  @max_age = max_age
  @org = org
  @initialize_tables = (initialize_tables.to_s == "true")
  @occupation = kwargs[:occupation]
  @location = kwargs[:location]
  @format = kwargs[:format] || 'poc'
end

Instance Method Details

#arv_refill_periodsObject



28
29
30
# File 'app/services/malawi_hiv_program_reports/arv_refill_periods.rb', line 28

def arv_refill_periods
  break_down
end

#find_reportObject



24
25
26
# File 'app/services/malawi_hiv_program_reports/arv_refill_periods.rb', line 24

def find_report
  arv_refill_periods
end

#init_reportObject



62
63
64
65
66
67
68
69
70
71
72
# File 'app/services/malawi_hiv_program_reports/arv_refill_periods.rb', line 62

def init_report
  pepfar_age_groups.each_with_object({}) do |age_group, report|
    report[age_group] = ['M', 'F'].each_with_object({}) do |gender, age_group_report|
      age_group_report[gender] = {
        less_than_3months: [],
        three_to_five_months: [],
        greater_than_six_months: []
      }
    end
  end
end

#tx_mmd_client_level_data(patient_ids) ⇒ Object



32
33
34
# File 'app/services/malawi_hiv_program_reports/arv_refill_periods.rb', line 32

def tx_mmd_client_level_data(patient_ids)
  client_level_data(patient_ids)
end