Spaces:
Sleeping
Sleeping
| import sys | |
| import os | |
| import pandas as pd | |
| import json | |
| # Ensure backend works | |
| sys.path.append(os.getcwd()) | |
| # Hardcode paths from data_service.py to test directly | |
| DATA_PATH = "/run/media/ishpreet/New Volume/Auribises/Vardhman Textiles/Final Base Data for PD Gr issue Norsm 15-01-26.xlsx" | |
| NORMS_PATH = "/run/media/ishpreet/New Volume/Auribises/Vardhman Textiles/AT1 MKT PD Gr Norms Rev on 13-12-2025.xlsx" | |
| print(f"Checking Data Path: {DATA_PATH}") | |
| if os.path.exists(DATA_PATH): | |
| print("β Main Data File found") | |
| try: | |
| print("Reading 'PO Type' sheet...") | |
| po_df = pd.read_excel(DATA_PATH, sheet_name="PO Type") | |
| print(f"β PO Type Loaded completely. Shape: {po_df.shape}") | |
| print(po_df.head().to_string()) | |
| print("\nReading 'Finish Description' sheet...") | |
| finish_df = pd.read_excel(DATA_PATH, sheet_name="Finish Description") | |
| print(f"β Finish Description Loaded completely. Shape: {finish_df.shape}") | |
| print(finish_df.head().to_string()) | |
| except Exception as e: | |
| print(f"β Error reading Excel: {e}") | |
| else: | |
| print("β Main Data 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 at {fallback}") | |
| else: | |
| print(f"β Fallback NOT found either") | |
| print("\nChecking Norms...") | |
| norms_json = os.path.join(os.getcwd(), "data/norms.json") | |
| if os.path.exists(norms_json): | |
| print(f"β Norms JSON found at {norms_json}") | |
| try: | |
| with open(norms_json, "r") as f: | |
| norms = json.load(f) | |
| print(f"β Norms loaded: {len(norms)} entries") | |
| except Exception as e: | |
| print(f"β Error reading Norms JSON: {e}") | |
| else: | |
| print(f"β Norms JSON NOT found at {norms_json}") | |