Uploaded image for project: 'Reporting Module'
  1. Reporting Module
  2. REPORT-93

Add ScriptedCohortDefinition

    XMLWordPrintable

    Details

    • Complexity:
      Low
    • Sprint:
      2013 - January 9-23

      Description

      Create a type of cohort definition that the user can define in any JSR-223 (javax.script) supported script (Groovy, Javascript, etc):

      • Should have 2 configuration properties:
        • String scriptType
        • String scriptCode
      • The evalutor should do something like:
        ScriptEngineManager manager = new ScriptEngineManager();
        ScriptEngine scriptEngine = manager.getEngineByName(scriptType);
        scriptEngine.put("context", context); // this is the reporting 
        scriptEngine.put("parameters", context.getParameters());
        Object result = scriptEngine.eval(scriptCode);
        try {
          if (result instanceof Cohort)
            return (Cohort) result;
          }
          else {
            return new Cohort((Collection<Integer>) result);
          }
        }
        catch (Exception e) {
          throw new EvaluationException("A Scripted Cohort Definition must return either a Cohort or a Collection<Integer>");
        }
        
      • Should have a user interface similar (or exactly like) the Sql Cohort Definition UI. The user should be able to define parameters that it accepts, and there should be a big text area for defining the script. There also needs to be a dropdown list of available Script types in order for the user to specify the type of script that they are authoring. You can get these from the javax.script package easily.

      For examples of using javax.script, see:

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                dkayiwa Daniel Kayiwa
                Reporter:
                mseaton Mike Seaton
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:

                    Time Tracking

                    Estimated:
                    Original Estimate - 3 days
                    3d
                    Remaining:
                    Remaining Estimate - 0 minutes
                    0m
                    Logged:
                    Time Spent - 3 days
                    3d