julee-ceap 0.1.0__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.
- julee_ceap-0.1.0/PKG-INFO +72 -0
- julee_ceap-0.1.0/README.md +40 -0
- julee_ceap-0.1.0/pyproject.toml +67 -0
- julee_ceap-0.1.0/setup.cfg +4 -0
- julee_ceap-0.1.0/src/julee_ceap/__init__.py +36 -0
- julee_ceap-0.1.0/src/julee_ceap/_schema_ref.py +35 -0
- julee_ceap-0.1.0/src/julee_ceap/apps/__init__.py +3 -0
- julee_ceap-0.1.0/src/julee_ceap/apps/api/__init__.py +20 -0
- julee_ceap-0.1.0/src/julee_ceap/apps/api/app.py +181 -0
- julee_ceap-0.1.0/src/julee_ceap/apps/api/dependencies.py +257 -0
- julee_ceap-0.1.0/src/julee_ceap/apps/api/requests.py +176 -0
- julee_ceap-0.1.0/src/julee_ceap/apps/api/responses.py +44 -0
- julee_ceap-0.1.0/src/julee_ceap/apps/api/routers/__init__.py +43 -0
- julee_ceap-0.1.0/src/julee_ceap/apps/api/routers/assembly_specifications.py +213 -0
- julee_ceap-0.1.0/src/julee_ceap/apps/api/routers/documents.py +182 -0
- julee_ceap-0.1.0/src/julee_ceap/apps/api/routers/knowledge_service_configs.py +80 -0
- julee_ceap-0.1.0/src/julee_ceap/apps/api/routers/knowledge_service_queries.py +294 -0
- julee_ceap-0.1.0/src/julee_ceap/apps/api/routers/system.py +138 -0
- julee_ceap-0.1.0/src/julee_ceap/apps/api/routers/workflows.py +233 -0
- julee_ceap-0.1.0/src/julee_ceap/apps/api/services/__init__.py +20 -0
- julee_ceap-0.1.0/src/julee_ceap/apps/api/services/system_initialization.py +217 -0
- julee_ceap-0.1.0/src/julee_ceap/apps/api/tests/__init__.py +14 -0
- julee_ceap-0.1.0/src/julee_ceap/apps/api/tests/routers/__init__.py +17 -0
- julee_ceap-0.1.0/src/julee_ceap/apps/api/tests/routers/test_assembly_specifications.py +752 -0
- julee_ceap-0.1.0/src/julee_ceap/apps/api/tests/routers/test_documents.py +306 -0
- julee_ceap-0.1.0/src/julee_ceap/apps/api/tests/routers/test_knowledge_service_configs.py +237 -0
- julee_ceap-0.1.0/src/julee_ceap/apps/api/tests/routers/test_knowledge_service_queries.py +741 -0
- julee_ceap-0.1.0/src/julee_ceap/apps/api/tests/routers/test_system.py +186 -0
- julee_ceap-0.1.0/src/julee_ceap/apps/api/tests/routers/test_workflows.py +396 -0
- julee_ceap-0.1.0/src/julee_ceap/apps/api/tests/test_app.py +295 -0
- julee_ceap-0.1.0/src/julee_ceap/apps/api/tests/test_dependencies.py +248 -0
- julee_ceap-0.1.0/src/julee_ceap/apps/api/tests/test_requests.py +253 -0
- julee_ceap-0.1.0/src/julee_ceap/apps/worker/__init__.py +22 -0
- julee_ceap-0.1.0/src/julee_ceap/apps/worker/extract_assemble.py +222 -0
- julee_ceap-0.1.0/src/julee_ceap/apps/worker/main.py +212 -0
- julee_ceap-0.1.0/src/julee_ceap/apps/worker/validate_document.py +229 -0
- julee_ceap-0.1.0/src/julee_ceap/conftest.py +61 -0
- julee_ceap-0.1.0/src/julee_ceap/domain/__init__.py +3 -0
- julee_ceap-0.1.0/src/julee_ceap/domain/models/__init__.py +44 -0
- julee_ceap-0.1.0/src/julee_ceap/domain/models/assembly/__init__.py +17 -0
- julee_ceap-0.1.0/src/julee_ceap/domain/models/assembly/assembly.py +98 -0
- julee_ceap-0.1.0/src/julee_ceap/domain/models/assembly/tests/__init__.py +0 -0
- julee_ceap-0.1.0/src/julee_ceap/domain/models/assembly/tests/factories.py +38 -0
- julee_ceap-0.1.0/src/julee_ceap/domain/models/assembly/tests/test_assembly.py +453 -0
- julee_ceap-0.1.0/src/julee_ceap/domain/models/assembly_specification/__init__.py +24 -0
- julee_ceap-0.1.0/src/julee_ceap/domain/models/assembly_specification/assembly_specification.py +187 -0
- julee_ceap-0.1.0/src/julee_ceap/domain/models/assembly_specification/knowledge_service_query.py +126 -0
- julee_ceap-0.1.0/src/julee_ceap/domain/models/assembly_specification/tests/__init__.py +0 -0
- julee_ceap-0.1.0/src/julee_ceap/domain/models/assembly_specification/tests/factories.py +79 -0
- julee_ceap-0.1.0/src/julee_ceap/domain/models/assembly_specification/tests/test_assembly_specification.py +613 -0
- julee_ceap-0.1.0/src/julee_ceap/domain/models/assembly_specification/tests/test_knowledge_service_query.py +314 -0
- julee_ceap-0.1.0/src/julee_ceap/domain/models/document/__init__.py +17 -0
- julee_ceap-0.1.0/src/julee_ceap/domain/models/document/document.py +139 -0
- julee_ceap-0.1.0/src/julee_ceap/domain/models/document/tests/__init__.py +0 -0
- julee_ceap-0.1.0/src/julee_ceap/domain/models/document/tests/factories.py +77 -0
- julee_ceap-0.1.0/src/julee_ceap/domain/models/document/tests/test_document.py +282 -0
- julee_ceap-0.1.0/src/julee_ceap/domain/models/knowledge_service_config/__init__.py +17 -0
- julee_ceap-0.1.0/src/julee_ceap/domain/models/knowledge_service_config/knowledge_service_config.py +83 -0
- julee_ceap-0.1.0/src/julee_ceap/domain/models/policy/__init__.py +15 -0
- julee_ceap-0.1.0/src/julee_ceap/domain/models/policy/document_policy_validation.py +221 -0
- julee_ceap-0.1.0/src/julee_ceap/domain/models/policy/policy.py +204 -0
- julee_ceap-0.1.0/src/julee_ceap/domain/models/policy/tests/__init__.py +0 -0
- julee_ceap-0.1.0/src/julee_ceap/domain/models/policy/tests/factories.py +48 -0
- julee_ceap-0.1.0/src/julee_ceap/domain/models/policy/tests/test_document_policy_validation.py +424 -0
- julee_ceap-0.1.0/src/julee_ceap/domain/models/policy/tests/test_policy.py +549 -0
- julee_ceap-0.1.0/src/julee_ceap/domain/repositories/__init__.py +26 -0
- julee_ceap-0.1.0/src/julee_ceap/domain/repositories/assembly.py +47 -0
- julee_ceap-0.1.0/src/julee_ceap/domain/repositories/assembly_specification.py +54 -0
- julee_ceap-0.1.0/src/julee_ceap/domain/repositories/document.py +51 -0
- julee_ceap-0.1.0/src/julee_ceap/domain/repositories/document_policy_validation.py +54 -0
- julee_ceap-0.1.0/src/julee_ceap/domain/repositories/knowledge_service_config.py +56 -0
- julee_ceap-0.1.0/src/julee_ceap/domain/repositories/knowledge_service_query.py +45 -0
- julee_ceap-0.1.0/src/julee_ceap/domain/repositories/policy.py +51 -0
- julee_ceap-0.1.0/src/julee_ceap/domain/repositories/remote_schema.py +8 -0
- julee_ceap-0.1.0/src/julee_ceap/fixtures/Spec-Sheet-BondorPanel-v17.pdf +0 -0
- julee_ceap-0.1.0/src/julee_ceap/fixtures/assembly_specifications.json +1460 -0
- julee_ceap-0.1.0/src/julee_ceap/fixtures/documents.yaml +139 -0
- julee_ceap-0.1.0/src/julee_ceap/fixtures/knowledge_service_configs.yaml +37 -0
- julee_ceap-0.1.0/src/julee_ceap/fixtures/knowledge_service_queries.yaml +36 -0
- julee_ceap-0.1.0/src/julee_ceap/fixtures/q1_planning_meeting.txt +42 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/__init__.py +1 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/repositories/__init__.py +7 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/repositories/http/__init__.py +0 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/repositories/http/schema.py +14 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/repositories/memory/__init__.py +33 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/repositories/memory/assembly.py +85 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/repositories/memory/assembly_specification.py +125 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/repositories/memory/document.py +156 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/repositories/memory/document_policy_validation.py +105 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/repositories/memory/knowledge_service_config.py +125 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/repositories/memory/knowledge_service_query.py +122 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/repositories/memory/policy.py +88 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/repositories/memory/remote_schema.py +16 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/repositories/memory/tests/__init__.py +0 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/repositories/memory/tests/test_document.py +216 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/repositories/memory/tests/test_document_policy_validation.py +164 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/repositories/memory/tests/test_policy.py +456 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/repositories/minio/__init__.py +31 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/repositories/minio/assembly.py +103 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/repositories/minio/assembly_specification.py +168 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/repositories/minio/document.py +534 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/repositories/minio/document_policy_validation.py +120 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/repositories/minio/knowledge_service_config.py +187 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/repositories/minio/knowledge_service_query.py +208 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/repositories/minio/policy.py +106 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/repositories/minio/tests/__init__.py +0 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/repositories/minio/tests/test_assembly.py +415 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/repositories/minio/tests/test_assembly_specification.py +400 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/repositories/minio/tests/test_document.py +599 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/repositories/minio/tests/test_document_policy_validation.py +195 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/repositories/minio/tests/test_knowledge_service_config.py +383 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/repositories/minio/tests/test_knowledge_service_query.py +447 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/repositories/minio/tests/test_policy.py +572 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/repositories/temporal/__init__.py +38 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/repositories/temporal/activities.py +131 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/repositories/temporal/activity_names.py +36 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/repositories/temporal/proxies.py +178 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/services/__init__.py +5 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/services/knowledge_service/__init__.py +47 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/services/knowledge_service/anthropic/__init__.py +12 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/services/knowledge_service/anthropic/knowledge_service.py +380 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/services/knowledge_service/anthropic/tests/test_knowledge_service.py +464 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/services/knowledge_service/factory.py +141 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/services/knowledge_service/knowledge_service.py +166 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/services/knowledge_service/memory/__init__.py +13 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/services/knowledge_service/memory/knowledge_service.py +304 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/services/knowledge_service/memory/test_knowledge_service.py +350 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/services/knowledge_service/test_factory.py +117 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/services/temporal/__init__.py +38 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/services/temporal/activities.py +86 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/services/temporal/activity_names.py +22 -0
- julee_ceap-0.1.0/src/julee_ceap/infrastructure/services/temporal/proxies.py +44 -0
- julee_ceap-0.1.0/src/julee_ceap/py.typed +0 -0
- julee_ceap-0.1.0/src/julee_ceap/usecases/__init__.py +17 -0
- julee_ceap-0.1.0/src/julee_ceap/usecases/decorators.py +108 -0
- julee_ceap-0.1.0/src/julee_ceap/usecases/extract_assemble_data.py +664 -0
- julee_ceap-0.1.0/src/julee_ceap/usecases/initialize_system_data.py +912 -0
- julee_ceap-0.1.0/src/julee_ceap/usecases/pointable_json_schema.py +102 -0
- julee_ceap-0.1.0/src/julee_ceap/usecases/tests/__init__.py +7 -0
- julee_ceap-0.1.0/src/julee_ceap/usecases/tests/test_extract_assemble_data.py +760 -0
- julee_ceap-0.1.0/src/julee_ceap/usecases/tests/test_initialize_system_data.py +455 -0
- julee_ceap-0.1.0/src/julee_ceap/usecases/tests/test_pointable_json_schema.py +453 -0
- julee_ceap-0.1.0/src/julee_ceap/usecases/tests/test_validate_document.py +1230 -0
- julee_ceap-0.1.0/src/julee_ceap/usecases/validate_document.py +791 -0
- julee_ceap-0.1.0/src/julee_ceap.egg-info/PKG-INFO +72 -0
- julee_ceap-0.1.0/src/julee_ceap.egg-info/SOURCES.txt +148 -0
- julee_ceap-0.1.0/src/julee_ceap.egg-info/dependency_links.txt +1 -0
- julee_ceap-0.1.0/src/julee_ceap.egg-info/entry_points.txt +2 -0
- julee_ceap-0.1.0/src/julee_ceap.egg-info/requires.txt +23 -0
- julee_ceap-0.1.0/src/julee_ceap.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: julee-ceap
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Capture, Extract, Assemble, Publish: document processing for julee solutions
|
|
5
|
+
Author-email: Pyx Industries <chris@pyx.io>
|
|
6
|
+
License-Expression: GPL-3.0
|
|
7
|
+
Keywords: julee,document-processing,temporal,ai
|
|
8
|
+
Requires-Python: >=3.11
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
Requires-Dist: julee[api,minio,temporal]>=0.3.0
|
|
11
|
+
Requires-Dist: anthropic>=0.66.0
|
|
12
|
+
Requires-Dist: jsonschema>=4.0.0
|
|
13
|
+
Requires-Dist: jsonpointer>=3.0.0
|
|
14
|
+
Requires-Dist: multihash>=0.1.1
|
|
15
|
+
Requires-Dist: six>=1.16.0
|
|
16
|
+
Requires-Dist: PyYAML>=6.0.0
|
|
17
|
+
Requires-Dist: httpx>=0.27.0
|
|
18
|
+
Provides-Extra: dev
|
|
19
|
+
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
20
|
+
Requires-Dist: pytest-asyncio>=1.0.0; extra == "dev"
|
|
21
|
+
Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
|
|
22
|
+
Requires-Dist: pytest-xdist>=3.5.0; extra == "dev"
|
|
23
|
+
Requires-Dist: pytest-timeout>=2.3.0; extra == "dev"
|
|
24
|
+
Requires-Dist: factory-boy>=3.2.0; extra == "dev"
|
|
25
|
+
Requires-Dist: hypothesis>=6.0.0; extra == "dev"
|
|
26
|
+
Requires-Dist: mypy>=1.7.0; extra == "dev"
|
|
27
|
+
Requires-Dist: types-PyYAML; extra == "dev"
|
|
28
|
+
Requires-Dist: types-jsonschema; extra == "dev"
|
|
29
|
+
Requires-Dist: black>=24.0.0; extra == "dev"
|
|
30
|
+
Requires-Dist: ruff>=0.5.0; extra == "dev"
|
|
31
|
+
Requires-Dist: julee[doctrine]>=0.3.0; extra == "dev"
|
|
32
|
+
|
|
33
|
+
# julee-ceap
|
|
34
|
+
|
|
35
|
+
Capture, Extract, Assemble, Publish — document processing for
|
|
36
|
+
[julee](https://github.com/pyx-industries/julee) solutions.
|
|
37
|
+
|
|
38
|
+
```toml
|
|
39
|
+
[tool.julee]
|
|
40
|
+
kits = ["ceap"]
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
A document arrives; a knowledge service extracts what it can find in it;
|
|
44
|
+
the results are assembled against a specification; the assembly is
|
|
45
|
+
validated against a policy; the result is published. Each step is a use
|
|
46
|
+
case, and each runs durably as a Temporal pipeline.
|
|
47
|
+
|
|
48
|
+
The kit provides:
|
|
49
|
+
|
|
50
|
+
- **Domain models:** `Document`, `Assembly`, `AssemblySpecification`,
|
|
51
|
+
`Policy`, `DocumentPolicyValidation`, `KnowledgeServiceConfig`,
|
|
52
|
+
`KnowledgeServiceQuery`.
|
|
53
|
+
- **Use cases:** `ExtractAssembleDataUseCase`, `ValidateDocumentUseCase`,
|
|
54
|
+
`InitializeSystemDataUseCase`.
|
|
55
|
+
- **Infrastructure:** in-memory and MinIO repositories, Temporal proxies,
|
|
56
|
+
and a knowledge service backed by Anthropic (with an in-memory one for
|
|
57
|
+
tests).
|
|
58
|
+
- **Apps:** a FastAPI application and a Temporal worker.
|
|
59
|
+
|
|
60
|
+
Fixtures for a demonstration run ship in `src/julee_ceap/fixtures/`.
|
|
61
|
+
|
|
62
|
+
## The demonstration
|
|
63
|
+
|
|
64
|
+
`deploy/` holds a Docker Compose stack that runs the whole pipeline — the
|
|
65
|
+
API, the worker, a demo UI, and the Temporal and MinIO they need. See
|
|
66
|
+
[deploy/README.md](deploy/README.md).
|
|
67
|
+
|
|
68
|
+
## Releasing
|
|
69
|
+
|
|
70
|
+
The kits release on their own tags, `ceap-vX.Y.Z` and `polling-vX.Y.Z`.
|
|
71
|
+
The workflow checks the tag against the version in the kit's
|
|
72
|
+
`pyproject.toml` and refuses a mismatch.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# julee-ceap
|
|
2
|
+
|
|
3
|
+
Capture, Extract, Assemble, Publish — document processing for
|
|
4
|
+
[julee](https://github.com/pyx-industries/julee) solutions.
|
|
5
|
+
|
|
6
|
+
```toml
|
|
7
|
+
[tool.julee]
|
|
8
|
+
kits = ["ceap"]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
A document arrives; a knowledge service extracts what it can find in it;
|
|
12
|
+
the results are assembled against a specification; the assembly is
|
|
13
|
+
validated against a policy; the result is published. Each step is a use
|
|
14
|
+
case, and each runs durably as a Temporal pipeline.
|
|
15
|
+
|
|
16
|
+
The kit provides:
|
|
17
|
+
|
|
18
|
+
- **Domain models:** `Document`, `Assembly`, `AssemblySpecification`,
|
|
19
|
+
`Policy`, `DocumentPolicyValidation`, `KnowledgeServiceConfig`,
|
|
20
|
+
`KnowledgeServiceQuery`.
|
|
21
|
+
- **Use cases:** `ExtractAssembleDataUseCase`, `ValidateDocumentUseCase`,
|
|
22
|
+
`InitializeSystemDataUseCase`.
|
|
23
|
+
- **Infrastructure:** in-memory and MinIO repositories, Temporal proxies,
|
|
24
|
+
and a knowledge service backed by Anthropic (with an in-memory one for
|
|
25
|
+
tests).
|
|
26
|
+
- **Apps:** a FastAPI application and a Temporal worker.
|
|
27
|
+
|
|
28
|
+
Fixtures for a demonstration run ship in `src/julee_ceap/fixtures/`.
|
|
29
|
+
|
|
30
|
+
## The demonstration
|
|
31
|
+
|
|
32
|
+
`deploy/` holds a Docker Compose stack that runs the whole pipeline — the
|
|
33
|
+
API, the worker, a demo UI, and the Temporal and MinIO they need. See
|
|
34
|
+
[deploy/README.md](deploy/README.md).
|
|
35
|
+
|
|
36
|
+
## Releasing
|
|
37
|
+
|
|
38
|
+
The kits release on their own tags, `ceap-vX.Y.Z` and `polling-vX.Y.Z`.
|
|
39
|
+
The workflow checks the tag against the version in the kit's
|
|
40
|
+
`pyproject.toml` and refuses a mismatch.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "julee-ceap"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Capture, Extract, Assemble, Publish: document processing for julee solutions"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
license = "GPL-3.0"
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "Pyx Industries", email = "chris@pyx.io"}
|
|
14
|
+
]
|
|
15
|
+
keywords = ["julee", "document-processing", "temporal", "ai"]
|
|
16
|
+
|
|
17
|
+
dependencies = [
|
|
18
|
+
# The kit needs julee's entities and services, its Temporal and MinIO
|
|
19
|
+
# integrations, and FastAPI for its API app.
|
|
20
|
+
"julee[temporal,api,minio]>=0.3.0",
|
|
21
|
+
# Knowledge service
|
|
22
|
+
"anthropic>=0.66.0",
|
|
23
|
+
# Schemas, content addressing and fixtures
|
|
24
|
+
"jsonschema>=4.0.0",
|
|
25
|
+
"jsonpointer>=3.0.0",
|
|
26
|
+
"multihash>=0.1.1",
|
|
27
|
+
# multihash 0.1.1 imports six without declaring it
|
|
28
|
+
"six>=1.16.0",
|
|
29
|
+
"PyYAML>=6.0.0",
|
|
30
|
+
"httpx>=0.27.0",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.optional-dependencies]
|
|
34
|
+
dev = [
|
|
35
|
+
"pytest>=8.0.0",
|
|
36
|
+
"pytest-asyncio>=1.0.0",
|
|
37
|
+
"pytest-cov>=4.1.0",
|
|
38
|
+
"pytest-xdist>=3.5.0",
|
|
39
|
+
"pytest-timeout>=2.3.0",
|
|
40
|
+
"factory-boy>=3.2.0",
|
|
41
|
+
"hypothesis>=6.0.0",
|
|
42
|
+
"mypy>=1.7.0",
|
|
43
|
+
"types-PyYAML",
|
|
44
|
+
"types-jsonschema",
|
|
45
|
+
"black>=24.0.0",
|
|
46
|
+
"ruff>=0.5.0",
|
|
47
|
+
"julee[doctrine]>=0.3.0",
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
# A kit announces itself here. Installing it does not activate it; a
|
|
51
|
+
# solution adopts it in [tool.julee] kits.
|
|
52
|
+
[project.entry-points."julee.kits"]
|
|
53
|
+
ceap = "julee_ceap:kit"
|
|
54
|
+
|
|
55
|
+
[tool.setuptools.packages.find]
|
|
56
|
+
where = ["src"]
|
|
57
|
+
include = ["julee_ceap*"]
|
|
58
|
+
|
|
59
|
+
[tool.setuptools.package-data]
|
|
60
|
+
# The demonstration loads documents by the filename documents.yaml gives,
|
|
61
|
+
# so every fixture ships, not just the structured ones.
|
|
62
|
+
julee_ceap = ["py.typed", "fixtures/*"]
|
|
63
|
+
|
|
64
|
+
[tool.julee]
|
|
65
|
+
# This kit is a julee solution in its own right, and runs its own doctrine.
|
|
66
|
+
# The package itself is the bounded context, so discovery starts above it.
|
|
67
|
+
search_root = "src"
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""CEAP: capture, extract, assemble, publish.
|
|
2
|
+
|
|
3
|
+
A julee kit. It takes documents in, extracts what a knowledge service can
|
|
4
|
+
find in them, assembles that against a specification, validates the result
|
|
5
|
+
against a policy, and publishes it — each step durable, and each step
|
|
6
|
+
recorded.
|
|
7
|
+
|
|
8
|
+
Install it, then adopt it::
|
|
9
|
+
|
|
10
|
+
[tool.julee]
|
|
11
|
+
kits = ["ceap"]
|
|
12
|
+
|
|
13
|
+
The pipeline's parts are imported from their own modules rather than from
|
|
14
|
+
here, so that a Temporal workflow does not pull in non-deterministic code
|
|
15
|
+
by importing the package::
|
|
16
|
+
|
|
17
|
+
from julee_ceap.usecases.extract_assemble_data import (
|
|
18
|
+
ExtractAssembleDataUseCase,
|
|
19
|
+
)
|
|
20
|
+
from julee_ceap.domain.models.document.document import Document
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
from julee.core.entities.kit import Kit
|
|
24
|
+
|
|
25
|
+
kit = Kit(
|
|
26
|
+
slug="ceap",
|
|
27
|
+
name="Capture, Extract, Assemble, Publish",
|
|
28
|
+
package="julee_ceap",
|
|
29
|
+
contributes={
|
|
30
|
+
"fastapi.routers": "julee_ceap.apps.api.app:app",
|
|
31
|
+
"temporal.pipelines": "julee_ceap.apps.worker",
|
|
32
|
+
"temporal.activities": "julee_ceap.infrastructure.repositories.temporal.activities",
|
|
33
|
+
},
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
__all__ = ["kit"]
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Shared helpers for resolving JSON Schema $ref values.
|
|
3
|
+
|
|
4
|
+
A bare $ref schema is a dict of exactly {"$ref": "url#/fragment"}.
|
|
5
|
+
Resolution means fetching the URL and, if a fragment is present,
|
|
6
|
+
navigating to the target sub-schema and bundling the parent $defs so
|
|
7
|
+
that internal $ref values within the sub-schema remain valid.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from typing import Any
|
|
11
|
+
|
|
12
|
+
import jsonpointer
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def extract_schema_from_fetched(
|
|
16
|
+
full_schema: dict[str, Any], fragment: str
|
|
17
|
+
) -> dict[str, Any]:
|
|
18
|
+
"""Return the sub-schema identified by *fragment* from *full_schema*.
|
|
19
|
+
|
|
20
|
+
If *fragment* is empty the full schema is returned as-is. Otherwise the
|
|
21
|
+
fragment is treated as a JSON Pointer; the target object is extracted and
|
|
22
|
+
the parent ``$defs`` are merged in so that any internal ``$ref`` values
|
|
23
|
+
within the sub-schema continue to resolve correctly.
|
|
24
|
+
"""
|
|
25
|
+
if not fragment:
|
|
26
|
+
return full_schema
|
|
27
|
+
|
|
28
|
+
target = jsonpointer.resolve_pointer(full_schema, fragment)
|
|
29
|
+
if not isinstance(target, dict):
|
|
30
|
+
raise ValueError(f"$ref fragment '{fragment}' did not resolve to a JSON object")
|
|
31
|
+
result = dict(target)
|
|
32
|
+
parent_defs = full_schema.get("$defs", {})
|
|
33
|
+
if parent_defs:
|
|
34
|
+
result["$defs"] = {**parent_defs, **result.get("$defs", {})}
|
|
35
|
+
return result
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""
|
|
2
|
+
FastAPI interface adapters for the julee CEAP workflow system.
|
|
3
|
+
|
|
4
|
+
This package contains the HTTP API layer that provides external access to the
|
|
5
|
+
CEAP (Capture, Extract, Assemble, Publish) workflow functionality.
|
|
6
|
+
|
|
7
|
+
The API follows clean architecture patterns:
|
|
8
|
+
- Request models for external client contracts (API-specific validation)
|
|
9
|
+
- Domain models returned directly as responses (no wrapper models needed)
|
|
10
|
+
- Dependency injection for use cases and repositories
|
|
11
|
+
- HTTPException for error responses with appropriate status codes
|
|
12
|
+
|
|
13
|
+
Modules:
|
|
14
|
+
- requests: Pydantic models for API request validation
|
|
15
|
+
- responses: Minimal API-specific response models (health checks, etc.)
|
|
16
|
+
- app: FastAPI application setup and endpoint definitions
|
|
17
|
+
- dependencies: Dependency injection configuration
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
__all__: list[str] = []
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"""
|
|
2
|
+
FastAPI application for julee CEAP workflow system.
|
|
3
|
+
|
|
4
|
+
This module provides the HTTP API layer for the Capture, Extract, Assemble,
|
|
5
|
+
Publish workflow system. It follows clean architecture principles with
|
|
6
|
+
proper dependency injection and error handling.
|
|
7
|
+
|
|
8
|
+
The API provides endpoints for:
|
|
9
|
+
- Knowledge service queries (CRUD operations)
|
|
10
|
+
- Assembly specifications (CRUD operations)
|
|
11
|
+
- Health checks and system status
|
|
12
|
+
|
|
13
|
+
All endpoints use domain models for responses and follow RESTful conventions
|
|
14
|
+
with proper HTTP status codes and error handling.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
import logging
|
|
18
|
+
from collections.abc import AsyncGenerator, Callable
|
|
19
|
+
from contextlib import asynccontextmanager
|
|
20
|
+
from typing import Any
|
|
21
|
+
|
|
22
|
+
import uvicorn
|
|
23
|
+
from fastapi import FastAPI
|
|
24
|
+
from fastapi.middleware.cors import CORSMiddleware
|
|
25
|
+
from fastapi_pagination import add_pagination
|
|
26
|
+
from fastapi_pagination.utils import disable_installed_extensions_check
|
|
27
|
+
|
|
28
|
+
from julee_ceap.apps.api.dependencies import (
|
|
29
|
+
get_knowledge_service_config_repository,
|
|
30
|
+
get_startup_dependencies,
|
|
31
|
+
)
|
|
32
|
+
from julee_ceap.apps.api.routers import (
|
|
33
|
+
assembly_specifications_router,
|
|
34
|
+
documents_router,
|
|
35
|
+
knowledge_service_configs_router,
|
|
36
|
+
knowledge_service_queries_router,
|
|
37
|
+
system_router,
|
|
38
|
+
workflows_router,
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
# Disable pagination extensions check for cleaner startup
|
|
42
|
+
disable_installed_extensions_check()
|
|
43
|
+
|
|
44
|
+
logger = logging.getLogger(__name__)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def setup_logging() -> None:
|
|
48
|
+
"""Configure logging for the application."""
|
|
49
|
+
logging.basicConfig(
|
|
50
|
+
level=logging.INFO,
|
|
51
|
+
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
|
52
|
+
handlers=[
|
|
53
|
+
logging.StreamHandler(),
|
|
54
|
+
],
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
# Set specific log levels
|
|
58
|
+
logging.getLogger("julee").setLevel(logging.DEBUG)
|
|
59
|
+
logging.getLogger("fastapi").setLevel(logging.INFO)
|
|
60
|
+
logging.getLogger("uvicorn").setLevel(logging.INFO)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
# Setup logging
|
|
64
|
+
setup_logging()
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def resolve_dependency(app: FastAPI, dependency_func: Callable[[], Any]) -> Any:
|
|
68
|
+
"""Resolve a dependency, respecting test overrides."""
|
|
69
|
+
override = app.dependency_overrides.get(dependency_func)
|
|
70
|
+
return override() if override else dependency_func()
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
@asynccontextmanager
|
|
74
|
+
async def lifespan(app: FastAPI) -> AsyncGenerator[None, None]:
|
|
75
|
+
"""Lifespan context manager for application startup and shutdown."""
|
|
76
|
+
# Startup
|
|
77
|
+
logger.info("Starting application initialization")
|
|
78
|
+
|
|
79
|
+
try:
|
|
80
|
+
# Check if we're in test mode by looking for repository overrides
|
|
81
|
+
if get_knowledge_service_config_repository in app.dependency_overrides:
|
|
82
|
+
logger.info("Test mode detected, skipping system initialization")
|
|
83
|
+
else:
|
|
84
|
+
# Normal production initialization
|
|
85
|
+
startup_deps = await resolve_dependency(app, get_startup_dependencies)
|
|
86
|
+
service = await startup_deps.get_system_initialization_service()
|
|
87
|
+
|
|
88
|
+
# Execute initialization
|
|
89
|
+
results = await service.initialize()
|
|
90
|
+
|
|
91
|
+
logger.info(
|
|
92
|
+
"Application initialization completed successfully",
|
|
93
|
+
extra={
|
|
94
|
+
"initialization_results": results,
|
|
95
|
+
"tasks_completed": results.get("tasks_completed", []),
|
|
96
|
+
},
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
except Exception as e:
|
|
100
|
+
logger.error(
|
|
101
|
+
"Application initialization failed",
|
|
102
|
+
exc_info=True,
|
|
103
|
+
extra={
|
|
104
|
+
"error_type": type(e).__name__,
|
|
105
|
+
"error_message": str(e),
|
|
106
|
+
},
|
|
107
|
+
)
|
|
108
|
+
# Re-raise to prevent application startup if critical init fails
|
|
109
|
+
raise
|
|
110
|
+
|
|
111
|
+
yield
|
|
112
|
+
|
|
113
|
+
# Shutdown (if needed)
|
|
114
|
+
logger.info("Application shutdown")
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
# Create FastAPI app
|
|
118
|
+
app = FastAPI(
|
|
119
|
+
title="Julee Example CEAP API",
|
|
120
|
+
description="API for the Capture, Extract, Assemble, Publish workflow",
|
|
121
|
+
version="0.1.0",
|
|
122
|
+
docs_url="/docs",
|
|
123
|
+
redoc_url="/redoc",
|
|
124
|
+
lifespan=lifespan,
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
# Add CORS middleware
|
|
128
|
+
app.add_middleware(
|
|
129
|
+
CORSMiddleware,
|
|
130
|
+
allow_origins=["*"], # Configure appropriately for production
|
|
131
|
+
allow_credentials=True,
|
|
132
|
+
allow_methods=["*"],
|
|
133
|
+
allow_headers=["*"],
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
# Add pagination support
|
|
137
|
+
_ = add_pagination(app)
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
# Include routers
|
|
141
|
+
app.include_router(system_router, tags=["System"])
|
|
142
|
+
|
|
143
|
+
app.include_router(
|
|
144
|
+
knowledge_service_queries_router,
|
|
145
|
+
prefix="/knowledge_service_queries",
|
|
146
|
+
tags=["Knowledge Service Queries"],
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
app.include_router(
|
|
150
|
+
knowledge_service_configs_router,
|
|
151
|
+
prefix="/knowledge_service_configs",
|
|
152
|
+
tags=["Knowledge Service Configs"],
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
app.include_router(
|
|
156
|
+
assembly_specifications_router,
|
|
157
|
+
prefix="/assembly_specifications",
|
|
158
|
+
tags=["Assembly Specifications"],
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
app.include_router(
|
|
162
|
+
documents_router,
|
|
163
|
+
prefix="/documents",
|
|
164
|
+
tags=["Documents"],
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
app.include_router(
|
|
168
|
+
workflows_router,
|
|
169
|
+
prefix="/workflows",
|
|
170
|
+
tags=["Workflows"],
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
if __name__ == "__main__":
|
|
175
|
+
uvicorn.run(
|
|
176
|
+
"julee_ceap.apps.api.app:app",
|
|
177
|
+
host="0.0.0.0",
|
|
178
|
+
port=8000,
|
|
179
|
+
reload=True,
|
|
180
|
+
log_level="info",
|
|
181
|
+
)
|