---
title: 'Basic modules overview'
section: 'Concepts'
weight: 1
related:
  - basic-modules/advantages
  - architecture/abstract-data-layer
  - basic-modules
  - equipment/equipment-types
---

In the IIoT Platform, data is organized as tables, which can be classified according to the main data representation modules.

These modules describe how raw measurements, the devices that produce them, the communication sessions during which they are collected, and the reference data that categorizes them all fit together. The tables below detail the key fields of each module and the foreign keys that link them.

## Data archives

Data archives 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 each record with equipment, sessions, channels, and units through foreign keys. This lets the data be classified by the specified attributes for further analysis and processing.

- `equipment_id` refers to the `equipment` table.
- `seance_id` refers to the `seances` table.
- `channel_id` refers to the `channels` table.
- `unit_id` refers to the `units` table.
- `archive_type_id` refers to the `referenceparameters` table.

## Metering units

The `equipment` table stores information about the equipment 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 and the dates of manufacture and installation;
- uses the `program_version` field to track the version of the software installed on the equipment;
- uses the `created_at` and `updated_at` fields to track changes in equipment data;
- is linked to other tables, such as `equipment_types`, `channel_data`, and `channels`, through foreign keys;
- lets you add, update, and retrieve information about equipment in the system.

The data view module based on the `equipment` table enables 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 stores 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;
- managing session-related data (for example, event time, session status, signal strength, and battery power);
- analyzing sessions to identify problems or optimize system performance;
- session status management: the `state` field lets you monitor the session status (for example, successful, error, and so on);
- session analysis: the `duration_session` and `session_traffic` fields let you analyze the duration and volume of session traffic;
- change tracking: the `created_at` and `updated_at` fields let you track changes in session data.

## Archive types

The `archive_type_id` attribute categorizes data in the `channel_data` table by archive type. This lets data 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.

This module is built on 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 archive type.                    |
| `varname`           | `character varying(30)`          | Short variable name for the archive type.        |
| `description`       | `character varying(100)`         | Description of the archive type.                 |
| `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 lets you 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'],
    ...
  ]
]
```

If necessary, these archives can be organized into groups:

- current data (`current_state`) — readings at the moment of the communication session;
- aggregated data (`hourly`, `daily`, `monthly`) — summary readings for a certain period of time;
- events and abnormal situations (`nesht`, `event`) — 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`) — records of commands or actions performed to control the system or equipment;
- and so on.

The `archive_type_id` data representation module lets you efficiently categorize data into archive types and manage reference information. It provides:

- classification of data in the `channel_data` table;
- management of reference information about archive types;
- analysis of data by archive type.
