How acdeveloper-sci/fortriage works
Purpose and Entry Points
ForTriage is an ephemeral Streamlit dashboard for prioritizing modernization risk in legacy Fortran systems. It consumes curated Forti4D analysis outputs, rather than parsing or modifying source itself. The process starts at streamlit_app.py, which delegates application initialization and navigation to fortriage/app.py.
Application Shell and Session State
The app shell owns Streamlit page routing, shared initialization, and the active-analysis lifecycle. Session-scoped state keeps uploaded/generated analysis available across dashboard pages without a database or cross-session persistence. Key paths: fortriage/app.py, fortriage/state.py, fortriage/config.py.
Upload and Analysis Boundary
Users provide a project/archive; the upload layer validates and stages it, while the pipeline invokes or consumes Forti4D analysis and converts its reports into dashboard-ready structures. Forti4D is an external, independent static-analysis engine and is the boundary for Fortran parsing, metrics, dependency analysis, and source-level risk computation. Key paths: fortriage/uploads.py, fortriage/pipeline.py, test_pipeline_manual.py.
Prioritized Analysis Model
The pipeline’s curated report corpus drives the application’s risk-ranked unit views: complexity, reachability/dead code, clones, coupling, dependencies, and score breakdowns. This is the central data boundary: UI code should consume normalized analysis results, not Forti4D internal diagnostics such as per-file audit/block dumps. Key paths: fortriage/pipeline.py, fortriage/state.py, fortriage/config.py.
Dashboard Exploration Views
Streamlit views present the same session analysis through complementary decision workflows: system-level prioritization, per-unit inspection, management-facing synthesis, and raw curated-report exploration. Navigation and selections should hand off through shared state rather than recomputing analysis. Key paths: fortriage/views/overview.py, fortriage/views/drilldown.py, fortriage/views/executive_summary.py, fortriage/views/report_explorer.py.
Visualization and Reusable UI
Shared components provide charts, risk/status badges, metric presentation, and unit-detail modal interactions; they are presentation-layer consumers of normalized analysis data. Altair is the material visualization runtime, embedded within Streamlit. Key paths: fortriage/components/charts.py, fortriage/components/metric_bar.py, fortriage/components/unit_modal.py.
AI Insights and External Service Boundary
AI Insights builds constrained context from aggregated reports and executive/prioritization findings, assembles prompt assets, and calls Google Gemini only when configured. It must not send raw Fortran source; non-AI dashboard functionality remains offline. Gemini credentials come from Streamlit secrets, and the feature degrades when no API key is available. Key paths: fortriage/views/ai_insights.py, fortriage/insights_context.py, fortriage/gemini_client.py, fortriage/prompts.py.
Runtime and Infrastructure
The runtime is Python 3.10+ with Streamlit, launched through uv run streamlit run streamlit_app.py; dependency resolution is defined by pyproject.toml and uv.lock. Deployment configuration is Streamlit-local in .streamlit/config.toml. No database, persistent project store, or cloud analysis backend is present; the only runtime external service is optional Google Gemini, while Forti4D remains an external analysis dependency.
Main entry points: app.py App routing · state.py Session analysis · pipeline.py Analysis pipeline · charts.py Shared UI components
Components 20
App shell
- Streamlit entry
streamlit_app.py - App routing · Initializes the app and routes pages.
fortriage/app.py - Session analysis · Ephemeral shared analysis and selections.
fortriage/state.py - App configuration
fortriage/config.py
Analysis workflow
- Upload staging · Validates and stages user projects or archives.
fortriage/uploads.py - Analysis pipeline · Converts Forti4D outputs into dashboard-ready results.
fortriage/pipeline.py - Forti4D · Independent Fortran parsing, metrics, dependency, and risk engine.
- Curated report model · Risk-ranked units, scores, dependencies, clones, and reachability.
fortriage/pipeline.py
Dashboard views
- Overview
fortriage/views/overview.py - Unit drilldown
fortriage/views/drilldown.py - Executive summary
fortriage/views/executive_summary.py - Report explorer
fortriage/views/report_explorer.py - Shared UI components · Charts, badges, metrics, and unit-detail interactions.
fortriage/components/charts.py - Altair
Optional AI insights
- AI Insights view · Remains unavailable when Gemini is not configured.
fortriage/views/ai_insights.py - Constrained context · Builds aggregated report and prioritization context without source.
fortriage/insights_context.py - Prompt assets
fortriage/prompts.py - Gemini client · Uses Streamlit secrets for optional credentials.
fortriage/gemini_client.py - Google Gemini
Other components
- Python / Streamlit runtime · Launched with uv and dependency resolution.
pyproject.toml
Connections 28
- Streamlit entry → App routing: starts
- Python / Streamlit runtime → Streamlit entry: runs
- App routing → Session analysis: initializes
- App routing → App configuration: reads
- App routing → Upload staging: routes to
- Upload staging → Analysis pipeline: staged project
- Analysis pipeline → Forti4D: invokes or consumes reports
- Forti4D → Analysis pipeline: analysis outputs
- Analysis pipeline → Curated report model: normalizes
- Curated report model → Session analysis: stored for session
- App routing → Overview: routes to
- App routing → Unit drilldown: routes to
- App routing → Executive summary: routes to
- App routing → Report explorer: routes to
- Session analysis → Overview: shared analysis
- Session analysis → Unit drilldown: shared analysis and selection
- Session analysis → Executive summary: shared analysis
- Session analysis → Report explorer: shared analysis
- Overview → Shared UI components: renders with
- Unit drilldown → Shared UI components: renders with
- Executive summary → Shared UI components: renders with
- Shared UI components → Altair: charts
- App routing → AI Insights view: routes to
- Session analysis → AI Insights view: aggregated findings
- AI Insights view → Constrained context: builds
- Constrained context → Prompt assets: constrains input
- Prompt assets → Gemini client: assembled request
- Gemini client → Google Gemini: optional API call