julee 0.1.0__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.
Files changed (161) hide show
  1. julee/__init__.py +3 -0
  2. julee/api/__init__.py +20 -0
  3. julee/api/app.py +180 -0
  4. julee/api/dependencies.py +257 -0
  5. julee/api/requests.py +175 -0
  6. julee/api/responses.py +43 -0
  7. julee/api/routers/__init__.py +43 -0
  8. julee/api/routers/assembly_specifications.py +212 -0
  9. julee/api/routers/documents.py +182 -0
  10. julee/api/routers/knowledge_service_configs.py +79 -0
  11. julee/api/routers/knowledge_service_queries.py +293 -0
  12. julee/api/routers/system.py +137 -0
  13. julee/api/routers/workflows.py +234 -0
  14. julee/api/services/__init__.py +20 -0
  15. julee/api/services/system_initialization.py +214 -0
  16. julee/api/tests/__init__.py +14 -0
  17. julee/api/tests/routers/__init__.py +17 -0
  18. julee/api/tests/routers/test_assembly_specifications.py +749 -0
  19. julee/api/tests/routers/test_documents.py +301 -0
  20. julee/api/tests/routers/test_knowledge_service_configs.py +234 -0
  21. julee/api/tests/routers/test_knowledge_service_queries.py +738 -0
  22. julee/api/tests/routers/test_system.py +179 -0
  23. julee/api/tests/routers/test_workflows.py +393 -0
  24. julee/api/tests/test_app.py +285 -0
  25. julee/api/tests/test_dependencies.py +245 -0
  26. julee/api/tests/test_requests.py +250 -0
  27. julee/domain/__init__.py +22 -0
  28. julee/domain/models/__init__.py +49 -0
  29. julee/domain/models/assembly/__init__.py +17 -0
  30. julee/domain/models/assembly/assembly.py +103 -0
  31. julee/domain/models/assembly/tests/__init__.py +0 -0
  32. julee/domain/models/assembly/tests/factories.py +37 -0
  33. julee/domain/models/assembly/tests/test_assembly.py +430 -0
  34. julee/domain/models/assembly_specification/__init__.py +24 -0
  35. julee/domain/models/assembly_specification/assembly_specification.py +172 -0
  36. julee/domain/models/assembly_specification/knowledge_service_query.py +123 -0
  37. julee/domain/models/assembly_specification/tests/__init__.py +0 -0
  38. julee/domain/models/assembly_specification/tests/factories.py +78 -0
  39. julee/domain/models/assembly_specification/tests/test_assembly_specification.py +490 -0
  40. julee/domain/models/assembly_specification/tests/test_knowledge_service_query.py +310 -0
  41. julee/domain/models/custom_fields/__init__.py +0 -0
  42. julee/domain/models/custom_fields/content_stream.py +68 -0
  43. julee/domain/models/custom_fields/tests/__init__.py +0 -0
  44. julee/domain/models/custom_fields/tests/test_custom_fields.py +53 -0
  45. julee/domain/models/document/__init__.py +17 -0
  46. julee/domain/models/document/document.py +150 -0
  47. julee/domain/models/document/tests/__init__.py +0 -0
  48. julee/domain/models/document/tests/factories.py +76 -0
  49. julee/domain/models/document/tests/test_document.py +297 -0
  50. julee/domain/models/knowledge_service_config/__init__.py +17 -0
  51. julee/domain/models/knowledge_service_config/knowledge_service_config.py +86 -0
  52. julee/domain/models/policy/__init__.py +15 -0
  53. julee/domain/models/policy/document_policy_validation.py +220 -0
  54. julee/domain/models/policy/policy.py +203 -0
  55. julee/domain/models/policy/tests/__init__.py +0 -0
  56. julee/domain/models/policy/tests/factories.py +47 -0
  57. julee/domain/models/policy/tests/test_document_policy_validation.py +420 -0
  58. julee/domain/models/policy/tests/test_policy.py +546 -0
  59. julee/domain/repositories/__init__.py +27 -0
  60. julee/domain/repositories/assembly.py +45 -0
  61. julee/domain/repositories/assembly_specification.py +52 -0
  62. julee/domain/repositories/base.py +146 -0
  63. julee/domain/repositories/document.py +49 -0
  64. julee/domain/repositories/document_policy_validation.py +52 -0
  65. julee/domain/repositories/knowledge_service_config.py +54 -0
  66. julee/domain/repositories/knowledge_service_query.py +44 -0
  67. julee/domain/repositories/policy.py +49 -0
  68. julee/domain/use_cases/__init__.py +17 -0
  69. julee/domain/use_cases/decorators.py +107 -0
  70. julee/domain/use_cases/extract_assemble_data.py +649 -0
  71. julee/domain/use_cases/initialize_system_data.py +842 -0
  72. julee/domain/use_cases/tests/__init__.py +7 -0
  73. julee/domain/use_cases/tests/test_extract_assemble_data.py +548 -0
  74. julee/domain/use_cases/tests/test_initialize_system_data.py +455 -0
  75. julee/domain/use_cases/tests/test_validate_document.py +1228 -0
  76. julee/domain/use_cases/validate_document.py +736 -0
  77. julee/fixtures/assembly_specifications.yaml +70 -0
  78. julee/fixtures/documents.yaml +178 -0
  79. julee/fixtures/knowledge_service_configs.yaml +37 -0
  80. julee/fixtures/knowledge_service_queries.yaml +27 -0
  81. julee/repositories/__init__.py +17 -0
  82. julee/repositories/memory/__init__.py +31 -0
  83. julee/repositories/memory/assembly.py +84 -0
  84. julee/repositories/memory/assembly_specification.py +125 -0
  85. julee/repositories/memory/base.py +227 -0
  86. julee/repositories/memory/document.py +149 -0
  87. julee/repositories/memory/document_policy_validation.py +104 -0
  88. julee/repositories/memory/knowledge_service_config.py +123 -0
  89. julee/repositories/memory/knowledge_service_query.py +120 -0
  90. julee/repositories/memory/policy.py +87 -0
  91. julee/repositories/memory/tests/__init__.py +0 -0
  92. julee/repositories/memory/tests/test_document.py +212 -0
  93. julee/repositories/memory/tests/test_document_policy_validation.py +161 -0
  94. julee/repositories/memory/tests/test_policy.py +443 -0
  95. julee/repositories/minio/__init__.py +31 -0
  96. julee/repositories/minio/assembly.py +103 -0
  97. julee/repositories/minio/assembly_specification.py +170 -0
  98. julee/repositories/minio/client.py +570 -0
  99. julee/repositories/minio/document.py +530 -0
  100. julee/repositories/minio/document_policy_validation.py +120 -0
  101. julee/repositories/minio/knowledge_service_config.py +187 -0
  102. julee/repositories/minio/knowledge_service_query.py +211 -0
  103. julee/repositories/minio/policy.py +106 -0
  104. julee/repositories/minio/tests/__init__.py +0 -0
  105. julee/repositories/minio/tests/fake_client.py +213 -0
  106. julee/repositories/minio/tests/test_assembly.py +374 -0
  107. julee/repositories/minio/tests/test_assembly_specification.py +391 -0
  108. julee/repositories/minio/tests/test_client_protocol.py +57 -0
  109. julee/repositories/minio/tests/test_document.py +591 -0
  110. julee/repositories/minio/tests/test_document_policy_validation.py +192 -0
  111. julee/repositories/minio/tests/test_knowledge_service_config.py +374 -0
  112. julee/repositories/minio/tests/test_knowledge_service_query.py +438 -0
  113. julee/repositories/minio/tests/test_policy.py +559 -0
  114. julee/repositories/temporal/__init__.py +38 -0
  115. julee/repositories/temporal/activities.py +114 -0
  116. julee/repositories/temporal/activity_names.py +34 -0
  117. julee/repositories/temporal/proxies.py +159 -0
  118. julee/services/__init__.py +18 -0
  119. julee/services/knowledge_service/__init__.py +48 -0
  120. julee/services/knowledge_service/anthropic/__init__.py +12 -0
  121. julee/services/knowledge_service/anthropic/knowledge_service.py +331 -0
  122. julee/services/knowledge_service/anthropic/tests/test_knowledge_service.py +318 -0
  123. julee/services/knowledge_service/factory.py +138 -0
  124. julee/services/knowledge_service/knowledge_service.py +160 -0
  125. julee/services/knowledge_service/memory/__init__.py +13 -0
  126. julee/services/knowledge_service/memory/knowledge_service.py +278 -0
  127. julee/services/knowledge_service/memory/test_knowledge_service.py +345 -0
  128. julee/services/knowledge_service/test_factory.py +112 -0
  129. julee/services/temporal/__init__.py +38 -0
  130. julee/services/temporal/activities.py +86 -0
  131. julee/services/temporal/activity_names.py +22 -0
  132. julee/services/temporal/proxies.py +41 -0
  133. julee/util/__init__.py +0 -0
  134. julee/util/domain.py +119 -0
  135. julee/util/repos/__init__.py +0 -0
  136. julee/util/repos/minio/__init__.py +0 -0
  137. julee/util/repos/minio/file_storage.py +213 -0
  138. julee/util/repos/temporal/__init__.py +11 -0
  139. julee/util/repos/temporal/client_proxies/file_storage.py +68 -0
  140. julee/util/repos/temporal/data_converter.py +123 -0
  141. julee/util/repos/temporal/minio_file_storage.py +12 -0
  142. julee/util/repos/temporal/proxies/__init__.py +0 -0
  143. julee/util/repos/temporal/proxies/file_storage.py +58 -0
  144. julee/util/repositories.py +55 -0
  145. julee/util/temporal/__init__.py +22 -0
  146. julee/util/temporal/activities.py +123 -0
  147. julee/util/temporal/decorators.py +473 -0
  148. julee/util/tests/__init__.py +1 -0
  149. julee/util/tests/test_decorators.py +770 -0
  150. julee/util/validation/__init__.py +29 -0
  151. julee/util/validation/repository.py +100 -0
  152. julee/util/validation/type_guards.py +369 -0
  153. julee/worker.py +211 -0
  154. julee/workflows/__init__.py +26 -0
  155. julee/workflows/extract_assemble.py +215 -0
  156. julee/workflows/validate_document.py +228 -0
  157. julee-0.1.0.dist-info/METADATA +195 -0
  158. julee-0.1.0.dist-info/RECORD +161 -0
  159. julee-0.1.0.dist-info/WHEEL +5 -0
  160. julee-0.1.0.dist-info/licenses/LICENSE +674 -0
  161. julee-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,70 @@
