How lrigaux/technical_test_tby works
Project type and purpose
• This is a full-stack, single-page web application built with Streamlit.
• Its purpose is to ingest raw product data (CSV), clean and analyze it, enhance product descriptions with a generative AI (Google AI API via LangChain/LangGraph), harmonize images, and store history locally in DuckDB.
File structure
• Top level
– app.py: Streamlit entry point (UI layer + orchestration trigger)
– data/: raw inputs (CSV prompts), outputs (processed_images), DB file
– requirements.txt, .devcontainer/: environment config
• src/
– config.py: global paths, default model and image options
– data_handler.py: CSV loading, pandas-based cleaning/prep
– db_handler.py: DuckDB persistence and history queries
– graph_workflow.py: LangGraph workflow definition (map, generate, enhance, image, aggregate, persist)
– llm_models.py: initializes Google AI client via LangChain
– image_processor.py: optional image-background removal, resizing
– utils.py: helper functions (HTML cleanup, etc.)
README for additional insights
• Workflow steps are explicitly listed (map_selected, gen_titles, enhance_desc, proc_images, aggregate_results, persist_db).
• Key external dependencies: Streamlit, Pandas, Plotly Express, LangChain, LangGraph, Google AI, Pillow, Rembg, DuckDB.
a. Main components
1. Streamlit UI layer (app.py + sidebar configuration)
2. Data Ingestion & Cleaning (data_handler module + user upload widget)
3. Workflow Orchestrator (graph_workflow module running LangGraph)
4. LLM Service (llm_models module → Google AI API)
5. Image Processing Service (image_processor module)
6. Persistence Layer (db_handler module → DuckDB local file)
7. File System (data/ folder for CSVs, prompts, images)
b. Relationships and interactions
– UI triggers upload → Data Ingestion
– Cleaned data passed to Workflow Orchestrator
– Orchestrator dispatches to LLM Service and Image Processor in parallel or sequence
– Aggregated results returned to UI and forwarded to Persistence Layer
– Persistence Layer writes to DuckDB and File System (processed_images)
– UI can query Persistence Layer for history
c. Architectural patterns and principles
– Modular layered architecture: UI / Application Logic / Services / Persistence
– Pipeline/workflow pattern implemented via LangGraph (directed acyclic graph of tasks)
– Separation of concerns: each module handles one responsibility
– Local-first data storage (DuckDB) and stateless service calls to Google AI
d. Relevant technologies and libraries
– Frontend: Streamlit
– Data analysis & viz: Pandas, Plotly Express
– Workflow orchestration: LangChain + LangGraph
– LLM integration: langchain-google-genai (Google AI Gemini)
– Image processing: Pillow, Rembg
– Persistence: DuckDB
– Utility: Python 3.12
– UI (blue),
– Processing services (green),
– External APIs (orange),
– Persistence (gray)
Detail without over-fragmenting
• Key modules and flows listed above
• Avoid splitting modules beyond their single responsibility