Changeset 2159
- Timestamp:
- Dec 6, 2013, 10:01:43 AM (9 years ago)
- 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 1057 1057 <th>RNA later date</th> 1058 1058 </tr> 1059 <tr id="specimen.pad" >1059 <tr id="specimen.pad" class="confidential"> 1060 1060 <th>PAD</th> 1061 1061 </tr> … … 1101 1101 <th>Sampling date</th> 1102 1102 </tr> 1103 <tr id="nospecimen.pad" >1103 <tr id="nospecimen.pad" class="confidential"> 1104 1104 <th>PAD</th> 1105 1105 </tr> -
extensions/net.sf.basedb.reggie/trunk/resources/reports/samplereportgenerator.jsp
r2024 r2159 356 356 var report = response.report; 357 357 var permissionDeniedForPatientName = report.permissionDeniedForPatientName; 358 var permissionDeniedForPad = report.permissionDeniedForPad; 358 359 var reportTable; 359 360 … … 541 542 { 542 543 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); 550 555 } 551 556 } … … 1233 1238 var bloodSampleFilter = report.bloodSampleFilter; 1234 1239 var permissionDeniedForPatientName = report.permissionDeniedForPatientName; 1240 var permissionDeniedForPad = report.permissionDeniedForPad; 1235 1241 1236 1242 var headerRow = document.createElement('tr'); … … 1347 1353 if (sitesCombined != null) 1348 1354 { 1349 if ( 'false' ==permissionDeniedForPatientName)1355 if (!permissionDeniedForPatientName) 1350 1356 { 1351 1357 data = getJSONData(sitesCombined, 'missingPatientName'); … … 1359 1365 if (sampleType == 'specimen') 1360 1366 { 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 } 1363 1377 data = getJSONData(sitesCombined, 'missingLaterality'); 1364 1378 sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary')); … … 1370 1384 else if (sampleType == 'nospecimen') 1371 1385 { 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 } 1374 1396 data = getJSONData(sitesCombined, 'missingLaterality'); 1375 1397 sitesCombinedRow.appendChild(getTableCellElement(data, 'colsummary')); … … 1714 1736 var sampleType = report.sampleType; 1715 1737 var permissionDeniedForPatientName = report.permissionDeniedForPatientName; 1738 var permissionDeniedForPad = report.permissionDeniedForPad; 1716 1739 var unknownCreation = statistics.noDate; 1717 1740 var unknownSite = statistics.unknownSite; … … 1740 1763 if (siteData != null) 1741 1764 { 1742 if ( 'false' ==permissionDeniedForPatientName)1765 if (!permissionDeniedForPatientName) 1743 1766 { 1744 1767 data = getJSONData(siteData, 'missingPatientName'); … … 1752 1775 if (sampleType == 'specimen') 1753 1776 { 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 1756 1788 data = getJSONData(siteData, 'missingLaterality'); 1757 1789 tableRow.appendChild(getTableCellElement(data, 'reportdata')); … … 1763 1795 else if (sampleType == 'nospecimen') 1764 1796 { 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 } 1767 1807 data = getJSONData(siteData, 'missingLaterality'); 1768 1808 tableRow.appendChild(getTableCellElement(data, 'reportdata')); -
extensions/net.sf.basedb.reggie/trunk/resources/sampleproc/specimentube.jsp
r2058 r2159 181 181 frm.arrivalDate.disabled = true; 182 182 frm.nofTubes.disabled = true; 183 frm.pad.disabled = true;184 183 for (var i=0;i<frm.laterality.length;i++) 185 184 { … … 591 590 } 592 591 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 }605 592 606 593 function lateralityOnChange() … … 689 676 690 677 caseInfo.laterality = Forms.getCheckedRadio(frm.laterality).value; 691 caseInfo.pad = frm.pad.value;692 678 caseInfo.samplingDate = Main.trimString(frm.samplingDate.value + ' ' + frm.samplingTime.value); 693 679 caseInfo.rnaLaterDate = Main.trimString(frm.rnaLaterDate.value + ' ' + frm.rnaLaterTime.value); … … 846 832 <td class="prompt">Arrival date</td> 847 833 <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> 849 835 <td class="status" id="arrivalDate.status"></td> 850 836 <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>859 837 </tr> 860 838 <tr id="samplingDateSection" valign="top"> -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/InstallServlet.java
r2157 r2159 8 8 import java.util.List; 9 9 import java.util.Map; 10 import java.util.Set; 10 11 11 12 import javax.servlet.ServletException; … … 123 124 jsonChecks.add(checkReggieRole(dc, ReggieRole.SECONDARY_ANALYSIS, createIfMissing)); 124 125 126 int projectId = dc.getSessionControl().getActiveProjectId(); 127 Project activeProject = projectId == 0 ? null : Project.getById(dc, projectId); 128 125 129 Group patientCurator = ReggieRole.PATIENT_CURATOR.get(dc); 126 130 PermissionOptions sharedToPatientCurator = null; … … 129 133 sharedToPatientCurator = new PermissionOptions(); 130 134 sharedToPatientCurator.set(patientCurator, Permission.USE); 135 if (activeProject != null) 136 { 137 sharedToPatientCurator.set(activeProject, null); 138 } 131 139 } 132 140 133 141 PermissionOptions sharedToActiveProject = null; 134 int projectId = dc.getSessionControl().getActiveProjectId(); 135 if (projectId != 0) 142 if (activeProject != null) 136 143 { 137 144 sharedToActiveProject = new PermissionOptions(); 138 sharedToActiveProject.set( Project.getById(dc, projectId), Permission.USE);145 sharedToActiveProject.set(activeProject, Permission.USE); 139 146 } 140 147 … … 215 222 jsonChecks.add(checkAnnotationType(dc, Annotationtype.LATERALITY, 1, new ValueOptions("LEFT", "RIGHT"), effectiveOptions, createIfMissing)); 216 223 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)); 218 225 219 226 jsonChecks.add(checkAnnotationType(dc, Annotationtype.BLOOD_SAMPLING_DATETIME, 1,null, effectiveOptions, createIfMissing)); … … 1990 1997 Project pr = entry.getKey(); 1991 1998 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 } 1996 2018 } 1997 2019 } … … 2001 2023 Group g = entry.getKey(); 2002 2024 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 2009 2046 } 2010 2047 return true; … … 2029 2066 Group g = entry.getKey(); 2030 2067 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 } 2032 2076 } 2033 2077 for (Map.Entry<Project, Permission> entry : projectPermissions.entrySet()) … … 2035 2079 Project pr = entry.getKey(); 2036 2080 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 } 2038 2089 } 2039 2090 mp.updateKeys(item.getDbControl()); -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/SampleReportServlet.java
r2024 r2159 23 23 import net.sf.basedb.core.ItemSubtype; 24 24 import net.sf.basedb.core.MeasuredBioMaterial; 25 import net.sf.basedb.core.PermissionDeniedException;26 25 import net.sf.basedb.core.Sample; 27 26 import net.sf.basedb.core.SessionControl; … … 1457 1456 sampleQuery.joinPermanent(Hql.innerJoin(null, "creationEvent", "ce", true)); 1458 1457 // Select what sample subtype to include in database search 1458 // Fetch Joining parent CASE and PATIENT should improve performance 1459 1459 if (sampleType.equals("nospecimen")) 1460 1460 { 1461 1461 Subtype.NO_SPECIMEN.addFilter(dc, sampleQuery); 1462 sampleQuery.join(Hql.innerJoin(null, "parent", "cse", true)); 1463 sampleQuery.join(Hql.innerJoin("cse", "parent", "pat", true)); 1462 1464 } 1463 1465 else if (sampleType.equals("blood")) 1464 1466 { 1465 1467 Subtype.BLOOD.addFilter(dc, sampleQuery); 1468 sampleQuery.join(Hql.innerJoin(null, "parent", "pat", true)); 1466 1469 } 1467 1470 else 1468 1471 { 1469 1472 Subtype.SPECIMEN.addFilter(dc, sampleQuery); 1473 sampleQuery.join(Hql.innerJoin(null, "parent", "cse", true)); 1474 sampleQuery.join(Hql.innerJoin("cse", "parent", "pat", true)); 1470 1475 } 1471 1476 sampleQuery.setIncludes(Reggie.INCLUDE_IN_CURRENT_PROJECT); … … 1487 1492 String missingBloodFreezerDateTimeKey = "missingBloodFreezerDateTime"; 1488 1493 String permissionDeniedForPatientNameKey = "permissionDeniedForPatientName"; 1494 String permissionDeniedForPadKey = "permissionDeniedForPad"; 1489 1495 String sitesCombinedKey = "sitesCombinedKey"; 1490 1496 String latestDateKey = "latestDateKey"; … … 1516 1522 ItemSubtype subtypeNoSpecimen = Subtype.NO_SPECIMEN.load(dc); 1517 1523 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 1519 1544 // 1520 1545 while (sampleIterator != null && sampleIterator.hasNext()) … … 1607 1632 if (patient != null) 1608 1633 { 1609 try1634 if (!permissionDeniedForPatientName) 1610 1635 { 1611 1636 // Get patient all first names … … 1614 1639 familyName = (String) Annotationtype.FAMILY_NAME.getAnnotationValue(dc, manager, patient); 1615 1640 } 1616 catch (PermissionDeniedException e)1617 {1618 permissionDeniedForPatientName = true;1619 }1620 1641 } 1621 1642 if (sampleType.equals("specimen")) 1622 1643 { 1623 1644 // 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 } 1625 1649 // Get laterality 1626 1650 laterality = (String) Annotationtype.LATERALITY.getAnnotationValue(dc, manager, s); … … 1633 1657 { 1634 1658 // 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 } 1636 1663 // Get laterality 1637 1664 laterality = (String) Annotationtype.LATERALITY.getAnnotationValue(dc, manager, s); … … 1663 1690 } 1664 1691 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 1668 1700 if (allFirstNames == null || allFirstNames.equals("") 1669 1701 || familyName == null || familyName.equals("")) 1670 1702 { 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); 1677 1705 } 1678 1706 } … … 1680 1708 { 1681 1709 // 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 } 1686 1717 } 1687 1718 // Update missing laterality data … … 1707 1738 { 1708 1739 // 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 } 1713 1747 } 1714 1748 // Update missing laterality data … … 1781 1815 String latestDateStr = (String) jsonStatistics.get("latestDateKey"); 1782 1816 jsonReport.put("latestDate", latestDateStr); 1783 jsonReport.put(permissionDeniedForPatientNameKey, permissionDeniedForPatientName.toString()); 1817 jsonReport.put(permissionDeniedForPatientNameKey, permissionDeniedForPatientName); 1818 jsonReport.put(permissionDeniedForPadKey, permissionDeniedForPad); 1784 1819 String siteOrder = ReportTableUtilServlet.alphabeticalOrder; 1785 1820 JSONObject jsonSiteOrderList = tableUtil.createJSONSiteOrderList(siteOrder); -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/SpecimenTubeServlet.java
r2134 r2159 282 282 283 283 String laterality = Values.getStringOrNull((String)jsonCase.get("laterality")); 284 String pad = Values.getStringOrNull((String)jsonCase.get("pad"));285 284 String otherPathNote = Values.getStringOrNull((String)jsonCase.get("otherPathNote")); 286 285 StringToDateConverter dateTimeConverter = new StringToDateConverter(new SimpleDateFormat("yyyyMMdd HHmm")); … … 316 315 Annotationtype.SAMPLING_DATETIME.setAnnotationValue(dc, specimen, samplingDateTime); 317 316 Annotationtype.RNALATER_DATETIME.setAnnotationValue(dc, specimen, rnaLaterDate); 318 Annotationtype.PAD.setAnnotationValue(dc, specimen, pad);319 317 Annotationtype.OTHER_PATH_NOTE.setAnnotationValue(dc, specimen, otherPathNote); 320 318 Annotationtype.SPECIMEN_TYPE.setAnnotationValue(dc, specimen, specimenTypeString); -
extensions/net.sf.basedb.reggie/trunk/testdata/cleanup_dev_clone.sql
r1955 r2159 85 85 (select a.value_id from `Annotations` a inner join `AnnotationTypes` at on at.id=a.annotationtype_id 86 86 where at.name='FamilyName'); 87 88 89 /* Replace PAD with PAD-HEX(<id>) values for all specimen */ 90 update `StringValues` set value=upper(concat('PAD-', hex(id))) 91 where 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.