MCPcopy
hub / github.com/tanelpoder/0xtools / validate_columns

Method validate_columns

xtop/core/data_source.py:175–208  ·  view source on GitHub ↗

Validate and map column names (case-insensitive). Returns list of actual column names.

(self, columns: List[str], csv_type: str = None)

Source from the content-addressed store, hash-verified

173 return (None, None)
174
175 def validate_columns(self, columns: List[str], csv_type: str = None) -> List[str]:
176 """
177 Validate and map column names (case-insensitive).
178 Returns list of actual column names.
179 """
180 # Ensure columns are discovered
181 if not self.available_columns:
182 self.discover_columns()
183
184 validated = []
185
186 for col in columns:
187 col_lower = col.lower()
188 found = False
189
190 if csv_type and csv_type in self.available_columns:
191 # Look in specific CSV type first
192 if col_lower in self.available_columns[csv_type]:
193 validated.append(self.available_columns[csv_type][col_lower])
194 found = True
195
196 if not found:
197 # Look in all CSV types
198 for csv_cols in self.available_columns.values():
199 if col_lower in csv_cols:
200 validated.append(csv_cols[col_lower])
201 found = True
202 break
203
204 if not found:
205 # Use original column name if not found
206 validated.append(col)
207
208 return validated
209
210 def get_available_values(self, column: str, csv_type: str = 'samples',
211 where_clause: str = "1=1", limit: int = 100) -> List[Any]:

Callers 1

get_available_valuesMethod · 0.95

Calls 1

discover_columnsMethod · 0.95

Tested by

no test coverage detected