documente_shared 0.1.115__tar.gz → 0.1.116__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.115 → documente_shared-0.1.116}/PKG-INFO +1 -1
  2. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/domain/entities/processing_case.py +63 -44
  3. {documente_shared-0.1.115 → documente_shared-0.1.116}/pyproject.toml +1 -1
  4. {documente_shared-0.1.115 → documente_shared-0.1.116}/README.md +0 -0
  5. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/__init__.py +0 -0
  6. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/application/__init__.py +0 -0
  7. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/application/dates.py +0 -0
  8. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/application/digest.py +0 -0
  9. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/application/exceptions.py +0 -0
  10. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/application/files.py +0 -0
  11. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/application/json.py +0 -0
  12. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/application/numbers.py +0 -0
  13. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/application/payloads.py +0 -0
  14. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/application/query_params.py +0 -0
  15. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/application/time_utils.py +0 -0
  16. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/application/timezone.py +0 -0
  17. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/domain/__init__.py +0 -0
  18. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/domain/base_enum.py +0 -0
  19. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/domain/constants.py +0 -0
  20. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/domain/entities/__init__.py +0 -0
  21. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/domain/entities/document.py +0 -0
  22. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/domain/entities/document_metadata.py +0 -0
  23. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/domain/entities/in_memory_document.py +0 -0
  24. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/domain/entities/processing_case_filters.py +0 -0
  25. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/domain/entities/processing_case_item.py +0 -0
  26. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/domain/entities/processing_case_item_filters.py +0 -0
  27. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/domain/entities/processing_documents.py +0 -0
  28. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/domain/entities/processing_event.py +0 -0
  29. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/domain/entities/scaling.py +0 -0
  30. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/domain/enums/__init__.py +0 -0
  31. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/domain/enums/common.py +0 -0
  32. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/domain/enums/document.py +0 -0
  33. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/domain/enums/processing_case.py +0 -0
  34. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/domain/exceptions.py +0 -0
  35. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/domain/interfaces/__init__.py +0 -0
  36. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/domain/interfaces/scaling.py +0 -0
  37. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/domain/repositories/__init__.py +0 -0
  38. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/domain/repositories/document.py +0 -0
  39. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/domain/repositories/processing_case.py +0 -0
  40. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/domain/repositories/processing_case_item.py +0 -0
  41. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/infrastructure/__init__.py +0 -0
  42. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/infrastructure/documente_client.py +0 -0
  43. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/infrastructure/dynamo_table.py +0 -0
  44. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/infrastructure/lambdas.py +0 -0
  45. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/infrastructure/repositories/__init__.py +0 -0
  46. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/infrastructure/repositories/dynamo_document.py +0 -0
  47. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/infrastructure/repositories/dynamo_processing_case.py +0 -0
  48. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/infrastructure/repositories/dynamo_processing_case_item.py +0 -0
  49. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/infrastructure/repositories/http_document.py +0 -0
  50. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/infrastructure/repositories/http_processing_case.py +0 -0
  51. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/infrastructure/repositories/http_processing_case_item.py +0 -0
  52. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/infrastructure/repositories/mem_document.py +0 -0
  53. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/infrastructure/repositories/mem_processing_case.py +0 -0
  54. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/infrastructure/repositories/mem_processing_case_item.py +0 -0
  55. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/infrastructure/s3_bucket.py +0 -0
  56. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/infrastructure/services/__init__.py +0 -0
  57. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/infrastructure/services/http_scaling.py +0 -0
  58. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/infrastructure/sqs_queue.py +0 -0
  59. {documente_shared-0.1.115 → documente_shared-0.1.116}/documente_shared/presentation/__init__.py +0 -0
  60. {documente_shared-0.1.115 → documente_shared-0.1.116}/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.115
3
+ Version: 0.1.116
4
4
  Summary: Shared utilities for Documente AI projects
5
5
  License: MIT
6
6
  Author: Tech
@@ -27,50 +27,6 @@ class ProcessingCase(object):
27
27
  def __post_init__(self):
28
28
  self.items = self.items or []
29
29
 
