Skip to content

Build reusable CalibrationVariantAssignmentTable component (inline editing + CSV upload) #679

@bencap

Description

@bencap

Summary

Create a reusable Vue component CalibrationVariantAssignmentTable that renders an inline, editable table of variant → assignment pairs, with support for adding/removing individual rows and CSV upload. This component is the shared foundation for calibration controls and future class-based assignment editing.

Background

Two calibration workflows need a UI for assigning a clinical or functional label to a score-set variant:

  1. Controls: variant → Pathogenic | Benign
  2. Class-based calibrations: variant → one of the calibration's defined class labels (tracked separately as a follow-up)

Rather than building two separate UIs, a single parameterized component handles both. Assignment options are passed as a prop so the same component works for fixed enums and dynamic label sets alike.

Proposed Behavior

Props

  • modelValue: { variantUrn: string; assignment: string }[] — current rows (v-model)
  • assignmentOptions: { label: string; value: string }[] — available assignment values
  • scoreSetUrn: string | null — the score set to search variants from
  • assignmentColumnName?: string — column header label (defaults to "Clinical Status")
  • validationErrors?: Record<string, string> — keyed by row index/field for inline errors
  • readonly?: boolean — hides add/remove controls and disables editing (for viewer use)
  • disabled?: boolean

Behavior

  • Renders a table with columns: variant (typeahead search from score set variants), assignment (dropdown from assignmentOptions), remove button
  • "Add row" button appends a new empty row
  • "Upload CSV" button opens a file picker; the CSV is parsed client-side and valid rows are merged into modelValue
  • Emits update:modelValue on any change (v-model compatible)
  • Row-level validation errors displayed inline

CSV format

  • Two columns: variant (URN or HGVS), [assignment] (column name configurable via prop)
  • Invalid rows highlighted with an error message; valid rows added to the table

Acceptance Criteria

  • Component renders a table of variant + assignment rows
  • Rows can be added and removed inline
  • CSV upload parses a two-column CSV and merges valid rows into the table
  • Assignment options are fully driven by the assignmentOptions prop (no hardcoded values)
  • Variant typeahead searches score set variants by URN/HGVS prefix
  • Row-level validation errors are displayed inline
  • Component is v-model compatible
  • readonly prop hides editing controls and disables inputs
  • Component is accessible (keyboard navigation, ARIA labels on interactive elements)

Implementation Notes

  • Place in src/components/calibration/CalibrationVariantAssignmentTable.vue
  • Use existing PSelect / PrimeVue components for the dropdown; follow the file upload pattern from CalibrationFields.vue for CSV
  • Debounce the variant typeahead API calls; display URN + HGVS in option labels
  • Keep the component presentational — no direct API calls except the variant search typeahead

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions