Skip to content

Commit

Permalink
Rename util function for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
russellkan committed Apr 23, 2020
1 parent db94f23 commit f0c7b8a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions dicom_standard/extract_attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import sys

from dicom_standard import parse_lib as pl
from dicom_standard.table_utils import TableDictType, get_tables_from_ids
from dicom_standard.table_utils import TableDictType, get_table_rows_from_ids

COLUMN_TITLES = ['tag', 'name', 'keyword', 'valueRepresentation', 'valueMultiplicity', 'retired']
TABLE_IDS = ['table_6-1', 'table_7-1', 'table_8-1', 'table_9-1']
Expand All @@ -24,6 +24,6 @@ def attribute_table_to_json(table: List[TableDictType]) -> List[TableDictType]:

if __name__ == '__main__':
standard = pl.parse_html_file(sys.argv[1])
table = get_tables_from_ids(standard, TABLE_IDS, COLUMN_TITLES)
table = get_table_rows_from_ids(standard, TABLE_IDS, COLUMN_TITLES)
parsed_table_data = attribute_table_to_json(table)
pl.write_pretty_json(parsed_table_data)
4 changes: 2 additions & 2 deletions dicom_standard/extract_sops.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import sys

from dicom_standard import parse_lib as pl
from dicom_standard.table_utils import TableDictType, get_tables_from_ids
from dicom_standard.table_utils import TableDictType, get_table_rows_from_ids

COLUMN_TITLES = ['name', 'id', 'ciod']
TABLE_IDS = ['table_B.5-1', 'table_I.4-1', 'table_GG.3-1']
Expand Down Expand Up @@ -37,6 +37,6 @@ def sop_table_to_json(table: List[TableDictType]) -> List[TableDictType]:

if __name__ == '__main__':
standard = pl.parse_html_file(sys.argv[1])
table = get_tables_from_ids(standard, TABLE_IDS, COLUMN_TITLES)
table = get_table_rows_from_ids(standard, TABLE_IDS, COLUMN_TITLES)
parsed_table_data = sop_table_to_json(table)
pl.write_pretty_json(parsed_table_data)
2 changes: 1 addition & 1 deletion dicom_standard/table_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def table_to_list(table_div: Tag) -> List[List[str]]:
for row in pr.table_rows(table_div)]


def get_tables_from_ids(standard: BeautifulSoup, table_ids: List[str], col_titles: List[str]) -> List[TableDictType]:
def get_table_rows_from_ids(standard: BeautifulSoup, table_ids: List[str], col_titles: List[str]) -> List[TableDictType]:
table_dict_list: List[TableDictType] = []
all_tables = standard.find_all('div', class_='table')
for table_id in table_ids:
Expand Down

0 comments on commit f0c7b8a

Please sign in to comment.