Skip to content

Add pre_mapped_vrs, pre_mapped_vrs_digest, and pre_mapped_vrs_version columns to Variant #867

Description

@bencap

Summary

Add three nullable columns to variants to hold the independently-minted pre-mapped VRS value. This issue is schema-only — no minting logic, wiring, or backfill.

Proposed behavior

  • New Alembic revision, chained onto the current release-2026.3.0 head, adding to variants:
    • pre_mapped_vrsJSONB, nullable.
    • pre_mapped_vrs_digestString, nullable, indexed.
    • pre_mapped_vrs_versionString, nullable.
  • No server_default on any of the three. Every existing row starts null; backfilling them is separate work.
  • Update the Variant ORM model with matching Column declarations, placed alongside the existing hgvs_nt/hgvs_pro/hgvs_splice fields.

Acceptance criteria

  • The migration applies cleanly on top of the current release-2026.3.0 head and downgrades cleanly, dropping all three columns.
  • variants.pre_mapped_vrs_digest has a btree index.
  • The Variant ORM model exposes pre_mapped_vrs, pre_mapped_vrs_digest, and pre_mapped_vrs_version, all nullable, defaulting to None.
  • No existing row's data changes; no other table is read or written.
  • A model-level test creates a Variant, sets all three new fields, commits, re-fetches by id, and asserts each value round-trips exactly, including the full JSONB structure of pre_mapped_vrs.

Implementation notes

  • Model the migration file on the existing additional_mapping_columns revision, which adds columns to mapped_variants and target_genes the same way.
  • Index pre_mapped_vrs_digest as a plain indexed string column, the same way clingen_allele_id is indexed on MappedVariant (Column(String, index=True, nullable=True)) — not as a JSONB expression index like mapped_variants' existing index on pre_mapped->>'id'. This column is meant to be queried and joined on directly.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    app: backendTask implementation touches the backendapp: databaseTask implementation requires database changes

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions