Skip to content

Commit

Permalink
table name simplification applied
Browse files Browse the repository at this point in the history
  • Loading branch information
hkir-dev committed Mar 13, 2024
1 parent ef80de7 commit dd2fe6e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
requests
cas-tools==0.0.1.dev24
cas-tools==0.0.1.dev31
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setup(
name="tdta",
version="0.1.0.dev3",
version="0.1.0.dev4",
description="The aim of this project is to provide taxonomy development tools custom actions.",
long_description=README,
long_description_content_type="text/markdown",
Expand Down
12 changes: 6 additions & 6 deletions src/tdta/tdt_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

CONFLICT_TBL_EXT = "_conflict"

cas_table_postfixes = ["_annotation", "_labelset", "_metadata", "_annotation_transfer"]
cas_tables = ["annotation", "labelset", "metadata", "annotation_transfer"]


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

cas_tables = get_table_names(sqlite_db)
for table_name in cas_tables:
if table_name.endswith("_metadata"):
if table_name == "metadata":
parse_metadata_data(cta, sqlite_db, table_name)
elif table_name.endswith("_annotation"):
elif table_name == "annotation":
parse_annotation_data(cta, sqlite_db, table_name)
elif table_name.endswith("_labelset"):
elif table_name == "labelset":
parse_labelset_data(cta, sqlite_db, table_name)
elif table_name.endswith("_annotation_transfer"):
elif table_name == "annotation_transfer":
parse__annotation_transfer_data(cta, sqlite_db, table_name)

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

Expand Down

0 comments on commit dd2fe6e

Please sign in to comment.