gitea d10b1d263f Add selector nomenclature for conditional field visibility
A selector is a nomenclature whose value decides which other nomenclatures
appear beneath it: picking "Ship" reveals the ship fields, "Warehouse"
reveals the warehouse ones. Previously every vehicle nomenclature rendered
at once, so the operator had to know which were relevant and a vehicle
could silently carry both a ship and a warehouse.

Visibility is one rule - a nomenclature is hidden if some selector option
reveals it and that selector's value is not the revealing option - kept in
nomenclatures/visibility.py and mirrored in services/nomenclatureVisibility.js.
A nomenclature no selector references always shows, so installations without
selectors are unchanged.

The serializer, not the UI, enforces the invariant: a value for a hidden
nomenclature is rejected, as is a selector value that matches no option.
The frontend clearing values on switch and pruning hidden keys before save
is convenience on top of that.

Selector values join lookups in the quick-fill combination projection, so
applying a saved combination sets the source and its revealed fields in one
click rather than collapsing "Ship + cargo" and "Warehouse + cargo" into
one indistinguishable row.

Configuration rejects nesting (a selector revealing another selector) and
double-reveal (one nomenclature revealed by two selectors, leaving its
visibility ambiguous). The admin UI filters both out of the reveal list as
well, so an invalid configuration cannot be built in the first place.

Note: introducing a selector over existing data hides values already
entered - vehicles predating the selector have no selector key, so anything
it reveals becomes invisible until a source is chosen. The values remain
stored. Worth a data check before configuring the first selector.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-18 19:43:13 +03:00
2026-02-21 19:53:04 +02:00
2026-02-24 00:13:56 +02:00
2026-02-24 00:13:56 +02:00
2026-02-21 19:53:04 +02:00

ScalesApp - Multi-Component Application

A distributed application consisting of three main components:

Architecture

1. Frontend (React)

  • Location: /frontend
  • Description: React web application that displays real-time data from the serial port
  • Communicates with: Django backend via REST API
  • Port: 3000 (default)

2. Backend (Django)

  • Location: /backend
  • Description: Django REST API server for storing and retrieving serial data
  • Database: SQLite (configurable)
  • Port: 8000 (default)

3. Serial Bridge (Python)

  • Location: /serial_bridge
  • Description: Python application that reads data from COM ports
  • Features: System tray integration, runs as EXE (via PyInstaller)
  • Communicates with: Django backend via REST API
  • Data Flow: COM Port → Serial Bridge → Django Backend → React Frontend

Installation & Setup

Prerequisites

  • Node.js 16+ (for React)
  • Python 3.8+ (for Django and Serial Bridge)
  • pip or conda for Python packages

Quick Start

  1. Backend Setup

    cd backend
    python -m venv venv
    venv\Scripts\activate
    pip install -r requirements.txt
    python manage.py migrate
    python manage.py runserver
    
  2. Frontend Setup

    cd frontend
    npm install
    npm start
    
  3. Serial Bridge Setup

    cd serial_bridge
    python -m venv venv
    venv\Scripts\activate
    pip install -r requirements.txt
    python app.py
    

Data Flow

COM Port
   ↓
Serial Bridge (Python)
   ↓
Django Backend REST API
   ↓
React Frontend

Configuration

Each component has its own configuration file:

  • Frontend: .env
  • Backend: settings.py and .env
  • Serial Bridge: config.py and .env

Development Tips

  • Keep all three services running during development
  • Use CORS headers properly in Django for frontend requests
  • Serial Bridge should continuously read COM data and POST to backend
  • Frontend should poll/subscribe to backend for updates
S
Description
VehicleScales app with Django and React. It has a python service reading from comport and forwarding data to frontend via sse
Readme 4.3 MiB
Languages
JavaScript 62.1%
Python 23.8%
CSS 13.8%
Dockerfile 0.1%