A coding tutorial for implementing a fitment normalization pipeline in .NET with deterministic mapping, validation, and conflict handling.
Target outcome
Convert noisy supplier feeds into normalized fitment records that can be trusted by search and checkout.
Core domain model
csharp
public sealed record FitmentRecord(
string SupplierPartNumber,
string OemReference,
string Make,
string Model,
int YearFrom,
int YearTo,
string EngineCode
);Normalization service
csharp
public sealed class FitmentNormalizer
{
public FitmentRecord Normalize(FitmentRecord raw)
{
var make = AliasDictionary.NormalizeMake(raw.Make);
var model = AliasDictionary.NormalizeModel(raw.Model);
var engine = raw.EngineCode.Trim().ToUpperInvariant();
return raw with { Make = make, Model = model, EngineCode = engine };
}
}Validation rule example
csharp
public static bool IsValidYearRange(FitmentRecord record)
{
return record.YearFrom >= 1970
&& record.YearTo >= record.YearFrom
&& record.YearTo <= DateTime.UtcNow.Year + 1;
}Deployment checklist
- define alias dictionaries per market
- version every normalization rule
- log conflict reasons for reviewer queue
- publish only batches passing quality threshold
Final takeaway
Keep mapping deterministic and versioned. It is the only way to reconcile supplier disputes and support reliable reprocessing.