def get_standards_chart_data(config): data = g.uow.compiled_point_records.get_compiled_point_data(config.point_ids, config.report_year, 'temp', 'all') standards_chart_info = ReportChartInformation() standards_chart_info.title = "Intensity" standards_chart_info.y_axis_label = "Energy Intensity (BTU/sqft)" standards_chart_info.x_axis_label = "Temperature (F)" standards_chart_info.data = data return standards_chart_info
def get_intensity_chart_data(sic_codes, account_type, report_year, comparison_type, demand_type, g): # Set the x units for the intensity chart on the consumption report x_units = "F" x_axis_label = "Temperature (" + x_units + ")" if comparison_type == "enthalpy": x_axis_label = "Enthalpy" final_data = [] # get all accounts for sic code and it's descendants for nc in sic_codes: data_insert = [] accounts = [] sic_code = g.uow.sic.get_by_code(nc) group_descendants = g.uow.sic.get_group_descendants(nc) for desc in group_descendants: accounts += SharedReporting.get_accounts_for_group(desc, account_type, report_year, comparison_type, demand_type, g) consider_demand_type = False if demand_type != 'all': consider_demand_type = True if len(accounts) > 0: # get data for the consumption report intensity_data = g.uow.compiled_energy_records.get_compiled_energy_records_for_report(accounts, consider_demand_type=consider_demand_type) else: intensity_data = [] # loop through and adjust the values based on size normalization for entry in intensity_data: data_insert.append([entry['group']['value'], entry['reduction']['sum_btu'] / entry['reduction']['sum_size_normalization']]) # add to the final data final_data.append({"name": sic_code["name"], "data": data_insert}) # set the metadata for the consumption report intensity_chart_info = ReportChartInformation() intensity_chart_info.title = "Intensity" intensity_chart_info.y_axis_label = "Energy Intensity (BTU/sqft)" intensity_chart_info.x_axis_label = x_axis_label intensity_chart_info.data = final_data return intensity_chart_info