Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -270,14 +270,16 @@ def load_kpi_excel_mapping(excel_path: str):
|
|
| 270 |
mapping = {}
|
| 271 |
for idx, row in df.iterrows():
|
| 272 |
|
|
|
|
|
|
|
|
|
|
| 273 |
if kpi_name:
|
| 274 |
print(
|
| 275 |
f"KPI={kpi_name} | "
|
| 276 |
f"Definition={str(row.get('KPI_Definitions',''))[:50]} | "
|
| 277 |
f"DAX={str(row.get('KPI_DAX',''))[:50]}"
|
| 278 |
)
|
| 279 |
-
|
| 280 |
-
measure_name = str(row.get(measure_col, '')).strip() if measure_col else ''
|
| 281 |
if not kpi_name and not measure_name:
|
| 282 |
continue
|
| 283 |
|
|
@@ -378,11 +380,11 @@ def lookup_kpi_excel_info(kpi_name: str, measure_name: str, excel_mapping: dict,
|
|
| 378 |
|
| 379 |
|
| 380 |
def load_default_excel_if_present():
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
|
| 387 |
query_key = normalize_loose(query)
|
| 388 |
|
|
@@ -801,11 +803,11 @@ formula = record.get("dax", "").strip()
|
|
| 801 |
if not formula:
|
| 802 |
formula = "Formula not available"
|
| 803 |
|
| 804 |
-
|
| 805 |
-
|
| 806 |
-
|
| 807 |
-
|
| 808 |
-
|
| 809 |
|
| 810 |
notes = f"""
|
| 811 |
**KPI Name:** {record.get('kpi_name','')}
|
|
|
|
| 270 |
mapping = {}
|
| 271 |
for idx, row in df.iterrows():
|
| 272 |
|
| 273 |
+
kpi_name = str(row.get(kpi_col, '')).strip() if kpi_col else ''
|
| 274 |
+
measure_name = str(row.get(measure_col, '')).strip() if measure_col else ''
|
| 275 |
+
|
| 276 |
if kpi_name:
|
| 277 |
print(
|
| 278 |
f"KPI={kpi_name} | "
|
| 279 |
f"Definition={str(row.get('KPI_Definitions',''))[:50]} | "
|
| 280 |
f"DAX={str(row.get('KPI_DAX',''))[:50]}"
|
| 281 |
)
|
| 282 |
+
|
|
|
|
| 283 |
if not kpi_name and not measure_name:
|
| 284 |
continue
|
| 285 |
|
|
|
|
| 380 |
|
| 381 |
|
| 382 |
def load_default_excel_if_present():
|
| 383 |
+
|
| 384 |
+
if Path(DEFAULT_KPI_EXCEL).exists():
|
| 385 |
+
return load_kpi_excel_mapping(DEFAULT_KPI_EXCEL)
|
| 386 |
+
return {}
|
| 387 |
+
|
| 388 |
|
| 389 |
query_key = normalize_loose(query)
|
| 390 |
|
|
|
|
| 803 |
if not formula:
|
| 804 |
formula = "Formula not available"
|
| 805 |
|
| 806 |
+
business = build_business_meaning(
|
| 807 |
+
audience,
|
| 808 |
+
record.get('kpi_name'),
|
| 809 |
+
record.get('measure_name')
|
| 810 |
+
)
|
| 811 |
|
| 812 |
notes = f"""
|
| 813 |
**KPI Name:** {record.get('kpi_name','')}
|