bluesearch.database.topic_info module¶
Implementation of the TopicInfo data structure.
- class TopicInfo(source: ArticleSource, path: str | pathlib.Path, element_in_file: int | None = None)[source]¶
Bases:
objectThe topic information extracted from a journal article.
For the spec see the following GitHub issue/comment: https://github.com/BlueBrain/Search/issues/518#issuecomment-985525160
- add_article_topics(kind: str, topics: Iterable[str]) None[source]¶
Add article topics.
- Parameters
kind – The topic kind. For example “MeSH” or “MAG”.
topics – A collection of the topics to add.
- add_journal_topics(kind: str, topics: Iterable[str]) None[source]¶
Add journal topics.
- Parameters
kind – The topic kind. For example “MeSH” or “MAG”.
topics – A collection of the topics to add.
- article_topics: dict[str, list[str]]¶
- element_in_file: int | None = None¶
- classmethod from_dict(data: dict) bluesearch.database.topic_info.TopicInfo[source]¶
Parse topic info from a dictionary.
- Parameters
data – The dictionary to parse.
- Returns
The parsed topic info.
- Return type
- journal_topics: dict[str, list[str]]¶
- json() dict[source]¶
Convert the contents of this class to a structured dictionary.
Apart from the source, path and topic entries a “metadata” top-level key will be added containing a dictionary with entries “created-date” and “bbs-version”.
- Returns
The structure dictionary with all topic information.
- Return type
dict
- path: str | pathlib.Path¶
- source: ArticleSource¶