documente_shared 0.1.77__tar.gz → 0.1.79__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.

Potentially problematic release.


This version of documente_shared might be problematic. Click here for more details.

Files changed (42) hide show
  1. {documente_shared-0.1.77 → documente_shared-0.1.79}/PKG-INFO +1 -1
  2. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/domain/entities/processing_case_item.py +10 -4
  3. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/domain/repositories/processing_case_item.py +4 -0
  4. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/infrastructure/repositories/dynamo_processing_case_item.py +14 -4
  5. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/infrastructure/repositories/http_processing_case_item.py +6 -2
  6. {documente_shared-0.1.77 → documente_shared-0.1.79}/pyproject.toml +1 -1
  7. {documente_shared-0.1.77 → documente_shared-0.1.79}/README.md +0 -0
  8. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/__init__.py +0 -0
  9. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/application/__init__.py +0 -0
  10. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/application/digest.py +0 -0
  11. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/application/exceptions.py +0 -0
  12. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/application/files.py +0 -0
  13. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/application/query_params.py +0 -0
  14. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/application/time_utils.py +0 -0
  15. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/application/timezone.py +0 -0
  16. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/domain/__init__.py +0 -0
  17. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/domain/base_enum.py +0 -0
  18. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/domain/constants.py +0 -0
  19. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/domain/entities/__init__.py +0 -0
  20. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/domain/entities/document.py +0 -0
  21. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/domain/entities/document_metadata.py +0 -0
  22. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/domain/entities/in_memory_result.py +0 -0
  23. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/domain/entities/processing_case.py +0 -0
  24. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/domain/entities/processing_case_filters.py +0 -0
  25. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/domain/entities/processing_case_item_filters.py +0 -0
  26. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/domain/entities/processing_event.py +0 -0
  27. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/domain/enums/__init__.py +0 -0
  28. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/domain/enums/common.py +0 -0
  29. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/domain/enums/document.py +0 -0
  30. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/domain/enums/processing_case.py +0 -0
  31. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/domain/repositories/__init__.py +0 -0
  32. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/domain/repositories/document.py +0 -0
  33. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/domain/repositories/processing_case.py +0 -0
  34. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/infrastructure/__init__.py +0 -0
  35. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/infrastructure/documente_client.py +0 -0
  36. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/infrastructure/dynamo_table.py +0 -0
  37. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/infrastructure/repositories/__init__.py +0 -0
  38. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/infrastructure/repositories/dynamo_document.py +0 -0
  39. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/infrastructure/repositories/dynamo_processing_case.py +0 -0
  40. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/infrastructure/repositories/http_processing_case.py +0 -0
  41. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/infrastructure/s3_bucket.py +0 -0
  42. {documente_shared-0.1.77 → documente_shared-0.1.79}/documente_shared/infrastructure/sqs_queue.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: documente_shared
3
- Version: 0.1.77
3
+ Version: 0.1.79
4
4
  Summary: Shared utilities for Documente AI projects
5
5
  License: MIT
6
6
  Author: Tech
@@ -16,8 +16,8 @@ class ProcessingCaseItem(object):
16
16
  case_id: str
17
17
  digest: str
18
18
  status: ProcessingStatus
19
- document_type: ProcessingDocumentType
20
19
  document: InMemoryDocument
20
+ document_type: Optional[ProcessingDocumentType] = None
21
21
  uploaded_from: Optional[ProcessingSource] = None
22
22
  processed_csv: Optional[InMemoryDocument] = None
23
23
  processed_xlsx: Optional[InMemoryDocument] = None
@@ -107,7 +107,10 @@ class ProcessingCaseItem(object):
107
107
  'digest': self.digest,
108
108
  'status': str(self.status),
109
109
  'document': self.document.to_dict,
110
- 'document_type': str(self.document_type),
110
+ 'document_type': (
111
+ str(self.document_type)
112
+ if self.document_type else None
113
+ ),
111
114
  'uploaded_from': (
112
115
  str(self.uploaded_from)
113
116
  if self.uploaded_from else None
@@ -152,8 +155,8 @@ class ProcessingCaseItem(object):
152
155
  ):
