11"""Coordinate parsing processor for the pipeline."""
22
33import logging
4- import csv
5- from pathlib import Path
64from typing import List
75
86from .openai_client import CoordinateParsingClient
@@ -37,25 +35,16 @@ def process_single_table(self, table):
3735 List of analyses extracted from the table
3836 """
3937 try :
40- # Load the table data
41- for path_attr in self .path_preference :
42- table_path_value = getattr (table , path_attr , None )
43- if table_path_value :
44- table_path = Path (table_path_value )
45- break
46- else :
38+ # Load the raw table content using the table's method
39+ table .load_raw_table ()
40+
41+ # If we couldn't load the raw table content, return empty list
42+ if table .raw_table is None :
4743 logger .warning (f"No valid table path found for table: { table .table_id } " )
4844 return []
49- table_path = Path (table_path )
50- if not table_path .exists ():
51- logger .warning (f"Table file not found: { table_path } " )
52- return []
5345
54- # Read the table as text
55- with open (table_path , "r" , encoding = "utf-8" ) as f :
56- reader = csv .reader (f )
57- rows = list (reader )
58- table_text = "\n " .join (["," .join (r ) for r in rows ])
46+ # Use the raw_table content directly
47+ table_text = table .raw_table
5948
6049 # Create a prompt for the table
6150 prompt = self ._create_table_prompt (
@@ -69,7 +58,7 @@ def process_single_table(self, table):
6958 return result .analyses
7059
7160 except Exception as e :
72- logger .warning (f"Error processing table { table .table_path } : { e } " )
61+ logger .warning (f"Error processing table { table .table_id } : { e } " )
7362 return []
7463
7564 def _create_table_prompt (self , table_text : str , table_caption : str = "" , table_foot : str = "" ) -> str :
0 commit comments