private void PublicationAssertions(PubMedArticle article)
        {
            Assert.AreEqual("23265711", article.PubMedId);
            Assert.AreEqual("1879-0852", article.Issn);
            Assert.AreEqual("Electronic", article.IssnType);
            Assert.AreEqual("49", article.Volume);
            Assert.AreEqual("6", article.Issue);
            Assert.AreEqual("2013", article.PublicationYear);
            Assert.AreEqual("Apr", article.PublicationMonth);
            Assert.AreEqual("European journal of cancer (Oxford, England : 1990)", article.JournalTitle);
            Assert.AreEqual("Eur. J. Cancer", article.IsoAbbreviation);
            Assert.IsTrue(!article.ArticleTitle.IsNullOrEmpty());
            Assert.AreEqual("1161-8", article.MedlinePgn);
            Assert.IsTrue(!article.Abstract.IsNullOrEmpty());
            Assert.AreEqual(11, article.Authors.Count);
            Assert.AreEqual(4, article.PublicationTypes.Count);
            Assert.AreEqual(2012, article.PubMedPublishYear);
            Assert.AreEqual(12, article.PubMedPublishMonth);
            Assert.AreEqual(26, article.PubMedPublishDay);
            Assert.AreEqual(2012, article.EntrezPublishYear);
            Assert.AreEqual(12, article.EntrezPublishMonth);
            Assert.AreEqual(26, article.EntrezPublishDay);
            Assert.AreEqual(2013, article.MedlinePublishYear);
            Assert.AreEqual(5, article.MedlinePublishMonth);
            Assert.AreEqual(29, article.MedlinePublishDay);

            Assert.AreEqual(2, article.NctNumbers.Count);
            Assert.AreEqual("NCT00122460", article.NctNumbers[0]);
            Assert.AreEqual("NCT00154102", article.NctNumbers[1]);
        }
Esempio n. 2
0
        private PubMedArticle GetPublication(XElement pubmedArticle, string pmid)
        {
            var publication = new PubMedArticle();

            var medlineCitation = pubmedArticle.GetElement("MedlineCitation", pmid);
            publication.PubMedId = medlineCitation.GetElement("PMID", pmid).Value;
            if (pmid.IsNullOrEmpty()) pmid = publication.PubMedId;

            var article = medlineCitation.GetElement("Article", pmid);
            var journal = article.GetElement("Journal", pmid);
            var issnElement = journal.GetElement("ISSN", pmid);
            var history = pubmedArticle.GetElement("PubmedData/History", pmid);

            publication.Issn = issnElement.Value;
            publication.IssnType = issnElement.GetAttribute("IssnType", pmid).Value;
            publication.Volume = journal.GetOptionalElementValue("JournalIssue/Volume");
            publication.Issue = journal.GetOptionalElementValue("JournalIssue/Issue");
            publication.PublicationMonth = journal.GetOptionalElementValue("JournalIssue/PubDate/Month");
            publication.PublicationYear = journal.GetOptionalElementValue("JournalIssue/PubDate/Year");
            publication.JournalTitle = journal.GetOptionalElementValue("Title");
            publication.IsoAbbreviation = journal.GetOptionalElementValue("ISOAbbreviation");
            publication.ArticleTitle = article.GetOptionalElementValue("ArticleTitle");
            publication.MedlinePgn = article.GetOptionalElementValue("Pagination/MedlinePgn");
            publication.Abstract = article.GetOptionalElementValue("Abstract/AbstractText");
            publication.Authors = GetAuthors(article.GetElement("AuthorList", pmid));
            publication.PublicationTypes = GetPublicationTypes(article.GetElement("PublicationTypeList", pmid));

            var pubMedPublishInfo = GetPubMedDate(history.GetElement("PubMedPubDate[@PubStatus='pubmed']", pmid), pmid);
            publication.PubMedPublishYear = pubMedPublishInfo.Item1;
            publication.PubMedPublishMonth = pubMedPublishInfo.Item2;
            publication.PubMedPublishDay = pubMedPublishInfo.Item3;

            var entrezPublishInfo = GetPubMedDate(history.GetElement("PubMedPubDate[@PubStatus='entrez']", pmid), pmid);
            publication.EntrezPublishYear = entrezPublishInfo.Item1;
            publication.EntrezPublishMonth = entrezPublishInfo.Item2;
            publication.EntrezPublishDay = entrezPublishInfo.Item3;

            var medlinePublishInfo = GetPubMedDate(history.GetElement("PubMedPubDate[@PubStatus='medline']", pmid), pmid);
            publication.MedlinePublishYear = medlinePublishInfo.Item1;
            publication.MedlinePublishMonth = medlinePublishInfo.Item2;
            publication.MedlinePublishDay = medlinePublishInfo.Item3;

            var accessionNumberList = article.GetOptionalElement("DataBankList/DataBank/AccessionNumberList");
            if (accessionNumberList != null)
                publication.NctNumbers = GetAccessionNumbers(accessionNumberList);

            return publication;
        }