fix:Vendor column style & closed dataset

#16
app/backend/data_page.py CHANGED
@@ -46,6 +46,8 @@ def get_closed_dataset():
46
  return closed_list
47
 
48
 
 
 
49
  def convert_df_to_csv(df):
50
  output = io.StringIO()
51
  df.to_csv(output, index=False)
@@ -230,6 +232,7 @@ def table_area(group_name, grid_state, data_engine=None, df=None):
230
  "font-weight": "bold",
231
  "padding": "10px",
232
  "text-align": "left",
 
233
  },
234
  ".custom-cell-style": {
235
  "font-size": "14px",
 
46
  return closed_list
47
 
48
 
49
+
50
+
51
  def convert_df_to_csv(df):
52
  output = io.StringIO()
53
  df.to_csv(output, index=False)
 
232
  "font-weight": "bold",
233
  "padding": "10px",
234
  "text-align": "left",
235
+ "width":"150px"
236
  },
237
  ".custom-cell-style": {
238
  "font-size": "14px",
app/backend/multi_header_util.py CHANGED
@@ -9,6 +9,21 @@ HEADER_STYLE = {'fontSize': '18px'}
9
  CELL_STYLE = {'fontSize': '18px'}
10
  LINK = ' https://huggingface.co/datasets/embedding-benchmark/'
11
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
  def mutil_header_options(column_list: list, avg_column: str, is_section: bool):
14
  """
@@ -34,15 +49,10 @@ def mutil_header_options(column_list: list, avg_column: str, is_section: bool):
34
 
35
  mutil_column_list = [column for column in column_list if
36
  column not in (avg_column, "Closed average", "Open average")]
37
- close_group_list = list(filter(lambda x: x.startswith('_'), mutil_column_list))
38
- open_group_list = list(filter(lambda x: not x.startswith('_'), mutil_column_list))
39
 
40
  theme = st_theme(key="st_theme_1")
41
- if theme:
42
- current_theme = theme.get("base", "light")
43
- else:
44
- current_theme = "light"
45
-
46
 
47
 
48
  close_group_def = {
@@ -53,7 +63,7 @@ def mutil_header_options(column_list: list, avg_column: str, is_section: bool):
53
 
54
  "headerComponentParams": {
55
  "innerHeaderComponent": "linkHeaderComponent",
56
- "url": LINK + column.replace('_', ''),
57
  "headerName": column
58
  },
59
 
@@ -74,14 +84,14 @@ def mutil_header_options(column_list: list, avg_column: str, is_section: bool):
74
  'field': column,
75
  "headerComponentParams": {
76
  "innerHeaderComponent": "linkHeaderComponent",
77
- "url": LINK + column.replace('_', ''),
78
  "headerName": column
79
  },
80
  'headerClass': 'custom-header-style',
81
  'cellClass': 'custom-cell-style',
82
  'sortable': True,
83
  'width': 150,
84
- "suppressColumnVirtualisation": True,
85
 
86
  } for column in open_group_list
87
  ],
@@ -123,8 +133,8 @@ def get_header_options(column_list: list, avg_column: str, is_section: bool):
123
  },
124
  {'headerName': "Vendor",
125
  'field': 'vendor',
126
- 'headerStyle': HEADER_STYLE,
127
- 'cellStyle': CELL_STYLE,
128
  # 'suppressSizeToFit': True
129
  },
130
  {'headerName': "Overall Score",
 
9
  CELL_STYLE = {'fontSize': '18px'}
10
  LINK = ' https://huggingface.co/datasets/embedding-benchmark/'
11
 
12
+ def get_dataset_url_name(field_name):
13
+ """Convert field name to proper URL format for closed datasets"""
14
+ # Handle field names like "ClosedDataset 2 (German Legal Sentences)"
15
+ if field_name.startswith("ClosedDataset "):
16
+ # Extract the number and format it as ClosedDataset_X
17
+ if "(" in field_name:
18
+ # Extract number from "ClosedDataset 2 (description)" -> "2"
19
+ number_part = field_name.split("ClosedDataset ")[1].split(" ")[0]
20
+ return f"ClosedDataset_{number_part}"
21
+ else:
22
+ # Handle cases where it might already be in the right format or no parentheses
23
+ return field_name.replace(" ", "_")
24
+
25
+ # Return original field_name for open datasets
26
+ return field_name
27
 
28
  def mutil_header_options(column_list: list, avg_column: str, is_section: bool):
29
  """
 
49
 
50
  mutil_column_list = [column for column in column_list if
51
  column not in (avg_column, "Closed average", "Open average")]
52
+ close_group_list = list(filter(lambda x: x.startswith('_') or x.startswith("ClosedDataset "), mutil_column_list))
53
+ open_group_list = list(filter(lambda x: not x.startswith('_') and not x.startswith("ClosedDataset "), mutil_column_list))
54
 
55
  theme = st_theme(key="st_theme_1")
 
 
 
 
 
56
 
57
 
58
  close_group_def = {
 
63
 
64
  "headerComponentParams": {
65
  "innerHeaderComponent": "linkHeaderComponent",
66
+ "url": LINK + get_dataset_url_name(column),
67
  "headerName": column
68
  },
69
 
 
84
  'field': column,
85
  "headerComponentParams": {
86
  "innerHeaderComponent": "linkHeaderComponent",
87
+ "url": LINK + get_dataset_url_name(column),
88
  "headerName": column
89
  },
90
  'headerClass': 'custom-header-style',
91
  'cellClass': 'custom-cell-style',
92
  'sortable': True,
93
  'width': 150,
94
+ # "suppressColumnVirtualisation": True,
95
 
96
  } for column in open_group_list
97
  ],
 
133
  },
134
  {'headerName': "Vendor",
135
  'field': 'vendor',
136
+ 'headerClass': 'custom-header-style',
137
+ 'cellClass': 'custom-cell-style',
138
  # 'suppressSizeToFit': True
139
  },
140
  {'headerName': "Overall Score",