You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
Before being able to evaluate or construct any formulas in our /calculate API route, we must fetch the corresponding eGRID and AVERT variables from MongoDB. We can do this by calling the getEgridRecordByKey() and getAvertRecordByKey() functions. Once both records are fetched, we should add all variables in the to the FormulaParser by calling
Acceptance Criteria
The /calculate route is extended to retrieve eGRID and AVERT records based on the input parameters. Variables are added to the FormulaParser in preparation for adding formulas.
Steps:
Modify /api/calculate POST route to do query MongoDB
Call getEgridRecordByKey() with the appropriate year and location parameters from the inputData
Call getAvertRecordByKey() with the appropriate year, location, and powerPlantClass from the inputData
Add the variables in the resulting records to the FormulaParser using addVariable()
Additional Information
The text was updated successfully, but these errors were encountered:
ryanhu021
changed the title
Add db fetching to formula parser
Fetch egrid and avert variables in calculate route
Mar 4, 2025
Description
Before being able to evaluate or construct any formulas in our
/calculate
API route, we must fetch the corresponding eGRID and AVERT variables from MongoDB. We can do this by calling thegetEgridRecordByKey()
andgetAvertRecordByKey()
functions. Once both records are fetched, we should add all variables in the to theFormulaParser
by callingAcceptance Criteria
The
/calculate
route is extended to retrieve eGRID and AVERT records based on the input parameters. Variables are added to the FormulaParser in preparation for adding formulas.Steps:
/api/calculate
POST route to do query MongoDBgetEgridRecordByKey()
with the appropriateyear
andlocation
parameters from theinputData
getAvertRecordByKey()
with the appropriateyear
,location
, andpowerPlantClass
from theinputData
FormulaParser
usingaddVariable()
Additional Information
The text was updated successfully, but these errors were encountered: