private void LaunchBatchs(Disorder[] disorders, int indexDisorder, int maxSize) { int size = maxSize; if (disorders.Length - indexDisorder <= 0) { return; } else if (disorders.Length - indexDisorder < maxSize) { size = disorders.Length - indexDisorder; } //Parallel.for(int i = indexDisorder; i < indexDisorder + size; i++) Parallel.For(indexDisorder, indexDisorder + size, (i) => { //ProgressBar.Instance.Report((double)indexDisorder / disorders.Length); //var disorder = Datas.JDBOR[0].DisorderList[0].Disorder[i]; Boolean isARealDisorder = disorders[i].DisorderType[0].Name[0].label == "Disease" || disorders[i].DisorderType[0].Name[0].label == "Clinical syndrome" || disorders[i].DisorderType[0].Name[0].label == "Malformation syndrome" || disorders[i].DisorderType[0].Name[0].label == "Biological anomaly" || disorders[i].DisorderType[0].Name[0].label == "Morphological anomaly" || disorders[i].DisorderType[0].Name[0].label == "Particular clinical situation in a disease or syndrome"; if (isARealDisorder) { Disease d = new Disease(); d.OrphaNumber = disorders[i].OrphaNumber; d.Name = disorders[i].Name[0].label; var synonymsList = disorders[i].SynonymList[0].Synonym; if (synonymsList != null) { foreach (var synonym in synonymsList) { d.Synonyms.Add(synonym.label); } } var textualList = disorders[i].TextualInformationList[0].TextualInformation; if (textualList != null) { foreach (var textualInformation in textualList) { var textualSections = textualInformation.TextSectionList[0].TextSection; if (textualSections != null) { foreach (var textSection in textualSections) { TextualInformation textual = new TextualInformation(); textual.title = textSection.TextSectionType[0].Name[0].label; textual.content = textSection.Contents; d.TextualInformationList.Add(textual); } } } } /* * var url = disorders[i].ExpertLink[0].link; * var web = new HtmlWeb(); * var doc = web.Load(url); * * if(doc != null) * { * ParseExpertData(d, ref doc); * }*/ Diseases.Add(d); } }); LaunchBatchs(disorders, indexDisorder + maxSize, maxSize); }
public void Initialize() { //Initializing with dummy data //TODO: Actual initialization logic to be implemented Patients.Add(new Patient() { Id = "1", FirstName = "Nick", LastName = "Wright", EmailId = "*****@*****.**" }); Diseases.Add(new PatientDisease() { Id = "1", PatientId = "1", DiseaseId = "1", DiseaseName = "Anaphylaxis" }); Diseases.Add(new PatientDisease() { Id = "2", PatientId = "1", DiseaseId = "2", DiseaseName = "Atopic Dermatitis" }); Diseases.Add(new PatientDisease() { Id = "3", PatientId = "1", DiseaseId = "3", DiseaseName = "Latex Allergy" }); Contacts.Add(new PatientContact() { Id = "1", PatientId = "1", ContactId = "1", FirstName = "Steve", LastName = "Wright", PhoneNumber = "1234567890", EmailId = "*****@*****.**", Relationship = "Father" }); HCPs.Add(new HealthCareProfessional() { Id = "1", PatientId = "1", FirstName = "Marlon", LastName = "Samuels", EmailId = "*****@*****.**", CanShareInformation = true }); Conditions.Add(new PatientConditionViewModel() { Id = "1", DiseaseId = "1", DiseaseName = "Anaphylaxis", IsPresent = true }); Conditions.Add(new PatientConditionViewModel() { Id = "2", DiseaseId = "2", DiseaseName = "Atopic Dermatitis", IsPresent = false }); Conditions.Add(new PatientConditionViewModel() { Id = "3", DiseaseId = "3", DiseaseName = "Latex Allergy", IsPresent = false }); }