pfs: code lineage table — creation, adoption, replacement, deletion, status change, revaluation events with FR anchors #686
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Spec docs/superpowers/specs/2026-09-09-code-family-longitudinal-design.md (
pfs/lineage.py).What.
pfs.code_event(code, year, kind, from_codes, to_codes, item_key, p_id, page, source)built from two independent sources that must agree or be flaggedunanchored: (a)pfs.rvu/rvu_proposeddiffs per code per year — appears, disappears, status change, descriptor change, |ΔRVU| > 10 %; (b)fr_anchorsparagraphs whosecodesmetadata contains the code and whose text matches an event pattern (creat/finaliz, replace, delet, crosswalk, bundled, telehealth services list).Fixture lineages, all already in the corpus.
DE2VH9PD¶1249–1251, 79 FR 67716: "we will adopt CPT code 99490 … effective January 1, 2015 instead of the G code"YBM4IZUS¶1578, 85 FR 84639: "descriptor identical to G2058", temporary crosswalk; ¶686 (TCM concurrency), ¶2369JE7KYBW3¶1100/¶1111, 86 FR 65118;MZ24MX5S¶1305XFGGRBDH/JJ6AM5HJ¶489/¶765, 89 FR 61652pfs.rvu: 99487/99489 B→A, 99497/99498 I→A, 99091 B→A, G2211 B→AJJ6AM5HJ¶1163–1187, 89 FR 9786499490 alone is discussed in 27 distinct rule documents (CY2015 final → CY2027 proposed) and 284 rule chunks already carry
codes ∋ 99490, so the FR side has the coverage; the RVU side starts at 2015 (files before that are a gap to note, not to fill here).Done when the six fixture lineages are emitted with correct kinds and anchors, the cross-check flags a deliberately removed paragraph as
unanchored, andstack pfs lineage --code Xprints the timeline with FR jump links (P40).Implemented on branch
worktree-p49-code-family-foundation(Tasks 6–7):src/pfs/lineage.py—rvu_events(appeared / disappeared / status_change / descriptor_change / revalued frompfs.rvubase-row diffs) andfr_events(created / adopted_cpt / replaces / replaced_by / deleted / crosswalk / bundled / telehealth_list fromfr_anchorsparagraphs naming the code), merged bylineage()with the ±1-rule-year cross-check that marks RVU eventsanchored. Directionalreplaces/replaced_by(no other code may sit between subject and trigger),createdno longer fires on "value established for", same-block range prefilter (99441-99443,G0008-G0010) expands ranges, FR page citations stripped before matching. CLI:stack pfs lineage --code X [--write](read-only without--write).Live run, seven fixture codes: 156 events written, 0 unanchored.
Fixture checks: 99490
2015 adopted_cptDE2VH9PD ¶1251 ✓; G20582020 appeared,2021 replaced_by → 99439(YBM4IZUS ¶686; the brief's ¶1578 anchors 99439's reciprocalreplaces G2058),2021 disappeared✓; G20642022 replaced_by → 99424(JE7KYBW3 ¶1100/¶1111) ✓; 994412025 deleted+bundled+telehealth_list(XFGGRBDH ¶489) and2025 disappeared✓; G05562025 created(JJ6AM5HJ) +appeared✓.Known limitation to design around in the chat (#691): FR events are dated by the rule year of the paragraph that mentions them, not the effective year — retrospective recaps yield extra
created/replaced_byrows in later years (e.g. G2058createdin 2021–2023 from paragraphs recounting its CY2020 creation). The chat should present the earliest anchored event as the origin and later ones as mentions.Delivered in P49 slice 1 (merged
edc128e) and extended: pfs.code_event with rvu/fr/cpt sources and ±1-year anchoring; stack pfs lineage --all-payable (78da985) precomputes events for 6,710 of 8,689 payable codes. Closing.