Skip to main content

Lightweight Python tools for generating PRISMA-style flow diagrams without system dependencies.

Project description

prisma-flow

CI Python Versions Package Version License

prisma-flow is a lightweight Python package for generating PRISMA-style flow diagrams for evidence synthesis workflows.

Unlike Graphviz-based tools, prisma-flow does not require system-level graph layout binaries. Unlike Mermaid-based tools, it does not require Node or Mermaid CLI. The default renderer is a pure-Python, template-based SVG generator.

The project is designed for systematic reviews, scoping reviews, evidence syntheses, and literature review workflows.

Features

  • Pure-Python SVG rendering by default
  • Standalone HTML export
  • Mermaid text export without Mermaid CLI
  • JSON input/output in the base install
  • Optional YAML input/output via prisma-flow[yaml]
  • Optional PNG method that clearly reports the missing optional dependency
  • Python API and prisma-flow command-line interface
  • PRISMA count validation with errors and warnings

Installation

pip install prisma-flow

or:

uv add prisma-flow

Optional YAML support:

uv add "prisma-flow[yaml]"

Optional PNG support, when a supported backend is added:

uv add "prisma-flow[png]"

Python API

from prismaflow import PrismaFlow

flow = PrismaFlow.new_review(
    records_identified_databases=1240,
    records_identified_registers=50,
    records_removed_duplicates=210,
    records_removed_automation=0,
    records_removed_other=0,
    records_screened=1080,
    records_excluded=950,
    reports_sought=130,
    reports_not_retrieved=10,
    reports_assessed=120,
    reports_excluded={
        "Wrong population": 30,
        "Wrong intervention": 20,
        "Wrong outcome": 15,
        "Not primary research": 15,
    },
    studies_included=40,
)

report = flow.validate()
print(report.format_text())

flow.to_svg("prisma.svg")
flow.to_html("prisma.html")
flow.to_mermaid("prisma.mmd")
flow.to_json("review.json")

CLI usage

Validate input data:

prisma-flow validate examples/basic_new_review.json

Render SVG:

prisma-flow render examples/basic_new_review.json -o prisma.svg

Render other base-install formats:

prisma-flow render examples/basic_new_review.json --format html -o prisma.html
prisma-flow render examples/basic_new_review.json --format mermaid -o prisma.mmd

If validation fails, the CLI prints a report and exits with a non-zero status:

Validation failed:
- records_screened should equal identified records minus removed records. Expected: 1080 Found: 1090

Data model

The v0.1 implementation supports the PRISMA 2020 new-review databases/registers template:

from prismaflow import (
    EligibilityStage,
    IdentificationStage,
    IncludedStage,
    PrismaFlow,
    PrismaTemplate,
    ScreeningStage,
)

flow = PrismaFlow(
    template=PrismaTemplate.PRISMA_2020_NEW_DATABASES_REGISTERS,
    identification=IdentificationStage(
        records_identified_databases=1240,
        records_identified_registers=50,
    ),
    screening=ScreeningStage(
        records_removed_duplicates=210,
        records_removed_automation=0,
        records_removed_other=0,
        records_screened=1080,
        records_excluded=950,
    ),
    eligibility=EligibilityStage(
        reports_sought=130,
        reports_not_retrieved=10,
        reports_assessed=120,
        reports_excluded={"Wrong population": 30},
    ),
    included=IncludedStage(studies_included=40),
)

Dependency policy

SVG, HTML, Mermaid, and JSON work with the base install. YAML is optional. PNG is intentionally optional and not implemented as a required renderer in v0.1.

The package does not require Graphviz, Cairo, CairoSVG, Node, Mermaid CLI, Inkscape, Playwright, browser engines, Matplotlib, or Plotly.

Development

conda env create -f conda/dev.yaml
conda activate prismaflow
poetry config virtualenvs.create false
poetry install --extras "dev yaml"

Run the same workflow through Makim:

makim tests.linter
makim tests.unit
makim package.build
makim docs.build
makim all.ci

Documentation

The documentation site is built with Quarto:

quarto render docs

Preview locally:

quarto preview docs

License

BSD-3-Clause.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

prisma_flow-0.1.2.tar.gz (18.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prisma_flow-0.1.2-py3-none-any.whl (25.3 kB view details)

Uploaded Python 3

File details

Details for the file prisma_flow-0.1.2.tar.gz.

File metadata

  • Download URL: prisma_flow-0.1.2.tar.gz
  • Upload date:
  • Size: 18.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.13.13 Linux/6.17.0-1013-azure

File hashes

Hashes for prisma_flow-0.1.2.tar.gz
Algorithm Hash digest
SHA256 7cd69b05363706dd33067fee609b899049be24bba8c752254986741d6ddb1191
MD5 e2b1604d381fa0de2486d28c1d223ab5
BLAKE2b-256 c36d980d0f8bdf327bdd80b8c9fa266f2b01b0086d372b08b9d7bfbeb3589651

See more details on using hashes here.

File details

Details for the file prisma_flow-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: prisma_flow-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 25.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.13.13 Linux/6.17.0-1013-azure

File hashes

Hashes for prisma_flow-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ee08bf7c65aaa8700d0c48e4a0a39a7a187cf9973539f0c8f1046b9be36be326
MD5 025edc4242bd692ffa681836a662a2e7
BLAKE2b-256 40d63a13d70aeb9d4af4fb6e5c1d4e047af4f60ad6a60395fc67c2ddcb43792a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page