1
+ assembly_specifications:
2
+ - assembly_specification_id: "meeting-minutes-assembly"
3
+ name: "Meeting Minutes Assembly"
4
+ applicability: "Meeting transcripts from video conferences or in-person meetings that need to be structured into formal meeting minutes"
5
+ status: "active"
6
+ version: "1.0"
7
+ jsonschema:
8
+ $schema: "http://json-schema.org/draft-07/schema#"
9
+ title: "Meeting Minutes"
10
+ type: "object"
11
+ properties:
12
+ meeting_info:
13
+ type: "object"
14
+ properties:
15
+ title:
16
+ type: "string"
17
+ date:
18
+ type: "string"
19
+ format: "date"
20
+ start_time:
21
+ type: "string"
22
+ end_time:
23
+ type: "string"
24
+ attendees:
25
+ type: "array"
26
+ items:
27
+ type: "object"
28
+ properties:
29
+ name:
30
+ type: "string"
31
+ role:
32
+ type: "string"
33
+ required: ["name", "role"]
34
+ required: ["title", "date", "attendees"]
35
+ agenda_items:
36
+ type: "array"
37
+ items:
38
+ type: "object"
39
+ properties:
40
+ topic:
41
+ type: "string"
42
+ discussion_points:
43
+ type: "array"
44
+ items:
45
+ type: "string"
46
+ decisions:
47
+ type: "array"
48
+ items:
49
+ type: "string"
50
+ required: ["topic"]
51
+ action_items:
52
+ type: "array"
53
+ items:
54
+ type: "object"
55
+ properties:
56
+ task:
57
+ type: "string"
58
+ assignee:
59
+ type: "string"
60
+ due_date:
61
+ type: "string"
62
+ priority:
63
+ type: "string"
64
+ enum: ["low", "medium", "high"]
65
+ required: ["task", "assignee"]
66
+ required: ["meeting_info", "agenda_items"]
67
+ knowledge_service_queries:
68
+ "/properties/meeting_info": "extract-meeting-info-query"
69
+ "/properties/agenda_items": "extract-agenda-items-query"
70
+ "/properties/action_items": "extract-action-items-query"
@@ -0,0 +1,178 @@
1
+ # Documents Fixture Configuration
2
+ #
3
+ # This file defines the documents that should be created during system
4
+ # initialization for testing and demonstration purposes. Each document
5
+ # represents a sample file with content and metadata that can be used
6
+ # in the CEAP workflow.
7
+ #
8
+ # The documents are loaded during application startup and stored in the
9
+ # repository if they don't already exist (idempotent loading).
10
+
11
+ documents:
12
+ - document_id: "meeting-transcript-q1-planning"
13
+ original_filename: "q1_planning_meeting.txt"
14
+ content_type: "text/plain"
15
+ status: "captured"
16
+ additional_metadata:
17
+ meeting_type: "planning_session"
18
+ quarter: "Q1 2024"
19
+ attendee_count: 3
20
+ duration_minutes: 90
21
+ department: "product"
22
+ content: |
23
+ Meeting Transcript - Q1 Planning Session
24
+ Date: March 15, 2024
25
+ Time: 2:00 PM - 3:30 PM
26
+ Attendees: Sarah Chen (Product Manager), Mike Rodriguez (Engineering Lead),
27
+ Lisa Wang (Designer)
28
+
29
+ Sarah: Thanks everyone for joining. Let's kick off our Q1 planning. Mike,
30
+ can you give us an update on the current sprint?
31
+
32
+ Mike: Sure, we're about 80% through sprint 23. We've completed the user
33
+ authentication module and are working on the data migration tool. Should be
34
+ done by Friday.
35
+
36
+ Lisa: Great! I've finished the mockups for the dashboard redesign. Sarah,
37
+ have you had a chance to review them?
38
+
39
+ Sarah: Yes, they look fantastic. I especially like the new navigation
40
+ structure. When can we start implementation?
41
+
42
+ Mike: I'd estimate 2 weeks for the frontend work, plus another week for
43
+ backend API changes.
44
+
45
+ Lisa: I can start on the component library updates while Mike works on the
46
+ APIs.
47
+
48
+ Sarah: Perfect. Let's also discuss the customer feedback integration. We had
49
+ 47 responses to our survey.
50
+
51
+ Mike: The main requests were for better reporting and mobile optimization.
52
+
53
+ Sarah: Those should be our next priorities then. Lisa, can you start
54
+ sketching mobile designs?
55
+
56
+ Lisa: Absolutely. I'll have initial concepts by next Tuesday.
57
+
58
+ Sarah: Excellent. Any other items?
59
+
60
+ Mike: Just a heads up that we'll need to schedule downtime for the database
61
+ migration, probably next weekend.
62
+
63
+ Sarah: Noted. I'll coordinate with support. Meeting adjourned at 3:30 PM.
64
+
65
+ - document_id: "customer-feedback-survey-q4"
66
+ original_filename: "customer_survey_results_q4_2023.txt"
67
+ content_type: "text/plain"
68
+ status: "captured"
69
+ additional_metadata:
70
+ survey_type: "customer_satisfaction"
71
+ quarter: "Q4 2023"
72
+ response_count: 47
73
+ department: "product"
74
+ collection_method: "email_survey"
75
+ content: |
76
+ Customer Feedback Survey Results - Q4 2023
77
+ Survey Period: October 1 - December 31, 2023
78
+ Total Responses: 47
79
+ Response Rate: 23.5%
80
+
81
+ === SUMMARY ===
82
+ Overall Satisfaction: 4.2/5.0 (up from 3.9 in Q3)
83
+ Net Promoter Score: +15 (up from +8 in Q3)
84
+
85
+ === TOP REQUESTED FEATURES ===
86
+ 1. Better reporting dashboard (mentioned by 78% of respondents)
87
+ 2. Mobile application/optimization (mentioned by 65% of respondents)
88
+ 3. Advanced filtering options (mentioned by 52% of respondents)
89
+ 4. Real-time collaboration features (mentioned by 43% of respondents)
90
+ 5. API access for integrations (mentioned by 39% of respondents)
91
+
92
+ === KEY FEEDBACK THEMES ===
93
+
94
+ Positive Feedback:
95
+ - "Love the recent performance improvements" - Customer #23
96
+ - "Interface is much cleaner than competitors" - Customer #41
97
+ - "Support team is very responsive" - Customer #15
98
+
99
+ Areas for Improvement:
100
+ - "Mobile experience feels like an afterthought" - Customer #7
101
+ - "Reports are too basic for our needs" - Customer #31
102
+ - "Would love more customization options" - Customer #18
103
+
104
+ === DETAILED METRICS ===
105
+ Feature Usage:
106
+ - Dashboard: 95% of users
107
+ - Reports: 73% of users
108
+ - Collaboration: 45% of users
109
+ - API: 12% of users
110
+
111
+ Support Satisfaction: 4.5/5.0
112
+ Performance Rating: 4.1/5.0
113
+ Ease of Use: 4.0/5.0
114
+
115
+ - document_id: "project-requirements-doc"
116
+ original_filename: "mobile_optimization_requirements.md"
117
+ content_type: "text/markdown"
118
+ status: "registered"
119
+ knowledge_service_id: "anthropic-4.5-as-a-knowledge-service"
120
+ assembly_types: ["technical_specification"]
121
+ additional_metadata:
122
+ document_type: "requirements"
123
+ project: "mobile_optimization"
124
+ priority: "high"
125
+ department: "engineering"
126
+ version: "1.2"
127
+ content: |
128
+ # Mobile Optimization Project Requirements
129
+
130
+ ## Overview
131
+ Based on Q4 customer feedback indicating 65% of users want better mobile experience,
132
+ this document outlines requirements for mobile optimization across our platform.
133
+
134
+ ## Stakeholders
135
+ - **Product Owner**: Sarah Chen
136
+ - **Tech Lead**: Mike Rodriguez
137
+ - **UX Designer**: Lisa Wang
138
+ - **QA Lead**: James Kim
139
+
140
+ ## Success Criteria
141
+ - Mobile page load time < 3 seconds
142
+ - 95%+ responsive design coverage
143
+ - Touch-friendly interface elements
144
+ - Offline capability for core features
145
+ - App store rating > 4.0
146
+
147
+ ## Technical Requirements
148
+
149
+ ### Performance
150
+ - Implement lazy loading for images and components
151
+ - Optimize bundle size (target: <2MB initial load)
152
+ - Add service worker for caching
153
+ - Implement progressive web app (PWA) features
154
+
155
+ ### User Experience
156
+ - Responsive breakpoints: 320px, 768px, 1024px, 1440px
157
+ - Touch targets minimum 44px x 44px
158
+ - Swipe gestures for navigation
159
+ - Pull-to-refresh functionality
160
+ - Bottom navigation for primary actions
161
+
162
+ ### Browser Support
163
+ - iOS Safari (last 2 versions)
164
+ - Android Chrome (last 2 versions)
165
+ - Samsung Internet (latest)
166
+ - Firefox Mobile (latest)
167
+
168
+ ## Timeline
169
+ - **Phase 1 (2 weeks)**: Core responsive layouts
170
+ - **Phase 2 (1 week)**: Performance optimizations
171
+ - **Phase 3 (1 week)**: PWA features and testing
172
+
173
+ ## Definition of Done
174
+ - [ ] All pages responsive on target devices
175
+ - [ ] Performance metrics meet targets
176
+ - [ ] Accessibility audit passes (WCAG 2.1 AA)
177
+ - [ ] Cross-browser testing complete
178
+ - [ ] QA sign-off received
@@ -0,0 +1,37 @@
1
+ # Knowledge Services Fixture Configuration
2
+ #
3
+ # This file defines the knowledge service configurations that should be
4
+ # created during system initialization. Each configuration represents
5
+ # an external AI/ML service that can be used for document analysis
6
+ # and data extraction in the CEAP workflow.
7
+ #
8
+ # The configurations are loaded during application startup and stored
9
+ # in the repository if they don't already exist (idempotent loading).
10
+
11
+ knowledge_services:
12
+ - knowledge_service_id: "anthropic-4.5-as-a-knowledge-service"
13
+ name: "Anthropic 4.5 sonnet as a Knowledge Service"
14
+ description: "Uses Anthropic's Claude Sonnet 4.5 with its beta file API as an initial knowledge service"
15
+ service_api: "anthropic"
16
+ metadata:
17
+ model: "claude-sonnet-4-5"
18
+ max_tokens: 4096
19
+ temperature: 0.2
20
+ capabilities:
21
+ - "text_analysis"
22
+ - "document_extraction"
23
+ - "summarization"
24
+ - "question_answering"
25
+
26
+ - knowledge_service_id: "anthropic-claude-haiku"
27
+ name: "Anthropic Claude Haiku 4.5 as a knowledge service"
28
+ description: "Uses Anthropic's Claude Haiku 4.5 for fast, lightweight text processing"
29
+ service_api: "anthropic"
30
+ metadata:
31
+ model: "claude-haiku-4-5"
32
+ max_tokens: 2048
33
+ temperature: 0.1
34
+ capabilities:
35
+ - "quick_analysis"
36
+ - "simple_extraction"
37
+ - "classification"
@@ -0,0 +1,27 @@
1
+ knowledge_service_queries:
2
+ - query_id: "extract-meeting-info-query"
3
+ name: "Extract Meeting Information"
4
+ knowledge_service_id: "anthropic-4.5-as-a-knowledge-service"
5
+ prompt: "Extract the basic meeting information from this transcript including title, date, times, and attendees with their roles."
6
+ assistant_prompt: "Looking at the meeting transcript, here's the extracted meeting information that conforms to the provided schema, without surrounding ```json ... ``` markers:"
7
+ query_metadata:
8
+ max_tokens: 1000
9
+ temperature: 0.1
10
+
11
+ - query_id: "extract-agenda-items-query"
12
+ name: "Extract Agenda Items"
13
+ knowledge_service_id: "anthropic-4.5-as-a-knowledge-service"
14
+ prompt: "Analyze the meeting transcript and extract the main agenda items discussed, including the topic, key discussion points, and any decisions made for each item."
15
+ assistant_prompt: "Analyzing the meeting transcript, here are the agenda items with discussion points and decisions that conform to the provided schema, without surrounding ```json ... ``` markers:"
16
+ query_metadata:
17
+ max_tokens: 2000
18
+ temperature: 0.1
19
+
20
+ - query_id: "extract-action-items-query"
21
+ name: "Extract Action Items"
22
+ knowledge_service_id: "anthropic-4.5-as-a-knowledge-service"
23
+ prompt: "Identify and extract action items from the meeting transcript, including the specific task, who it's assigned to, any mentioned due dates, and the priority level."
24
+ assistant_prompt: "From the meeting transcript, here are the identified action items formatted according to the provided schema, without surrounding ```json ... ``` markers:"
25
+ query_metadata:
26
+ max_tokens: 1500
27
+ temperature: 0.1
@@ -0,0 +1,17 @@
1
+ """
2
+ Repository implementations and infrastructure.
3
+
4
+ This package contains concrete implementations of the repository interfaces
5
+ defined in julee.domain.repositories.
6
+
7
+ Implementation packages:
8
+ - memory: In-memory implementations for testing
9
+ - minio: MinIO-based implementations for production
10
+ - temporal: Temporal workflow proxy implementations
11
+
12
+ Import implementations using their full module paths, e.g.:
13
+ from julee.repositories.memory import MemoryDocumentRepository
14
+ from julee.repositories.minio.document import (
15
+ MinioDocumentRepository,
16
+ )
17
+ """
@@ -0,0 +1,31 @@
1
+ """
2
+ Memory repository implementations for julee domain.
3
+
4
+ This module exports in-memory implementations of all repository protocols
5
+ for the Capture, Extract, Assemble, Publish workflow. These implementations
6
+ use Python dictionaries for storage and are ideal for testing scenarios
7
+ where external dependencies should be avoided.
8
+
9
+ All implementations maintain the same async interfaces as their production
10
+ counterparts while providing lightweight, dependency-free alternatives.
11
+ """
12
+
13
+ from .assembly import MemoryAssemblyRepository
14
+ from .assembly_specification import MemoryAssemblySpecificationRepository
15
+ from .document import MemoryDocumentRepository
16
+ from .document_policy_validation import (
17
+ MemoryDocumentPolicyValidationRepository,
18
+ )
19
+ from .knowledge_service_config import MemoryKnowledgeServiceConfigRepository
20
+ from .knowledge_service_query import MemoryKnowledgeServiceQueryRepository
21
+ from .policy import MemoryPolicyRepository
22
+
23
+ __all__ = [
24
+ "MemoryAssemblyRepository",
25
+ "MemoryAssemblySpecificationRepository",
26
+ "MemoryDocumentRepository",
27
+ "MemoryDocumentPolicyValidationRepository",
28
+ "MemoryKnowledgeServiceConfigRepository",
29
+ "MemoryKnowledgeServiceQueryRepository",
30
+ "MemoryPolicyRepository",
31
+ ]
@@ -0,0 +1,84 @@
1
+ """
2
+ Memory implementation of AssemblyRepository.
3
+
4
+ This module provides an in-memory implementation of the AssemblyRepository
5
+ protocol that follows the Clean Architecture patterns defined in the
6
+ Fun-Police Framework. It handles assembly storage in memory dictionaries,
7
+ ensuring idempotency and proper error handling.
8
+
9
+ The implementation uses Python dictionaries to store assembly data, making it
10
+ ideal for testing scenarios where external dependencies should be avoided.
11
+ All operations are still async to maintain interface compatibility.
12
+ """
13
+
14
+ import logging
15
+ from typing import Optional, Dict, Any, List
16
+
17
+ from julee.domain.models.assembly import Assembly
18
+ from julee.domain.repositories.assembly import AssemblyRepository
19
+ from .base import MemoryRepositoryMixin
20
+
21
+ logger = logging.getLogger(__name__)
22
+
23
+
24
+ class MemoryAssemblyRepository(AssemblyRepository, MemoryRepositoryMixin[Assembly]):
25
+ """
26
+ Memory implementation of AssemblyRepository using Python dictionaries.
27
+
28
+ This implementation stores assembly data in memory using a dictionary
29
+ keyed by assembly_id. This provides a lightweight, dependency-free
30
+ option for testing.
31
+ """
32
+
33
+ def __init__(self) -> None:
34
+ """Initialize repository with empty in-memory storage."""
35
+ self.logger = logger
36
+ self.entity_name = "Assembly"
37
+ self.storage_dict: Dict[str, Assembly] = {}
38
+
39
+ logger.debug("Initializing MemoryAssemblyRepository")
40
+
41
+ async def get(self, assembly_id: str) -> Optional[Assembly]:
42
+ """Retrieve an assembly by ID.
43
+
44
+ Args:
45
+ assembly_id: Unique assembly identifier
46
+
47
+ Returns:
48
+ Assembly if found, None otherwise
49
+ """
50
+ return self.get_entity(assembly_id)
51
+
52
+ async def save(self, assembly: Assembly) -> None:
53
+ """Save assembly metadata (status, updated_at, etc.).
54
+
55
+ Args:
56
+ assembly: Assembly entity
57
+ """
58
+ self.save_entity(assembly, "assembly_id")
59
+
60
+ async def generate_id(self) -> str:
61
+ """Generate a unique assembly identifier.
62
+
63
+ Returns:
64
+ Unique assembly ID string
65
+ """
66
+ return self.generate_entity_id("assembly")
67
+
68
+ async def get_many(self, assembly_ids: List[str]) -> Dict[str, Optional[Assembly]]:
69
+ """Retrieve multiple assemblies by ID.
70
+
71
+ Args:
72
+ assembly_ids: List of unique assembly identifiers
73
+
74
+ Returns:
75
+ Dict mapping assembly_id to Assembly (or None if not found)
76
+ """
77
+ return self.get_many_entities(assembly_ids)
78
+
79
+ def _add_entity_specific_log_data(
80
+ self, entity: Assembly, log_data: Dict[str, Any]
81
+ ) -> None:
82
+ """Add assembly-specific data to log entries."""
83
+ super()._add_entity_specific_log_data(entity, log_data)
84
+ log_data["assembled_document_id"] = entity.assembled_document_id
@@ -0,0 +1,125 @@
1
+ """
2
+ Memory implementation of AssemblySpecificationRepository.
3
+
4
+ This module provides an in-memory implementation of the
5
+ AssemblySpecificationRepository protocol that follows the Clean Architecture
6
+ patterns defined in the Fun-Police Framework. It handles assembly
7
+ specification storage with JSON schemas and knowledge service query
8
+ configurations in memory dictionaries, ensuring idempotency and proper
9
+ error handling.
10
+
11
+ The implementation uses Python dictionaries to store specification data,
12
+ making it ideal for testing scenarios where external dependencies should be
13
+ avoided. All operations are still async to maintain interface compatibility.
14
+ """
15
+
16
+ import logging
17
+ from typing import Optional, Dict, Any, List
18
+
19
+ from julee.domain.models.assembly_specification import (
20
+ AssemblySpecification,
21
+ )
22
+ from julee.domain.repositories.assembly_specification import (
23
+ AssemblySpecificationRepository,
24
+ )
25
+ from .base import MemoryRepositoryMixin
26
+
27
+ logger = logging.getLogger(__name__)
28
+
29
+
30
+ class MemoryAssemblySpecificationRepository(
31
+ AssemblySpecificationRepository,
32
+ MemoryRepositoryMixin[AssemblySpecification],
33
+ ):
34
+ """
35
+ Memory implementation of AssemblySpecificationRepository using Python
36
+ dictionaries.
37
+
38
+ This implementation stores assembly specifications in memory:
39
+ - Specifications: Dictionary keyed by assembly_specification_id containing
40
+ AssemblySpecification objects
41
+
42
+ This provides a lightweight, dependency-free option for testing while
43
+ maintaining the same interface as other implementations.
44
+ """
45
+
46
+ def __init__(self) -> None:
47
+ """Initialize repository with empty in-memory storage."""
48
+ self.logger = logger
49
+ self.entity_name = "AssemblySpecification"
50
+ self.storage_dict: Dict[str, AssemblySpecification] = {}
51
+
52
+ logger.debug("Initializing MemoryAssemblySpecificationRepository")
53
+
54
+ async def get(
55
+ self, assembly_specification_id: str
56
+ ) -> Optional[AssemblySpecification]:
57
+ """Retrieve an assembly specification by ID.
58
+
59
+ Args:
60
+ assembly_specification_id: Unique specification identifier
61
+
62
+ Returns:
63
+ AssemblySpecification if found, None otherwise
64
+ """
65
+ return self.get_entity(assembly_specification_id)
66
+
67
+ async def save(self, assembly_specification: AssemblySpecification) -> None:
68
+ """Save an assembly specification.
69
+
70
+ Args:
71
+ assembly_specification: Complete AssemblySpecification to save
72
+ """
73
+ self.save_entity(assembly_specification, "assembly_specification_id")
74
+
75
+ async def generate_id(self) -> str:
76
+ """Generate a unique assembly specification identifier.
77
+
78
+ Returns:
79
+ Unique assembly specification ID string
80
+ """
81
+ return self.generate_entity_id("spec")
82
+
83
+ async def get_many(
84
+ self, assembly_specification_ids: List[str]
85
+ ) -> Dict[str, Optional[AssemblySpecification]]:
86
+ """Retrieve multiple assembly specifications by ID.
87
+
88
+ Args:
89
+ assembly_specification_ids: List of unique specification
90
+ identifiers
91
+
92
+ Returns:
93
+ Dict mapping specification_id to AssemblySpecification (or None if
94
+ not found)
95
+ """
96
+ return self.get_many_entities(assembly_specification_ids)
97
+
98
+ async def list_all(self) -> List[AssemblySpecification]:
99
+ """List all assembly specifications.
100
+
101
+ Returns:
102
+ List of all AssemblySpecification entities in the repository
103
+ """
104
+ self.logger.debug(
105
+ f"Memory{self.entity_name}Repository: Listing all "
106
+ f"{self.entity_name.lower()}s"
107
+ )
108
+
109
+ specifications = list(self.storage_dict.values())
110
+
111
+ self.logger.info(
112
+ f"Memory{self.entity_name}Repository: Listed all "
113
+ f"{self.entity_name.lower()}s",
114
+ extra={"count": len(specifications)},
115
+ )
116
+
117
+ return specifications
118
+
119
+ def _add_entity_specific_log_data(
120
+ self, entity: AssemblySpecification, log_data: Dict[str, Any]
121
+ ) -> None:
122
+ """Add assembly specification-specific data to log entries."""
123
+ super()._add_entity_specific_log_data(entity, log_data)
124
+ log_data["spec_name"] = entity.name
125
+ log_data["version"] = entity.version