Class: MalawiHivProgramReports::Cohort::Tpt
- Inherits:
-
Object
- Object
- MalawiHivProgramReports::Cohort::Tpt
- Includes:
- Adapters::Moh::Custom, Utils::CommonSqlQueryUtils
- Defined in:
- app/services/malawi_hiv_program_reports/cohort/tpt.rb
Instance Method Summary collapse
-
#initialize(start_date:, end_date:, **kwargs) ⇒ Tpt
constructor
A new instance of Tpt.
-
#newly_initiated_on_3hp ⇒ Object
Patients (re-)initiated on 3HP in current reporting period.
-
#newly_initiated_on_ipt ⇒ Object
Patients (re-)initiated on IPT in current reporting period.
Methods included from 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:, **kwargs) ⇒ Tpt
Returns a new instance of Tpt.
11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/services/malawi_hiv_program_reports/cohort/tpt.rb', line 11 def initialize(start_date:, end_date:, **kwargs) @start_date = start_date @end_date = end_date @occupation = kwargs[:occupation] @location = kwargs[:location] @adapter = ActiveRecord::Base.connection.adapter_name.downcase return unless @occupation.present? process_occupation(start_date: @start_date, end_date: @end_date, occupation: @occupation, location: @location) end |
Instance Method Details
#newly_initiated_on_3hp ⇒ Object
Patients (re-)initiated on 3HP in current reporting period.
Candidates for this indicator are patients who either have had their first dispensation in the current reporting period or patients who have restarted 3HP in the current reporting period after breaking from the course for a period of at least 9 months (3 quarters).
31 32 33 34 35 36 |
# File 'app/services/malawi_hiv_program_reports/cohort/tpt.rb', line 31 def newly_initiated_on_3hp # newly_initiated_on_tpt(start_date, end_date).each_with_object([]) do |patient, patients| # patients << patient['patient_id'] unless patient_on_3hp?(patient) # end processed_tpt_clients.select { |patient| patient_on_3hp?(patient) } end |
#newly_initiated_on_ipt ⇒ Object
Patients (re-)initiated on IPT in current reporting period
Has a similar definition to 3HP, please refer to 3HP docs above.
43 44 45 46 47 48 |
# File 'app/services/malawi_hiv_program_reports/cohort/tpt.rb', line 43 def newly_initiated_on_ipt # newly_initiated_on_tpt(start_date, end_date).each_with_object([]) do |patient, patients| # patients << patient['patient_id'] if patient_on_3hp?(patient) # end processed_tpt_clients.reject { |patient| patient_on_3hp?(patient) } end |