How hamidrezak324/cag works
Project Type and Purpose
• This is a backend‐focused, containerized API service (FastAPI) for calculating Compound Annual Growth Rate (CAGR) from CSV stock data.
• Key external pieces: Redis (caching), ChromaDB (vector storage), Hugging Face NLP models, and Docker for deployment.
Main Architectural Components
a. Client (e.g., browser, Postman)
b. Docker Container (boundary “wall” representing the running environment)
• FastAPI service (app.py)
• Redis cache
• ChromaDB data store (chroma_db folder + sqlite)
• Dataset volume (mounted folder containing CSVs)
c. External NLP Model (Hugging Face)
Relationships and Data Flows
• Client → HTTP request → FastAPI
• FastAPI → check Redis cache → return cached result or compute
• FastAPI → read from dataset (CSV) → compute CAGR
• FastAPI → store/query vectors → ChromaDB
• FastAPI → call Hugging Face model for any NLP preprocessing
• FastAPI → write result → Redis for future cache
• FastAPI → HTTP response → Client
Architectural Patterns and Principles
• Layered: API layer, caching layer, storage layer, external AI service
• Containerization: all core services run inside one Docker image/container
• Separation of concerns: each component has a single responsibility