153
156
  instance_properties = properties or [
154
157
  'status',
155
- 'document_type',
156
158
  'document',
159
+ 'document_type',
157
160
  'uploaded_from',
158
161
  'processed_csv',
159
162
  'processed_xlsx',
@@ -182,7 +185,10 @@ class ProcessingCaseItem(object):
182
185
  digest=data.get('digest'),
183
186
  status=ProcessingStatus.from_value(data.get('status')),
184
187
  document=InMemoryDocument.from_dict(data.get('document')),
185
- document_type=ProcessingDocumentType.from_value(data.get('document_type')),
188
+ document_type=(
189
+ ProcessingDocumentType.from_value(data.get('document_type'))
190
+ if data.get('document_type') else None
191
+ ),
186
192
  uploaded_from=(
187
193
  ProcessingSource.from_value(data.get('uploaded_from'))
188
194
  if data.get('uploaded_from') else None
@@ -11,6 +11,10 @@ class ProcessingCaseItemRepository(ABC):
11
11
  def find(self, uuid: str) -> Optional[ProcessingCaseItem]:
12
12
  raise NotImplementedError
13
13
 
14
+ @abstractmethod
15
+ def find_by_digest(self, digest: str) -> Optional[ProcessingCaseItem]:
16
+ raise NotImplementedError
17
+
14
18
  @abstractmethod
15
19
  def persist(self, instance: ProcessingCaseItem) -> ProcessingCaseItem:
16
20
  raise NotImplementedError
@@ -3,7 +3,7 @@ from typing import Optional, List
3
3
  from boto3.dynamodb.conditions import Key
4
4
 
5
5
  from documente_shared.domain.entities.processing_case_item import ProcessingCaseItem
6
- from documente_shared.domain.enums.common import ProcessingStatus
6
+ from documente_shared.domain.entities.processing_case_item_filters import ProcessingCaseItemFilters
7
7
  from documente_shared.domain.repositories.processing_case_item import ProcessingCaseItemRepository
8
8
 
9
9
  from documente_shared.infrastructure.dynamo_table import DynamoDBTable
@@ -19,6 +19,12 @@ class DynamoProcessingCaseItemRepository(
19
19
  return ProcessingCaseItem.from_dict(item)
20
20
  return None
21
21
 
22
+ def find_by_digest(self, digest: str) -> Optional[ProcessingCaseItem]:
23
+ item = self.get(key={'digest': digest})
24
+ if item:
25
+ return ProcessingCaseItem.from_dict(item)
26
+ return None
27
+
22
28
  def persist(self, instance: ProcessingCaseItem) -> ProcessingCaseItem:
23
29
  self.put(instance.to_simple_dict)
24
30
  return instance
@@ -26,10 +32,14 @@ class DynamoProcessingCaseItemRepository(
26
32
  def remove(self, instance: ProcessingCaseItem):
27
33
  self.delete(key={'case_id': instance.case_id})
28
34
 
29
- def filter(self, statuses: List[ProcessingStatus]) -> List[ProcessingCaseItem]:
35
+ def filter(
36
+ self,
37
+ tenant_slug: str,
38
+ filters: ProcessingCaseItemFilters,
39
+ ) -> List[ProcessingCaseItem]:
30
40
  items = []
31
41
 
32
- for status in statuses:
42
+ for status in filters.statuses:
33
43
  response = self._table.query(
34
44
  IndexName='status',
35
45
  KeyConditionExpression=Key('status').eq(status.value),
@@ -40,4 +50,4 @@ class DynamoProcessingCaseItemRepository(
40
50
  return [
41
51
  ProcessingCaseItem.from_dict(item)
42
52
  for item in items
43
- ]
53
+ ]
@@ -1,10 +1,8 @@
1
1
  from dataclasses import dataclass
2
2
  from typing import List, Optional
3
3
 
4
- from documente_shared.domain.entities.processing_case import ProcessingCase
5
4
  from documente_shared.domain.entities.processing_case_item import ProcessingCaseItem
6
5
  from documente_shared.domain.entities.processing_case_item_filters import ProcessingCaseItemFilters
7
- from documente_shared.domain.enums.common import ProcessingStatus
8
6
  from documente_shared.domain.repositories.processing_case_item import ProcessingCaseItemRepository
9
7
  from documente_shared.infrastructure.documente_client import DocumenteClientMixin
10
8
 
@@ -21,6 +19,12 @@ class HttpProcessingCaseItemRepository(
21
19
  return ProcessingCaseItem.from_dict(response.json())
22
20
  return None
23
21
 
22
+ def find_by_digest(self, digest: str) -> Optional[ProcessingCaseItem]:
23
+ response = self.session.get(f"{self.api_url}/processing-case-items/{digest}/")
24
+ if response.status_code == 200:
25
+ return ProcessingCaseItem.from_dict(response.json())
26
+ return None
27
+
24
28
  def persist(self, instance: ProcessingCaseItem) -> ProcessingCaseItem:
25
29
  response = self.session.put(
26
30
  url=f"{self.api_url}/processing-case-items/{instance.uuid}/",
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "documente_shared"
3
- version = "0.1.77"
3
+ version = "0.1.79"
4
4
  description = "Shared utilities for Documente AI projects"
5
5
  authors = ["Tech <tech@llamitai.com>"]
6
6
  license = "MIT"