structa-maestro 0.2.0__tar.gz → 0.2.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.
Files changed (57) hide show
  1. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/CHANGELOG.md +7 -0
  2. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/PKG-INFO +58 -47
  3. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/README.md +52 -46
  4. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/pyproject.toml +8 -1
  5. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/__init__.py +1 -1
  6. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/.gitignore +0 -0
  7. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/LICENSE +0 -0
  8. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/SECURITY.md +0 -0
  9. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/batch.py +0 -0
  10. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/binding.py +0 -0
  11. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/builder/__init__.py +0 -0
  12. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/builder/result_builder.py +0 -0
  13. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/cli.py +0 -0
  14. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/confidence/__init__.py +0 -0
  15. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/confidence/calibration.py +0 -0
  16. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/confidence/normalizer.py +0 -0
  17. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/config.py +0 -0
  18. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/contracts/__init__.py +0 -0
  19. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/contracts/enums.py +0 -0
  20. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/contracts/models.py +0 -0
  21. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/contracts/serialization.py +0 -0
  22. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/documents/__init__.py +0 -0
  23. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/documents/docx_parser.py +0 -0
  24. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/documents/eml_parser.py +0 -0
  25. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/documents/html_parser.py +0 -0
  26. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/documents/inputs.py +0 -0
  27. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/documents/loader.py +0 -0
  28. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/documents/markdown_parser.py +0 -0
  29. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/documents/models.py +0 -0
  30. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/documents/normalization.py +0 -0
  31. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/documents/pdf_parser.py +0 -0
  32. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/documents/txt_parser.py +0 -0
  33. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/engine.py +0 -0
  34. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/exceptions.py +0 -0
  35. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/provenance/__init__.py +0 -0
  36. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/provenance/associator.py +0 -0
  37. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/py.typed +0 -0
  38. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/review.py +0 -0
  39. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/schema/__init__.py +0 -0
  40. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/schema/loader.py +0 -0
  41. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/schema/models.py +0 -0
  42. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/schema/pydantic_adapter.py +0 -0
  43. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/schema/rules.py +0 -0
  44. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/schema/serializer.py +0 -0
  45. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/strategies/__init__.py +0 -0
  46. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/strategies/base.py +0 -0
  47. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/strategies/llm_anthropic.py +0 -0
  48. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/strategies/llm_config.py +0 -0
  49. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/strategies/llm_gemini.py +0 -0
  50. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/strategies/llm_helpers.py +0 -0
  51. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/strategies/llm_openai_compat.py +0 -0
  52. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/strategies/schema_compiler.py +0 -0
  53. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/strategies/testing.py +0 -0
  54. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/telemetry.py +0 -0
  55. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/validation/__init__.py +0 -0
  56. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/validation/cross_field.py +0 -0
  57. {structa_maestro-0.2.0 → structa_maestro-0.2.1}/src/structa_maestro/validation/validator.py +0 -0
@@ -6,6 +6,13 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.2.1] - 2026-11-27
10
+
11
+ ### Changed
12
+ - **PyPI Project Page & README Polish**:
13
+ - Added `[project.urls]` (`Homepage`, `Repository`, `Documentation`, `Changelog`, `Issues`) to `pyproject.toml` so PyPI sidebar links populate cleanly.
14
+ - Added PyPI version badge to `README.md`, converted all relative repository links to absolute GitHub URLs so links work on both GitHub and PyPI, and replaced GitHub-only `mermaid` and `[!...]` alert syntax in `README.md` with universally rendered plain-text architecture flow and bold callouts.
15
+
9
16
  ## [0.2.0] - 2026-11-26
10
17
 
11
18
  ### Added
@@ -1,7 +1,12 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: structa-maestro
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Structured data extraction engine transforming unstructured documents into validated, traceable canonical records.
5
+ Project-URL: Homepage, https://github.com/ivnmoreno/structa-maestro
6
+ Project-URL: Repository, https://github.com/ivnmoreno/structa-maestro
7
+ Project-URL: Documentation, https://github.com/ivnmoreno/structa-maestro/blob/main/docs/api.md
8
+ Project-URL: Changelog, https://github.com/ivnmoreno/structa-maestro/blob/main/CHANGELOG.md
9
+ Project-URL: Issues, https://github.com/ivnmoreno/structa-maestro/issues
5
10
  Author: structa-maestro contributors
6
11
  License: MIT License
7
12
 
@@ -53,15 +58,16 @@ Description-Content-Type: text/markdown
53
58
 
54
59
  # structa-maestro
55
60
 
