Exemplo n.º 1
0
def get_table_with_metadata(
        table_with_tdiv: Tuple[List[TableDictType], Tag]) -> MetadataTableType:
    table, tdiv = table_with_tdiv
    table_name = pr.table_name(tdiv)
    clean_name = pl.clean_table_name(table_name)
    table_description = pr.table_description(tdiv)
    is_macro = True if MACRO_TABLE_SUFFIX.match(table_name) else False
    # Standard workaround: Add description to module without a description paragraph
    # http://dicom.nema.org/dicom/2013/output/chtml/part03/sect_F.3.html#sect_F.3.2.1
    if table_description.has_attr(
            'class') and 'title' in table_description.get('class'):
        table_description_str = f'<p>{clean_name} {"Macro" if is_macro else "Module"}.</p>'
        table_description = BeautifulSoup(table_description_str, 'html.parser')
    return {
        'name':
        clean_name,
        'attributes':
        table,
        'id':
        pl.create_slug(clean_name),
        'description':
        str(clean_table_description(table_description, is_macro)),
        'linkToStandard':
        fix_nonstandard_section_links(get_short_standard_link(tdiv)),
        'isMacro':
        is_macro,
    }
def get_table_with_metadata(table_with_tdiv):
    table, tdiv = table_with_tdiv
    clean_name = pl.clean_table_name(pr.table_name(tdiv))
    table_description = get_ciod_description(tdiv)
    return {
        'name': clean_name,
        'modules': table,
        'id': pl.create_slug(clean_name),
        'description': str(table_description),
        'linkToStandard': get_short_standard_link(tdiv)
    }
Exemplo n.º 3
0
def get_table_with_metadata(
        table_with_tdiv: Tuple[List[TableDictType], Tag]) -> MetadataTableType:
    table, tdiv = table_with_tdiv
    clean_name = pl.clean_table_name(pr.table_name(tdiv))
    table_description = get_table_description(tdiv)
    return {
        'name': clean_name,
        'modules': table,
        'id': pl.create_slug(clean_name),
        'description': str(table_description),
        'linkToStandard': get_short_standard_link(tdiv)
    }
Exemplo n.º 4
0
def clean_macro_table_name(table_name: str) -> str:
    clean_name = pl.clean_table_name(table_name)
    if clean_name == 'Ophthalmic Tomography':
        clean_name = 'Ophthalmic Tomography Image'
    return clean_name