CSVTableSpecParser
dcmspec.csv_table_spec_parser.CSVTableSpecParser
Bases: SpecParser
Base parser for DICOM Specification IHE tables in CSV-like format.
Source code in src/dcmspec/csv_table_spec_parser.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
parse(table, column_to_attr, name_attr='elem_name', table_id=None, include_depth=None, progress_observer=None)
Parse specification metadata and content from a single table dict.
| PARAMETER | DESCRIPTION |
|---|---|
table
|
A table dict as output by PDFDocHandler.concat_tables, with 'header' and 'data' keys.
TYPE:
|
column_to_attr
|
Mapping from column indices to node attribute names.
TYPE:
|
name_attr
|
The attribute to use for node names.
TYPE:
|
table_id
|
Table identifier for model parsing.
TYPE:
|
include_depth
|
The depth to which included tables should be parsed.
TYPE:
|
progress_observer
|
Accepted for interface compatibility, but ignored in this parser. Included so that this method can be called with the same arguments as other table parsers.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple
|
(metadata_node, content_node)
TYPE:
|
Source code in src/dcmspec/csv_table_spec_parser.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | |
parse_table(tables, column_to_attr, name_attr='elem_name')
Build a tree from tables using column mapping and '>' nesting logic.
| PARAMETER | DESCRIPTION |
|---|---|
tables
|
List of tables, each a list of rows (list of str).
TYPE:
|
column_to_attr
|
Mapping from column indices to node attribute names.
TYPE:
|
name_attr
|
The attribute to use for node names.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Node
|
The root node of the tree.
TYPE:
|
Source code in src/dcmspec/csv_table_spec_parser.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |