Changeset 1600


Ignore:
Timestamp:
Apr 16, 2012, 11:18:48 AM (11 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #374: Store operation date on case items

Renamed SamplingDateTimeCase to SamplingDateCase and changed it's type to only store date values. Existing annotation values are not modified and should be moved to the new annotation type with a batch importer. The old annotation type can then be deleted.

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

Legend:

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

    r1597 r1600  
    345345 
    346346  var samplingDate = frm.samplingDate.value;
    347   var samplingTime = frm.samplingTime.value;
     347  var samplingTime = frm.samplingTime.disabled ? null : frm.samplingTime.value;
    348348 
    349349  if (samplingDate != '' || samplingTime != '')
     
    353353    frm.samplingDate.value = samplingDate;
    354354
    355     samplingTime = autoFillTime(samplingTime);
    356     frm.samplingTime.value = samplingTime;
     355    if (!frm.samplingTime.disabled)
     356    {
     357      samplingTime = autoFillTime(samplingTime);
     358      frm.samplingTime.value = samplingTime;
     359    }
    357360   
    358361    if (!Dates.isDate(samplingDate, 'yyyyMMdd'))
     
    363366    if (frm.rnaLaterDate.value == '') frm.rnaLaterDate.value = samplingDate;
    364367   
    365     if (!Dates.isDate(samplingDate + ' ' + samplingTime, 'yyyyMMdd HHmm'))
    366     {
    367       if (samplingDate != '') setInputStatus('samplingDate', 'Not a valid time', 'invalid');
    368       return;
     368    if (!frm.samplingTime.disabled)
     369    {
     370      if (!Dates.isDate(samplingDate + ' ' + samplingTime, 'yyyyMMdd HHmm'))
     371      {
     372        if (samplingDate != '') setInputStatus('samplingDate', 'Not a valid time', 'invalid');
     373        return;
     374      }
    369375    }
    370376    setInputStatus('samplingDate', '', 'valid');
     
    408414  rnaLaterDateIsValid = true;
    409415
    410   if (samplingDateIsValid && rnaLaterTimestamp)
     416  if (samplingDateIsValid && rnaLaterTimestamp && !frm.samplingTime.disabled)
    411417  {
    412418    var samplingTimestamp = Dates.parseString(frm.samplingDate.value + ' ' + frm.samplingTime.value, 'yyyyMMdd Hmm');
     
    623629    }
    624630   
     631    // Hide & disable 'Sampling time' field
     632    Main.hide('samplingTimeField');
     633    frm.samplingTime.disabled = true;
    625634   
    626635    // Hide 'RNA Later date' field
     
    632641  {
    633642    frm.samplingDate.value = thisCaseSamplingDate.substring(0, 8);
    634     frm.samplingTime.value = thisCaseSamplingDate.substring(9, 13);
     643    if (!frm.samplingTime.disabled)
     644    {
     645      frm.samplingTime.value = thisCaseSamplingDate.substring(9, 13);
     646    }
    635647    samplingDateTimeOnChange();
    636648  }
     
    812824  caseInfo.reasonIfNoSpecimen = frm.reasonIfNoSpecimen.value;
    813825  caseInfo.pad = frm.pad.value;
    814   caseInfo.samplingDate = Main.trimString(frm.samplingDate.value + ' ' + frm.samplingTime.value);
     826  if (frm.samplingTime.disabled)
     827  {
     828    // No time part if no specimen has been received
     829    caseInfo.samplingDate = Main.trimString(frm.samplingDate.value);
     830  }
     831  else
     832  {
     833    caseInfo.samplingDate = Main.trimString(frm.samplingDate.value + ' ' + frm.samplingTime.value);
     834  }
    815835  caseInfo.rnaLaterDate = Main.trimString(frm.rnaLaterDate.value + ' ' + frm.rnaLaterTime.value);
    816836  if (frm.copyConsent.checked && frm.copyConsent.value)
     
    10671087        <td class="subprompt">Sampling date</td>
    10681088        <td class="input"><input type="text" name="samplingDate" value="" size="12" maxlength="10"
    1069             onkeypress="focusOnEnter(event, 'samplingTime')" onblur="samplingDateTimeOnChange()">
    1070           Time <input type="text" name="samplingTime" value="" size="6" maxlength="5"
    1071             onkeypress="focusOnEnter(event, caseInfo.specimen && caseInfo.specimen.length > 0 ? 'rnaLaterDate' : 'reasonIfNoSpecimen')" onblur="samplingDateTimeOnChange()"></td>
     1089            onkeypress="focusOnEnter(event, caseInfo.specimen && caseInfo.specimen.length > 0 ? 'samplingTime' : 'reasonIfNoSpecimen')" onblur="samplingDateTimeOnChange()">
     1090          <span id="samplingTimeField">Time <input type="text" name="samplingTime" value="" size="6" maxlength="5"
     1091            onkeypress="focusOnEnter(event, caseInfo.specimen && caseInfo.specimen.length > 0 ? 'rnaLaterDate' : 'reasonIfNoSpecimen')" onblur="samplingDateTimeOnChange()"></span>
     1092        </td>
    10721093        <td class="status" id="samplingDate.status"></td>
    1073         <td class="help"><span id="samplingDate.message" class="message" style="display: none;"></span>Date+time of surgical removal (YYYYMMDD, HHMM)</td>
     1094        <td class="help"><span id="samplingDate.message" class="message" style="display: none;"></span>Date (+time) of surgical removal (YYYYMMDD, HHMM)</td>
    10741095      </tr>
    10751096      <tr id="rnaLaterDateSection" valign="top">
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/Reggie.java

    r1598 r1600  
    114114
    115115  /**
    116     The name of the "SamplingDateTimeCase" annotation type, used
    117     for samples (Case). It is a multi-valued timestamp annotation.
    118     @since 2.4
    119   */
    120   public static final String ANNOTATION_SAMPLING_DATETIME_CASE = "SamplingDateTimeCase";
    121  
     116    The name of the "SamplingDateCase" annotation type, used
     117    for samples (Case). The value is basically a copy of the
     118    date part of the {@link #ANNOTATION_SAMPLING_DATETIME}
     119    annotation, but also allow registration of a date when
     120    no specimen has been received. It is a multi-valued date annotation.
     121    @since 2.4
     122  */
     123  public static final String ANNOTATION_SAMPLING_DATE_CASE = "SamplingDateCase";
    122124 
    123125  /**
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/InstallServlet.java

    r1597 r1600  
    173173        jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_SAMPLING_DATETIME, Item.SAMPLE, Type.TIMESTAMP, 1,
    174174            null, effectiveOptions, createIfMissing));
    175         jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_SAMPLING_DATETIME_CASE, Item.SAMPLE, Type.TIMESTAMP, 0,
     175        jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_SAMPLING_DATE_CASE, Item.SAMPLE, Type.DATE, 0,
    176176            null, effectiveOptions, createIfMissing));
    177177        jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_RNALATER_DATETIME, Item.SAMPLE, Type.TIMESTAMP, 1,
     
    221221        jsonChecks.add(checkAnnotationTypeCategory(dc, Subtype.CASE, createIfMissing,
    222222            Reggie.ANNOTATION_CONSENT, Reggie.ANNOTATION_CONSENT_DATE,
    223             Reggie.ANNOTATION_LATERALITY, Reggie.ANNOTATION_SAMPLING_DATETIME_CASE,
     223            Reggie.ANNOTATION_LATERALITY, Reggie.ANNOTATION_SAMPLING_DATE_CASE,
    224224            Reggie.ANNOTATION_PAD_CASE, Reggie.ANNOTATION_REASON_IF_NO_SPECIMEN));
    225225       
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/PersonalRegistrationServlet.java

    r1597 r1600  
    100100          theCase.loadAnnotations(dc, "laterality", Reggie.ANNOTATION_LATERALITY, null);
    101101          theCase.loadAnnotations(dc, "pad", Reggie.ANNOTATION_PAD_CASE, null);
    102           theCase.loadAnnotations(dc, "samplingDate", Reggie.ANNOTATION_SAMPLING_DATETIME_CASE, Reggie.CONVERTER_DATETIME_TO_STRING);
     102          theCase.loadAnnotations(dc, "samplingDate", Reggie.ANNOTATION_SAMPLING_DATE_CASE, Reggie.CONVERTER_DATE_TO_STRING);
    103103          theCase.loadAnnotations(dc, "reasonIfNoSpecimen", Reggie.ANNOTATION_REASON_IF_NO_SPECIMEN, null);
    104104
     
    343343       
    344344        // Sampling date on Case
    345         AnnotationType samplingDateCaseType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_SAMPLING_DATETIME_CASE, true);
    346         Date samplingDate = Reggie.CONVERTER_STRING_TO_DATETIME.convert((String)jsonCase.get("samplingDate"));
     345        AnnotationType samplingDateCaseType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_SAMPLING_DATE_CASE, true);
     346        Date samplingDate = Reggie.CONVERTER_STRING_TO_DATE.convert((String)jsonCase.get("samplingDate"));
    347347        if (samplingDate != null)
    348348        {
     
    353353        {
    354354          AnnotationType padType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_PAD, true);
    355           AnnotationType samplingDateType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_SAMPLING_DATETIME, true);
     355          AnnotationType samplingDateTimeType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_SAMPLING_DATETIME, true);
    356356          AnnotationType rnaLaterType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_RNALATER_DATETIME, true);
    357           Date rnaLaterDate = Reggie.CONVERTER_STRING_TO_DATETIME.convert((String)jsonCase.get("rnaLaterDate"));
     357          Date samplingDateTime = Reggie.CONVERTER_STRING_TO_DATETIME.convert((String)jsonCase.get("samplingDate"));
     358          Date rnaLaterDateTime = Reggie.CONVERTER_STRING_TO_DATETIME.convert((String)jsonCase.get("rnaLaterDate"));
    358359
    359360          for (int i = 0; i < jsonSpecimen.size(); ++i)
     
    370371            if (laterality != null) Reggie.setAnnotationValue(specimen, lateralityType, laterality);
    371372            Reggie.setAnnotationValue(specimen, padType, pad);
    372             if (samplingDate != null) Reggie.setAnnotationValue(specimen, samplingDateType, samplingDate);
    373             if (rnaLaterDate != null) Reggie.setAnnotationValue(specimen, rnaLaterType, rnaLaterDate);
     373            if (samplingDateTime != null) Reggie.setAnnotationValue(specimen, samplingDateTimeType, samplingDateTime);
     374            if (rnaLaterDateTime != null) Reggie.setAnnotationValue(specimen, rnaLaterType, rnaLaterDateTime);
    374375           
    375376          }
     
    420421
    421422        // Sampling date on Case
    422         AnnotationType samplingDateCaseType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_SAMPLING_DATETIME_CASE, true);
    423         Date samplingDate = Reggie.CONVERTER_STRING_TO_DATETIME.convert((String)jsonCase.get("samplingDate"));
    424         Date oldSamplingDate = Reggie.CONVERTER_STRING_TO_DATETIME.convert((String)jsonCase.get("oldSamplingDate"));
     423        AnnotationType samplingDateCaseType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_SAMPLING_DATE_CASE, true);
     424        Date samplingDate = Reggie.CONVERTER_STRING_TO_DATE.convert((String)jsonCase.get("samplingDate"));
     425        Date oldSamplingDate = Reggie.CONVERTER_STRING_TO_DATE.convert((String)jsonCase.get("oldSamplingDate"));
    425426        if (oldSamplingDate != null)
    426427        {
     
    441442          AnnotationType rnaLaterType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_RNALATER_DATETIME, true);
    442443         
    443           Date rnaLaterDate = Reggie.CONVERTER_STRING_TO_DATETIME.convert((String)jsonCase.get("rnaLaterDate"));
     444          Date samplingDateTime = Reggie.CONVERTER_STRING_TO_DATETIME.convert((String)jsonCase.get("samplingDate"));
     445          Date rnaLaterDateTime = Reggie.CONVERTER_STRING_TO_DATETIME.convert((String)jsonCase.get("rnaLaterDate"));
    444446         
    445447          for (int i = 0; i < jsonSpecimen.size(); ++i)
     
    453455            if (updateLaterality) Reggie.setAnnotationValue(specimen, lateralityType, laterality);
    454456            Reggie.setAnnotationValue(specimen, padType, pad);
    455             if (samplingDate != null) Reggie.setAnnotationValue(specimen, samplingDateType, samplingDate);
    456             if (rnaLaterDate != null) Reggie.setAnnotationValue(specimen, rnaLaterType, rnaLaterDate);
     457            if (samplingDateTime != null) Reggie.setAnnotationValue(specimen, samplingDateType, samplingDateTime);
     458            if (rnaLaterDateTime != null) Reggie.setAnnotationValue(specimen, rnaLaterType, rnaLaterDateTime);
    457459           
    458460          }
Note: See TracChangeset for help on using the changeset viewer.