Skip to main content

Components Details

Bill Generation System - Component

Overview

1. BaseBillCreationClass

Role: Acts as the central point to initiate the bill generation process. It orchestrates the flow of data through various components.

Data Dependencies:

  • Initial Input:
    • Configuration JSON
    • Bill Run ID
    • Authentication Token
    • Schedule Start Date - Schedule End Date
    • Consumer Details

Dependent Components:

  • UtilityDetailComponent
  • ConsumerDetailComponent
  • PlanDetailComponent
  • RateDetailComponent
  • MeterDetailComponent
  • MeterReadingComponent
  • PaymentsDetailComponent
  • OutstandingDetailComponent

Output:

  • bill_json_data: Final output after aggregating and combining data from all components.

2. Component Manager (UtilityDetailComponent)

Role: Fetches utility-specific data such as name, tax information, and rate types.

Data Dependencies:

  • Input Data:
    • Authentication Token
    • Consumer ID
    • Utility ID

Dependent Components:

  • ConsumerDetailComponent
  • PlanDetailComponent
  • RateDetailComponent
  • MeterDetailComponent
  • MeterReadingComponent
  • PaymentsDetailComponent
  • OutstandingDetailComponent

Output:

  • calculation_specific_data: Utility-related data like the name, service type, and rate structure.
  • bill_json_data: Utility details included in the final aggregated bill.

3. ConsumerDetailComponent

Role: Fetches consumer-specific details such as consumer ID, plan ID, activation date, and meter IDs.

Data Dependencies:

  • Input Data:
    • Consumer ID
    • Utility ID (from UtilityDetailComponent)

Dependent Components:

  • PlanDetailComponent
  • MeterReadingComponent
  • OutstandingDetailComponent

Output:

  • calculation_specific_data: Consumer details like ID, meter information, activation status, and outstanding balance.
  • bill_json_data: Consumer-specific metadata for the bill, including ID and activation details.

4. PlanDetailComponent

Role:

  • Handles and fetches rate plans and billing frequencies associated with the consumer.
  • Calls the get_plan_data method, which interacts with an external API from the onboarding service.

Data Dependencies:

  • Input Data:
    • Plan ID (from ConsumerDetailComponent)

Dependent Components:

  • RateDetailComponent
  • CalculationDetailComponent

Output:

  • calculation_specific_data: Rate details, tax configurations, and billing frequency.
  • bill_json_data: Plan data included in the final bill.

5. RateDetailComponent

Role: Processes rate configurations specific to utilities such as fixed, variable, tiered, and time-of-use (TOU) rates.

Data Dependencies:

  • Input Data:
    • Rate ID (from PlanDetailComponent)

Dependent Components:

  • ConsumptionDetailComponent
  • CalculationDetailComponent

Output:

  • calculation_specific_data: Rate-related data for different services like electricity, water, etc.
  • bill_json_data: Rates and service charges in the final bill.

6. BillDetailComponent

Role:

  • Processes bill configurations, calculates due dates, and fetches historical bill data.
  • get_rate_data : Calls an external API to fetch rate data based on the provided rate IDs.

Data Dependencies:

  • Input Data:
    • Consumer Object
    • Utility Object
    • Plan Object
    • Authentication Token
    • Schedule Start/End Date

Dependent Components:

  • PlanDetailComponent
  • CalculationDetailComponent
  • ConsumptionDetailComponent

Output:

  • calculation_specific_data: Previous bill details, due dates, and outstanding amounts.
  • bill_json_data: Finalized bill details, including invoice period and payment due dates.

7. MeterDetailComponent

Role: Fetches and manages meter-related data like meter IDs, types, and device details.

Data Dependencies:

  • Input Data:
    • Meter ID (from ConsumerDetailComponent)

Dependent Components:

  • MeterReadingComponent
  • ConsumptionDetailComponent

Output:

  • calculation_specific_data: Meter-related data.
  • bill_json_data: Meter details included in the final bill.

8. MeterReadingComponent

Role: Fetches current and previous meter readings.

Data Dependencies:

Input Data:

  • Meter IDs (from ConsumerDetailComponent)
  • Basis_type (from RateDetailComponent)
  • Is_first_bill (from BillDetailComponent)

Dependent Components:

  • ConsumptionDetailComponent

Output:

  • calculation_specific_component: Meter readings.
  • bill_json_data: Meter reading details in the final bill.

9. ConsumptionDetailComponent

Role: Calculates total consumption based on meter readings and applicable rates.

Data Dependencies:

  • Input Data:
    • Meter readings (from MeterReadingComponent)
    • Rate configurations (from RateDetailComponent)

Dependent Components:

  • CalculationDetailComponent

Output:

  • calculation_specific_component: Total consumption.
  • bill_json_data: Consumption data in the final bill.

10. PaymentsDetailComponent

Role: Manages payment history and reconciles payments.

Data Dependencies:

Input Data:

  • Last bill due date (from BillDetailComponent)
  • Consumer ID (from ConsumerDetailComponent)

Dependent Components:

  • OutstandingDetailComponent

Output:

  • calculation_specific_component: Payment history and total payment received.
  • bill_json_data: Payment details in the final bill.

11. OutstandingDetailComponent

Role: Calculates outstanding balances.

Data Dependencies:

  • Input Data:
    • Total payment received (from PaymentsDetailComponent)
    • Last bill outstanding amount (from BillDetailComponent)

Dependent Components:

  • CalculationDetailComponent

Output:

  • calculation_specific_component: Outstanding balance and due date.
  • bill_json_data: Outstanding amounts in the final bill.

12. CalculationDetailComponent

Role: Aggregates data from all components and performs final calculations.

Data Dependencies:

  • Input Data:
    • Plan details
    • Rates
    • Consumption
    • Payments
    • Outstanding balances

Output:

  • calculation_specific_component: Final charges, taxes, and outstanding balances.
  • bill_json_data: Comprehensive bill data ready for consumer view.