Skip to content

data-governance : DAG 02_create_iahx_xml_collection.py - Geração do campo book_title incorreta #437

@ChicoLopes

Description

@ChicoLopes

Hoje a geração do campo ‘book_title’ está baseada no campo ‘reference_title’ e deveria seguir outra regra.
Deveria ser ‘title_monographic’ (v018 no ISIS) quando ‘literature_type’ (v005 no ISIS) não for ((T ou N) E NÃO FOR ‘treatment_level’ (v006 no ISIS) uma analítica”)

Lógica a ser usada para literature_type e treatmente_level
not((v5='T' or v5='N') and not v6:'a')

Sugestão, trocar:

            'book_title': (
                  doc.get('reference_title')
                  if 'm' in doc.get('treatment_level', '').lower()
                  and doc.get('literature_type', '').upper() not in ['S', 'T', 'N']
                  else None
            ),

Por:

            'book_title': (
                next(
                    (
                        tm.get('text')
                        for tm in doc.get('title_monographic', [])
                        if tm.get('_i') == doc.get('text_language', [None])[0]
                    ),
                    None
                )
                if doc.get('title_monographic')
                and not (
                    doc.get('literature_type', '').upper() in ['T', 'N']
                    and not doc.get('treatment_level', '').lower().startswith('a')
                )
                else None
            ),

Ou algo mais eficiente que isso.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions