Changeset 1597


Ignore:
Timestamp:
Mar 30, 2012, 11:23:23 AM (11 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #374: Store operation date on case items

Added SamplingDateTimeCase annotation type that can hold multiple values.

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

Legend:

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

    r1592 r1597  
    596596      thisCaseLaterality = null;
    597597    }
    598 
    599     // Show and populate 'Sampling date' and 'RNA Later date' fields
     598   
    600599    Main.show('samplingDateSection');
    601600    Main.show('rnaLaterDateSection');
    602     if (thisCaseSamplingDate != null)
    603     {
    604       frm.samplingDate.value = thisCaseSamplingDate.substring(0, 8);
    605       frm.samplingTime.value = thisCaseSamplingDate.substring(9, 13);
    606       samplingDateTimeOnChange();
    607     }
    608     if (thisCaseRNALaterDate != null)
    609     {
    610       frm.rnaLaterDate.value = thisCaseRNALaterDate.substring(0, 8);
    611       frm.rnaLaterTime.value = thisCaseRNALaterDate.substring(9, 13);
    612       rnaLaterDateTimeOnChange();
    613     }
     601
    614602  }
    615603  else
     
    621609      thisCasePAD = caseInfo.pad[0];
    622610    }
     611    if (caseInfo.samplingDate)
     612    {
     613      if (caseInfo.samplingDate.length == 1)
     614      {
     615        thisCaseSamplingDate = caseInfo.samplingDate[0];
     616      }
     617      else
     618      {
     619        frm.samplingDate.disabled = true;
     620        frm.samplingTime.disabled = true;
     621        setInputStatus('samplingDate', 'Multiple dates have already been registered for this case.', 'warning');
     622      }
     623    }
     624   
    623625   
    624626    // Hide 'RNA Later date' field
     
    626628  }
    627629
     630  // Populate 'Sampling date' and 'RNA Later date' fields
     631  if (thisCaseSamplingDate != null)
     632  {
     633    frm.samplingDate.value = thisCaseSamplingDate.substring(0, 8);
     634    frm.samplingTime.value = thisCaseSamplingDate.substring(9, 13);
     635    samplingDateTimeOnChange();
     636  }
     637  if (thisCaseRNALaterDate != null)
     638  {
     639    frm.rnaLaterDate.value = thisCaseRNALaterDate.substring(0, 8);
     640    frm.rnaLaterTime.value = thisCaseRNALaterDate.substring(9, 13);
     641    rnaLaterDateTimeOnChange();
     642  }
     643
     644 
    628645  frm.pad.value = thisCasePAD;
    629646  caseInfo.oldPad = thisCasePAD;
     647  caseInfo.oldSamplingDate = thisCaseSamplingDate;
    630648 
    631649  if (updateMode && !hasSpecimen)
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/Reggie.java

    r1593 r1597  
    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 
     122 
     123  /**
    116124    The name of the "RNALaterDateTime" annotation type, used
    117125    for samples (Specimen tube). It is a timestamp annotation.
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/InstallServlet.java

    r1592 r1597  
    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,
     176            null, effectiveOptions, createIfMissing));
    175177        jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_RNALATER_DATETIME, Item.SAMPLE, Type.TIMESTAMP, 1,
    176178            null, effectiveOptions, createIfMissing));
     
    219221        jsonChecks.add(checkAnnotationTypeCategory(dc, Subtype.CASE, createIfMissing,
    220222            Reggie.ANNOTATION_CONSENT, Reggie.ANNOTATION_CONSENT_DATE,
    221             Reggie.ANNOTATION_LATERALITY, Reggie.ANNOTATION_SAMPLING_DATETIME,
     223            Reggie.ANNOTATION_LATERALITY, Reggie.ANNOTATION_SAMPLING_DATETIME_CASE,
    222224            Reggie.ANNOTATION_PAD_CASE, Reggie.ANNOTATION_REASON_IF_NO_SPECIMEN));
    223225       
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/PersonalRegistrationServlet.java

    r1595 r1597  
    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);
    102103          theCase.loadAnnotations(dc, "reasonIfNoSpecimen", Reggie.ANNOTATION_REASON_IF_NO_SPECIMEN, null);
    103104
     
    340341        String pad = Values.getStringOrNull((String)jsonCase.get("pad"));
    341342        if (pad != null) Reggie.appendAnnotationValueIfUnique(theCase, padCaseType, pad);
    342         // Sampling date
    343         AnnotationType samplingDateType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_SAMPLING_DATETIME, true);
     343       
     344        // Sampling date on Case
     345        AnnotationType samplingDateCaseType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_SAMPLING_DATETIME_CASE, true);
    344346        Date samplingDate = Reggie.CONVERTER_STRING_TO_DATETIME.convert((String)jsonCase.get("samplingDate"));
    345         if (samplingDate != null) Reggie.setAnnotationValue(theCase, samplingDateType, samplingDate);
     347        if (samplingDate != null)
     348        {
     349          Reggie.appendAnnotationValueIfUnique(theCase, samplingDateCaseType, samplingDate);
     350        }
    346351       
    347352        if (jsonSpecimen != null && jsonSpecimen.size() > 0)
    348353        {
    349354          AnnotationType padType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_PAD, true);
     355          AnnotationType samplingDateType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_SAMPLING_DATETIME, true);
    350356          AnnotationType rnaLaterType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_RNALATER_DATETIME, true);
    351357          Date rnaLaterDate = Reggie.CONVERTER_STRING_TO_DATETIME.convert((String)jsonCase.get("rnaLaterDate"));
     
    413419        if (pad != null) Reggie.appendAnnotationValueIfUnique(theCase, padCaseType, pad);
    414420
    415         // Sampling date
    416         AnnotationType samplingDateType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_SAMPLING_DATETIME, true);
     421        // Sampling date on Case
     422        AnnotationType samplingDateCaseType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_SAMPLING_DATETIME_CASE, true);
    417423        Date samplingDate = Reggie.CONVERTER_STRING_TO_DATETIME.convert((String)jsonCase.get("samplingDate"));
    418         if (samplingDate != null) Reggie.setAnnotationValue(theCase, samplingDateType, samplingDate);
     424        Date oldSamplingDate = Reggie.CONVERTER_STRING_TO_DATETIME.convert((String)jsonCase.get("oldSamplingDate"));
     425        if (oldSamplingDate != null)
     426        {
     427          Reggie.removeAnnotationValue(theCase, samplingDateCaseType, oldSamplingDate);
     428        }
     429        if (samplingDate != null)
     430        {
     431          Reggie.appendAnnotationValueIfUnique(theCase, samplingDateCaseType, samplingDate);
     432        }
    419433       
    420434        jsonMessages.add("Case '" + originalCaseName + "' updated successfully.");
     
    424438        {
    425439          AnnotationType padType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_PAD, true);
     440          AnnotationType samplingDateType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_SAMPLING_DATETIME, true);
    426441          AnnotationType rnaLaterType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_RNALATER_DATETIME, true);
    427442         
Note: See TracChangeset for help on using the changeset viewer.