Changeset 1389 for extensions
- Timestamp:
- Sep 9, 2011, 3:37:01 PM (12 years ago)
- Location:
- extensions/net.sf.basedb.reggie/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/net.sf.basedb.reggie/trunk/resources/reggie.js
r1359 r1389 143 143 function autoFillDate(shortDate) 144 144 { 145 shortDate = shortDate.replace("-","") 145 146 var fullDateString = shortDate; 146 147 -
extensions/net.sf.basedb.reggie/trunk/resources/specimentube.jsp
r1380 r1389 28 28 var caseIsValid = false; 29 29 var arrivalDateIsValid = false; 30 var partitionDateIsValid = false;31 30 var nofDeliveredTubesIsValid = true; 32 31 var nofTubesIsValid = false; … … 34 33 var boxesAreValid = null; 35 34 var wellsAreValidValid = null; 35 var specimenTypeIsValid = false; 36 36 var debug = false; 37 37 var currentStep = 1; … … 85 85 var hasUnknownSpecimen = false; 86 86 var thisArrivalDate = null; 87 var thisPartitionDate = null;88 87 var thisNumberOfTubes = null; 89 88 var thisCaseSamplingDate = null; … … 91 90 var thisCaseLaterality = null; 92 91 var thisCasePad = null; 93 var thisCasePathNote = null; 92 var thisOtherPathNote = null; 93 var thisSpecimenType = null; 94 var thisBiopsyType = null; 94 95 95 96 frm.caseName.disabled = true; … … 104 105 // Load annotations from the actual case 105 106 thisCaseLaterality = caseInfo.laterality; 106 this CasePathNote = caseInfo.pathNote;107 thisOtherPathNote = caseInfo.otherPathNote; 107 108 thisCasePad = caseInfo.pad; 108 109 if (caseInfo.reasonIfNoSpecimen && caseInfo.reasonIfNoSpecimen.length>0) … … 138 139 { 139 140 thisArrivalDate = specimen.arrivalDate; 140 }141 if(specimen.partitionDate && !thisPartitionDate)142 {143 thisPartitionDate = specimen.partitionDate;144 141 } 145 142 if (specimen.nofTubes && !thisNumberOfTubes) … … 155 152 thisCaseRNALaterDate = specimen.rnaLaterDate; 156 153 } 157 if (specimen. pathNote && !thisCasePathNote)154 if (specimen.otherPathNote && !thisOtherPathNote) 158 155 { 159 this CasePathNote = specimen.pathNote;156 thisOtherPathNote = specimen.otherPathNote; 160 157 } 161 158 if (specimen.laterality && !thisCaseLaterality) … … 164 161 if (specimen.laterality == 'RIGHT') hasRightSpecimen = true; 165 162 thisCaseLaterality = specimen.laterality; 166 } 163 } 167 164 else if(!thisCaseLaterality) 168 165 { 169 166 hasUnknownSpecimen = true; 170 167 } 168 if (specimen.specimenType && !thisSpecimenType) 169 { 170 thisSpecimenType = specimen.specimenType; 171 } 172 if (specimen.biopsyType && !thisBiopsyType) 173 { 174 thisBiopsyType = specimen.biopsyType; 175 } 171 176 } 172 177 … … 205 210 frm.arrivalDate.value = thisArrivalDate; 206 211 } 207 if (thisPartitionDate != null)208 {209 frm.partitionDate.value = thisPartitionDate;210 }211 212 if (thisNumberOfTubes != null) 212 213 { … … 226 227 rnaLaterDateTimeOnChange(); 227 228 } 228 if (thisCasePathNote != null) 229 { 230 frm.pathNote.value = thisCasePathNote; 231 } 229 if (thisOtherPathNote != null) 230 { 231 frm.otherPathNote.value = thisOtherPathNote; 232 } 233 if (thisSpecimenType != null) 234 { 235 Forms.selectListOption(frm.specimenType, thisSpecimenType); 236 specimenTypeOnClick(); 237 } 238 if (thisBiopsyType != null) 239 { 240 Forms.selectListOption(frm.biopsyType, thisBiopsyType); 241 biopsyTypeOnClick(); 242 } 232 243 frm.nofTubes.focus(); 233 244 currentStep = 2; … … 242 253 243 254 frm.arrivalDate.disabled = true; 244 frm.partitionDate.disabled = true;245 255 frm.nofTubes.disabled = true; 246 256 frm.pad.disabled = true; … … 253 263 frm.rnaLaterTime.disabled = true; 254 264 frm.samplingTime.disabled = true; 255 frm. pathNote.disabled = true;265 frm.otherPathNote.disabled = true; 256 266 257 267 if (updateMode) … … 276 286 boxValue = specimen.box == null ? '' : specimen.box; 277 287 rowValue = specimen.row == null ? '' : specimen.row; 278 columnValue = specimen.column == null ? '' : specimen.column; 279 spWeightValue = specimen.spWeight == null ? '' : specimen.spWeight; 280 hisWeightValue = specimen.hisWeight == null ? '' : specimen.hisWeight; 281 allPrepWeightValue = specimen.allPrepWeight == null ? '' : specimen.allPrepWeight; 288 columnValue = specimen.column == null ? '' : specimen.column; 282 289 } 283 290 inputTubeHtml += '<tr>'; … … 289 296 inputTubeHtml += '<tr>'; 290 297 inputTubeHtml += '<td class="subprompt">Box</td>'; 291 inputTubeHtml += '<td class="input"><input type="text" name='+box+' value="' + boxValue + '" '+ boxDisabled +' size="12" maxlength="12" onChange="boxOnChange('+i+')"></td>'; 298 inputTubeHtml += '<td class="input">'; 299 inputTubeHtml += '<input type="text" name='+box+' value="Sp' + boxValue + '" '+ boxDisabled +' size="12" maxlength="12" onKeyUp="boxOnKeyUp('+i+')" onChange="boxOnChange('+i+')"></td>'; 292 300 inputTubeHtml += '<td class="status" id="'+box+'.status"></td>'; 293 inputTubeHtml += '<td class="help"><span id="'+box+'.message" class="message" style="display: none;"></span>Box the specimen tube is located in.</td>';301 inputTubeHtml += '<td class="help"><span id="'+box+'.message" class="message" style="display: none;"></span>Box-number where the specimen tube is located in.</td>'; 294 302 inputTubeHtml += '</tr>'; 295 303 … … 308 316 inputTubeHtml += '</tr>'; 309 317 310 var spWeight = 'spWeight'+i;311 inputTubeHtml += '<tr>';312 inputTubeHtml += '<td class="subprompt">Sp weight</td>';313 inputTubeHtml += '<td class="input"><input type="text" name='+spWeight+' value="' + spWeightValue + '" size="12" maxlength="10"></td>';314 inputTubeHtml += '<td class="status" id="'+spWeight+'.status"></td>';315 inputTubeHtml += '<td class="help"><span id="'+spWeight+'.message" class="message" style="display: none;"></span>[mg]</td>';316 inputTubeHtml += '</tr>';317 318 var allPrep = 'allPrepWeight' + i;319 inputTubeHtml += '<tr>';320 inputTubeHtml += '<td class="subprompt">Allprep weight</td>';321 inputTubeHtml += '<td class="input"><input type="text" name='+allPrep+' value="'+allPrepWeightValue+'" size="12" maxlength="10"></td>';322 inputTubeHtml += '<td class="status" id="'+allPrep+'.status"></td>';323 inputTubeHtml += '<td class="help"><span id="'+allPrep+'.message" class="message" style="display: none;"></span>[mg]</td>';324 inputTubeHtml += '</tr>';325 326 var his = 'hisWeight'+i;327 inputTubeHtml += '<tr>';328 inputTubeHtml += '<td class="subprompt">His weight</td>';329 inputTubeHtml += '<td class="input"><input type="text" name='+his+' value="'+hisWeightValue+'" size="12" maxlength="10"></td>';330 inputTubeHtml += '<td class="status" id="his.status"></td>';331 inputTubeHtml += '<td class="help"><span id="'+his+'.message" class="message" style="display: none;"></span>[mg]</td>';332 inputTubeHtml += '</tr>';333 334 318 var operatorComment = 'operatorComment'+i; 335 319 var doOnTab = i==(nofTubes-1) ? 'doOnTab(event, goCreate)' : ''; … … 346 330 currentStep = 3; 347 331 Main.show('tubeSection'); 348 Main.hide('gonext'); 332 Main.hide('gonext'); 349 333 350 334 if (updateMode) Main.show('goupdate'); 351 335 else Main.show('gocreate'); 352 336 353 if (frm.box0.value == ' ') frm.box0.focus();354 else frm. his0.focus();337 if (frm.box0.value == 'Sp') frm.box0.focus(); 338 else frm.operatorComment0.focus(); 355 339 } 356 340 … … 358 342 { 359 343 var frm = document.forms['reggie']; 344 var todaysDate = new Date(); 360 345 samplingDateIsValid = false; 361 346 setInputStatus('samplingDate', '', ''); … … 377 362 setInputStatus('samplingDate', 'Not a valid date', 'invalid'); 378 363 return; 364 } 365 if (todaysDate < new Date(samplingDate.substring(0,4),(samplingDate.substring(4,6)-1), samplingDate.substring(6)) ) 366 { 367 setInputStatus('samplingDate', 'Future date is not valid', 'invalid'); 368 return; 379 369 } 380 370 if (frm.rnaLaterDate.value == '') frm.rnaLaterDate.value = samplingDate; … … 388 378 } 389 379 samplingDateIsValid = true; 380 } 381 382 function boxOnKeyUp(tubeIndex) 383 { 384 var frm = document.forms['reggie']; 385 var boxName = 'box'+tubeIndex; 386 var boxValue = frm.elements[boxName].value; 387 if (boxValue.substring(0,2) != 'Sp') 388 { 389 boxValue = 'Sp'+boxValue; 390 } 391 frm.elements[boxName].value = boxValue; 390 392 } 391 393 … … 397 399 var columnName = 'column'+tubeIndex; 398 400 var boxValue = frm.elements[boxName].value; 399 401 var nofTubes = frm.nofTubes.value; 402 403 boxValue = boxValue.substring(2); 404 while (boxValue.length < 3) 405 { 406 boxValue = '0'+boxValue; 407 } 408 boxValue = 'Sp'+boxValue; 409 frm.elements[boxName].value = boxValue; 410 400 411 wellsAreValid[tubeIndex] = false; 401 412 … … 407 418 frm.elements[rowName].value = ''; 408 419 frm.elements[columnName].disabled = true; 409 frm.elements[columnName].value = ''; 410 frm.elements['his'+tubeIndex].focus(); 420 frm.elements[columnName].value = ''; 411 421 setInputStatus(boxName, '', ''); 412 422 setInputStatus('rowColumn'+tubeIndex, '', ''); … … 445 455 frm.elements[rowName].disabled = false; 446 456 frm.elements[columnName].disabled = false; 447 frm.elements[rowName].value = ''; 448 frm.elements[columnName].value = ''; 457 458 var nextWellRow = response.freeRow; 459 var nextWellColumn = parseInt(response.freeColumn)+1; 460 461 if( (nextWellColumn + tubeIndex) > response.columns) 462 { 463 464 } 465 else 466 { 467 nextWellColumn + tubeIndex; 468 } 469 470 frm.elements[rowName].value = nextWellRow 471 frm.elements[columnName].value = nextWellColumn; 449 472 setInputStatus('rowColumn'+tubeIndex,'Row[A-'+response.rows+'], Columns[1-'+response.columns+']',''); 450 473 setInputStatus(boxName, '', 'valid'); … … 515 538 { 516 539 var frm = document.forms['reggie']; 540 var todaysDate = new Date(); 517 541 rnaLaterDateIsValid = false; 518 542 setInputStatus('rnaLaterDate', '', ''); … … 524 548 if (rnaLaterDate != '' || rnaLaterTime != '') 525 549 { 526 // Auto-fill the date if it's only given with 4(MMdd) or 6(yyMMdd) digits.550 // Auto-fill the date if it's not given in yyyyMMdd 527 551 rnaLaterDate = autoFillDate(rnaLaterDate); 528 552 frm.rnaLaterDate.value = rnaLaterDate; … … 536 560 return; 537 561 } 562 if (todaysDate < new Date(rnaLaterDate.substring(0,4),(rnaLaterDate.substring(4,6)-1), rnaLaterDate.substring(6)) ) 563 { 564 setInputStatus('rnaLaterDate', 'Future date is not valid', 'invalid'); 565 return; 566 } 538 567 rnaLaterTimestamp = Dates.parseString(rnaLaterDate + ' ' + rnaLaterTime, 'yyyyMMdd HHmm'); 539 568 if (rnaLaterTimestamp == null) … … 542 571 return; 543 572 } 573 if (samplingDateIsValid && rnaLaterTimestamp) 574 { 575 var samplingTimestamp = Dates.parseString(frm.samplingDate.value + ' ' + frm.samplingTime.value, 'yyyyMMdd Hmm'); 576 if (samplingTimestamp && rnaLaterTimestamp.getDate() != samplingTimestamp.getDate()) 577 { 578 setInputStatus('rnaLaterDate', 'Sampling and RNA later dates are different', 'warning'); 579 return; 580 } 581 } 544 582 setInputStatus('rnaLaterDate', '', 'valid'); 545 583 } 546 584 547 585 rnaLaterDateIsValid = true; 548 549 if (samplingDateIsValid && rnaLaterTimestamp)550 {551 var samplingTimestamp = Dates.parseString(frm.samplingDate.value + ' ' + frm.samplingTime.value, 'yyyyMMdd Hmm');552 if (samplingTimestamp && rnaLaterTimestamp.getDate() != samplingTimestamp.getDate())553 {554 setInputStatus('rnaLaterDate', 'Sampling and RNA later dates are different', 'warning');555 }556 }557 586 } 558 587 … … 561 590 var frm = document.forms['reggie']; 562 591 var arrivalDate = frm.arrivalDate.value; 592 var todaysDate = new Date(); 563 593 arrivalDateIsValid = false; 564 594 … … 575 605 return; 576 606 } 607 if (todaysDate < new Date(arrivalDate.substring(0,4), arrivalDate.substring(4,6), arrivalDate.substring(6))) 608 { 609 setInputStatus('arrivalDate', 'Future dates are not valid','invalid'); 610 return; 611 } 577 612 setInputStatus('arrivalDate', '', 'valid'); 578 613 arrivalDateIsValid = true; … … 584 619 } 585 620 586 function partitionDateOnBlur()587 {588 var frm = document.forms['reggie'];589 var partitionDate = frm.partitionDate.value;590 partitionDateIsValid = false;591 592 setInputStatus('partitionDate', '', '');593 594 if (partitionDate != '')595 {596 partitionDate = autoFillDate(partitionDate);597 frm.partitionDate.value = partitionDate;598 599 if (!Dates.isDate(partitionDate, 'yyyyMMdd'))600 {601 setInputStatus('partitionDate', 'Not a valid date', 'invalid');602 return;603 }604 setInputStatus('partitionDate', '', 'valid');605 partitionDateIsValid = true;606 }607 else608 {609 setInputStatus('partitionDate', 'Missing', 'warning');610 }611 }612 613 621 function nofTubesOnChange() 614 622 { … … 644 652 645 653 function lateralityOnChange() 646 { 647 // No specimen tubes? 648 //if (!caseInfo.specimen || caseInfo.specimen.length == 0) return; 649 654 { 650 655 lateralityIsValid = false; 651 656 … … 677 682 } 678 683 } 684 } 685 686 function specimenTypeOnClick() 687 { 688 var frm = document.forms['reggie']; 689 var selectedSpecimenType = frm.specimenType.value; 690 691 specimenTypeIsValid = true; 692 var specimenType = null; 693 if (selectedSpecimenType != "") 694 { 695 specimenType = selectedSpecimenType; 696 } 697 698 for (var i=0; i<caseInfo.specimen.length; i++) 699 { 700 var specimen = caseInfo.specimen[i]; 701 if (specimen.specimenType != specimenType) 702 { 703 setInputStatus('specimenType', 'Specimen tubes are updated to: ' + specimenType, 'valid') 704 return; 705 } 706 } 707 setInputStatus('specimenType', '', 'valid'); 708 } 709 710 function biopsyTypeOnClick() 711 { 712 var frm = document.forms['reggie']; 713 var selectedBiopsyType = frm.biopsyType.value; 714 biopsyTypeIsValid = true; 715 var biopsyType = null; 716 if (selectedBiopsyType != "") 717 { 718 biopsyType = selectedBiopsyType; 719 } 720 721 for (var i=0; i<caseInfo.specimen.length; i++) 722 { 723 var specimen = caseInfo.specimen[i]; 724 if (specimen.biopsyType != biopsyType) 725 { 726 setInputStatus('biopsyType', 'Specimen tubes are updated to: ' + biopsyType, 'valid') 727 return; 728 } 729 } 730 setInputStatus('biopsyType', '', 'valid'); 679 731 } 680 732 … … 711 763 caseInfo.samplingDate = Main.trimString(frm.samplingDate.value + ' ' + frm.samplingTime.value); 712 764 caseInfo.rnaLaterDate = Main.trimString(frm.rnaLaterDate.value + ' ' + frm.rnaLaterTime.value); 713 caseInfo.pathNote = frm.pathNote.value; 714 caseInfo.arrivalDate = Main.trimString(frm.arrivalDate.value); 715 caseInfo.partitionDate = Main.trimString(frm.partitionDate.value); 765 caseInfo.otherPathNote = frm.otherPathNote.value; 766 caseInfo.arrivalDate = Main.trimString(frm.arrivalDate.value); 716 767 717 768 var nofTubes = frm.nofTubes.value; … … 725 776 frm.elements['row'+i].disabled = true; 726 777 frm.elements['column'+i].disabled = true; 727 frm.elements['spWeight'+i].disabled = true;728 frm.elements['allPrepWeight'+i].disabled = true;729 frm.elements['hisWeight'+i].disabled = true;730 778 frm.elements['operatorComment'+i].disabled = true; 731 779 … … 733 781 if (frm.elements['row'+i].value != '') specimenTube.row = frm.elements['row'+i].value; 734 782 if (frm.elements['column'+i].value != '') specimenTube.column = frm.elements['column'+i].value; 735 if (frm.elements['operatorComment'+i].value != '') specimenTube.operatorComment = frm.elements['operatorComment'+i].value; 736 737 if (frm.elements['spWeight'+i].value != '') specimenTube.spWeight = frm.elements['spWeight'+i].value; 738 if (frm.elements['allPrepWeight'+i].value != '') specimenTube.allPrepWeight = frm.elements['allPrepWeight'+i].value; 739 if (frm.elements['hisWeight'+i].value != '') specimenTube.hisWeight = frm.elements['hisWeight'+i].value; 783 if (frm.elements['operatorComment'+i].value != '') specimenTube.operatorComment = frm.elements['operatorComment'+i].value; 784 if (frm.specimenType.value != '') specimenTube.specimenType = frm.specimenType.value; 785 if (frm.biopsyType.value != '') specimenTube.biopsyType = frm.biopsyType.value; 740 786 741 787 caseInfo.specimen[i] = specimenTube; … … 862 908 <td class="help"><span id="arrivalDate.message" class="message" style="display:none"></span>Date when the specimen tubes arrived(YYYYMMDD or MMDD).</td> 863 909 </tr> 864 <tr valign="top">865 <td class="prompt">Partition date</td>866 <td class="input"><input type="text" name="partitionDate"867 value="" size="12" maxlength="10" onblur="partitionDateOnBlur()"></td>868 <td class="status" id="partitionDate.status"></td>869 <td class="help"><span id="partitionDate.message" class="message" style="display:none"></span>Date when the specimen tubes were partitioned(YYYYMMDD or MMDD).</td>870 </tr>871 910 <tr> 872 911 <td class="prompt">PAD</td> … … 884 923 onkeypress="focusOnEnter(event, 'rnaLaterDate')" onblur="samplingDateTimeOnChange()"></td> 885 924 <td class="status" id="samplingDate.status"></td> 886 <td class="help"><span id="samplingDate.message" class="message" style="display: none;"></span>Date+time of surgical removal (YYYYMMDD, HHMM )</td>925 <td class="help"><span id="samplingDate.message" class="message" style="display: none;"></span>Date+time of surgical removal (YYYYMMDD, HHMM or MMDD, HMM)</td> 887 926 </tr> 888 927 <tr id="rnaLaterDateSection" valign="top"> … … 893 932 onblur="rnaLaterDateTimeOnChange()"></td> 894 933 <td class="status" id="rnaLaterDate.status"></td> 895 <td class="help"><span id="rnaLaterDate.message" class="message" style="display: none;"></span>Date+time of pathology handling (YYYYMMDD, HHMM )</td>934 <td class="help"><span id="rnaLaterDate.message" class="message" style="display: none;"></span>Date+time of pathology handling (YYYYMMDD, HHMM or MMDD, HMM)</td> 896 935 </tr> 897 936 <tr> … … 906 945 </tr> 907 946 <tr> 908 <td class="prompt" id="pathNote.prompt">Path note</td> 909 <td class="input" id="pathNote.input"><textarea rows="3" cols="30" 910 name="pathNote" value="" onkeypress="doOnTab(event, goNext)"></textarea></td> 911 <td class="status" id="pathNote.status"></td> 912 <td class="help"><span id="pathNote.message" class="message" style="display: none;"></span></td> 947 <td class="prompt" id="specimenType.prompt">Speciment type</td> 948 <td class="input" id="specimenType.input"> 949 <select name="specimenType" onChange="specimenTypeOnClick()"> 950 <option selected value="Primary">Primary 951 <option value="LymfnodeRegional">LymfnodeRegional 952 <option value="MetastasisDistant">MetastasisDistant 953 <option value="RecurrenceLocal">RecurrenceLocal 954 <option value="RecurrenceRegional">RecurrenceRegional 955 <option value="" >unknown 956 </select> 957 </td> 958 <td class="status" id="specimenType.status"></td> 959 <td class="help"><span id="specimenType.message" class="message" style="display: none;"></span></td> 960 </tr> 961 <tr> 962 <td class="prompt" id="biopsyType.prompt">Biopsy type</td> 963 <td class="input" id="biopsyType.input"> 964 <select name="biopsyType" onChange="biopsyTypeOnClick()"> 965 <option value="SpecimenSurgery">SpecimenSurgery 966 <option value="SpecimenCoreBiopsy">SpecimenCoreBiopsy 967 <option value="SpecimenFineNeedleAspiration" >SpecimenFineNeedleAspiration 968 <option value="" >unknown 969 </select> 970 </td> 971 <td class="status" id="biopsyType.status"></td> 972 <td class="help"><span id="biopsyType.message" class="message" style="display: none;"></span></td> 973 </tr> 974 975 <tr> 976 <td class="prompt" id="otherPathNote.prompt">Other path note</td> 977 <td class="input" id="otherPathNote.input"><textarea rows="3" cols="30" 978 name="otherPathNote" value="" onkeypress="doOnTab(event, goNext)"></textarea></td> 979 <td class="status" id="otherPathNote.status"></td> 980 <td class="help"><span id="otherPathNote.message" class="message" style="display: none;"></span></td> 913 981 </tr> 914 982 </table> -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/Reggie.java
r1380 r1389 96 96 used for samples (Case). It is a string annotation type. 97 97 */ 98 public static final String ANNOTATION_ PATH_NOTE = "PathNote";98 public static final String ANNOTATION_OTHER_PATH_NOTE = "OtherPathNote"; 99 99 100 100 /** … … 129 129 */ 130 130 public static final String ANNOTATION_ARRIVAL_DATE = "ArrivalDate"; 131 132 /** 133 The name of the "PartitionDate" annotation type, used 134 for samples (Specimen tube). It is a timestamp annotation. 135 */ 136 public static final String ANNOTATION_PARTITION_DATE = "PartitionDate"; 131 137 132 /** 138 133 The name of the "NofDeliveredTubes" annotation type, used … … 154 149 155 150 /** 156 The name of the Sp-weight annotation type, use 157 for samples (Specimen tube). It is a Float annotation type. 158 */ 159 public static final String ANNOTATION_SP_WEIGTH = "SpWeight"; 160 161 /** 162 The name of the allPrep-weight annotation type, use 163 for samples (Specimen tube). It is a Float annotation type. 164 */ 165 public static final String ANNOTATION_ALLPREP_WEIGTH = "AllPrepWeight"; 166 167 /** 168 The name of the his-weight annotation type, use 169 for samples (Specimen tube). It is a Float annotation type. 170 */ 171 public static final String ANNOTATION_HIS_WEIGTH = "HisWeight"; 151 The name of the "SpecimenType" annotation type, used for 152 samples (Specimen tube). It is a String enumeration annotation. 153 */ 154 public static final String ANNOTATION_SPECIMEN_TYPE = "SpecimenType"; 155 156 /** 157 The name of the "BiopsyType" annotation type, used for 158 samples (Specimen tube). It is a String enumeration annotation. 159 */ 160 public static final String ANNOTATION_BIOPSY_TYPE = "BiopsyType"; 172 161 173 162 /** -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/InstallServlet.java
r1380 r1389 127 127 jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_ARRIVAL_DATE, Item.SAMPLE, Type.DATE, 1, 128 128 null, effectiveOptions, createIfMissing)); 129 jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_PARTITION_DATE, Item.SAMPLE, Type.DATE, 1,130 null, effectiveOptions, createIfMissing));131 129 jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_NOF_DELIVERED_TUBES, Item.SAMPLE, Type.INT, 1, 132 130 null, effectiveOptions, createIfMissing)); 133 131 jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_OPERATOR_COMMENT, Item.SAMPLE, Type.STRING, 1, 134 132 null, effectiveOptions, createIfMissing)); 135 jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_ PATH_NOTE, Item.SAMPLE, Type.STRING, 1,136 null, effectiveOptions, createIfMissing)); 137 jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_ ALLPREP_WEIGTH, Item.SAMPLE, Type.FLOAT, 1,138 n ull,effectiveOptions, createIfMissing));139 jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_SP_WEIGTH, Item.SAMPLE, Type.FLOAT, 1,140 null,effectiveOptions, createIfMissing));141 jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_HIS_WEIGTH, Item.SAMPLE, Type.FLOAT, 1,142 null,effectiveOptions, createIfMissing));143 133 jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_OTHER_PATH_NOTE, Item.SAMPLE, Type.STRING, 1, 134 null, effectiveOptions, createIfMissing)); 135 jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_SPECIMEN_TYPE, Item.SAMPLE, Type.STRING, 1, 136 new EnumerationOptions("Primary", "LymfnodeRegional", "MetastasisDistant", "RecurrenceLocal", "RecurrenceRegional"), 137 effectiveOptions, createIfMissing)); 138 jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_BIOPSY_TYPE, Item.SAMPLE, Type.STRING, 1, 139 new EnumerationOptions("SpecimenSurgery", "SpecimenCoreBiopsy", "SpecimenFineNeedleAspiration"), 140 effectiveOptions, createIfMissing)); 141 144 142 json.put("checks", jsonChecks); 145 143 } -
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/SpecimenTubeServlet.java
r1380 r1389 86 86 theCase.loadAnnotations(dc, "pad", Reggie.ANNOTATION_PAD_CASE, null); 87 87 theCase.loadAnnotations(dc, "reasonIfNoSpecimen", Reggie.ANNOTATION_REASON_IF_NO_SPECIMEN, null); 88 theCase.loadAnnotations(dc, "pathNote", Reggie.ANNOTATION_ PATH_NOTE, null);88 theCase.loadAnnotations(dc, "pathNote", Reggie.ANNOTATION_OTHER_PATH_NOTE, null); 89 89 90 90 jsonCase = theCase.asJSONObject(); … … 103 103 AnnotationType samplingDateType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_SAMPLING_DATETIME, true); 104 104 AnnotationType rnaLaterDateType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_RNALATER_DATETIME, true); 105 AnnotationType arrivalDateType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_ARRIVAL_DATE, true); 106 AnnotationType partitionDateType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_PARTITION_DATE, true); 105 AnnotationType arrivalDateType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_ARRIVAL_DATE, true); 107 106 AnnotationType nofDeliveredTubesType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_NOF_DELIVERED_TUBES, true); 108 107 AnnotationType operatorCommentType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_OPERATOR_COMMENT, true); 109 AnnotationType pathNoteType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_PATH_NOTE, true); 110 AnnotationType spWeightType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_SP_WEIGTH, true); 111 AnnotationType allPrepWeightType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_ALLPREP_WEIGTH, true); 112 AnnotationType hisWeightType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_HIS_WEIGTH, true); 113 108 AnnotationType pathNoteType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_OTHER_PATH_NOTE, true); 109 AnnotationType specimenType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_SPECIMEN_TYPE, true); 110 AnnotationType biopsyType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_BIOPSY_TYPE, true); 111 114 112 DateToStringConverter dateTimeConverter = new DateToStringConverter(new SimpleDateFormat("yyyyMMdd HHmm")); 115 113 DateToStringConverter dateConverter = new DateToStringConverter(new SimpleDateFormat("yyyyMMdd")); … … 121 119 tube.loadAnnotations("rnaLaterDate", rnaLaterDateType, dateTimeConverter); 122 120 tube.loadAnnotations("arrivalDate", arrivalDateType, dateConverter); 123 tube.loadAnnotations("partitionDate", partitionDateType, dateConverter);124 121 tube.loadAnnotations("nofTubes", nofDeliveredTubesType, null); 125 122 tube.loadAnnotations("operatorComment", operatorCommentType, null); 126 tube.loadAnnotations("pathNote", pathNoteType, null); 127 tube.loadAnnotations("allPrepWeight", allPrepWeightType, null); 128 tube.loadAnnotations("spWeight", spWeightType, null); 129 tube.loadAnnotations("hisWeight", hisWeightType, null); 130 123 tube.loadAnnotations("otherPathNote", pathNoteType, null); 124 tube.loadAnnotations("specimenType", specimenType, null); 125 tube.loadAnnotations("biopsyType", biopsyType, null); 126 131 127 jsonTubes.add(tube.asJSONObject()); 132 128 } … … 153 149 else 154 150 { 151 BioPlate box = boxes.get(0); 155 152 WellCoordinateFormatter wcfRow = new WellCoordinateFormatter(true); 153 154 int rowIndex = box.getRows()-1; 155 boolean isLastEmpty = false; 156 BioWell emptyWell = null; 157 while (rowIndex >= 0 && !isLastEmpty) 158 { 159 int columnIndex = box.getColumns()-1; 160 while (columnIndex >= 0 && !isLastEmpty) 161 { 162 if (box.getBioWell(rowIndex, columnIndex).isEmpty()) 163 { 164 emptyWell = box.getBioWell(rowIndex, columnIndex); 165 } 166 else 167 { 168 isLastEmpty = true; 169 } 170 columnIndex--; 171 } 172 rowIndex--; 173 } 156 174 157 175 json.put("boxInfo", boxes.get(0).getId()); 158 176 json.put("rows", wcfRow.format(boxes.get(0).getRows()-1)); 159 177 json.put("columns", boxes.get(0).getColumns()); 178 json.put("freeColumn", emptyWell.getColumn()); 179 json.put("freeRow", wcfRow.format(emptyWell.getRow())); 160 180 } 161 181 … … 236 256 String laterality = Values.getStringOrNull((String)jsonCase.get("laterality")); 237 257 String padCase = Values.getStringOrNull((String)jsonCase.get("pad")); 238 String pathNote = Values.getStringOrNull((String)jsonCase.get("pathNote"));258 String otherPathNote = Values.getStringOrNull((String)jsonCase.get("otherPathNote")); 239 259 StringToDateConverter dateTimeConverter = new StringToDateConverter(new SimpleDateFormat("yyyyMMdd HHmm")); 240 260 StringToDateConverter dateConverter = new StringToDateConverter(new SimpleDateFormat("yyyyMMdd")); 241 261 Date samplingDate = dateTimeConverter.convert((String)jsonCase.get("samplingDate")); 242 262 Date rnaLaterDate = dateTimeConverter.convert((String)jsonCase.get("rnaLaterDate")); 243 Date arrivalDate = dateConverter.convert((String)jsonCase.get("arrivalDate")); 244 Date partitionDate = dateConverter.convert((String)jsonCase.get("partitionDate")); 263 Date arrivalDate = dateConverter.convert((String)jsonCase.get("arrivalDate")); 245 264 246 265 AnnotationType nofDeliveredTubesType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_NOF_DELIVERED_TUBES, true); … … 248 267 AnnotationType padCaseType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_PAD_CASE, true); 249 268 AnnotationType lateralityType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_LATERALITY, true); 250 AnnotationType pathNoteType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_ PATH_NOTE, true);269 AnnotationType pathNoteType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_OTHER_PATH_NOTE, true); 251 270 AnnotationType samplingDateType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_SAMPLING_DATETIME, true); 252 271 AnnotationType rnaLaterDateType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_RNALATER_DATETIME, true); 253 AnnotationType arrivalDateType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_ARRIVAL_DATE, true); 254 AnnotationType partitionDateType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_PARTITION_DATE, true); 272 AnnotationType arrivalDateType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_ARRIVAL_DATE, true); 255 273 AnnotationType operatorCommentType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_OPERATOR_COMMENT, true); 256 AnnotationType spWeightType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_SP_WEIGTH, true); 257 AnnotationType allPrepWeightType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_ALLPREP_WEIGTH, true); 258 AnnotationType hisWeightType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_HIS_WEIGTH, true); 274 AnnotationType specimenType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_SPECIMEN_TYPE, true); 275 AnnotationType biopsyType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_BIOPSY_TYPE, true); 259 276 260 277 // Checking if it is an existing case or a new should be created. … … 264 281 265 282 if (laterality != null) Reggie.setAnnotationValue(theCase, lateralityType, laterality); 266 if (arrivalDate != null) Reggie.setAnnotationValue(theCase, arrivalDateType, arrivalDate); 267 if (partitionDate != null) Reggie.setAnnotationValue(theCase, partitionDateType, partitionDate); 268 if (pathNote != null) Reggie.setAnnotationValue(theCase, pathNoteType, pathNote); 269 if (padCase != null) Reggie.appendAnnotationValueIfUnique(theCase, padCaseType, padCase); 283 if (arrivalDate != null) Reggie.setAnnotationValue(theCase, arrivalDateType, arrivalDate); 284 if (otherPathNote != null) Reggie.setAnnotationValue(theCase, pathNoteType, otherPathNote); 285 if (padCase != null) Reggie.appendAnnotationValueIfUnique(theCase, padCaseType, padCase); 270 286 } 271 287 … … 279 295 Number specimenId = (Number)jsonSpec.get("id"); 280 296 Sample specimen = Sample.getById(dc, specimenId.intValue()); 281 282 float originalQuantity = 0; 283 Float spWeight = null; 284 Float allPrepWeight = null; 285 Float hisWeight = null; 286 if (jsonSpec.get("spWeight") != null && jsonSpec.get("spWeight") != "") 287 { 288 spWeight = Values.getFloat(((String)jsonSpec.get("spWeight"))); 289 } 290 if (jsonSpec.get("hisWeight") != null && jsonSpec.get("hisWeight") != "") 291 { 292 hisWeight = Values.getFloat((String)jsonSpec.get("hisWeight")); 293 } 294 if (jsonSpec.get("allPrepWeight") != null && jsonSpec.get("allPrepWeight") != "") 295 { 296 allPrepWeight = Values.getFloat((String)jsonSpec.get("allPrepWeight")); 297 } 297 298 298 String operatorComment = Values.getStringOrNull((String)jsonSpec.get("operatorComment")); 299 String specimenTypeString = Values.getStringOrNull((String)jsonCase.get("specimenType")); 300 String biopsyTypeString = Values.getStringOrNull((String)jsonCase.get("biopsyType")); 299 301 300 302 Reggie.setAnnotationValue(specimen, nofDeliveredTubesType, nofTubes); 301 303 if (arrivalDate != null) Reggie.setAnnotationValue(specimen, arrivalDateType, arrivalDate); 302 if (partitionDate != null) Reggie.setAnnotationValue(specimen, partitionDateType, partitionDate);303 304 if (laterality != null) Reggie.setAnnotationValue(specimen, lateralityType, laterality); 304 305 if (samplingDate != null) Reggie.setAnnotationValue(specimen, samplingDateType, samplingDate); 305 306 if (rnaLaterDate != null) Reggie.setAnnotationValue(specimen, rnaLaterDateType, rnaLaterDate); 306 307 if (padCase != null) Reggie.setAnnotationValue(specimen, padType, padCase); 307 if (pathNote != null) Reggie.setAnnotationValue(specimen, pathNoteType, pathNote); 308 if (spWeight != null) 309 { 310 Reggie.setAnnotationValue(specimen, spWeightType, spWeight.floatValue()); 311 originalQuantity = originalQuantity + spWeight * 1000; 312 } 313 if (allPrepWeight != null) 314 { 315 Reggie.setAnnotationValue(specimen, allPrepWeightType, allPrepWeight.floatValue()); 316 originalQuantity = originalQuantity + allPrepWeight.floatValue() * 1000; 317 } 318 if (hisWeight != null) 319 { 320 Reggie.setAnnotationValue(specimen, hisWeightType, hisWeight.floatValue()); 321 originalQuantity = originalQuantity + hisWeight.floatValue() * 1000; 322 } 323 if (operatorComment != null) Reggie.setAnnotationValue(specimen, operatorCommentType, operatorComment); 324 if (originalQuantity > 0) specimen.setOriginalQuantity(originalQuantity); 325 308 if (otherPathNote != null) Reggie.setAnnotationValue(specimen, pathNoteType, otherPathNote); 309 if (operatorComment != null) Reggie.setAnnotationValue(specimen, operatorCommentType, operatorComment); 310 if (specimenTypeString != null) Reggie.setAnnotationValue(specimen, specimenType, specimenTypeString); 311 if (biopsyTypeString != null) Reggie.setAnnotationValue(specimen, biopsyType, biopsyTypeString); 312 326 313 jsonMessages.add("Specimen tube '" + specimen.getName() + "' updated successfully."); 327 314 } … … 339 326 String laterality = Values.getStringOrNull((String)jsonCase.get("laterality")); 340 327 String padCase = Values.getStringOrNull((String)jsonCase.get("pad")); 341 String pathNote = Values.getStringOrNull((String)jsonCase.get("pathNote"));328 String otherPathNote = Values.getStringOrNull((String)jsonCase.get("pathNote")); 342 329 StringToDateConverter dateTimeConverter = new StringToDateConverter(new SimpleDateFormat("yyyyMMdd HHmm")); 343 330 StringToDateConverter dateConverter = new StringToDateConverter(new SimpleDateFormat("yyyyMMdd")); … … 345 332 Date rnaLaterDate = dateTimeConverter.convert((String)jsonCase.get("rnaLaterDate")); 346 333 Date arrivalDate = dateConverter.convert((String)jsonCase.get("arrivalDate")); 347 Date partitionDate = dateConverter.convert((String)jsonCase.get("partitionDate"));348 334 349 335 AnnotationType nofDeliveredTubesType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_NOF_DELIVERED_TUBES, true); 350 AnnotationType padType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_PAD, true); 351 AnnotationType padCaseType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_PAD_CASE, true); 336 AnnotationType padType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_PAD, true); 352 337 AnnotationType lateralityType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_LATERALITY, true); 353 AnnotationType pathNoteType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_PATH_NOTE, true);338 AnnotationType otherPathNoteType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_OTHER_PATH_NOTE, true); 354 339 AnnotationType samplingDateType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_SAMPLING_DATETIME, true); 355 340 AnnotationType rnaLaterDateType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_RNALATER_DATETIME, true); 356 341 AnnotationType arrivalDateType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_ARRIVAL_DATE, true); 357 AnnotationType partitionDateType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_PARTITION_DATE, true);358 342 AnnotationType operatorCommentType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_OPERATOR_COMMENT, true); 359 AnnotationType spWeightType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_SP_WEIGTH, true); 360 AnnotationType allPrepWeightType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_ALLPREP_WEIGTH, true); 361 AnnotationType hisWeightType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_HIS_WEIGTH, true); 343 AnnotationType specimenType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_SPECIMEN_TYPE, true); 344 AnnotationType biopsyType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_BIOPSY_TYPE, true); 362 345 363 346 JSONArray jsonSpecimen = (JSONArray)jsonCase.get("specimen"); 364 347 365 348 if (jsonSpecimen != null && jsonSpecimen.size() > 0) 366 349 { … … 373 356 dc.saveItem(specimen); 374 357 375 float originalQuantity = 0;376 Float spWeight = null;377 Float allPrepWeight = null;378 Float hisWeight = null;379 if (jsonSpec.get("spWeight") != null && jsonSpec.get("spWeight") != "")380 {381 spWeight = Values.getFloat(((String)jsonSpec.get("spWeight")));382 }383 if (jsonSpec.get("hisWeight") != null && jsonSpec.get("hisWeight") != "")384 {385 hisWeight = Values.getFloat((String)jsonSpec.get("hisWeight"));386 }387 if (jsonSpec.get("allPrepWeight") != null && jsonSpec.get("allPrepWeight") != "")388 {389 allPrepWeight = Values.getFloat((String)jsonSpec.get("allPrepWeight"));390 }391 392 358 String operatorComment = Values.getStringOrNull((String)jsonSpec.get("operatorComment")); 359 String specimenTypeString = Values.getStringOrNull((String)jsonSpec.get("specimenType")); 360 String biopsyTypeString = Values.getStringOrNull((String)jsonSpec.get("biopsyType")); 393 361 394 362 Reggie.setAnnotationValue(specimen, nofDeliveredTubesType, nofTubes); 395 if (arrivalDate != null) Reggie.setAnnotationValue(specimen, arrivalDateType, arrivalDate); 396 if (partitionDate != null) Reggie.setAnnotationValue(specimen, partitionDateType, partitionDate); 363 if (arrivalDate != null) Reggie.setAnnotationValue(specimen, arrivalDateType, arrivalDate); 397 364 if (laterality != null) Reggie.setAnnotationValue(specimen, lateralityType, laterality); 398 365 if (samplingDate != null) Reggie.setAnnotationValue(specimen, samplingDateType, samplingDate); 399 366 if (rnaLaterDate != null) Reggie.setAnnotationValue(specimen, rnaLaterDateType, rnaLaterDate); 400 367 if (padCase != null) Reggie.setAnnotationValue(specimen, padType, padCase); 401 if (pathNote != null) Reggie.setAnnotationValue(specimen, pathNoteType, pathNote); 402 403 if (spWeight != null) 404 { 405 System.out.println("sp: " + spWeight); 406 Reggie.setAnnotationValue(specimen, spWeightType, spWeight.floatValue()); 407 originalQuantity = originalQuantity + spWeight * 1000; 408 } 409 if (allPrepWeight != null) 410 { 411 Reggie.setAnnotationValue(specimen, allPrepWeightType, allPrepWeight.floatValue()); 412 originalQuantity = originalQuantity + allPrepWeight.floatValue() * 1000; 413 } 414 if (hisWeight != null) 415 { 416 Reggie.setAnnotationValue(specimen, hisWeightType, hisWeight.floatValue()); 417 originalQuantity = originalQuantity + hisWeight.floatValue() * 1000; 418 } 419 if (operatorComment != null) Reggie.setAnnotationValue(specimen, operatorCommentType, operatorComment); 420 if (originalQuantity > 0) specimen.setOriginalQuantity(originalQuantity); 368 if (otherPathNote != null) Reggie.setAnnotationValue(specimen, otherPathNoteType, otherPathNote); 369 if (specimenTypeString != null ) Reggie.setAnnotationValue(specimen, specimenType, specimenTypeString); 370 if (biopsyTypeString != null) Reggie.setAnnotationValue(specimen, biopsyType,biopsyTypeString); 371 372 if (operatorComment != null) Reggie.setAnnotationValue(specimen, operatorCommentType, operatorComment); 421 373 422 374 // Set biowell if it is specified for this tube
Note: See TracChangeset
for help on using the changeset viewer.