"""Record what an annotation run produced, and how specific each HPO term is Two changes, both so the ranking can stop asserting things it has not measured: - jobs.has_frequencies / has_effect_scores: whether the run looked up allele frequencies and CADD/AlphaMissense at all. Without this the API cannot tell "absent from gnomAD" (strong evidence) from "nobody checked gnomAD" (no evidence), and scored both as maximally rare. - hpo_terms: each term's information content, so a phenotype match is weighted by how specific the matching term is rather than counting every term alike. Existing rows default to false, which is correct: every job recorded before this ran used VEP's database mode, which returns neither frequencies nor plugin scores. Revision ID: b7d4e2f80c31 Revises: 9a1c2d3e4f50 """ from collections.abc import Sequence import sqlalchemy as sa from alembic import op revision: str = "b7d4e2f80c31" down_revision: str | None = "9a1c2d3e4f50" branch_labels: str | Sequence[str] | None = None depends_on: str | Sequence[str] | None = None def upgrade() -> None: op.add_column( "jobs", sa.Column("has_frequencies", sa.Boolean(), nullable=False, server_default=sa.false()), ) op.add_column( "jobs", sa.Column("has_effect_scores", sa.Boolean(), nullable=False, server_default=sa.false()), ) op.create_table( "hpo_terms", sa.Column("hpo_id", sa.String(length=20), primary_key=True), sa.Column("name", sa.String(length=200), nullable=False), sa.Column("ic", sa.Float(), nullable=False), ) def downgrade() -> None: op.drop_table("hpo_terms") op.drop_column("jobs", "has_effect_scores") op.drop_column("jobs", "has_frequencies")