Skip to content

Commit 11ef110

Browse files
authored
Merge pull request #33 from hkir-dev/tdt_sprint_4
table name simplification applied
2 parents ef80de7 + dd2fe6e commit 11ef110

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
requests
2-
cas-tools==0.0.1.dev24
2+
cas-tools==0.0.1.dev31

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
setup(
1010
name="tdta",
11-
version="0.1.0.dev3",
11+
version="0.1.0.dev4",
1212
description="The aim of this project is to provide taxonomy development tools custom actions.",
1313
long_description=README,
1414
long_description_content_type="text/markdown",

src/tdta/tdt_export.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
CONFLICT_TBL_EXT = "_conflict"
1515

16-
cas_table_postfixes = ["_annotation", "_labelset", "_metadata", "_annotation_transfer"]
16+
cas_tables = ["annotation", "labelset", "metadata", "annotation_transfer"]
1717

1818

1919
def export_cas_data(sqlite_db: str, output_file: str, dataset_cache_folder: str = None):
@@ -27,13 +27,13 @@ def export_cas_data(sqlite_db: str, output_file: str, dataset_cache_folder: str
2727

2828
cas_tables = get_table_names(sqlite_db)
2929
for table_name in cas_tables:
30-
if table_name.endswith("_metadata"):
30+
if table_name == "metadata":
3131
parse_metadata_data(cta, sqlite_db, table_name)
32-
elif table_name.endswith("_annotation"):
32+
elif table_name == "annotation":
3333
parse_annotation_data(cta, sqlite_db, table_name)
34-
elif table_name.endswith("_labelset"):
34+
elif table_name == "labelset":
3535
parse_labelset_data(cta, sqlite_db, table_name)
36-
elif table_name.endswith("_annotation_transfer"):
36+
elif table_name == "annotation_transfer":
3737
parse__annotation_transfer_data(cta, sqlite_db, table_name)
3838

3939
project_config = read_project_config(Path(output_file).parent.absolute())
@@ -168,7 +168,7 @@ def get_table_names(sqlite_db):
168168
columns = list(map(lambda x: x[0], cursor.description))
169169
table_column_index = columns.index('table')
170170
for row in rows:
171-
if str(row[table_column_index]).endswith(tuple(cas_table_postfixes)):
171+
if str(row[table_column_index]) in cas_tables:
172172
cas_tables.append(str(row[table_column_index]))
173173
return cas_tables
174174

0 commit comments

Comments
 (0)