blockchain-carbon-accounting icon indicating copy to clipboard operation
blockchain-carbon-accounting copied to clipboard

refactor chain code to work with new emissions type

Open sichen1234 opened this issue 4 years ago • 5 comments

Add new field for Emissions Type (UTILITY_EMISSIONS_ELECTRICITY, TRAVEL_CAR, TRAVEL_AIR) so that we can distinguish between different types of emissions for Scope 3 emissions calculation

Modify the data loading script, the recordEmissions chain code, and the tests to add support for this type field with UTILITY_EMISSIONS_ELECTRICITY. Current chain code for getEmissionsRecord should stay the same with UUID.

sichen1234 avatar Oct 14 '21 03:10 sichen1234

I think we can work with the flat file from https://www.gov.uk/government/publications/greenhouse-gas-reporting-conversion-factors-2019

We currently store the utility emissions factors from eGRID and EIA with country and state. Following the format of this spreadsheet, we can refactor the UtilityEmissionsFactorInterface in utilityEmissionsFactor.ts to have the following fields: Year Scope = "Scope 2" Level 1 = "Utility Emissions Factor" Level 2 = the current Country (ie USA) Level 3 = the current Division Type and ID, combining the two. So it could be "NERC_REGION: WECC" or "STATE: CA" Text = text field. Can be "Utility Emissions Factor" for utility emissions or the Text field from the UK file. Factor_uom = "MWH" co2_equivalent_emissions = same as now co2_equivalent_emissions_uom = same as now Source = This should be changed to a field in the loader, so we can enter "eGRID ... from ...." as needed.

sichen1234 avatar Nov 18 '21 00:11 sichen1234

Instead of changing the fabric emissions factors entities, create a new OrbitDB database.

Modify the egrid data loader to load the data into OrbitDB using this new format. Instead of using invokeChainCode, create a new function to record Emission factors on OrbitDB.

Modify the record emissions chain code to get the emissions factors from orbitdb using this new format.

sichen1234 avatar Jan 17 '22 17:01 sichen1234

Modify the test to use the existing OrbitDB database. You would not have to re-load it every time you run the tests.

sichen1234 avatar Jan 17 '22 17:01 sichen1234

@sichen1234 You mentioned

Level 1 = "Utility Emissions Factor" Level 2 = the current Country (ie USA) Level 3 = the current Division Type and ID, combining the two. So it could be "NERC_REGION: WECC" or "STATE: CA"

Could you just clarify if these "level-" fields are a replacement for our current 'division_type', 'division_id' and 'division_name' fields or not?

hs2361 avatar Feb 07 '22 07:02 hs2361

Yes, they do replace those fields. Also feel free to add some Level fields if the spreadsheet has them.

sichen1234 avatar Feb 07 '22 16:02 sichen1234