1111from dash import html
1212from pandas import DataFrame
1313
14- from utils .settings import get_GVC
14+ from utils .settings import get_GVC , CACHE_FOLDER
1515from utils .spectro_reader import get_quest2 , get_lcmodel , parse_lcmodel
1616from utils .settings import get_DB
1717
@@ -39,14 +39,14 @@ def get_cquest_experiment_data(experiment_id: int) -> pd.DataFrame:
3939
4040def read_cquest_file (file_uuid : str ) -> DataFrame :
4141 """Read the file uploaded by the user using the uuid and return a dataframe"""
42- path = os .path .join ("src" , "tmp" , "user_compare" , str (file_uuid ) + ".txt" )
42+ path = os .path .join (CACHE_FOLDER , "user_compare" , str (file_uuid ) + ".txt" )
4343 data = get_quest2 (path )
4444 return data
4545
4646
4747def read_lcmodel_file (file_uuid : str ) -> DataFrame :
4848 """Read the file uploaded by the user using the uuid and return a dataframe"""
49- path = os .path .join ("src" , "tmp" , "user_compare" , str (file_uuid ) + ".table" )
49+ path = os .path .join (CACHE_FOLDER , "user_compare" , str (file_uuid ) + ".table" )
5050 data , diag = get_lcmodel (path )
5151 data = parse_lcmodel (data , diag )
5252 return data
@@ -78,30 +78,30 @@ def get_metadata_cquest(exp_id: int) -> list:
7878
7979def get_files_in_folder (folder_id , extension = 'txt' ):
8080 """Get the files in a folder from user's folder in local"""
81- path = os .path .join ("src" , "tmp" , "user_compare" , str (folder_id ))
81+ path = os .path .join (CACHE_FOLDER , "user_compare" , str (folder_id ))
8282 files = os .listdir (path )
8383 files = [file for file in files if file .endswith (f".{ extension } " )]
8484 return files
8585
8686
8787def read_file_in_folder_cquest (folder , file ):
8888 """Read the file uploaded by the user using the uuid and return a dataframe"""
89- path = os .path .join ("src" , "tmp" , "user_compare" , str (folder ), str (file ))
89+ path = os .path .join (CACHE_FOLDER , "user_compare" , str (folder ), str (file ))
9090 data = get_quest2 (path )
9191 return data
9292
9393
9494def read_file_in_folder_lcmodel (folder , file ):
9595 """Read the file uploaded by the user using the uuid and return a dataframe"""
96- path = os .path .join ("src" , "tmp" , "user_compare" , str (folder ), str (file ))
96+ path = os .path .join (CACHE_FOLDER , "user_compare" , str (folder ), str (file ))
9797 data , diag = get_lcmodel (path )
9898 data = parse_lcmodel (data , diag )
9999 return data
100100
101101
102102def read_folder_cquest (folder ):
103103 """Read all the files in a folder and return a dataframe containing all the data"""
104- path = os .path .join ("src" , "tmp" , "user_compare" , str (folder ))
104+ path = os .path .join (CACHE_FOLDER , "user_compare" , str (folder ))
105105 files = os .listdir (path )
106106 files = [file for file in files if file .endswith (".txt" )]
107107 data = pd .DataFrame ()
@@ -114,7 +114,7 @@ def read_folder_cquest(folder):
114114
115115def read_folder_lcmodel (folder ):
116116 """Read all the files in a folder and return a dataframe containing all the data"""
117- path = os .path .join ("src" , "tmp" , "user_compare" , str (folder ))
117+ path = os .path .join (CACHE_FOLDER , "user_compare" , str (folder ))
118118 files = os .listdir (path )
119119 files = [file for file in files if file .endswith (".table" )]
120120 data = pd .DataFrame ()
0 commit comments