Ignore:
Timestamp:
Sep 9, 2011, 3:37:01 PM (10 years ago)
Author:
Martin Svensson
Message:

References #317. Added two more annotations to specimen tubes and also some helpful features when selecting row/column in a box. Annotation:partition date was removed, cause it should be in the partition wizard instead.

File:
1 edited

Legend:

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

    r1380 r1389  
    2828var caseIsValid = false;
    2929var arrivalDateIsValid = false;
    30 var partitionDateIsValid = false;
    3130var nofDeliveredTubesIsValid = true;
    3231var nofTubesIsValid = false;
     
    3433var boxesAreValid = null;
    3534var wellsAreValidValid = null;
     35var specimenTypeIsValid = false;
    3636var debug = false;
    3737var currentStep = 1;
     
    8585  var hasUnknownSpecimen = false;
    8686  var thisArrivalDate = null;
    87   var thisPartitionDate = null;
    8887  var thisNumberOfTubes = null;
    8988  var thisCaseSamplingDate = null;
     
    9190  var thisCaseLaterality = null;
    9291  var thisCasePad = null;
    93   var thisCasePathNote = null;
     92  var thisOtherPathNote = null;
     93  var thisSpecimenType = null;
     94  var thisBiopsyType = null;
    9495
    9596  frm.caseName.disabled = true;
     
    104105  // Load annotations from the actual case
    105106  thisCaseLaterality = caseInfo.laterality;
    106   thisCasePathNote = caseInfo.pathNote;
     107  thisOtherPathNote = caseInfo.otherPathNote;
    107108  thisCasePad = caseInfo.pad;
    108109  if (caseInfo.reasonIfNoSpecimen && caseInfo.reasonIfNoSpecimen.length>0)
     
    138139      {         
    139140        thisArrivalDate = specimen.arrivalDate;
    140       }
    141       if(specimen.partitionDate && !thisPartitionDate)
    142       {         
    143         thisPartitionDate = specimen.partitionDate;
    144141      }
    145142      if (specimen.nofTubes && !thisNumberOfTubes)
     
    155152        thisCaseRNALaterDate = specimen.rnaLaterDate;
    156153      }
    157       if (specimen.pathNote && !thisCasePathNote)
     154      if (specimen.otherPathNote && !thisOtherPathNote)
    158155      {
    159         thisCasePathNote = specimen.pathNote;
     156        thisOtherPathNote = specimen.otherPathNote;
    160157      }
    161158      if (specimen.laterality && !thisCaseLaterality)
     
    164161        if (specimen.laterality == 'RIGHT') hasRightSpecimen = true;
    165162        thisCaseLaterality = specimen.laterality;
    166       }
     163      }     
    167164      else if(!thisCaseLaterality)
    168165      {
    169166        hasUnknownSpecimen = true;
    170167      }
     168      if (specimen.specimenType && !thisSpecimenType)
     169      {
     170        thisSpecimenType = specimen.specimenType;
     171      }
     172      if (specimen.biopsyType && !thisBiopsyType)
     173      {
     174        thisBiopsyType = specimen.biopsyType;
     175      }     
    171176    }
    172177             
     
    205210    frm.arrivalDate.value = thisArrivalDate;
    206211  }
    207   if (thisPartitionDate != null)
    208   {
    209     frm.partitionDate.value = thisPartitionDate;
    210   }
    211212  if (thisNumberOfTubes != null)
    212213  {
     
    226227    rnaLaterDateTimeOnChange();
    227228  }
    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  }
    232243  frm.nofTubes.focus();
    233244  currentStep = 2;   
     
    242253 
    243254  frm.arrivalDate.disabled = true;
    244   frm.partitionDate.disabled = true;
    245255  frm.nofTubes.disabled = true;
    246256  frm.pad.disabled = true;
     
    253263  frm.rnaLaterTime.disabled = true;
    254264  frm.samplingTime.disabled = true;
    255   frm.pathNote.disabled = true;
     265  frm.otherPathNote.disabled = true;
    256266 
    257267  if (updateMode)
     
    276286      boxValue = specimen.box == null ? '' : specimen.box;
    277287      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;     
    282289    }
    283290    inputTubeHtml += '<tr>';
     
    289296    inputTubeHtml += '<tr>';
    290297    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>';
    292300    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>';   
    294302    inputTubeHtml += '</tr>';       
    295303
     
    308316    inputTubeHtml += '</tr>';
    309317
    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 
    334318    var operatorComment = 'operatorComment'+i;
    335319    var doOnTab = i==(nofTubes-1) ? 'doOnTab(event, goCreate)' : '';
     
    346330  currentStep = 3;
    347331  Main.show('tubeSection');
    348   Main.hide('gonext');
     332  Main.hide('gonext'); 
    349333
    350334  if (updateMode) Main.show('goupdate');
    351335  else Main.show('gocreate');
    352336
    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();
    355339}
    356340
     
    358342{
    359343  var frm = document.forms['reggie'];
     344  var todaysDate = new Date();
    360345  samplingDateIsValid = false;
    361346  setInputStatus('samplingDate', '', '');
     
    377362      setInputStatus('samplingDate', 'Not a valid date', 'invalid');
    378363      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;
    379369    }
    380370    if (frm.rnaLaterDate.value == '') frm.rnaLaterDate.value = samplingDate;
     
    388378  }
    389379  samplingDateIsValid = true;
     380}
     381
     382function 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;
    390392}
    391393
     
    397399  var columnName = 'column'+tubeIndex; 
    398400  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 
    400411  wellsAreValid[tubeIndex] = false;
    401412 
     
    407418    frm.elements[rowName].value = '';
    408419    frm.elements[columnName].disabled = true;
    409     frm.elements[columnName].value = '';
    410     frm.elements['his'+tubeIndex].focus();
     420    frm.elements[columnName].value = '';   
    411421    setInputStatus(boxName, '', ''); 
    412422    setInputStatus('rowColumn'+tubeIndex, '', '');       
     
    445455    frm.elements[rowName].disabled = false;
    446456    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;
    449472    setInputStatus('rowColumn'+tubeIndex,'Row[A-'+response.rows+'], Columns[1-'+response.columns+']','');
    450473    setInputStatus(boxName, '', 'valid');   
     
    515538{
    516539  var frm = document.forms['reggie'];
     540  var todaysDate = new Date();
    517541  rnaLaterDateIsValid = false;
    518542  setInputStatus('rnaLaterDate', '', '');
     
    524548  if (rnaLaterDate != '' || rnaLaterTime != '')
    525549  {
    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
    527551    rnaLaterDate = autoFillDate(rnaLaterDate);
    528552    frm.rnaLaterDate.value = rnaLaterDate;
     
    536560      return;
    537561    }
     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    }
    538567    rnaLaterTimestamp = Dates.parseString(rnaLaterDate + ' ' + rnaLaterTime, 'yyyyMMdd HHmm');
    539568    if (rnaLaterTimestamp == null)
     
    542571      return;
    543572    }
     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    }
    544582    setInputStatus('rnaLaterDate', '', 'valid');
    545583  }
    546584   
    547585  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   }
    557586}
    558587
     
    561590  var frm = document.forms['reggie'];
    562591  var arrivalDate = frm.arrivalDate.value;
     592  var todaysDate = new Date();
    563593  arrivalDateIsValid = false;
    564594
     
    575605      return;
    576606    }
     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    }
    577612    setInputStatus('arrivalDate', '', 'valid');
    578613    arrivalDateIsValid = true;   
     
    584619}
    585620
    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   else
    608   {
    609     setInputStatus('partitionDate', 'Missing', 'warning');
    610   }
    611 }
    612 
    613621function nofTubesOnChange()
    614622{
     
    644652
    645653function lateralityOnChange()
    646 {
    647   // No specimen tubes?
    648   //if (!caseInfo.specimen || caseInfo.specimen.length == 0) return;
    649  
     654{
    650655  lateralityIsValid = false;
    651656 
     
    677682    }
    678683  }
     684}
     685
     686function 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
     710function 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');
    679731}
    680732
     
    711763  caseInfo.samplingDate = Main.trimString(frm.samplingDate.value + ' ' + frm.samplingTime.value);
    712764  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);
    716767 
    717768  var nofTubes = frm.nofTubes.value;
     
    725776    frm.elements['row'+i].disabled = true;
    726777    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;
    730778    frm.elements['operatorComment'+i].disabled = true;
    731779   
     
    733781    if (frm.elements['row'+i].value != '') specimenTube.row = frm.elements['row'+i].value;
    734782    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;
    740786   
    741787    caseInfo.specimen[i] = specimenTube;
     
    862908      <td class="help"><span id="arrivalDate.message" class="message" style="display:none"></span>Date when the specimen tubes arrived(YYYYMMDD or MMDD).</td>
    863909    </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>
    871910    <tr>
    872911      <td class="prompt">PAD</td>
     
    884923          onkeypress="focusOnEnter(event, 'rnaLaterDate')" onblur="samplingDateTimeOnChange()"></td>
    885924      <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>
    887926    </tr>
    888927    <tr id="rnaLaterDateSection" valign="top">
     
    893932          onblur="rnaLaterDateTimeOnChange()"></td>
    894933      <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>
    896935    </tr>
    897936    <tr>
     
    906945    </tr>
    907946    <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>
    913981    </tr>
    914982    </table>
Note: See TracChangeset for help on using the changeset viewer.