Skip to content

Export, save and supply stored current-law values to reform simulations #678

In progress

Description

@anth-volk

A reform simulation recalculates every current-law value its formulas read, on a copy of itself under current law, even when a simulation run without a reform over the same population has already calculated those values. #674 (PR #675) lets formulas declare those reads (current_law_read = True) and builds the current-law copy only when a read needs it, but nothing can save the values one run calculated or give them to another.

Core should:

  • export a current-law run's registered current-law values (the calculation year, its months for monthly variables, eternity for eternal ones) with each entity's ID array and the id of the run they came from;
  • save them to one HDF5 file with a versioned JSON manifest, and load them back, keeping every value type core stores (numbers, booleans, dates, strings and Enum values);
  • let a reform simulation take them, at construction or once its population exists, after checking that each entity's ID array matches and refusing them otherwise with an error that names the entity;
  • return them for declared reads, and through a call that returns only supplied values, without building the current-law copy; start a copy that is built from them as calculated values, never inputs;
  • drop them, with a logged warning, when the simulation is subsampled or its population is rebuilt.

Checks on where the values came from (current law, dataset, year, model version and settings) belong to the caller, .py, which supplies them in a later change.

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