Skip to content

Conversation

@Bill-Becker
Copy link
Collaborator

@Bill-Becker Bill-Becker commented Dec 24, 2025

PR:

Plus this commit for fixes found during web dev testing:

And this commit after realizing I missed another optional input for cooling load and that we don't have to map/handle each parameter of the POST request body to the inputs dictionary - we can just parse and pass the .json body directly to the inputs dictionary (which is the convenience of this POST structure for this endpoint):

Finally (final final) last commit directly made to develop: update the way the API internally calls the Julia API for the /simulated_load endpoint to be a POST for best-practice with potentially larger payloads (e.g. with a load_profile)

@Bill-Becker Bill-Becker requested a review from adfarth December 24, 2025 17:56
The beauty of the POST is that we can effectively pass the .json straight to the function as a dictionary with minimal data processing.

This preserves all intentionally inputs validation/checking that was there before.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the /simulated_load endpoint to improve POST request handling by making load_type and year optional inputs where appropriate, fixing latitude/longitude pass-through for POST requests with doe_reference_name, and simplifying the input handling by directly parsing the JSON body into the inputs dictionary.

Key changes:

  • Makes load_type optional for both GET and POST requests with default value of "electric"
  • Makes year optional for POST requests with doe_reference_name (consistent with GET behavior)
  • Simplifies POST request handling by directly parsing JSON body into inputs dictionary instead of manually mapping each field

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
reoptjl/views.py Updated GET request to conditionally add load_type if present; refactored POST request handling to directly parse JSON body and simplified validation logic for required fields
reoptjl/test/test_http_endpoints.py Added comprehensive test suite with 8 test cases covering various POST request scenarios including validation, normalization, reference names, and hybrid buildings
CHANGELOG.md Documents the changes made in v3.17.5 including the optional parameters and lat/long pass-through fix

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…GET to POST due to potential payload size

Even though the GET method works, for large payloads in particular, this should be a POST.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants