Sw1ft0 commited on
Commit
2c65316
·
1 Parent(s): 1f650a0

Add one more special header case handling to data loading section

Browse files
Files changed (1) hide show
  1. app.py +22 -2
app.py CHANGED
@@ -9,14 +9,19 @@ genai.configure(api_key=os.getenv("GEMINI_API_KEY"))
9
  model = genai.GenerativeModel("gemini-2.5-pro")
10
 
11
  # 2. Load Excel data
12
- df2 = pd.read_excel(os.path.join("data_source", "The Alex Ideas Report.xlsx"), sheet_name=None)
13
- # Load all sheets, handle special header case
14
  df1_all = pd.read_excel(
15
  os.path.join("data_source", "OC Onboarding Information.xlsx"),
16
  sheet_name=None,
17
  header=None # load raw to inspect
18
  )
 
 
 
 
 
19
 
 
20
  df1 = {}
21
  for sheet, raw_df in df1_all.items():
22
  if sheet == "PY Event Diary":
@@ -32,6 +37,21 @@ for sheet, raw_df in df1_all.items():
32
  sheet_name=sheet
33
  )
34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  # Build schema info for prompts
36
  def get_schema_info():
37
  lines = ["Report 1 - OC Onboarding Information:"]
 
9
  model = genai.GenerativeModel("gemini-2.5-pro")
10
 
11
  # 2. Load Excel data
12
+ # Load all sheets
 
13
  df1_all = pd.read_excel(
14
  os.path.join("data_source", "OC Onboarding Information.xlsx"),
15
  sheet_name=None,
16
  header=None # load raw to inspect
17
  )
18
+ df2_all = pd.read_excel(
19
+ os.path.join("data_source", "The Alex Ideas Report.xlsx"),
20
+ sheet_name=None,
21
+ header=None # load raw to inspect
22
+ )
23
 
24
+ # Handle special header cases
25
  df1 = {}
26
  for sheet, raw_df in df1_all.items():
27
  if sheet == "PY Event Diary":
 
37
  sheet_name=sheet
38
  )
39
 
40
+ df2 = {}
41
+ for sheet, raw_df in df2_all.items():
42
+ if sheet == "Report Criteria":
43
+ # use row 3 as header
44
+ df2[sheet] = pd.read_excel(
45
+ os.path.join("data_source", "The Alex Ideas Report.xlsx"),
46
+ sheet_name=sheet,
47
+ header=2
48
+ )
49
+ else:
50
+ df2[sheet] = pd.read_excel(
51
+ os.path.join("data_source", "The Alex Ideas Report.xlsx"),
52
+ sheet_name=sheet
53
+ )
54
+
55
  # Build schema info for prompts
56
  def get_schema_info():
57
  lines = ["Report 1 - OC Onboarding Information:"]