Update src/streamlit_app.py
Browse files- 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 |
-
|
| 345 |
-
if
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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())
|