massenergize / api

Backend Code for Massenergize Portal. This provides the API to the backend database, and is shared by the various front-end portal projects.
MIT License
4 stars 8 forks source link

Carbon Calculator - implement different carbon values by location #960

Open BradHN1 opened 2 months ago

BradHN1 commented 2 months ago

User Story. As a Community Admin or User I want the carbon savings to reflect where actions are taken (if appropriate) So that they will be more accurate

Additional details/context We are now working with a large community in Vermont, but our carbon calculations are all done for Massachusetts. Even within Massachusetts there are communities with MLPs or CCA where the average carbon values can be quite different. The carbon calculator envisioned this by having locality dependent values, but this functionality has not yet been used.

The Carbon Calculator method AverageImpact()) is used to determine carbon values based on date, and has an optional Locality which hasn't been used so gets the value "default". My plan is to pass in the Location json from the real estate unit where an action is taken. AverageImpact will use that to determine whether there is specific value for that community, or for that county, or for that state, in that order. If not the default value will be used.

To be implemented behind a feature flag so only will take effect for certain communities, until ready to be more generally released.

Value added. What do you think the value of adding this feature is? Help managers and developers know how this should be prioritized.

Acceptance criteria. The conditions that must be met for this to be done. For example, for a login feature: User is securely and reliably logged in until timeout or manual sign-out.

BradHN1 commented 1 month ago

Carbon calculator default values are in general for a "default" location, but can be defined for a city or town (for example "Concord-MA"), or for a county (for example "Addison County-VT") or for a state (for example "VT"). For a community or real estate unit with a location, we search for default values in this order, first for the town, then for the county, then for the state, and finally use the default value.