documente_shared 0.1.103__tar.gz → 0.1.105__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 (60) hide show
  1. {documente_shared-0.1.103 → documente_shared-0.1.105}/PKG-INFO +1 -1
  2. documente_shared-0.1.105/documente_shared/application/numbers.py +7 -0
  3. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/domain/entities/document.py +3 -2
  4. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/domain/entities/processing_case_item.py +3 -2
  5. documente_shared-0.1.105/documente_shared/infrastructure/repositories/mem_processing_case_item.py +43 -0
  6. {documente_shared-0.1.103 → documente_shared-0.1.105}/pyproject.toml +1 -1
  7. {documente_shared-0.1.103 → documente_shared-0.1.105}/README.md +0 -0
  8. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/__init__.py +0 -0
  9. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/application/__init__.py +0 -0
  10. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/application/dates.py +0 -0
  11. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/application/digest.py +0 -0
  12. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/application/exceptions.py +0 -0
  13. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/application/files.py +0 -0
  14. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/application/json.py +0 -0
  15. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/application/payloads.py +0 -0
  16. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/application/query_params.py +0 -0
  17. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/application/time_utils.py +0 -0
  18. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/application/timezone.py +0 -0
  19. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/domain/__init__.py +0 -0
  20. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/domain/base_enum.py +0 -0
  21. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/domain/constants.py +0 -0
  22. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/domain/entities/__init__.py +0 -0
  23. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/domain/entities/document_metadata.py +0 -0
  24. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/domain/entities/in_memory_document.py +0 -0
  25. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/domain/entities/processing_case.py +0 -0
  26. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/domain/entities/processing_case_filters.py +0 -0
  27. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/domain/entities/processing_case_item_filters.py +0 -0
  28. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/domain/entities/processing_documents.py +0 -0
  29. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/domain/entities/processing_event.py +0 -0
  30. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/domain/entities/scaling.py +0 -0
  31. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/domain/enums/__init__.py +0 -0
  32. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/domain/enums/common.py +0 -0
  33. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/domain/enums/document.py +0 -0
  34. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/domain/enums/processing_case.py +0 -0
  35. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/domain/exceptions.py +0 -0
  36. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/domain/interfaces/__init__.py +0 -0
  37. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/domain/interfaces/scaling.py +0 -0
  38. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/domain/repositories/__init__.py +0 -0
  39. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/domain/repositories/document.py +0 -0
  40. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/domain/repositories/processing_case.py +0 -0
  41. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/domain/repositories/processing_case_item.py +0 -0
  42. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/infrastructure/__init__.py +0 -0
  43. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/infrastructure/documente_client.py +0 -0
  44. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/infrastructure/dynamo_table.py +0 -0
  45. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/infrastructure/lambdas.py +0 -0
  46. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/infrastructure/repositories/__init__.py +0 -0
  47. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/infrastructure/repositories/dynamo_document.py +0 -0
  48. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/infrastructure/repositories/dynamo_processing_case.py +0 -0
  49. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/infrastructure/repositories/dynamo_processing_case_item.py +0 -0
  50. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/infrastructure/repositories/http_document_processing.py +0 -0
  51. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/infrastructure/repositories/http_processing_case.py +0 -0
  52. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/infrastructure/repositories/http_processing_case_item.py +0 -0
  53. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/infrastructure/repositories/mem_document.py +0 -0
  54. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/infrastructure/repositories/mem_processing_case.py +0 -0
  55. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/infrastructure/s3_bucket.py +0 -0
  56. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/infrastructure/services/__init__.py +0 -0
  57. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/infrastructure/services/http_scaling.py +0 -0
  58. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/infrastructure/sqs_queue.py +0 -0
  59. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/presentation/__init__.py +0 -0
  60. {documente_shared-0.1.103 → documente_shared-0.1.105}/documente_shared/presentation/presenters.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: documente_shared
3
- Version: 0.1.103
3
+ Version: 0.1.105
4
4
  Summary: Shared utilities for Documente AI projects
5
5
  License: MIT
6
6
  Author: Tech
@@ -0,0 +1,7 @@
1
+ from decimal import Decimal
2
+
3
+
4
+ def normalize_number(number: str | float | Decimal) -> str:
5
+ if not isinstance(number, Decimal):
6
+ number = Decimal(number)
7
+ return str(number.quantize(Decimal('0.001')))
@@ -5,6 +5,7 @@ from decimal import Decimal
5
5
  from typing import Optional, List