61
+ [![PyPI version](https://img.shields.io/pypi/v/structa-maestro.svg)](https://pypi.org/project/structa-maestro/)
56
62
  [![CI](https://github.com/ivnmoreno/structa-maestro/actions/workflows/ci.yml/badge.svg)](https://github.com/ivnmoreno/structa-maestro/actions/workflows/ci.yml)
57
63
  [![Formal Assurance](https://github.com/ivnmoreno/structa-maestro/actions/workflows/formal-assurance.yml/badge.svg)](https://github.com/ivnmoreno/structa-maestro/actions/workflows/formal-assurance.yml)
58
64
  [![Security](https://github.com/ivnmoreno/structa-maestro/actions/workflows/security.yml/badge.svg)](https://github.com/ivnmoreno/structa-maestro/actions/workflows/security.yml)
59
65
  [![Evaluation](https://github.com/ivnmoreno/structa-maestro/actions/workflows/evaluation.yml/badge.svg)](https://github.com/ivnmoreno/structa-maestro/actions/workflows/evaluation.yml)
60
66
  [![Python 3.11+](https://img.shields.io/badge/python-3.11%2B-blue.svg)](https://www.python.org/downloads/)
61
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
67
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/ivnmoreno/structa-maestro/blob/main/LICENSE)
62
68
  [![Code Style: Ruff](https://img.shields.io/badge/code%20style-ruff-000000.svg)](https://github.com/astral-sh/ruff)
63
69
  [![Type Checked: mypy](https://img.shields.io/badge/type%20checked-mypy-blue.svg)](https://mypy-lang.org/)
64
- [![Formal Verification: Lean 4](https://img.shields.io/badge/formal%20verification-Lean%204-blueviolet.svg)](docs/formal-assurance.md)
70
+ [![Formal Verification: Lean 4](https://img.shields.io/badge/formal%20verification-Lean%204-blueviolet.svg)](https://github.com/ivnmoreno/structa-maestro/blob/main/docs/formal-assurance.md)
65
71
  [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](https://commitizen-tools.github.io/commitizen/)
66
72
 
67
73
  **Structured Data Extraction Engine** — a reusable, stateless Python library (`structa_maestro`) with a minimal thin CLI (`structa-maestro`) that transforms unstructured documents (`TXT`, text-based `PDF`, `DOCX`, `HTML`, `Markdown`, and `EML`) into **validated, schema-conforming, provenance-backed canonical records** using only four pure-Python runtime dependencies (`pydantic`, `pypdf`, `python-docx`, `httpx`).
@@ -84,19 +90,26 @@ Unstructured business documents (invoices, contracts, employment records, applic
84
90
  | **Validation** | Does the record satisfy schema & cross-field rules? | Deterministic non-coercing validator (`valid` / `invalid` / `not_validated`) |
85
91
  | **Processing status** | Did the extraction pipeline complete? | `completed` / `partial` / `failed`, strictly independent of schema validity |
86
92
 
87
- ```mermaid
88
- flowchart LR
89
- In["Document (File / Bytes / Text / Stream) + ExtractionSchema"] --> Parse["Hardened Parsers (TXT, PDF, DOCX, HTML, MD, EML)"]
90
- Parse --> Strat["Extraction Strategy (OpenAI / Anthropic / Gemini / Deterministic)"]
91
- Strat --> Verify["Provenance + Confidence + Deterministic Validation"]
92
- Verify --> Contract["Canonical Output Record Contract v1.0"]
93
- Contract --> Bind["Optional Strict Typed Binding (Pydantic v2)"]
94
- Verify -. "zero-PII events" .-> Obs["Observability Hooks (Sync / Async)"]
95
- Formal["Lean 4 Formal Assurance (Dev/CI Only)"] -. "134 proofs + conformance" .-> Contract
93
+ ```text
94
+ Document (File / Bytes / Text / Stream) + ExtractionSchema
95
+ │
96
+ ▼
97
+ Hardened Parsers (TXT, PDF, DOCX, HTML, MD, EML)
98
+ │
99
+ ▼
100
+ Extraction Strategy (OpenAI / Anthropic / Gemini / Deterministic)
101
+ │
102
+ ▼ [Strategy-to-Contract Firewall]
103
+ Provenance + Confidence + Deterministic Validation ──(zero-PII events)──▶ Observability Hooks (Sync / Async)
104
+ │
105
+ ▼
106
+ Canonical Output Record Contract v1.0 ◀──(134 Lean 4 proofs + conformance)── Formal Assurance (Dev/CI Only)
107
+ │
108
+ ▼ (opt-in, read-only)
109
+ Strict Typed Binding (Pydantic v2) & Stateless Human Review (plan_review / apply_review)
96
110
  ```
97
111
 
98
- > [!IMPORTANT]
99
- > **Explicit Scope Boundaries**: `structa-maestro` is a focused structured extraction engine — **not** an OCR engine (image-only PDFs report `no_extractable_text`), **not** a RAG/vector/embedding search platform, and **not** a database-backed workflow server or multi-provider router.
112
+ > **Important — Explicit Scope Boundaries**: `structa-maestro` is a focused structured extraction engine — **not** an OCR engine (image-only PDFs report `no_extractable_text`), **not** a RAG/vector/embedding search platform, and **not** a database-backed workflow server or multi-provider router.
100
113
 
101
114
  ---
102
115
 
@@ -146,8 +159,7 @@ source .venv/bin/activate
146
159
  pip install -e ".[dev]"
147
160
  ```
148
161
 
149
- > [!NOTE]
150
- > Installing `structa-maestro` requires **zero Lean tooling** and installs only four pure-Python packages (`pydantic`, `pypdf`, `python-docx`, `httpx`).
162
+ > **Note**: Installing `structa-maestro` requires **zero Lean tooling** and installs only four pure-Python packages (`pydantic`, `pypdf`, `python-docx`, `httpx`).
151
163
 
152
164
  ---
153
165
 
@@ -232,8 +244,7 @@ except RecordBindingError as exc:
232
244
  print(result.status, result.validation.status, exc)
233
245
  ```
234
246
 
235
- > [!TIP]
236
- > For multi-record `partial` extractions, pass `only_valid=True` to `bind_records(result, Invoice, only_valid=True)` to materialize only `completed` + `valid` records while preserving full provenance, confidence, and diagnostics on `ExtractionResult`.
247
+ > **Tip**: For multi-record `partial` extractions, pass `only_valid=True` to `bind_records(result, Invoice, only_valid=True)` to materialize only `completed` + `valid` records while preserving full provenance, confidence, and diagnostics on `ExtractionResult`.
237
248
 
238
249
  ### Native Asyncio Extraction (`aextract`, `aextract_batch`, FastAPI)
239
250
 
@@ -306,25 +317,25 @@ structa-maestro extract-batch ./invoices/ --schema invoice_schema.json \
306
317
 
307
318
  ## Runnable Offline Examples
308
319
 
309
- All 15 scripts under [examples/](examples/) execute completely offline (zero API keys required) and are verified continuously in CI:
320
+ All 15 scripts under [examples/](https://github.com/ivnmoreno/structa-maestro/tree/main/examples) execute completely offline (zero API keys required) and are verified continuously in CI:
310
321
 
311
322
  | Example Script | Capability Demonstrated |
312
323
  | --- | --- |
313
- | [basic_invoice_extraction.py](examples/basic_invoice_extraction.py) | End-to-end single-record extraction, provenance, confidence, and Contract `v1.0` JSON |
314
- | [multi_record_extraction.py](examples/multi_record_extraction.py) | Multi-record extraction (`cardinality="multiple"`) with per-record validation |
315
- | [custom_strategy_example.py](examples/custom_strategy_example.py) | Implementing a custom `ExtractionStrategy` behind the Strategy-to-Contract Firewall |
316
- | [hardened_llm_strategy_example.py](examples/hardened_llm_strategy_example.py) | Strict `json_schema`, fallback, bounded retries, `InputBudgetPolicy`, and delimiter neutralization |
317
- | [anthropic_strategy_example.py](examples/anthropic_strategy_example.py) | Sync & async `AnthropicLLMStrategy` forced `tool_use` + token telemetry over `httpx.MockTransport` |
318
- | [gemini_strategy_example.py](examples/gemini_strategy_example.py) | Sync & async `GeminiLLMStrategy` strict `responseJsonSchema` + `usageMetadata` telemetry over `httpx.MockTransport` |
319
- | [cross_field_validation_example.py](examples/cross_field_validation_example.py) | Declarative comparison, exact `Decimal` arithmetic balance, conditional & group rules |
320
- | [batch_extraction_example.py](examples/batch_extraction_example.py) | Stateless concurrent `extract_batch(...)`, `fail_fast`, `BatchSummary`, and JSONL export |
321
- | [in_memory_extraction_example.py](examples/in_memory_extraction_example.py) | Zero-temp-file `DocumentInput.from_bytes`, `from_text`, and `from_stream` extraction |
322
- | [pydantic_schema_example.py](examples/pydantic_schema_example.py) | `ExtractionSchema.from_pydantic`, JSON export, and strict `bind_record` / `bind_records` |
323
- | [async_extraction_example.py](examples/async_extraction_example.py) | Native asyncio `aextract`, `aextract_batch`, pooled `async with`, and concurrency bounds |
324
- | [observability_telemetry_example.py](examples/observability_telemetry_example.py) | `InMemoryTelemetryObserver`, `StructuredLoggingObserver`, stage timings, and token rollups |
325
- | [multiformat_extraction_example.py](examples/multiformat_extraction_example.py) | Consistent extraction & provenance across HTML, Markdown, and RFC 5322 EML documents |
326
- | [confidence_calibration_example.py](examples/confidence_calibration_example.py) | Zero-dependency empirical calibration (`fit_calibrator`), ECE/Brier reduction, artifact persistence, and `calibrated: false` vs. `true` |
327
- | [human_review_workflow_example.py](examples/human_review_workflow_example.py) | Stateless `plan_review` triage, immutable `apply_review` corrections + re-validation, privacy-safe `ReviewAudit`, and `bind_records` |
324
+ | [basic_invoice_extraction.py](https://github.com/ivnmoreno/structa-maestro/blob/main/examples/basic_invoice_extraction.py) | End-to-end single-record extraction, provenance, confidence, and Contract `v1.0` JSON |
325
+ | [multi_record_extraction.py](https://github.com/ivnmoreno/structa-maestro/blob/main/examples/multi_record_extraction.py) | Multi-record extraction (`cardinality="multiple"`) with per-record validation |
326
+ | [custom_strategy_example.py](https://github.com/ivnmoreno/structa-maestro/blob/main/examples/custom_strategy_example.py) | Implementing a custom `ExtractionStrategy` behind the Strategy-to-Contract Firewall |
327
+ | [hardened_llm_strategy_example.py](https://github.com/ivnmoreno/structa-maestro/blob/main/examples/hardened_llm_strategy_example.py) | Strict `json_schema`, fallback, bounded retries, `InputBudgetPolicy`, and delimiter neutralization |
328
+ | [anthropic_strategy_example.py](https://github.com/ivnmoreno/structa-maestro/blob/main/examples/anthropic_strategy_example.py) | Sync & async `AnthropicLLMStrategy` forced `tool_use` + token telemetry over `httpx.MockTransport` |
329
+ | [gemini_strategy_example.py](https://github.com/ivnmoreno/structa-maestro/blob/main/examples/gemini_strategy_example.py) | Sync & async `GeminiLLMStrategy` strict `responseJsonSchema` + `usageMetadata` telemetry over `httpx.MockTransport` |
330
+ | [cross_field_validation_example.py](https://github.com/ivnmoreno/structa-maestro/blob/main/examples/cross_field_validation_example.py) | Declarative comparison, exact `Decimal` arithmetic balance, conditional & group rules |
331
+ | [batch_extraction_example.py](https://github.com/ivnmoreno/structa-maestro/blob/main/examples/batch_extraction_example.py) | Stateless concurrent `extract_batch(...)`, `fail_fast`, `BatchSummary`, and JSONL export |
332
+ | [in_memory_extraction_example.py](https://github.com/ivnmoreno/structa-maestro/blob/main/examples/in_memory_extraction_example.py) | Zero-temp-file `DocumentInput.from_bytes`, `from_text`, and `from_stream` extraction |
333
+ | [pydantic_schema_example.py](https://github.com/ivnmoreno/structa-maestro/blob/main/examples/pydantic_schema_example.py) | `ExtractionSchema.from_pydantic`, JSON export, and strict `bind_record` / `bind_records` |
334
+ | [async_extraction_example.py](https://github.com/ivnmoreno/structa-maestro/blob/main/examples/async_extraction_example.py) | Native asyncio `aextract`, `aextract_batch`, pooled `async with`, and concurrency bounds |
335
+ | [observability_telemetry_example.py](https://github.com/ivnmoreno/structa-maestro/blob/main/examples/observability_telemetry_example.py) | `InMemoryTelemetryObserver`, `StructuredLoggingObserver`, stage timings, and token rollups |
336
+ | [multiformat_extraction_example.py](https://github.com/ivnmoreno/structa-maestro/blob/main/examples/multiformat_extraction_example.py) | Consistent extraction & provenance across HTML, Markdown, and RFC 5322 EML documents |
337
+ | [confidence_calibration_example.py](https://github.com/ivnmoreno/structa-maestro/blob/main/examples/confidence_calibration_example.py) | Zero-dependency empirical calibration (`fit_calibrator`), ECE/Brier reduction, artifact persistence, and `calibrated: false` vs. `true` |
338
+ | [human_review_workflow_example.py](https://github.com/ivnmoreno/structa-maestro/blob/main/examples/human_review_workflow_example.py) | Stateless `plan_review` triage, immutable `apply_review` corrections + re-validation, privacy-safe `ReviewAudit`, and `bind_records` |
328
339
 
329
340
  ---
330
341
 
@@ -345,7 +356,7 @@ Every extraction returns an immutable `ExtractionResult` supporting lossless rou
345
356
 
346
357
  ## Current Limitations
347
358
 
348
- > [!WARNING]
359
+ > **Warning**:
349
360
  > - **Confidence calibration requires domain-representative data**: By default (`calibrator=None`), confidence scores report `"calibrated": false` and MUST NOT be interpreted as statistical probabilities. Even when an offline empirical `CalibrationModel` sets `"calibrated": true`, calibration reflects empirical accuracy on its fitting distribution only and never implies schema validity or factual truth.
350
361
  > - **External model data transmission**: `OpenAICompatibleLLMStrategy`, `AsyncOpenAICompatibleLLMStrategy`, `AnthropicLLMStrategy`, `AsyncAnthropicLLMStrategy`, `GeminiLLMStrategy`, and `AsyncGeminiLLMStrategy` transmit prepared document text to the configured endpoint; review provider data-handling policies before processing confidential documents.
351
362
 
@@ -363,7 +374,7 @@ python -m evals validate-dataset
363
374
  python -m evals run --strategy deterministic --baseline evals/baselines/deterministic_v2.0.0.json
364
375
  ```
365
376
 
366
- See [docs/development.md](docs/development.md) for subset filtering, repeated-trial (`--trials`) distributions, differential strategy comparison (`python -m evals diff`), and on-demand live-model benchmarking.
377
+ See [docs/development.md](https://github.com/ivnmoreno/structa-maestro/blob/main/docs/development.md) for subset filtering, repeated-trial (`--trials`) distributions, differential strategy comparison (`python -m evals diff`), and on-demand live-model benchmarking.
367
378
 
368
379
  ---
369
380
 
@@ -376,19 +387,19 @@ cd formal && lake build && lake test
376
387
  cd .. && STRUCTA_REQUIRE_LEAN_ORACLE=1 pytest tests/conformance/ -v
377
388
  ```
378
389
 
379
- See [Formal Assurance Guide](docs/formal-assurance.md) for the 4-layer assurance diagram, complete assurance matrix, formal model scope, assumptions, and explicit non-goals.
390
+ See [Formal Assurance Guide](https://github.com/ivnmoreno/structa-maestro/blob/main/docs/formal-assurance.md) for the 4-layer assurance diagram, complete assurance matrix, formal model scope, assumptions, and explicit non-goals.
380
391
 
381
392
  ---
382
393
 
383
394
  ## Further Documentation
384
395
 
385
- - [Architecture](docs/architecture.md)
386
- - [Formal Assurance Layer](docs/formal-assurance.md)
387
- - [Public API & CLI Reference](docs/api.md)
388
- - [Configuration & Security](docs/configuration.md)
389
- - [Development & Quality Gates](docs/development.md)
390
- - [Testing Strategy & CI Rules](docs/TESTING.md)
391
- - [Contributing Guide](CONTRIBUTING.md)
392
- - [Code of Conduct](CODE_OF_CONDUCT.md)
393
- - [Security Policy](SECURITY.md)
394
- - [Changelog](CHANGELOG.md)
396
+ - [Architecture](https://github.com/ivnmoreno/structa-maestro/blob/main/docs/architecture.md)
397
+ - [Formal Assurance Layer](https://github.com/ivnmoreno/structa-maestro/blob/main/docs/formal-assurance.md)
398
+ - [Public API & CLI Reference](https://github.com/ivnmoreno/structa-maestro/blob/main/docs/api.md)
399
+ - [Configuration & Security](https://github.com/ivnmoreno/structa-maestro/blob/main/docs/configuration.md)
400
+ - [Development & Quality Gates](https://github.com/ivnmoreno/structa-maestro/blob/main/docs/development.md)
401
+ - [Testing Strategy & CI Rules](https://github.com/ivnmoreno/structa-maestro/blob/main/docs/TESTING.md)
402
+ - [Contributing Guide](https://github.com/ivnmoreno/structa-maestro/blob/main/CONTRIBUTING.md)
403
+ - [Code of Conduct](https://github.com/ivnmoreno/structa-maestro/blob/main/CODE_OF_CONDUCT.md)
404
+ - [Security Policy](https://github.com/ivnmoreno/structa-maestro/blob/main/SECURITY.md)
405
+ - [Changelog](https://github.com/ivnmoreno/structa-maestro/blob/main/CHANGELOG.md)
@@ -1,14 +1,15 @@
1
1
  # structa-maestro
2
2
 
3
+ [![PyPI version](https://img.shields.io/pypi/v/structa-maestro.svg)](https://pypi.org/project/structa-maestro/)
3
4
  [![CI](https://github.com/ivnmoreno/structa-maestro/actions/workflows/ci.yml/badge.svg)](https://github.com/ivnmoreno/structa-maestro/actions/workflows/ci.yml)
4
5
  [![Formal Assurance](https://github.com/ivnmoreno/structa-maestro/actions/workflows/formal-assurance.yml/badge.svg)](https://github.com/ivnmoreno/structa-maestro/actions/workflows/formal-assurance.yml)
5
6
  [![Security](https://github.com/ivnmoreno/structa-maestro/actions/workflows/security.yml/badge.svg)](https://github.com/ivnmoreno/structa-maestro/actions/workflows/security.yml)
6
7
  [![Evaluation](https://github.com/ivnmoreno/structa-maestro/actions/workflows/evaluation.yml/badge.svg)](https://github.com/ivnmoreno/structa-maestro/actions/workflows/evaluation.yml)
7
8
  [![Python 3.11+](https://img.shields.io/badge/python-3.11%2B-blue.svg)](https://www.python.org/downloads/)
8
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
9
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/ivnmoreno/structa-maestro/blob/main/LICENSE)
9
10
  [![Code Style: Ruff](https://img.shields.io/badge/code%20style-ruff-000000.svg)](https://github.com/astral-sh/ruff)
10
11
  [![Type Checked: mypy](https://img.shields.io/badge/type%20checked-mypy-blue.svg)](https://mypy-lang.org/)
11
- [![Formal Verification: Lean 4](https://img.shields.io/badge/formal%20verification-Lean%204-blueviolet.svg)](docs/formal-assurance.md)
12
+ [![Formal Verification: Lean 4](https://img.shields.io/badge/formal%20verification-Lean%204-blueviolet.svg)](https://github.com/ivnmoreno/structa-maestro/blob/main/docs/formal-assurance.md)
12
13
  [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](https://commitizen-tools.github.io/commitizen/)
13
14
 
14
15
  **Structured Data Extraction Engine** — a reusable, stateless Python library (`structa_maestro`) with a minimal thin CLI (`structa-maestro`) that transforms unstructured documents (`TXT`, text-based `PDF`, `DOCX`, `HTML`, `Markdown`, and `EML`) into **validated, schema-conforming, provenance-backed canonical records** using only four pure-Python runtime dependencies (`pydantic`, `pypdf`, `python-docx`, `httpx`).
@@ -31,19 +32,26 @@ Unstructured business documents (invoices, contracts, employment records, applic
31
32
  | **Validation** | Does the record satisfy schema & cross-field rules? | Deterministic non-coercing validator (`valid` / `invalid` / `not_validated`) |
32
33
  | **Processing status** | Did the extraction pipeline complete? | `completed` / `partial` / `failed`, strictly independent of schema validity |
33
34
 
34
- ```mermaid
35
- flowchart LR
36
- In["Document (File / Bytes / Text / Stream) + ExtractionSchema"] --> Parse["Hardened Parsers (TXT, PDF, DOCX, HTML, MD, EML)"]
37
- Parse --> Strat["Extraction Strategy (OpenAI / Anthropic / Gemini / Deterministic)"]
38
- Strat --> Verify["Provenance + Confidence + Deterministic Validation"]
39
- Verify --> Contract["Canonical Output Record Contract v1.0"]
40
- Contract --> Bind["Optional Strict Typed Binding (Pydantic v2)"]
41
- Verify -. "zero-PII events" .-> Obs["Observability Hooks (Sync / Async)"]
42
- Formal["Lean 4 Formal Assurance (Dev/CI Only)"] -. "134 proofs + conformance" .-> Contract
35
+ ```text
36
+ Document (File / Bytes / Text / Stream) + ExtractionSchema
37
+ │
38
+ ▼
39
+ Hardened Parsers (TXT, PDF, DOCX, HTML, MD, EML)
40
+ │
41
+ ▼
42
+ Extraction Strategy (OpenAI / Anthropic / Gemini / Deterministic)
43
+ │
44
+ ▼ [Strategy-to-Contract Firewall]
45
+ Provenance + Confidence + Deterministic Validation ──(zero-PII events)──▶ Observability Hooks (Sync / Async)
46
+ │
47
+ ▼
48
+ Canonical Output Record Contract v1.0 ◀──(134 Lean 4 proofs + conformance)── Formal Assurance (Dev/CI Only)
49
+ │
50
+ ▼ (opt-in, read-only)
51
+ Strict Typed Binding (Pydantic v2) & Stateless Human Review (plan_review / apply_review)
43
52
  ```
44
53
 
45
- > [!IMPORTANT]
46
- > **Explicit Scope Boundaries**: `structa-maestro` is a focused structured extraction engine — **not** an OCR engine (image-only PDFs report `no_extractable_text`), **not** a RAG/vector/embedding search platform, and **not** a database-backed workflow server or multi-provider router.
54
+ > **Important — Explicit Scope Boundaries**: `structa-maestro` is a focused structured extraction engine — **not** an OCR engine (image-only PDFs report `no_extractable_text`), **not** a RAG/vector/embedding search platform, and **not** a database-backed workflow server or multi-provider router.
47
55
 
48
56
  ---
49
57
 
@@ -93,8 +101,7 @@ source .venv/bin/activate
93
101
  pip install -e ".[dev]"
94
102
  ```
95
103
 
96
- > [!NOTE]
97
- > Installing `structa-maestro` requires **zero Lean tooling** and installs only four pure-Python packages (`pydantic`, `pypdf`, `python-docx`, `httpx`).
104
+ > **Note**: Installing `structa-maestro` requires **zero Lean tooling** and installs only four pure-Python packages (`pydantic`, `pypdf`, `python-docx`, `httpx`).
98
105
 
99
106
  ---
100
107
 
@@ -179,8 +186,7 @@ except RecordBindingError as exc:
179
186
  print(result.status, result.validation.status, exc)
180
187
  ```
181
188
 
182
- > [!TIP]
183
- > For multi-record `partial` extractions, pass `only_valid=True` to `bind_records(result, Invoice, only_valid=True)` to materialize only `completed` + `valid` records while preserving full provenance, confidence, and diagnostics on `ExtractionResult`.
189
+ > **Tip**: For multi-record `partial` extractions, pass `only_valid=True` to `bind_records(result, Invoice, only_valid=True)` to materialize only `completed` + `valid` records while preserving full provenance, confidence, and diagnostics on `ExtractionResult`.
184
190
 
185
191
  ### Native Asyncio Extraction (`aextract`, `aextract_batch`, FastAPI)
186
192
 
@@ -253,25 +259,25 @@ structa-maestro extract-batch ./invoices/ --schema invoice_schema.json \
253
259
 
254
260
  ## Runnable Offline Examples
255
261
 
256
- All 15 scripts under [examples/](examples/) execute completely offline (zero API keys required) and are verified continuously in CI:
262
+ All 15 scripts under [examples/](https://github.com/ivnmoreno/structa-maestro/tree/main/examples) execute completely offline (zero API keys required) and are verified continuously in CI:
257
263
 
258
264
  | Example Script | Capability Demonstrated |
259
265
  | --- | --- |
260
- | [basic_invoice_extraction.py](examples/basic_invoice_extraction.py) | End-to-end single-record extraction, provenance, confidence, and Contract `v1.0` JSON |
261
- | [multi_record_extraction.py](examples/multi_record_extraction.py) | Multi-record extraction (`cardinality="multiple"`) with per-record validation |
262
- | [custom_strategy_example.py](examples/custom_strategy_example.py) | Implementing a custom `ExtractionStrategy` behind the Strategy-to-Contract Firewall |
263
- | [hardened_llm_strategy_example.py](examples/hardened_llm_strategy_example.py) | Strict `json_schema`, fallback, bounded retries, `InputBudgetPolicy`, and delimiter neutralization |
264
- | [anthropic_strategy_example.py](examples/anthropic_strategy_example.py) | Sync & async `AnthropicLLMStrategy` forced `tool_use` + token telemetry over `httpx.MockTransport` |
265
- | [gemini_strategy_example.py](examples/gemini_strategy_example.py) | Sync & async `GeminiLLMStrategy` strict `responseJsonSchema` + `usageMetadata` telemetry over `httpx.MockTransport` |
266
- | [cross_field_validation_example.py](examples/cross_field_validation_example.py) | Declarative comparison, exact `Decimal` arithmetic balance, conditional & group rules |
267
- | [batch_extraction_example.py](examples/batch_extraction_example.py) | Stateless concurrent `extract_batch(...)`, `fail_fast`, `BatchSummary`, and JSONL export |
268
- | [in_memory_extraction_example.py](examples/in_memory_extraction_example.py) | Zero-temp-file `DocumentInput.from_bytes`, `from_text`, and `from_stream` extraction |
269
- | [pydantic_schema_example.py](examples/pydantic_schema_example.py) | `ExtractionSchema.from_pydantic`, JSON export, and strict `bind_record` / `bind_records` |
270
- | [async_extraction_example.py](examples/async_extraction_example.py) | Native asyncio `aextract`, `aextract_batch`, pooled `async with`, and concurrency bounds |
271
- | [observability_telemetry_example.py](examples/observability_telemetry_example.py) | `InMemoryTelemetryObserver`, `StructuredLoggingObserver`, stage timings, and token rollups |
272
- | [multiformat_extraction_example.py](examples/multiformat_extraction_example.py) | Consistent extraction & provenance across HTML, Markdown, and RFC 5322 EML documents |
273
- | [confidence_calibration_example.py](examples/confidence_calibration_example.py) | Zero-dependency empirical calibration (`fit_calibrator`), ECE/Brier reduction, artifact persistence, and `calibrated: false` vs. `true` |
274
- | [human_review_workflow_example.py](examples/human_review_workflow_example.py) | Stateless `plan_review` triage, immutable `apply_review` corrections + re-validation, privacy-safe `ReviewAudit`, and `bind_records` |
266
+ | [basic_invoice_extraction.py](https://github.com/ivnmoreno/structa-maestro/blob/main/examples/basic_invoice_extraction.py) | End-to-end single-record extraction, provenance, confidence, and Contract `v1.0` JSON |
267
+ | [multi_record_extraction.py](https://github.com/ivnmoreno/structa-maestro/blob/main/examples/multi_record_extraction.py) | Multi-record extraction (`cardinality="multiple"`) with per-record validation |
268
+ | [custom_strategy_example.py](https://github.com/ivnmoreno/structa-maestro/blob/main/examples/custom_strategy_example.py) | Implementing a custom `ExtractionStrategy` behind the Strategy-to-Contract Firewall |
269
+ | [hardened_llm_strategy_example.py](https://github.com/ivnmoreno/structa-maestro/blob/main/examples/hardened_llm_strategy_example.py) | Strict `json_schema`, fallback, bounded retries, `InputBudgetPolicy`, and delimiter neutralization |
270
+ | [anthropic_strategy_example.py](https://github.com/ivnmoreno/structa-maestro/blob/main/examples/anthropic_strategy_example.py) | Sync & async `AnthropicLLMStrategy` forced `tool_use` + token telemetry over `httpx.MockTransport` |
271
+ | [gemini_strategy_example.py](https://github.com/ivnmoreno/structa-maestro/blob/main/examples/gemini_strategy_example.py) | Sync & async `GeminiLLMStrategy` strict `responseJsonSchema` + `usageMetadata` telemetry over `httpx.MockTransport` |
272
+ | [cross_field_validation_example.py](https://github.com/ivnmoreno/structa-maestro/blob/main/examples/cross_field_validation_example.py) | Declarative comparison, exact `Decimal` arithmetic balance, conditional & group rules |
273
+ | [batch_extraction_example.py](https://github.com/ivnmoreno/structa-maestro/blob/main/examples/batch_extraction_example.py) | Stateless concurrent `extract_batch(...)`, `fail_fast`, `BatchSummary`, and JSONL export |
274
+ | [in_memory_extraction_example.py](https://github.com/ivnmoreno/structa-maestro/blob/main/examples/in_memory_extraction_example.py) | Zero-temp-file `DocumentInput.from_bytes`, `from_text`, and `from_stream` extraction |
275
+ | [pydantic_schema_example.py](https://github.com/ivnmoreno/structa-maestro/blob/main/examples/pydantic_schema_example.py) | `ExtractionSchema.from_pydantic`, JSON export, and strict `bind_record` / `bind_records` |
276
+ | [async_extraction_example.py](https://github.com/ivnmoreno/structa-maestro/blob/main/examples/async_extraction_example.py) | Native asyncio `aextract`, `aextract_batch`, pooled `async with`, and concurrency bounds |
277
+ | [observability_telemetry_example.py](https://github.com/ivnmoreno/structa-maestro/blob/main/examples/observability_telemetry_example.py) | `InMemoryTelemetryObserver`, `StructuredLoggingObserver`, stage timings, and token rollups |
278
+ | [multiformat_extraction_example.py](https://github.com/ivnmoreno/structa-maestro/blob/main/examples/multiformat_extraction_example.py) | Consistent extraction & provenance across HTML, Markdown, and RFC 5322 EML documents |
279
+ | [confidence_calibration_example.py](https://github.com/ivnmoreno/structa-maestro/blob/main/examples/confidence_calibration_example.py) | Zero-dependency empirical calibration (`fit_calibrator`), ECE/Brier reduction, artifact persistence, and `calibrated: false` vs. `true` |
280
+ | [human_review_workflow_example.py](https://github.com/ivnmoreno/structa-maestro/blob/main/examples/human_review_workflow_example.py) | Stateless `plan_review` triage, immutable `apply_review` corrections + re-validation, privacy-safe `ReviewAudit`, and `bind_records` |
275
281
 
276
282
  ---
277
283
 
@@ -292,7 +298,7 @@ Every extraction returns an immutable `ExtractionResult` supporting lossless rou
292
298
 
293
299
  ## Current Limitations
294
300
 
295
- > [!WARNING]
301
+ > **Warning**:
296
302
  > - **Confidence calibration requires domain-representative data**: By default (`calibrator=None`), confidence scores report `"calibrated": false` and MUST NOT be interpreted as statistical probabilities. Even when an offline empirical `CalibrationModel` sets `"calibrated": true`, calibration reflects empirical accuracy on its fitting distribution only and never implies schema validity or factual truth.
297
303
  > - **External model data transmission**: `OpenAICompatibleLLMStrategy`, `AsyncOpenAICompatibleLLMStrategy`, `AnthropicLLMStrategy`, `AsyncAnthropicLLMStrategy`, `GeminiLLMStrategy`, and `AsyncGeminiLLMStrategy` transmit prepared document text to the configured endpoint; review provider data-handling policies before processing confidential documents.
298
304
 
@@ -310,7 +316,7 @@ python -m evals validate-dataset
310
316
  python -m evals run --strategy deterministic --baseline evals/baselines/deterministic_v2.0.0.json
311
317
  ```
312
318
 
313
- See [docs/development.md](docs/development.md) for subset filtering, repeated-trial (`--trials`) distributions, differential strategy comparison (`python -m evals diff`), and on-demand live-model benchmarking.
319
+ See [docs/development.md](https://github.com/ivnmoreno/structa-maestro/blob/main/docs/development.md) for subset filtering, repeated-trial (`--trials`) distributions, differential strategy comparison (`python -m evals diff`), and on-demand live-model benchmarking.
314
320
 
315
321
  ---
316
322
 
@@ -323,19 +329,19 @@ cd formal && lake build && lake test
323
329
  cd .. && STRUCTA_REQUIRE_LEAN_ORACLE=1 pytest tests/conformance/ -v
324
330
  ```
325
331
 
326
- See [Formal Assurance Guide](docs/formal-assurance.md) for the 4-layer assurance diagram, complete assurance matrix, formal model scope, assumptions, and explicit non-goals.
332
+ See [Formal Assurance Guide](https://github.com/ivnmoreno/structa-maestro/blob/main/docs/formal-assurance.md) for the 4-layer assurance diagram, complete assurance matrix, formal model scope, assumptions, and explicit non-goals.
327
333
 
328
334
  ---
329
335
 
330
336
  ## Further Documentation
331
337
 
332
- - [Architecture](docs/architecture.md)
333
- - [Formal Assurance Layer](docs/formal-assurance.md)
334
- - [Public API & CLI Reference](docs/api.md)
335
- - [Configuration & Security](docs/configuration.md)
336
- - [Development & Quality Gates](docs/development.md)
337
- - [Testing Strategy & CI Rules](docs/TESTING.md)
338
- - [Contributing Guide](CONTRIBUTING.md)
339
- - [Code of Conduct](CODE_OF_CONDUCT.md)
340
- - [Security Policy](SECURITY.md)
341
- - [Changelog](CHANGELOG.md)
338
+ - [Architecture](https://github.com/ivnmoreno/structa-maestro/blob/main/docs/architecture.md)
339
+ - [Formal Assurance Layer](https://github.com/ivnmoreno/structa-maestro/blob/main/docs/formal-assurance.md)
340
+ - [Public API & CLI Reference](https://github.com/ivnmoreno/structa-maestro/blob/main/docs/api.md)
341
+ - [Configuration & Security](https://github.com/ivnmoreno/structa-maestro/blob/main/docs/configuration.md)
342
+ - [Development & Quality Gates](https://github.com/ivnmoreno/structa-maestro/blob/main/docs/development.md)
343
+ - [Testing Strategy & CI Rules](https://github.com/ivnmoreno/structa-maestro/blob/main/docs/TESTING.md)
344
+ - [Contributing Guide](https://github.com/ivnmoreno/structa-maestro/blob/main/CONTRIBUTING.md)
345
+ - [Code of Conduct](https://github.com/ivnmoreno/structa-maestro/blob/main/CODE_OF_CONDUCT.md)
346
+ - [Security Policy](https://github.com/ivnmoreno/structa-maestro/blob/main/SECURITY.md)
347
+ - [Changelog](https://github.com/ivnmoreno/structa-maestro/blob/main/CHANGELOG.md)
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "structa-maestro"
7
- version = "0.2.0"
7
+ version = "0.2.1"
8
8
  description = "Structured data extraction engine transforming unstructured documents into validated, traceable canonical records."
9
9
  readme = "README.md"
10
10
  license = { file = "LICENSE" }
@@ -44,6 +44,13 @@ dev = [
44
44
  [project.scripts]
45
45
  structa-maestro = "structa_maestro.cli:main"
46
46
 
47
+ [project.urls]
48
+ Homepage = "https://github.com/ivnmoreno/structa-maestro"
49
+ Repository = "https://github.com/ivnmoreno/structa-maestro"
50
+ Documentation = "https://github.com/ivnmoreno/structa-maestro/blob/main/docs/api.md"
51
+ Changelog = "https://github.com/ivnmoreno/structa-maestro/blob/main/CHANGELOG.md"
52
+ Issues = "https://github.com/ivnmoreno/structa-maestro/issues"
53
+
47
54
  [tool.hatch.build.targets.wheel]
48
55
  packages = ["src/structa_maestro"]
49
56
 
@@ -158,7 +158,7 @@ from structa_maestro.telemetry import (
158
158
  )
159
159
  from structa_maestro.validation.validator import DeterministicValidator
160
160
 
161
- __version__ = "0.2.0"
161
+ __version__ = "0.2.1"
162
162
 
163
163
  __all__ = [
164
164
  "CALIBRATION_ARTIFACT_VERSION",
File without changes