Skip to content

Commit

Permalink
process.py: File handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Ed (ODSC) committed Nov 29, 2024
1 parent af64ab7 commit ba6b49c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cove_bods/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@
logger = getLogger(__name__)


def check_table_file_new(filename):
def check_table_file_new(input_file):
logger.info(f"{filename} {type(filename)}")
if get_file_type_for_flatten_tool(filename) == "xlsx":
data = pandas.read_excel(filename)
if get_file_type_for_flatten_tool(input_file) == "xlsx":
data = pandas.read_excel(input_file.upload_dir_and_filename())
if "statementID" in data.head():
return False
else:
return True
else:
with open(filename) as file:
with open(input_file.upload_dir_and_filename()) as file:
head = file.readline()
if "statementID" in data.head():
return False
Expand Down Expand Up @@ -202,7 +202,7 @@ def process(self, process_data: dict) -> dict:
# We don't know what schema version the spreadsheet is in. Use default schema.
schema = SchemaBODS()

if check_table_file_new(input_filename):
if check_table_file_new(supplied_data_json_file):
statement_id_name = "statementID"
else:
statement_id_name = "statementId"
Expand Down

0 comments on commit ba6b49c

Please sign in to comment.