How ai-hackathon-2025/scarecrow works
Project Type and Purpose
• This project is a full-stack Django web application. The “scarecrowApp” directory (with files such as settings.py, urls.py, asgi.py, and wsgi.py) clearly indicates a Django configuration for the web frontend and backend.
• The “disease_detector” package contains domain-specific logic for analyzing crops, classifying images (likely to detect diseases), and recommending crop-related actions. It includes modules for model training (Jupyter notebooks), a crop analyser, and pre-trained machine learning models (stored as .pkl, .joblib files).
• The project combines web application functionalities (serving front-end pages, static files, and Django views) with machine learning components for processing crop data and images.
File Structure
• Top-Level Files and Directories:
• .gitignore, README.md, manage.py, and requirement.txt: Standard files for project management and dependency tracking.
• The "scarecrowApp" directory: Contains the Django project configuration and routing files (ASGI, WSGI, settings, and URL configurations).
• The "disease_detector" package: It comprises application logic, analysis scripts (crop_analyser.py and image_classifier_code.py), model training notebooks, and pre-built models stored in the models subdirectory.
• "static" and "templates": Directories for the frontend – CSS, JavaScript, and HTML files that render the UI.
• Additional notebooks in "model_traning" that reinforce the focus on model training and evaluation.
• Architectural Aspects:
• The separation between “scarecrowApp” and “disease_detector” suggests modularization where the Django app serves as the orchestration layer, and the disease_detector module provides domain-specific ML logic.
• The presence of Jupyter notebooks suggests an exploratory and iterative process for model training and evaluation.
Detail the Components
• Frontend Component:
• Templates (HTML files) and Static Files (CSS & JavaScript) that build the user interface.
• This component handles user interactions and displays results from the backend.
• Backend Component – Django Application (“scarecrowApp”):
• Acts as the central coordinator taking HTTP requests, routing them appropriately, and delivering responses.
• Contains URL configurations, settings, middleware, and interfaces with the domain logic.
• Domain Logic / Business Layer – Disease Detector:
• This package includes:
◦ Crop Analyser: Code responsible for analyzing crop images or data.
◦ Image Classifier: Functions to classify images to detect diseases.
◦ Model Training Scripts: Jupyter notebooks and training modules for building/updating machine learning models.
◦ Pre-trained Models: Stored serialized models and encoders (such as crop recommendation model, label encoder, paddy image classifier) that are loaded for inference.
• Relationship: The Django backend (views, controllers) invokes functions in the disease_detector to process data, predict outcomes, and then return findings to the user.
• Data Store / Dataset:
• CSV files (like Crop_recommendation.csv) that serve as data input for crop recommendation.
• Serve as a reference used during prediction or additional analysis.
• Deployment & Infrastructure:
• The manage.py file and configuration files in scarecrowApp indicate how the project is executed and deployed (using Django’s ASGI/WGSI).
Establish Relationships and Interactions
• Data Flow:
• User Request: A user interacts with the frontend (via the browser), making an HTTP request.
• Django Routing: The request is received by the Django application (scarecrowApp) and routed to the appropriate view.
• Business Logic Invocation: The view calls functions in the disease_detector package to perform image classification, crop analysis, or model inference.
• Data Retrieval/Processing: If necessary, the disease_detector accesses data files (e.g., Crop_recommendation.csv) or loads pre-trained models.
• Response: The results are sent back through Django views, rendered in templates, and finally displayed on the user interface.
• Dependencies between modules: