Core evolution - Statistics Reports improvements

From Gephi:Wiki

Jump to: navigation, search

The Statistics reports is a flexible way to allow freedom in statistics result. As the report is HTML, it allows to change formatting and include images. The current design has however no Report abstraction and only a String text is returned by the Statistics.

For allowing better flexibility and future improvements, a Report abstraction is likely welcome. This page also lists other possible improvements.

Contents

Specifications

  • Generate reports from Statistics, as HTML text
  • View last executed report for each Statistic
  • Save reports as HTML file and folder for images
  • Print reports
  • Copy report text to clipboard
  • Utilities to build reports File:new-icon.png
  • Include Javascript & SVG in reports File:new-icon.png
  • Report navigation, save reports in a binder File:new-icon.png

Current Design

Reports are obtained from Statistics and cached into the StatisticModel. That means the complete report string is saved, but not the Statistics instance. That is good because Statistics are likely to use a lot of memory for their computing and need to be GC after their execution.

Only the latest report for each Statistic is saved, the newest replacing the existing.

Charts

Some charts are generated by Statistics, using JFreeChart. They manually creates PNG images and store them into the default temp directory of the system, in a folder. The images path is written in the HTML code.

Saving, copying or printing the report need quite some hacks to work with chart images. For instance for including Statistics Reports into the Gephi project file, a regex has to be executed on the string to find images and path is replaced by PNG byte array. That may be improved.

Report abstraction and utilities

Here is the current Statistics interface:

/**
 * Define a Statistics/Metrics execution task, that performs analysis and write results
 * as new attribute columns and/or HTML report.
 *
 * @author Patrick J. McSweeney, Mathieu Bastian
 * @see StatisticsBuilder
 */
public interface Statistics {
 
    /**
     * Executes the statistics algorithm.
     * <p>
     * It is preferable to work on <b>visible</b> graphs, to be synchronized with the
     * visualization.
     * @param graphModel The graph topology
     * @param attributeModel The elements attributes, and where to write table results
     */
    public void execute(GraphModel graphModel, AttributeModel attributeModel);
 
    /**
     * Returns an HTML string that displays the statistics result. Can contains
     * complex HTML snippets and images.
     * @return An HTML string that displays the results for this Statistics
     */
    public String getReport();
}

A Report interface, in addition with a Factory or a Helper to build them would be created. It would contain utility methods to help embed images (and objects in general) in the HTML code. Currently the HTML browser in Gephi is poor but that doesn't forbid to create more complex HTML and see them in real browser.

One can imagine the Gephi Toolkit use case where users want to obtain, in one command, a professional looking report, with CSS and JS, automatically opened in Firefox.

HTML browser

Project to have a modern web browser embedded into Gephi.

Personal tools