just_dna_compiler.compiler.meta¶
just_dna_compiler.compiler.meta ¶
The meta-table at compile (0.8): load meta.csv, expand every member, resolve precedence, and build
meta.parquet and meta_resolved.parquet.
The model and the grammar are the format tier's (just_dna_format.meta); this module needs the
module's other tables in hand, which is why it lives here. The table is loaded by the one loader every
authored table outside the table kinds shares (load.load_authored_table, RM357).
Expansion reads the authored rows, after the symbolic-allele drop and before resolution, on both
sides: validate_spec and compile_module hand it the same view, so a member matches the same rows in
the pre-flight and in the compile and every finding is one sentence on both (@parity-by-check). For a
variants.csv row the recorded key is the authored (variant_key, genotype), which is the key
weights.parquet carries for every row resolution did not expand. An rsID that resolution expands onto
several loci is the one residual: its weights rows are coordinate-keyed, and a consumer reaches them
from the meta key through their rsid column (COMPILER.md § The meta-table).
What meta_resolved.parquet holds. One row per single-statement row a one-member meta row
reaches, per (sex, drug) scope, with each fact column (tier, age_of_action, age_of_action_confidence,
flags) after precedence and a withheld list naming the columns two incomparable, disagreeing rows
left unresolved. A row of two or more members states facts about the combination, so its facts stay
on its own meta.parquet row and never reach a member row by itself.
tradeoff (RM327) is computed there too, per allele-bearing member and never pooled across
members: True when one member has a protective per-trait row and a risk per-trait row (a
one-member row with trait_efo_id and a direction not withheld; a mediator row counts, since its
direction is still a benefit/harm judgement), and that verdict lands on every row the member reaches,
including the diplotypes an allele_function member reaches through the allele they carry. On one
trait at one row, the fact columns' precedence applies first, so a narrower judgement the author made
about that row (a diplotype member over the allele it contains, a genotype over its locus, a sex- or
drug-scoped row over the unscoped one) drops the broader judgement on that trait. A row two members
reach is True when either member is. Never False: RM327's false arm needs every trait's
judgement stated, and a module states no closed list of the traits an allele touches, so absence of an
opposing row is unknown, not a negative. Two alleles meeting at a heterozygous diplotype are two
members, so ε2 protective on one trait and ε4 risk on another is not a trade-off of either.
MetaMatch ¶
Bases: NamedTuple
One row a member matched: which member, which table, the row's position there and its key.
MetaBuild
dataclass
¶
MetaBuild(
rows: list[MetaRow],
members: list[list[MetaMember]],
texts: list[list[str]],
matches: list[list[MetaMatch]],
withheld: list[list[str]],
resolved: list[dict[str, Any]],
errors: list[str],
warnings: list[str],
)
Everything the compile writes from meta.csv, computed before anything is written.
selector_counts ¶
Every member of every row with its match count, in authored order, for the manifest.
Source code in compiler/src/just_dna_compiler/compiler/meta.py
member_tables ¶
The rows each member table holds, keyed by the name a member uses (variants, not the file).
Source code in compiler/src/just_dna_compiler/compiler/meta.py
meta_scale_errors ¶
The one refusal that needs the module but no other table: a tier with no tier_scale (RM324).
Separate from build_meta so compile_module can ask it before mkdir while expanding after the
positional fill, where its rows match the pre-flight's.
Source code in compiler/src/just_dna_compiler/compiler/meta.py
build_meta ¶
build_meta(
rows: list[MetaRow],
tables: dict[str, list[Any]],
tier_scale: str | None,
) -> MetaBuild
Expand every member against tables, judge the rows that need the module, and resolve precedence.
Pure computation over rows already loaded, so both validate_spec and compile_module run it, on
the same view, and reach the same sentences. Nothing here reads or writes a file.
Source code in compiler/src/just_dna_compiler/compiler/meta.py
446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 | |
meta_frame ¶
meta.parquet: one row per authored row, in authored order — every authored cell verbatim (what
reverse writes back), the stamped key, and what the compile derived: the match count, the matches
as (member, table, key) structs, whether the row replaces the findings it names, and withheld.
Source code in compiler/src/just_dna_compiler/compiler/meta.py
meta_resolved_frame ¶
meta_resolved.parquet: one row per (single-statement row, sex, drug) a one-member row reaches.
Sorted by member table (META_MEMBER_TABLES order), then the row's authored position in its table,
then the sex scope (none, female, male), then the drug (none, then by name). tradeoff is RM327's
verdict (True or null, never False). meta_rows are the 0-based meta.parquet rows that apply
in the scope.