Add OARMP routing engine, dashboard and documentation

- Complete routing engine: ingest, optimizer (CG+B&B), maintenance
  monitor, metrics, pipeline, quality checks
- Streamlit dashboard with Input/Output tab structure, editable data
  editors, interactive Folium map with satellite layer and maintenance
  base highlights, FH stacked bar chart with TTM availability
- CSV data files: AERONAVES, CHECKS, AIRPORTS, ESCALA DE VOO
- README, CONTEXTO and CHANGELOG added
- Remove legacy pre_process scripts and raw binary files (PDFs/xlsx)
- Update .gitignore to exclude outputs/, data/, raw/*.pdf, raw/*.xlsx

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Eduardo Carlos
2026-06-17 11:52:34 -03:00
parent 32ad7c9f23
commit 3607965c88
43 changed files with 3419 additions and 1936 deletions

View File

@@ -0,0 +1,64 @@
"""
Script 02 Build fleet reference table.
Reads AERONAVES.csv + CHECKS.csv, computes TTM and the full check-cycle
sequence for each aircraft, and saves the reference to data/reference/.
"""
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT))
import pandas as pd
from datetime import datetime
from src.routing_engine.config import DEFAULT_CONFIG
from src.routing_engine.inspect_files import read_aircraft, read_checks
from src.routing_engine.ingest import build_fleet, _check_cycles
cfg = DEFAULT_CONFIG
aircraft_df = read_aircraft(cfg.raw_dir / cfg.aircraft_file)
checks_df = read_checks(cfg.raw_dir / cfg.checks_file)
print("Aircraft loaded:")
print(aircraft_df.to_string(index=False))
print()
print("Checks loaded:")
print(checks_df.to_string(index=False))
print()
# Build fleet
planning_start = datetime(cfg.planning_year, 3, 18) # first OFRAG departure in the sample data
fleet = build_fleet(aircraft_df, checks_df, planning_start)
print("Fleet reference:")
for _, row in fleet.iterrows():
print(f"\n {row['tail_number']} ({row['model']}) FH total = {row['fh_total']:.0f}")
print(f" TTM before first check: {row['ttm_hours']:.1f} FH")
for i, c in enumerate(row["checks"]):
print(f" Cycle {i}: threshold={c['fh_threshold']:.0f} FH, "
f"TTM={c['ttm']:.0f} FH, duration={c['duration_hours']:.0f} h")
# Save to reference
cfg.reference_dir.mkdir(parents=True, exist_ok=True)
out_path = cfg.reference_dir / "fleet_reference.csv"
flat_rows = []
for _, row in fleet.iterrows():
flat_rows.append(
{
"tail_number": row["tail_number"],
"model": row["model"],
"fh_total": row["fh_total"],
"ttm_hours_cycle0": row["ttm_hours"],
"n_check_cycles": len(row["checks"]),
"cycles_json": str(row["checks"]),
}
)
pd.DataFrame(flat_rows).to_csv(out_path, index=False)
print(f"\nFleet reference saved -> {out_path}")