Update app.py
Browse files
app.py
CHANGED
|
@@ -321,12 +321,21 @@ class DicomAnalyzer:
|
|
| 321 |
wb = openpyxl.load_workbook(template_path, data_only=False)
|
| 322 |
ws = wb.active
|
| 323 |
|
| 324 |
-
# Define the column groups for horizontal saving
|
| 325 |
column_groups = [
|
| 326 |
-
('B', 'C', 'D', 'E', 'F'),
|
| 327 |
-
('H', 'I', 'J', 'K', 'L'),
|
| 328 |
-
('N', 'O', 'P', 'Q', 'R'),
|
| 329 |
-
('T', 'U', 'V', 'W', 'X'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 330 |
]
|
| 331 |
|
| 332 |
# Define row pairs
|
|
@@ -349,7 +358,7 @@ class DicomAnalyzer:
|
|
| 349 |
current_row_pair = 0
|
| 350 |
|
| 351 |
while result_idx < len(self.results):
|
| 352 |
-
if
|
| 353 |
break
|
| 354 |
|
| 355 |
# Get current positions
|
|
@@ -386,14 +395,16 @@ class DicomAnalyzer:
|
|
| 386 |
ws[f"{cols[4]}{rows[1]}"] = float(result['Max'])
|
| 387 |
result_idx += 1
|
| 388 |
|
| 389 |
-
# Move to next column group
|
| 390 |
current_col_group += 1
|
| 391 |
|
| 392 |
-
# If we've used all column groups, move to next row pair
|
| 393 |
if current_col_group >= len(column_groups):
|
| 394 |
current_col_group = 0
|
| 395 |
current_row_pair += 1
|
| 396 |
|
|
|
|
|
|
|
| 397 |
# Save while preserving formulas
|
| 398 |
wb.save(output_path)
|
| 399 |
print(f"Saved {result_idx} results to template")
|
|
|
|
| 321 |
wb = openpyxl.load_workbook(template_path, data_only=False)
|
| 322 |
ws = wb.active
|
| 323 |
|
| 324 |
+
# Define the column groups for horizontal saving (13 groups)
|
| 325 |
column_groups = [
|
| 326 |
+
('B', 'C', 'D', 'E', 'F'), # First group
|
| 327 |
+
('H', 'I', 'J', 'K', 'L'), # Second group
|
| 328 |
+
('N', 'O', 'P', 'Q', 'R'), # Third group
|
| 329 |
+
('T', 'U', 'V', 'W', 'X'), # Fourth group
|
| 330 |
+
('Z', 'AA', 'AB', 'AC', 'AD'), # Fifth group
|
| 331 |
+
('AF', 'AG', 'AH', 'AI', 'AJ'), # Sixth group
|
| 332 |
+
('AL', 'AM', 'AN', 'AO', 'AP'), # Seventh group
|
| 333 |
+
('AR', 'AS', 'AT', 'AU', 'AV'), # Eighth group
|
| 334 |
+
('AX', 'AY', 'AZ', 'BA', 'BB'), # Ninth group
|
| 335 |
+
('BD', 'BE', 'BF', 'BG', 'BH'), # Tenth group
|
| 336 |
+
('BJ', 'BK', 'BL', 'BM', 'BN'), # Eleventh group
|
| 337 |
+
('BP', 'BQ', 'BR', 'BS', 'BT'), # Twelfth group
|
| 338 |
+
('BV', 'BW', 'BX', 'BY', 'BZ') # Thirteenth group
|
| 339 |
]
|
| 340 |
|
| 341 |
# Define row pairs
|
|
|
|
| 358 |
current_row_pair = 0
|
| 359 |
|
| 360 |
while result_idx < len(self.results):
|
| 361 |
+
if current_row_pair >= len(row_pairs):
|
| 362 |
break
|
| 363 |
|
| 364 |
# Get current positions
|
|
|
|
| 395 |
ws[f"{cols[4]}{rows[1]}"] = float(result['Max'])
|
| 396 |
result_idx += 1
|
| 397 |
|
| 398 |
+
# Move to next column group
|
| 399 |
current_col_group += 1
|
| 400 |
|
| 401 |
+
# If we've used all 13 column groups, move to next row pair
|
| 402 |
if current_col_group >= len(column_groups):
|
| 403 |
current_col_group = 0
|
| 404 |
current_row_pair += 1
|
| 405 |
|
| 406 |
+
print(f"Processed results {result_idx-2}-{result_idx-1} in columns {cols[0]}-{cols[4]} rows {rows[0]}-{rows[1]}")
|
| 407 |
+
|
| 408 |
# Save while preserving formulas
|
| 409 |
wb.save(output_path)
|
| 410 |
print(f"Saved {result_idx} results to template")
|