documente_shared 0.1.114__py3-none-any.whl → 0.1.116__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.
- documente_shared/domain/entities/processing_case.py +63 -44
- documente_shared/domain/entities/processing_case_item.py +4 -4
- {documente_shared-0.1.114.dist-info → documente_shared-0.1.116.dist-info}/METADATA +1 -1
- {documente_shared-0.1.114.dist-info → documente_shared-0.1.116.dist-info}/RECORD +5 -5
- {documente_shared-0.1.114.dist-info → documente_shared-0.1.116.dist-info}/WHEEL +0 -0
|
@@ -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
|
+
|
|
@@ -17,7 +17,7 @@ class ProcessingCaseItem(object):
|
|
|
17
17
|
case_id: str
|
|
18
18
|
digest: str
|
|
19
19
|
status: ProcessingStatus
|
|
20
|
-
document: InMemoryDocument
|
|
20
|
+
document: Optional[InMemoryDocument] = None
|
|
21
21
|
document_type: Optional[ProcessingDocumentType] = None
|
|
22
22
|
uploaded_from: Optional[ProcessingSource] = None
|
|
23
23
|
processed_csv: Optional[InMemoryDocument] = None
|
|
@@ -64,9 +64,9 @@ class ProcessingCaseItem(object):
|
|
|
64
64
|
self.started_at = datetime.now(tz=timezone)
|
|
65
65
|
|
|
66
66
|
def failed(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
self,
|
|
68
|
+
error_message: Optional[str] = None,
|
|
69
|
+
timezone: tzinfo = la_paz_tz,
|
|
70
70
|
):
|
|
71
71
|
self.status = ProcessingStatus.FAILED
|
|
72
72
|
self.failed_at = datetime.now(tz=timezone)
|
|
@@ -17,9 +17,9 @@ documente_shared/domain/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRk
|
|
|
17
17
|
documente_shared/domain/entities/document.py,sha256=9X6XCE-zTm0q8ASBn-5TAvNwK4iO_70KHkcgyMSO9JI,13044
|
|
18
18
|
documente_shared/domain/entities/document_metadata.py,sha256=ygyFIC5qwxlm8DUM5kvVFny9zJfPQS8vNLM2br5XsQ8,2353
|
|
19
19
|
documente_shared/domain/entities/in_memory_document.py,sha256=BswTG1LjrQ8nP3pb0T2bSODPjJ2ud4ifbnYxRdFlIhY,2116
|
|
20
|
-
documente_shared/domain/entities/processing_case.py,sha256=
|
|
20
|
+
documente_shared/domain/entities/processing_case.py,sha256=6_1J50jyb8XcOiXvGKDJxyLZ6we-RDOmdimalc3h7oM,6451
|
|
21
21
|
documente_shared/domain/entities/processing_case_filters.py,sha256=harKyu7QEuL1bI_Z8_UxkVCMo5r9vHeNHyi_Ja07vjs,1953
|
|
22
|
-
documente_shared/domain/entities/processing_case_item.py,sha256=
|
|
22
|
+
documente_shared/domain/entities/processing_case_item.py,sha256=KtH5JpJOcGLzVGQrcIGQY7CNWTwkm3_sriHM0ROF7SM,10255
|
|
23
23
|
documente_shared/domain/entities/processing_case_item_filters.py,sha256=R_AvDCB496Lww1qn2OwtltqULKE3IpcJB0ejnmRkg7Q,2009
|
|
24
24
|
documente_shared/domain/entities/processing_documents.py,sha256=YYuTkdCNkqlO8cA0onJsZYtstxGt9M5NMuIO_87lB14,352
|
|
25
25
|
documente_shared/domain/entities/processing_event.py,sha256=izdBXEz0TMNjxxZVjcM3YclzOv250JOV-amSpqmtQ9c,2180
|
|
@@ -55,6 +55,6 @@ documente_shared/infrastructure/services/http_scaling.py,sha256=cIo-61nfIwbtO86E
|
|
|
55
55
|
documente_shared/infrastructure/sqs_queue.py,sha256=KZWeHZ9zmXmrxoNpOQX7GEdDhZ1knbPXgwSwFwJblGg,1504
|
|
56
56
|
documente_shared/presentation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
57
57
|
documente_shared/presentation/presenters.py,sha256=GGAEwefmjCIVepsUA2oZOVLxXbhhiISPM0Jgt6dT6O0,423
|
|
58
|
-
documente_shared-0.1.
|
|
59
|
-
documente_shared-0.1.
|
|
60
|
-
documente_shared-0.1.
|
|
58
|
+
documente_shared-0.1.116.dist-info/METADATA,sha256=poNCU_jPxaMFEHD4f-tGVNMd9CNDAOW04CGg5A1yrV8,963
|
|
59
|
+
documente_shared-0.1.116.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
60
|
+
documente_shared-0.1.116.dist-info/RECORD,,
|
|
File without changes
|