Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not All Information available from NHTSA DATA #8

Closed
ride4sun opened this issue Aug 24, 2021 · 5 comments
Closed

Not All Information available from NHTSA DATA #8

ride4sun opened this issue Aug 24, 2021 · 5 comments

Comments

@ride4sun
Copy link

It seems like there is way more data available from the NHTSA Data. Why is that not decoded?

@pmundt
Copy link
Member

pmundt commented Aug 25, 2021

Mostly because the NHTSA data that's pulled in is to map in to the VIN data model, which has a fairly limited number of data points compared to the NHTSA data model. I'm not sure it makes sense to try and introduce more complexity into the VIN data model given that a lot of this information is not sufficiently generalized (e.g. we don't have an equivalent for European VINs), but I wouldn't be opposed to extending the NHTSA data model and adding new APIs for this if that's something that's going to be useful.

@ride4sun
Copy link
Author

ride4sun commented Aug 25, 2021 via email

@pmundt
Copy link
Member

pmundt commented Aug 25, 2021

That should be pretty straightforward, we already parse all of the results, they're just not passed through to the upper layers as we truncate explicitly with the call to toExtendedVehicleInfo(). Perhaps the easiest solution is to convert the result pairs into a Map<String, dynamic> and pass this up to the upper layer, then pull out the make/model/year from there instead, which would allow the rest of the results to be accessed by the caller.

@ride4sun
Copy link
Author

ride4sun commented Aug 25, 2021

Yes, I did see that. I think that should be the default. Then all data is available.
Basically like that in the Vin class:
Future<List<NHTSAResult>> fetchExtendedVehicleInfo() async => ExtendedVehicleInfo.getExtendedVehicleInfo(this.number);

All the other calls like Future<String> getModelAsync() async
can be deleted.

@pmundt pmundt closed this as completed in dc082f1 Aug 26, 2021
@pmundt
Copy link
Member

pmundt commented Aug 26, 2021

Ok, thinking about it a bit more, I came up with a slightly different approach. I'd rather not expose too much knowledge of the underlying NHTSA model within the VIN class, especially as we may end up using other sources for VINs from different geographic regions. As a compromise, I split out the NHTSA API accessors into their own class and exposed a library for this such that you can query it alongside your normal VIN processing code. There are now two methods by which to query the NHTSA data:

  1. Querying a specific variable name or ID, pursuant to the NHTSA data specification.
  2. Obtaining a Map<String, dynamic> map of populated key-value pairs pertaining to extended VIN data points.

I've updated the example to show how to use either of these approaches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants