CardMarket ID Matching Overhaul (~36% β ~85-91%)
| Date | 2026-04-06 |
| Status | Accepted |
| Decision Makers | @benjaminW78 |
Context and Problem Statement
CardMarket ID coverage for SWU products was ~36%. Three root causes were identified:
-
Name normalization broken by (V.N) suffixes β CardMarket appends version suffixes like
(V.2)to card names, which broke the normalized name comparison. This affected ~60% of CardMarket singles, especially in newer sets (LOF 6.2%, SEC 2.8%). -
Variant expansion search too restrictive β Only Hyperspace variants searched X-prefixed (Extras) expansions on TCGPowerTools. Showcase (124 products) and Prestige (534 products) were at 0% coverage because they searched the wrong expansion. Since print numbers are unique across base and extras expansions, filtering by variant type was unnecessary.
-
No fallback for products without SWU API match β Products that failed to match the SWU API had their CardMarket lookup skipped entirely, leaving them with no Cardmarket ID regardless of whether a PowerTools match existed.
Decision Drivers
- Print numbers are unique across base and X-prefixed (Extras) expansions β no need to filter by variant
- Products without SWU API enrichment still have TCGPlayer name + print number, sufficient for PowerTools matching
- Name normalization must strip CardMarket-specific suffixes like
(V.N)andToken
Considered Options
- Search all mapped expansions + add fallback β remove variant filtering, strip (V.N) suffixes, add TCGPlayer-data fallback
- Improve variant detection β try to correctly classify Showcase/Prestige into base vs extras
- Use CardMarket API directly β bypass TCGPowerTools entirely
Decision Outcome
Chosen option: Search all mapped expansions + add fallback, because itβs the simplest fix with the largest coverage gain.
Implementation
Logic Flow
Key Changes
- Removed
isHyperspaceparameter fromfindPowertoolsProduct()andSwuTcgPowertoolsMatchService.findMatch()β now always searches all mapped expansions - Added fallback for products without SWU API match β uses TCGPlayer name/number directly
- Name normalization improvements in
tcg-powertools-match.utils.ts:- Strip
(V.N)version suffixes from CardMarket names - Strip
Tokensuffix for double-faced card mismatches
- Strip
- Expanded
SWU_API_TO_TCGPT_CODE_MAPwith 12 promo/OP set mappings
Impacted Files
| File | Change |
|---|---|
packages/games/game-importer/src/swu-importer.ts | Added fallback for non-API-matched products, removed isHyperspace parameter |
packages/games/game-importer/src/swu/tcg-powertools/tcg-powertools-match.service.ts | Removed variant filtering β getExpansionsToSearch() returns all mapped expansions |
packages/games/game-importer/src/swu/tcg-powertools/tcg-powertools-match.utils.ts | Strip (V.N) and Token suffixes in name normalization |
Consequences
Positive
- CardMarket coverage: ~36% β ~85-91% across all SWU sets
- Showcase and Prestige products now have CardMarket IDs (were at 0%)
- Products without SWU API enrichment can still get CardMarket IDs via fallback
- Simpler code β no variant-based expansion filtering logic
Negative
- Searching all mapped expansions instead of filtering is slightly less efficient (more candidates to compare), but the impact is negligible given the small dataset size
- Fallback uses TCGPlayer names which may differ from CardMarket names, reducing match quality for edge cases
More Information
- PR: #2742
- Coverage report:
specs/swu-cardmarket/status-report.md