> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wavecentric.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Nodes - Nodi

> Physical and logical network topology

## 1. Overview

The **Nodes** (Nodi) registry defines the physical and logical infrastructure of the network. It includes terminals, railway stations, maritime ports, and warehouses.

Nodes are the foundational building blocks for **Services**, **Traces**, and **Connections**, acting as the start and end points for all logistics movements.

<img src="https://mintcdn.com/wavecentric/N4bEljzdv1huU6fv/images/magemo/image.png?fit=max&auto=format&n=N4bEljzdv1huU6fv&q=85&s=399a2304848ae075b55257a3de00d617" alt="Gestione Nodi - Nodes Management List" width="1566" height="420" data-path="images/magemo/image.png" />

## 2. Core Functional Pillars

### 1. Geo-Location & Identification

Every node is mapped to international and technical standards:

* **LOCODE**: The UN/LOCODE standard for international shipping, critical for EDI messaging.
* **UIC Code**: The 5-digit station code for rail operations (Codice UIC).
* **GPS Coordinates**: Precise Latitude and Longitude for map visualization in tracking modules.

### 2. Node Services (Servizi di nodo)

Defines the operational capabilities of a terminal.

* **Activity Types**: Shunting, handling, washing, or customs.
* **Service Providers**: Links specific **Subjects** (Soggetti) as authorized contractors.
* **Commercial Info**: Stores contract and quotation references to automate cost estimation.

### 3. Network Connectivity (Collegamenti)

Builds the adjacency graph for the routing engine.

* **Mode-Specific**: Defines links as Road, Rail, or Sea.
* **Logistics Geometry**: Stores technical distances (km) to calculate trip feasibility and estimated transit times.

### 4. Stakeholder Ownership

Every node is linked to its stakeholders:

* **Owner (Proprietario)**: The entity that owns the physical infrastructure.
* **Operator (Gestore)**: The entity responsible for daily operations (Terminal Operator).

## 3. Propagation & Operational Logic

A **Node** is not just a static record; it drives the functional limits of the entire network.

### I. The Routing Engine Gateway

When creating a **Design > Trace**, the system filters valid endpoints based on nodes that have defined `Collegamenti` (Links). If a connection doesn't exist in the Nodes registry, it cannot be used in a commercial Service.

### II. Automated Milestone Triggering

Nodes marked as `is_terminal=1` act as detection zones for the **Monitoring** module. When a GPS coordinate matches the node's `latitudine/longitudine` (plus a defined geofence radius), the system automatically updates the trip status to **Arrivato**.

### III. PCS Integration

The `transcodifiche_id_terminal_pcs` field is the technical key for EDI messaging. When a manifest is sent to a Port Community System, the system uses this ID to ensure the port's software correctly identifies the destined terminal.

## 4. Data Connectivity & Flow

```mermaid theme={null}
graph TD
    subgraph "Inbound"
        LC[LOCODE Registry] --> N[Nodes]
        SOG[Subjects Registry] --> N
        ZON[Zones Registry] --> N
    end
    subgraph "Outbound Propagation"
        N --> DESIGN[Design: Define Traces between Nodes]
        N --> BKG[Booking: Select Load/Unload Points]
        N --> EXE[Execution: Trigger Gate Events]
        N --> MON[Monitoring: Geographic Geofencing]
        N --> ADM[Admin: Calculate Terminal Storage Costs]
    end
```

## 5. Field Mapping Reference

### Registry View (Gestione Nodi)

| Field            | Technical Name | Description                                    | Source        |
| :--------------- | :------------- | :--------------------------------------------- | :------------ |
| **Descrizione**  | `descrizione`  | Full terminal/station name.                    | Manual        |
| **Tipo Nodo**    | `id_tipo_nodo` | Classification (Station, Port, Terminal, etc). | Config Enum   |
| **Luogo**        | `id_luogo`     | Associated LOCODE/Località.                    | LOCODE Master |
| **UIC**          | `codice_uic`   | Railway identifier.                            | Manual        |
| **Stakeholders** | `id_gestore`   | The terminal operator.                         | **Soggetti**  |

### Configuration Tabs (Form)

#### Anagrafica (Core Data)

* **Primary**: `descrizione` (Required), `id_tipo_nodo` (Required).
* **Geography**: `luogo` (LOCODE Link), `id_zona` (Zone Group), `indirizzo`, `cap`.
* **Geo-Precision**: `latitudine`, `longitudine` (Driving GPS logic).

#### Servizi di Nodo (Cost Calculation Engine)

* **Activity**: `sn_id_tipo_attivita` (e.g., Handling, Shunting).
* **Provider**: `sn_id_fornitore` (Linked to **Soggetti**).
* **Quotes**: `sn_rif_contratto` (Link to financial agreements).

#### Collegamenti (The Network Adjacency Matrix)

* **Link Type**: `co_tipo` (Road/Rail/Sea).
* **Target Node**: `co_luogo_collegato`.
* **Metrics**: `co_distanza` (km) used for transit time estimations.

#### Transcodifiche (EDI Sync)

* **EDI/CIM**: `transcodifiche_edi`, `transcodifiche_cim`.
* **External Hubs**: `transcodifiche_id_terminal_pcs` (Used for Port-to-System handshakes).
