ForTriage’s analysis pipeline is encapsulated in theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/acdeveloper-sci/fortriage/llms.txt
Use this file to discover all available pages before exploring further.
fortriage.pipeline module. The public surface consists of a single entry-point function run_pipeline() and the PipelineResult dataclass it returns. The pipeline invokes Forti4D as a subprocess, reads its CSV and Markdown outputs into memory, and returns them in a structured result object. All other modules — views, AI Insights, session state — depend only on PipelineResult’s fields and never interact with Forti4D directly.
run_pipeline()
run_pipeline is the single public function in the fortriage.pipeline module. It accepts a path to a directory of Fortran source files, runs the full Forti4D analysis, and returns a PipelineResult with all output data loaded into memory.
Signature
| Parameter | Type | Description |
|---|---|---|
source_dir | Path | Path to a directory containing Fortran source files to analyze. |
PipelineResult — all report data loaded into memory.
Raises:
PipelineError— ifforti4dexits with a non-zero return code, the executable is not found inPATH, or the subprocess invocation fails at the OS level.FileNotFoundError— if expected output files are absent after a successful run.
run_pipeline is a blocking call — it uses subprocess.run and waits for Forti4D to complete before returning. In the Streamlit app it is invoked in a background thread so that the UI can display a rotating spinner and remain responsive during analysis.PipelineResult
PipelineResult is a frozen dataclass. All data is loaded into memory before temporary directories are cleaned up, so no file-path references escape this object.
| Field | Type | Source file | Description |
|---|---|---|---|
prioritization | pd.DataFrame | report_prioritization.csv | Ranked units with tier, score, CC, Fan-In, strategy, reachability, and key legacy metrics. Primary table for the Overview view and AI Insights KPIs. |
consolidated | pd.DataFrame | report_consolidated.csv | Full diagnostic report with approximately 34 columns per unit, including all raw metrics used to compute the Score. Used by the Drill-down view. |
migration_strategy | pd.DataFrame | report_migration_strategy.csv | Per-unit migration strategy, sorted by Priority_Num. Displayed in the Report Explorer tab. |
common_coupling | pd.DataFrame | common_coupling.csv | COMMON block coupling risks — one row per COMMON block, with unit/file counts and risk level. Used by the Report Explorer and AI Insights. |
clones | pd.DataFrame | report_clones.csv | Duplicate and near-duplicate unit detection — one row per clone pair. Used by the Report Explorer and AI Insights. |
project_summary | str | PROJECT_SUMMARY.md | Executive summary in Markdown format, rendered verbatim in the Executive Summary view. |
PipelineError
PipelineError is the single exception type raised for all subprocess-level failures. Callers only ever need to catch this one type to handle “the pipeline could not produce a result.”
Raised when:
forti4dexits with a non-zero return code.- The
forti4dexecutable is not found inPATH. - The subprocess invocation fails at the OS level for any other reason.
STDERR_TAIL_LINES in config.py). The full raw stderr is often long and mostly noise; only the trailing lines tend to carry the actual error message — the same principle as tail -n for log inspection.
All subprocess failures — whether a non-zero exit code or an OS-level exception like
FileNotFoundError from the operating system when the executable is missing — are normalized to PipelineError. Downstream callers never need to handle subprocess.CalledProcessError, OSError, or any other subprocess exception type.Environment Variables
The pipeline sets several environment variables in the subprocess environment before invoking Forti4D.| Variable | Set by | Description |
|---|---|---|
FORT_SRC | run_pipeline | Points to the isolated temp copy of source files. Consumed by Forti4D to locate input files. |
FORT_OUT | run_pipeline | Points to the temp output directory. Forti4D writes all CSV and Markdown reports here. |
PYTHONIOENCODING | run_pipeline | Set to utf-8 in the child process to prevent UnicodeEncodeError on Windows (where the default console encoding is cp1252, which cannot encode some characters Forti4D writes to stdout/stderr). |
FORTRIAGE_PROMPTS_DIR | Caller (optional) | Overrides the PROMPTS_DIR constant at runtime, pointing to a custom directory of LLM prompt files. See the Configuration reference for details. |
Subprocess Isolation
ForTriage ensures that the Forti4D analysis is fully isolated and leaves no temporary files on disk after completion.Copy sources to a temp directory
User-provided source files are copied into a temporary directory with the prefix
fortriage_src_*. This prevents any writes from the analysis engine from touching the user’s original files.Create an output temp directory
A second temporary directory with the prefix
fortriage_out_* is created to receive Forti4D’s CSV and Markdown report outputs.Invoke Forti4D
Forti4D is invoked as a subprocess with
FORT_SRC and FORT_OUT set to the respective temp directories. The process runs synchronously.Load outputs into memory
All six output files are read into
PipelineResult fields before the temp directories are cleaned up.This design means
PipelineResult is fully self-contained. There are no file handles, no temp paths, and no references to the filesystem after run_pipeline returns. The entire analysis artifact lives in the dataclass fields until the Streamlit session ends or a new analysis is started.