# pardheevkrishna/amazon-ml-challenge-2026-entity-resolution architecture

> Architecture diagram of the GitHub repository pardheevkrishna/amazon-ml-challenge-2026-entity-resolution, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pardheevkrishna/amazon-ml-challenge-2026-entity-resolution
- Repository: https://github.com/pardheevkrishna/amazon-ml-challenge-2026-entity-resolution

## Overview

This repository implements a per-country business entity resolution cascade: incoming records are normalized, candidate links retrieved and pruned, then ranked and scored before country-specific decisions and refinements produce matching and candidate-pair files. The graph preserves the documented model, rescue, France-rule, and output stages, plus the collective-feature layer. Most runtime connections are documented in the README; unsampled implementation details are not inferred beyond those statements.

Main entry points: [`code/business_entity_resolution/src/pipeline/stack.py`](https://github.com/pardheevkrishna/amazon-ml-challenge-2026-entity-resolution/blob/main/code/business_entity_resolution/src/pipeline/stack.py) (Country stackers), [`code/business_entity_resolution/src/pipeline/infer/p6_output.py`](https://github.com/pardheevkrishna/amazon-ml-challenge-2026-entity-resolution/blob/main/code/business_entity_resolution/src/pipeline/infer/p6_output.py) (Matching and candidate files), [`code/business_entity_resolution/src/pipeline/build_topk.py`](https://github.com/pardheevkrishna/amazon-ml-challenge-2026-entity-resolution/blob/main/code/business_entity_resolution/src/pipeline/build_topk.py) (CatBoost ranker and CE-set), [`code/business_entity_resolution/src/pipeline/infer/p4_predict.py`](https://github.com/pardheevkrishna/amazon-ml-challenge-2026-entity-resolution/blob/main/code/business_entity_resolution/src/pipeline/infer/p4_predict.py) (Threshold and margin)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_retrieval["Retrieval and ranking"]
  node_normalization["Normalization<br/>[build_text.py]"]
  node_country_profiles["Country profiles<br/>[__init__.py]"]
  node_matcher["Inverted-index matcher<br/>[matcher.cpp]"]
  node_pruning["Candidate pruning<br/>[prune.py]"]
  node_ranker["CatBoost ranker and CE-set<br/>[build_topk.py]"]
end

subgraph group_scoring["Scoring and features"]
  node_cross_encoders["Cross-encoders<br/>[ce.py]"]
  node_pair_features["Pair features<br/>[features.py]"]
  node_collective_features["Collective features<br/>[collective.py]"]
  node_stacker["Country stackers<br/>[stack.py]"]
end

subgraph group_decisions["Decisions and rescues"]
  node_decision["Threshold and margin<br/>[p4_predict.py]"]
  node_india_rescue["India native-script rescue<br/>[p5_rescue.py]"]
  node_ladder["Per-S1 ladder<br/>[s1_ladder.py]"]
  node_address_rescue["Address rescue<br/>[p5b_addr_rescue.py]"]
  node_france_rules["France rules A-H"]
end

subgraph group_outputs["Output"]
  node_output["Matching and candidate files<br/>[p6_output.py]"]
end

node_records(("Incoming records"))

node_records -->|"normalizes"| node_normalization
node_country_profiles -->|"selects country setup"| node_normalization
node_normalization -->|"provides records"| node_matcher
node_matcher -->|"generates candidates"| node_pruning
node_pruning -->|"passes kept pairs"| node_ranker
node_ranker -->|"selects CE-set"| node_cross_encoders
node_cross_encoders -->|"provides logits"| node_stacker
node_pair_features -->|"provides pair features"| node_stacker
node_collective_features -->|"provides collective features"| node_stacker
node_stacker -->|"scores candidates"| node_decision
node_decision -->|"refines India links"| node_india_rescue
node_india_rescue -->|"passes refined links"| node_ladder
node_decision -->|"refines France links"| node_france_rules
node_ladder -->|"passes unlinked records"| node_address_rescue
node_india_rescue -->|"contributes links"| node_output
node_address_rescue -->|"contributes links"| node_output
node_france_rules -->|"produces links"| node_output
node_ranker -->|"adds CE-set candidates"| node_output

click node_normalization "https://github.com/pardheevkrishna/amazon-ml-challenge-2026-entity-resolution/blob/main/code/business_entity_resolution/src/pipeline/build_text.py"
click node_country_profiles "https://github.com/pardheevkrishna/amazon-ml-challenge-2026-entity-resolution/blob/main/code/business_entity_resolution/src/pipeline/profiles/__init__.py"
click node_matcher "https://github.com/pardheevkrishna/amazon-ml-challenge-2026-entity-resolution/blob/main/code/business_entity_resolution/src/work/outer_refit_v6_run/matcher.cpp"
click node_pruning "https://github.com/pardheevkrishna/amazon-ml-challenge-2026-entity-resolution/blob/main/code/business_entity_resolution/src/pipeline/blocking/prune.py"
click node_ranker "https://github.com/pardheevkrishna/amazon-ml-challenge-2026-entity-resolution/blob/main/code/business_entity_resolution/src/pipeline/build_topk.py"
click node_cross_encoders "https://github.com/pardheevkrishna/amazon-ml-challenge-2026-entity-resolution/blob/main/code/business_entity_resolution/src/pipeline/ce.py"
click node_pair_features "https://github.com/pardheevkrishna/amazon-ml-challenge-2026-entity-resolution/blob/main/code/business_entity_resolution/src/pipeline/forensics/features.py"
click node_collective_features "https://github.com/pardheevkrishna/amazon-ml-challenge-2026-entity-resolution/blob/main/code/business_entity_resolution/src/pipeline/robust/collective.py"
click node_stacker "https://github.com/pardheevkrishna/amazon-ml-challenge-2026-entity-resolution/blob/main/code/business_entity_resolution/src/pipeline/stack.py"
click node_decision "https://github.com/pardheevkrishna/amazon-ml-challenge-2026-entity-resolution/blob/main/code/business_entity_resolution/src/pipeline/infer/p4_predict.py"
click node_india_rescue "https://github.com/pardheevkrishna/amazon-ml-challenge-2026-entity-resolution/blob/main/code/business_entity_resolution/src/pipeline/infer/p5_rescue.py"
click node_ladder "https://github.com/pardheevkrishna/amazon-ml-challenge-2026-entity-resolution/blob/main/code/business_entity_resolution/src/pipeline/infer/s1_ladder.py"
click node_address_rescue "https://github.com/pardheevkrishna/amazon-ml-challenge-2026-entity-resolution/blob/main/code/business_entity_resolution/src/pipeline/infer/p5b_addr_rescue.py"
click node_france_rules "https://github.com/pardheevkrishna/amazon-ml-challenge-2026-entity-resolution/tree/main/code/business_entity_resolution/src/pipeline/france_rules"
click node_output "https://github.com/pardheevkrishna/amazon-ml-challenge-2026-entity-resolution/blob/main/code/business_entity_resolution/src/pipeline/infer/p6_output.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_normalization,node_country_profiles,node_matcher,node_pruning,node_ranker toneBlue
class node_cross_encoders,node_pair_features,node_collective_features,node_stacker toneAmber
class node_decision,node_india_rescue,node_ladder,node_address_rescue,node_france_rules toneMint
class node_output toneRose
class node_records toneIndigo
```

## Components

### Retrieval and ranking

- [Normalization](https://github.com/pardheevkrishna/amazon-ml-challenge-2026-entity-resolution/blob/main/code/business_entity_resolution/src/pipeline/build_text.py): `code/business_entity_resolution/src/pipeline/build_text.py`
- [Country profiles](https://github.com/pardheevkrishna/amazon-ml-challenge-2026-entity-resolution/blob/main/code/business_entity_resolution/src/pipeline/profiles/__init__.py): `code/business_entity_resolution/src/pipeline/profiles/__init__.py`
- [Inverted-index matcher](https://github.com/pardheevkrishna/amazon-ml-challenge-2026-entity-resolution/blob/main/code/business_entity_resolution/src/work/outer_refit_v6_run/matcher.cpp): `code/business_entity_resolution/src/work/outer_refit_v6_run/matcher.cpp`
- [Candidate pruning](https://github.com/pardheevkrishna/amazon-ml-challenge-2026-entity-resolution/blob/main/code/business_entity_resolution/src/pipeline/blocking/prune.py): `code/business_entity_resolution/src/pipeline/blocking/prune.py`
- [CatBoost ranker and CE-set](https://github.com/pardheevkrishna/amazon-ml-challenge-2026-entity-resolution/blob/main/code/business_entity_resolution/src/pipeline/build_topk.py): `code/business_entity_resolution/src/pipeline/build_topk.py`

### Scoring and features

- [Cross-encoders](https://github.com/pardheevkrishna/amazon-ml-challenge-2026-entity-resolution/blob/main/code/business_entity_resolution/src/pipeline/ce.py): `code/business_entity_resolution/src/pipeline/ce.py`
- [Pair features](https://github.com/pardheevkrishna/amazon-ml-challenge-2026-entity-resolution/blob/main/code/business_entity_resolution/src/pipeline/forensics/features.py): `code/business_entity_resolution/src/pipeline/forensics/features.py`
- [Collective features](https://github.com/pardheevkrishna/amazon-ml-challenge-2026-entity-resolution/blob/main/code/business_entity_resolution/src/pipeline/robust/collective.py): `code/business_entity_resolution/src/pipeline/robust/collective.py`
- [Country stackers](https://github.com/pardheevkrishna/amazon-ml-challenge-2026-entity-resolution/blob/main/code/business_entity_resolution/src/pipeline/stack.py): `code/business_entity_resolution/src/pipeline/stack.py`

### Decisions and rescues

- [Threshold and margin](https://github.com/pardheevkrishna/amazon-ml-challenge-2026-entity-resolution/blob/main/code/business_entity_resolution/src/pipeline/infer/p4_predict.py): `code/business_entity_resolution/src/pipeline/infer/p4_predict.py`
- [India native-script rescue](https://github.com/pardheevkrishna/amazon-ml-challenge-2026-entity-resolution/blob/main/code/business_entity_resolution/src/pipeline/infer/p5_rescue.py): `code/business_entity_resolution/src/pipeline/infer/p5_rescue.py`
- [Per-S1 ladder](https://github.com/pardheevkrishna/amazon-ml-challenge-2026-entity-resolution/blob/main/code/business_entity_resolution/src/pipeline/infer/s1_ladder.py): `code/business_entity_resolution/src/pipeline/infer/s1_ladder.py`
- [Address rescue](https://github.com/pardheevkrishna/amazon-ml-challenge-2026-entity-resolution/blob/main/code/business_entity_resolution/src/pipeline/infer/p5b_addr_rescue.py): `code/business_entity_resolution/src/pipeline/infer/p5b_addr_rescue.py`
- [France rules A-H](https://github.com/pardheevkrishna/amazon-ml-challenge-2026-entity-resolution/tree/main/code/business_entity_resolution/src/pipeline/france_rules): `code/business_entity_resolution/src/pipeline/france_rules`

### Output

- [Matching and candidate files](https://github.com/pardheevkrishna/amazon-ml-challenge-2026-entity-resolution/blob/main/code/business_entity_resolution/src/pipeline/infer/p6_output.py): `code/business_entity_resolution/src/pipeline/infer/p6_output.py`

### Other components

- **Incoming records**

## Connections

- Incoming records → Normalization: normalizes (evidence: `README.md`)
- Country profiles → Normalization: selects country setup (evidence: `README.md`)
- Normalization → Inverted-index matcher: provides records (evidence: `README.md`)
- Inverted-index matcher → Candidate pruning: generates candidates (evidence: `README.md`)
- Candidate pruning → CatBoost ranker and CE-set: passes kept pairs (evidence: `README.md`)
- CatBoost ranker and CE-set → Cross-encoders: selects CE-set (evidence: `README.md`)
- Cross-encoders → Country stackers: provides logits (evidence: `README.md`)
- Pair features → Country stackers: provides pair features (evidence: `README.md`)
- Collective features → Country stackers: provides collective features (evidence: `README.md`)
- Country stackers → Threshold and margin: scores candidates (evidence: `README.md`)
- Threshold and margin → India native-script rescue: refines India links (evidence: `README.md`)
- India native-script rescue → Per-S1 ladder: passes refined links (evidence: `README.md`)
- Threshold and margin → France rules A-H: refines France links (evidence: `README.md`)
- Per-S1 ladder → Address rescue: passes unlinked records (evidence: `README.md`)
- India native-script rescue → Matching and candidate files: contributes links (evidence: `README.md`)
- Address rescue → Matching and candidate files: contributes links (evidence: `README.md`)
- France rules A-H → Matching and candidate files: produces links (evidence: `README.md`)
- CatBoost ranker and CE-set → Matching and candidate files: adds CE-set candidates (evidence: `README.md`)
