documente_shared 0.1.77__py3-none-any.whl → 0.1.79__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.

Potentially problematic release.


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

@@ -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
  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
@@ -15,7 +15,7 @@ documente_shared/domain/entities/document_metadata.py,sha256=ygyFIC5qwxlm8DUM5kv
15
15
  documente_shared/domain/entities/in_memory_result.py,sha256=Q1E9vnLL5Hz5xunOqWtQmJOMjoK5KN42LZr18GlBAZo,1246
16
16
  documente_shared/domain/entities/processing_case.py,sha256=3bL6BgFwWe6F5keZ6A1K_lLsrwGpkcKg98roM_i6kEQ,5167
17
17
  documente_shared/domain/entities/processing_case_filters.py,sha256=FgyxB4mQb0nEGjIbUB9OiazkKL4yHRRC6bvmjD5NT8k,1915
18
- documente_shared/domain/entities/processing_case_item.py,sha256=hglyPhZBSjlMKVdEVccyHXU3aQRdZ8hfZlXDJnkf7wA,7996
18
+ documente_shared/domain/entities/processing_case_item.py,sha256=i3MpEBzsHbcDO3gHYI1Y-wfFGbaedt3RBXmJdZEtm74,8180
19
19
  documente_shared/domain/entities/processing_case_item_filters.py,sha256=-cAQTSWOepMMcGCBg2X3dd0W_8XHuBTlvOB1d-3sVVM,1971
20
20
  documente_shared/domain/entities/processing_event.py,sha256=m1O0gcNaE_SszeIhxM3uYPHSpyOUmize6mfRw1_bYZo,1723
21
21
  documente_shared/domain/enums/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -25,18 +25,18 @@ documente_shared/domain/enums/processing_case.py,sha256=LhFhcoWlockxcpplsVdC6M2k
25
25
  documente_shared/domain/repositories/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
26
  documente_shared/domain/repositories/document.py,sha256=vJzr6c92gqBzyhaEdjrvnoneKRrWmJ0AsvocPnhxiLU,767
27
27
  documente_shared/domain/repositories/processing_case.py,sha256=bpks3SAM_L4wx29P29iFo5g-oi4fxSXQEzhveARjo3c,767
28
- documente_shared/domain/repositories/processing_case_item.py,sha256=kvk8LsrfM934-SNLIKIBTRXaKnY09q6nzsoULItrNeY,844
28
+ documente_shared/domain/repositories/processing_case_item.py,sha256=gPZaQCMYlD6vlnEt6cVIqRmi1K-JWvmDx1f74nd97Cs,974
29
29
  documente_shared/infrastructure/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
30
  documente_shared/infrastructure/documente_client.py,sha256=UjVWs9DKa-yhw5DVbcEs8iJxalHOarusVayi_ob6QhE,494
31
31
  documente_shared/infrastructure/dynamo_table.py,sha256=TMQbcuty7wjDMbuhI8PbT0IGXelgELsNTtqTEQeZ824,2112
32
32
  documente_shared/infrastructure/repositories/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
33
  documente_shared/infrastructure/repositories/dynamo_document.py,sha256=_Yp4gtA-n-hJ2w2wAM5BMCs2Mf46Q2Kq3eHqlxudkL4,1443
34
34
  documente_shared/infrastructure/repositories/dynamo_processing_case.py,sha256=UJcROnmfKvE5k_GZOHvaYDvnNSX4Rm22xCB7tUaUUEU,1386
35
- documente_shared/infrastructure/repositories/dynamo_processing_case_item.py,sha256=bqD6uFoMmG_CgLcY4Q5VLGVD5A1bA927_dzllHTZ7O8,1447
35
+ documente_shared/infrastructure/repositories/dynamo_processing_case_item.py,sha256=4guM8V3YfP7kzYcuVWunGJGmXi0kSSUW8otks39g1vs,1754
36
36
  documente_shared/infrastructure/repositories/http_processing_case.py,sha256=4PHNqbzDlt8Bicv3IUwJ58e4WNlIU_Hxq0cPuaLFgtw,1724
37
- documente_shared/infrastructure/repositories/http_processing_case_item.py,sha256=TybbIO6Kp92xVvKedQgiI7s63U7SFnu6P0RkOrXemT8,1939
37
+ documente_shared/infrastructure/repositories/http_processing_case_item.py,sha256=FfKHLPir5uXsVu8WVqEbzcbsO9uzNLvbwDiw-Up1Ddo,2085
38
38
  documente_shared/infrastructure/s3_bucket.py,sha256=vT_yN42RFQXubtUn8ln-j13Os_-25UGClVtXg5Bkv6I,1932
39
39
  documente_shared/infrastructure/sqs_queue.py,sha256=KZWeHZ9zmXmrxoNpOQX7GEdDhZ1knbPXgwSwFwJblGg,1504
40
- documente_shared-0.1.77.dist-info/METADATA,sha256=s6_-ia0MAetbkzPm-9OZvdXENQVblwU3iA8rCi6GDTk,881
41
- documente_shared-0.1.77.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
42
- documente_shared-0.1.77.dist-info/RECORD,,
40
+ documente_shared-0.1.79.dist-info/METADATA,sha256=E3rsWtAhGjm9t4-aCzAnZnEnQC6YXPP5dVjVGKuvXic,881
41
+ documente_shared-0.1.79.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
42
+ documente_shared-0.1.79.dist-info/RECORD,,