Changeset 2183


Ignore:
Timestamp:
Dec 20, 2013, 2:19:21 PM (8 years ago)
Author:
olle
Message:

Refs #550. Overview report updated to allow time period filter:

JSP script samplereportgenerator.jsp in reggie/resources/reports/ updates:

  1. Function gotoStep2() updated to display the time period input fields.
  2. Function goCreate() updated to report the number of items of different types with unknown date in a comment line at the end of the report.

Java servlet SampleReportServlet.java in reggie/src/net/sf/basedb/reggie/servlet/ updated in private method JSONObject createOverviewReport(DbControl dc, JSONObject json, Date startDate, Date endDate, String bloodSampleFilter):

  1. Four new JSON keys are defined to keep track of the number of items of different types with unknown date, and the JSON statistics objects are initialized for these keys.
  2. The number of sample items of different types with unknown date are counted, and the results are added to the returned JSON object via the new JSON keys.
  3. The selected time period filter is applied to the sample items, where the entry (registration) date is used for items with unknown creation date.
Location:
extensions/net.sf.basedb.reggie/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/trunk/resources/reports/samplereportgenerator.jsp

    r2178 r2183  
    148148    else if (frm.reporttype[frm.reporttype.selectedIndex].value == 'overviewreport')
    149149    {
    150 /*
    151       // Set parameters (report period) help text
     150      // Show report period input fields
    152151      document.getElementById("reportPeriodSubSection01").style.display = 'block';
     152      document.getElementById("reportPeriodSubSection02").style.display = 'block';
    153153      document.getElementById("reportPeriodSubSection04").style.display = 'block';
    154       document.getElementById("reportPeriodSubSection01Header").innerHTML="No report parameters";
    155       document.getElementById("reportPeriodSubSection04HelpText").innerHTML="Overview report will be generated irrespective of date for items.";
    156 */
     154      document.getElementById("reportPeriodSubSection01Header").innerHTML="Report period";
     155      document.getElementById("reportPeriodSubSection04HelpText").innerHTML="Define which period the report should cover. Empty fields will include all items.";
    157156      // Show blood sample filter pop-up menu
    158157      document.getElementById("bloodSampleFilterSubSection01").style.display = 'block';
     
    543542    else if ('overviewreport' == reportType)
    544543    {
     544      var numBloodNoDate = 0;
     545      var numBloodFUNoDate = 0;
     546      var numSpecimenNoDate = 0;
     547      var numNoSpecimenNoDate = 0;
     548      if (report != null)
     549      {
     550        var statistics = report.statistics;
     551        numBloodNoDate = statistics.bloodSampleNoDate;
     552        numBloodFUNoDate = statistics.bloodSampleFollowUpNoDate;
     553        numSpecimenNoDate = statistics.specimenNoDate;
     554        numNoSpecimenNoDate = statistics.noSpecimenNoDate;
     555      }
     556      if (numBloodNoDate == null)
     557      {
     558        numBloodNoDate = 0;
     559      }
     560      if (numBloodFUNoDate == null)
     561      {
     562        numBloodFUNoDate = 0;
     563      }
     564      if (numSpecimenNoDate == null)
     565      {
     566        numSpecimenNoDate = 0;
     567      }
     568      if (numNoSpecimenNoDate == null)
     569      {
     570        numNoSpecimenNoDate = 0;
     571      }
    545572      summaryList.appendChild(getListElement(unknownSite + ' patients registered to unknown sites.'));
    546573      summaryList.appendChild(getListElement(numPatientsNoSamples + ' patients with no samples.'));
    547574      summaryList.appendChild(getListElement('Note: Consents of type "Yes" include consents without patient id (PAT#) or date.'));
    548575      summaryList.appendChild(getListElement('Note: Data in column "Blood samples follow-up" are not affected by blood sample filter.'));
     576      summaryList.appendChild(getListElement('Note: Time period filter only affects sample items, patients and consents are derived from these.'));
     577      summaryList.appendChild(getListElement('Note: If creation date is unknown, registration date is used instead.'));
     578      summaryList.appendChild(getListElement('Items with unknown creation date: Blood ' + numBloodNoDate + ', Blood follow-up ' + numBloodFUNoDate + ', Specimen ' + numSpecimenNoDate + ', No specimen ' + numNoSpecimenNoDate));
    549579    }
    550580    else if ('missingsampledatareport' == reportType)
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/SampleReportServlet.java

    r2178 r2183  
    994994    String latestDateKey = "latestDateKey";
    995995    String duplicateKey = "duplicateKey";
     996    String bloodSampleNoDateKey = "bloodSampleNoDate";
     997    String bloodSampleFollowUpNoDateKey = "bloodSampleFollowUpNoDate";
     998    String specimenNoDateKey = "specimenNoDate";
     999    String noSpecimenNoDateKey = "noSpecimenNoDate";
    9961000    jsonStatistics.put(sitesCombinedKey, jsonSitesCombined);
    9971001    // Initialize site data to 0 for the different keys
     
    10151019    jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, consentMissingKey);
    10161020    jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, patientNoSamplesKey);
     1021    jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, bloodSampleNoDateKey);
     1022    jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, bloodSampleFollowUpNoDateKey);
     1023    jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, specimenNoDateKey);
     1024    jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, noSpecimenNoDateKey);
    10171025    jsonStatistics = tableUtil.initializeJSONSiteData(jsonStatistics, sumKey);
    10181026    // Initialize combined data to 0 for the different keys
     
    10361044    jsonSitesCombined.put(consentMissingKey, 0);
    10371045    jsonSitesCombined.put(patientNoSamplesKey, 0);
     1046    jsonSitesCombined.put(bloodSampleNoDateKey, 0);
     1047    jsonSitesCombined.put(bloodSampleFollowUpNoDateKey, 0);
     1048    jsonSitesCombined.put(specimenNoDateKey, 0);
     1049    jsonSitesCombined.put(noSpecimenNoDateKey, 0);
    10381050    jsonSitesCombined.put(sumKey, 0);
    10391051    // Initialize other data to 0 for different keys
     
    10671079      Date creationDate = creationEvent.getEventDate();
    10681080
     1081      // Replace unknown creation date with registration date in overview report
     1082      if (creationDate == null)
     1083      {
     1084        creationDate = s.getEntryDate();
     1085        // Update unknown date counter
     1086        Site sampleSite = Site.findByCaseName(s.getName());
     1087        if (sampleSite != Site.UNKNOWN)
     1088        {
     1089          String sampleNoDateKey = null;
     1090          JSONObject jsonSite = (JSONObject)jsonStatistics.get(sampleSite.getPrefix());
     1091          if (jsonSite == null)
     1092          {
     1093            jsonSite = new JSONObject();
     1094            jsonStatistics.put(sampleSite.getPrefix(), jsonSite);
     1095          }
     1096          if (s.getItemSubtype().equals(subtypeBlood))
     1097          {
     1098            sampleNoDateKey = bloodSampleNoDateKey;
     1099            // Get blood sample annotation
     1100            String bloodSampleType = (String) Annotationtype.BLOOD_SAMPLE.getAnnotationValue(dc, manager, s);
     1101            // Follow-up blood sample type (blood sample type == null should not be included)
     1102            if (bloodSampleType != null &&
     1103                (bloodSampleType.equals(BLOOD_FILTER_FOLLOW_UP_06)
     1104                || bloodSampleType.equals(BLOOD_FILTER_FOLLOW_UP_12)
     1105                || bloodSampleType.equals(BLOOD_FILTER_FOLLOW_UP_36))
     1106              )
     1107            {
     1108              // Update unknown date counter
     1109              jsonSite = tableUtil.updateJSONObjectCounter(jsonSite, bloodSampleFollowUpNoDateKey);
     1110              jsonSitesCombined = tableUtil.updateJSONObjectCounter(jsonSitesCombined, bloodSampleFollowUpNoDateKey);
     1111              jsonStatistics = tableUtil.updateJSONObjectCounter(jsonStatistics, bloodSampleFollowUpNoDateKey);
     1112            }
     1113          }
     1114          else if (s.getItemSubtype().equals(subtypeSpecimen))
     1115          {
     1116            sampleNoDateKey = specimenNoDateKey;
     1117          }
     1118          else if (s.getItemSubtype().equals(subtypeNoSpecimen))
     1119          {
     1120            sampleNoDateKey = noSpecimenNoDateKey;
     1121          }
     1122          // Update unknown date counter
     1123          jsonSite = tableUtil.updateJSONObjectCounter(jsonSite, sampleNoDateKey);
     1124          jsonSitesCombined = tableUtil.updateJSONObjectCounter(jsonSitesCombined, sampleNoDateKey);
     1125          jsonStatistics = tableUtil.updateJSONObjectCounter(jsonStatistics, sampleNoDateKey);
     1126        }
     1127      }
     1128      // Skip item if date is outside selected time period
     1129      if (creationDate.before(startDate) || creationDate.after(endDate))
     1130      {
     1131        continue;
     1132      }
     1133     
    10691134      // Update follow-up blood sample data before filtering for blood sample type
    10701135      if (s.getItemSubtype().equals(subtypeBlood))
Note: See TracChangeset for help on using the changeset viewer.