torchcell.verification

Record-level verification of built datasets at five levels, L0 to L4. levels holds the reusable checks and common the rules every dataset family shares; each family module (fitness, expression, morphology, metabolite, protein and others) applies them to one phenotype type. report defines the pydantic verification report, sourced binds a single extracted value to its source quote and sha256, and runners runs the verifiers over built datasets.

Classes

CarrierGapCensus

The gap census, extended to every carrier and to undeclared None values.

SharedRecordRules

Accumulate the family-agnostic rules over a dataset's records.

DerivationMethod

How a non-sourced statistic's value was fixed (ordered by preference).

Level

The five universal verification levels (ordered: a gate, not a set).

LevelResult

The outcome of a single L-level check.

Provenance

Where a dataset's records came from, recorded alongside verification.

StatDerivation

How a derived (non-per-record-sourced) statistic was fixed, as data.

VerificationReport

Provenance + the L-level results for one dataset.

SourcedValue

A hardcoded value plus the provenance that justifies it.

ProvenanceGap

The complement of SourcedValue: a documented, typed ABSENCE.

ProvenanceGapReason

WHERE in the provenance chain a value died -- an honest, typed absence.

ProvenanceGapCensus

Aggregate view of the ProvenanceGaps across a built dataset -- the worklist.

Functions

shared_rule_results

Run every shared rule over a materialized record sequence.

sha256_file

Return the hex sha256 of a file, read in chunks (large artifacts).

audit_sourced_value

Verify a SourcedValue against its source artifact.

library_available

True if the MinerU library root exists (audits skip when it doesn't).

provenance_gap_census

Tally the provenance_gaps carried by a stream of phenotype records.

provenance_gap_level_result

Wrap a census into the L1 provenance_gaps result -- ALWAYS passes.

l1_provenance_gaps

L1 informational census of documented provenance gaps over a phenotype stream.

l0_structural

L0: every raw record validates against its schema model.

l1_completeness

L1: observed keys cover the expected oracle set (nothing silently dropped).

l1_count

L1 variant: an exact record-count oracle (e.g. 4718 mutants + 122 WT).

l2_cross_method

L2: two independently-derived aligned series agree within tol.

l2_value_fidelity

L2: numeric values are finite / in range / non-NaN as required.

l3_convention

L3: a named units/convention assertion (e.g. expression = log2(sample/ref)).

l4_cross_source

L4: overlapping entities agree across two sources.

measured_gene_universe

Union of all measured genes across records (the L4 cross-source key).

verify_expression_dataset

Run the L0-L4 record-level gate for one microarray expression dataset.

perturbed_gene_set

Union of systematic gene names deleted across records (the L4 overlap key).

verify_morphology_dataset

Run the L0-L3 record-level gate for the Ohya2005 CalMorph dataset.

verify_visual_score_dataset

Run the L0-L3 record-level gate for a visual-score dataset.

visual_score_gene_set

The host loci a dataset's records name: the L4 gene-universe overlap key.

metabolite_gene_set

The host loci a dataset's records name: the L4 gene-universe overlap key.

verify_metabolite_dataset

Run the L0-L3 record-level gate for a metabolite dataset.

fitness_gene_set

Union of screened deleted gene names -- the L4 gene-containment key.

verify_fitness_dataset

Run the L0-L4 record-level gate for a single-mutant fitness dataset.