Skip to content

How to create a public or private LOEP plugin with new evaluation models and metrics

Aldo edited this page Mar 9, 2018 · 9 revisions

How to create a public or private LOEP plugin with new evaluation models and metrics

  1. Which is a LOEP plugin?
  2. How to create a LOEP plugin
  3. How to add new evaluation models and metrics to a LOEP plugin

LOEP plugins allow to extend LOEP with new features as well as to override original features. These plugins are defined as Rails engines. You can check this guide for further information on Rails engines. LOEP plugins can be public or private. Thereby, it's possible to add private features (e.g. support for a private evaluation model) to the open source LOEP system by using plugins. A LOEP plugin can be packaged in a single ZIP file, which can be used for its distribution. Next section explains how to create a plugin for LOEP.
A common reason to create a LOEP plugin is to provide new evaluations models and/or metrics. Section 3 explains how to do that.

The first step to create a LOEP plugin is to execute the following command in the root path of the LOEP application:

rails plugin new pluginName --full

This will create a folder called pluginName in the root path of the LOEP application which should be moved to the loep_plugins folder as follows:

mv pluginName loep_plugins/

Then, we need to add the plugin to the application_config.yml file in order to enable it. For that, we should add pluginName to the array specified in the plugins key.
 
By default, the created plugin located at /loep_plugins/pluginName will not be uploaded to the public repository so it will remain private. If you want to make the plugin public, you can add an exception in the .gitignore file as follows:

!loep_plugins/pluginName

In order to deploy a private plugin to a LOEP instance, such a plugin should be specified in the private_plugins key of the corresponding deploy xml file.

Finally, you can specify different settings for the plugin in the following files located at /loep_plugins/pluginName: README.rdoc and pluginName.gemspec. By default a file called MIT-LICENSE is created at the root of the plugin path. You are free to remove such a file and specify the license you want in the README.rdoc file. If you remove the MIT-LICENSE file, remove also the reference to the file included in the pluginName.gemspec file.
 

As explained in other sections of the wiki, LOEP allows to define new evaluation models as well as metrics. Instead of defining these models or metrics in the core system, it is possible to define them as plugins. This approach can be useful in some situations, for instance, for adding support to private evaluation models and metrics, or to provide a set of evaluation models and metrics packaged in a single ZIP file. This guide explains how to create a plugin and define in it an evaluation model and a metric.

After creating a plugin following the previous instructions, it is possible to create evaluation models and metrics for the plugin with the tasks generate:evmethod and generate:metric as indicated in the sections How to add a new evaluation model and How to add a new metric, but adding an extra parameter indicating the name of the plugin.

Thereby, in order to create a new evaluation model, instead of using:

bundle exec rake generate:evmethod["modelName","multiple","automatic","moduleName"]

as indicated in the How to add a new evaluation model section, we should use:

bundle exec rake generate:evmethod["modelName","multiple","automatic","moduleName","pluginName"]

For instance, to create an evaluation model called "Starp" in a plugin termed "loep_stars_private" the following command should be executed:

bundle exec rake generate:evmethod["Starp","false","false",,"loep_stars_private"]

Similarly, in order to create a new metric, instead of using:

bundle exec rake generate:metric["metricName","evModelNames","moduleName"]

as indicated in the How to add a new metric section, we should use:

bundle exec rake generate:metric["metricName","evModelNames","moduleName","pluginName"]

For instance, to create a metric called "Starp Metric" in a plugin termed "loep_stars_private" the following command should be executed:

bundle exec rake generate:metric["Starp Metric","Starp",,"loep_stars_private"]

Finally, in order to use the new evaluation model and metric created, they should be enabled in the application_config.yml file: "Starp" should be added to the evmethods key and "Starp Metric" should be added to the metrics key.

The evaluation models and metrics can be customized as indicated in the sections How to add a new evaluation model and How to add a new metric. A full example of a plugin that provides a new evaluation model and a metric is provided here. A private version of this same plugin provided as a single ZIP file is provided at /extras/loep_stars_private.zip.

To allow the plugin to be succesfully installed in new LOEP instances, a task named pluginName:install should be provided in order to populate the database with all required data. For example, in the case of a plugin that provides a new evaluation model and a new metric, this task should create the database instances for both the model and the metric. An example of this kind of tasks can be found here.