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
{{ message }}
Repository navigation
Find or create a report and its simulations by key without a run, for API v1's one-time migration #1166
API v1's one-time migration of saved reports to API v2 (PolicyEngine/policyengine-api#4359) creates each saved report's report in the simulation service without a run. App v3 starts a report's first run when someone opens it, through POST /reports/{report_id}/runs. The simulation service's POST /reports always finds or creates a run and starts its calculation, so the migration has no way to create a report alone.
What:
POST /reports/without-run (operation create_report_without_run, permission simulation:submit) takes POST /reports' body (economy, budget window or household). It reads the v2 version manifest and the catalog as POST /reports does, then finds or creates the report and its simulations by the same keys. It creates no run and starts no Modal call. It answers 201 with the report's ID, its type and its simulations' IDs (for a budget window, every year's). include_cliffs: true is refused with 422 cliffs_not_available.
In the persistence library, the find-or-create of each report kind is split into a report part and a run part, so both creates write the report and its simulations the same way.
POST /reports/{report_id}/runs answers 409 today for a budget window with no window run, because it reads a window's years from its newest window run. A keyed window with no window run instead gets its years from its first year and size, with each year's simulations found by key, so its first re-run is its first calculation.
The generated policyengine-api-simulation-client gains create_report_without_run and ReportWithoutRunCreated.
The route is temporary: it is to be removed once the migration's last run is done.
Activity