private void createDataSetDefinition(ReportDefinition reportDefinition) {
    // Create new dataset definition
    RowPerPatientDataSetDefinition dataSetDefinition = new RowPerPatientDataSetDefinition();
    dataSetDefinition.setName("Chemotherapy Daily Patient List");

    dataSetDefinition.addFilter(
        Cohorts.createInProgramParameterizableByDate("Oncology", oncologyProgram),
        ParameterizableUtil.createParameterMappings("onDate=${endDate}"));

    SortCriteria sortCriteria = new SortCriteria();
    sortCriteria.addSortElement("familyName", SortDirection.ASC);
    dataSetDefinition.setSortCriteria(sortCriteria);

    dataSetDefinition.addParameter(new Parameter("endDate", "Monday", Date.class));

    // Add Columns
    dataSetDefinition.addColumn(
        RowPerPatientColumns.getFirstNameColumn("givenName"), new HashMap<String, Object>());

    dataSetDefinition.addColumn(
        RowPerPatientColumns.getMiddleNameColumn("middleName"), new HashMap<String, Object>());

    dataSetDefinition.addColumn(
        RowPerPatientColumns.getFamilyNameColumn("familyName"), new HashMap<String, Object>());

    dataSetDefinition.addColumn(RowPerPatientColumns.getIMBId("id"), new HashMap<String, Object>());

    dataSetDefinition.addColumn(
        RowPerPatientColumns.getDrugRegimenInformationParameterized("regimen", false, false),
        ParameterizableUtil.createParameterMappings("asOfDate=${endDate},untilDate=${endDate}"));
    dataSetDefinition.addColumn(
        RowPerPatientColumns.getDrugRegimenInformationParameterized(
            "regimenDrugs", chemotherapy, false, true),
        ParameterizableUtil.createParameterMappings("asOfDate=${endDate},untilDate=${endDate}"));

    dataSetDefinition.addColumn(
        RowPerPatientColumns.getStateOfPatient("diagnosis", oncologyProgram, diagnosis, null),
        new HashMap<String, Object>());

    dataSetDefinition.addColumn(
        RowPerPatientColumns.getMostRecent("telephone", telephone, null),
        new HashMap<String, Object>());

    dataSetDefinition.addColumn(
        RowPerPatientColumns.getMostRecent("telephone2", telephone2, null),
        new HashMap<String, Object>());

    dataSetDefinition.addColumn(
        RowPerPatientColumns.getAccompRelationship("accompagnateur"),
        new HashMap<String, Object>());

    Map<String, Object> mappings = new HashMap<String, Object>();
    mappings.put("endDate", "${endDate}");

    reportDefinition.addDataSetDefinition("dataSet", dataSetDefinition, mappings);
  }
  /**
   * Processes the form when a user submits.
   *
   * @param cohortDefinition
   * @param bindingResult
   * @return
   */
  @RequestMapping("/module/reporting/deleteParameter")
  public ModelAndView removeParameter(
      @RequestParam(value = "uuid", required = false) String uuid,
      @RequestParam(value = "type", required = false) Class<Parameterizable> type,
      @RequestParam(value = "parameterName", required = false) String parameterName,
      @RequestParam(value = "redirectUrl", required = false) String redirectUrl) {

    Parameterizable parameterizable = ParameterizableUtil.getParameterizable(uuid, type);
    if (parameterizable != null) {
      parameterizable.removeParameter(parameterName);
      ParameterizableUtil.saveParameterizable(parameterizable);
    }
    return new ModelAndView("redirect:" + redirectUrl);
  }
  private ReportDefinition createReportDefinition() {

    ReportDefinition reportDefinition = new ReportDefinition();
    reportDefinition.setName("ONC-Chemotherapy Daily Expected Patient List");

    UpcomingChemotherapyCohortDefinition baseCohort = new UpcomingChemotherapyCohortDefinition();
    baseCohort.setChemotherapyIndication(chemotherapy);
    baseCohort.addParameter(new Parameter("asOfDate", "asOfDate", Date.class));
    baseCohort.addParameter(new Parameter("untilDate", "untilDate", Date.class));

    reportDefinition.setBaseCohortDefinition(
        baseCohort,
        ParameterizableUtil.createParameterMappings("asOfDate=${endDate},untilDate=${endDate}"));
    reportDefinition.addParameter(new Parameter("endDate", "Date", Date.class));
    createDataSetDefinition(reportDefinition);

    h.saveReportDefinition(reportDefinition);

    return reportDefinition;
  }