Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetch egrid and avert variables in calculate route #90

Open
4 tasks
ryanhu021 opened this issue Feb 27, 2025 · 1 comment
Open
4 tasks

Fetch egrid and avert variables in calculate route #90

ryanhu021 opened this issue Feb 27, 2025 · 1 comment
Assignees
Labels
backend Backend scope ready Ready for sprint

Comments

@ryanhu021
Copy link
Collaborator

ryanhu021 commented Feb 27, 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 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

@ryanhu021 ryanhu021 changed the title Add db fetching to formula parser Fetch egrid and avert variables in calculate route Mar 4, 2025
@ryanchansf ryanchansf added ready Ready for sprint backend Backend scope labels Mar 6, 2025
@ryanhu021
Copy link
Collaborator Author

ryanhu021 commented Mar 6, 2025

Keep in mind EgridLocation and AvertLocation will be separate enums once #69 gets merged - need to figure out how this will work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Backend scope ready Ready for sprint
Projects
None yet
Development

No branches or pull requests

3 participants