Skip to content
This repository was archived by the owner on Jul 6, 2026. It is now read-only.

Add search param to run API v1#2603

Merged
nikhilwoodruff merged 1 commit into
masterfrom
feat/api-v1-url-param
Jun 10, 2025
Merged

Add search param to run API v1#2603
nikhilwoodruff merged 1 commit into
masterfrom
feat/api-v1-url-param

Conversation

@anth-volk

Copy link
Copy Markdown
Collaborator

Description

Fixes #2602.
Requires PolicyEngine/policyengine-api#2558.

Changes

This PR adds a temporary search param, run_api_v2, which activates the use of API v1. This should be removed once we are confident with the new simulation API's results.

Screenshots

N/A

Tests

None have been added.

Copilot AI review requested due to automatic review settings June 9, 2025 23:43
@vercel

vercel Bot commented Jun 9, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
policyengine-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 9, 2025 11:43pm

@mikesmit mikesmit left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We'll need to manually integration test this after deploy. LGTM.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 adds a temporary run_api_v1 search parameter to toggle use of API v1 in simulation URL builders.

  • Introduces a run_api_v1 flag from URL search params in impact and cliff-impact components
  • Appends &run_api_v1=true to simulation request URLs when the flag is set
  • No automated tests have been added for the new behavior
Comments suppressed due to low confidence (3)

src/pages/policy/output/FetchAndDisplayImpact.jsx:43

  • [nitpick] The variable name run_api_v1 uses snake_case while the codebase uses camelCase. Consider renaming it to runApiV1 for consistency.
const run_api_v1 = searchParams.get("run_api_v1") === "true";

src/pages/policy/output/FetchAndDisplayImpact.jsx:43

  • [nitpick] Add a // TODO: remove this flag once v2 API is validated comment here to indicate the temporary nature of the run_api_v1 parameter.
const run_api_v1 = searchParams.get("run_api_v1") === "true";

src/pages/policy/output/FetchAndDisplayImpact.jsx:112

  • There are no tests covering the new run_api_v1 URL parameter. Add unit or integration tests to verify that the query string is built correctly when this flag is toggled.
`&version=${version}${maxHouseholdInput}${datasetInput}${runApiV1Input}`;

? `&max_households=${maxHouseholds}`
: "";

const runApiV1Input = run_api_v1 ? `&run_api_v1=${run_api_v1}` : "";

Copilot AI Jun 9, 2025

Copy link

Choose a reason for hiding this comment

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

[nitpick] The conditional string-building logic for run_api_v1 is duplicated in multiple places. Consider extracting to a helper function or constant to reduce repetition.

Suggested change
const runApiV1Input = run_api_v1 ? `&run_api_v1=${run_api_v1}` : "";
const runApiV1Input = getRunApiV1Input(run_api_v1);

Copilot uses AI. Check for mistakes.
@nikhilwoodruff nikhilwoodruff merged commit 576cc66 into master Jun 10, 2025
4 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in policyengine-app Jun 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Create search parameter to run impacts over API v1

4 participants