public RopDocument(RopDocument rd)
 {
     this.Name = rd.Name;
     this.AvailableOn = rd.AvailableOn;
     this.Description = rd.Description;
     this.PathDocument = rd.PathDocument;
     this.WebPage = rd.WebPage;
 }
Exemple #2
0
 public RopDocument(RopDocument rd)
 {
     this.Name         = rd.Name;
     this.AvailableOn  = rd.AvailableOn;
     this.Description  = rd.Description;
     this.PathDocument = rd.PathDocument;
     this.WebPage      = rd.WebPage;
 }
        public Medici()
        {
            rdBase = new RopDocument();
            rdBase.ID = ("931433F4-1595-4AF6-A746-8C5859B0823C");
            rdBase.PathDocument =
               new Uri( "http://www.date.gov.ro/dataset/3c128d2f-f4e2-47d5-ad11-a5602c1e4856/resource/61a73bc0-34c6-4067-b1c4-3ab659323c87/download/numrul-medicilor-pe-judee-i-ministere-din-sectorul-public-numrul-medicilor-pe-ministere-macroreg.xls");
            rdBase.WebPage =
                "http://data.gov.ro/dataset/personalul-medico-sanitar-din-romania/resource/61a73bc0-34c6-4067-b1c4-3ab659323c87";
            rdBase.Name = "personalul-medico-sanitar-din-romania";
            rdBase.Description =
                "NUMĂRUL MEDICILOR PE JUDEŢE ŞI MINISTERE DIN SECTORUL PUBLIC/NUMĂRUL MEDICILOR PE MINISTERE, MACROREGIUNI ŞI REGIUNI DIN SECTORUL PUBLIC";

            rdBase.AvailableOn = new SingleTimePeriod("2015-10-19");
        }
        public StatisticaLocalitati()
        {
            rdBase = new RopDocument();
            
            rdBase.PathDocument =
               new Uri("http://data.gov.ro/storage/f/2014-06-11T07%3A56%3A32.555Z/siaep2014-stat-statistica-pe-localitati.xls");
            rdBase.WebPage =
                "http://data.gov.ro/dataset/alegerea-membrilor-din-romania-pentru-parlamentul-european-2014/resource/756ea5fc-d335-4ea3-adc4-8f6e62a21307";
            rdBase.Name = "statistica alegatori ";
            rdBase.Description =
                "SIAEP2014_STAT_Statistica-pe-localitati.xls";

            rdBase.AvailableOn = new SingleTimePeriod("2014-01-01");
        }
        public NumarAnimale()
        {
            rdBase = new RopDocument();
            rdBase.ID = ("822FCCF9-F77F-4D70-A189-7A637CCC7BBC");
            rdBase.PathDocument =
                new Uri("http://data.gov.ro/storage/f/2013-11-19T09%3A18%3A21.274Z/ansv-statistica.csv");
            rdBase.WebPage =
                "http://data.gov.ro/dataset/numar-bovine-ovine-caprine-porci-pe-localitati-si-gospodarii";
            rdBase.Name = "Numar bovine, ovine, caprine, porci pe localitati si gospodarii";
            rdBase.Description =
                "Pentru fiecare localitate numarul total de bovine,ovine,caprine si porci precum si numarul de curti/gospodarii din localitate care au un anumit numar de animale. Informatie exportata din baza de date aferenta crotalierii in luna noiembrie 2013.";

            rdBase.AvailableOn = new SingleTimePeriod("2013-12-31");
        }
        public DetinatoriPermise()
        {
            rdBase = new RopDocument();
            rdBase.ID = ("305A49E7-0971-445F-890E-293F502FCDB1");
            rdBase.PathDocument =
               new Uri("http://data.gov.ro/storage/f/2015-03-04T11%3A53%3A57.941Z/detinatori-pc-2014.csv");
            rdBase.WebPage =
                "http://data.gov.ro/dataset/detinatori-permise-de-conducere/resource/137f2972-5350-4dc8-b8f3-7f135fdd60fb";
            rdBase.Name = "detinatori pc 2014.csv";
            rdBase.Description =
                "Statistica detinatori permise de conducere si categorii";

            rdBase.AvailableOn = new SingleTimePeriod("2014-12-31");
        }
        public ObiectiveInvestiții()
        {
            rdBase = new RopDocument();
            rdBase.ID = ("346CCE96-6970-4347-BC30-9AF806D00224");
            rdBase.PathDocument =
               new Uri("http://data.gov.ro/dataset/c0301bf1-88b6-408b-8740-88871133d8dd/resource/466e023d-2ecb-4c40-a4c5-a409d40661cb/download/listalegea114.xls");
            rdBase.WebPage =
                "http://data.gov.ro/dataset/programul-de-constructii-de-locuinte-sociale/resource/466e023d-2ecb-4c40-a4c5-a409d40661cb";
            rdBase.Name = "Obiective de investitii finantate - stadiu ";
            rdBase.Description =
                "Lista obiectivelor de investiții finanțate în anul 2015, cu Ordine MDRAP aprobate - situație la data de 20.09.2015";

            rdBase.AvailableOn = new SingleTimePeriod("2014-12-31");
        }
        public UnitatiInvatamint()
        {
            rdBase = new RopDocument();
            rdBase.ID = ("B4069A84-5C75-4EFA-98BD-9594A50A997C");
            rdBase.PathDocument =
               new Uri("http://date.edu.ro/sites/default/files/Retea_2014_2015.csv");
            rdBase.WebPage =
                "http://data.gov.ro/dataset/reteaua-scolara-a-unitatilor-de-invatamant-2014-2015";
            rdBase.Name = "Rețeaua școlară a unităților de învățământ 2014-2015";
            rdBase.Description =
                "Rețeaua școlară a unităților de învățământ include datele tuturor unităților subordonate Ministerului Educației Naționale care funcționează în anul școlar 2014-2015.";

            rdBase.AvailableOn = new SingleTimePeriod("2015-12-31");
        }
        public ParcAuto()
        {
            rdBase = new RopDocument();

            rdBase.PathDocument =
                new Uri(
                    "http://data.gov.ro/dataset/b93e0946-2592-4ed7-a520-e07cba6acd07/resource/98895aa9-5cdf-4572-86d8-d6ec6c28b0da/download/parcauto2015.csv");
            rdBase.WebPage =
                "http://data.gov.ro/dataset/parc-auto-romania/resource/98895aa9-5cdf-4572-86d8-d6ec6c28b0da";
            rdBase.Name = "Parcul auto la data de 31.12.2015";
            rdBase.Description =
                "Situatia cuprinde parcul auto la 31.12.2015";
            rdBase.ID = "1AEA07DB-4F14-42DC-989A-91241A020182";
            rdBase.AvailableOn = new SingleTimePeriod("2015-12-31");
        }
        public Casatorii()
        {
            rdBase = new RopDocument();

            rdBase.PathDocument =
                new Uri(
                    "http://data.gov.ro/dataset/55a39469-fb6a-4dae-90ee-827d075eab9e/resource/7f941b8d-4f7e-477d-92b8-a7c9d4be6511/download/casatorii2015.xlsx");
            rdBase.WebPage =
                "http://data.gov.ro/dataset/numarul-casatoriilor-civile-in-anul-2015-pe-luni-respectiv-orase/resource/7f941b8d-4f7e-477d-92b8-a7c9d4be6511";
            rdBase.Name = "căsătorii 2015 ";
            rdBase.Description =
                "Numărul căsătoriilor civile, în anul 2015";
            rdBase.ID = "4E29E0A3-D7A6-4F00-B141-DF6253158223";
            rdBase.AvailableOn = new SingleTimePeriod("2015-01-01");
        }
        public override async Task<RopDocument[]> FillDate()
        {
            
            var dd = new DownloadData();
            var uri = new Uri("http://data.gov.ro/dataset/situatia-farmaciilor-din-romania");
            var dataBytes = await dd.Data(uri);
            var str = Encoding.ASCII.GetString(dataBytes);
            var hd = new HtmlDocument();
            hd.LoadHtml(str);
            var nodes= hd.DocumentNode.SelectNodes("//a[@class='resource-url-analytics']");
            var taskList = new List<Task<RopData>>();
            foreach (var node in nodes)
            {
                var link=node.Attributes["href"].Value;
                var task = CreateFarmacie(new Uri(link));
                taskList.Add(task);
            }

            await Task.WhenAll(taskList.ToArray());

            var rd = new RopDocument();
            rd.Name = "farmacii";
            rd.PathDocument = uri;
            rd.ID = "45A83E85-D049-4258-8575-9CE43C49273C";            
            rd.Description = "Situatia farmaciilor din Romania";
            var list = taskList.
                Select(it => (it.Exception == null) ? it.Result : null)
                .Where(it => it != null);
            //Bucuresti is duplicate - judet
            list=list.GroupBy(it => it.Judet).Select(group =>
            
                new RopData()
                {
                    Judet = group.Key,
                    Valoare = group.Sum(it => it.Valoare)
                }
            ).ToArray();
            rd.Data = list.ToArray();
            return new[] { rd };

        }
 private static void write(RopDocument[] d)
 {
     foreach (var doc in d)
     {
         Console.WriteLine("------------"+doc.Name);
         foreach (var item in doc.Data)
         {
             Console.WriteLine(item.Judet.Nume + " -- " + item.Valoare);
         }
     }
 }
        public override async Task<RopDocument[]> FillDate()
        {

            var dataAlegatori = new List<RopData>();
            var dataAlegatoriPrezenti = new List<RopData>();
            var dd = new DownloadData();
            var dataBytes = await dd.Data(rdBase.PathDocument);

            var path = Path.Combine(Path.GetTempPath(), Path.GetTempFileName() + ".xls");
            File.WriteAllBytes(path, dataBytes);
            //var path = "D:\\a.xls";
            var dt = new DataTable();
            using (var m = new OleDbConnection())
            {
                m.ConnectionString = ExcelHelpers.BuildExcelConnectionString(path, true);
                m.Open();
                var query = @"Select * From [SIAEP2014_STAT_Statistica pe lo$]";
                using (var cmd = new OleDbCommand(query, m))
                {
                    using (var dr = cmd.ExecuteReaderAsync().Result)
                    {

                        dt.Load(dr);

                    }
                }

            }
            foreach (DataRow row in dt.Rows)
            {
                
                var arr = row.ItemArray;
                //if (arr[0] == null || string.IsNullOrWhiteSpace(arr[0].ToString()))
                if (string.IsNullOrWhiteSpace(arr[0]?.ToString()))
                    continue;
                var numeJudet = arr[1].ToString().Trim().ToLower();
                if(numeJudet == "străinătate")
                    continue;
                
                var judet = judetFinder.Find(numeJudet);
                var valoare = int.Parse(arr[3].ToString());
                var rd = new RopData();
                rd.Judet = judet;
                rd.Valoare = valoare;
                rd.Oras = null;
                dataAlegatori.Add(rd);

                rd = new RopData();
                rd.Judet = judet;
                rd.Valoare = int.Parse(arr[6].ToString());
                rd.Oras = null;
                dataAlegatoriPrezenti.Add(rd);
            }
            var newRD = new RopDocument(rdBase);
            newRD.Name += "Nr Alegatori Liste";
            newRD.ID = "BA671A2B-27E8-408D-BABD-59B52661789D";
            newRD.Data = dataAlegatori
                    .GroupBy(it => it.Judet).Select(group =>

                  new RopData()
                  {
                      Judet = group.Key,
                      Valoare = group.Sum(it => it.Valoare)
                  }
            ).ToArray();

            var newRDUrne = new RopDocument(rdBase);
            newRDUrne.Name += "Nr Alegatori Prezentati La Urne";
            newRDUrne.ID = "BBB0ECA2-34BE-4177-B3A2-82BC6B41311E";
            newRDUrne.Data = dataAlegatoriPrezenti
                .GroupBy(it => it.Judet).Select(group =>
                  new RopData()
                  {
                      Judet = group.Key,
                      Valoare = group.Sum(it => it.Valoare)
                  }
            ).ToArray();

            return new[] { newRD,newRDUrne };

        }