> For the complete documentation index, see [llms.txt](https://navixy.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://navixy.com/docs/analytics/ru/iot-query/schema-overview/bronze-layer/raw-telematics-data.md). Agents can also search and read this documentation through its [MCP server](https://navixy.com/docs/~gitbook/mcp).

# Схема raw\_telematics\_data

raw\_telematics\_data содержит точки мониторинга, входы, состояния и события, отправляемые устройствами. Ознакомьтесь с определением схемы и описаниями ключевых таблиц для SQL-анализа

The **`raw_telematics_data`** Схема содержит четыре основных типа таблиц, которые совместно обеспечивают предоставление полных данных об устройствах.

{% hint style="info" %}
Интерактивная диаграмма схемы raw\_telematics\_data доступна на **dbdiagram.io**: <https://dbdiagram.io/d/v1-schema-telematics-bd-67a0acef263d6cf9a0d8e750>
{% endhint %}

Подробные сведения о схеме исходных телематических данных приведены ниже.

{% code title="схема raw\_telematics\_data" expandable="true" %}

```sql
Table tracking_data_core {

  device_id integer [primary key]

  device_time timestampz [primary key]

  platform_time timestampz

  record_added_at timestampz [default: `now()`]

  latitude integer

  longitude integer

  speed integer

  altitude integer

  satellites integer

  event_id integer

  gps_fix_type integer

  hdop integer

  

  indexes {(device_id, device_time)}

}

  

Table inputs {

  event_id integer [primary key]

  device_id integer [primary key]

  record_added_at timestampz [default: `now()`]

  device_time timestampz [primary key]

  sensor_name text [primary key]

  value text

  indexes {(device_id, device_time)}

}

  

Table states {

  event_id integer [primary key]

  device_id serial [primary key]

  record_added_at timestampz [default: `now()`]

  device_time timestampz [primary key]

  state_name text [primary key]

  value text

  indexes {(device_id, device_time)}

}

  

Table additional_data {

  device_id integer [primary key]

  device_time timestampz [primary key]

  platform_time timestampz

  record_added_at timestampz [default: `now()`]

  текст discrete_inputs [первичный ключ]

  текст дискретных выходов [первичный ключ]

  special_jsonb jsonb

  индексы {(device_id, discrete_inputs, discrete_outputs, device_time)}

}

 

Ссылка: inputs.(device_id, device_time) > tracking_data_core.(device_id, device_time)

Ссылка: states.(device_id, device_time) > tracking_data_core.(device_id, device_time)

Ссылка: additional_data.(device_id, device_time) > tracking_data_core.(device_id, device_time)
```

{% endcode %}

## Основные таблицы по категориям

Каждая таблица предназначена для хранения определенного аспекта информации об устройстве:

<details>

<summary><code>tracking_data_core</code></summary>

**Назначение**: Основные данные о местоположении и движении

<table><thead><tr><th width="181.20001220703125">Атрибут</th><th>Подробности</th></tr></thead><tbody><tr><td><strong>Ключевые поля</strong></td><td><code>device_id</code>, <code>device_time</code>, <code>platform_time</code>, <code>latitude</code>, <code>longitude</code>, <code>speed</code>, <code>altitude</code>, <code>satellites</code>, <code>hdop</code>, <code>event_id</code></td></tr><tr><td><strong>Индексация</strong></td><td>Оптимизировано с помощью индекса по (<code>device_id</code>, <code>device_time</code>)</td></tr><tr><td><strong>Особые примечания</strong></td><td>Данные о местоположении (широта и долгота) хранятся в целочисленном формате с точностью 10⁷ для оптимальной производительности TimescaleDB<br><br>Скорость также хранится в целочисленном формате, поэтому ее нужно разделить на 100</td></tr></tbody></table>

</details>

<details>

<summary><code>inputs</code></summary>

**Назначение**: показания датчиков с устройств

<table><thead><tr><th width="182">Атрибут</th><th>Подробности</th></tr></thead><tbody><tr><td><strong>Ключевые поля</strong></td><td><code>input_id</code>, <code>device_id</code>, <code>device_time</code>, <code>sensor_name</code>, <code>value</code></td></tr><tr><td><strong>Содержимое</strong></td><td>Аналоговые показания (уровень топлива, температура, напряжение), расчетные значения (обороты двигателя)</td></tr><tr><td><strong>Связи</strong></td><td><pre data-overflow="wrap"><code>FROM raw_telematics_data.inputs AS i
JOIN raw_business_data.sensor_description AS sd
    ON i.device_id = sd.device_id AND i.sensor_name = sd.input_label
JOIN raw_telematics_data.tracking_data_core AS tdc
    ON i.device_id = tdc.device_id AND i.device_time = tdc.device_time
</code></pre></td></tr></tbody></table>

</details>

<details>

<summary><code>states</code></summary>

**Назначение**: Индикаторы статуса работы устройств и режимов работы

<table><thead><tr><th width="174.800048828125">Атрибут</th><th>Подробности</th></tr></thead><tbody><tr><td><strong>Основные поля</strong></td><td><code>state_id</code>, <code>device_id</code>, <code>device_time</code>, <code>state_name</code>, <code>value</code></td></tr><tr><td><strong>Содержимое</strong></td><td>Индикаторы режима работы (работает, холостой ход, выключено), статусы компонентов (зажигание, двери)</td></tr><tr><td><strong>Формат значения</strong></td><td>Логические значения (1/0) или специальные коды состояния</td></tr></tbody></table>

</details>

<details>

<summary><code>additional_data</code></summary>

**Назначение**: дискретные состояния входных/выходных сигналов и другие нестандартные данные устройства

<table><thead><tr><th width="174.800048828125">Атрибут</th><th>Подробности</th></tr></thead><tbody><tr><td><strong>Ключевые поля</strong></td><td><code>device_id</code>, <code>device_time</code>, <code>platform_time</code>, <code>discrete_inputs</code>, <code>discrete_outputs</code></td></tr><tr><td><strong>Первичный ключ</strong></td><td>Составной: <code>(device_id, discrete_inputs, discrete_outputs, device_time)</code></td></tr><tr><td><strong>Содержимое</strong></td><td>Каждое из значений <code>discrete_inputs</code> и <code>discrete_outputs</code> представляет собой битовую строку, в которой каждому входному или выходному каналу соответствует один символ (например, <code>"10110001"</code>), где <code>1</code> означает «включено», а <code>0</code> означает «выключено»</td></tr><tr><td><strong>Особые примечания</strong></td><td><code>special_jsonb</code> является зарезервированным столбцом для будущих данных устройства и в настоящее время не заполняется. Эта таблица передает данные в <code>processed_common_data.input_change_events</code>. См. <a href="https://navixy.com/docs/analytics/ru/iot-query/schema-overview/transformation-layer/common-transformations/input-change-events.md">События изменения входов</a></td></tr></tbody></table>

</details>

Данные в этой схеме поступают напрямую с устройств с минимальной задержкой (обычно несколько секунд). Схема оптимизирована для данных временных рядов с использованием TimescaleDB, что обеспечивает эффективное хранение и извлечение данных.

## Дополнительная информация

### Проверка данных

Целостность данных в базе обеспечивается несколькими механизмами:

* **Ограничения CHECK** проверяют, что значения находятся в допустимых пределах
* **Внешние ключи** обеспечивают согласованность связей между таблицами
* **Ограничения NOT NULL** гарантируют, что обязательные поля всегда содержат значения
* **Значения DEFAULT** используются по умолчанию, если данные не указаны явно

### Оптимизация запросов

Таблицы организованы с применением определенных стратегий индексирования:

* Во всех таблицах есть **индексы по времени** для `record_added_at`
* Для столбцов внешних ключей предусмотрены отдельные индексы, повышающие производительность соединений
* Для часто используемых комбинаций столбцов предусмотрены **составные индексы**
* TimescaleDB предоставляет специализированные индексы для запросов к данным временных рядов


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://navixy.com/docs/analytics/ru/iot-query/schema-overview/bronze-layer/raw-telematics-data.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
