How pnv2003/yolo-farm works
Main Components
• Mobile Client (React Native/Expo): Representing the mobile app interface which is segregated in the “client” directory. Break down key components such as:
• UI Components (controllers, screens, layouts, navigation)
• Utility modules handling API calls, MQTT handling, and configuration.
• Server (Express.js Application): Located in the “server” folder comprising:
• API Gateway and Routing Layers – routes for air humidity, lighting, temperature, watering, disease detection, etc.
• Controllers that manage business logic for sensors and devices.
• Database Access – interaction with MongoDB (as seen in the configuration files and “db.js”).
• Python AI/ML Module – shown in the “AI-Model/diseaseDetection” folder. This component leverages pre-trained models (ResNet50 based) for leaf disease classification.
• External Integrations – configuration for Adafruit IO (in server/config/adafruit.js and client/config/account.js) facilitating IoT connectivity.
• Database Server (MongoDB): As noted in the server configuration, this component stores system data.
• External Services: Such as Adafruit IO for sensor data and possibly other IoT or messaging protocols (notably via MQTT as seen in client/utils/mqtt.js).
Relationships and Data Flow
• The Server has multiple responsibilities:
• It handles device control and sensor data submissions (through controllers).
• It communicates with the MongoDB database for persistent storage.
• It invokes the Python AI module for processing images to diagnose leaf diseases. This can be depicted as a separate module interfaced via REST (if using a FastAPI wrapper) or through direct invocation.
• It handles external IoT interactions (sending or receiving data from Adafruit IO).
• Data flows such as user actions (e.g., scheduling or controlling devices) on the mobile client trigger API calls to the server, which then updates MongoDB, instructs hardware (via Adafruit IO), and possibly performs AI inference when needed.
Architectural Patterns and Design Principles
• MVC-like Separation on the Server: Controllers, models, and routes are clearly laid out.
• Modular design: The client’s modular components (e.g., sensors control, voice recognition) and the server’s separation between API routes, controllers, models, and AI modules.
• Integration of Heterogeneous Technologies: Node.js for API management alongside Python for machine learning. Highlight the method of interoperation (e.g., if REST endpoints or microservices architecture is used).
• Event-driven or asynchronous flows (especially for IoT data flows via MQTT/Adafruit IO).
Relevant Technologies and Frameworks
• On the Client: React Native, Expo, JavaScript, MQTT.
• On the Server: Express.js, Node.js, Python (including libraries like PyTorch/TensorFlow), FastAPI (if used as a wrapper for the AI module), and MongoDB.
• External and IoT: Adafruit IO and possibly MQTT protocols.
Additional Recommendations
• That any configuration files (such as account and connection configs) are noted as part of the integration layer that ties together external services.
• Optionally, indicate the flow of voice recognition events (from the client’s VoiceRecognition screen to the server’s processing pipeline if applicable).