From e196961132a5ba03b084a168453642129f0dc565 Mon Sep 17 00:00:00 2001 From: chen Date: Thu, 8 Mar 2018 14:57:31 -0500 Subject: [PATCH 1/2] Add item list in right order, to Scenario's return, for both IS and BS --- bpfin/financials/financial_lib.py | 19 +++++++++++++++++++ bpfin/financials/scenario.py | 14 +++++++------- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/bpfin/financials/financial_lib.py b/bpfin/financials/financial_lib.py index 236fa0f..67d662d 100644 --- a/bpfin/financials/financial_lib.py +++ b/bpfin/financials/financial_lib.py @@ -63,6 +63,25 @@ def organize_bill_overview(bill_overview, analysis_date): } return bill_overview_organized +IS_Item_List = [ + 'year', + 'revenue', + 'utility_expense', + 'energy_opex', + 'electricity_opex', + 'gas_opex', + 'oil_opex', + 'water_opex', + 'other_utility', + 'non_utility_expense', + 'net_non_energy_opex', + 'total_opex', + 'noi', +] + +BS_Item_List = [ + 'Balance', +] # class Income_Statement(): # def __init__(self): diff --git a/bpfin/financials/scenario.py b/bpfin/financials/scenario.py index ecc7f57..05ffdc1 100644 --- a/bpfin/financials/scenario.py +++ b/bpfin/financials/scenario.py @@ -4,7 +4,7 @@ from bpfin.financials.loan import Loan_List from bpfin.lib.other import add_year_dictionary, divide_dscr_dict, min_none_list from bpfin.utilbills.bill_lib import form_bill_year, annualizing_projection from bpfin.lib.other import UTILITY_TYPE_LIST, set_dict_starting_year - +from bpfin.financials.financial_lib import IS_Item_List, BS_Item_List class Scenario(): """ @@ -287,7 +287,7 @@ class Scenario(): economics_overview['min_cash_dscr'] = min_none_list(dscr_dict['cash_dscr'].values()) return economics_overview - def get_statement(self, full_statement): + def get_statement(self, full_statement, item_list): """This will get the income OR balance sheet statement in the required format.""" result = [] row = [] @@ -298,7 +298,7 @@ class Scenario(): analysis_year = result[0][1] - for field in full_statement[analysis_year]: + for field in item_list: if field.lower() != 'year': row = [] row.append(field) @@ -311,20 +311,20 @@ class Scenario(): def get_prior_income_statement(self): """Fetch full income statement table prior to retrofit.""" prior_full_income_statement = self.prior_income_statement_table.get_full_income_table() - return self.get_statement(prior_full_income_statement) + return self.get_statement(prior_full_income_statement, IS_Item_List) def get_post_income_statement(self): """Fetch full income statement table post to retrofit.""" post_full_income_statement = self.post_income_statement_table.get_full_income_table() - return self.get_statement(post_full_income_statement) + return self.get_statement(post_full_income_statement, IS_Item_List) def get_prior_balance_sheet_statement(self): prior_full_balance_statement = self.prior_balance_sheet_table.get_cash_dict() - return self.get_statement(prior_full_balance_statement) + return self.get_statement(prior_full_balance_statement, BS_Item_List) def get_post_balance_sheet_statement(self): post_full_balance_statement = self.post_balance_sheet_table.get_cash_dict() - return self.get_statement(post_full_balance_statement) + return self.get_statement(post_full_balance_statement, BS_Item_List) def get_financing_plan(self): """ -- GitLab From f609176aff28cd844d93627e84e89142f8ac3f99 Mon Sep 17 00:00:00 2001 From: chen Date: Thu, 8 Mar 2018 15:04:34 -0500 Subject: [PATCH 2/2] update version to 0.2.1 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index c809882..06f19b4 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ reqs = [str(req.req) for req in install_reqs] setup( name='bpfin', - version='0.2.0', + version='0.2.1', description='Finance models and utilites', author='BlocPower', author_email='admin@blocpower.org', -- GitLab