Skip to content

Customizing Reports in the Platform

All the dashboards seen in Corridor are customizable to suit your needs. To customize them, the following steps are required:

  • Creating of analytical report classes (covered in the user manual)
  • Packaging reports and configuring them in the platform
  • Controlling the visibility of the report in the dashboards

Creating the analytical report can be done using spark and plotly as described in the User Manual. Once that report class is created, this document discusses the technical configurations required to use that class within the platform.

Creating a reporting package

When the platform looks for reports, it searches within certain modules for which report classes are available. It does this by going through the appropriate module, and searching for any classes in that module that inherit from one of the reporting base classes (like BaseFeatureReport, BaseModelReport, etc.).

Hence, there are 2 steps needed to set this up:

  • Install the report python package in the system
  • Configure the platform to read from this package/module

The python package can be created in any standard way, as long as the platform can import that package using the standard import statement in python.

The set of modules that the platform will look in can be configured by using the configuration variable REPORT_LOCATIONS in the api_config.py. This configuration as well as the package needs to be available in both the API/API-worker (which performs the visualization logic) as well as the Spark-Worker (which performs the computation logic).

Example: Using a single python file as a package

  • Create a file with the report classes in a file like: /opt/corridor/reports/my_custom_report.py
  • Add this path to the Python PATH by modifying the api_config.py:
import sys
sys.path.insert(0, '/opt/corridor/reports')
  • Add the name of the module (i.e. my_custom_report) to the REPORT_LOCATIONS list in api_config.py:
REPORT_LOCATIONS = ['corridor_reports', 'my_custom_report']

NOTE: corridor_reports is the module where the default corridor reports are kept. TO disable the default reports in Corridor, this can be removed from the REPORT_LOCATIONS

Example: Using a distutils-based python package

Here, we use the distutils

/opt/corridor/venv-api/bin/pip install <<PACKAGE_NAME>>
  • Add the name of the python package's module to the REPORT_LOCATIONS list in api_config.py:
REPORT_LOCATIONS = ['corridor_reports', '<<MODULE_NAME>>']