# amirikarima/skill_extractor_api architecture

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

- Interactive diagram: https://gitdiagram.com/amirikarima/skill_extractor_api
- Repository: https://github.com/amirikarima/skill_extractor_api

## Overview

##### Project type and purpose
- This is a single‐service Flask API (a monolithic microservice) with a minimal web front end. Its job is to accept CV images (PNG/JPG/JPEG), extract text via OCR, parse out skills, match them against job postings in MongoDB Atlas, and return results via a web UI or API endpoint.

##### File structure
- Top‐level files:
- app.py – Flask entry point (routes, web form, API endpoints)
- skill_extractor.py – OCR (EasyOCR) integration and skill‐parsing logic
- job_matcher.py – MongoDB client code and matching algorithm
- test.py – (presumably) simple tests or manual runner
- requirements.txt – Python dependencies
- .gitignore, __pycache__ – standard housekeeping
- No separate “frontend” folder: the front end lives in Flask templates/routes in app.py.
- No build scripts or containers defined: simple Python runtime.

##### Key README insights
- Uses Python 3.9+, Flask, EasyOCR, MongoDB Atlas.
- Single POST `/process` endpoint plus a basic HTML upload form at `/`.

1. Client layer:
- Web browser (HTML form)
- API clients (Postman, curl)
2. API layer:
- Flask App (`app.py`)
- Routes: `/` (GET), `/process` (POST)
3. Processing modules (inside the same service):
- OCR Engine (EasyOCR) invoked by `skill_extractor.py`
- SkillExtractor logic (parses raw text → skill tokens)
- SkillMatcher logic (`job_matcher.py`)
4. Data store:
- MongoDB Atlas cluster
5. Infrastructure/dependencies:
- Python runtime & virtual env
- External library dependencies (EasyOCR, pymongo, Flask)

1. Client → HTTP POST `/process` (upload CV image)
2. Flask App reads the file and calls → OCR Engine
3. OCR Engine returns raw text → SkillExtractor
4. SkillExtractor returns list of skills → SkillMatcher
5. SkillMatcher queries MongoDB → retrieves job postings
6. Matching results → returned by Flask App → Client (JSON or HTML)

c. Architectural patterns/design principles
- Layered architecture: Presentation (Flask routes) → Application logic (modules) → Infrastructure (DB)
- Single‐service monolith but clearly separated concerns (OCR, parsing, matching, web)
- Dependency injection via module imports (app.py orchestrates)
- Externalized configuration (.env for MONGO_URI)

d. Key technologies/frameworks/libraries
- Python 3.9+
- Flask (web framework)
- EasyOCR (OCR library)
- pymongo or mongoengine (MongoDB client)
- MongoDB Atlas (cloud database)

##### Detail without overthinking
- Break the monolith into its logical parts (web, OCR, parsing, DB).
- Runtime components (Flask, OCR library, DB).

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Client Layer"
        Browser["Browser / Postman"]:::client
    end

    subgraph "Service Layer"
        Flask["Flask API: app.py"]:::api
        OCR["OCR Engine: EasyOCR"]:::processing
        Extractor["SkillExtractor: skill_extractor.py"]:::processing
        Matcher["SkillMatcher: job_matcher.py"]:::processing
    end

    subgraph "Data Layer"
        DB["MongoDB Atlas"]:::db
    end

    subgraph "Project Files"
        Req["requirements.txt"]:::file
        Test["test.py"]:::file
        Gitignore[".gitignore"]:::file
        Readme["README.md"]:::file
    end

    Browser -->|"POST /process (Image file)"| Flask
    Flask -->|"Image file"| OCR
    OCR -->|"Raw text"| Extractor
    Extractor -->|"Skills list"| Matcher
    Matcher -->|"Query"| DB
    DB -->|"Job postings"| Matcher
    Matcher -->|"Match results"| Flask
    Flask -->|"JSON/HTML response"| Browser

    classDef client fill:#add8e6,stroke:#333,stroke-width:1px
    classDef api fill:#90ee90,stroke:#333,stroke-width:1px
    classDef processing fill:#ffa500,stroke:#333,stroke-width:1px
    classDef db fill:#dda0dd,stroke:#333,stroke-width:1px
    classDef file fill:#f0f0f0,stroke:#999,stroke-width:1px,font-style:italic

    click Flask "https://github.com/amirikarima/skill_extractor_api/blob/main/app.py"
    click OCR "https://github.com/amirikarima/skill_extractor_api/blob/main/skill_extractor.py"
    click Extractor "https://github.com/amirikarima/skill_extractor_api/blob/main/skill_extractor.py"
    click Matcher "https://github.com/amirikarima/skill_extractor_api/blob/main/job_matcher.py"
    click Req "https://github.com/amirikarima/skill_extractor_api/blob/main/requirements.txt"
    click Test "https://github.com/amirikarima/skill_extractor_api/blob/main/test.py"
    click Gitignore "https://github.com/amirikarima/skill_extractor_api/blob/main/.gitignore"
    click Readme "https://github.com/amirikarima/skill_extractor_api/blob/main/README.md"
```
