A specialized VIN decoder library for niche manufacturers
$ dotnet add package NicheVinDecoderA specialized VIN (Vehicle Identification Number) decoder library for vehicles not well-covered by standard US NHTSA VIN decoders, including international manufacturers, specialty vehicles, and niche market segments.
Project supported by: https://www.vehicleregistrationapi.com/
The standard NHTSA VIN decoder works well for mainstream automotive manufacturers, but falls short when dealing with:
This library fills that gap by providing detailed VIN decoding for these specialized manufacturers, extracting meaningful information about vehicle specifications, manufacturing details, and model information that would otherwise be lost.
Currently supported manufacturers include:
| Manufacturer | WMI | Vehicle Types | Country |
|---|---|---|---|
| Appalachian Trailers Inc | 5Z5 | Utility Trailers, Car Haulers | USA |
| Brinkley RV, LLC | 7T0 | Travel Trailers, Fifth Wheels | USA |
| Highland Ridge RV | 58T | RV Trailers, Fifth Wheels | USA |
| Load Glide Trailers | 1L9 | Aluminum Flatbed Trailers | USA |
| Nine Tech Co., Ltd (Segway) | LTU | Electric Scooters/Motorcycles | China |
| XPO Manufacturing | 7F2 | Truck Trailers, Converter Dollies | USA |
using NicheVinDecoder;
// Decode a VIN
var result = VinDecoder.Decode("58TBM0BU8P3A13051");
if (result.IsValid)
{
Console.WriteLine($"Manufacturer: {result.Manufacturer}");
Console.WriteLine($"Model Year: {result.ModelYear}");
Console.WriteLine($"Model: {result.Model}");
Console.WriteLine($"Body Style: {result.BodyStyle}");
// Access additional manufacturer-specific properties
foreach (var prop in result.AdditionalProperties)
{
Console.WriteLine($"{prop.Key}: {prop.Value}");
}
}
else
{
Console.WriteLine("Invalid VIN or unsupported manufacturer");
foreach (var warning in result.Warnings)
{
Console.WriteLine($"Warning: {warning.Message}");
}
}
using NicheVinDecoder.Core.Factory;
var factory = new VinDecoderFactory();
var decoder = factory.GetDecoder("58TBM0BU8P3A13051");
if (decoder != null)
{
var result = decoder.Decode("58TBM0BU8P3A13051");
// Process result...
}
using Microsoft.Extensions.DependencyInjection;
using NicheVinDecoder.Extensions;
var services = new ServiceCollection();
services.AddNicheVinDecoder();
var serviceProvider = services.BuildServiceProvider();
var factory = serviceProvider.GetService<VinDecoderFactory>();
We welcome contributions to expand the library's coverage of niche manufacturers! Here's how you can contribute:
Create the Decoder Class
Manufacturers/ folderBaseVinDecoder[ManufacturerName]VinDecoder.csImplement Required Properties and Methods
using NicheVinDecoder.Core.Base;
using NicheVinDecoder.Core.Models;
namespace NicheVinDecoder.Manufacturers
{
public class YourManufacturerVinDecoder : BaseVinDecoder
{
public override string ManufacturerName => "Your Manufacturer Name";
public override IEnumerable<string> SupportedWMIs => new[] { "ABC" }; // World Manufacturer Identifier(s)
public override VinDecodingResult Decode(string vin)
{
var result = new VinDecodingResult
{
VIN = vin,
Manufacturer = ManufacturerName,
IsValid = true,
Warnings = new List<VinDecodingWarning>(),
AdditionalProperties = new Dictionary<string, object>()
};
if (!CanDecode(vin))
{
result.IsValid = false;
result.Warnings.Add(new VinDecodingWarning("VIN cannot be decoded by this decoder"));
return result;
}
try
{
// Decode VIN positions according to manufacturer's specification
// Position 4-8: Vehicle Descriptor Section
// Position 9: Check digit
// Position 10: Model year
// Position 11: Plant code
// Position 12-17: Sequential number
// Example decoding logic:
result.ModelYear = DecodeModelYear(vin[9]);
result.BodyStyle = DecodeBodyStyle(vin[5]);
// ... additional decoding logic
}
catch (Exception ex)
{
result.IsValid = false;
result.Warnings.Add(new VinDecodingWarning($"Error decoding VIN: {ex.Message}"));
}
return result;
}
}
}
Add Unit Tests
Add comprehensive tests to UnitTests.cs:
[Test]
public void VinDecoder_WithValidYourManufacturerVin_ShouldDecodeCorrectly()
{
// Arrange
const string vin = "ABCXXXXXXXXXXXXXXX"; // Valid VIN for your manufacturer
// Act
var result = VinDecoder.Decode(vin);
// Assert
Assert.That(result, Is.Not.Null);
Assert.That(result.IsValid, Is.True);
Assert.That(result.VIN, Is.EqualTo(vin));
Assert.That(result.Manufacturer, Is.EqualTo("Your Manufacturer Name"));
Assert.That(result.ModelYear, Is.EqualTo(2023)); // Expected model year
Assert.That(result.BodyStyle, Is.EqualTo("Expected Body Style"));
Assert.That(result.Model, Is.EqualTo("Expected Model"));
// Add assertions for additional properties
Assert.That(result.AdditionalProperties["PropertyName"], Is.EqualTo("Expected Value"));
Assert.That(result.Warnings, Is.Empty);
}
To create a decoder, gather the following information about your target manufacturer:
When contributing, please include:
Run the unit tests using:
dotnet test
All decoders should have comprehensive unit tests covering:
[Add your license information here]
This project exists to fill gaps in VIN decoding coverage and relies on contributions from the community and publicly available manufacturer documentation.