30
- @property
31
- def strategy_id(self) ->str:
32
- return str(self.case_type)
33
-
34
- @property
35
- def is_procesable(self) -> bool:
36
- return self.items and len(self.items) > 0
37
-
38
- @property
39
- def is_bcp_microcredito(self) -> bool:
40
- return self.case_type and self.case_type.is_bcp_microcredito
41
-
42
- @property
43
- def is_univida_soat(self) -> bool:
44
- return self.case_type and self.case_type.is_univida_soat
45
-
46
- def pending(self, timezone: tzinfo = la_paz_tz):
47
- self.status = ProcessingStatus.PENDING
48
- self.started_at = None
49
-
50
- def enqueue(self, timezone: tzinfo = la_paz_tz):
51
- self.status = ProcessingStatus.ENQUEUED
52
- self.enqueued_at = datetime.now(tz=timezone)
53
-
54
- def processing(self, timezone: tzinfo = la_paz_tz):
55
- self.status = ProcessingStatus.PROCESSING
56
- self.started_at = datetime.now(tz=timezone)
57
-
58
- def failed(
59
- self,
60
- error_message: Optional[str] = None,
61
- timezone: tzinfo = la_paz_tz,
62
- ):
63
- self.status = ProcessingStatus.FAILED
64
- self.failed_at = datetime.now(tz=timezone)
65
-
66
- def completed(self, timezone: tzinfo = la_paz_tz):
67
- self.status = ProcessingStatus.COMPLETED
68
- self.completed_at = datetime.now(tz=timezone)
69
-
70
- def deleted(self):
71
- self.status = ProcessingStatus.DELETED
72
-
73
-
74
30
  def __eq__(self, other: 'ProcessingCase') -> bool:
75
31
  if not other:
76
32
  return False
@@ -88,6 +44,22 @@ class ProcessingCase(object):
88
44
  and self.metadata == other.metadata
89
45
  )
90
46
 
47
+ @property
48
+ def strategy_id(self) ->str:
49
+ return str(self.case_type)
50
+
51
+ @property
52
+ def is_procesable(self) -> bool:
53
+ return self.items and len(self.items) > 0
54
+
55
+ @property
56
+ def is_bcp_microcredito(self) -> bool:
57
+ return self.case_type and self.case_type.is_bcp_microcredito
58
+
59
+ @property
60
+ def is_univida_soat(self) -> bool:
61
+ return self.case_type and self.case_type.is_univida_soat
62
+
91
63
  @property
92
64
  def to_dict(self) -> dict:
93
65
  return {
@@ -130,6 +102,52 @@ class ProcessingCase(object):
130
102
  def has_procesable_items(self) -> bool:
131
103
  return len(self.procesable_items) > 0
132
104
 
105
+ def pending(self, timezone: tzinfo = la_paz_tz):
106
+ self.status = ProcessingStatus.PENDING
107
+ self.started_at = None
108
+
109
+ def enqueue(self, timezone: tzinfo = la_paz_tz):
110
+ self.status = ProcessingStatus.ENQUEUED
111
+ self.enqueued_at = datetime.now(tz=timezone)
112
+
113
+ def processing(self, timezone: tzinfo = la_paz_tz):
114
+ self.status = ProcessingStatus.PROCESSING
115
+ self.started_at = datetime.now(tz=timezone)
116
+
117
+ def failed(
118
+ self,
119
+ error_message: Optional[str] = None,
120
+ timezone: tzinfo = la_paz_tz,
121
+ ):
122
+ self.status = ProcessingStatus.FAILED
123
+ self.failed_at = datetime.now(tz=timezone)
124
+
125
+ def completed(self, timezone: tzinfo = la_paz_tz):
126
+ self.status = ProcessingStatus.COMPLETED
127
+ self.completed_at = datetime.now(tz=timezone)
128
+
129
+ def deleted(self):
130
+ self.status = ProcessingStatus.DELETED
131
+
132
+ def refresh_status(self):
133
+ if not self.items:
134
+ return
135
+
136
+ item_statuses = [item.status for item in self.items]
137
+
138
+ if any(status == ProcessingStatus.FAILED for status in item_statuses):
139
+ self.status = ProcessingStatus.INCOMPLETE
140
+ elif any(status == ProcessingStatus.PROCESSING for status in item_statuses):
141
+ self.status = ProcessingStatus.PROCESSING
142
+ elif all(status == ProcessingStatus.COMPLETED for status in item_statuses):
143
+ self.status = ProcessingStatus.COMPLETED
144
+ elif all(status == ProcessingStatus.PENDING for status in item_statuses):
145
+ self.status = ProcessingStatus.PENDING
146
+ else:
147
+ self.status = ProcessingStatus.PENDING
148
+
149
+
150
+
133
151
  @classmethod
134
152
  def from_dict(cls, data: dict) -> 'ProcessingCase':
135
153
  return cls(
@@ -161,3 +179,4 @@ class ProcessingCase(object):
161
179
  for item_dict in data.get('items', [])
162
180
  ]
163
181
  return instance
182
+
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "documente_shared"
3
- version = "0.1.115"
3
+ version = "0.1.116"
4
4
  description = "Shared utilities for Documente AI projects"
5
5
  authors = ["Tech <tech@llamitai.com>"]
6
6
  license = "MIT"