How srinivas26k/network_project works
Project Type and Purpose
• From the README and file tree, this is a single‐page, full‐stack web application built with Streamlit.
• Purpose: Interactive network analysis for scientists—including graph generation, statistical/ML insights, visualization, and report export.
File Structure
• Top level:
• Python entry scripts: app.py, mod.py, mod1.py, mod2.py (mod2.py is the Streamlit launcher)
• Core modules: clustering.py, utila1.py, utils.py
• Static assets under lib/:
– tom‐select (enhanced selects)
– vis‐9.1.2 (network visualizations via vis.js)
– bindings/utils.js (custom JS helpers)
• config: requirements.txt, .devcontainer/, LICENSE, .gitignore
• Patterns:
• Layered architecture – UI (Streamlit) calls into domain modules (analysis, clustering, utils).
• Modules grouped by responsibility (visualization vs. algorithmic logic).
Extract Architecture Insights from README
• UI built with Streamlit, enriched by JS/CSS libs under lib/.
• Business logic leverages NetworkX, Plotly, scikit‐learn, and other ML/statistics libs.
• Data flows: Upload → Ingestion → Analysis → Visualization → Export.
a. Main Components
1. Client (Web Browser) – where the user interacts
2. Streamlit Server (mod2.py / app.py) – serves pages & handles events
3. Static Assets (lib/) – tom‐select, vis.js, CSS, JS bindings
4. Domain Modules – Python packages for:
• Data Ingestion (CSV, Excel, TXT loaders in utils.py)
• Random Graph Generator (utila1.py)
• Network Analysis (clustering.py, mod.py, mod1.py)
• ML Insights (scikit‐learn calls inside clustering.py or utils)
• Visualization (Plotly + PyVis hooks via lib/vis-9.1.2)
• Report Export (PDF/DOCX via python-docx or reportlab)
5. External Libraries – NetworkX, Plotly, scikit-learn, Pandas, Streamlit
b. Relationships & Interactions
• Browser ↔ Streamlit Server: HTTP / WebSocket events
• Streamlit Server → Static Assets: serves JS/CSS to client
• Streamlit Server → Domain Modules: function calls for data loading, analysis, ML, and export
• Domain Modules → External Libraries: invoke algorithm implementations
• Streamlit Server ↔ Export Module: triggers downloads of CSV, GraphML, PDF, DOCX
c. Architectural Patterns & Principles
• Layered Architecture (UI → Application Logic → Domain Logic → External Services)
• Modular Design: each Python module has a single responsibility (separation of concerns)
• Plugin-style static assets for UI enhancement
d. Key Technologies & Frameworks
• Python 3.8+, Streamlit (UI), NetworkX (graph operations), Plotly & vis.js (visualization), scikit‐learn (ML), Pandas (data), python-docx/reportlab (export), tom-select (UI enhancement)
Be Detailed and Exhaustive
• Break the backend into all individual Python modules, show which libraries each module calls.
• Data flow from “File Upload” → “utils.py loader” → “NetworkX graph object” → “Plotly/vis.js renderer” → “Browser Canvas”.
• “Random Graph Generator” and “AI-Powered Labeler” as separate submodules under Domain Logic.