From 536ebd2accaa6f570cfc327f2bf9b24d8a2ea60a Mon Sep 17 00:00:00 2001 From: HotSwapp <47397945+HotSwapp@users.noreply.github.com> Date: Thu, 4 Sep 2025 15:33:06 -0500 Subject: [PATCH] validate: treat legacy wide-format SETUP.csv as valid in single-file validate endpoint\n\nNow consistent with batch validation and import paths. --- app/api/import_data.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/api/import_data.py b/app/api/import_data.py index 1c076b4..3bf7bf9 100644 --- a/app/api/import_data.py +++ b/app/api/import_data.py @@ -1743,6 +1743,8 @@ async def validate_csv_file( mapping_info = _build_dynamic_mapping(csv_headers, model_class, file_type) mapped_headers = mapping_info["mapped_headers"] unmapped_headers = mapping_info["unmapped_headers"] + # Accept legacy wide-format SETUP.csv as valid (Appl_Title, L_Head1..10, Default_Printer) + wide_ok = (file_type == "SETUP.csv" and _is_setup_wide_format(csv_headers)) # Sample data validation sample_rows = [] @@ -1770,7 +1772,7 @@ async def validate_csv_file( return { "file_type": file_type, # Consider valid if we can map at least one column; we don't require exact header match - "valid": len(mapped_headers) > 0 and len(errors) == 0, + "valid": (len(mapped_headers) > 0 or wide_ok) and len(errors) == 0, "headers": { "found": csv_headers, "mapped": mapped_headers, @@ -1781,6 +1783,7 @@ async def validate_csv_file( "total_errors": len(errors), "auto_mapping": { "suggestions": mapping_info["suggestions"], + "wide_format": wide_ok, }, }