How synbioexplorer/welly works
Project type and purpose
• This is a full-stack, single-service web application built on Flask (Python).
• Purpose: allow users to upload plate-reader CSV/Excel data, compute growth metrics (max growth rate, AUC), cache results, and render interactive visualizations (line plots, heatmaps).
Key elements in the file structure
• app.py: the Flask application entrypoint, contains route handlers (upload, plate selection, processing, download).
• templates/: Jinja2 HTML templates (index.html, media_selection.html, edit_96.html, edit_384.html, results.html). These are the “View” layer.
• Static/: CSS/JS assets and example data. Served directly to browsers.
• cache-directory/: file-system cache for intermediate analysis results (hashed subfolders). Acts as a simple “Model” persistence without a database.
• downloads/: storage for user downloads (e.g., trial.csv).
• Generated HTML reports at root (growth_analysis_report.html, heatmap.html, interactive_plot.html) are artifacts of the processing component.
Architectural patterns and workflows
• MVC-like separation:
• Model = file-system (cache-directory, downloads) + in-memory data structures (Pandas DataFrames).
• View = templates/ + Static/ assets.
• Controller = app.py with Flask routes.
• Caching layer reduces recomputation: each upload is hashed and stored.
• Report-generation module outputs standalone HTML (heatmap, interactive plot).
• No external database; everything lives on disk in structured dirs.
Main components
• Client (Web Browser)
• Upload interface, interactive JS for plots (served from Static/)
• Web Server (Flask app.py)
• Route handlers: /, /upload, /select-media, /process, /results, /download
• Orchestrates processing modules
• Processing Modules (Python libraries)
• Data ingestion (Pandas, openpyxl/csv reader)
• Metric calculation (growth rate, AUC)
• Plot generation (Plotly/Matplotlib → HTML files)
• Cache Store (cache-directory)
• File-system hash buckets for reusing prior computations
• Download Store (downloads/)
• CSV & report files exposed via /download routes
• Template Engine (Jinja2)
• Merges computed data into HTML views
• Static Assets
• JavaScript, CSS, example CSVs under Static/
• External dependencies
• Flask, Pandas, NumPy, Plotly or Matplotlib, openpyxl (per requirements.txt)
Relationships & data flows
1. Browser sends HTTP POST (file upload) → Flask app
2. Flask checks cache-directory for existing hash; if miss, read file → Pandas DataFrame
3. Processing module computes metrics → stores results in cache-directory
4. Plot generator writes heatmap.html, interactive_plot.html, growth_analysis_report.html
5. Flask renders Jinja2 template (results.html), embedding links to static reports and data
6. Browser fetches static assets (JS/CSS) and interacts with the plots
7. User triggers download → GET /download → files from downloads/