Skip to content

Create and read household calculations in the Simulation Entrypoint on the Public API's household_jobs table #1045

Closed

Description

@anth-volk

The detailed-save API calculates single households as household jobs: one household, one year and one policy, stored as a row of the Public API's household_jobs table. The v2 Modal household functions (#903) claim a job they are given and record its result or failure. Nothing creates those jobs yet.

Wanted: the Simulation Entrypoint's POST /household-calculations and GET /household-calculations/{id}.

  • Submitting. A submission names a household (and optionally a policy) stored in the Public API. Sim reads them and the catalog version of its v2 manifest's default worker, and calculates for the household's default year under that one policy. It creates the job pending with no call ID, then starts the household function's call. It records the call ID while the job is still pending with none, or fails the job when Modal refuses the call.
  • Errors. Every referenced row is checked before writing. A missing household, policy or catalog version, or a foreign-key violation, is a 400 naming what is missing. A malformed request, or one the contract refuses, is a 422. A service that can't read its manifest or database is a 503.
  • Reading. A read returns the job's status, result document and error message.
  • Staging. A staging household calculation runs on every staging deploy.

This replaces #957, whose work was built on a schema that is no longer used.

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