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.

Metadata

Release files for biomed-article-converter 0.1.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.1.0
File Size Uploaded Provenance Actions
biomed_article_converter-0.1.0.tar.gz 27.0 kB With provenance Details for biomed_article_converter-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 54.5 kB

Release files / biomed_article_converter-0.1.0.tar.gz

Download URL biomed_article_converter-0.1.0.tar.gz
Size 27.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c62edc5ca4eaa60611f8f52993d2e3994d5dffd56d789b4570827db07bb55676
BLAKE2b-256 checksum
How to use checksums
d5b1788ed765fb01a2ec49aa1028fd424732b7cf5524d59bff840a64c58f1033
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 6, 2026.

Transparency log

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

Download URL biomed_article_converter-0.1.0-py3-none-any.whl
Size 27.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e2db542050843701dd8c1fb33446ba5c9e4428c8cff0e4399e750a6a83e2cb61
BLAKE2b-256 checksum
How to use checksums
5f2301d37b67c9cb664d2fcee6aa01906233579e38a2300e8fcf6b56a2d3104c
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 6, 2026.

Transparency log

Security for biomed-article-converter 0.1.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.1.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 6, 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.1.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