HTML browsing and curation (
Format a set of INDRA Statements into an HTML-formatted report which also supports curation.
HtmlAssembler(statements=None, summary_metadata=None, ev_totals=None, source_counts=None, curation_dict=None, title='INDRA Results', db_rest_url=None)¶
Generates an HTML-formatted report from INDRA Statements.
- statements (Optional[list[indra.statements.Statement]]) – A list of INDRA Statements to be added to the assembler. Statements can also be added using the add_statements method after the assembler has been instantiated.
- summary_metadata (Optional[dict]) – Dictionary of statement corpus metadata such as that provided by the INDRA REST API. Default is None. Each value should be a concise summary of O(1), not of order the length of the list, such as the evidence totals. The keys should be informative human-readable strings.
- ev_totals (Optional[dict]) – A dictionary of the total evidence available for each statement indexed by hash. Default: None
- source_counts (Optional[dict]) – A dictionary of the itemized evidence counts, by source, available for each statement, indexed by hash. Default: None.
- title (str) – The title to be printed at the top of the page.
- db_rest_url (Optional[str]) – The URL to a DB REST API to use for links out to further evidence. If given, this URL will be prepended to links that load additional evidence for a given Statement. One way to obtain this value is from the configuration entry indra.config.get_config(‘INDRA_DB_REST_URL’). If None, the URLs are constructed as relative links. Default: None
A list of INDRA Statements to assemble.
The HTML report formatted as a single string.
Dictionary of statement list metadata such as that provided by the INDRA REST API.
A dictionary of the total evidence available for each statement indexed by hash.
The URL to a DB REST API.
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.
Append a warning message to the model to expose issues.
Return the JSON used to create the HTML display.
Parameters: with_grouping (bool) – If True, statements will be grouped under multiple sub-headings. If False, all headings will be collapsed into one on every level, with all statements placed under a single heading. Returns: json – A complexly structured JSON dict containing grouped statements and various metadata. Return type: dict
make_model(template=None, with_grouping=True, **template_kwargs)¶
Return the assembled HTML content as a string.
- template (a Template object) – Manually pass a Jinja template to be used in generating the HTML. The template is responsible for rendering essentially the output of make_json_model.
- with_grouping (bool) – If True, statements will be grouped under multiple sub-headings. If False, all headings will be collapsed into one on every level, with all statements placed under a single heading.
- other keyword arguments are passed along to the template. If you (All) –
- using a custom template with args that are not passed below, this (are) –
- how you pass them. (is) –
The assembled HTML as a string.
Save the assembled HTML into a file.
Parameters: fname (str) – The path to the file to save the HTML into.
Apply start/end tags to spans of the given text.
- text (str) – Text to be tagged
- tag_info_list (list of tuples) – Each tuple refers to a span of the given text. Fields are (start_ix, end_ix, substring, start_tag, close_tag), where substring, start_tag, and close_tag are strings. If any of the given spans of text overlap, the longest span is used.
String where the specified substrings have been surrounded by the given start and close tags.