Skip to content

Start each side's cliff calculation when a report asks for cliffs #1098

Open

Description

@anth-volk

include_cliffs: true is refused today: POST /reports answers 422 cliffs_not_available, and so does a re-run of a report stored before keys whose inputs hold include_cliffs: true. That was C1 · 24's interim answer, while identical requests started sharing reports and simulation runs by key, so a cliff request could no longer change what a shared run calculates.

Cliffs are now a calculation of each simulation run of its own (C1 · 24's answer 4b). A run has one cliff result, its cliff gap and cliff share, in the Public API's new cliff_impacts table (PolicyEngine/policyengine-api#4327). The v2 simulation worker calculates it when its call's context names the row (#1096).

What's needed in the Simulation Entrypoint:

  • POST /reports (economy) and POST /reports/{report_id}/runs with include_cliffs: true start a cliff calculation for each side's simulation run that has none. They join one being calculated or already calculated, whether the report run was created or joined. Two identical requests start one calculation per run.
  • include_cliffs is never stored, never in a key, and never passed to the coordinator.
  • A report stored before keys that asked for cliffs is re-run with its runs' cliffs instead of a 422.
  • A budget window's or household report's re-run asking for cliffs is refused, since neither calculates them.
  • The create and re-run answers name each side's cliff calculation and its status.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions