spirotrace 0.0.1__py3-none-any.whl

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.
spirotrace/__init__.py ADDED
@@ -0,0 +1,3 @@
1
+ """spirotrace: traceable extraction of lung function data from printed and scanned reports."""
2
+
3
+ __version__ = "0.0.1"
@@ -0,0 +1,5 @@
1
+ """Rule registry. Every check is a named rule with an id, a layer (ocr, range, layout, image, consistency, gli,
2
+ cohort, free_text), a severity and a one-sentence rationale, and can be switched off by name.
3
+
4
+ Not implemented yet.
5
+ """
spirotrace/cli.py ADDED
@@ -0,0 +1,32 @@
1
+ """Command line entry point: spirotrace <command>."""
2
+ import argparse
3
+ import sys
4
+
5
+ from . import __version__
6
+
7
+ COMMANDS = {
8
+ "init": "create a study project folder",
9
+ "run": "extract and check all reports in a project",
10
+ "review": "open the local review app",
11
+ "export": "write the dataset, data dictionary and QC report",
12
+ "template": "draft, test or survey a layout template",
13
+ "eval": "evaluate against a manually coded reference sample",
14
+ }
15
+
16
+
17
+ def main(argv=None):
18
+ ap = argparse.ArgumentParser(prog="spirotrace", description=__doc__)
19
+ ap.add_argument("--version", action="version", version=f"spirotrace {__version__}")
20
+ sub = ap.add_subparsers(dest="command", metavar="command")
21
+ for name, help_ in COMMANDS.items():
22
+ sub.add_parser(name, help=help_)
23
+ a = ap.parse_args(argv)
24
+ if a.command is None:
25
+ ap.print_help()
26
+ return 0
27
+ print(f"spirotrace {__version__}: '{a.command}' is not implemented yet.")
28
+ return 1
29
+
30
+
31
+ if __name__ == "__main__":
32
+ sys.exit(main())
@@ -0,0 +1,5 @@
1
+ """Derived variables computed from reviewed values only: GLI recalculation (rspiro), ATS/ERS 2022 pattern,
2
+ severity, PRISm, bronchodilator response. Each derived value records the observations it came from.
3
+
4
+ Not implemented yet.
5
+ """
@@ -0,0 +1,5 @@
1
+ """Reference-standard evaluation: sampling, coding sheets, agreement and adjudication, accuracy, flag
2
+ sensitivity and silent errors, ablation by check layer.
3
+
4
+ Not implemented yet.
5
+ """
@@ -0,0 +1,4 @@
1
+ """Read each PDF once: page rotation and deskew, the text layer or an OCR engine, page images; cached by file hash.
2
+
3
+ Not implemented yet.
4
+ """
@@ -0,0 +1,6 @@
1
+ """Layout templates (YAML: geometry and vocabulary only), page classification, table, field and free-text readers.
2
+
3
+ Behaviour belongs in Python: a layout quirk is a named, tested handler that a template switches on.
4
+
5
+ Not implemented yet.
6
+ """
@@ -0,0 +1,4 @@
1
+ """Masking and the export guard: everything written to share/ passes through here.
2
+
3
+ Not implemented yet.
4
+ """
@@ -0,0 +1,4 @@
1
+ """Local review app (served on 127.0.0.1 only). Every reviewer action is appended to an event log.
2
+
3
+ Not implemented yet.
4
+ """
@@ -0,0 +1,67 @@
1
+ Metadata-Version: 2.1
2
+ Name: spirotrace
3
+ Version: 0.0.1
4
+ Summary: Traceable extraction of lung function data from printed and scanned reports
5
+ Author: Kirsty Hawke
6
+ Project-URL: Homepage, https://github.com/hawkek/spirotrace
7
+ Project-URL: Issues, https://github.com/hawkek/spirotrace/issues
8
+ Keywords: spirometry,lung function,PDF extraction,OCR,data quality,GLI
9
+ Classifier: Development Status :: 1 - Planning
10
+ Classifier: Intended Audience :: Science/Research
11
+ Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Requires-Python: >=3.11
15
+ Description-Content-Type: text/markdown
16
+ Provides-Extra: dev
17
+ Requires-Dist: pytest >=7 ; extra == 'dev'
18
+
19
+ # spirotrace
20
+
21
+ **Traceable extraction of lung function data from printed and scanned reports.**
22
+
23
+ > Status: early development. Nothing here is ready for use yet. The working prototype that this package replaces is not public; this repository is being built up from it module by module, with tests.
24
+
25
+ ## Statement of need
26
+
27
+ Lung function results (spirometry, lung volumes, gas transfer) often reach researchers only as printed or scanned PDF reports, not as structured data. Typing them by hand is slow and error-prone, and generic PDF or OCR extraction gives values with no indication of which ones are wrong.
28
+
29
+ spirotrace turns such reports into an audited, analysis-ready dataset with a measured error rate:
30
+
31
+ - **Extraction.** Report layouts are described in template files (geometry and vocabulary); one reader handles every layout.
32
+ - **Auditability.** Every value keeps its raw text, its position on the page, how it was read, and every human correction made to it (who, when, before, after).
33
+ - **Physiology-informed checks.** Values are checked against each other and against reference equations (for example, the printed z-score against a GLI recalculation, FEV1/FVC against FEV1 and FVC, LLN against the sign of the z-score), so errors that look like plausible numbers are still caught.
34
+ - **Measured reliability.** Built-in tools compare the extraction with a blinded manual reference sample and report accuracy, flag sensitivity and residual (silent) errors.
35
+ - **Local by default.** Everything runs on the user's machine. Nothing is uploaded; there is no telemetry.
36
+
37
+ Similar tools exist ([PFT-Extractor](https://github.com/lindseyboulet/PFT-Extractor), an R app for Vmax reports; [pft-extractor](https://github.com/Automate-Medical/pft-extractor), a cloud pipeline using Amazon Textract). Neither describes validation of the extracted values or detection of extraction errors.
38
+
39
+ ## Planned scope
40
+
41
+ | Tier | Contents |
42
+ | --- | --- |
43
+ | Research MVP | Two report layouts, deterministic extraction, provenance on every value, core checks, review corrections as an event log, derived variables (ATS/ERS 2022 pattern, severity, PRISm, bronchodilator response) after review, GLI recalculation via [rspiro](https://cran.r-project.org/package=rspiro), reference-standard evaluation |
44
+ | v1.0 | Add-your-own layout templates, a local browser review app, documentation |
45
+ | Later | Installers for non-programmers, template editor, further OCR engines |
46
+
47
+ ## Data protection
48
+
49
+ spirotrace is meant for clinical reports. Please:
50
+
51
+ - **never** attach a report, a screenshot of one, or extracted values to an issue or pull request;
52
+ - report layout problems with the masked, structure-only survey output instead (instructions will be in the docs);
53
+ - check that your ethics and data-access approvals cover your use.
54
+
55
+ Outputs written to a project's `share/` folder are masked or aggregate by default. Whether any file may be shared is a decision for your study's governance, not something the software can certify.
56
+
57
+ ## Installation
58
+
59
+ Not yet. When the first usable release is out: `pip install spirotrace`.
60
+
61
+ ## Citation
62
+
63
+ See [CITATION.cff](CITATION.cff). A software paper is planned.
64
+
65
+ ## Licence
66
+
67
+ To be confirmed (an OSI-approved permissive licence is intended).
@@ -0,0 +1,14 @@
1
+ spirotrace/__init__.py,sha256=f144UATiXymL2-1UxOOP1mQpmW6MZxNnwoVc4E6OOlg,118
2
+ spirotrace/cli.py,sha256=VtT9I4Etqq8fj90gQaYmZb9zg8Zzhd-Nmkk9POnNhig,1025
3
+ spirotrace/checks/__init__.py,sha256=hmOqjq1o5xTFArp8ONF8ZhWgOxkkFt03Wi223ia18Po,232
4
+ spirotrace/derive/__init__.py,sha256=VIn8WKuBlNLXdwwSUzO37SqPRqtal2IPTaD6dLz36pg,233
5
+ spirotrace/evaluate/__init__.py,sha256=zM-CwRzddPtoMqt1Zzur-dZtArBJs6YhxmympqlfyoI,184
6
+ spirotrace/ingest/__init__.py,sha256=lthu3IhWeX5L_KW6UoSGKWpdwKBGwPlrWxYZYr6BcYo,142
7
+ spirotrace/layouts/__init__.py,sha256=EwxDPzv5Si4KLKi4hJkR-7l4yYVUGoT4xZvkKI0bXJM,242
8
+ spirotrace/privacy/__init__.py,sha256=r4Y9YbeWSnfOGUhsKRJKZo9bC0f2jbLXW4qEWvJk-qg,109
9
+ spirotrace/review/__init__.py,sha256=wKKZyABHWFVxl8CtrjPu2E29clI53KqdLQB4jBS7oKE,125
10
+ spirotrace-0.0.1.dist-info/METADATA,sha256=Rfr0Lfo3Efg7w18IAcigaSm7MmhdCSgvU4Y7lHiXCdU,3993
11
+ spirotrace-0.0.1.dist-info/WHEEL,sha256=uJjSjqPgdWYN2DV9Rmm5KOx1XdVgjoWyzqfTL-hbUxM,91
12
+ spirotrace-0.0.1.dist-info/entry_points.txt,sha256=pqlOwDoV-QMhOJggyWl2sil1LIe-NW5r-SjyEUkpgbs,51
13
+ spirotrace-0.0.1.dist-info/top_level.txt,sha256=LDUMb2gQyG31_uwRw_IZZ0AHPmIKIzT1BnJxAexPEIA,11
14
+ spirotrace-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (68.1.2)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ spirotrace = spirotrace.cli:main
@@ -0,0 +1 @@
1
+ spirotrace