How ldgss/laudos works
Project type and purpose
• This is a full‑stack, monolithic web application (“sistema de laudos”) built with Python and Flask.
• Its purpose is to manage “laudos” (reports) for mercadería and hojalata, including access control, blocking/unblocking, inventory, labeling, reporting, etc.
File structure
• Top‑level entrypoint: app.py
• “routes/” directory: each module is a controller (Flask blueprint) for one domain (acceso, mercaderia, hojalata, etc.).
• “models/” directory: each file encapsulates data access for a domain entity (mod_login, mod_reporte, mod_insumos, etc.).
• “static/” and “templates/”: frontend assets (CSS, JS, images, sound) and Jinja2 templates for each view.
• “db/db.py”: database connection logic (PostgreSQL via psycopg2 and/or SQL‑Server via msodbcsql).
• “utils/”: helpers and token utilities.
• Config/backups in “db/” and tests in “tests/”.
Extract README insights
• Stack: Python, Flask, PostgreSQL, SQL‑Server (via ODBC driver).
• Development: VS Code, Git branching strategy.
Components
a. Client Layer
• Web Browser
• Static assets: CSS, JavaScript, images, sounds
b. Web Server Layer
• Flask App (app.py)
• Blueprints/Routes (routes/*.py) – handle HTTP requests, authentication, authorization
• Template Engine (Jinja2) renders HTML
c. Business Logic Layer
• Models (models/*.py) – ORM/data‑access modules
• Utility modules (utils/helpers.py, utils/tokens.py)
d. Data Layer
• Primary Database: PostgreSQL
• External Data Source: SQL‑Server (ODBC driver msodbcsql)
• DB backups stored under “db/”
e. Infrastructure & Dev
• Version Control (Git)
• Local Dev Environment (VS Code, Python interpreter)
Relationships and interactions
• Browser → (HTTP GET/POST) → Flask Routes
• Routes → Models → Database(s)
• Models → (SQL via psycopg2/ODBC) → PostgreSQL / SQL‑Server
• Routes → Templates & Static → Browser
• Utilities invoked by controllers and models
• Tests hitting Routes/Models directly
Architectural patterns and design principles
• MVC (Model‑View‑Controller) separation
• Blueprint‑based modularization for domain separation
• Single codebase → monolith, no microservices
• Layered architecture: Presentation → Application → Data
Essential elements
• Client vs. Server vs. Database
• Internal modules vs. external services
• Callouts for special modules (e.g., utils/tokens for JWT or session management)