Skip to main content

elife-pubmed-xml-generation

Generate PubMed deposit of journal articles.

Using JATS XML file as input, this library can generate a PubMed deposit XML file. The XML is parsed using the module from a different library, elifearticle, to extract the data from the XML file and to populate the objects defined in elifearticle.

It would be possible, with some additional code, to populate the elifearticle with data from a different data source and still generate a PubMed deposit, if all or a portion of the data is not stored in JATS XML format.

The PubMed deposit file will include the following output if the data is available in the elifearticle objects:

  • Journal (journal title, publisher name, issn, volume, issue, pub date)
  • Article metadata (title, doi, pii, language, pub date, abstract, copyright, keywords)
  • Authors, group authors, author affiliations
  • Funding data
  • aheadofprint publishing status

It is possible to generate a PubMed deposit XML which includes one article or mulitple articles, depending on how many articles are in the list when generating the output.

Some sample input and output files can be found in the tests/test_data/ folder, which are the basis for the automated tests.

Requirements and install

a) Install from pypi package index

pip install elifepubmed

b) Install locally

Clone the git repo

git clone https://github.com/elifesciences/elife-pubmed-xml-generation.git

Create a python virtual environment and activate it

python3 -m venv venv
source venv/bin/activate

Install it locally

pip install -r requirements.txt
python setup.py install

Configuration

The pubmed.cfg configuration file provided in this repository can be changed in order to read slightly different JATS XML attributes, depending on the journal.

The publication_types.yaml file, referenced in the pubmed.cfg file, is where a JATS XML article type value can be mapped to a PubMed publication_type value.

Example usage

This library is meant to be integrated into another operational system, however the following are examples using interactive Python:

Example 1 - Convert a test fixture XML to elifearticle Article() object, then generate PubMed XML

>>> from letterparser import generate
>>> articles = generate.build_articles_for_pubmed(["tests/test_data/elife-00666.xml"])
>>> p_xml = generate.pubmed_xml(articles)
>>> print(p_xml)

Example 2 - Convert a test fixture XML to elifearticle Article() object, set the article is_poa property, then generate PubMed XML, the output XML will contain <PubDate PubStatus="aheadofprint">

>>> from letterparser import generate
>>> articles = generate.build_articles_for_pubmed(["tests/test_data/elife-00666.xml"])
>>> articles[0].is_poa = True
>>> p_xml = generate.pubmed_xml(articles)
>>> print(p_xml)

Example 3 - Convert two test fixture XML files to elifearticle Article() objects, then generate PubMed XML to disk, the output will be written in the local tmp/ folder

>>> from letterparser import generate
>>> articles = generate.build_articles_for_pubmed(["tests/test_data/elife-00666.xml", "tests/test_data/elife-02935-v2.xml"])
>>> generate.pubmed_xml_to_disk(articles)

Run code tests

Use pytest for testing, install it if missing:

pip install pytest

Run tests

pytest

Run tests with coverage (install it if missing)

coverage run -m pytest

then report on code coverage

coverage report -m

License

Licensed under MIT.

Metadata

Release files for elifepubmed 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for elifepubmed 0.7.0
File Size Uploaded Provenance Actions
elifepubmed-0.7.0.tar.gz 21.9 kB Without provenance Details for elifepubmed-0.7.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for elifepubmed 0.7.0
File Interpreter ABI Platform Actions
elifepubmed-0.7.0-py3-none-any.whl Python 3 none any Details for elifepubmed-0.7.0-py3-none-any.whl

Total release size: 36.8 kB

Release files / elifepubmed-0.7.0.tar.gz

Download URL elifepubmed-0.7.0.tar.gz
Size 21.9 kB
Tags Source
SHA-256 checksum
How to use checksums
34a946303d8d11c6c81063a17e9610a06fae1fabb61276dfc9ff300d89bb7b79
BLAKE2b-256 checksum
How to use checksums
b05ee490471f64bce2f93eba375421c851265a4cde0d429d471e7d46967e5ac6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.10

Release files / elifepubmed-0.7.0-py3-none-any.whl

Download URL elifepubmed-0.7.0-py3-none-any.whl
Size 14.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6d6c1dd7adab292ad30c3c90b4dc9fe765a12d482b72a1a2ccf9ba74b973e559
BLAKE2b-256 checksum
How to use checksums
cf2e3feef70fd2acf805ed43c3918fceb723cf389a50e368e70f9b42f520c3cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.10

Security for elifepubmed 0.7.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page