dipsikha25 commited on
Commit
b3fc476
·
verified ·
1 Parent(s): 2dbbffc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -12
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
- kpi_name = str(row.get(kpi_col, '')).strip() if kpi_col else ''
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
- return (
382
- load_kpi_excel_mapping(DEFAULT_KPI_EXCEL)
383
- if Path(DEFAULT_KPI_EXCEL).exists()
384
- else {}
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
- business = build_business_meaning(
805
- audience,
806
- record.get('kpi_name'),
807
- record.get('measure_name')
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','')}