pfs: code element model — closed typed vocabulary for the logical elements of a code descriptor #684
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 (§Components:
pfs/elements.py).What. A pure module holding the element types (fixed) and element values (curated, closed list):
actor,time,period,population,activity,modality,relation,setting,billing. Plus a deterministic descriptor parser for minutes / "each additional" / period words / code references in parentheticals.Why the corpus says this is the right unit.
2KVJ2HKX¶394/¶396/¶398, 90 FR 32388–32389. The steps first print in the CY2024 rules (44F3F6VU,JJV3R692) and repeat every year since.DE2VH9PD¶1244–1247, 79 FR 67716. The entire commenter dispute that year was over oneperiodelement (calendar month vs 30 days, ¶1248–1251).++sub-elements (consent; initiating visit; 24/7 access; continuity; alternative care delivery; comprehensive care management; electronic care plan; transitions; community coordination; asynchronous communication; population data; risk stratification; performance measurement) —JJ6AM5HJ¶1163–1185, 89 FR 97864. G0557 is defined by reference to G0556's elements plus apopulationelement (¶1186) — arelationvalue we must model.Seed vocabulary from 99490, 99487/99489, 99491/99437, 99439, 99495/99496, 99497/99498, 99424–99427, G0556–G0558, 99441–99443 → 98008–98016, G2211, 99457/99458.
Done when the parser round-trips every seed descriptor in the FR into typed elements, with unit tests per type, and the five P48 hand families are reproducible from elements alone (see the families issue).
Implemented on branch
worktree-p49-code-family-foundation(plandocs/superpowers/plans/2026-09-09-code-family-foundation.md, Tasks 1 and 4).src/pfs/elements.py:ElementType(9 types), closedVOCAB,parse_descriptor,is_element_paragraph,slug;src/pfs/codetables.py:pfs.code_element,pfs.code_element_review,pfs.code_event,pfs.code_familywith delete-then-insert writers, bulk readers.Live run (2026-09-09, with the local model), elements per code:
Review queue: 9 lines across 3 codes (
stack pfs review). Every row carries an FR anchor (item_key, p_id, page) orsource='rvu'/'hcpcs'with a year.Known gaps for the review loop: vocabulary values are seeded from the fixture families only;
is_element_paragraphis a heuristic (final review fixed the FR cross-reference enumeration case). Follow-ups: #698 (--all-payablescale), new issue on long background paragraphs absorbed as a stem.Delivered in P49 slice 1 (merged
edc128evia #701): src/pfs/elements.py — ElementType enum, closed VOCAB, parse_descriptor, slug. Closing.