Remove the tracer patches in build-parameter-dependency-map.py once policyengine-core records scale and undated reads

Open
#1,598 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Active
Tech stack
python, shell
Domain
tooling

Research direction

Start in app/scripts/build-parameter-dependency-map.py, where patch_tracer patches get_traced_child and ParameterNode._get_at_instant, and where IGNORED_PARAMETER_PREFIXES is defined. The issue is blocked until a policyengine-core release contains PolicyEngine/policyengine-core#664, so first confirm that release exists, then check whether trace_microdata can replace the script's edge-building. Done when the patches and the prefix filter are removed and the script's output is unchanged.

Written by the indexing model from the issue text.

Description

PolicyEngine/policyengine-core#664 makes core's tracer record two kinds of read that app/scripts/build-parameter-dependency-map.py now adds by patching core:

  • scale and bracket reads such as p.base.calc(age), which the get_traced_child patch in patch_tracer adds;
  • calls of a node below the root with a period, such as parameters.gov.usda.snap.emergency_allotment(period), which the ParameterNode._get_at_instant patch adds.

With that core, each patch records those reads a second time. The script collects names into sets, so its output does not change, but both patches can be removed.

Two other changes in #664 affect the script:

  • Core's own abolition check (gov.abolitions.<variable>) is no longer recorded. IGNORED_PARAMETER_PREFIXES would then only drop formula reads of abolition switches, which do change the reading variable, such as policyengine-us's SSI income helpers. It can be removed.
  • Core adds policyengine_core.tools.dependency_map.trace_microdata(Microsimulation, households, year), which builds the same readers and consumers edge sets from a traced microdata subsample. The script could call it and keep its own output format.

Do this after the first policyengine-core release that contains #664.

Dominant language
HTML
Stars
1
Forks
3
Avg merge
1d 6h
Merged PRs (30d)
113

Getting set up

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.

More from PolicyEngine/policyengine-app-v2

All issues in PolicyEngine/policyengine-app-v2

Similar issues

More DevTools issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.