Changeset 5848


Ignore:
Timestamp:
Mar 2, 2020, 8:45:53 AM (21 months ago)
Author:
olle
Message:

Refs #1029. New wizard for FFPE section (specimen) tumour cell percentage added after FFPE section (specimen) registration wizard. The entered tumour cell percentages will be registered on the stained items coupled to the H&E glass items related to the specimen:

  1. Javascript file index.jsp in resources/ updated in section "Personal information wizards" by adding new wizard "FFPE section (specimen) tumour cell percentage" linked to new JSP file ffpe_section_tumour_cell_pct_alt_rec.jsp in resources/personal/.
  2. JSP file ffpe_section_tumour_cell_pct_alt_rec.jsp in resources/personal/ added. It references new Javascript file ffpe_section_tumour_cell_pct_alt_rec.js.
  3. Javascript file ffpe_section_tumour_cell_pct_alt_rec.js in resources/personal/ added. It allows an unprocessed FFPE section (specimen) to be selected, and tumour cell percentages for H&E glass stained items to be entered. At registration, servlet BaseLineRegistrationServlet is called with new post command "RegisterFFPESectionTumourCellPct".
  4. Data access object class/file Histology.java in src/net/sf/basedb/meludi/dao/ updated with new public static method List<Histology> findByName(DbControl dc, String name). It returns histology samples with a specific name.
  5. Java servlet class/file BaseLineRegistrationServlet.java in src/net/sf/basedb/meludi/servlet/ updated in protected method void doPost(HttpServletRequest req, HttpServletResponse resp) with new command "RegisterFFPESectionTumourCellPct". It registers the input tumour cell percentages on Stain items coupled to F and E H&E glass items for the FFPE section.
  6. Java servlet class/file ExtractionServlet.java in src/net/sf/basedb/meludi/servlet/ updated:
    a. Protected method void doGet(HttpServletRequest req, HttpServletResponse resp) updated for command "GetUnprocessedItems" to call new private method void loadHistologyInfo(DbControl dc, Histology his) to obtain histology info for the FFPE section items.
    b. New private method void loadHistologyInfo(DbControl dc, Histology his) added. It returns data on Stain items coupled to F and E H&E glass items for the histology item.
