I am creating a Vehicle Owner and User Management service for Polestar. The service has…
- User
I am creating a Vehicle Owner and User Management service for Polestar. The service has four modules: the Registration number, owner, primary driver, and market modules. I will focus on the Primary Driver module.
This module tracks the user, identified with a Polestar ID, who is the primary driver of a car. A car can only have one primary driver. The primary driver is captured from Polestar's Order Management System (POMS). The service listens to order events from POMS. If an order event contains a valid VIN and Polestar ID in the "Driver" field, the service saves that Polestar ID as the car's primary driver. A Polestar ID is valid if it exists in the Polestar ID service (which can be confirmed with an API call). A VIN is valid if it exists in Volvo's factory order system, the Vehicle Internet Sale & Traceability Application (VISTA).
The service also stores all the events it receives in an "event store" for replay purposes. Additionally, the service allows other systems to change a car's primary driver through an API. There are two versions of the API: one with M2M authentication and one with Polestar ID authentication (OAuth). Using the Polestar ID Auth. version, the user can only edit a car's primary driver if they have access to the logged-in primary driver's credentials.
The service also saves related information for primary driver changes. This includes the system that made the update, the timestamp of when the primary driver was registered, the user ID (if the change was made using Polestar ID auth API), the client ID of the service that made the change (if the change was made using M2M auth API), and the event ID that caused the change. If the update was made based on an event, the timestamp when the event was emitted is also saved.
If the primary driver is registered based on an event from POMS, the service stores the order ID from the event. A POMS update can only overwrite an API update if the order ID is new.
The service also maintains a history for primary drivers. When a new primary driver is registered, the previous primary driver is given an end timestamp. Using the APIs, it is possible to remove a primary driver from a car without registering a new one.
Assistant
That sounds like a complex but interesting project! Here are some suggestions for the primary driver module:
-
Use a relational database: To store and retrieve data efficiently, consider using a relational database such as MySQL or PostgreSQL. This will allow you to create tables and relationships between tables to represent the different entities in your system.
-
Implement an event-driven architecture: Since the primary driver module listens to events from POMS, it's a good idea to implement an event-driven architecture. This will allow the module to react to events in real-time and update the database accordingly.
-
Use an event store: As mentioned in the description, the service stores all events it receives in an "event store" for replay purposes. This is a good practice as it allows you to keep a history of events and replay them if needed.
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.