Your duplicate detection issues stem from multiple factors that need comprehensive solution addressing part number normalization, fuzzy matching, and BOM reconciliation:
Part Number Normalization Strategy:
Implement normalization at multiple layers. First, in your integration code before making REST API calls, apply consistent normalization rules:
function normalizePart(partNum) {
return partNum.trim()
.toUpperCase()
.replace(/[^A-Z0-9-]/g, '');
}
This handles whitespace, case variations, and special characters. Second, implement custom validator in Windchill that applies same normalization on part creation, ensuring consistency regardless of creation method.
Enhanced Duplicate Detection:
The OData $filter performs exact matching, which misses variations. Implement two-stage detection. First, query with normalized part number:
GET /Windchill/servlet/odata/ProdMgmt/Parts?
$filter=toupper(Number) eq 'TOOL-12345'
Note: OData string functions may have limited support in Windchill, so normalize in client code instead. Second stage: if no exact match found, retrieve parts with similar prefixes and perform fuzzy matching in application code using Levenshtein distance or Jaro-Winkler similarity. Set threshold (e.g., 90% similarity) to catch typos while avoiding false positives.
Fuzzy Matching Implementation:
For production use, implement caching layer that maintains normalized part number index. Use Redis or similar cache with normalized numbers as keys, part OIDs as values. When synchronizing tooling BOMs, first check cache with normalized part number. If cache miss, query Windchill REST API and update cache. This dramatically improves performance for BOM reconciliation with thousands of parts.
BOM Reconciliation Enhancement:
Shift from part number-based matching to OID-based matching. Maintain mapping table in your integration database: source system tool ID → Windchill part OID. During BOM synchronization, look up OIDs from mapping table rather than querying by part number. This eliminates duplicate detection issues entirely. Update mapping table whenever new parts are created.
Preventing Future Duplicates:
Implement part creation workflow that enforces uniqueness. Before creating part via REST API, always query with normalized number. If similar part exists (even with slight variation), prompt user to reuse existing part rather than creating duplicate. Add custom Windchill validator that checks normalized part numbers against existing parts and rejects creation if duplicate detected. This prevents duplicates at source.
Data Cleanup for Existing Duplicates:
For existing duplicate tooling parts, implement cleanup process: identify duplicates using fuzzy matching on all parts, determine canonical part (usually oldest or most-used), update all BOM references to point to canonical part, and obsolete duplicate parts. Document cleanup in change order for audit trail.
This comprehensive approach addresses immediate duplicate detection needs while preventing future occurrences through normalization, caching, and validation at multiple layers.