Beispiel #1
0
        public void SaveRealDataOnDB()
        {
            using (var realDataRepository = new MongoRepository.RealDataRepository())
            {
                //We clear the collection
                realDataRepository.removeAll();

                //We stock the retrieved diseases in DB
                realDataRepository.insert(RealData);
            }
        }
Beispiel #2
0
        public void SaveRealDataOnDB()
        {
            using (var realDataRepository = new MongoRepository.RealDataRepository())
            {
                //We clear the collection
                realDataRepository.removeAll();

                //We stock the retrieved diseases in DB
                //realDataRepository.insert(RealData);

                Console.WriteLine("InsertRealDataInDB start...");
                List <DiseaseData> listDiseaseData = RealData.DiseaseDataList;
                if (listDiseaseData.Count != 0)
                {
                    try
                    {
                        //Cut in listDiseaseData.Count parts
                        int numberOfDocument = listDiseaseData.Count;

                        for (int i = 0; i < numberOfDocument; i++)
                        {
                            realDataRepository.insert(
                                new DiseasesData(
                                    type.Symptom,
                                    listDiseaseData
                                    .Skip(i)
                                    .Take(1)
                                    .ToList()
                                    )
                                );
                        }
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                        Console.WriteLine("Error on insertion of RealData");
                    }
                }
                else
                {
                    Console.WriteLine("0 realData to insert!");
                }
                Console.WriteLine("InsertRealDataInDB finished!");
            }
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            //Environnement variables
            var path = Environment.GetEnvironmentVariable("RD_AGGREGATOR_SETTINGS");

            ConfigurationManager.Instance.Init(path);

            //TESTED AND DONE

            //Update Orphanet (diseases/real datasets)

            OrphaEngine orphaEngine = new OrphaEngine();

            orphaEngine.Start();



            //Retrieving diseases from DB
            List <Disease> lst_diseases = new List <Disease>();

            using (var db = new MongoRepository.DiseaseRepository())
            {
                lst_diseases = db.selectAll().Take(27).ToList();
                //lst_diseases = db.selectAll();
            }

            //TESTED AND DONE

            //Update Publications
            PubmedEngine pubmedEngine = new PubmedEngine();

            Console.WriteLine("Starting requests at PMC this can take some time...");
            pubmedEngine.Start2(lst_diseases);


            //Update number of publications per disease
            Console.WriteLine("Update number of publications per disease.....");
            using (var dbDisease = new MongoRepository.DiseaseRepository())
                using (var dbPublication = new MongoRepository.PublicationRepository())
                {
                    //Update all diseases
                    foreach (var disease in lst_diseases)
                    {
                        long numberPublications = dbPublication.countForOneDisease(disease.OrphaNumber);
                        disease.NumberOfPublications = (int)numberPublications;
                        dbDisease.updateDisease(disease);
                    }
                }
            Console.WriteLine("Update number of publications per disease finished");


            //Retrieving related entities by disease AND TextMine
            TextMiningEngine textMiningEngine = new TextMiningEngine();

            RecupSymptomsAndTextMine(lst_diseases, textMiningEngine);
            //RecupLinkedDiseasesAndTextMine(lst_diseases, textMiningEngine);
            //RecupDrugsAndTextMine(lst_diseases, textMiningEngine);


            //Retrieving PredictionData and RealData from DB (DiseasesData with type Symptom)
            DiseasesData PredictionData = null;
            DiseasesData RealData       = null;

            using (var dbPred = new MongoRepository.PredictionDataRepository())
                using (var dbReal = new MongoRepository.RealDataRepository())
                {
                    PredictionData = dbPred.selectByType(type.Symptom);
                    RealData       = dbReal.selectByType(type.Symptom);
                }


            //Evaluation...
            if (PredictionData != null && RealData != null)
            {
                Evaluator.Evaluate(PredictionData, RealData);
            }


            Console.WriteLine("Finished :)");
            Console.ReadLine();
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            //Environnement variables
            //Environment.SetEnvironmentVariable("RD_AGGREGATOR_SETTINGS", @"C:\Users\Psycho\Source\Repos\RDSearch4\settings.json");
            Environment.SetEnvironmentVariable("RD_AGGREGATOR_SETTINGS", @"C:\Users\CharlesCOUSYN\source\repos\Aggregator\settings.json");
            var path = Environment.GetEnvironmentVariable("RD_AGGREGATOR_SETTINGS");

            ConfigurationManager.Instance.Init(path);

            //Obtain all symptoms/phenotypes
            PhenotypeEngine phenotypeEngine = new PhenotypeEngine();

            phenotypeEngine.GetSymptomsList();

            /*
             * //TESTED AND DONE
             * //Update Orphanet (diseases/real datasets)
             * OrphaEngine orphaEngine = new OrphaEngine(phenotypeEngine);
             * orphaEngine.Start();*/



            //Retrieving diseases from DB
            List <Disease> lst_diseases = new List <Disease>();

            using (var db = new MongoRepository.DiseaseRepository())
            {
                //lst_diseases = db.selectAll().Take(50).ToList();
                lst_diseases = db.selectAll();
            }


            //TESTED AND DONE

            /*
             * //Update Publications
             * PubmedEngine pubmedEngine = new PubmedEngine();
             * Console.WriteLine("Starting requests at PMC this can take some time...");
             * pubmedEngine.Start2(lst_diseases);
             */

            /*
             * //Update number of publications per disease
             * Console.WriteLine("Update number of publications per disease.....");
             * using (var dbDisease = new MongoRepository.DiseaseRepository())
             * using (var dbPublication = new MongoRepository.PublicationRepository())
             * {
             *  //Update all diseases
             *  foreach (var disease in lst_diseases)
             *  {
             *      long numberPublications = dbPublication.countForOneDisease(disease.OrphaNumber);
             *      disease.NumberOfPublications = (int)numberPublications;
             *      dbDisease.updateDisease(disease);
             *  }
             * }
             * Console.WriteLine("Update number of publications per disease finished");
             */


            //Retrieving related entities by disease AND TextMine

            /*
             * TextMiningEngine textMiningEngine = new TextMiningEngine(phenotypeEngine);
             * RecupSymptomsAndTextMine(lst_diseases, textMiningEngine);*/


            //Retrieving PredictionData and RealData from DB (DiseasesData with type Symptom)
            DiseasesData PredictionData = null;
            DiseasesData RealData       = null;

            using (var dbPred = new MongoRepository.PredictionDataRepository())
                using (var dbReal = new MongoRepository.RealDataRepository())
                {
                    PredictionData = dbPred.selectByType(type.Symptom);
                    RealData       = dbReal.selectByType(type.Symptom);
                }


            //Evaluation...
            if (PredictionData != null && RealData != null)
            {
                Console.WriteLine("Evaluation....");

                //Testing all combinaisons
                MetaResults metaResults = Evaluator.MetaEvaluate(PredictionData, RealData, Evaluation.entities.Criterion.MeanRankRealPositives);
                Evaluator.WriteMetaResultsJSONFile(metaResults);

                //Having best combinaison and evaluate with it
                Tuple <TFType, IDFType> tupleToTest = new Tuple <TFType, IDFType>(metaResults.bestInfos.TFType, metaResults.bestInfos.IDFType);

                //Evaluate basically
                Results resultsOfBestCombinaison = Evaluator.Evaluate(PredictionData, RealData, tupleToTest);
                Evaluator.WriteResultsJSONFile(resultsOfBestCombinaison);

                //Evaluate best combinaison with threshold search
                MetaResultsWeight metaResultsWeight = Evaluator.MetaWeightEvaluate(PredictionData, RealData, tupleToTest, 0.0005, Evaluation.entities.Criterion.F_Score);
                Evaluator.WriteMetaResultsWeightJSONFile(metaResultsWeight);

                Console.WriteLine("Evaluation finished!");
            }


            Console.WriteLine("Finished :)");
            Console.ReadLine();
        }