Air Quality Route Optimization
The client is a company creating an ecosystem for connected vehicles. They have developed a hardware solution and a platform, which can be customized depending on specific business needs. Many devices can be integrated into the ecosystem and interact with the platform through the open APIs and SDKs.
Keeping the environment healthy is a major problem in the modern world, particularly in urban areas. While the issue has been highlighted by national governments and municipalities around the world, there is no immediate fix. It will take significant time, resources and cooperation to improve air quality.
The client envisioned a mobile app that would offer users an easy way to avoid contaminated areas and structure their routes according to data from different sources and providers. Lightweight, yet functional iOS and Android apps will respond to specific user needs and requests and take into consideration their preferences and health concerns.
It is very important to have the solution in a pluggable shape, in white-label fashion, which is agnostic to data sources, third party integrations and Cloud hosting. Therefore, the system can be used as a B2C or B2B solution or both.
This will only be possible be if a powerful and complex backend provides a foundation for the user-friendly interface. Different approaches and technologies must be incorporated in the system. It must consolidate data streams, make data multidimensional for further processing and enable Big Data analysis, ML and other calculation algorithms, and routing. All this has to be well-balanced to ensure the best possible performance and further scalability.
Meeting the Challenge
DataArt was chosen as a trusted development partner with strong M2M / IoT experience. The solution design was created based on the client’s feedback and requirements.
We proposed building the platform based on microservice architecture that would structure the application as a set of coupled, collaborating services. Each would encapsulate specific business logic.
A simplified diagram of the platform is shown below.
From the user perspective, an entry point to the application will be an API Gateway, which will handle requests in one of two ways. Some of the requests will be simply proxies to the appropriate service and others will reach out to multiple services to manage complex requests. The load balancer will be used to distribute incoming traffic across multiple targets automatically. It is necessary to access horizontally scalable and highly available services effectively.
Kubernetes will be used as a container management system. It will manage containerized applications across multiple hosts as well as provide necessary mechanisms for deployment, maintenance, and scaling of applications. Microservices will run in an environment in which the number of instances of a service and the locations can be changed dynamically. To address this, a DNS-based Kubernetes service discovery mechanism will be used.
Inter-service communications will utilize a mixed approach comprising asynchronous messaging and direct API calls. Apache Kafka will be used as a message bus. It is horizontally scalable, fault-tolerant and allows persisting data safely.
The system will operate with different types of data including air quality, riding, routing and user-specific data. The combination of an RDBMS database and NoSQL data store will be most efficient in this case. Logging all the details of how a distributed system operates is another essential task. Elasticsearch is best suited for storing and accessing this type of data. It is a distributed, RESTful search and analytics engine based on Apache Lucene.
The solution is designed to support cloud-based development and deployment. An AWS cloud platform will be used for infrastructure deployment. It provides commodity hardware and a wide choice of applications as a service. Infrastructure as a code approach will be applied for working with the infrastructure as with source code. An automation tool like Terraform supports the AWS cloud provider and makes it possible to script the entire infrastructure including virtual private networks, security settings, containers configurations and other components.
Continuous Integration and Continuous Delivery are two important practices. They affect both the engineering side and the business side and bring value to the team and product owner. Jenkins will be used as a CI/CD tool. It will bring automation into the routine development, deployment and testing processes.
The platform will seamlessly integrate multiple external services (mapping, routing, hailing, payments and air quality provider). Each integration will have a dedicated microservice implementing specific business logic.
The platform will help improve driver behavior by showing the user information about their driving and pollution, while suggesting alternative routes to avoid polluted or busy areas.
It will give users the information to measure, manage and reduce their environmental impact in real time. This technology can improve fuel efficiency by more than 15 per cent and NOx emissions can be halved through better driving.