How zekaistic/cyber-sierra-challenge works
Project type and purpose
• Type: Single-page Streamlit application (monolithic Python script)
• Purpose: Let users upload CSV/XLSX files, view them, and chat with an AI assistant (OpenAI GPT) about the data.
File structure
• Top-level files:
– app.py → contains the entire Streamlit UI and business logic
– requirements.txt → lists external Python libraries
– venv/ → local virtual environment (isolated dependencies)
• No separate “frontend” or “backend” directories—instead, Streamlit unifies UI and server code in a single process.
README for additional insights
• Three main UI sections: File Upload (sidebar), Data Viewer (left pane), AI Chat (right pane)
• Uses pandas for in-memory DataFrames, Streamlit’s cache decorator to speed reloads
• Calls OpenAI’s API (gpt-4-turbo) by converting DataFrame to Markdown and sending full content
Main components
a. User’s Browser / Streamlit Client
– Renders the upload sidebar, data viewer, Chat UI
– Sends HTTP/WebSocket requests to the Streamlit server
b. Streamlit Server (app.py process)
– UI layer: receives input, updates pages
– Data layer:
• File Upload Handler
• pandas DataFrames in memory
• @st.cache_data decorator for caching
– AI Chat Handler: formats DataFrame → Markdown → OpenAI payload
c. External Service
– OpenAI API endpoint (gpt-4-turbo)
d. (Optional) Local Virtual Environment
– Isolated Python interpreter + installed libraries
Relationships and data flows
– File Upload → pandas.read_csv/openpyxl → DataFrame cache
– Data Viewer → DataFrame slice → UI render
– Chat → DataFrame → Markdown conversion → OpenAI API
Architectural patterns / design principles
• Monolithic single-process design (Streamlit handles both UI and server)
• Cache-as-function-memoization for DataFrames
• Clear separation of concerns in code blocks: upload, view, chat
• External service integration via RESTful API calls