How faithmutua-code/agri-verify-gmo-website works
Project Type & Purpose
• AgriVerify is a monolithic, full-stack Django web application.
• Purpose: Provide GMO product verification (QR scanning, code entry, image upload), AI chatbot for queries, USSD access, educational content, and quizzes.
• Key indicators:
• Django “gmo” project folder + “base” app
• Templates under base/templates
• Staticfiles collected under “staticfiles”
• mqtt.py for USSD/MQTT integration
• server.py entry point for USSD sandbox
File Structure
• Top-level directories:
• gmo/ – Django project config (settings, URLs, wsgi/asgi)
• base/ – Core Django app (models, views, URLs, templates, migrations)
• staticfiles/ – Collected CSS/JS assets for admin & UI themes
• media/ – Uploaded assets (product images, QR codes, videos, resources)
• Other files:
• manage.py – Django CLI entry
• mqtt.py – USSD gateway integration via MQTT
• server.py – USSD sandbox server
• db.sqlite3 – Primary datastore
• Pipfile/requirements.txt – Dependencies
Extract Insights from README
• Frontend: HTML5, Tailwind CSS, JavaScript
• Backend: Django + Python
• Database: SQLite
• Features & external integrations:
• AI Chatbot (likely external ML/AI API)
• USSD Access (via MQTT broker)
• QR code generator & scanner (internal or third-party lib)
• Media/video streaming
Main Components
• Presentation Layer:
• Web Browser / Mobile Browser
• Static Assets (CSS/JS) served from Django staticfiles
• Application Layer:
• Django Web Server (Django app + Gunicorn/uWSGI)
• REST/API Endpoints (views in base/views.py)
• USSD Server (server.py)
• MQTT Client (mqtt.py)
• Data Layer:
• SQLite Database
• File Storage (media/ directory)
• External Services:
• AI Chatbot API (e.g., OpenAI or custom ML service)
• USSD Gateway / MQTT Broker
• Optional: Email/SMS service (if implemented for notifications)
Relationships & Data Flow
• Browser → Django Web Server
• Requests for pages (login, dashboard, product detail, quiz)
• AJAX calls to verification endpoints
• Django Web Server ↔ SQLite
• ORM queries for users, products, chat messages, quiz results
• Django Web Server → File Storage
• Upload/retrieve images, videos, QR code assets
• Django Web Server ↔ External AI Service
• Forward user questions, receive chatbot responses
• USSD Server ↔ MQTT Broker
• Publish/subscribe messages to provide USSD menu interactions
• Staticfile Server (Django or CDN) → Browser
• Delivers CSS/JS assets
Architectural Patterns & Design Principles
• MVC (Model-View-Template) inherent in Django
• Layered architecture separating presentation, application logic, data
• Event-driven USSD via MQTT (pub/sub)
• Use of media directory as simple object store
Detail Is Key
• Django apps/routes (e.g., /login, /quiz, /product-verify).
• Staticfiles host (could be same server or CDN).
• Separate media store folder.
• Call out the mqtt.py script as the bridge between the USSD sandbox and Django backend.
• That server.py runs the USSD sandbox locally.