---
title: Basic modules overview
description: The core data tables behind the platform — channel_data archives, equipment, seances sessions and archive-type reference parameters.
weight: 1
---

In the "Global Secure IoT Platform", data is organized in the form of tables, which can be classified according to the main data representation modules.

## Data Archives

Data archives in the system store historical information such as IoT device metrics, equipment data, and other measurements. The main table for storing archive data is `channel_data`.

| Field             | Type                             | Description                                        |
| ----------------- | -------------------------------- | -------------------------------------------------- |
| `id`              | `bigint`                         | Unique record identifier (primary key).            |
| `equipment_id`    | `bigint`                         | Reference to equipment (`equipment.id`).           |
| `seance_id`       | `bigint`                         | Reference to session (`seances.id`).               |
| `channel_id`      | `bigint`                         | Reference to channel (`channels.id`).              |
| `unit_id`         | `bigint`                         | Reference to unit of measurement (`units.id`).     |
| `archive_type_id` | `integer`                        | Archive type reference (`referenceparameters.id`). |
| `event_time`      | `integer`                        | The time of the event (eg timestamp).              |
| `value`           | `character varying(100)`         | The value received from the channel.               |
| `created_at`      | `timestamp(6) without time zone` | Time when the record was created.                  |
| `updated_at`      | `timestamp(6) without time zone` | Time when the record was last updated.             |

This table stores data received from equipment channels and associates them with equipment, sessions, channels, and units through external keys, which allows the data to be classified according to specified attributes for further data analysis and processing.

- `equipment_id` refers to the table `equipment`.
- `seance_id` refers to the table `seances`.
- `channel_id` refers to the table `channels`.
- `unit_id` refers to the table `units`.
- `archive_type_id` refers to the table `referenceparameters`,

## Metering devices

The `equipment` table is used to store information about the equipment that is used in the system. This module is key to managing data associated with physical devices such as meters, sensors, controllers, and other types of equipment.

| Field               | Type                             | Description                                    |
| ------------------- | -------------------------------- | ---------------------------------------------- |
| `id`                | `bigint`                         | Unique identifier of the record (primary key). |
| `equipment_type_id` | `bigint`                         | Reference to the equipment type.               |
| `serial_number`     | `character varying(25)`          | Serial number of the equipment.                |
| `manufacture_date`  | `timestamp(6) without time zone` | The date of manufacture of the equipment.      |
| `installation_date` | `timestamp(6) without time zone` | Installation date of the equipment.            |
| `program_version`   | `character varying(100)`         | Software version of the equipment.             |
| `created_at`        | `timestamp(6) without time zone` | Time when the record was created.              |
| `updated_at`        | `timestamp(6) without time zone` | Time when the record was last updated.         |

The `equipment` table:

- stores basic data about the equipment, such as serial number, date of manufacture and installation;
- the `program_version` field allows tracking the version of the software installed on the equipment;
- the `created_at` and updated_at fields allow tracking changes in equipment data.
- linked to other tables such as `equipment_types`, `channel_data` and `channels` through foreign keys.
- allows you to add, update and retrieve information about equipment in the system.

The `equipment` table based data view module allows efficient management of equipment information in the system.

It provides:

- Storage of basic equipment data.
- Software version management.
- Communication with other entities in the system.

## Communication Sessions

The `seances` table is used to store information about communication sessions and equipment activity. Sessions represent periods of activity during which data is exchanged between the equipment and the system. This module is key to managing and analyzing data associated with communication sessions.

Let's take a closer look at this module.

| Field          | Type                             | Description                                    |
| -------------- | -------------------------------- | ---------------------------------------------- |
| `id`           | `bigint`                         | Unique identifier of the record (primary key). |
| `telemetry_id` | `bigint`                         | Reference to telemetry (`telemetry.id`).       |
| `event_time`   | `integer`                        | The time of the event.                         |
| `evtid`        | `smallint`                       | The identifier of the event.                   |
| `trycnt`       | `smallint`                       | The number of attempts.                        |
| `tryfl`        | `character varying(12)`          | The flag of the attempt.                       |
| `state`        | `smallint`                       | Session status.                                |
| `btm`          | `integer`                        | Battery charge.                                |
| `rssi`         | `integer`                        | Signal strength (if used).                     |
| `created_at`   | `timestamp(6) without time zone` | Time when the record was created.              |
| `updated_at`   | `timestamp(6) without time zone` | Time when the record was last updated.         |

The `seances` module is used for:

- Storing information about communication sessions and equipment operation.
- Manage session-related data (e.g., event time, session status, signal strength, battery power).
- Analyzing sessions to identify problems or optimize system performance.
- Session status management: the `state` field allows you to monitor the session status (e.g., successful, error, etc.).
- Session analysis: the `duration_session` and `session_traffic` fields allow you to analyze the duration and volume of session traffic.
- Change tracking: the `created_at` and `updated_at` fields allow you to track changes in session data.

## Archive Types

The `archive_type_id` attribute is used to categorize data in the `channel_data` table by archive type. This allows data to be organized into different categories such as hourly, daily, monthly, abnormal situations and other archive types.The `referenceparameters` table stores reference information about archive types.

The basis for this module is the relationship between the `channel_data` and `referenceparameters` tables.

| Field               | Type                             | Description                                      |
| ------------------- | -------------------------------- | ------------------------------------------------ |
| `id`                | `bigint`                         | Unique identifier of the record (primary key).   |
| `name`              | `character varying(30)`          | The name of the unit of measure.                 |
| `varname`           | `character varying(30)`          | Short variable name for the unit of measure.     |
| `description`       | `character varying(100)`         | Description of the unit of measurement.          |
| `parent_id`         | `integer`                        | A reference to the parent parameter (hierarchy). |
| `referencemodel_id` | `integer`                        | Reference to the directory model.                |
| `created_at`        | `timestamp(6) without time zone` | Time when the record was created.                |
| `updated_at`        | `timestamp(6) without time zone` | Time when the record was last updated.           |
| `deleted_at`        | `timestamp(6) without time zone` | Time when the record was deleted (soft delete).  |

The `archive_type_id` field in the `channel_data` table allows you to categorize data by archive type.

For example:

```ruby
[ 'Archive types', 'archive_types', 'Archive types (hourly, daily, monthly)',
  [
    ['Hourly readings archive', 'hourly'],
    ['Daily readings archive', 'daily'],
    ['Monthly readings archive', 'monthly'],
    ['Emergency situations archive', 'nesht'],
    ['Events archive', 'event'],
    ['Valve status', 'valve'],
    ['Current state', 'current_state'],
    ['Updated firmware', 'update_app'],
    ['Send SMS', 'send_sms'],
    ['Send JSON', 'send_json'],
    ...
  ]
]
```

Specified archives, if necessary, can be grouped into groups:

- current data (`current_state`) - indicators at the moment of communication session;
- aggregated data (`hourly`, `daily`, `monthly`) - summary indicators for a certain period of time;
- events and abnormal situations (`nesht`, `event`) are records of significant changes or occurrences in the system. They may be related to equipment, users or external factors.
- valve status (`valve`)-the state and control of the meter valve, if any;
- control actions (`update_app`, `send_sms`, `send_json`) are records of commands or actions that have been performed to control the system or equipment.
- etc.

The `archive_type_id` data representation module allows you to efficiently categorize data into archive types and manage reference information. It provides:

- Classification of data in the `channel_data` table.
- Managing reference information about archive types.
- Analyzing data by archive type.
