- 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>
42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
"""
|
||
Script 01 – Inspect raw input files.
|
||
|
||
Prints metadata (encoding, separator, column names, sample rows) for every CSV
|
||
in the raw/ folder and saves a JSON report to data/raw_index/.
|
||
"""
|
||
|
||
import json
|
||
import sys
|
||
from pathlib import Path
|
||
|
||
ROOT = Path(__file__).resolve().parents[1]
|
||
sys.path.insert(0, str(ROOT))
|
||
|
||
from src.routing_engine.config import DEFAULT_CONFIG
|
||
from src.routing_engine.inspect_files import inspect_all
|
||
|
||
cfg = DEFAULT_CONFIG
|
||
|
||
print(f"Inspecting files in: {cfg.raw_dir}\n")
|
||
meta = inspect_all(cfg.raw_dir)
|
||
|
||
for name, info in meta.items():
|
||
print(f"-- {name} -------------------------------------------")
|
||
if "error" in info:
|
||
print(f" ERROR: {info['error']}")
|
||
continue
|
||
print(f" Encoding : {info['encoding']}")
|
||
print(f" Separator : {repr(info['separator'])}")
|
||
print(f" Columns : {info['columns']}")
|
||
if info["sample_rows"]:
|
||
print(f" First row : {info['sample_rows'][0]}")
|
||
print()
|
||
|
||
# Save report
|
||
out = cfg.raw_index_dir / "file_inventory.json"
|
||
cfg.raw_index_dir.mkdir(parents=True, exist_ok=True)
|
||
with open(out, "w", encoding="utf-8") as f:
|
||
json.dump(meta, f, ensure_ascii=False, indent=2, default=str)
|
||
|
||
print(f"Report saved -> {out}")
|