process-aware-ai / backend /debug_data_columns.py
borndeveloper's picture
Deploy Process Aware AI Dashboard without binaries
b4a2e7f
Raw
History Blame Contribute Delete
1.98 kB
import pandas as pd
import os
import sys
# Define path exactly as in data_service.py
DATA_PATH = "/run/media/ishpreet/New Volume/Auribises/Vardhman Textiles/Final Base Data for PD Gr issue Norsm 15-01-26.xlsx"
print(f"Checking {DATA_PATH}...")
if not os.path.exists(DATA_PATH):
print("❌ File NOT found!")
# Check fallback
fallback = "/run/media/ishpreet/New Volume/Auribises/Vardhman Textiles/Data Set.xlsx"
if os.path.exists(fallback):
print(f"⚠️ Fallback found: {fallback}")
DATA_PATH = fallback
else:
print("❌ Fallback also NOT found.")
sys.exit(1)
try:
print("Reading Excel file (this might take a moment)...")
xl = pd.ExcelFile(DATA_PATH)
print(f"Sheet names: {xl.sheet_names}")
if "Finish Description" in xl.sheet_names:
df = pd.read_excel(xl, "Finish Description", nrows=5)
print("\n--- Finish Description Columns ---")
print(list(df.columns))
print(df.head(2).to_string())
if "PO Type" in xl.sheet_names:
df = pd.read_excel(xl, "PO Type", nrows=5)
print("\n--- PO Type Columns ---")
print(list(df.columns))
print(df.head(2).to_string())
# Check Detail/Master for Shade Type
if "Detail" in xl.sheet_names:
df = pd.read_excel(xl, "Detail", nrows=5, header=2) # Adjust header if needed
print("\n--- Detail Columns (header=2) ---")
cols = list(df.columns)
print(cols[:10], "...")
if "Shade Type" in cols:
print("βœ… 'Shade Type' column FOUND in Detail.")
else:
print("❌ 'Shade Type' column NOT FOUND in Detail.")
# Check if it's there with header=0?
df0 = pd.read_excel(xl, "Detail", nrows=5, header=0)
if "Shade Type" in df0.columns:
print("⚠️ 'Shade Type' found with header=0.")
except Exception as e:
print(f"❌ Error reading Excel: {e}")