6
6
 
7
7
  from documente_shared.application.files import remove_slash_from_path, get_filename_from_path
8
+ from documente_shared.application.numbers import normalize_number
8
9
  from documente_shared.application.time_utils import get_datetime_from_data
9
10
  from documente_shared.domain.constants import la_paz_tz
10
11
  from documente_shared.domain.entities.document_metadata import DocumentProcessingMetadata
@@ -248,11 +249,11 @@ class DocumentProcessing(object):
248
249
  'processed_json_path': self.processed_json_path,
249
250
  'processed_metadata_path': self.processed_metadata_path,
250
251
  'processing_time': (
251
- str(self.processing_time.quantize(Decimal('0.00001')))
252
+ normalize_number(self.processing_time)
252
253
  if self.processing_time else None
253
254
  ),
254
255
  'processing_accuracy': (
255
- str(self.processing_accuracy.quantize(Decimal('0.00001')))
256
+ normalize_number(self.processing_accuracy)
256
257
  if self.processing_accuracy else None
257
258
  ),
258
259
  'issued_at': self.issued_at.isoformat() if self.issued_at else None,
@@ -3,6 +3,7 @@ from datetime import datetime, tzinfo
3
3
  from decimal import Decimal
4
4
  from typing import Optional, List
5
5
 
6
+ from documente_shared.application.numbers import normalize_number
6
7
  from documente_shared.application.time_utils import get_datetime_from_data
7
8
  from documente_shared.domain.constants import la_paz_tz
8
9
  from documente_shared.domain.entities.in_memory_document import InMemoryDocument
@@ -143,11 +144,11 @@ class ProcessingCaseItem(object):
143
144
  if self.processed_json else None
144
145
  ),
145
146
  'processing_time': (
146
- str(self.processing_time.quantize(Decimal('0.001')))
147
+ normalize_number(self.processing_time)
147
148
  if self.processing_time else None
148
149
  ),
149
150
  'processing_confidence': (
150
- str(self.processing_confidence.quantize(Decimal('0.001')))
151
+ normalize_number(self.processing_confidence)
151
152
  if self.processing_confidence else None
152
153
  ),
153
154
  'uploaded_at': (
@@ -0,0 +1,43 @@
1
+ from dataclasses import dataclass
2
+ from typing import List, Optional
3
+
4
+ from documente_shared.domain.entities.processing_case_item import ProcessingCaseItem
5
+ from documente_shared.domain.entities.processing_case_item_filters import ProcessingCaseItemFilters
6
+
7
+ from documente_shared.domain.repositories.processing_case_item import ProcessingCaseItemRepository
8
+
9
+
10
+ @dataclass
11
+ class MemoryProcessingCaseItemRepository(ProcessingCaseItemRepository):
12
+ collection: dict[str, ProcessingCaseItem] = None
13
+
14
+ def __post_init__(self):
15
+ self.collection = self.collection or {}
16
+
17
+ def find(
18
+ self,
19
+ uuid: str,
20
+ include_items: bool = False,
21
+ ) -> Optional[ProcessingCaseItem]:
22
+ if uuid in self.collection:
23
+ return self.collection[uuid]
24
+ return None
25
+
26
+ def find_by_digest(self, digest: str) -> Optional[ProcessingCaseItem]:
27
+ for item in self.collection.values():
28
+ if item.digest == digest:
29
+ return item
30
+ return None
31
+
32
+
33
+ def persist(self, instance: ProcessingCaseItem) -> ProcessingCaseItem:
34
+ self.collection[instance.uuid] = instance
35
+ return instance
36
+
37
+ def remove(self, instance: ProcessingCaseItem):
38
+ if instance.uuid in self.collection:
39
+ del self.collection[instance.uuid]
40
+ return None
41
+
42
+ def filter(self, filters: ProcessingCaseItemFilters) -> List[ProcessingCaseItem]:
43
+ return []
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "documente_shared"
3
- version = "0.1.103"
3
+ version = "0.1.105"
4
4
  description = "Shared utilities for Documente AI projects"
5
5
  authors = ["Tech <tech@llamitai.com>"]
6
6
  license = "MIT"