Hellooo, I've become interested in creating, and this is one of the things I've been looking into. The car market is a weird, some may argue under-regulated market, and I've been thinking about how a new comer like me can be protected. It will be a part of a series of ideas and their architectural aspects. Hope you enjoy!
Why am I doing this?
I've been looking at cars to buy lately, and I've been interested in knowing how I can save myself some time when looking at the details of each car. It's a bore to go from one place to the next and do endless scrolling to get the information that I want. Plus, I need to know how to analyse what I see when I look at the results from certain cars' MOT results.
Where do I get the information from?
I thought about looking at where some of the vehicle inspection apps get their information from. Turns out that the information comes form the government, it was a free API! I love free stuff, especially API's, so this was a welcome find. There were many types, and it was fun to see what information you can get from a single licence plate.
So that's the information, what do I want to do with it?
I want to use it to feed an AI model, that will be able to analyse the information and get back to me (the user) with well thought, digestible information. Kind of like a buddy car specialist, I'm sure there's some car specialist Models out there, or in the least, the general GPT models have consumed some car content from the internet in the last 10 years.
This would allow the user to understand, especially if they are not as knowledgeable in cars, the condition of the car, the history of it and how it would affect them if they were to buy it.
So, where do I start? Draw draw draw 🖼️🎨🖌️
I decided to go with a weird hybrid between flowchart and use case diagram lol. Essentially it should explain the process where the user would enter a licence plate number, it would transfer from the front end to the backend. The backend would check if the licence plate has been requested already by the same or other user, this saves us the money and time it would take calling the AI model API and free data API some rate limits.
Let's assume it's a cache miss, it would then begin the process of gathering all the data needed by querying the API with the licence plate. After that, we would begin the process structuring the data into a singular object model, called the vehicle analysis object (for a lack of better term, I know 🙄, will change at some point).
Once that is done, the fun begins, where we serialise the data into a JSON format, that can easily be inserted into a formatted string. The reason we do this is to be able to add it to the prompt we would like to give to the AI model. Of course, the prompt itself will be very concise but will have enough detail to ensure the AI model knows exactly what it needs to do, doesn't waste any output tokens (for those that know that AI models these days talk garbaage for days and waste tokens). The output will 100% have to be in a JSON format that we can quickly deserialise from and use right away. No point in doing extra work if the AI model API doesn't charge by compute but by tokens, so I might as well make them do it!
Anyway, we can see the weird result circle, which represents...tada.. the result, which we will then use as part of an action to ensure that result is transformed into a more front end friendly object. This will save to the cache, with a specific cache expiry lifetime. I haven't decided yet what the cache lifetime could/should be, but my gut feeling while looking at cars in some of the websites, that good cars can go pretty quickly, maybe like in 1-2 days. This probably means I wouldn't be the only one looking at them, but I don't want to hold things for a whole 2 days just in case people are interested, I'd clog up the RAM! Instead, I'll be starting with 6 hour cache potentially and see where it goes from there.
Side notes
An interesting thing I thought of was the issue of the cache itself, and the way in which I can find out how long should the expiry be. There would be monitoring involved of course, more so looking at how the all the request that go to any of the free data API, as the query will just be the licence plate, so it'd be easy to search.
That's all for now
I guess for now I'm just going through the creation of the app, starting with exploring the APIs and their documentation. It should give me a vision on how to structure the code, and how to model the vehicle analysis object. Thanks for tuning in, see you in the next instalment! 🙌

Top comments (0)