/// <summary> /// Retrieve case deteail /// </summary> /// <param name="caseURN">case id to be retrieved</param> /// <returns>detail of the case</returns> public CaseSpecimenList GetCaseDetail(string caseURN) { Log.Debug("Retrieving case details..."); CaseSpecimenList myCase = new CaseSpecimenList(); string URI = String.Format("pathology/case/specimens/{0}", caseURN); IRestResponse response; try { response = ExecuteGet(URI, VixServiceTypes.Pathology); ValidateRestResponse(response); myCase = ResponseParser.ParseGetCaseDetail(response.Content); } catch (MagVixFailureException vfe) { Log.Error("Unexpected response.", vfe); } catch (Exception ex) { Log.Error("Could not complete request to retrieve case detail.", ex); } return myCase; }
public void CreateChildren(CaseSpecimenList specimenData) { // clear speciment list this.Slides.Clear(); // group by specimens first List<List<CaseSpecimen>> specimens = specimenData.Items.GroupBy(item => item.Specimen).Select(group => new List<CaseSpecimen>(group).Where(spec => !string.IsNullOrEmpty(spec.Specimen)).ToList()).ToList(); foreach (List<CaseSpecimen> specimenGroup in specimens) { if (specimenGroup.Count == 0) continue; // add specimen node CaseListItem specimenRoot = new CaseListItem(specimenGroup[0], this, CaseListItemKind.Specimen); // group by smear prep List<List<CaseSpecimen>> smearPreps = specimenGroup.GroupBy(item => item.SmearPrep).Select(group => new List<CaseSpecimen>(group).Where(spec => !string.IsNullOrEmpty(spec.SmearPrep)).ToList()).ToList(); foreach (List<CaseSpecimen> smearPrepGroup in smearPreps) { if (smearPrepGroup.Count == 0) continue; // add smear prep node CaseListItem smearPrepRoot = new CaseListItem(smearPrepGroup[0], specimenRoot, CaseListItemKind.SmearPrep); // add remaining stains foreach (CaseSpecimen stain in smearPrepGroup) { if (string.IsNullOrEmpty(stain.Stain)) continue; CaseListItem stainNode = new CaseListItem(stain, smearPrepRoot, CaseListItemKind.Stain); smearPrepRoot.Slides.Add(stainNode); } specimenRoot.Slides.Add(smearPrepRoot); } this.Slides.Add(specimenRoot); } }