# khushi-12/avocado_ai architecture

> Architecture diagram of the GitHub repository khushi-12/avocado_ai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/khushi-12/avocado_ai
- Repository: https://github.com/khushi-12/avocado_ai

## Overview

##### Main Components
- Content Extraction Module: Represented by the data.py script. This module scrapes articles from the Flo app’s blog, extracts text and metadata, and stores the resulting data in articles.json.
- NLP Processing Engine: This is the core where the project utilizes a Hugging Face model (d4data/biomedical-ner-all) to perform Named Entity Recognition (NER) and applies NLP techniques for key phrase extraction.
- API Server: Built on FastAPI. The main.py file instantiates the FastAPI application, and uvicorn is used to serve the API endpoint that accepts text inputs and returns the analysis.
- User Interface: Shown by index.html, which provides a front-end interface for users to enter article content and view the processed results.
- Supporting Artifacts: Files like requirements.txt for dependencies, and video documentation demonstrating working functionality serve as supplemental information to understand deployment and user interaction.

##### Relationships and Data/Control Flow
- Interaction among these components, like potential asynchronous processing or error-handling paths.

##### Architectural Patterns and Design Principles
- Separation of Concerns: The project is clearly modular—splitting data extraction (scraping), processing (NLP tasks), and API serving.
- Clean API design: FastAPI is used to expose endpoints for text analysis, suggesting a layered architecture where the API acts as a middle layer between the UI and processing logic.
- Use of Pre-trained Models: Utilizing a specific Hugging Face model indicates reliance on external libraries/frameworks for NLP.

##### Incorporate Relevant Technologies
- Python as the primary programming language.
- FastAPI for API development and uvicorn as the ASGI server.
- Hugging Face (d4data/biomedical-ner-all) for NLP tasks.
- HTML for the basic user interface.
- Git (as shown by .gitignore) for version control.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Backend Components"
        A["Scraper Module (data.py)"]:::backend
        B["Data Store (articles.json)"]:::backend
        C["NLP Engine (NER & Key Phrase Extraction)"]:::backend
        D["API Server (FastAPI/main.py)"]:::api
    end

    subgraph "Frontend"
        E["User Interface (index.html)"]:::frontend
    end

    subgraph "Supporting Artifacts"
        F["Dependencies (requirements.txt)"]:::artifacts
        G["Video Prototype (working prototype (without audio).mp4)"]:::artifacts
    end

    A -->|"Extracts"| B
    B -->|"ProvidesInput"| C
    C -->|"ProcessedResults"| D
    E -->|"HTTPRequest"| D
    D -->|"HTTPResponse"| E
    D -.->|"UsesDep"| F
    D -.->|"Docs"| G

    click A "https://github.com/khushi-12/avocado_ai/blob/main/data.py"
    click B "https://github.com/khushi-12/avocado_ai/blob/main/articles.json"
    click C "https://github.com/khushi-12/avocado_ai/blob/main/main.py"
    click D "https://github.com/khushi-12/avocado_ai/blob/main/main.py"
    click E "https://github.com/khushi-12/avocado_ai/blob/main/index.html"
    click F "https://github.com/khushi-12/avocado_ai/blob/main/requirements.txt"
    click G "https://github.com/khushi-12/avocado_ai/blob/main/working prototype (without audio).mp4"

    classDef backend fill:#1f77b4,stroke:#333,stroke-width:2px;
    classDef api fill:#2ca02c,stroke:#333,stroke-width:2px;
    classDef frontend fill:#ff7f0e,stroke:#333,stroke-width:2px;
    classDef artifacts fill:#9467bd,stroke:#333,stroke-width:2px;
```
