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

@@ -0,0 +1,49 @@
1
+ from dataclasses import dataclass
2
+ from datetime import datetime
3
+ from typing import Optional
4
+
5
+ from documente_shared.application.time_utils import get_datetime_from_data
6
+ from documente_shared.domain.entities.document import DocumentProcessing
7
+ from documente_shared.domain.entities.processing_case import ProcessingCase
8
+ from documente_shared.domain.enums.common import ProcessingType
9
+
10
+
11
+ @dataclass
12
+ class ProcessingEvent(object):
13
+ processing_type: ProcessingType
14
+ instance: DocumentProcessing | ProcessingCase | None
15
+ timestamp: Optional[datetime] = None
16
+
17
+ def __eq__(self, other: 'ProcessingEvent') -> bool:
18
+ if not other:
19
+ return False
20
+
21
+ return (
22
+ self.processing_type == other.processing_type
23
+ and self.instance == other.instance
24
+ )
25
+
26
+ @property
27
+ def to_dict(self) -> dict:
28
+ return {
29
+ 'processing_type': str(self.processing_type),
30
+ 'instance': self.instance.to_dict,
31
+ 'timestamp': self.timestamp.isoformat() if self.timestamp else None,
32
+ }
33
+
34
+ @classmethod
35
+ def from_dict(cls, data: dict) -> 'ProcessingEvent':
36
+ processing_type = ProcessingType.from_value(data.get('processing_type'))
37
+
38
+ if processing_type.is_document:
39
+ processing_instance = DocumentProcessing.from_dict(data.get('instance'))
40
+ elif processing_type.is_processing_case:
41
+ processing_instance = ProcessingCase.from_dict(data.get('instance'))
42
+ else:
43
+ processing_instance = None
44
+
45
+ return cls(
46
+ processing_type=processing_type,
47
+ instance=processing_instance,
48
+ timestamp=get_datetime_from_data(input_datetime=data.get('timestamp')),
49
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: documente_shared
3
- Version: 0.1.68
3
+ Version: 0.1.70
4
4
  Summary: Shared utilities for Documente AI projects
5
5
  License: MIT
6
6
  Author: Tech
@@ -14,6 +14,7 @@ documente_shared/domain/entities/document_metadata.py,sha256=ygyFIC5qwxlm8DUM5kv
14
14
  documente_shared/domain/entities/in_memory_result.py,sha256=Q1E9vnLL5Hz5xunOqWtQmJOMjoK5KN42LZr18GlBAZo,1246
15
15
  documente_shared/domain/entities/processing_case.py,sha256=PuwWQuXIIP5wlkWBCrkF-61TfgKSYwc9HZl1JR13xhk,4955
16
16
  documente_shared/domain/entities/processing_case_item.py,sha256=5wuZylIc_Lanh5PnY4ghEgbQhCtBDCExh4KRW6ZGK_4,7684
17
+ documente_shared/domain/entities/processing_event.py,sha256=m1O0gcNaE_SszeIhxM3uYPHSpyOUmize6mfRw1_bYZo,1723
17
18
  documente_shared/domain/enums/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
19
  documente_shared/domain/enums/common.py,sha256=vXldMUPhhWo0PfTgYwDSjI8bur_lYcImZYiV7yAO7DQ,2262
19
20
  documente_shared/domain/enums/document.py,sha256=NltZA1YVgJ7dVfSQdJFIE0ZUGf9Y-nxNXsVQ6GiPLL4,1827
@@ -24,6 +25,6 @@ documente_shared/infrastructure/dynamo_repositories.py,sha256=SEad_HLppp2h_BKDSz
24
25
  documente_shared/infrastructure/dynamo_table.py,sha256=dK05KgFvIYCmOdMpq9-OV_OBrP6cCngiUikCJrxlwt4,2112
25
26
  documente_shared/infrastructure/s3_bucket.py,sha256=vT_yN42RFQXubtUn8ln-j13Os_-25UGClVtXg5Bkv6I,1932
26
27
  documente_shared/infrastructure/sqs_queue.py,sha256=PSiTAnjXvQ-W-9mzLpH2UjbQJTvYkMiaxNaMecF-cR4,1505
27
- documente_shared-0.1.68.dist-info/METADATA,sha256=GzKC9St8yRT3mlxTKnKVBx7xbfwrNTmsX239ZvmARV0,800
28
- documente_shared-0.1.68.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
29
- documente_shared-0.1.68.dist-info/RECORD,,
28
+ documente_shared-0.1.70.dist-info/METADATA,sha256=JCm5S835mggDqZMKE320WqYbKgyH79nvdZMXIIaMnEU,800
29
+ documente_shared-0.1.70.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
30
+ documente_shared-0.1.70.dist-info/RECORD,,