public void SetInterpretiveComment() { StringBuilder result = new StringBuilder(); foreach (Business.Flow.CellPopulationOfInterest cellPopulationOfInterest in this.m_PanelSetOrderLeukemiaLymphoma.FlowMarkerCollection.CellPopulationsOfInterest) { if (this.m_PanelSetOrderLeukemiaLymphoma.FlowMarkerCollection.CellPopulationsOfInterest.Count >= 2) { result.AppendLine("Cell population of interest: " + cellPopulationOfInterest.Description); } Business.Flow.FlowMarkerCollection flowMarkerCollection = this.m_PanelSetOrderLeukemiaLymphoma.FlowMarkerCollection.GetMarkerPanel(cellPopulationOfInterest.Id); if (this.m_PanelSetOrderLeukemiaLymphoma.TestResult == "Normal") { result.Append(this.GetNormalComment()); } else { if (this.m_PanelSetOrderLeukemiaLymphoma.CellDescription == "Myeloid Cells") { result.Append(this.GetNormalComment()); } else { result.Append(this.GetAbnormalComment(flowMarkerCollection)); } } } this.m_PanelSetOrderLeukemiaLymphoma.InterpretiveComment = result.ToString(); }
private void SetSurfaceImmunoglobulinSentence(List <string> sentences, Business.Flow.FlowMarkerCollection flowMarkerCollection) { string sentence = string.Empty; foreach (YellowstonePathology.Business.Flow.FlowMarkerItem marker in flowMarkerCollection) { if (marker.Name == "Lambda" | marker.Name == "Kappa") { if (marker.Expresses == 3) { sentences.Add("Surface immunoglobulin is too dim to assess clonality"); return; } } } }
private string GetAbnormalComment(Business.Flow.FlowMarkerCollection flowMarkerCollection) { List <string> sentences = new List <string>(); this.SetSentence1(sentences); this.SetMarkerExpressionFragment(sentences, flowMarkerCollection); this.SetSurfaceImmunoglobulinSentence(sentences, flowMarkerCollection); this.SetEquivocalSentence(sentences, flowMarkerCollection); string comment = string.Empty; foreach (string s in sentences) { comment += s.Trim() + ". "; } return(comment); }
private void SetEquivocalSentence(List <string> sentences, Business.Flow.FlowMarkerCollection flowMarkerCollection) { List <string> markers = new List <string>(); foreach (YellowstonePathology.Business.Flow.FlowMarkerItem marker in flowMarkerCollection) { if (marker.Expresses == 3) { if (marker.Name != "Kappa" & marker.Name != "Lambda") { markers.Add(marker.Name); } } } string equivocalSentence = string.Empty; foreach (string marker in markers) { equivocalSentence += marker + ", "; } if (markers.Count > 0) { equivocalSentence = equivocalSentence.Remove(equivocalSentence.Length - 2, 1); } switch (markers.Count) { case 1: equivocalSentence += "is equivocal"; break; default: equivocalSentence += "are equivocal"; break; } if (markers.Count > 0) { sentences.Add(equivocalSentence); } }
private void SetMarkerExpressionFragment(List <string> sentences, Business.Flow.FlowMarkerCollection flowMarkerCollection) { string expressesFragment = " that express "; foreach (YellowstonePathology.Business.Flow.FlowMarkerItem marker in flowMarkerCollection) { if (marker.Name != "Kappa" & marker.Name != "Lambda") { if (marker.Expresses == 1) { expressesFragment += marker.Name + ", "; } } } expressesFragment = expressesFragment.Remove(expressesFragment.Length - 2, 2); string[] expressionSplit = expressesFragment.Split(','); if (expressionSplit.Length > 1) { string replaceText = ", " + expressionSplit[expressionSplit.Length - 1].Trim(); expressesFragment = expressesFragment.Replace(replaceText, " and " + expressionSplit[expressionSplit.Length - 1].Trim()); } foreach (YellowstonePathology.Business.Flow.FlowMarkerItem marker in flowMarkerCollection) { if (marker.Name == "Kappa") { if (marker.Expresses == 1) { expressesFragment += " and Ig Kappa light chain restriction"; } } if (marker.Name == "Lambda") { if (marker.Expresses == 1) { expressesFragment += " and Ig Lambda light chain restriction"; } } } List <string> butNotMarkers = new List <string>(); foreach (YellowstonePathology.Business.Flow.FlowMarkerItem marker in flowMarkerCollection) { if (marker.Name != "Kappa" & marker.Name != "Lambda") { if (marker.Expresses == 2) { butNotMarkers.Add(marker.Name); } } } if (butNotMarkers.Count > 0) { expressesFragment += " but not "; foreach (string str in butNotMarkers) { if (str == butNotMarkers[butNotMarkers.Count - 1]) { expressesFragment = expressesFragment.Substring(0, expressesFragment.Length - 2); expressesFragment += " or " + str; } else { expressesFragment += str + ", "; } } } sentences[0] = sentences[0] + expressesFragment; }
private void HandleMarkers(PanelSetOrderLeukemiaLymphoma panelSetOrderLeukemiaLymphoma) { panelSetOrderLeukemiaLymphoma.FlowMarkerCollection.SetFirstMarkerPanelIfExists(); XmlNode tableNode1 = this.m_ReportXml.SelectSingleNode("descendant::w:tbl[w:tr/w:tc/w:p/w:r/w:t='marker_name1']", this.m_NameSpaceManager); XmlNode MarkerNode1 = tableNode1.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='marker_name1']", this.m_NameSpaceManager); XmlNode cellPopulationNode = tableNode1.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='cell_population_of_interest']", this.m_NameSpaceManager); XmlNode blankRowNode1 = tableNode1.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='blank_row']", this.m_NameSpaceManager); XmlNode tableNode2 = this.m_ReportXml.SelectSingleNode("descendant::w:tbl[w:tr/w:tc/w:p/w:r/w:t='marker_name2']", this.m_NameSpaceManager); XmlNode MarkerNode2 = tableNode2.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='marker_name2']", this.m_NameSpaceManager); XmlNode blankRowNode2 = tableNode2.SelectSingleNode("descendant::w:tr[w:tc/w:p/w:r/w:t='blank_row']", this.m_NameSpaceManager); foreach (Business.Flow.CellPopulationOfInterest cellPopulationOfInterest in panelSetOrderLeukemiaLymphoma.FlowMarkerCollection.CellPopulationsOfInterest) { Business.Flow.FlowMarkerCollection flowMarkerCollection = panelSetOrderLeukemiaLymphoma.FlowMarkerCollection.GetMarkerPanel(cellPopulationOfInterest.Id); XmlNode nodeToInsertAfter1 = MarkerNode1; int rowCount = flowMarkerCollection.Count; int FirstHalfCount = rowCount / 2; int LastHalfCount = rowCount - FirstHalfCount; XmlNode newCellPopulationNode = cellPopulationNode.Clone(); newCellPopulationNode.SelectSingleNode("descendant::w:r[w:t='cell_population_of_interest']/w:t", this.m_NameSpaceManager).InnerText = cellPopulationOfInterest.Description; tableNode1.InsertAfter(newCellPopulationNode, nodeToInsertAfter1); nodeToInsertAfter1 = newCellPopulationNode; for (int i = 0; i < FirstHalfCount; i++) { XmlNode NewMarkerNode1 = MarkerNode1.Clone(); NewMarkerNode1.SelectSingleNode("descendant::w:r[w:t='marker_name1']/w:t", this.m_NameSpaceManager).InnerText = flowMarkerCollection[i].Name; NewMarkerNode1.SelectSingleNode("descendant::w:r[w:t='marker_interpretation1']/w:t", this.m_NameSpaceManager).InnerText = flowMarkerCollection[i].Interpretation; NewMarkerNode1.SelectSingleNode("descendant::w:r[w:t='marker_intensity1']/w:t", this.m_NameSpaceManager).InnerText = flowMarkerCollection[i].Intensity; tableNode1.InsertAfter(NewMarkerNode1, nodeToInsertAfter1); nodeToInsertAfter1 = NewMarkerNode1; } XmlNode newBlankRowNode3 = blankRowNode1.Clone(); newBlankRowNode3.SelectSingleNode("descendant::w:r[w:t='blank_row']/w:t", this.m_NameSpaceManager).InnerText = null; tableNode1.InsertAfter(newBlankRowNode3, nodeToInsertAfter1); XmlNode nodeToInsertAfter2 = MarkerNode2; XmlNode newBlankRowNode2 = blankRowNode2.Clone(); newBlankRowNode2.SelectSingleNode("descendant::w:r[w:t='blank_row']/w:t", this.m_NameSpaceManager).InnerText = null; tableNode2.InsertAfter(newBlankRowNode2, nodeToInsertAfter2); nodeToInsertAfter2 = newBlankRowNode2; for (int i = FirstHalfCount; i < rowCount; i++) { XmlNode NewMarkerNode2 = MarkerNode2.Clone(); NewMarkerNode2.SelectSingleNode("descendant::w:r[w:t='marker_name2']/w:t", this.m_NameSpaceManager).InnerText = flowMarkerCollection[i].Name; NewMarkerNode2.SelectSingleNode("descendant::w:r[w:t='marker_interpretation2']/w:t", this.m_NameSpaceManager).InnerText = flowMarkerCollection[i].Interpretation; NewMarkerNode2.SelectSingleNode("descendant::w:r[w:t='marker_intensity2']/w:t", this.m_NameSpaceManager).InnerText = flowMarkerCollection[i].Intensity; tableNode2.InsertAfter(NewMarkerNode2, nodeToInsertAfter2); nodeToInsertAfter2 = NewMarkerNode2; } XmlNode newBlankRowNode4 = blankRowNode2.Clone(); newBlankRowNode4.SelectSingleNode("descendant::w:r[w:t='blank_row']/w:t", this.m_NameSpaceManager).InnerText = null; tableNode2.InsertAfter(newBlankRowNode4, nodeToInsertAfter2); nodeToInsertAfter2 = newBlankRowNode4; } tableNode1.RemoveChild(cellPopulationNode); tableNode1.RemoveChild(MarkerNode1); tableNode1.RemoveChild(blankRowNode1); tableNode2.RemoveChild(blankRowNode2); tableNode2.RemoveChild(MarkerNode2); }