documente_shared 0.1.54b1__tar.gz → 0.1.56__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.
- {documente_shared-0.1.54b1 → documente_shared-0.1.56}/PKG-INFO +1 -1
- {documente_shared-0.1.54b1 → documente_shared-0.1.56}/documente_shared/domain/entities/document.py +17 -2
- {documente_shared-0.1.54b1 → documente_shared-0.1.56}/documente_shared/domain/enums.py +34 -0
- {documente_shared-0.1.54b1 → documente_shared-0.1.56}/pyproject.toml +1 -1
- {documente_shared-0.1.54b1 → documente_shared-0.1.56}/README.md +0 -0
- {documente_shared-0.1.54b1 → documente_shared-0.1.56}/documente_shared/__init__.py +0 -0
- {documente_shared-0.1.54b1 → documente_shared-0.1.56}/documente_shared/application/__init__.py +0 -0
- {documente_shared-0.1.54b1 → documente_shared-0.1.56}/documente_shared/application/digest.py +0 -0
- {documente_shared-0.1.54b1 → documente_shared-0.1.56}/documente_shared/application/exceptions.py +0 -0
- {documente_shared-0.1.54b1 → documente_shared-0.1.56}/documente_shared/application/time_utils.py +0 -0
- {documente_shared-0.1.54b1 → documente_shared-0.1.56}/documente_shared/application/timezone.py +0 -0
- {documente_shared-0.1.54b1 → documente_shared-0.1.56}/documente_shared/domain/__init__.py +0 -0
- {documente_shared-0.1.54b1 → documente_shared-0.1.56}/documente_shared/domain/base_enum.py +0 -0
- {documente_shared-0.1.54b1 → documente_shared-0.1.56}/documente_shared/domain/constants.py +0 -0
- {documente_shared-0.1.54b1 → documente_shared-0.1.56}/documente_shared/domain/entities/__init__.py +0 -0
- {documente_shared-0.1.54b1 → documente_shared-0.1.56}/documente_shared/domain/entities/document_metadata.py +0 -0
- {documente_shared-0.1.54b1 → documente_shared-0.1.56}/documente_shared/domain/repositories.py +0 -0
- {documente_shared-0.1.54b1 → documente_shared-0.1.56}/documente_shared/infrastructure/__init__.py +0 -0
- {documente_shared-0.1.54b1 → documente_shared-0.1.56}/documente_shared/infrastructure/dynamo_repositories.py +0 -0
- {documente_shared-0.1.54b1 → documente_shared-0.1.56}/documente_shared/infrastructure/dynamo_table.py +0 -0
- {documente_shared-0.1.54b1 → documente_shared-0.1.56}/documente_shared/infrastructure/s3_bucket.py +0 -0
- {documente_shared-0.1.54b1 → documente_shared-0.1.56}/documente_shared/infrastructure/sqs_queue.py +0 -0
{documente_shared-0.1.54b1 → documente_shared-0.1.56}/documente_shared/domain/entities/document.py
RENAMED
|
@@ -9,14 +9,16 @@ from documente_shared.domain.entities.document_metadata import DocumentProcessin
|
|
|
9
9
|
from documente_shared.domain.enums import (
|
|
10
10
|
DocumentProcessingStatus,
|
|
11
11
|
DocumentProcessingSubCategory,
|
|
12
|
-
DocumentProcessingCategory,
|
|
12
|
+
DocumentProcessingCategory, DocumentProcessingSource,
|
|
13
13
|
)
|
|
14
14
|
|
|
15
|
+
|
|
15
16
|
def remove_slash_from_path(path: str) -> str:
|
|
16
17
|
if path and path.startswith('/'):
|
|
17
18
|
return path[1:]
|
|
18
19
|
return path
|
|
19
20
|
|
|
21
|
+
|
|
20
22
|
@dataclass
|
|
21
23
|
class DocumentProcessing(object):
|
|
22
24
|
digest: str
|
|
@@ -25,6 +27,7 @@ class DocumentProcessing(object):
|
|
|
25
27
|
file_bytes: Optional[bytes] = None
|
|
26
28
|
category: Optional[DocumentProcessingCategory] = None
|
|
27
29
|
sub_category: Optional[DocumentProcessingSubCategory] = None
|
|
30
|
+
uploaded_from: Optional[DocumentProcessingSource] = None
|
|
28
31
|
processed_csv_path: Optional[str] = None
|
|
29
32
|
processed_csv_bytes: Optional[bytes] = None
|
|
30
33
|
processed_xlsx_path: Optional[str] = None
|
|
@@ -85,6 +88,10 @@ class DocumentProcessing(object):
|
|
|
85
88
|
DocumentProcessingStatus.FAILED,
|
|
86
89
|
]
|
|
87
90
|
|
|
91
|
+
def pending(self):
|
|
92
|
+
self.status = DocumentProcessingStatus.PENDING
|
|
93
|
+
self.started_at = None
|
|
94
|
+
|
|
88
95
|
def enqueue(self, timezone: tzinfo = la_paz_tz):
|
|
89
96
|
self.status = DocumentProcessingStatus.ENQUEUED
|
|
90
97
|
self.enqueued_at = datetime.now(tz=timezone)
|
|
@@ -157,7 +164,6 @@ class DocumentProcessing(object):
|
|
|
157
164
|
and self.completed_at == other.completed_at
|
|
158
165
|
)
|
|
159
166
|
|
|
160
|
-
|
|
161
167
|
@property
|
|
162
168
|
def to_dict(self) -> dict:
|
|
163
169
|
return {
|
|
@@ -172,6 +178,10 @@ class DocumentProcessing(object):
|
|
|
172
178
|
str(self.sub_category)
|
|
173
179
|
if self.sub_category else None
|
|
174
180
|
),
|
|
181
|
+
'uploaded_from': (
|
|
182
|
+
str(self.uploaded_from)
|
|
183
|
+
if self.uploaded_from else None
|
|
184
|
+
),
|
|
175
185
|
'processed_csv_path': self.processed_csv_path,
|
|
176
186
|
'processed_xlsx_path': self.processed_xlsx_path,
|
|
177
187
|
'processed_json_path': self.processed_json_path,
|
|
@@ -212,6 +222,7 @@ class DocumentProcessing(object):
|
|
|
212
222
|
'file_bytes',
|
|
213
223
|
'category',
|
|
214
224
|
'sub_category',
|
|
225
|
+
'uploaded_from',
|
|
215
226
|
'processed_csv_path',
|
|
216
227
|
'processed_csv_bytes',
|
|
217
228
|
'processed_xlsx_path',
|
|
@@ -251,6 +262,10 @@ class DocumentProcessing(object):
|
|
|
251
262
|
DocumentProcessingSubCategory.from_value(data.get('sub_category'))
|
|
252
263
|
if data.get('sub_category') else None
|
|
253
264
|
),
|
|
265
|
+
uploaded_from=(
|
|
266
|
+
DocumentProcessingSource.from_value(data.get('uploaded_from'))
|
|
267
|
+
if data.get('uploaded_from') else None
|
|
268
|
+
),
|
|
254
269
|
processed_csv_path=data.get('processed_csv_path'),
|
|
255
270
|
processed_xlsx_path=data.get('processed_xlsx_path'),
|
|
256
271
|
processed_json_path=data.get('processed_json_path'),
|
|
@@ -11,6 +11,7 @@ class DocumentProcessingStatus(BaseEnum):
|
|
|
11
11
|
CANCELLED = 'CANCELLED'
|
|
12
12
|
IN_REVIEW = 'IN_REVIEW'
|
|
13
13
|
|
|
14
|
+
|
|
14
15
|
class DocumentProcessingCategory(BaseEnum):
|
|
15
16
|
CIRCULAR = 'CIRCULAR'
|
|
16
17
|
DESGRAVAMEN = 'DESGRAVAMEN'
|
|
@@ -24,6 +25,39 @@ class DocumentProcessingCategory(BaseEnum):
|
|
|
24
25
|
return self == DocumentProcessingCategory.DESGRAVAMEN
|
|
25
26
|
|
|
26
27
|
|
|
28
|
+
class DocumentProcessingSource(BaseEnum):
|
|
29
|
+
AGENT_UI = 'AGENT_UI'
|
|
30
|
+
AGENT_CRAWLER = 'AGENT_CRAWLER'
|
|
31
|
+
PLATFORM_UI = 'PLATFORM_UI'
|
|
32
|
+
PLATFORM_API = 'PLATFORM_API'
|
|
33
|
+
AWS_CONSOLE = 'AWS_CONSOLE'
|
|
34
|
+
LOCAL_MANUAL = 'LOCAL_MANUAL'
|
|
35
|
+
|
|
36
|
+
@property
|
|
37
|
+
def is_agent_ui(self):
|
|
38
|
+
return self == DocumentProcessingSource.AGENT_UI
|
|
39
|
+
|
|
40
|
+
@property
|
|
41
|
+
def is_agent_crawler(self):
|
|
42
|
+
return self == DocumentProcessingSource.AGENT_CRAWLER
|
|
43
|
+
|
|
44
|
+
@property
|
|
45
|
+
def is_platform_ui(self):
|
|
46
|
+
return self == DocumentProcessingSource.PLATFORM_UI
|
|
47
|
+
|
|
48
|
+
@property
|
|
49
|
+
def is_platform_api(self):
|
|
50
|
+
return self == DocumentProcessingSource.PLATFORM_API
|
|
51
|
+
|
|
52
|
+
@property
|
|
53
|
+
def is_aws_console(self):
|
|
54
|
+
return self == DocumentProcessingSource.AWS_CONSOLE
|
|
55
|
+
|
|
56
|
+
@property
|
|
57
|
+
def is_local_manual(self):
|
|
58
|
+
return self == DocumentProcessingSource.LOCAL_MANUAL
|
|
59
|
+
|
|
60
|
+
|
|
27
61
|
class DocumentProcessingSubCategory(BaseEnum):
|
|
28
62
|
# Circulares
|
|
29
63
|
CC_COMBINADA = 'CC_COMBINADA'
|
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.54b1 → documente_shared-0.1.56}/documente_shared/application/__init__.py
RENAMED
|
File without changes
|
{documente_shared-0.1.54b1 → documente_shared-0.1.56}/documente_shared/application/digest.py
RENAMED
|
File without changes
|
{documente_shared-0.1.54b1 → documente_shared-0.1.56}/documente_shared/application/exceptions.py
RENAMED
|
File without changes
|
{documente_shared-0.1.54b1 → documente_shared-0.1.56}/documente_shared/application/time_utils.py
RENAMED
|
File without changes
|
{documente_shared-0.1.54b1 → documente_shared-0.1.56}/documente_shared/application/timezone.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.54b1 → documente_shared-0.1.56}/documente_shared/domain/entities/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.54b1 → documente_shared-0.1.56}/documente_shared/domain/repositories.py
RENAMED
|
File without changes
|
{documente_shared-0.1.54b1 → documente_shared-0.1.56}/documente_shared/infrastructure/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.54b1 → documente_shared-0.1.56}/documente_shared/infrastructure/s3_bucket.py
RENAMED
|
File without changes
|
{documente_shared-0.1.54b1 → documente_shared-0.1.56}/documente_shared/infrastructure/sqs_queue.py
RENAMED
|
File without changes
|