Files
aircraftrouting_arara/scripts/01_inspect_inputs.py
Eduardo Carlos 3607965c88 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>
2026-06-17 11:52:34 -03:00

42 lines
1.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""
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}")