Changeset 2159


Ignore:
Timestamp:
Dec 6, 2013, 10:01:43 AM (7 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #542: PAD should be a PatientCurator? annotation

The PAD values should now be more protected.

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

Legend:

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

    r2145 r2159  
    10571057              <th>RNA later date</th>
    10581058            </tr>
    1059             <tr id="specimen.pad">
     1059            <tr id="specimen.pad" class="confidential">
    10601060              <th>PAD</th>
    10611061            </tr>
     
    11011101              <th>Sampling date</th>
    11021102            </tr>
    1103             <tr id="nospecimen.pad">
     1103            <tr id="nospecimen.pad" class="confidential">
    11041104              <th>PAD</th>
    11051105            </tr>
  • extensions/net.sf.basedb.reggie/trunk/resources/reports/samplereportgenerator.jsp

    r2024 r2159  
    356356    var report = response.report;
    357357    var permissionDeniedForPatientName = report.permissionDeniedForPatientName;
     358    var permissionDeniedForPad = report.permissionDeniedForPad;
    358359    var reportTable;
    359360   
     
    541542    {
    542543      summaryList.appendChild(getListElement('Note: Patient name is considered missing if either "all first names" or "family name" is missing.'));
    543       if ('true' == permissionDeniedForPatientName)
    544       {
    545         var patientNamePermissionWarningIconWithMessage = document.createElement('img');
    546         patientNamePermissionWarningIconWithMessage.innerHTML = '<img src="images/warning.png"> Sorry, logged-in user does not have permission to check patient names.</img>';
    547         var patientNamePermissionWarningListElement = document.createElement('li');
    548         patientNamePermissionWarningListElement.appendChild(patientNamePermissionWarningIconWithMessage);
    549         summaryList.appendChild(patientNamePermissionWarningListElement);
     544      if (permissionDeniedForPatientName)
     545      {
     546        var patientNamePermissionWarning = document.createElement('li');
     547        patientNamePermissionWarning.innerHTML = 'Sorry, logged-in user does not have permission to check patient names.';
     548        summaryList.appendChild(patientNamePermissionWarning);
     549      }
     550      if (permissionDeniedForPad)
     551      {
     552        var padPermissionWarning = document.createElement('li');
     553        padPermissionWarning.innerHTML = 'Sorry, logged-in user does not have permission to check PAD values.';
     554        summaryList.appendChild(padPermissionWarning);
    550555      }
    551556    }
     
    12331238    var bloodSampleFilter = report.bloodSampleFilter;
    12341239    var permissionDeniedForPatientName = report.permissionDeniedForPatientName;
     1240    var permissionDeniedForPad = report.permissionDeniedForPad;
    12351241
    12361242    var headerRow = document.createElement('tr');   
     
    13471353    if (sitesCombined != null)
    13481354    {
    1349       if ('false' == permissionDeniedForPatientName)
     1355      if (!permissionDeniedForPatientName)
    13501356      {
    13511357        data = getJSONData(sitesCombined, 'missingPatientName');
     
    13591365      if (sampleType == 'specimen')
    13601366      {
    1361         data = getJSONData(sitesCombined, 'missingPadReference');
    1362         sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary'));
     1367        if (!permissionDeniedForPad)
     1368        {
     1369          data = getJSONData(sitesCombined, 'missingPadReference');
     1370          sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary'));
     1371        }
     1372        else
     1373        {
     1374          data = '-';
     1375          sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary'));
     1376        }
    13631377        data = getJSONData(sitesCombined, 'missingLaterality');
    13641378        sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary'));
     
    13701384      else if (sampleType == 'nospecimen')
    13711385      {
    1372         data = getJSONData(sitesCombined, 'missingPadReference');
    1373         sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary'));
     1386        if (!permissionDeniedForPad)
     1387        {
     1388          data = getJSONData(sitesCombined, 'missingPadReference');
     1389          sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary'));
     1390        }
     1391        else
     1392        {
     1393          data = '-';
     1394          sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary'));
     1395        }
    13741396        data = getJSONData(sitesCombined, 'missingLaterality');
    13751397        sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary'));
     
    17141736    var sampleType = report.sampleType;
    17151737    var permissionDeniedForPatientName = report.permissionDeniedForPatientName;
     1738    var permissionDeniedForPad = report.permissionDeniedForPad;
    17161739    var unknownCreation = statistics.noDate;
    17171740    var unknownSite = statistics.unknownSite;
     
    17401763      if (siteData != null)
    17411764      {
    1742         if ('false' == permissionDeniedForPatientName)
     1765        if (!permissionDeniedForPatientName)
    17431766        {
    17441767          data = getJSONData(siteData, 'missingPatientName');
     
    17521775        if (sampleType == 'specimen')
    17531776        {
    1754           data = getJSONData(siteData, 'missingPadReference');
    1755           tableRow.appendChild(getTableCellElement(data, 'reportdata'));
     1777          if (!permissionDeniedForPad)
     1778          {
     1779            data = getJSONData(siteData, 'missingPadReference');
     1780            tableRow.appendChild(getTableCellElement(data, 'reportdata'));
     1781          }
     1782          else
     1783          {
     1784            data = '-';
     1785            tableRow.appendChild(getTableCellElement(data, 'reportdata'));
     1786          }
     1787         
    17561788          data = getJSONData(siteData, 'missingLaterality');
    17571789          tableRow.appendChild(getTableCellElement(data, 'reportdata'));
     
    17631795        else if (sampleType == 'nospecimen')
    17641796        {
    1765           data = getJSONData(siteData, 'missingPadReference');
    1766           tableRow.appendChild(getTableCellElement(data, 'reportdata'));
     1797          if (!permissionDeniedForPad)
     1798          {
     1799            data = getJSONData(siteData, 'missingPadReference');
     1800            tableRow.appendChild(getTableCellElement(data, 'reportdata'));
     1801          }
     1802          else
     1803          {
     1804            data = '-';
     1805            tableRow.appendChild(getTableCellElement(data, 'reportdata'));
     1806          }         
    17671807          data = getJSONData(siteData, 'missingLaterality');
    17681808          tableRow.appendChild(getTableCellElement(data, 'reportdata'));
  • extensions/net.sf.basedb.reggie/trunk/resources/sampleproc/specimentube.jsp

    r2058 r2159  
    181181  frm.arrivalDate.disabled = true;
    182182  frm.nofTubes.disabled = true;
    183   frm.pad.disabled = true;
    184183  for (var i=0;i<frm.laterality.length;i++)
    185184  {
     
    591590}
    592591
    593 function padOnChange()
    594 {
    595   var frm = document.forms['reggie'];
    596   var PAD = frm.pad.value;
    597   if (PAD == '')
    598   {
    599     setInputStatus('pad', 'Missing', 'warning');
    600     return;
    601   }
    602   frm.pad.value = PAD.replace(/\+/, '-');
    603   setInputStatus('pad', '', 'valid');
    604 }
    605592
    606593function lateralityOnChange()
     
    689676 
    690677  caseInfo.laterality = Forms.getCheckedRadio(frm.laterality).value;
    691   caseInfo.pad = frm.pad.value;
    692678  caseInfo.samplingDate = Main.trimString(frm.samplingDate.value + ' ' + frm.samplingTime.value);
    693679  caseInfo.rnaLaterDate = Main.trimString(frm.rnaLaterDate.value + ' ' + frm.rnaLaterTime.value);
     
    846832      <td class="prompt">Arrival date</td>
    847833      <td class="input"><input type="text" name="arrivalDate"
    848         onkeypress="focusOnEnter(event, 'pad')" value="" size="12" maxlength="10" onblur="arrivalDateOnBlur()"></td>
     834        onkeypress="focusOnEnter(event, 'samplingDate')" value="" size="12" maxlength="10" onblur="arrivalDateOnBlur()"></td>
    849835      <td class="status" id="arrivalDate.status"></td>
    850836      <td class="help"><span id="arrivalDate.message" class="message" style="display:none"></span>Date when the specimen tubes arrived(YYYYMMDD or MMDD).</td>
    851     </tr>
    852     <tr>
    853       <td class="prompt">PAD</td>
    854       <td class="input"><input type="text" name="pad"
    855         value="" size="12" maxlength="10"
    856         onkeypress="focusOnEnter(event, 'samplingDate')" onblur="padOnChange()"></td>
    857       <td class="status" id="pad.status"></td>
    858       <td class="help"><span id="pad.message" class="message" style="display: none;"></span></td>
    859837    </tr>
    860838    <tr id="samplingDateSection" valign="top">
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/InstallServlet.java

    r2157 r2159  
    88import java.util.List;
    99import java.util.Map;
     10import java.util.Set;
    1011
    1112import javax.servlet.ServletException;
     
    123124        jsonChecks.add(checkReggieRole(dc, ReggieRole.SECONDARY_ANALYSIS, createIfMissing));
    124125
     126        int projectId = dc.getSessionControl().getActiveProjectId();
     127        Project activeProject = projectId == 0 ? null : Project.getById(dc, projectId);
     128
    125129        Group patientCurator = ReggieRole.PATIENT_CURATOR.get(dc);
    126130        PermissionOptions sharedToPatientCurator = null;
     
    129133          sharedToPatientCurator = new PermissionOptions();
    130134          sharedToPatientCurator.set(patientCurator, Permission.USE);
     135          if (activeProject != null)
     136          {
     137            sharedToPatientCurator.set(activeProject, null);
     138          }
    131139        }
    132140       
    133141        PermissionOptions sharedToActiveProject = null;
    134         int projectId = dc.getSessionControl().getActiveProjectId();
    135         if (projectId != 0)
     142        if (activeProject != null)
    136143        {
    137144          sharedToActiveProject = new PermissionOptions();
    138           sharedToActiveProject.set(Project.getById(dc, projectId), Permission.USE);
     145          sharedToActiveProject.set(activeProject, Permission.USE);
    139146        }
    140147       
     
    215222        jsonChecks.add(checkAnnotationType(dc, Annotationtype.LATERALITY, 1, new ValueOptions("LEFT", "RIGHT"), effectiveOptions, createIfMissing));
    216223        jsonChecks.add(checkAnnotationType(dc, Annotationtype.REASON_IF_NO_SPECIMEN, 1, null, effectiveOptions, createIfMissing));
    217         jsonChecks.add(checkAnnotationType(dc, Annotationtype.PAD, 1,  null, effectiveOptions, createIfMissing));
     224        jsonChecks.add(checkAnnotationType(dc, Annotationtype.PAD, 1,  null, sharedToPatientCurator, createIfMissing));
    218225       
    219226        jsonChecks.add(checkAnnotationType(dc, Annotationtype.BLOOD_SAMPLING_DATETIME, 1,null, effectiveOptions, createIfMissing));
     
    19901997        Project pr = entry.getKey();
    19911998        Permission p = entry.getValue();
    1992         if (pKey == null || !pKey.getPermissions(pr).contains(p))
    1993         {
    1994           message = "Not shared to project: " + pr.getName() + " (" + p + ")";
    1995           return false;
     1999       
     2000        Set<Permission> permissions = pKey != null ? pKey.getPermissions(pr) : null;
     2001        if (p == null)
     2002        {
     2003          // The item should not be shared to project 'pr'
     2004          if (permissions != null && permissions.size() > 0)
     2005          {
     2006            message = "Should not be shared to project: " + pr.getName() + " (" + permissions + ")";
     2007            return false;
     2008          }
     2009        }
     2010        else
     2011        {
     2012          // The item should be shared to project 'pr' with permission 'p'
     2013          if (pKey == null || !permissions.contains(p))
     2014          {
     2015            message = "Not shared to project: " + pr.getName() + " (" + p + ")";
     2016            return false;
     2017          }
    19962018        }
    19972019      }
     
    20012023        Group g = entry.getKey();
    20022024        Permission p = entry.getValue();
    2003 
    2004         if (key == null || !key.getPermissions(g).contains(p))
    2005         {
    2006           message = "Not shared to group: " + g.getName() + " (" + p + ")";
    2007           return false;
    2008         }
     2025       
     2026        Set<Permission> permissions = pKey != null ? key.getPermissions(g) : null;
     2027        if (p == null)
     2028        {
     2029          // The item should not be shared to group 'g'
     2030          if (permissions != null && permissions.size() > 0)
     2031          {
     2032            message = "Should not be shared to group: " + g.getName() + " (" + permissions + ")";
     2033            return false;
     2034          }
     2035        }
     2036        else
     2037        {
     2038          // The item should be shared to group 'g' with permission 'p'
     2039          if (key == null || !key.getPermissions(g).contains(p))
     2040          {
     2041            message = "Not shared to group: " + g.getName() + " (" + p + ")";
     2042            return false;
     2043          }
     2044        }
     2045
    20092046      }
    20102047      return true;
     
    20292066        Group g = entry.getKey();
    20302067        Permission p = entry.getValue();
    2031         mp.addPermissions(g, Collections.singleton(p));
     2068        if (p == null)
     2069        {
     2070          mp.setPermissions(g, null);
     2071        }
     2072        else
     2073        {
     2074          mp.addPermissions(g, Collections.singleton(p));
     2075        }
    20322076      }
    20332077      for (Map.Entry<Project, Permission> entry : projectPermissions.entrySet())
     
    20352079        Project pr = entry.getKey();
    20362080        Permission p = entry.getValue();
    2037         mp.addPermissions(pr, Collections.singleton(p));
     2081        if (p == null)
     2082        {
     2083          mp.setPermissions(pr, null);
     2084        }
     2085        else
     2086        {
     2087          mp.addPermissions(pr, Collections.singleton(p));
     2088        }
    20382089      }
    20392090      mp.updateKeys(item.getDbControl());
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/SampleReportServlet.java

    r2024 r2159  
    2323import net.sf.basedb.core.ItemSubtype;
    2424import net.sf.basedb.core.MeasuredBioMaterial;
    25 import net.sf.basedb.core.PermissionDeniedException;
    2625import net.sf.basedb.core.Sample;
    2726import net.sf.basedb.core.SessionControl;
     
    14571456    sampleQuery.joinPermanent(Hql.innerJoin(null, "creationEvent", "ce", true));
    14581457    // Select what sample subtype to include in database search
     1458    // Fetch Joining parent CASE and PATIENT should improve performance
    14591459    if (sampleType.equals("nospecimen"))
    14601460    {
    14611461      Subtype.NO_SPECIMEN.addFilter(dc, sampleQuery);
     1462      sampleQuery.join(Hql.innerJoin(null, "parent", "cse", true));
     1463      sampleQuery.join(Hql.innerJoin("cse", "parent", "pat", true));
    14621464    }
    14631465    else if (sampleType.equals("blood"))
    14641466    {
    14651467      Subtype.BLOOD.addFilter(dc, sampleQuery);
     1468      sampleQuery.join(Hql.innerJoin(null, "parent", "pat", true));
    14661469    }
    14671470    else
    14681471    {
    14691472      Subtype.SPECIMEN.addFilter(dc, sampleQuery);
     1473      sampleQuery.join(Hql.innerJoin(null, "parent", "cse", true));
     1474      sampleQuery.join(Hql.innerJoin("cse", "parent", "pat", true));
    14701475    }
    14711476    sampleQuery.setIncludes(Reggie.INCLUDE_IN_CURRENT_PROJECT);
     
    14871492    String missingBloodFreezerDateTimeKey = "missingBloodFreezerDateTime";
    14881493    String permissionDeniedForPatientNameKey = "permissionDeniedForPatientName";
     1494    String permissionDeniedForPadKey = "permissionDeniedForPad";
    14891495    String sitesCombinedKey = "sitesCombinedKey";
    14901496    String latestDateKey = "latestDateKey";
     
    15161522    ItemSubtype subtypeNoSpecimen = Subtype.NO_SPECIMEN.load(dc);
    15171523    ItemSubtype subtypeBlood = Subtype.BLOOD.load(dc);
    1518     Boolean permissionDeniedForPatientName = false;
     1524    boolean permissionDeniedForPatientName = false;
     1525    try
     1526    {
     1527      Annotationtype.ALL_FIRST_NAMES.load(dc);
     1528      Annotationtype.FAMILY_NAME.load(dc);
     1529    }
     1530    catch (RuntimeException ex)
     1531    {
     1532      permissionDeniedForPatientName = true;
     1533    }
     1534    boolean permissionDeniedForPad = false;
     1535    try
     1536    {
     1537      Annotationtype.PAD.load(dc);
     1538    }
     1539    catch (RuntimeException ex)
     1540    {
     1541      permissionDeniedForPad = true;
     1542    }
     1543   
    15191544    //
    15201545    while (sampleIterator != null && sampleIterator.hasNext())
     
    16071632      if (patient != null)
    16081633      {
    1609         try
     1634        if (!permissionDeniedForPatientName)
    16101635        {
    16111636          // Get patient all first names
     
    16141639          familyName = (String) Annotationtype.FAMILY_NAME.getAnnotationValue(dc, manager, patient);
    16151640        }
    1616         catch (PermissionDeniedException e)
    1617         {
    1618           permissionDeniedForPatientName = true;
    1619         }
    16201641      }
    16211642      if (sampleType.equals("specimen"))
    16221643      {
    16231644        // Get PAD reference
    1624         pad = (String) Annotationtype.PAD.getAnnotationValue(dc, manager, s);
     1645        if (!permissionDeniedForPad)
     1646        {
     1647          pad = (String) Annotationtype.PAD.getAnnotationValue(dc, manager, s);
     1648        }
    16251649        // Get laterality
    16261650        laterality = (String) Annotationtype.LATERALITY.getAnnotationValue(dc, manager, s);
     
    16331657      {
    16341658        // Get PAD reference
    1635         pad = (String) Annotationtype.PAD.getAnnotationValue(dc, manager, s);
     1659        if (!permissionDeniedForPad)
     1660        {
     1661          pad = (String) Annotationtype.PAD.getAnnotationValue(dc, manager, s);
     1662        }
    16361663        // Get laterality
    16371664        laterality = (String) Annotationtype.LATERALITY.getAnnotationValue(dc, manager, s);
     
    16631690        }
    16641691
    1665         if (patient != null)
    1666         {
    1667           // Update missing first names data and family name data
     1692        if (patient != null && patient.getName().equals("PAT000295"))
     1693        {
     1694          System.out.println(patient +":"+allFirstNames+":"+familyName+":"+permissionDeniedForPatientName);
     1695        }
     1696       
     1697        if (patient != null && !permissionDeniedForPatientName)
     1698        {
     1699          // Update missing patient name data, provided the user has permission to check it
    16681700          if (allFirstNames == null || allFirstNames.equals("")
    16691701              || familyName == null || familyName.equals(""))
    16701702          {
    1671             // Update missing patient name data, provided the user has permission to check it
    1672             if (!permissionDeniedForPatientName)
    1673             {
    1674               jsonSite = tableUtil.updateJSONObjectCounter(jsonSite, missingPatientNameKey);
    1675               jsonSitesCombined = tableUtil.updateJSONObjectCounter(jsonSitesCombined, missingPatientNameKey);
    1676             }
     1703            jsonSite = tableUtil.updateJSONObjectCounter(jsonSite, missingPatientNameKey);
     1704            jsonSitesCombined = tableUtil.updateJSONObjectCounter(jsonSitesCombined, missingPatientNameKey);
    16771705          }
    16781706        }
     
    16801708        {
    16811709          // Update missing PAD reference data
    1682           if (pad == null || pad.equals(""))
    1683           {
    1684             jsonSite = tableUtil.updateJSONObjectCounter(jsonSite, missingPadReferenceKey);
    1685             jsonSitesCombined = tableUtil.updateJSONObjectCounter(jsonSitesCombined, missingPadReferenceKey);
     1710          if (!permissionDeniedForPad)
     1711          {
     1712            if (pad == null || pad.equals(""))
     1713            {
     1714              jsonSite = tableUtil.updateJSONObjectCounter(jsonSite, missingPadReferenceKey);
     1715              jsonSitesCombined = tableUtil.updateJSONObjectCounter(jsonSitesCombined, missingPadReferenceKey);
     1716            }
    16861717          }
    16871718          // Update missing laterality data
     
    17071738        {
    17081739          // Update missing PAD reference data
    1709           if (pad == null || pad.equals(""))
    1710           {
    1711             jsonSite = tableUtil.updateJSONObjectCounter(jsonSite, missingPadReferenceKey);
    1712             jsonSitesCombined = tableUtil.updateJSONObjectCounter(jsonSitesCombined, missingPadReferenceKey);
     1740          if (!permissionDeniedForPad)
     1741          {
     1742            if (pad == null || pad.equals(""))
     1743            {
     1744              jsonSite = tableUtil.updateJSONObjectCounter(jsonSite, missingPadReferenceKey);
     1745              jsonSitesCombined = tableUtil.updateJSONObjectCounter(jsonSitesCombined, missingPadReferenceKey);
     1746            }
    17131747          }
    17141748          // Update missing laterality data
     
    17811815    String latestDateStr = (String) jsonStatistics.get("latestDateKey");
    17821816    jsonReport.put("latestDate", latestDateStr);
    1783     jsonReport.put(permissionDeniedForPatientNameKey, permissionDeniedForPatientName.toString());
     1817    jsonReport.put(permissionDeniedForPatientNameKey, permissionDeniedForPatientName);
     1818    jsonReport.put(permissionDeniedForPadKey, permissionDeniedForPad);
    17841819    String siteOrder = ReportTableUtilServlet.alphabeticalOrder;
    17851820    JSONObject jsonSiteOrderList = tableUtil.createJSONSiteOrderList(siteOrder);
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/SpecimenTubeServlet.java

    r2134 r2159  
    282282
    283283        String laterality = Values.getStringOrNull((String)jsonCase.get("laterality"));       
    284         String pad = Values.getStringOrNull((String)jsonCase.get("pad"));
    285284        String otherPathNote = Values.getStringOrNull((String)jsonCase.get("otherPathNote"));
    286285        StringToDateConverter dateTimeConverter = new StringToDateConverter(new SimpleDateFormat("yyyyMMdd HHmm"));
     
    316315            Annotationtype.SAMPLING_DATETIME.setAnnotationValue(dc, specimen, samplingDateTime);
    317316            Annotationtype.RNALATER_DATETIME.setAnnotationValue(dc, specimen, rnaLaterDate);
    318             Annotationtype.PAD.setAnnotationValue(dc, specimen, pad);
    319317            Annotationtype.OTHER_PATH_NOTE.setAnnotationValue(dc, specimen, otherPathNote);
    320318            Annotationtype.SPECIMEN_TYPE.setAnnotationValue(dc, specimen, specimenTypeString);
  • extensions/net.sf.basedb.reggie/trunk/testdata/cleanup_dev_clone.sql

    r1955 r2159  
    8585  (select a.value_id from `Annotations` a inner join `AnnotationTypes` at on at.id=a.annotationtype_id
    8686   where at.name='FamilyName');
     87   
     88   
     89/* Replace PAD with PAD-HEX(<id>) values for all specimen */
     90update `StringValues` set value=upper(concat('PAD-', hex(id)))
     91where id in
     92  (select a.value_id from `Annotations` a inner join `AnnotationTypes` at on at.id=a.annotationtype_id
     93   where at.name='PAD');
Note: See TracChangeset for help on using the changeset viewer.