Changeset 1608


Ignore:
Timestamp:
Apr 20, 2012, 9:57:46 AM (11 years ago)
Author:
Nicklas Nordborg
Message:

References #379: Create "virtual" samples for cases when no specimen is received

I think this should work now, though I have probably not tested every possible scenario with respect to which order the various forms are registered.

In any case, when updating to this version it is important to complete this procedure before registering new cases or specimen tubes:

  1. Update to Reggie 2.5
  2. Create 'NoSpecimen?' items for all relevant cases. This step is best done with batch importer, but some exotic cases may need to be done manually (for example, if there are multiple no-specimen for a case). The following annotations should be copied from the 'Case' to the new 'NoSpecimen?' items:
    • ReasonIfNoSpecimen (without the [nnnnn] prefix)
    • PAD (copied from PADCase)
    • SamplingDateTime (copied from SamplingDate)
  3. Remove the unused annotations from the 'Case' item. The last two are no longer needed and can then be completely deleted.
    • ReasonIfNoSpecimen
    • PADCase
    • SamplingDate
  4. Done. It should now be possible to register new cases and specimen tubes again.
Location:
extensions/net.sf.basedb.reggie/trunk
Files:
1 added
6 edited

Legend:

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

    r1600 r1608  
    609609  else
    610610  {
    611     // No specimen tubes... if there is only one PAD on the case... use that
    612     if (caseInfo.pad && caseInfo.pad.length == 1)
    613     {
    614       hasPAD = true;
    615       thisCasePAD = caseInfo.pad[0];
    616     }
    617     if (caseInfo.samplingDate)
    618     {
    619       if (caseInfo.samplingDate.length == 1)
    620       {
    621         thisCaseSamplingDate = caseInfo.samplingDate[0];
    622       }
    623       else
    624       {
    625         frm.samplingDate.disabled = true;
    626         frm.samplingTime.disabled = true;
    627         setInputStatus('samplingDate', 'Multiple dates have already been registered for this case.', 'warning');
    628       }
     611    if (caseInfo.noSpecimen)
     612    {
     613      // This case is registered with 'NoSpecimen'
     614      thisCasePAD = caseInfo.noSpecimen.pad;
     615      thisCaseSamplingDate = caseInfo.noSpecimen.samplingDate;
     616      frm.reasonIfNoSpecimen.value = caseInfo.noSpecimen.reasonIfNoSpecimen;
    629617    }
    630618   
     
    653641    rnaLaterDateTimeOnChange();
    654642  }
    655 
    656643 
    657644  frm.pad.value = thisCasePAD;
    658   caseInfo.oldPad = thisCasePAD;
    659   caseInfo.oldSamplingDate = thisCaseSamplingDate;
    660  
    661   if (updateMode && !hasSpecimen)
    662   {
    663     // Try to find 'reasonIfNoSpecimen' annotation on the case
    664     for (var i = 0; i < caseInfo.reasonIfNoSpecimen.length; i++)
    665     {
    666       var rns = caseInfo.reasonIfNoSpecimen[i];
    667       if (rns.indexOf('['+caseInfo.originalName+']') == 0)
    668       {
    669         caseInfo.oldReasonIfNoSpecimen = rns;
    670         frm.reasonIfNoSpecimen.value = rns.substring(rns.indexOf(']')+2);
    671         i = 999;
    672       }
    673     }
    674   }
    675645 
    676646  Main.show('caseSection');
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/Reggie.java

    r1606 r1608  
    8585  /**
    8686    The name of the "ReasonIfNoSpecimen" annotation type, used
    87     for samples (Case). It is a multi-valued string annotation.
     87    for samples (NoSpecimen). It is a string annotation.
    8888  */
    8989  public static final String ANNOTATION_REASON_IF_NO_SPECIMEN = "ReasonIfNoSpecimen";
    90 
     90 
    9191  /**
    9292    The name of the "PAD" annotation type, used
     
    9696
    9797  /**
    98     The name of the "PADcase" annotation type, used
    99     for samples (Case). It is a multi-valued string annotation.
    100   */
    101   public static final String ANNOTATION_PAD_CASE = "PADcase";
    102  
    103   /**
    10498    The name of the "PathNote" annotation type,
    10599    used for samples (Case). It is a string annotation type.
     
    114108
    115109  /**
    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";
    124  
    125   /**
    126110    The name of the "RNALaterDateTime" annotation type, used
    127111    for samples (Specimen tube). It is a timestamp annotation.
    128112  */
    129113  public static final String ANNOTATION_RNALATER_DATETIME = "RNALaterDateTime";
    130 
    131114 
    132115  /**
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/Case.java

    r1503 r1608  
    1515import net.sf.basedb.core.Sample;
    1616import net.sf.basedb.core.Type;
    17 import net.sf.basedb.core.query.Annotations;
    1817import net.sf.basedb.core.query.Expressions;
    1918import net.sf.basedb.core.query.Hql;
     
    3635    on the name of a sample. If exactly one match is found this is the
    3736    (primary) case. More than one match is an error condition. If no
    38     match is found, we look harder by trying to find a case with
    39     specimen tubes that have names matching the case we are looking
     37    match is found, we look harder by trying to find a child sample with
     38    'Specimen' or 'NoSpecimen' that have names matching the case we are looking
    4039    for (eg. xxx.1, xxx.2, etc.). If exactly one match is found this is
    4140    the (merged) case. More than one match is an error condition. No match
     
    6463    {
    6564      // Not found... see if we can find a different case
    66       // with specimen tubes belonging to this case (merged case)
     65      // with 'Specimen'/'NoSpecimen' child items belonging to this case (merged case)
    6766      merged = true;
    6867      caseQuery = Sample.getQuery();
     
    7170      caseQuery.join(Hql.innerJoin("cce", "event", "evt"));
    7271      caseQuery.join(Hql.innerJoin("evt", "bioMaterial", "sp")); // 'sp' should now reference a specimen tube
    73       Subtype.SPECIMEN.addFilter(dc, caseQuery, "sp");
     72     
     73      // Restrict to 'Specimen' or 'NoSpecimen' child items
     74      caseQuery.restrict(Restrictions.or(Subtype.SPECIMEN.restriction(dc, "sp"), Subtype.NO_SPECIMEN.restriction(dc, "sp")));
    7475      caseQuery.restrict(Restrictions.like(Hql.property("sp", "name"), Expressions.parameter("name", name + ".%", Type.STRING)));
    7576      caseQuery.setDistinct(true);
     
    8687      }
    8788     
    88       if (cases.size() == 0)
    89       {
    90         // Still not found... last chance is to find a (merged) case with ReasonIfNoSpecimen comment
    91         // that has [caseName] as prefix...
    92         AnnotationType reasonIfNoSpecimenType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_REASON_IF_NO_SPECIMEN, true);
    93         caseQuery = Sample.getQuery();
    94         Subtype.CASE.addFilter(dc, caseQuery);
    95         caseQuery.restrict(Annotations.like(null, reasonIfNoSpecimenType, "[" + name + "]%", false));
    96         cases = caseQuery.list(dc);
    97        
    98        
    99         if (cases.size() > 1)
    100         {
    101           // ...something is very incorrectly registered...
    102           // we different cases with comments for this case
    103           throw new InvalidDataException(
    104             "Found " + cases.size() + " cases with ReasonIfNoSpecimen comments " +
    105             "for this case (" + name + "). This wizard can't be used until that is corrected.");
    106         }
    107        
    108       }
    109      
    11089    }
    11190
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/Subtype.java

    r1544 r1608  
    6161  */
    6262  public static final Subtype SPECIMEN = new Subtype("Specimen", Item.SAMPLE);
     63
     64  /**
     65    The definition of the "NoSpecimen" subtype (for cases when no specimen has been received).
     66    @since 2.5
     67  */
     68  public static final Subtype NO_SPECIMEN = new Subtype("NoSpecimen", Item.SAMPLE);
     69
    6370 
    6471  /**
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/InstallServlet.java

    r1606 r1608  
    124124        jsonChecks.add(checkSubtype(dc, Subtype.BLOOD, createIfMissing, Subtype.PATIENT));
    125125        jsonChecks.add(checkSubtype(dc, Subtype.SPECIMEN,createIfMissing, Subtype.CASE));
     126        jsonChecks.add(checkSubtype(dc, Subtype.NO_SPECIMEN,createIfMissing, Subtype.CASE));
    126127        jsonChecks.add(checkSubtype(dc, Subtype.HISTOLOGY, createIfMissing, Subtype.SPECIMEN));
    127128        jsonChecks.add(checkSubtype(dc, Subtype.LYSATE, createIfMissing, Subtype.SPECIMEN));
     
    169170        jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_LATERALITY, Item.SAMPLE, Type.STRING, 1,
    170171            new EnumerationOptions("LEFT", "RIGHT"), effectiveOptions, createIfMissing));
    171         jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_REASON_IF_NO_SPECIMEN, Item.SAMPLE, Type.STRING, 0,
     172        jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_REASON_IF_NO_SPECIMEN, Item.SAMPLE, Type.STRING, 1,
    172173            null, effectiveOptions, createIfMissing));
    173174        jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_PAD, Item.SAMPLE, Type.STRING, 1,
    174175            null, effectiveOptions, createIfMissing));
     176        /*
     177        TODO - remove
    175178        jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_PAD_CASE, Item.SAMPLE, Type.STRING, 0,
    176179            null, effectiveOptions, createIfMissing));
     180        */
     181       
    177182        jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_BLOOD_SAMPLING_DATETIME, Item.SAMPLE, Type.TIMESTAMP, 1,
    178183            null, effectiveOptions, createIfMissing));
     
    183188        jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_SAMPLING_DATETIME, Item.SAMPLE, Type.TIMESTAMP, 1,
    184189            null, effectiveOptions, createIfMissing));
     190        /*
     191        TODO - remove
    185192        jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_SAMPLING_DATE_CASE, Item.SAMPLE, Type.DATE, 0,
    186193            null, effectiveOptions, createIfMissing));
     194        */
     195       
    187196        jsonChecks.add(checkAnnotationType(dc, Reggie.ANNOTATION_RNALATER_DATETIME, Item.SAMPLE, Type.TIMESTAMP, 1,
    188197            null, effectiveOptions, createIfMissing));
     
    231240        jsonChecks.add(checkAnnotationTypeCategory(dc, Subtype.CASE, createIfMissing,
    232241            Reggie.ANNOTATION_CONSENT, Reggie.ANNOTATION_CONSENT_DATE,
    233             Reggie.ANNOTATION_LATERALITY, Reggie.ANNOTATION_SAMPLING_DATE_CASE,
    234             Reggie.ANNOTATION_PAD_CASE, Reggie.ANNOTATION_REASON_IF_NO_SPECIMEN));
     242            Reggie.ANNOTATION_LATERALITY));
    235243       
    236244        jsonChecks.add(checkAnnotationTypeCategory(dc, Subtype.BLOOD, createIfMissing,
     
    246254            Reggie.ANNOTATION_PAD, Reggie.ANNOTATION_RNALATER_DATETIME,
    247255            Reggie.ANNOTATION_SAMPLING_DATETIME, Reggie.ANNOTATION_SPECIMEN_TYPE));
     256       
     257        jsonChecks.add(checkAnnotationTypeCategory(dc, Subtype.NO_SPECIMEN, createIfMissing,
     258            Reggie.ANNOTATION_PAD, Reggie.ANNOTATION_REASON_IF_NO_SPECIMEN,
     259            Reggie.ANNOTATION_SAMPLING_DATETIME
     260            ));
     261       
    248262        jsonChecks.add(checkAnnotationTypeCategory(dc, Subtype.LYSATE, createIfMissing,
    249263            Reggie.ANNOTATION_PARTITION_DATE));
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/PersonalRegistrationServlet.java

    r1600 r1608  
    2121import net.sf.basedb.core.BioSource;
    2222import net.sf.basedb.core.DbControl;
     23import net.sf.basedb.core.InvalidDataException;
    2324import net.sf.basedb.core.Item;
    2425import net.sf.basedb.core.Sample;
     
    2829import net.sf.basedb.reggie.dao.Case;
    2930import net.sf.basedb.reggie.dao.Consent;
     31import net.sf.basedb.reggie.dao.NoSpecimen;
    3032import net.sf.basedb.reggie.dao.Patient;
    3133import net.sf.basedb.reggie.dao.SpecimenTube;
     
    8082       
    8183        List<SpecimenTube> specimenTubes = null;
     84        NoSpecimen noSpecimen = null;
    8285        JSONObject jsonCase = null;
    8386        JSONObject jsonBlood = null;
     
    9598            specimenTubes = SpecimenTube.findByCaseName(dc, caseName);
    9699          }
     100         
     101          if (specimenTubes.size() == 0)
     102          {
     103            // Still not found -- check if there are any 'NoSpecimen' items
     104            List<NoSpecimen> nsList = NoSpecimen.findByCase(dc, theCase, true);
     105            if (nsList.size() > 1)
     106            {
     107              // There should be at most one 'NoSpecimen' item
     108              throw new InvalidDataException(
     109                "Found " + nsList.size() + " 'NoSpecimen' samples for the case (" + caseName +
     110                "). This wizard can't be used until that is corrected.");
     111            }
     112            else if (nsList.size() == 1)
     113            {
     114              noSpecimen = nsList.get(0);
     115            }
     116          }
    97117
    98118          // Continue to load some more info (annotations, etc...)
    99119          // ... case annotations
    100120          theCase.loadAnnotations(dc, "laterality", Reggie.ANNOTATION_LATERALITY, null);
     121          /*
     122          TODO - remove
    101123          theCase.loadAnnotations(dc, "pad", Reggie.ANNOTATION_PAD_CASE, null);
    102124          theCase.loadAnnotations(dc, "samplingDate", Reggie.ANNOTATION_SAMPLING_DATE_CASE, Reggie.CONVERTER_DATE_TO_STRING);
    103125          theCase.loadAnnotations(dc, "reasonIfNoSpecimen", Reggie.ANNOTATION_REASON_IF_NO_SPECIMEN, null);
     126          */
    104127
    105128          // Wrap what we have so far up into JSON objects
     
    142165        }
    143166       
    144         // Load specimen tube annotations
     167        // Load 'Specimen'/'NoSpecimen' annotations
    145168        JSONArray jsonTubes = new JSONArray();
     169        AnnotationType padType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_PAD, true);
     170        AnnotationType samplingDateType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_SAMPLING_DATETIME, true);
    146171        if (specimenTubes.size() > 0)
    147172        {
    148           AnnotationType padType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_PAD, true);
    149173          AnnotationType lateralityType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_LATERALITY, true);
    150           AnnotationType samplingDateType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_SAMPLING_DATETIME, true);
    151174          AnnotationType rnaLaterDateType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_RNALATER_DATETIME, true);
    152175          for (SpecimenTube tube : specimenTubes)
     
    160183        }
    161184        jsonCase.put("specimen", jsonTubes);
     185       
     186        if (noSpecimen != null)
     187        {
     188          noSpecimen.loadAnnotations("pad", padType, null);
     189          noSpecimen.loadAnnotations("samplingDate", samplingDateType, Reggie.CONVERTER_DATE_TO_STRING);
     190          noSpecimen.loadAnnotations(dc, "reasonIfNoSpecimen", Reggie.ANNOTATION_REASON_IF_NO_SPECIMEN, null);
     191          jsonCase.put("noSpecimen", noSpecimen.asJSONObject());
     192        }
    162193       
    163194        // This is what we send back to the browser
     
    337368        AnnotationSet caseAnnotations = theCase.getAnnotationSet();
    338369        JSONArray jsonSpecimen = (JSONArray)jsonCase.get("specimen");
    339         // PAD value
    340         AnnotationType padCaseType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_PAD_CASE, true);
     370       
     371        // Annotations that are always used
     372        AnnotationType padType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_PAD, true);
     373        AnnotationType samplingDateTimeType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_SAMPLING_DATETIME, true);
     374       
    341375        String pad = Values.getStringOrNull((String)jsonCase.get("pad"));
    342         if (pad != null) Reggie.appendAnnotationValueIfUnique(theCase, padCaseType, pad);
    343        
    344         // Sampling date on Case
    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"));
    347         if (samplingDate != null)
    348         {
    349           Reggie.appendAnnotationValueIfUnique(theCase, samplingDateCaseType, samplingDate);
    350         }
    351376       
    352377        if (jsonSpecimen != null && jsonSpecimen.size() > 0)
    353378        {
    354           AnnotationType padType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_PAD, true);
    355           AnnotationType samplingDateTimeType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_SAMPLING_DATETIME, true);
    356379          AnnotationType rnaLaterType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_RNALATER_DATETIME, true);
     380          Date rnaLaterDateTime = Reggie.CONVERTER_STRING_TO_DATETIME.convert((String)jsonCase.get("rnaLaterDate"));
    357381          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"));
    359382
    360383          for (int i = 0; i < jsonSpecimen.size(); ++i)
     
    366389            creationEvent.setSource(theCase);
    367390            // !IMPORTANT - The sampling date must be set here and as an 'SamplingDateTime' annotation
    368             creationEvent.setEventDate(samplingDate);
     391            creationEvent.setEventDate(samplingDateTime);
    369392           
    370393            // Update the specimen annotations
     
    379402        else
    380403        {
     404          Date samplingDate = Reggie.CONVERTER_STRING_TO_DATE.convert((String)jsonCase.get("samplingDate"));
     405
     406          // Create new 'NoSpecimen' item
     407          Sample noSpecimen = Sample.getNew(dc);
     408          dc.saveItem(noSpecimen);
     409          noSpecimen.setItemSubtype(Subtype.NO_SPECIMEN.load(dc));
     410          noSpecimen.setName(originalCaseName+".1");
     411          BioMaterialEvent creationEvent = noSpecimen.getCreationEvent();
     412          creationEvent.setSource(theCase);
     413          creationEvent.setEventDate(samplingDate);
     414         
    381415          AnnotationType reasonIfNoSpecimenType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_REASON_IF_NO_SPECIMEN, true);
    382           Reggie.appendAnnotationValueIfUnique(theCase, reasonIfNoSpecimenType, "[" + originalCaseName + "] " + jsonCase.get("reasonIfNoSpecimen"));
     416          Reggie.setAnnotationValue(noSpecimen, padType, pad);
     417          Reggie.setAnnotationValue(noSpecimen, reasonIfNoSpecimenType, jsonCase.get("reasonIfNoSpecimen"));
     418          if (samplingDate != null) Reggie.setAnnotationValue(noSpecimen, samplingDateTimeType, samplingDate);
     419         
     420          jsonMessages.add("Virtual specimen '" + noSpecimen.getName() + "' created successfully.");
    383421        }
    384422       
     
    406444        boolean updateLaterality = Values.getInt(laterality, -1) == -1;
    407445        String pad = Values.getStringOrNull((String)jsonCase.get("pad"));
    408         String oldPad = Values.getStringOrNull((String)jsonCase.get("oldPad"));
    409446        JSONArray jsonSpecimen = (JSONArray)jsonCase.get("specimen");
     447        JSONObject jsonNoSpecimen = (JSONObject)jsonCase.get("noSpecimen");
    410448     
    411449        // Update laterality and PAD for the case
    412450        AnnotationType lateralityType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_LATERALITY, true);
    413         AnnotationType padCaseType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_PAD_CASE, true);
    414451        if (updateLaterality)
    415452        {
    416453          Reggie.setAnnotationValue(theCase, lateralityType, laterality);
    417454        }
    418 
    419         if (oldPad != null) Reggie.removeAnnotationValue(theCase, padCaseType, oldPad);
    420         if (pad != null) Reggie.appendAnnotationValueIfUnique(theCase, padCaseType, pad);
    421 
    422         // Sampling date on Case
    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"));
    426         if (oldSamplingDate != null)
    427         {
    428           Reggie.removeAnnotationValue(theCase, samplingDateCaseType, oldSamplingDate);
    429         }
    430         if (samplingDate != null)
    431         {
    432           Reggie.appendAnnotationValueIfUnique(theCase, samplingDateCaseType, samplingDate);
    433         }
    434        
     455     
    435456        jsonMessages.add("Case '" + originalCaseName + "' updated successfully.");
    436457       
     
    450471            Sample specimen = Sample.getById(dc, ((Number)jsonSpec.get("id")).intValue());
    451472            // !IMPORTANT - The sampling date must be set here and as an 'SamplingDateTime' annotation
    452             specimen.getCreationEvent().setEventDate(samplingDate);
     473            specimen.getCreationEvent().setEventDate(samplingDateTime);
    453474           
    454475            // Update the specimen annotations
     
    462483
    463484        }
    464         else
    465         {
    466           // No specimen tubes...update the 'reasonIfNoSpecimen' annotation
     485        else if (jsonNoSpecimen != null)
     486        {
     487          // Update the 'NoSpecimen' item
     488          AnnotationType padType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_PAD, true);
     489          AnnotationType samplingDateType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_SAMPLING_DATETIME, true);
    467490          AnnotationType reasonIfNoSpecimenType = Reggie.findAnnotationType(dc, Item.SAMPLE, Reggie.ANNOTATION_REASON_IF_NO_SPECIMEN, true);
    468          
    469           String rns = Values.getString((String)jsonCase.get("reasonIfNoSpecimen"));
    470           String oldRns = Values.getString((String)jsonCase.get("oldReasonIfNoSpecimen"));
    471           if (oldRns != null)
    472           {
    473             Reggie.removeAnnotationValue(theCase, reasonIfNoSpecimenType, oldRns);
    474           }
    475           if (rns != null)
    476           {
    477             Reggie.appendAnnotationValueIfUnique(theCase, reasonIfNoSpecimenType, "[" + originalCaseName + "] " + rns);
    478           }
    479          
     491
     492          Date samplingDate = Reggie.CONVERTER_STRING_TO_DATE.convert((String)jsonCase.get("samplingDate"));
     493
     494          Sample noSpecimen = Sample.getById(dc, ((Number)jsonNoSpecimen.get("id")).intValue());
     495          noSpecimen.getCreationEvent().setEventDate(samplingDate);
     496
     497          Reggie.setAnnotationValue(noSpecimen, padType, pad);
     498          Reggie.setAnnotationValue(noSpecimen, samplingDateType, samplingDate);
     499          Reggie.setAnnotationValue(noSpecimen, reasonIfNoSpecimenType, Values.getString((String)jsonCase.get("reasonIfNoSpecimen")));
    480500        }
    481501       
Note: See TracChangeset for help on using the changeset viewer.