public void TestTargetSpeciesExtractionLocal()
        {
            var pid = VMDPIDFactory.GetVmdPid().Result;

            foreach (var ep in pid.ExpiredProducts.Where(ep => !EPARTools.IsEPAR(ep.SPC_Link)))
            {
                var spc = VMDPIDFactory.GetSpc(ep).Result;
                Debug.WriteLine(spc);
                spc = spc.ToLowerInvariant().EndsWith(".doc") ? WordConverter.ConvertDocToDocx(spc) : spc;
                var ts = SPCParser.GetTargetSpecies(spc);
                Assert.IsNotNull(ts, $"null ts for {ep.Name}, {spc}");
                Assert.IsTrue(ts.Any(), $"empty ts for {ep.Name}, {spc}");
                Assert.IsFalse(ts.Any(string.IsNullOrWhiteSpace), $"blank species for {ep.Name}, {spc}");
            }
        }
        public void TestStaticTypingOfTargetSpeciesEmaLicensedExpiredProducts()
        {
            var pid         = VMDPIDFactory.GetVmdPid(PidFactoryOptions.GetTargetSpeciesForExpiredEmaProduct).Result;
            var errorString = "";
            var errors      = pid.AllProducts
                              .Where(p => p.GetType() == typeof(ExpiredProduct) && EPARTools.IsEPAR(((ExpiredProduct)p).SPC_Link))
                              .Where(p => p.TargetSpeciesTyped == null || !p.TargetSpeciesTyped.Any()).ToList();

            if (errors.Any())
            {
                errorString = string.Join(Environment.NewLine,
                                          errors.Select(p => $"{p.Name} " +
                                                        $"from {string.Join(';', p.TargetSpecies??new string[0])}"));
            }

            Assert.IsFalse(errors.Any(),
                           $"EMA-licensed expired product with un-filled strongly typed target species for: {errorString}");
        }
        public void TestStaticTypingOfTargetSpeciesExpiredProducts()
        {
            var pid = VMDPIDFactory.GetVmdPid(PidFactoryOptions.GetTargetSpeciesForExpiredVmdProduct).Result;

            foreach (var p in pid.AllProducts)
            {
                if (p.GetType() != typeof(ExpiredProduct) ||
                    EPARTools.IsEPAR(((ExpiredProduct)p).SPC_Link)
                    )
                {
                    continue;
                }
                if (!(p.TargetSpeciesTyped != null && p.TargetSpeciesTyped.Any()))
                {
                    Debug.WriteLine(string.Join(';', p.TargetSpecies));
                }
                Assert.IsTrue(p.TargetSpeciesTyped != null && p.TargetSpeciesTyped.Any(),
                              $"Expired product with un-filled strongly typed target species for {p.Name}"
                              + $"from {string.Join(';', p.TargetSpecies)}");
            }
        }
Esempio n. 4
0
        public void TestGetSearchResults()
        {
            var testset = new Dictionary <string, string>
            {
                {
                    "dicural 150 mg coated tablets for dogs",
                    "https://www.ema.europa.eu/documents/product-information/dicural-epar-product-information_en.pdf"
                },
                {
                    "metacam",
                    "https://www.ema.europa.eu/documents/product-information/metacam-epar-product-information_en.pdf"
                },
                {
                    "purevax rcch",
                    "https://www.ema.europa.eu/documents/product-information/purevax-rcch-epar-product-information_en.pdf"
                },
                { "aivlosin 8.5 mg/g premix for medicated feeding stuff for pigs",
                  "https://www.ema.europa.eu/documents/product-information/aivlosin-epar-product-information_en.pdf" },
                {
                    "promeris duo 499.5 mg + 499.5 mg spot-on for medium/large sized dogs",
                    "https://www.ema.europa.eu/documents/product-information/promeris-duo-epar-product-information_en.pdf"
                }
            };
            var testout = new Dictionary <string, string>();

            foreach (var test in testset)
            {
                var res = EPARTools.GetSearchResults(test.Key).Result;

                if (res == null)
                {
                    testout[test.Key] = null;
                }
                else
                if (res.Length == 0)
                {
                    testout[test.Key] = string.Empty;
                }
                else
                if (res[0].Equals(test.Value))
                {
                    testout[test.Key] = true.ToString();
                }
                else
                {
                    testout[test.Key] = false.ToString();
                }

                if (!testout[test.Key].Equals(true.ToString()))
                {
                    Debug.WriteLine($"{test.Key}: {testout[test.Key]}");
                }
            }

            Assert.IsTrue(testout.Values.All(t => t.Equals(true.ToString())));

            //var res = EPARTools.GetSearchResults("metacam").Result;
            //Assert.IsNotNull(res,"No results returned");
            //Assert.IsTrue(res.Length>0, "Empty results returned");
            //Assert.IsTrue(res[0].Equals("https://www.ema.europa.eu/documents/product-information/metacam-epar-product-information_en.pdf")
            //    , $"Wrong url returned: {res[0]}");
        }