Skip to main content

BioMed Article Converter

Coverage PyPI version

This is a simple package made to convert NCBI PubMed/PMC XML formats into more common and useable downstream formats such as HTML, MD, or plain text

This can be used as command line tool or as a library. For example to convert the XML from a pmc article to html

python -m biomed_article_converter input.xml output.html --source_type pmc

or via the library to convert to markdown

from biomed_article_converter import convert_format


with open("input.xml", "r") as fh:
    content = fh.read()

md = convert_format("xml", "md", content, source_type="pmc")

While the xml to html conversion tries to retain as much information as possible, the simpler md and txt formats make some assumptions on what you want to keep.

By default the md/txt formats drop the following

  • author details
  • references
  • inline citations
  • article metadata

as well as any sections with known non-informative titles defined by (OMIT_TITLES)

OMIT_TITLES = {
    "ethics statement",
    "conflict of interest",
    "conflicts of interest",
    "acknowledgments",
    "acknowledgment",
    "data deposition and access",
    "data availability",
    "code availability",
    "author contributions",
    "funding",
    "competing interest statement",
    "competing interests",
}

Table Normalization

For markdown or plain text, we cannot support the nested/complex table structures seen in html. Therefore the first step is simplifying the tables. For cells the span multiple columns or rows we simply create X new cells and repeat the content. For multi-row headers were concatenate each header level within a cell by row1: row2: cell content

XML inspection helpers

biomed_article_converter also provides small XML-structure helpers used when working with raw NCBI article responses.

Split PubMed article sets

PubMed efetch responses may contain multiple PubmedArticle or PubmedBookArticle records. Use split_articles_from_pubmed_xml() to split a response into individual XML documents keyed by PMID:

from biomed_article_converter import split_articles_from_pubmed_xml

articles = split_articles_from_pubmed_xml(xml)

article_xml = articles["32214442"]

The returned values are standalone XML strings for each article. Both regular PubMed articles and PubMed book articles are supported.

Detect abstract-only records

Use is_abstract_only() to determine whether an article XML record contains only abstract-level content:

from biomed_article_converter import is_abstract_only

if is_abstract_only(xml, source_type="pmc"):
    print("PMC did not provide substantive full text")

For PMC/JATS XML, a document is considered abstract-only when it has no substantive <body> content. PubMed XML records are abstract-level records by definition, so source_type="pubmed" returns True.

These helpers inspect article XML structure only; they do not perform format conversion.

Crossref JATS abstracts

Pass the Crossref API response's message["abstract"] string directly, without additional XML wrapping:

from biomed_article_converter import convert_format

abstract_xml = response.json()["message"].get("abstract")
if abstract_xml:
    md = convert_format("xml", "md", abstract_xml, source_type="crossref")

Crossref abstracts support HTML, Markdown, and plain-text output, including JATS section labels, paragraph boundaries, and inline formatting. Trailing AACR Citation Format: blocks are omitted. is_abstract_only() returns True for this source. The command line also accepts --source_type crossref. Conversion is local; it does not fetch Crossref records or look up PMIDs.

Metadata

Release files for biomed-article-converter 0.2.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 biomed-article-converter 0.2.0
File Size Uploaded Provenance Actions
biomed_article_converter-0.2.0.tar.gz 29.7 kB With provenance Details for biomed_article_converter-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for biomed-article-converter 0.2.0
File Interpreter ABI Platform Actions
biomed_article_converter-0.2.0-py3-none-any.whl Python 3 none any Details for biomed_article_converter-0.2.0-py3-none-any.whl

Total release size: 60.2 kB

Release files / biomed_article_converter-0.2.0.tar.gz

Download URL biomed_article_converter-0.2.0.tar.gz
Size 29.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2fe9e32fdb2bec330ae4e49e20771aa663936d0344e2b22143ab0fefa2563592
BLAKE2b-256 checksum
How to use checksums
71ce5dd870073e5d333567a61c51876350f98e625e50b36811a42dbf391735da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Release files / biomed_article_converter-0.2.0-py3-none-any.whl

Download URL biomed_article_converter-0.2.0-py3-none-any.whl
Size 30.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ddfa2e5c8355df2dab8f6641ccb70e7e817f0ec6534a18169dc3ca58bfc949ac
BLAKE2b-256 checksum
How to use checksums
c140a5f2abc7caddbed8dbcb2c0cfa820f8e84e526545a0194b4474b4143ef92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Security for biomed-article-converter 0.2.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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for biomed_article_converter-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

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