Spaces:
Running
Running
feat: Add validation to skip duplicate header rows in batch processing
Browse files- Skip rows where majority of cell values match column names (header duplicates)
- Add tests_data/ to .gitignore to prevent binary xlsx files from being committed
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- .gitignore +1 -0
- interface.py +7 -0
.gitignore
CHANGED
|
@@ -55,6 +55,7 @@ isolated-lp-generation/
|
|
| 55 |
|
| 56 |
# Ігноруємо тестові файли
|
| 57 |
data_test/
|
|
|
|
| 58 |
|
| 59 |
# Ігноруємо додані документи
|
| 60 |
Add_docs/
|
|
|
|
| 55 |
|
| 56 |
# Ігноруємо тестові файли
|
| 57 |
data_test/
|
| 58 |
+
tests_data/
|
| 59 |
|
| 60 |
# Ігноруємо додані документи
|
| 61 |
Add_docs/
|
interface.py
CHANGED
|
@@ -418,6 +418,13 @@ async def process_batch_testing(
|
|
| 418 |
|
| 419 |
court_decision_text = str(row['text'])
|
| 420 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 421 |
# Generate legal position
|
| 422 |
try:
|
| 423 |
legal_position_json = generate_legal_position(
|
|
|
|
| 418 |
|
| 419 |
court_decision_text = str(row['text'])
|
| 420 |
|
| 421 |
+
# Skip rows where cell values match column names — these are duplicate header rows
|
| 422 |
+
col_values = {str(col): str(row[col]) for col in row.index}
|
| 423 |
+
header_matches = sum(1 for col, val in col_values.items() if val == col)
|
| 424 |
+
if header_matches >= max(1, len(col_values) // 2):
|
| 425 |
+
results.append("ПРОПУЩЕНО: рядок містить назви колонок (дублікат заголовка)")
|
| 426 |
+
continue
|
| 427 |
+
|
| 428 |
# Generate legal position
|
| 429 |
try:
|
| 430 |
legal_position_json = generate_legal_position(
|