The post has been translated automatically. Original language: Russian
The forecast on the screen is the end of a long job. The data goes through a path to it that the user does not see. And it is there that it is largely decided whether the forecast can be trusted.
The source material is far from ideal. Some indicators are measured every minute, others once a day. There are gaps, gaps, outliers, and inconsistent units of measurement. Therefore, in the prototype of the digital eco-platform, data received through the API in JSON or CSV formats is preprocessed.
Duplicates and incorrect measurements are removed, the signs lead to a comparable scale, and gaps are filled in with interpolation. If the gaps are systematic, use averages or predictions from auxiliary models.
There is a trap here: a sharp spike may turn out to be a trace of a real accident, and not at all a sensor error. Therefore, it is better to keep the original values, and mark and check suspicious ones.
The platform itself is built on microservices. Data collection, analytics, and visualization work as separate services with their own APIs, and each can be updated independently. The models are implemented in Python, and FastAPI is used to publish predictive services. Time series are stored in PostgreSQL and TimescaleDB, Grafana and its own web interface provide a visual picture, and Docker is responsible for containerization.
It doesn't end with the launch. New data is coming in, and the models need to be retrained. A good forecast, like good news, is valuable as long as it is fresh.
Прогноз на экране — это финал долгой работы. До него данные проходят путь, которого пользователь не видит. И именно там во многом решается, можно ли доверять прогнозу.
Исходный материал далёк от идеала. Одни показатели измеряют каждую минуту, другие раз в сутки. Встречаются разрывы, пропуски, выбросы и несогласованные единицы измерения. Поэтому в прототипе цифровой экоплатформы данные, поступившие через API в форматах JSON или CSV, проходят предобработку.
Дубликаты и некорректные измерения удаляют, признаки приводят к сопоставимому масштабу, пропуски заполняют интерполяцией. Если пробелы носят систематический характер, используют средние значения или предсказания вспомогательных моделей.
Здесь есть ловушка: резкий всплеск может оказаться следом реальной аварии, а вовсе не ошибкой датчика. Поэтому исходные значения лучше сохранять, а подозрительные помечать и проверять.
Сама платформа построена на микросервисах. Сбор данных, аналитика и визуализация работают как отдельные сервисы со своими API, и каждый можно обновить независимо. Модели реализованы на Python, для публикации предсказательных сервисов применяется FastAPI. Временные ряды хранятся в PostgreSQL и TimescaleDB, наглядную картину дают Grafana и собственный веб-интерфейс, а за контейнеризацию отвечает Docker.
Запуском дело не заканчивается. Поступают новые данные, и модели нужно переобучать. Хороший прогноз, как и хорошая новость, ценен, пока он свежий.
Comments 5
Newest Popular