Class: MalawiHivProgramReports::Pepfar::TptStatus

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
app/services/malawi_hiv_program_reports/pepfar/tpt_status.rb

Overview

This class is used to generate the TPT Status report for an ART patient

Constant Summary

Constants included from Utils

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from 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

Constructor Details

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

Returns a new instance of TptStatus.



11
12
13
14
15
16
# File 'app/services/malawi_hiv_program_reports/pepfar/tpt_status.rb', line 11

def initialize(start_date:, end_date:, **kwargs)
  @start_date = start_date
  @end_date = end_date
  @patient_id = kwargs[:patient_id]
  @tpt_status = {}
end

Instance Attribute Details

#end_dateObject (readonly)

Returns the value of attribute end_date.



7
8
9
# File 'app/services/malawi_hiv_program_reports/pepfar/tpt_status.rb', line 7

def end_date
  @end_date
end

#patient_idObject (readonly)

Returns the value of attribute patient_id.



7
8
9
# File 'app/services/malawi_hiv_program_reports/pepfar/tpt_status.rb', line 7

def patient_id
  @patient_id
end

#start_dateObject (readonly)

Returns the value of attribute start_date.



7
8
9
# File 'app/services/malawi_hiv_program_reports/pepfar/tpt_status.rb', line 7

def start_date
  @start_date
end

Instance Method Details

#find_reportObject



18
19
20
21
22
23
24
# File 'app/services/malawi_hiv_program_reports/pepfar/tpt_status.rb', line 18

def find_report
  patient_tpt_status
rescue StandardError => e
  Rails.logger.error("Error generating TPT Status report for patient #{patient_id}: #{e.message}")
  Rails.logger.error(e.backtrace.join("\n"))
  raise e
end