PolicyEngine / PolicyEngine/policyengine-core

Add safe return to `Microsimulation.calc`

Open
#358 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

code-health
Dominant language
Python
Stars
22
Forks
30
Avg merge
14h 33m
Merged PRs (30d)
7

Description

Often we want to calculate a variable across both baseline and reform simulations, where it only exists in the reform, e.g. UBI. We could add a safe=bool keyword argument which would return an array of zeros. This would probably require that map_to is also passed, in order to know what shape array to return.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Microsimulation.calc entry point and inspect how variables that exist only in a reform are currently handled. Define the expected behavior for a safe calculation, including the required map_to shape, and add coverage showing that the reform-only variable returns zeros in the baseline simulation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.