Revelo Vehicle Data Service Challenge
The Vehicle Data Service Challenge consists of the following main components:
-
Data Fetching and Parsing (XML Parser Service)
-
Data Transformation and Storage (Data Transformation Service) (later implemented in a separate service but kept for consistency)
-
Data Storage (Database Service)
-
GraphQL API (Vehicle Resolver)
-
Import data (A script added to import the data to the db. Specific to this challenge.)
- Fetches all vehicle makes and their corresponding vehicle types
- Parses XML data into a usable format
- Transforms and stores the data in a database
- Implements error handling and retries for API requests
- Provides a GraphQL API to query vehicle data
- Uses batch processing and concurrency to optimize data import
- Node.js (v14 or later)
- npm
- A running instance of MongoDB
- Clone the repository
- Install dependencies:
npm install
-
Start the application:
npm run start
-
To import data, run:
npm run import-data
-
Once the data is imported, you can query it using the GraphQL API at
http://localhost:3000/graphql
The GraphQL API provides two main queries:
vehicles
: Fetches all vehiclesvehicle(makeId: Int!)
: Fetches a specific vehicle by its make ID
Example query:
query { vehicles { Make_ID Make_Name VehicleTypes { VehicleTypeId VehicleTypeName } } }
query { vehicle(makeId: 123) { Make_ID Make_Name VehicleTypes { VehicleTypeId VehicleTypeName } } }