v1 household copies to v2 fail when the household leaves out group collections

未关闭
#4,164 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

  • #4165 来自 @anth-volk —— 已关闭,未合并

评估

难度
4/5
预计耗时
3-5 天
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python
领域
backend

调研方向

Start with translate_legacy_household and its normalization step, which rejects people records that do not list every country-supported collection, and with _failure_category, which reports those rejections as translation. Compare them with policyengine-core's SimulationBuilder.build_from_entities, specifically add_default_group_entity and the last step of add_group_entity, to see which default groups it creates. Done when the two affected US households translate with those groups added, the UK and extra-key households still fail as unsupported, and the two events can be copied with process-v1-household-mirror-event.yml.

由索引模型根据 Issue 内容生成。

描述

Problem

From 2026-10-29 to 2026-11-02, four production v1 household creates in the Public API (three US, one UK) logged V1 household immediate copy completed with outcome error and failure_category translation. Their household_mirror_events records stay pending, so those households have no v2 copy.

Cause

translate_legacy_household requires every person to be listed in a group of every collection the country supports. policyengine-core, which the Public API's v1 calculations use, does not. When it builds a simulation from a v1 household (SimulationBuilder.build_from_entities):

  • a group collection that is omitted, or null, gets one group that holds every person (add_default_group_entity);
  • a person that a present collection's groups leave out gets a group of their own (the last step of add_group_entity).

Two of the US households list people and households, and leave out some or all of families, tax_units, spm_units and marital_units. v1 calculates them, but the translation's normalization rejects them with people record memberships must identify every country-supported entity collection, which _failure_category reports as translation.

The other two households are not valid v1 households, and v1 cannot calculate them either:

  • one US household has an extra top-level key that is not an entity collection;
  • the UK household has no people collection, and a person record at the top level.

policyengine-core raises SituationParsingError for both. The translation rejects them as legacy household contains unsupported collections, which is correct, so this issue leaves them pending.

Fix

Make the translation create, for each collection, the groups that policyengine-core creates: one group of everyone for an omitted or null collection, and a group of their own for each person a present collection leaves out. These groups have stable IDs after the named groups, no source_name (the v1 household has no name for them) and no values.

After the fix deploys, copy the two affected events with process-v1-household-mirror-event.yml, one event at a time.

主要语言
Python
星标
18
派生
33
平均合并
2 天 21 小时
30 天内合并 PR
93

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

PolicyEngine/policyengine-api 的其他 Issue

查看 PolicyEngine/policyengine-api 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。