documente_shared 0.1.68__tar.gz → 0.1.70__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 (30) hide show
  1. {documente_shared-0.1.68 → documente_shared-0.1.70}/PKG-INFO +1 -1
  2. documente_shared-0.1.70/documente_shared/domain/entities/processing_event.py +49 -0
  3. {documente_shared-0.1.68 → documente_shared-0.1.70}/pyproject.toml +1 -1
  4. {documente_shared-0.1.68 → documente_shared-0.1.70}/README.md +0 -0
  5. {documente_shared-0.1.68 → documente_shared-0.1.70}/documente_shared/__init__.py +0 -0
  6. {documente_shared-0.1.68 → documente_shared-0.1.70}/documente_shared/application/__init__.py +0 -0
  7. {documente_shared-0.1.68 → documente_shared-0.1.70}/documente_shared/application/digest.py +0 -0
  8. {documente_shared-0.1.68 → documente_shared-0.1.70}/documente_shared/application/exceptions.py +0 -0
  9. {documente_shared-0.1.68 → documente_shared-0.1.70}/documente_shared/application/files.py +0 -0
  10. {documente_shared-0.1.68 → documente_shared-0.1.70}/documente_shared/application/time_utils.py +0 -0
  11. {documente_shared-0.1.68 → documente_shared-0.1.70}/documente_shared/application/timezone.py +0 -0
  12. {documente_shared-0.1.68 → documente_shared-0.1.70}/documente_shared/domain/__init__.py +0 -0
  13. {documente_shared-0.1.68 → documente_shared-0.1.70}/documente_shared/domain/base_enum.py +0 -0
  14. {documente_shared-0.1.68 → documente_shared-0.1.70}/documente_shared/domain/constants.py +0 -0
  15. {documente_shared-0.1.68 → documente_shared-0.1.70}/documente_shared/domain/entities/__init__.py +0 -0
  16. {documente_shared-0.1.68 → documente_shared-0.1.70}/documente_shared/domain/entities/document.py +0 -0
  17. {documente_shared-0.1.68 → documente_shared-0.1.70}/documente_shared/domain/entities/document_metadata.py +0 -0
  18. {documente_shared-0.1.68 → documente_shared-0.1.70}/documente_shared/domain/entities/in_memory_result.py +0 -0
  19. {documente_shared-0.1.68 → documente_shared-0.1.70}/documente_shared/domain/entities/processing_case.py +0 -0
  20. {documente_shared-0.1.68 → documente_shared-0.1.70}/documente_shared/domain/entities/processing_case_item.py +0 -0
  21. {documente_shared-0.1.68 → documente_shared-0.1.70}/documente_shared/domain/enums/__init__.py +0 -0
  22. {documente_shared-0.1.68 → documente_shared-0.1.70}/documente_shared/domain/enums/common.py +0 -0
  23. {documente_shared-0.1.68 → documente_shared-0.1.70}/documente_shared/domain/enums/document.py +0 -0
  24. {documente_shared-0.1.68 → documente_shared-0.1.70}/documente_shared/domain/enums/processing_case.py +0 -0
  25. {documente_shared-0.1.68 → documente_shared-0.1.70}/documente_shared/domain/repositories.py +0 -0
  26. {documente_shared-0.1.68 → documente_shared-0.1.70}/documente_shared/infrastructure/__init__.py +0 -0
  27. {documente_shared-0.1.68 → documente_shared-0.1.70}/documente_shared/infrastructure/dynamo_repositories.py +0 -0
  28. {documente_shared-0.1.68 → documente_shared-0.1.70}/documente_shared/infrastructure/dynamo_table.py +0 -0
  29. {documente_shared-0.1.68 → documente_shared-0.1.70}/documente_shared/infrastructure/s3_bucket.py +0 -0
  30. {documente_shared-0.1.68 → documente_shared-0.1.70}/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.68
3
+ Version: 0.1.70
4
4
  Summary: Shared utilities for Documente AI projects
5
5
  License: MIT
6
6
  Author: Tech
@@ -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
  [tool.poetry]
2
2
  name = "documente_shared"
3
- version = "0.1.68"
3
+ version = "0.1.70"
4
4
  description = "Shared utilities for Documente AI projects"
5
5
  authors = ["Tech <tech@llamitai.com>"]
6
6
  license = "MIT"