Location:
extensions/net.sf.basedb.meludi/trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.meludi/trunk/resources/index.jsp

    r5686 r5848  
    920920              <span class="counter" data-counter="ffpeblocks-unused-for-section"
    921921              title="Number of FFPE blocks unused for section">∙</span>
     922
     923            <li><span class="require-permission" data-role="PatientCurator" data-link="personal/ffpe_section_tumour_cell_pct_alt_rec.jsp?ID=<%=ID%>"
     924              >FFPE section (specimen) tumour cell percentage</span>
     925              <span class="counter" data-counter="unprocessed-extract-source-items"
     926              title="Number of unprocessed specimens">∙</span>
    922927<!--
    923928            <li><span class="require-permission" data-role="PatientCurator" data-link="personal/ffpe_section_order_form_sequential.jsp?ID=<%=ID%>"
  • extensions/net.sf.basedb.meludi/trunk/src/net/sf/basedb/meludi/dao/Histology.java

    r5093 r5848  
    126126  }
    127127 
     128
     129  /**
     130    Find all histology items by name. This method will check for {@link Subtype#HISTOLOGY} samples
     131    with a specific name (eg. xxx.his).
     132    @since 2.11
     133   */
     134  public static List<Histology> findByName(DbControl dc, String name)
     135  {
     136    ItemQuery<Sample> histologyQuery = Sample.getQuery();
     137    Subtype.HISTOLOGY.addFilter(dc, histologyQuery);
     138    histologyQuery.setIncludes(Meludi.INCLUDE_IN_CURRENT_PROJECT);
     139    //histologyQuery.restrict(Restrictions.like(Hql.property("name"), Expressions.parameter("name", name+".%", Type.STRING)));
     140    histologyQuery.restrict(Restrictions.like(Hql.property("name"), Expressions.parameter("name", name+"%", Type.STRING)));
     141    histologyQuery.order(Orders.asc(Hql.property("name")));
     142
     143    List<Sample> tmp = histologyQuery.list(dc);
     144    List<Histology> histology = new ArrayList<Histology>(tmp.size());
     145    for (Sample s : tmp)
     146    {
     147      histology.add(new Histology(s));
     148    }
     149    return histology;
     150  }
     151
     152
    128153  /**
    129154    Find all histology items by case name. This method will check for {@link Subtype#HISTOLOGY} samples
  • extensions/net.sf.basedb.meludi/trunk/src/net/sf/basedb/meludi/servlet/BaseLineRegistrationServlet.java

    r5832 r5848  
    4545import net.sf.basedb.core.Sample;
    4646import net.sf.basedb.core.SessionControl;
     47import net.sf.basedb.core.Type;
    4748import net.sf.basedb.core.query.Expressions;
    4849import net.sf.basedb.core.query.Hql;
     
    21432144        CounterService.getInstance().setForceCount();
    21442145      }
     2146      else if ("RegisterFFPESectionTumourCellPct".equals(cmd))
     2147      {
     2148        dc = sc.newDbControl();
     2149
     2150        MeludiRole.checkPermission(dc, "'" + cmd + "' wizard", MeludiRole.PATIENT_CURATOR, MeludiRole.ADMINISTRATOR);
     2151
     2152        JSONObject jsonReq = (JSONObject)new JSONParser().parse(req.getReader());
     2153        JSONObject jsonFfpeSectionTot = (JSONObject)jsonReq.get("ffpeSectionInfo");
     2154        JSONArray jsonFfpeSections = (JSONArray)jsonFfpeSectionTot.get("ffpeSections");
     2155
     2156        // Register the FFPE section (specimen) tumour cell percentage
     2157        int numUpdatedFfpeSections = 0;
     2158        if (jsonFfpeSections != null && jsonFfpeSections.size() > 0)
     2159        {
     2160          HashMap<String, BioPlate> bioPlateNamePlateHashMap = new HashMap<String, BioPlate>();
     2161          for (int i = 0; i < jsonFfpeSections.size(); ++i)
     2162          {
     2163            JSONObject jsonFfpeSection = (JSONObject)jsonFfpeSections.get(i);
     2164            String ffpeSectionName = (String)jsonFfpeSection.get("name");
     2165            int pctTumourCellsF = Integer.parseInt((String)jsonFfpeSection.get("pctTumourCellsF"));
     2166            int pctTumourCellsE = Integer.parseInt((String)jsonFfpeSection.get("pctTumourCellsE"));
     2167
     2168            // Create new child biomaterial
     2169            String itemName = ffpeSectionName;
     2170            String stainedName = itemName + ".he" + ".F";
     2171           
     2172            // Look for a stain with the given name
     2173            MeasuredBioMaterial stained = null;
     2174            ItemQuery<Sample> stainQuery = Sample.getQuery();
     2175            Subtype.STAINED.addFilter(dc, stainQuery);
     2176            stainQuery.restrict(Restrictions.eq(Hql.property("name"), Expressions.parameter("name", stainedName, Type.STRING)));
     2177            List<Sample> stainSamples = stainQuery.list(dc);
     2178            if (stainSamples.size() == 1)
     2179            {
     2180              stained = Sample.getById(dc, stainSamples.get(0).getId());
     2181            }
     2182            stained.setItemSubtype(Subtype.STAINED.load(dc));
     2183
     2184            Annotationtype.TUMOUR_CELLS_PERCENT.setAnnotationValue(dc, stained, pctTumourCellsF);
     2185            jsonMessages.add("HE stain '" + stained.getName() + "' updated with tumour cell percentage " + pctTumourCellsF + " successfully.");
     2186
     2187            stainedName = itemName + ".he" + ".E";
     2188           
     2189            // Look for a stain with the given name
     2190            stained = null;
     2191            stainQuery = Sample.getQuery();
     2192            Subtype.STAINED.addFilter(dc, stainQuery);
     2193            stainQuery.restrict(Restrictions.eq(Hql.property("name"), Expressions.parameter("name", stainedName, Type.STRING)));
     2194            stainSamples = stainQuery.list(dc);
     2195            if (stainSamples.size() == 1)
     2196            {
     2197              stained = Sample.getById(dc, stainSamples.get(0).getId());
     2198            }
     2199            stained.setItemSubtype(Subtype.STAINED.load(dc));
     2200
     2201            Annotationtype.TUMOUR_CELLS_PERCENT.setAnnotationValue(dc, stained, pctTumourCellsE);
     2202            jsonMessages.add("HE stain '" + stained.getName() + "' updated with tumour cell percentage " + pctTumourCellsE + " successfully.");
     2203
     2204            // Update the FFPE block annotations
     2205            //Annotationtype.USED_FOR_FFPE_SECTION.setAnnotationValue(dc, ffpeBlock.getSample(), Boolean.TRUE);
     2206          }
     2207          jsonMessages.add(numUpdatedFfpeSections + " Specimen(s) updated.");
     2208        }
     2209        dc.commit();
     2210        json.put("messages", jsonMessages);
     2211        CounterService.getInstance().setForceCount();
     2212      }
    21452213      else if ("RegisterReturnedFFPEBlocks".equals(cmd))
    21462214      {
  • extensions/net.sf.basedb.meludi/trunk/src/net/sf/basedb/meludi/servlet/ExtractionServlet.java

    r5824 r5848  
    5454import net.sf.basedb.meludi.dao.Case;
    5555import net.sf.basedb.meludi.dao.FfpeBlock;
     56import net.sf.basedb.meludi.dao.Histology;
    5657import net.sf.basedb.meludi.dao.MeludiRole;
    5758import net.sf.basedb.meludi.dao.Patient;
     
    155156            jsonSpec.put("rna", rna.asJSONObject());
    156157          }
     158          // Get histology info
     159          String histologyName = s.getName() + ".his";
     160          List<Histology> histology = Histology.findByName(dc, histologyName);
     161          if (histology.size() > 0)
     162          {
     163            JSONArray jsonHistology = new JSONArray();
     164            for (Histology his : histology)
     165            {
     166              loadHistologyInfo(dc, his);
     167              //jsonHistology.add(his.asJSONObject());
     168              jsonSpec.put("histology", his.asJSONObject());
     169            }
     170            //jsonSections.add(loadSectionInfo(sc, "histology"));
     171            //json.put("histology", jsonHistology);
     172          }
     173         
    157174          // Add JSON data for specimen
    158175          jsonSpecimen.add(jsonSpec);
     
    36883705    return itemListWithHighestNumber;
    36893706  }
     3707
     3708  @SuppressWarnings("unchecked")
     3709  private void loadHistologyInfo(DbControl dc, Histology his)
     3710  {
     3711    Sample s = his.getSample();
     3712    BioMaterialEvent created = s.getCreationEvent();
     3713   
     3714    his.loadBioPlateLocation();
     3715    his.setAnnotation("registrationDate", Meludi.CONVERTER_DATE_TO_STRING.convert(s.getEntryDate()));
     3716    his.setAnnotation("editable", s.hasPermission(Permission.WRITE));
     3717    //his.loadDoNotUseAnnotations(dc, null);
     3718
     3719    //his.loadAnnotations(dc, "partitionDate", Annotationtype.PARTITION_DATE, Meludi.CONVERTER_DATE_TO_STRING);
     3720    his.setAnnotation("originalQuantity", s.getOriginalQuantity());
     3721    his.setAnnotation("remainingQuantity", s.getRemainingQuantity());
     3722   
     3723    if (created.getEventDate() != null)
     3724    {
     3725      his.setAnnotation("embedDate", Meludi.CONVERTER_DATE_TO_STRING.convert(created.getEventDate()));
     3726/*
     3727      his.setAnnotation("embedProtocol", JsonUtil.getProtocolAsJSON(created.getProtocol()));
     3728*/
     3729    }
     3730
     3731    ItemQuery<Sample> stainedQuery = s.getChildSamples();
     3732    Subtype.STAINED.addFilter(dc, stainedQuery);
     3733    stainedQuery.include(Meludi.INCLUDE_IN_CURRENT_PROJECT);
     3734    List<Sample> stained = stainedQuery.list(dc);
     3735System.out.println("CaseSummaryServlet::loadHistologyInfo(): stained.size() = " + stained.size());
     3736    if (stained.size() > 0)
     3737    {
     3738/*
     3739      Sample good = stained.get(0);
     3740      boolean goodIsGood = false;
     3741      for (Sample he : stained)
     3742      {
     3743        if (Boolean.TRUE.equals(Annotationtype.GOOD_STAIN.getAnnotationValue(dc, he)))
     3744        {
     3745          good = he;
     3746          goodIsGood = true;
     3747          break;
     3748        }
     3749      }
     3750      BioMaterialEvent heCreated = good.getCreationEvent();
     3751      his.setAnnotation("stainDate", Meludi.CONVERTER_DATE_TO_STRING.convert(heCreated.getEventDate()));
     3752      his.setAnnotation("stainProtocol", JsonUtil.getProtocolAsJSON(good.getProtocol()));
     3753      his.setAnnotation("numStains", stained.size());
     3754      if (goodIsGood)
     3755      {
     3756        // Image
     3757        File imageFile = null;
     3758        AnyToAny imageLink = null;
     3759        try
     3760        {
     3761          imageLink = AnyToAny.getByName(dc, good, "image");
     3762          if (imageLink.getToType() == Item.FILE)
     3763          {
     3764            // This is linked to an existing file already, replace it
     3765            imageFile = (File)imageLink.getTo();
     3766          }
     3767        }
     3768        catch (RuntimeException ex)
     3769        {}
     3770       
     3771        JSONObject jsonGood = new JSONObject();
     3772        jsonGood.put("id", good.getId());
     3773        jsonGood.put("name", good.getName());
     3774        jsonGood.put("bioWell", JsonUtil.getBioWellAsJSON(good.getBioWell(), true));
     3775        jsonGood.put("comments", good.getDescription());
     3776       
     3777        jsonGood.put("ScoreComplete", Annotationtype.SCORE_COMPLETE.getAnnotationValue(dc, good));
     3778        jsonGood.put("ScoreInvasiveCancer", Annotationtype.SCORE_INVASIVE_CANCER.getAnnotationValue(dc, good));
     3779        jsonGood.put("ScoreInsituCancer", Annotationtype.SCORE_INSITU_CANCER.getAnnotationValue(dc, good));
     3780        jsonGood.put("ScoreLymphocytes", Annotationtype.SCORE_LYMPHOCYTES.getAnnotationValue(dc, good));
     3781        jsonGood.put("ScoreNormal", Annotationtype.SCORE_NORMAL.getAnnotationValue(dc, good));
     3782        jsonGood.put("ScoreStroma", Annotationtype.SCORE_STROMA.getAnnotationValue(dc, good));
     3783        jsonGood.put("ScoreFat", Annotationtype.SCORE_FAT.getAnnotationValue(dc, good));
     3784        if (imageFile != null)
     3785        {
     3786          JSONObject jsonImage = new JSONObject();
     3787          jsonImage.put("id", imageFile.getId());
     3788          jsonImage.put("path", imageFile.getPath().toString());
     3789          jsonGood.put("image", jsonImage);
     3790        }
     3791       
     3792        his.setAnnotation("bestStain", jsonGood);
     3793      }
     3794*/
     3795
     3796      his.setAnnotation("numStains", stained.size());
     3797      if (stained.size() > 1)
     3798      {
     3799        for (int i = 0; i < 2; i++)
     3800        {
     3801          Sample he = (Sample)stained.get(i);
     3802          Integer tumourCellsPct = (Integer)Annotationtype.TUMOUR_CELLS_PERCENT.getAnnotationValue(dc, he);
     3803          String heName = he.getName();
     3804          if (heName.contains(".F"))
     3805          {
     3806            JSONObject jsonF = new JSONObject();
     3807            jsonF.put("id", he.getId());
     3808            jsonF.put("name", he.getName());
     3809            jsonF.put("bioWell", JsonUtil.getBioWellAsJSON(he.getBioWell(), true));
     3810            jsonF.put("tumourCellsPct", tumourCellsPct);
     3811            his.setAnnotation("FStain", jsonF);
     3812          }
     3813          else if (heName.contains(".E"))
     3814          {
     3815            JSONObject jsonE = new JSONObject();
     3816            jsonE.put("id", he.getId());
     3817            jsonE.put("name", he.getName());
     3818            jsonE.put("bioWell", JsonUtil.getBioWellAsJSON(he.getBioWell(), true));
     3819            jsonE.put("tumourCellsPct", tumourCellsPct);
     3820            his.setAnnotation("EStain", jsonE);
     3821          }
     3822        }
     3823      }
     3824    }
     3825  }
    36903826}
Note: See TracChangeset for help on using the changeset viewer.