# baratam-saiprasoona/zomato-restaurant-listing-searching architecture

> Architecture diagram of the GitHub repository baratam-saiprasoona/zomato-restaurant-listing-searching, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/baratam-saiprasoona/zomato-restaurant-listing-searching
- Repository: https://github.com/baratam-saiprasoona/zomato-restaurant-listing-searching

## Overview

##### Project type and purpose
- This is a small full-stack web application built with a lightweight Python web framework (likely Flask) that loads restaurant data into a database, exposes REST API endpoints for querying, and renders HTML pages for users. It also includes a standalone data‐loading/testing script.

##### File structure
- Top-level files:
- README.md – project description, use cases
- app.py – main web application (API + UI)
- test_import.py – unit test for the loader
- zomato_data.csv & Tomato.restaurants.json – source data
- Directory “templates/” contains Jinja HTML templates:
- restaurant_list.html, restaurant_detail.html, search_results.html, upload.html
- No separate “static” folder implies inline/static links or none.

##### README for additional insights
- Key functions: data loading into a DB, REST API endpoints (get by ID, list with pagination), web pages for listing, detail view, location search, image-based search.
- Optional filters/search by cuisine, country, spend.

##### Main components
a. Data Ingestion Layer
– Script (test_import.py/app.py loader) reads CSV/JSON → writes to relational DB
b. Database
– Relational store (e.g., SQLite/MySQL/Postgres) holding restaurant records
c. Web API Service
– app.py exposes endpoints:
- GET /restaurants/{id}
- GET /restaurants?page=&size=
- GET /search?lat=&lng=&radius=
- POST /image-search (accepts uploaded image)
d. Image-Recognition Service (external or internal ML module)
– Optional component called by the API to classify cuisines from user-uploaded images
e. Web UI (Frontend)
– Jinja templates served by app.py: list, detail, search, upload pages
f. Client (Browser)
– User interacts via HTTP(S) to UI or directly to API

##### Relationships and interactions
- Data Ingestion → Database
- Client Browser → Web UI pages (app.py)
- Web UI → Web API (internal calls)
- Client Browser → API (for AJAX or image upload)
- API → Database (CRUD reads)
- API → Image-Recognition Service (for image search)

##### Architectural patterns & principles
– MVC variant: templates are the View, app.py routes/controllers are the Controller, the Database is the Model
– Single-process monolith bundling API and UI
– Separation of concerns: ETL script decoupled from runtime service
– RESTful interface for programmatic access
– Optional pluggable ML component for extensibility

##### Technologies, frameworks, libraries
– Python 3.x, Flask (or similar)
– Jinja2 (templating)
– pytest or unittest (test_import.py)
– pandas or csv module (data loading)
– SQLAlchemy or direct DB connector
– External ML/cv library or microservice for image classification

## Diagram (Mermaid)

```mermaid
flowchart TD
    Browser["Client Browser"]:::frontend
    subgraph "Full-stack Monolith"
        subgraph "Web UI (Jinja2 Templates)"
            RL["Restaurant List"]:::frontend
            RD["Restaurant Detail"]:::frontend
            SR["Search Results"]:::frontend
            UP["Upload Page"]:::frontend
        end
        API["Flask REST API"]:::backend
    end
    Loader["ETL Script"]:::backend
    CSV["zomato_data.csv"]:::backend
    JSON["Tomato.restaurants.json"]:::backend
    DB["PostgreSQL DB"]:::backend
    IMG["Image Classifier"]:::external

    CSV -->|"read"| Loader
    JSON -->|"read"| Loader
    Loader -->|"write(SQL)"| DB
    Browser -->|"HTTP GET/POST"| RL
    Browser -->|"HTTP GET/POST"| RD
    Browser -->|"HTTP GET/POST"| SR
    Browser -->|"HTTP GET/POST"| UP
    RL -->|"render"| API
    RD -->|"render"| API
    SR -->|"render"| API
    UP -->|"render"| API
    Browser -->|"AJAX/Upload"| API
    API -->|"SQL SELECT"| DB
    API -->|"HTTP JSON"| IMG

    click Loader "https://github.com/baratam-saiprasoona/zomato-restaurant-listing-searching/blob/main/test_import.py"
    click CSV "https://github.com/baratam-saiprasoona/zomato-restaurant-listing-searching/blob/main/zomato_data.csv"
    click JSON "https://github.com/baratam-saiprasoona/zomato-restaurant-listing-searching/blob/main/Tomato.restaurants.json"
    click API "https://github.com/baratam-saiprasoona/zomato-restaurant-listing-searching/blob/main/app.py"
    click RL "https://github.com/baratam-saiprasoona/zomato-restaurant-listing-searching/blob/main/templates/restaurant_list.html"
    click RD "https://github.com/baratam-saiprasoona/zomato-restaurant-listing-searching/blob/main/templates/restaurant_detail.html"
    click SR "https://github.com/baratam-saiprasoona/zomato-restaurant-listing-searching/blob/main/templates/search_results.html"
    click UP "https://github.com/baratam-saiprasoona/zomato-restaurant-listing-searching/blob/main/templates/upload.html"

    classDef backend fill:#b3cde0,stroke:#333,stroke-width:1px
    classDef frontend fill:#ccebc5,stroke:#333,stroke-width:1px
    classDef external fill:#fdae61,stroke:#333,stroke-width:1px
```
