How jhackisneros/dashboard_de_mando works
Project Type and Purpose
• This is a Streamlit-based interactive dashboard (“Dashboard de Mando y Control – ChronoLogistics”) that integrates three decision-support modules (Tactical Risk “Precog”, Strategic Vision “Chronos”, and Interactive Battle Manual “K-Lang”), plus a “Chatbot” page.
• Its primary function is to ingest geospatial and sensor data, run analytics/simulations, then present charts, heatmaps and maps in a browser UI.
File Structure Overview
• Top-level files and folders:
• .devcontainer/ – VS Code DevContainer configuration
• _pages/ – Streamlit multipage modules (chatbot.py, chronos.py, klang.py, precog.py)
• app.py – Main Streamlit launcher (or entry point renamed from run.py)
• functions/ – Business-logic layer (ChronosLogic.py, precog.py, protocolos.py, utils.py)
• data/ – Raw data assets (GeoJSON, CSV)
• scripts/ – ETL/preprocessing helpers (download_distritos.py)
• generate_geojson.py – Standalone converter/generator
• requirements.txt – Python dependencies (Streamlit, pandas, numpy, matplotlib, seaborn, scikit-learn, plotly, Pillow)
• Key patterns:
• Layered separation: UI (_pages + app.py) → Service/Logic (functions/) → Data storage (data/, assets/)
• Pre-processing scripts and one-off data generators live outside the UI pipeline
a. User Interface Layer
• Browser → Streamlit Server (hosted locally or on cloud)
• app.py / _pages/*.py (each page implements a view + controller logic)
b. Application Logic Layer
• functions/ChronosLogic.py, precog.py, protocolos.py, utils.py
• Shared routines for data processing, model inference, map layering
c. Data Layer
• data/sensores.csv & data/distritos_madrid.geojson (raw inputs)
• Generated artifacts (generate_geojson.py output)
• Static assets (assets/)
d. Auxiliary & Deployment
• .devcontainer/ for local dev
• scripts/ for offline ETL
• External libraries: Streamlit, pandas, numpy, matplotlib/seaborn, plotly, scikit-learn, Pillow
• Optional deployment targets: Streamlit Community Cloud, Hugging Face Spaces, Heroku
Relationships & Data Flow
• User clicks or selects module → HTTP request to Streamlit backend →
Streamlit routes to the appropriate _pages/*.py →
Page code calls into functions/ to fetch, process, and model data →
Data is loaded from data/ or precomputed artifacts →
Results (charts, maps) are rendered via Streamlit widgets and plotly/matplotlib →
Browser displays visualizations.
• Offline: scripts/download_distritos.py populates raw data, then generate_geojson.py transforms to GeoJSON for data/.
Architectural Patterns & Principles
• Modular multipage design: each _pages file is an isolated view/controller
• Business logic extraction: functions/ enforces single-responsibility and reusability
• Clear separation of concerns: ETL scripts outside the request path
• Leverage containerization (.devcontainer) for dev-prod parity
• Labels: Component name, file path or module name