Changeset 1784


Ignore:
Timestamp:
Dec 13, 2012, 9:53:56 AM (7 years ago)
Author:
olle
Message:

Fixes #452. Consent count report updated to not count missing consents as consents with unknown date.

Location:
extensions/net.sf.basedb.reggie/trunk
Files:
2 edited

Legend:

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

    r1772 r1784  
    3333  var numCols;
    3434  var unknownSite = 0;
    35   var unknownCreation;
     35  var unknownCreation = 0;
     36  var numMissing = 0;
    3637  var numPatientsNoSamples = 0;
    3738 
     
    337338      summaryList.appendChild(getListElement(unknownSite + ' consents registered to unknown sites.'));
    338339      summaryList.appendChild(getListElement(unknownCreation + ' consents without known date. These are included in the \'Total\' column.'));
     340      summaryList.appendChild(getListElement(numMissing + ' missing consents for cases and blood samples. These are NOT included in the \'Total\' column.'));
    339341      summaryList.appendChild(getListElement(numDuplicates + ' duplicates ignored.'));
    340342
     
    637639    var numCols = 4;
    638640    var numDecimals = 0;
    639     var headerText = '# Consent forms of different types for cases and blood samples, unknown consent date';
     641    var headerText = '# Consent forms of different types for cases and blood samples with unknown consent date, as well as items with missing consents';
    640642    headerRow.appendChild(getTableCellElement(headerText, 'reportheader', (numCols+5)));
    641643   
     
    677679    sitesCombinedRow.appendChild(getTableCellElement('', 'colsummary', 2));
    678680    // Get combined numbers for all sites
     681    var noDateOrMissingKey = 'noDateOrMissing';
    679682    var sumKey = 'sumKey';
    680683    var statistics = report.statistics;
     
    682685    if (sitesCombined != null)
    683686    {
    684       data = getJSONDataWithPercent(sitesCombined, 'yesNoDate', sumKey, numDecimals);
    685       sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary'));
    686       data = getJSONDataWithPercent(sitesCombined, 'noNoDate', sumKey, numDecimals);
    687       sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary'));
    688       data = getJSONDataWithPercent(sitesCombined, 'notAskedNoDate', sumKey, numDecimals);
    689       sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary'));
    690       data = getJSONDataWithPercent(sitesCombined, 'missing', sumKey, numDecimals);
    691       sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary'));
    692     }
    693     // Add entry with total number of consents with chosen restrictions
    694     var noDateKey = 'noDate';
    695     data = getJSONData(sitesCombined, noDateKey, 0);
    696     sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary'));
    697     // Add entry with total number of consents, regardless of restrictions
    698     var totalKey = 'totalKey';
    699     data = getJSONData(sitesCombined, totalKey, 0);
    700     sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary'));
     687      data = getJSONDataWithPercent(sitesCombined, 'yesNoDate', noDateOrMissingKey, numDecimals);
     688      sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary'));
     689      data = getJSONDataWithPercent(sitesCombined, 'noNoDate', noDateOrMissingKey, numDecimals);
     690      sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary'));
     691      data = getJSONDataWithPercent(sitesCombined, 'notAskedNoDate', noDateOrMissingKey, numDecimals);
     692      sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary'));
     693      data = getJSONDataWithPercent(sitesCombined, 'missing', noDateOrMissingKey, numDecimals);
     694      sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary'));
     695      // Add entry with total number of consents with chosen restrictions
     696      var noDateOrMissingKey = 'noDateOrMissing';
     697      data = getJSONData(sitesCombined, noDateOrMissingKey, 0);
     698      sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary'));
     699      // Add entry with total number of consents, regardless of restrictions
     700      var totalKey = 'totalKey';
     701      data = getJSONData(sitesCombined, totalKey, 0);
     702      sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary'));
     703    }
    701704    reportTable.appendChild(sitesCombinedRow); 
    702705
     
    11981201    unknownCreation = statistics.noDate;
    11991202    unknownSite = statistics.unknownSite;
     1203    numMissing = statistics.missing;
    12001204    var siteOrderList = report.siteOrderListKey;
    12011205    for (var siteOrderIndex in siteOrderList)
     
    12161220      tableRow.appendChild(getTableCellElement(siteStartDateStr, 'reportdata'));
    12171221      tableRow.appendChild(getTableCellElement(siteLatestDateStr, 'reportdata'));
    1218       var noDateKey = 'noDate';
     1222      var noDateOrMissingKey = 'noDateOrMissing';
    12191223      var sumKey = 'sumKey';
    12201224      var totalKey = 'totalKey';
    12211225      if (siteData != null)
    12221226      {
    1223         data = getJSONDataWithPercent(siteData, 'yesNoDate', sumKey, numDecimals);
    1224         tableRow.appendChild(getTableCellElement(data, 'reportdata'));
    1225         data = getJSONDataWithPercent(siteData, 'noNoDate', sumKey, numDecimals);
    1226         tableRow.appendChild(getTableCellElement(data, 'reportdata'));
    1227         data = getJSONDataWithPercent(siteData, 'notAskedNoDate', sumKey, numDecimals);
    1228         tableRow.appendChild(getTableCellElement(data, 'reportdata'));
    1229         data = getJSONDataWithPercent(siteData, 'missing', sumKey, numDecimals);
     1227        data = getJSONDataWithPercent(siteData, 'yesNoDate', noDateOrMissingKey, numDecimals);
     1228        tableRow.appendChild(getTableCellElement(data, 'reportdata'));
     1229        data = getJSONDataWithPercent(siteData, 'noNoDate', noDateOrMissingKey, numDecimals);
     1230        tableRow.appendChild(getTableCellElement(data, 'reportdata'));
     1231        data = getJSONDataWithPercent(siteData, 'notAskedNoDate', noDateOrMissingKey, numDecimals);
     1232        tableRow.appendChild(getTableCellElement(data, 'reportdata'));
     1233        data = getJSONDataWithPercent(siteData, 'missing', noDateOrMissingKey, numDecimals);
    12301234        tableRow.appendChild(getTableCellElement(data, 'reportdata'));
    12311235        // Add column with summed values for site
    1232         var siteSum = getJSONData(siteData, noDateKey, 0);
     1236        var siteSum = getJSONData(siteData, noDateOrMissingKey, 0);
    12331237        tableRow.appendChild(getTableCellElement(siteSum, 'rowsummary'));
    12341238      }
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/SampleReportServlet.java

    r1772 r1784  
    488488    String latestDateKey = "latestDateKey";
    489489    String noDateKey = "noDate";
     490    String noDateOrMissingKey = "noDateOrMissing";
    490491    String duplicateKey = "duplicateKey";
    491492    jsonStatistics.put(sitesCombinedKey, jsonSitesCombined);
     
    502503    jsonStatistics = initializeJSONSiteData(jsonStatistics, missingKey);
    503504    jsonStatistics = initializeJSONSiteData(jsonStatistics, noDateKey);
     505    jsonStatistics = initializeJSONSiteData(jsonStatistics, noDateOrMissingKey);
    504506    jsonStatistics = initializeJSONSiteData(jsonStatistics, sumKey);
    505507    jsonStatistics = initializeJSONSiteData(jsonStatistics, totalKey);
     
    516518    jsonSitesCombined.put(missingKey, 0);
    517519    jsonSitesCombined.put(noDateKey, 0);
     520    jsonSitesCombined.put(noDateOrMissingKey, 0);
    518521    jsonSitesCombined.put(sumKey, 0);
    519522    jsonSitesCombined.put(totalKey, 0);
    520523    // Initialize other data to 0 for different keys
    521524    jsonStatistics.put(noDateKey, 0);
     525    jsonStatistics.put(missingKey, 0);
    522526    jsonStatistics.put(duplicateKey, 0);
    523527    Date latestDate = null;
     
    651655            // Update consent counters
    652656            jsonSite = updateJSONObjectCounter(jsonSite, key);
    653             jsonSite = updateJSONObjectCounter(jsonSite, sumKey);
    654657            jsonSitesCombined = updateJSONObjectCounter(jsonSitesCombined, key);
    655             jsonSitesCombined = updateJSONObjectCounter(jsonSitesCombined, sumKey);
     658            // Include all consents except missing in summed count
     659            if (consent != null)
     660            {
     661              jsonSite = updateJSONObjectCounter(jsonSite, sumKey);
     662              jsonSitesCombined = updateJSONObjectCounter(jsonSitesCombined, sumKey);
     663            }
    656664          }
    657665          if (consentDate == null)
    658666          {
    659             // Include consents with unknown date
    660             jsonSite = updateJSONObjectCounter(jsonSite, noDateKey);
    661             jsonSitesCombined = updateJSONObjectCounter(jsonSitesCombined, noDateKey);
    662             jsonStatistics = updateJSONObjectCounter(jsonStatistics, noDateKey);
    663           }
    664           // Increase the counter for total consents for the site, regardless of creation date
    665           jsonSite = updateJSONObjectCounter(jsonSite, totalKey);
    666 
    667           // Increase the counter for total consents for all sites
    668           jsonSitesCombined = updateJSONObjectCounter(jsonSitesCombined, totalKey);
     667            // Include consents with unknown date for site, but not missing consents
     668            if (consent != null)
     669            {
     670              jsonSite = updateJSONObjectCounter(jsonSite, noDateKey);
     671              jsonSitesCombined = updateJSONObjectCounter(jsonSitesCombined, noDateKey);
     672              jsonStatistics = updateJSONObjectCounter(jsonStatistics, noDateKey);
     673            }
     674            else
     675            {
     676              jsonStatistics = updateJSONObjectCounter(jsonStatistics, missingKey);
     677            }
     678            jsonSite = updateJSONObjectCounter(jsonSite, noDateOrMissingKey);
     679            jsonSitesCombined = updateJSONObjectCounter(jsonSitesCombined, noDateOrMissingKey);
     680            jsonStatistics = updateJSONObjectCounter(jsonStatistics, noDateOrMissingKey);
     681          }
     682          // Include all consents except missing in total count
     683          if (consent != null)
     684          {
     685            // Increase the counter for total consents for the site, regardless of creation date
     686            jsonSite = updateJSONObjectCounter(jsonSite, totalKey);
     687
     688            // Increase the counter for total consents for all sites
     689            jsonSitesCombined = updateJSONObjectCounter(jsonSitesCombined, totalKey);
     690          }
    669691        }
    670692        else
Note: See TracChangeset for help on using the changeset viewer.