Skip to content

features mapping and auto pair

Douwe de Vries edited this page Jul 2, 2026 · 1 revision

Mapping and auto-pair

Active contributors: Douwe de Vries

Purpose

Mapping lets users choose row-key columns and comparison-column pairs. Auto-pair conservatively fills confident one-to-one comparison pairs after users select matching row keys.

Directory layout

frontend/src/components/MappingConfig.tsx
frontend/src/components/mapping-config/
frontend/src/features/mapping/autoPair.ts
src/comparison/mapping.rs
src/backend/validation.rs

Key abstractions

Name File Description
MappingConfig frontend/src/components/MappingConfig.tsx Main configuration UI.
ColumnChipSelector frontend/src/components/mapping-config/ColumnChipSelector.tsx Physical and virtual column selection chips.
PairPreview frontend/src/components/mapping-config/PairPreview.tsx Shows selected order, auto-pair actions, and save/load pair-order actions.
buildAutoPairSelection frontend/src/features/mapping/autoPair.ts Filters confident mappings and preserves selected key prefix.
suggest_mappings_with_data src/comparison/mapping.rs Header and value-profile mapping suggestions.

How it works

Backend mapping suggestions score exact normalized names, aliases, fuzzy header similarity, and loaded value-profile overlap. Frontend auto-pair keeps only exact mappings or fuzzy mappings at or above AUTO_PAIR_MIN_FUZZY_SIMILARITY from frontend/src/features/mapping/autoPair.ts.

graph LR
    Keys[Selected row keys] --> Suggest[suggest_mappings]
    Suggest --> Backend[src/comparison/mapping.rs]
    Backend --> Mappings[MappingDto]
    Mappings --> AutoPair[buildAutoPairSelection]
    AutoPair --> Selection[comparisonColumnsA/B]
Loading

Integration points

src/backend/validation.rs turns comparison selections and mapping DTOs into ComparisonConfig. Pair-order persistence stores the selected column order through src/backend/pair_order.rs.

Entry points for modification

Change mapping scoring in src/comparison/mapping.rs. Change auto-pair policy in frontend/src/features/mapping/autoPair.ts. Change UI selection rules in frontend/src/components/MappingConfig.tsx and test with frontend/src/components/MappingConfig.auto-pair.test.tsx.

Key source files

File Purpose
frontend/src/components/MappingConfig.tsx Configuration step UI and compare payload assembly.
frontend/src/features/mapping/autoPair.ts Auto-pair selection policy.
src/comparison/mapping.rs Mapping suggestion algorithm.
src/backend/validation.rs Selected-column and mapping validation.
docs/auto-pairing.md User-facing auto-pairing behavior notes.

Clone this wiki locally