Skip to content

Household calculations accept a list of variables to calculate #4382

In review

Description

@anth-volk

API v1's POST /v2/household-calculations has no way to ask for only some variables: a caller either sets add_missing_variables: true, which adds and calculates every variable the household lacks, or gets only the values the household leaves empty. App v3's Household tab reads about 330 variables, and calculating every variable made one household calculation take 100–154 seconds where the listed variables take 4–20 seconds in local measurements.

The simulation service now takes a variables list on its POST /household-calculations (PolicyEngine/policyengine-sim-api#1177).

What is needed

  • POST /v2/household-calculations accepts variables, an optional list of at most 10,000 distinct variable names of 1 to 255 characters, for a stored household and for one given in the request.
  • API v1 checks each name against its running catalog version (the catalog of the .py version it runs, as policy parameters are checked) and refuses unknown names with a 422 naming them, before anything is sent. Nothing is checked when that version has no published catalog for the country.
  • A list given with add_missing_variables: true is refused with a 422.
  • The list is sent to the simulation service only when given, so a request without it is sent exactly as today.
  • Responses don't return the list.

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