12
12
13
13
from . import __version__
14
14
from .pipelines .derivations import DERIVATIONS , conversations
15
- from .projects import ChildProject
15
+ from .projects import ChildProject , METADATA_FOLDER
16
16
from .converters import *
17
17
from .tables import IndexTable , IndexColumn , assert_dataframe , assert_columns_presence
18
18
from .utils import Segment , intersect_ranges , path_is_parent , TimeInterval , series_to_datetime , find_lines_involved_in_overlap
19
19
20
+ ANNOTATIONS_CSV = 'annotations.csv'
21
+ SETS_CSV = 'sets.csv'
20
22
21
23
# Create a logger for the module (file)
22
24
logger_annotations = logging .getLogger (__name__ )
@@ -290,7 +292,7 @@ def __init__(self, project: ChildProject):
290
292
291
293
self .project .read ()
292
294
293
- index_path = os .path .join (self .project .path , "metadata" , "annotations.csv" )
295
+ index_path = os .path .join (self .project .path , METADATA_FOLDER , ANNOTATIONS_CSV )
294
296
if not os .path .exists (index_path ):
295
297
open (index_path , "w+" ).write ("," .join ([c .name for c in self .INDEX_COLUMNS ]))
296
298
@@ -306,7 +308,7 @@ def read(self) -> Tuple[List[str], List[str]]:
306
308
"""
307
309
table = IndexTable (
308
310
"input" ,
309
- path = os .path .join (self .project .path , "metadata/annotations.csv" ),
311
+ path = os .path .join (self .project .path , METADATA_FOLDER , ANNOTATIONS_CSV ),
310
312
columns = self .INDEX_COLUMNS ,
311
313
)
312
314
self .annotations = table .read ()
@@ -426,7 +428,7 @@ def write(self):
426
428
] = self .annotations [["time_seek" , "range_onset" , "range_offset" ]].astype (np .int64 )
427
429
self .annotations = self .annotations .sort_values (['imported_at' ,'set' , 'annotation_filename' ])
428
430
self .annotations .to_csv (
429
- os .path .join (self .project .path , "metadata/annotations.csv" ), index = False
431
+ os .path .join (self .project .path , METADATA_FOLDER , ANNOTATIONS_CSV ), index = False
430
432
)
431
433
432
434
def _check_for_outdated_merged_sets (self , sets : set = None ):
@@ -888,7 +890,7 @@ def derive_annotations(self,
888
890
"""
889
891
input_processed = self .annotations [self .annotations ['set' ] == input_set ].copy ()
890
892
assert not input_processed .empty , "Input set {0} does not exist,\
891
- existing sets are in the 'set' column of annotations.csv " .format (input_set )
893
+ existing sets are in the 'set' column of {1} " .format (input_set , ANNOTATIONS_CSV )
892
894
893
895
assert input_set != output_set , "Input set {0} should be different than output\
894
896
set {1}" .format (input_set , output_set )
0 commit comments