gijswobben / pymed

PyMed is a Python library that provides access to PubMed.
MIT License
191 stars 111 forks source link

some code is userful,i hopy you can add in #19

Open BEIBEI123 opened 5 years ago

BEIBEI123 commented 5 years ago

I hope you can add this code in article.py

``

__slots__ = (
    "pubmed_id",
    "title",
    "abstract",
    "keywords",
    "journal",
    "publication_date",
    "authors",
    "methods",
    "conclusions",
    "results",
    "copyrights",
    "doi",
    "volume",
    "issue",
    "pubdate_year",
    "pubdate_month"
)

def _extractVolume(self: object, xml_element: TypeVar("Element")) -> str:
    path = ".//Journal/JournalIssue/Volume"
    return getContent(element=xml_element, path=path)

def _extractIssue(self: object, xml_element: TypeVar("Element")) -> str:
    path = ".//Journal/JournalIssue/Issue"
    return getContent(element=xml_element, path=path)

def _extractPubDateYear(self: object, xml_element: TypeVar("Element")) -> str:
    path = ".//Journal/JournalIssue/PubDate/Year"
    return getContent(element=xml_element, path=path)

def _extractPubDateMonth(self: object, xml_element: TypeVar("Element")) -> str:
    path = ".//Journal/JournalIssue/PubDate/Month"
    return getContent(element=xml_element, path=path)

    self.volume = self._extractVolume(xml_element)
    self.issue = self._extractIssue(xml_element)
    self.pubdate_year = self._extractPubDateYear(xml_element)
    self.pubdate_month = self._extractPubDateMonth(xml_element)

``

BEIBEI123 commented 5 years ago

thanks

Darkbladecr commented 5 years ago

Why not create a pull request? It will make it easier for the authors to implement.