# nixhantb/neural-machine-translated-communication-system architecture

> Architecture diagram of the GitHub repository nixhantb/neural-machine-translated-communication-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nixhantb/neural-machine-translated-communication-system
- Repository: https://github.com/nixhantb/neural-machine-translated-communication-system

## Overview

This is a Django chat application coupled to a Spanish–English neural machine translation model. A sender enters or joins a room, submits a message, and the chat view translates it before saving it; clients can then retrieve room messages. The README also describes an encoder–decoder translation model, attention, and model training. Training and inference internals are represented from sampled model files, but the web integration module `final_test.py` was not provided, so its internal wiring is not expanded.

Main entry points: [`src/model/training.py`](https://github.com/nixhantb/neural-machine-translated-communication-system/blob/main/src/model/training.py) (Model training), [`src/nmt_chat/chatapp/views.py`](https://github.com/nixhantb/neural-machine-translated-communication-system/blob/main/src/nmt_chat/chatapp/views.py) (Chat views), [`src/model/translate.py`](https://github.com/nixhantb/neural-machine-translated-communication-system/blob/main/src/model/translate.py) (Translation inference), [`src/model/decoder.py`](https://github.com/nixhantb/neural-machine-translated-communication-system/blob/main/src/model/decoder.py) (Attention decoder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Chat web app"]
  node_routes["URL routing<br/>[urls.py]"]
  node_views["Chat views<br/>[views.py]"]
  node_home["Home page<br/>[home.html]"]
  node_roompage["Room page<br/>[room.html]"]
end

subgraph group_state["Chat state"]
  node_models["Room and messages<br/>[models.py]"]
  node_sqlite[("SQLite database<br/>[settings.py]")]
end

subgraph group_model["Translation model"]
  node_integration["Model integration<br/>[final_test.py]"]
  node_translation["Translation inference<br/>[translate.py]"]
  node_encoder["Encoder<br/>[encoder.py]"]
  node_decoder["Attention decoder<br/>[decoder.py]"]
  node_attention["Bahdanau attention<br/>[encodeFunction.py]"]
end

subgraph group_training["Model preparation"]
  node_preprocess["Text preprocessing<br/>[preprocess.py]"]
  node_dataset["Dataset creation<br/>[create_dataset.py]"]
  node_padding["Token padding<br/>[tokenspad.py]"]
  node_split["Train test data"]
  node_trainingloop["Model training<br/>[training.py]"]
end

node_sender(("Chat user"))

node_sender -->|"sends requests"| node_routes
node_routes -->|"routes to"| node_views
node_views -->|"renders"| node_home
node_views -->|"renders"| node_roompage
node_views -->|"reads and writes"| node_models
node_models -.->|"persists records"| node_sqlite
node_views -->|"calls translate"| node_integration
node_trainingloop -->|"imports"| node_translation
node_translation -->|"encodes input"| node_encoder
node_translation -->|"generates tokens"| node_decoder
node_trainingloop -->|"trains"| node_encoder
node_trainingloop -->|"trains"| node_decoder
node_decoder -->|"uses"| node_attention
node_trainingloop -->|"imports"| node_preprocess
node_trainingloop -->|"imports"| node_dataset
node_trainingloop -->|"imports"| node_padding
node_trainingloop -->|"imports"| node_split

click node_routes "https://github.com/nixhantb/neural-machine-translated-communication-system/blob/main/src/nmt_chat/chatapp/urls.py"
click node_views "https://github.com/nixhantb/neural-machine-translated-communication-system/blob/main/src/nmt_chat/chatapp/views.py"
click node_home "https://github.com/nixhantb/neural-machine-translated-communication-system/blob/main/src/nmt_chat/templates/home.html"
click node_roompage "https://github.com/nixhantb/neural-machine-translated-communication-system/blob/main/src/nmt_chat/templates/room.html"
click node_models "https://github.com/nixhantb/neural-machine-translated-communication-system/blob/main/src/nmt_chat/chatapp/models.py"
click node_sqlite "https://github.com/nixhantb/neural-machine-translated-communication-system/blob/main/src/nmt_chat/nmt_chat/settings.py"
click node_integration "https://github.com/nixhantb/neural-machine-translated-communication-system/blob/main/src/model/final_test.py"
click node_translation "https://github.com/nixhantb/neural-machine-translated-communication-system/blob/main/src/model/translate.py"
click node_encoder "https://github.com/nixhantb/neural-machine-translated-communication-system/blob/main/src/model/encoder.py"
click node_decoder "https://github.com/nixhantb/neural-machine-translated-communication-system/blob/main/src/model/decoder.py"
click node_attention "https://github.com/nixhantb/neural-machine-translated-communication-system/blob/main/src/model/encodeFunction.py"
click node_preprocess "https://github.com/nixhantb/neural-machine-translated-communication-system/blob/main/src/model/preprocess.py"
click node_dataset "https://github.com/nixhantb/neural-machine-translated-communication-system/blob/main/src/model/create_dataset.py"
click node_padding "https://github.com/nixhantb/neural-machine-translated-communication-system/blob/main/src/model/tokenspad.py"
click node_split "https://github.com/nixhantb/neural-machine-translated-communication-system/blob/main/src/model/train_test_creation.py"
click node_trainingloop "https://github.com/nixhantb/neural-machine-translated-communication-system/blob/main/src/model/training.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_routes,node_views,node_home,node_roompage,node_sender toneBlue
class node_models,node_sqlite toneAmber
class node_integration,node_translation,node_encoder,node_decoder,node_attention toneMint
class node_preprocess,node_dataset,node_padding,node_split,node_trainingloop toneRose
```

## Components

### Chat web app

- [URL routing](https://github.com/nixhantb/neural-machine-translated-communication-system/blob/main/src/nmt_chat/chatapp/urls.py): `src/nmt_chat/chatapp/urls.py`
- [Chat views](https://github.com/nixhantb/neural-machine-translated-communication-system/blob/main/src/nmt_chat/chatapp/views.py): `src/nmt_chat/chatapp/views.py`
- [Home page](https://github.com/nixhantb/neural-machine-translated-communication-system/blob/main/src/nmt_chat/templates/home.html): `src/nmt_chat/templates/home.html`
- [Room page](https://github.com/nixhantb/neural-machine-translated-communication-system/blob/main/src/nmt_chat/templates/room.html): `src/nmt_chat/templates/room.html`

### Chat state

- [Room and messages](https://github.com/nixhantb/neural-machine-translated-communication-system/blob/main/src/nmt_chat/chatapp/models.py): `src/nmt_chat/chatapp/models.py`
- [SQLite database](https://github.com/nixhantb/neural-machine-translated-communication-system/blob/main/src/nmt_chat/nmt_chat/settings.py): `src/nmt_chat/nmt_chat/settings.py`

### Translation model

- [Model integration](https://github.com/nixhantb/neural-machine-translated-communication-system/blob/main/src/model/final_test.py): `src/model/final_test.py`
- [Translation inference](https://github.com/nixhantb/neural-machine-translated-communication-system/blob/main/src/model/translate.py): `src/model/translate.py`
- [Encoder](https://github.com/nixhantb/neural-machine-translated-communication-system/blob/main/src/model/encoder.py): `src/model/encoder.py`
- [Attention decoder](https://github.com/nixhantb/neural-machine-translated-communication-system/blob/main/src/model/decoder.py): `src/model/decoder.py`
- [Bahdanau attention](https://github.com/nixhantb/neural-machine-translated-communication-system/blob/main/src/model/encodeFunction.py): `src/model/encodeFunction.py`

### Model preparation

- [Text preprocessing](https://github.com/nixhantb/neural-machine-translated-communication-system/blob/main/src/model/preprocess.py): `src/model/preprocess.py`
- [Dataset creation](https://github.com/nixhantb/neural-machine-translated-communication-system/blob/main/src/model/create_dataset.py): `src/model/create_dataset.py`
- [Token padding](https://github.com/nixhantb/neural-machine-translated-communication-system/blob/main/src/model/tokenspad.py): `src/model/tokenspad.py`
- [Train test data](https://github.com/nixhantb/neural-machine-translated-communication-system/blob/main/src/model/train_test_creation.py): `src/model/train_test_creation.py`
- [Model training](https://github.com/nixhantb/neural-machine-translated-communication-system/blob/main/src/model/training.py): `src/model/training.py`

### Other components

- **Chat user**

## Connections

- Chat user → URL routing: sends requests (evidence: `src/nmt_chat/chatapp/urls.py`)
- URL routing → Chat views: routes to (evidence: `src/nmt_chat/chatapp/urls.py`)
- Chat views → Home page: renders (evidence: `src/nmt_chat/chatapp/views.py`)
- Chat views → Room page: renders (evidence: `src/nmt_chat/chatapp/views.py`)
- Chat views → Room and messages: reads and writes (evidence: `src/nmt_chat/chatapp/views.py`)
- Room and messages → SQLite database: persists records (evidence: `src/nmt_chat/nmt_chat/settings.py`)
- Chat views → Model integration: calls translate (evidence: `src/nmt_chat/chatapp/views.py`)
- Model training → Translation inference: imports (evidence: `src/model/translate.py`)
- Translation inference → Encoder: encodes input (evidence: `src/model/translate.py`)
- Translation inference → Attention decoder: generates tokens (evidence: `src/model/translate.py`)
- Model training → Encoder: trains (evidence: `src/model/training.py`)
- Model training → Attention decoder: trains (evidence: `src/model/training.py`)
- Attention decoder → Bahdanau attention: uses (evidence: `src/model/decoder.py`)
- Model training → Text preprocessing: imports (evidence: `src/model/training.py`)
- Model training → Dataset creation: imports (evidence: `src/model/training.py`)
- Model training → Token padding: imports (evidence: `src/model/training.py`)
- Model training → Train test data: imports (evidence: `src/model/training.py`)
