singhn9 commited on
Commit
0d3dfb6
·
verified ·
1 Parent(s): 40b3e1c

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +14 -9
src/streamlit_app.py CHANGED
@@ -341,15 +341,20 @@ for col in required_cols:
341
  if col not in meta_df.columns:
342
  meta_df[col] = None
343
 
344
- # Populate placeholders if file is just run summaries
345
- if meta_df["feature_name"].isna().all():
346
- meta_df["feature_name"] = df.columns
347
- meta_df["source_type"] = [
348
- "engineered" if any(x in c for x in ["poly", "pca", "roll", "lag"]) else "measured"
349
- for c in df.columns
350
- ]
351
- meta_df["formula"] = ""
352
- meta_df["remarks"] = "auto-inferred synthetic feature metadata"
 
 
 
 
 
353
 
354
  # Build sidebar safely
355
  feat_types = sorted(meta_df["source_type"].dropna().unique().tolist())
 
341
  if col not in meta_df.columns:
342
  meta_df[col] = None
343
 
344
+
345
+ # Populate placeholders if metadata is summary-like (not feature-level)
346
+ if len(meta_df) < len(df.columns) or "feature_name" not in meta_df.columns:
347
+ st.warning("Metadata appears to be summary-only. Rebuilding feature-level metadata.")
348
+ meta_df = pd.DataFrame({
349
+ "feature_name": df.columns,
350
+ "source_type": [
351
+ "engineered" if any(x in c for x in ["poly", "pca", "roll", "lag"]) else "measured"
352
+ for c in df.columns
353
+ ],
354
+ "formula": ["" for _ in df.columns],
355
+ "remarks": ["auto-inferred synthetic feature metadata" for _ in df.columns]
356
+ })
357
+
358
 
359
  # Build sidebar safely
360
  feat_types = sorted(meta_df["source_type"].dropna().unique().tolist())