prisma-flow 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,28 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2026, Open Science Labs Incubator
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,236 @@
1
+ Metadata-Version: 2.4
2
+ Name: prisma-flow
3
+ Version: 0.1.1
4
+ Summary: Lightweight Python tools for generating PRISMA-style flow diagrams without system dependencies.
5
+ License-Expression: BSD-3-Clause
6
+ License-File: LICENSE
7
+ Keywords: prisma,systematic-review,scoping-review,evidence-synthesis,literature-review,svg,python,open-science
8
+ Author: Open Science Labs Incubator contributors
9
+ Requires-Python: >=3.10,<4
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: Intended Audience :: Healthcare Industry
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Scientific/Engineering
19
+ Classifier: Topic :: Text Processing :: Markup
20
+ Provides-Extra: dev
21
+ Provides-Extra: docs
22
+ Provides-Extra: png
23
+ Provides-Extra: yaml
24
+ Requires-Dist: douki (>=0.12.1) ; extra == "dev"
25
+ Requires-Dist: makim (==1.29.0) ; extra == "dev"
26
+ Requires-Dist: mypy (>=1.10) ; extra == "dev"
27
+ Requires-Dist: pre-commit (>=3) ; extra == "dev"
28
+ Requires-Dist: pydantic (>=2)
29
+ Requires-Dist: pytest (>=8) ; extra == "dev"
30
+ Requires-Dist: pytest-cov (>=5) ; extra == "dev"
31
+ Requires-Dist: pyyaml (>=6) ; extra == "yaml"
32
+ Requires-Dist: resvg (>=0.1.2) ; extra == "png"
33
+ Requires-Dist: ruff (>=0.6) ; extra == "dev"
34
+ Project-URL: Documentation, https://osl-incubator.github.io/prisma-flow/
35
+ Project-URL: Homepage, https://github.com/osl-incubator/prisma-flow
36
+ Project-URL: Issues, https://github.com/osl-incubator/prisma-flow/issues
37
+ Project-URL: Repository, https://github.com/osl-incubator/prisma-flow
38
+ Description-Content-Type: text/markdown
39
+
40
+ # prisma-flow
41
+
42
+ ![CI](https://img.shields.io/github/actions/workflow/status/osl-incubator/prisma-flow/ci.yml?logo=github&label=CI)
43
+ [![Python Versions](https://img.shields.io/pypi/pyversions/prisma-flow)](https://pypi.org/project/prisma-flow/)
44
+ [![Package Version](https://img.shields.io/pypi/v/prisma-flow?color=blue)](https://pypi.org/project/prisma-flow/)
45
+ ![License](https://img.shields.io/pypi/l/prisma-flow?color=blue)
46
+
47
+ `prisma-flow` is a lightweight Python package for generating PRISMA-style flow
48
+ diagrams for evidence synthesis workflows.
49
+
50
+ Unlike Graphviz-based tools, `prisma-flow` does not require system-level graph
51
+ layout binaries. Unlike Mermaid-based tools, it does not require Node or Mermaid
52
+ CLI. The default renderer is a pure-Python, template-based SVG generator.
53
+
54
+ The project is designed for systematic reviews, scoping reviews, evidence
55
+ syntheses, and literature review workflows.
56
+
57
+ ## Features
58
+
59
+ - Pure-Python SVG rendering by default
60
+ - Standalone HTML export
61
+ - Mermaid text export without Mermaid CLI
62
+ - JSON input/output in the base install
63
+ - Optional YAML input/output via `prisma-flow[yaml]`
64
+ - Optional PNG method that clearly reports the missing optional dependency
65
+ - Python API and `prisma-flow` command-line interface
66
+ - PRISMA count validation with errors and warnings
67
+
68
+ ## Installation
69
+
70
+ ```bash
71
+ pip install prisma-flow
72
+ ```
73
+
74
+ or:
75
+
76
+ ```bash
77
+ uv add prisma-flow
78
+ ```
79
+
80
+ Optional YAML support:
81
+
82
+ ```bash
83
+ uv add "prisma-flow[yaml]"
84
+ ```
85
+
86
+ Optional PNG support, when a supported backend is added:
87
+
88
+ ```bash
89
+ uv add "prisma-flow[png]"
90
+ ```
91
+
92
+ ## Python API
93
+
94
+ ```python
95
+ from prismaflow import PrismaFlow
96
+
97
+ flow = PrismaFlow.new_review(
98
+ records_identified_databases=1240,
99
+ records_identified_registers=50,
100
+ records_removed_duplicates=210,
101
+ records_removed_automation=0,
102
+ records_removed_other=0,
103
+ records_screened=1080,
104
+ records_excluded=950,
105
+ reports_sought=130,
106
+ reports_not_retrieved=10,
107
+ reports_assessed=120,
108
+ reports_excluded={
109
+ "Wrong population": 30,
110
+ "Wrong intervention": 20,
111
+ "Wrong outcome": 15,
112
+ "Not primary research": 15,
113
+ },
114
+ studies_included=40,
115
+ )
116
+
117
+ report = flow.validate()
118
+ print(report.format_text())
119
+
120
+ flow.to_svg("prisma.svg")
121
+ flow.to_html("prisma.html")
122
+ flow.to_mermaid("prisma.mmd")
123
+ flow.to_json("review.json")
124
+ ```
125
+
126
+ ## CLI usage
127
+
128
+ Validate input data:
129
+
130
+ ```bash
131
+ prisma-flow validate examples/basic_new_review.json
132
+ ```
133
+
134
+ Render SVG:
135
+
136
+ ```bash
137
+ prisma-flow render examples/basic_new_review.json -o prisma.svg
138
+ ```
139
+
140
+ Render other base-install formats:
141
+
142
+ ```bash
143
+ prisma-flow render examples/basic_new_review.json --format html -o prisma.html
144
+ prisma-flow render examples/basic_new_review.json --format mermaid -o prisma.mmd
145
+ ```
146
+
147
+ If validation fails, the CLI prints a report and exits with a non-zero status:
148
+
149
+ ```text
150
+ Validation failed:
151
+ - records_screened should equal identified records minus removed records. Expected: 1080 Found: 1090
152
+ ```
153
+
154
+ ## Data model
155
+
156
+ The v0.1 implementation supports the PRISMA 2020 new-review databases/registers
157
+ template:
158
+
159
+ ```python
160
+ from prismaflow import (
161
+ EligibilityStage,
162
+ IdentificationStage,
163
+ IncludedStage,
164
+ PrismaFlow,
165
+ PrismaTemplate,
166
+ ScreeningStage,
167
+ )
168
+
169
+ flow = PrismaFlow(
170
+ template=PrismaTemplate.PRISMA_2020_NEW_DATABASES_REGISTERS,
171
+ identification=IdentificationStage(
172
+ records_identified_databases=1240,
173
+ records_identified_registers=50,
174
+ ),
175
+ screening=ScreeningStage(
176
+ records_removed_duplicates=210,
177
+ records_removed_automation=0,
178
+ records_removed_other=0,
179
+ records_screened=1080,
180
+ records_excluded=950,
181
+ ),
182
+ eligibility=EligibilityStage(
183
+ reports_sought=130,
184
+ reports_not_retrieved=10,
185
+ reports_assessed=120,
186
+ reports_excluded={"Wrong population": 30},
187
+ ),
188
+ included=IncludedStage(studies_included=40),
189
+ )
190
+ ```
191
+
192
+ ## Dependency policy
193
+
194
+ SVG, HTML, Mermaid, and JSON work with the base install. YAML is optional. PNG
195
+ is intentionally optional and not implemented as a required renderer in v0.1.
196
+
197
+ The package does **not** require Graphviz, Cairo, CairoSVG, Node, Mermaid CLI,
198
+ Inkscape, Playwright, browser engines, Matplotlib, or Plotly.
199
+
200
+ ## Development
201
+
202
+ ```bash
203
+ conda env create -f conda/dev.yaml
204
+ conda activate prismaflow
205
+ poetry config virtualenvs.create false
206
+ poetry install --extras "dev yaml"
207
+ ```
208
+
209
+ Run the same workflow through Makim:
210
+
211
+ ```bash
212
+ makim tests.linter
213
+ makim tests.unit
214
+ makim package.build
215
+ makim docs.build
216
+ makim all.ci
217
+ ```
218
+
219
+ ## Documentation
220
+
221
+ The documentation site is built with Quarto:
222
+
223
+ ```bash
224
+ quarto render docs
225
+ ```
226
+
227
+ Preview locally:
228
+
229
+ ```bash
230
+ quarto preview docs
231
+ ```
232
+
233
+ ## License
234
+
235
+ BSD-3-Clause.
236
+
@@ -0,0 +1,196 @@
1
+ # prisma-flow
2
+
3
+ ![CI](https://img.shields.io/github/actions/workflow/status/osl-incubator/prisma-flow/ci.yml?logo=github&label=CI)
4
+ [![Python Versions](https://img.shields.io/pypi/pyversions/prisma-flow)](https://pypi.org/project/prisma-flow/)
5
+ [![Package Version](https://img.shields.io/pypi/v/prisma-flow?color=blue)](https://pypi.org/project/prisma-flow/)
6
+ ![License](https://img.shields.io/pypi/l/prisma-flow?color=blue)
7
+
8
+ `prisma-flow` is a lightweight Python package for generating PRISMA-style flow
9
+ diagrams for evidence synthesis workflows.
10
+
11
+ Unlike Graphviz-based tools, `prisma-flow` does not require system-level graph
12
+ layout binaries. Unlike Mermaid-based tools, it does not require Node or Mermaid
13
+ CLI. The default renderer is a pure-Python, template-based SVG generator.
14
+
15
+ The project is designed for systematic reviews, scoping reviews, evidence
16
+ syntheses, and literature review workflows.
17
+
18
+ ## Features
19
+
20
+ - Pure-Python SVG rendering by default
21
+ - Standalone HTML export
22
+ - Mermaid text export without Mermaid CLI
23
+ - JSON input/output in the base install
24
+ - Optional YAML input/output via `prisma-flow[yaml]`
25
+ - Optional PNG method that clearly reports the missing optional dependency
26
+ - Python API and `prisma-flow` command-line interface
27
+ - PRISMA count validation with errors and warnings
28
+
29
+ ## Installation
30
+
31
+ ```bash
32
+ pip install prisma-flow
33
+ ```
34
+
35
+ or:
36
+
37
+ ```bash
38
+ uv add prisma-flow
39
+ ```
40
+
41
+ Optional YAML support:
42
+
43
+ ```bash
44
+ uv add "prisma-flow[yaml]"
45
+ ```
46
+
47
+ Optional PNG support, when a supported backend is added:
48
+
49
+ ```bash
50
+ uv add "prisma-flow[png]"
51
+ ```
52
+
53
+ ## Python API
54
+
55
+ ```python
56
+ from prismaflow import PrismaFlow
57
+
58
+ flow = PrismaFlow.new_review(
59
+ records_identified_databases=1240,
60
+ records_identified_registers=50,
61
+ records_removed_duplicates=210,
62
+ records_removed_automation=0,
63
+ records_removed_other=0,
64
+ records_screened=1080,
65
+ records_excluded=950,
66
+ reports_sought=130,
67
+ reports_not_retrieved=10,
68
+ reports_assessed=120,
69
+ reports_excluded={
70
+ "Wrong population": 30,
71
+ "Wrong intervention": 20,
72
+ "Wrong outcome": 15,
73
+ "Not primary research": 15,
74
+ },
75
+ studies_included=40,
76
+ )
77
+
78
+ report = flow.validate()
79
+ print(report.format_text())
80
+
81
+ flow.to_svg("prisma.svg")
82
+ flow.to_html("prisma.html")
83
+ flow.to_mermaid("prisma.mmd")
84
+ flow.to_json("review.json")
85
+ ```
86
+
87
+ ## CLI usage
88
+
89
+ Validate input data:
90
+
91
+ ```bash
92
+ prisma-flow validate examples/basic_new_review.json
93
+ ```
94
+
95
+ Render SVG:
96
+
97
+ ```bash
98
+ prisma-flow render examples/basic_new_review.json -o prisma.svg
99
+ ```
100
+
101
+ Render other base-install formats:
102
+
103
+ ```bash
104
+ prisma-flow render examples/basic_new_review.json --format html -o prisma.html
105
+ prisma-flow render examples/basic_new_review.json --format mermaid -o prisma.mmd
106
+ ```
107
+
108
+ If validation fails, the CLI prints a report and exits with a non-zero status:
109
+
110
+ ```text
111
+ Validation failed:
112
+ - records_screened should equal identified records minus removed records. Expected: 1080 Found: 1090
113
+ ```
114
+
115
+ ## Data model
116
+
117
+ The v0.1 implementation supports the PRISMA 2020 new-review databases/registers
118
+ template:
119
+
120
+ ```python
121
+ from prismaflow import (
122
+ EligibilityStage,
123
+ IdentificationStage,
124
+ IncludedStage,
125
+ PrismaFlow,
126
+ PrismaTemplate,
127
+ ScreeningStage,
128
+ )
129
+
130
+ flow = PrismaFlow(
131
+ template=PrismaTemplate.PRISMA_2020_NEW_DATABASES_REGISTERS,
132
+ identification=IdentificationStage(
133
+ records_identified_databases=1240,
134
+ records_identified_registers=50,
135
+ ),
136
+ screening=ScreeningStage(
137
+ records_removed_duplicates=210,
138
+ records_removed_automation=0,
139
+ records_removed_other=0,
140
+ records_screened=1080,
141
+ records_excluded=950,
142
+ ),
143
+ eligibility=EligibilityStage(
144
+ reports_sought=130,
145
+ reports_not_retrieved=10,
146
+ reports_assessed=120,
147
+ reports_excluded={"Wrong population": 30},
148
+ ),
149
+ included=IncludedStage(studies_included=40),
150
+ )
151
+ ```
152
+
153
+ ## Dependency policy
154
+
155
+ SVG, HTML, Mermaid, and JSON work with the base install. YAML is optional. PNG
156
+ is intentionally optional and not implemented as a required renderer in v0.1.
157
+
158
+ The package does **not** require Graphviz, Cairo, CairoSVG, Node, Mermaid CLI,
159
+ Inkscape, Playwright, browser engines, Matplotlib, or Plotly.
160
+
161
+ ## Development
162
+
163
+ ```bash
164
+ conda env create -f conda/dev.yaml
165
+ conda activate prismaflow
166
+ poetry config virtualenvs.create false
167
+ poetry install --extras "dev yaml"
168
+ ```
169
+
170
+ Run the same workflow through Makim:
171
+
172
+ ```bash
173
+ makim tests.linter
174
+ makim tests.unit
175
+ makim package.build
176
+ makim docs.build
177
+ makim all.ci
178
+ ```
179
+
180
+ ## Documentation
181
+
182
+ The documentation site is built with Quarto:
183
+
184
+ ```bash
185
+ quarto render docs
186
+ ```
187
+
188
+ Preview locally:
189
+
190
+ ```bash
191
+ quarto preview docs
192
+ ```
193
+
194
+ ## License
195
+
196
+ BSD-3-Clause.
@@ -0,0 +1,121 @@
1
+ [project]
2
+ name = "prisma-flow"
3
+ version = "0.1.1" # semantic-release
4
+ description = "Lightweight Python tools for generating PRISMA-style flow diagrams without system dependencies."
5
+ readme = "README.md"
6
+ requires-python = ">=3.10,<4"
7
+ license = "BSD-3-Clause"
8
+ authors = [
9
+ { name = "Open Science Labs Incubator contributors" }
10
+ ]
11
+ keywords = [
12
+ "prisma",
13
+ "systematic-review",
14
+ "scoping-review",
15
+ "evidence-synthesis",
16
+ "literature-review",
17
+ "svg",
18
+ "python",
19
+ "open-science",
20
+ ]
21
+ classifiers = [
22
+ "Development Status :: 3 - Alpha",
23
+ "Intended Audience :: Science/Research",
24
+ "Intended Audience :: Healthcare Industry",
25
+ "Programming Language :: Python :: 3",
26
+ "Programming Language :: Python :: 3.10",
27
+ "Programming Language :: Python :: 3.11",
28
+ "Programming Language :: Python :: 3.12",
29
+ "Programming Language :: Python :: 3.13",
30
+ "Topic :: Scientific/Engineering",
31
+ "Topic :: Text Processing :: Markup",
32
+ ]
33
+ dependencies = [
34
+ "pydantic>=2",
35
+ ]
36
+
37
+ [project.urls]
38
+ Homepage = "https://github.com/osl-incubator/prisma-flow"
39
+ Repository = "https://github.com/osl-incubator/prisma-flow"
40
+ Issues = "https://github.com/osl-incubator/prisma-flow/issues"
41
+ Documentation = "https://osl-incubator.github.io/prisma-flow/"
42
+
43
+ [project.optional-dependencies]
44
+ yaml = ["pyyaml>=6"]
45
+ png = ["resvg>=0.1.2"]
46
+ dev = [
47
+ "douki>=0.12.1",
48
+ "pytest>=8",
49
+ "pytest-cov>=5",
50
+ "ruff>=0.6",
51
+ "mypy>=1.10",
52
+ "pre-commit>=3",
53
+ "makim==1.29.0",
54
+ ]
55
+ docs = []
56
+
57
+
58
+ [tool.poetry.group.dev.dependencies]
59
+ quarto-cli = ">=1.9.0"
60
+ pyyaml = ">=6"
61
+ resvg = ">=0.1.2"
62
+ douki = ">=0.12.1"
63
+ pytest = ">=8"
64
+ pytest-cov = ">=5"
65
+ ruff = ">=0.6"
66
+ mypy = ">=1.10"
67
+ pre-commit = ">=3"
68
+ makim = "==1.29.0"
69
+
70
+ [project.scripts]
71
+ prisma-flow = "prismaflow.cli:main"
72
+
73
+ [build-system]
74
+ requires = ["poetry-core>=2"]
75
+ build-backend = "poetry.core.masonry.api"
76
+
77
+ [tool.poetry]
78
+ packages = [
79
+ { include = "prismaflow", from = "src" },
80
+ ]
81
+ include = [
82
+ "src/prismaflow/py.typed",
83
+ ]
84
+
85
+ [tool.ruff]
86
+ line-length = 88
87
+ target-version = "py310"
88
+ src = ["src", "tests"]
89
+
90
+ [tool.ruff.lint]
91
+ select = [
92
+ "E",
93
+ "F",
94
+ "I",
95
+ "UP",
96
+ "B",
97
+ "RUF",
98
+ ]
99
+ ignore = [
100
+ "D203",
101
+ "D213",
102
+ ]
103
+
104
+ [tool.ruff.lint.per-file-ignores]
105
+ "tests/**" = ["D"]
106
+ "src/prismaflow/cli.py" = ["B008"]
107
+
108
+ [tool.ruff.format]
109
+ quote-style = "double"
110
+
111
+ [tool.pytest.ini_options]
112
+ testpaths = ["tests"]
113
+ addopts = "-ra"
114
+
115
+ [tool.mypy]
116
+ python_version = "3.10"
117
+ strict = true
118
+ warn_unused_ignores = true
119
+ warn_redundant_casts = true
120
+ warn_unused_configs = true
121
+ show_error_codes = true
@@ -0,0 +1,40 @@
1
+ """
2
+ title: Lightweight PRISMA-style flow diagram generation.
3
+ """
4
+
5
+ from prismaflow.enums import PrismaTemplate
6
+ from prismaflow.exceptions import (
7
+ OptionalDependencyError,
8
+ PrismaFlowError,
9
+ PrismaValidationError,
10
+ TemplateNotSupportedError,
11
+ )
12
+ from prismaflow.models import (
13
+ EligibilityStage,
14
+ FlowMetadata,
15
+ IdentificationStage,
16
+ IncludedStage,
17
+ PrismaFlow,
18
+ ScreeningStage,
19
+ )
20
+ from prismaflow.validation import ValidationMessage, ValidationReport, validate_flow
21
+
22
+ __version__ = "0.1.1" # semantic-release
23
+
24
+ __all__ = [
25
+ "EligibilityStage",
26
+ "FlowMetadata",
27
+ "IdentificationStage",
28
+ "IncludedStage",
29
+ "OptionalDependencyError",
30
+ "PrismaFlow",
31
+ "PrismaFlowError",
32
+ "PrismaTemplate",
33
+ "PrismaValidationError",
34
+ "ScreeningStage",
35
+ "TemplateNotSupportedError",
36
+ "ValidationMessage",
37
+ "ValidationReport",
38
+ "__version__",
39
+ "validate_flow",
40
+ ]