HTML browsing and curation (indra.assemblers.html.assembler) — INDRA 1.22.0 documentation (original) (raw)

INDRA

Format a set of INDRA Statements into an HTML-formatted report which also supports curation.

indra.assemblers.html.assembler.DB_TEXT_COLOR = 'black'

The text color for database sources when shown as source count badges

indra.assemblers.html.assembler.READER_TEXT_COLOR = 'white'

The text color for reader sources when shown as source count badges

indra.assemblers.html.assembler.generate_source_css(fname, source_colors=None)[source]

Save a stylesheet defining color, background-color for the given sources

Parameters

class indra.assemblers.html.assembler.HtmlAssembler(statements=None, summary_metadata=None, ev_counts=None, beliefs=None, source_counts=None, curation_dict=None, title='INDRA Results', db_rest_url=None, sort_by='default', custom_stats=None, custom_sources=None)[source]

Generates an HTML-formatted report from INDRA Statements.

The HTML report format includes statements formatted in English (by the EnglishAssembler), text and metadata for the Evidence object associated with each Statement, and a Javascript-based curation interface linked to the INDRA database (access permitting). The interface allows for curation of statements at the evidence level by letting the user specify type of error and (optionally) provide a short description of of the error.

Parameters

statements

A list of INDRA Statements to assemble.

Type

list[indra.statements.Statement]

model

The HTML report formatted as a single string.

Type

str

metadata

Dictionary of statement list metadata such as that provided by the INDRA REST API.

Type

dict

ev_counts

A dictionary of the total evidence available for each statement indexed by hash.

Type

dict

beliefs

A dictionary of the belief score of each statement, indexed by hash.

Type

dict

db_rest_url

The URL to a DB REST API.

Type

str

add_statements(statements)[source]

Add a list of Statements to the assembler.

Parameters

statements (list[ indra.statements.Statement ]) – A list of INDRA Statements to be added to the assembler.

make_json_model(grouping_level='agent-pair', no_redundancy=False, **kwargs)[source]

Return the JSON used to create the HTML display.

Parameters

Returns

json – A complexly structured JSON dict containing grouped statements and various metadata.

Return type

dict

make_model(template=None, grouping_level='agent-pair', add_full_text_search_link=False, no_redundancy=False, **template_kwargs)[source]

Return the assembled HTML content as a string.

Parameters

Returns

The assembled HTML as a string.

Return type

str

append_warning(msg)[source]

Append a warning message to the model to expose issues.

save_model(fname, **kwargs)[source]

Save the assembled HTML into a file.

Other kwargs are passed directly to make_model.

Parameters

fname (str) – The path to the file to save the HTML into.

indra.assemblers.html.assembler.src_url(ev)[source]

Given an Evidence object, provide the URL for the source

Return type

str

indra.assemblers.html.assembler.tag_text(text, tag_info_list)[source]

Apply start/end tags to spans of the given text.

Parameters

Returns

String where the specified substrings have been surrounded by the given start and close tags.

Return type

str

indra.assemblers.html.assembler.complete_source_counts(source_counts)[source]

Return source counts that are complete with respect to all sources.

This is necessary because the statement presentation module expects that all sources that appear in any statement source count appear in all statement source counts (even if the count is 0).