Six delete-then-insert-per-edition_year tables (schema spec §3):
cpt_section/cpt_code/cpt_instruction/cpt_reference/cpt_crosswalk/
cpt_list, keyed by (edition_year, item_key). cpt_section carries a new
path_key = " > ".join(path) column (C7) so consumers can group the
same heading title's several sec_ids (2019's running-header repeats)
together.
codetables.write_cpt_edition(con, edition, item_key) asserts one
pfs.cpt_code row per (edition_year, code) before inserting and raises
with the offending codes otherwise (C8's loader-side backstop, paired
with the parser fix). read_cpt_sections/read_cpt_codes/
read_cpt_instructions/cpt_years round out the readers.
pfs.cpt_load.find_editions(store) locates source:ama-tagged bib items
whose title names a CPT Professional edition year and carry an .epub
attachment (2019/2021/2022/2024 on disk today); the 2018 PDF-only
edition, the 2023 "CPT Changes" book and Netter's Atlas are excluded
by the title/attachment match itself, no special-casing needed.
ingest(store, con, years=None, dry_run=False) parses each matched
edition and writes it, or — dry_run — only counts, never touching con
so a preview can't contend for the DuckDB single-writer lock
(#508-#514).
`stack pfs cpt-ingest [--edition YEAR]... [--all] [--dry-run]` follows
the `elements` command's shape: dry-run opens no connection at all,
the write path goes through duckdb_batch + ensure_tables +
publish_replica.