Helping a mining company optimize logistics
Developing a route management service for heavy-duty trucks delivering coal from mining sites to distribution points. Read a new case study about how we built an MVP based on open source libraries and set up a CI/CD in kubernetes.
East Mining Company mines coal in an open pit — a complex process that not only requires them to extract the coal, but also process it, store it somewhere, and then deliver it by land or sea. And we are talking about millions of tons of coal per year.
Such a large company, of course, has its own IT department. At East Mining, this is an expert team that takes care of internal tasks like networking and technical equipment, helps business lines with automation, and finds contractors with the right technology stack for individual tasks.
So when they needed a new service for road management, they turned to Evrone.
Problem: The old solution worked but did not have the necessary functions
East Mining mines coal using the open pit method. This means that, instead of working underground, they dig down directly from the surface to uncover and mine layers of coal. As a result, their mining sites consist of massive, open air, funnel-shaped pits that are connected by an ever-changing series of roads.
Work is carried out constantly across different areas, which means that the routes in each section change every day. The roads are used by special dump trucks, for example, BelAZ trucks, that are larger than conventional dump trucks and can carry 3-10x more cargo. However, this also means that their fuel consumption is much higher, so their routes should be as efficient as possible, without downtime or traffic jams.
Vehicle movement data is collected in one-second increments for analysis. Dispatchers use this data to visualize the movement of all trucks and see potential traffic jams. Then they can redirect a truck to another route or design a new road to unload a popular route. This helps the company save on fuel and manpower, as well as significantly increase the throughput and the total volume of transported product per unit of time.
East Mining already had a special program to manage their routes, but it did not have all the features they needed. For example, it evaluated roads as single objects, and they needed the ability to divide roads into small segments. So the Evrone team was brought in to develop a new user-friendly service that would maximize business efficiency and value.
Solution: A new service based on open-source libraries
Over the course of three months, we developed a new service for rendering coal mine roads for the East Mining Company. We started by talking with the client's technical team and collecting requirements. They needed to keep the ability to visualize data, while adding several new features, including:
map editing (drawing new roads and sites)
management of the list of roads and polygons
For the mapping solution, we found a freely distributed library that would be similar to what the operators used before. Then we added a JS library for editing elements. Now the interface is similar to working in a graphical editor — separate layers for different types of entities and different modes for editing roads and sites. Data from the machines comes in the form of a series of points that form the path of a particular machine. There can be 10,000 or more such points on the map.
To draw the roads that vehicles drive on in the interface, the backend receives data, processes the coordinates and time, and transfers it in the required form to the frontend.
One of our biggest challenges was data processing. The server must not only receive telemetry and send it to the frontend, but also validate changes that came from the frontend. For example, when an operator draws a new road, the backend must save it as a new version of the map.
So we created an API that defines the list of changes on the map of roads and polygons and performs the necessary actions to update/create/delete. To check the changes, a system of rules for the interaction of entities was added. RestAPI is built with django-rest, which greatly speeds up development and simplifies maintenance, as this tool can do a lot out of the box.
We used Swagger to document the API. This was a great option because it partially automates the process. When an endpoint appears on the backend, information about it immediately appears in Swagger. This is convenient for communicating with the frontend and debugging, since you can see the backend information all in one place.
The system initially used Kubernetes and full-fledged CI/CD, so at the MVP stage, we prepared a standard set focused on high-speed deployment, allowing us to write separate pipelines for new needs.
We decided to limit ourselves to a simple deployment to a virtual machine, so that when new parts were added to the service, everything would work quickly: tests, linters, container deployment, direct deployment, etc.
All code was stored in a mono-repository. And to speed up the build time, our DevOps engineer set up the pipelines so that the backend and frontend were built separately.
Result and plans
Now East Mining has a service that allows them to maintain the current state of dumps and roads on a daily basis.
The application loads data from the backend, then draws a map with roads and sites. Users can assess the current situation and use the editor to make changes when needed, such as adding a new road or fixing an old one.
In order for the data to be stored in a consistent form, the service checks new or changed objects according to internal rules and displays an error if something goes wrong.
Users can undo or redo recent changes, save a new version of the map, and view previous versions. If there is something wrong with the new map, they can always revert to any of the earlier versions.
From an administrative point of view, we have divided access to different features of the application into the roles of an editor and a “read-only” user. Together with map versioning, this is a big insurance against accidental errors and changes.
The resulting roads are broken down into small segments, which the East Mining Company uses to gather detailed analytics. The service helps them to quickly respond to data changes and save the company time and money.
In the future, there is the possibility of adding automation to the application. For example, auto-drawing of roads based on the received data. AI can potentially handle this task, but first it will be necessary to collect a huge number of successful cases made by human operators.
After delivery of the project, East Mining has been working independently to expand the functionality. They transferred the service to their own OES IoT platform, where they use the service data to monitor road conditions, set speed advisories for dump truck drivers, optimize dump truck balancing, and other business tasks.