Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#420 closed enhancement (fixed)

Sample count report should have two columns for summed data

Reported by: olle Owned by: olle
Priority: major Milestone: Reggie v2.9
Component: net.sf.basedb.reggie Keywords:
Cc:

Description (last modified by olle)

The sample count report currently have a rightmost column named "Grand total" for the summed sample counts per site for the selected time period. This column should change name to "Sum".

In addition, a new column named "Total" should be added to the right of the "Sum" column, for the total number of samples per site, including samples created at a time outside the selected time period. This number should also include samples without known creation date.

Change History (11)

comment:1 Changed 7 years ago by olle

Type: Requestenhancement

Type changed from Request to enhancement.

comment:2 Changed 7 years ago by olle

Status: newassigned

Ticket accepted.

comment:3 Changed 7 years ago by olle

Description: modified (diff)

Ticket description updated regarding clarification that the 'Total' column should show number of samples per site, regardless of when the samples were created (or if the creation date is unknown).

comment:4 Changed 7 years ago by olle

Traceability note:

  • The report generator was introduced in Ticket #339 (Report generator).

comment:5 Changed 7 years ago by olle

Design discussion:

Data for the report is collected by servlet SampleReportServlet in reggie/src/net/sf/basedb/reggie/servlet/, while the table presentation is created by JSP script samplereportgenerator in reggie/resources/. Currently, however, the data for the summed values for each site and all sites together are calculated by the JSP script. The servlet uses restrictions for the database query to only get items for the selected time period.

Design of new feature for extra table column with data regardless of creation date:

  1. It was decided to perform most of the calculations in the servlet. Servlet SampleReportServlet will therefore be updated to calculate the summed values for each site and all sites together and insert the values in JSON objects jsonSite and jsonStatistics with keys "sumSiteKey" and "sumKey", respectively.
  2. Servlet SampleReportServlet will be modified to not set any date restrictions on the database query, but to perform this comparison in the java code for the main table data. In addition, data for all sites regardless of creation date is collected and inserted in JSON objects jsonSite and jsonStatistics with keys "totalSiteKey" and "totalKey", respectively.
  3. JSP script samplereportgenerator will be updated to get the values for summed data from the JSON objects obtained from the servlet. Column "Grand total" is renamed "Sum", and a new column named "Total" is added to the right of the latter for data regardless of creation date.

comment:6 Changed 7 years ago by olle

Resolution: fixed
Status: assignedclosed

(In [1729]) Fixes #420. The sample count report is updated to rename column "Grand total" to "Sum", and add a new column "Total" to the right of the latter with data regardless od creation date.

comment:7 Changed 7 years ago by olle

Design update:

The displayed combined values for all sites for each time period are still calculated by the JSP script. These values should also be calculated by the servlet and transferred to the JSP script for display.

Update of servlet SampleReportServlet:

  1. The servlet should be updated to calculate the combined values for all sites and insert them in JSON object jsonSitesCombined with key "sitesCombinedKey". The initial values should be 0 for periods ending after the earliest date one of the sites joined the project, and null for earlier periods. The latter entries should be displayed as a blank in the table.
  2. In order to achieve the new functionality, a number of new convenience methods will be added, Date fetchEarliestSiteStartDate(), List<Date> createSortedPeriodEndDateList(...), List<Date> createSortedPeriodStartDateList(...), and JSONObject initializeJSONPeriodData(...).
  3. In order to prepare for further functionality of the sample report servlet, the sample count code should be refactored into a number of new methods, JSONObject sampleCountReport(...), JSONObject createJSONStatistics(...), and JSONObject updateJSONObjectCounter(...).

Update of JSP script samplereportgenerator:

  1. The script should be updated to obtain the combined values for all sites from the servlet via JSON object jsonSitesCombined with key "sitesCombinedKey".
  2. In order to ensure correct display of the combined values, new functions getJsonData(jsonObject, key) and createSortedPeriodArray(report, numberOfColumns) will be added.

comment:8 Changed 7 years ago by olle

(In [1730]) Refs #420. The sample count report is updated to calculate the combined values for all sites for each time period in the servlet and transfer them to the JSP script. Also refactoring of the servlet code, in order to prepare for further functionality.

comment:9 Changed 7 years ago by olle

(In [1731]) Refs #420. Minor refactoring of sample count report: private method sampleCountReport(...) is renamed createSampleCountReport(...), as common practice is to have method names contain a verb, and the name SampleCountReport might be desired for a class.

comment:10 Changed 7 years ago by olle

(In [1735]) Refs #428. Refs #420. Refs #426. Sample count report and consent count report updated to show sites in alphabetical order of site names.

comment:11 Changed 7 years ago by olle

(In [1737]) Fixes #428. Refs #420. Refs #426. Sample count report and consent count report updated to show a table column with latest item dates for each site.

Note: See TracTickets for help on using tickets.