Skip to content

Writing TAPPS Plugin

Maurice HT Ling edited this page Aug 4, 2018 · 4 revisions

A TAPPS plugin is a Python module with the following rules:

  1. A plugin has to be a Python file (.py$) named in the following format: <plugin name>_<release number>.py, where has to be a single word in small caps and without underscore or hyphenation, and has to be an integer. For example, “generallinearmodel_1.py” is allowed while “General_Linear_Model_1.py” or “glm_1.0.py” or “GeneralLinearModel_1.py” are not allowed.

  2. The plugin may be a single Python file or can include a package. If the plugin includes a package, then the package folder should be the plugin name and it must be an importable Python package.

  3. The plugin (<plugin name>_<release number>.py) must contain the following items:

    1. name (Name of the plugin)
    2. release (Version or release number of the plugin)
    3. category (Category which this plugin should belong to. Allowed categories are (1) exporter, (2) importer, (3) statistics, (4) statistics.hypothesis, (5) statistics.model, (6) statistics.timeseries, and (7) unclassified.)
    4. shortDescription (A short description of the plugin)
    5. longDescription (Long description of the plugin)
    6. projectURL (URL of this project)
    7. contactDetails (Person(s) to contact for any help or information regarding this plugin)
    8. license (License for this plugin)
    9. instruction string (a multi-line string to explain to users how to fill in the parameters dictionary)
    10. a dictionary called parameters
    11. a function called main.
  4. The parameters dictionary must minimally contain the following key-value pairs:

    1. plugin_name, which must correspond to the name of the plugin
    2. dataframe, for attaching a data frame as input to the plugin
    3. results, for the plugin to attach a data frame as analysis output
  5. The following key-value pairs in parameters dictionary are not mandatory but encouraged:

    1. analysis_name, for user to give a short description of the analysis
    2. analytical_method, for the plugin to know which analysis function to execute is there is more than one analytical option
    3. narrative, for user to give a long description of the analysis
  6. The main function must

    1. take only parameters dictionary as the only parameter
    2. use only information provided in parameters dictionary for execution in order to maintain encapsulation
    3. return the analysis output as a data frame into results key of parameters dictionary
    4. return parameters dictionary at the end.
  7. The main function can call other functions or other modules.

A plugin template (https://github.com/mauriceling/tapps/tree/master/plugins/template_1.py), containing the essential boilerplate codes of a plugin has been provided. Plugin developers are encouraged to duplicate this folder as basic template for development.