documente_shared 0.1.105__tar.gz → 0.1.107__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.105 → documente_shared-0.1.107}/PKG-INFO +1 -1
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/application/files.py +5 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/domain/entities/document.py +5 -1
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/domain/entities/in_memory_document.py +5 -1
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/domain/entities/processing_case_item.py +75 -70
- {documente_shared-0.1.105 → documente_shared-0.1.107}/pyproject.toml +1 -1
- {documente_shared-0.1.105 → documente_shared-0.1.107}/README.md +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/__init__.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/application/__init__.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/application/dates.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/application/digest.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/application/exceptions.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/application/json.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/application/numbers.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/application/payloads.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/application/query_params.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/application/time_utils.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/application/timezone.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/domain/__init__.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/domain/base_enum.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/domain/constants.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/domain/entities/__init__.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/domain/entities/document_metadata.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/domain/entities/processing_case.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/domain/entities/processing_case_filters.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/domain/entities/processing_case_item_filters.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/domain/entities/processing_documents.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/domain/entities/processing_event.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/domain/entities/scaling.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/domain/enums/__init__.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/domain/enums/common.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/domain/enums/document.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/domain/enums/processing_case.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/domain/exceptions.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/domain/interfaces/__init__.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/domain/interfaces/scaling.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/domain/repositories/__init__.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/domain/repositories/document.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/domain/repositories/processing_case.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/domain/repositories/processing_case_item.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/infrastructure/__init__.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/infrastructure/documente_client.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/infrastructure/dynamo_table.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/infrastructure/lambdas.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/infrastructure/repositories/__init__.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/infrastructure/repositories/dynamo_document.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/infrastructure/repositories/dynamo_processing_case.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/infrastructure/repositories/dynamo_processing_case_item.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/infrastructure/repositories/http_document_processing.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/infrastructure/repositories/http_processing_case.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/infrastructure/repositories/http_processing_case_item.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/infrastructure/repositories/mem_document.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/infrastructure/repositories/mem_processing_case.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/infrastructure/repositories/mem_processing_case_item.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/infrastructure/s3_bucket.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/infrastructure/services/__init__.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/infrastructure/services/http_scaling.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/infrastructure/sqs_queue.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/presentation/__init__.py +0 -0
- {documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/presentation/presenters.py +0 -0
|
@@ -20,3 +20,8 @@ def remove_slash_from_path(file_path: str) -> str:
|
|
|
20
20
|
if file_path and file_path.startswith('/'):
|
|
21
21
|
return file_path[1:]
|
|
22
22
|
return file_path
|
|
23
|
+
|
|
24
|
+
def remove_extension(filename: str) -> str:
|
|
25
|
+
if filename and '.' in filename:
|
|
26
|
+
return filename.rsplit('.', 1)[0]
|
|
27
|
+
return filename
|
{documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/domain/entities/document.py
RENAMED
|
@@ -4,7 +4,7 @@ from datetime import datetime, tzinfo
|
|
|
4
4
|
from decimal import Decimal
|
|
5
5
|
from typing import Optional, List
|
|
6
6
|
|
|
7
|
-
from documente_shared.application.files import remove_slash_from_path, get_filename_from_path
|
|
7
|
+
from documente_shared.application.files import remove_slash_from_path, get_filename_from_path, remove_extension
|
|
8
8
|
from documente_shared.application.numbers import normalize_number
|
|
9
9
|
from documente_shared.application.time_utils import get_datetime_from_data
|
|
10
10
|
from documente_shared.domain.constants import la_paz_tz
|
|
@@ -140,6 +140,10 @@ class DocumentProcessing(object):
|
|
|
140
140
|
def extended_filename(self) -> str:
|
|
141
141
|
return self.file_path.split('/')[-1]
|
|
142
142
|
|
|
143
|
+
@property
|
|
144
|
+
def raw_file_name(self) -> str:
|
|
145
|
+
return remove_extension(self.extended_filename)
|
|
146
|
+
|
|
143
147
|
@property
|
|
144
148
|
def filename(self) -> str:
|
|
145
149
|
filename_with_extension = self.extended_filename
|
|
@@ -2,7 +2,7 @@ import base64
|
|
|
2
2
|
from typing import Optional
|
|
3
3
|
from dataclasses import dataclass
|
|
4
4
|
|
|
5
|
-
from documente_shared.application.files import get_filename_from_path
|
|
5
|
+
from documente_shared.application.files import get_filename_from_path, remove_extension
|
|
6
6
|
from documente_shared.domain.exceptions import InMemoryDocumentContentError
|
|
7
7
|
|
|
8
8
|
|
|
@@ -33,6 +33,10 @@ class InMemoryDocument(object):
|
|
|
33
33
|
def file_name(self) -> Optional[str]:
|
|
34
34
|
return get_filename_from_path(self.file_path) if self.file_path else None
|
|
35
35
|
|
|
36
|
+
@property
|
|
37
|
+
def raw_file_name(self) -> str:
|
|
38
|
+
return remove_extension(self.file_name)
|
|
39
|
+
|
|
36
40
|
@property
|
|
37
41
|
def file_key(self) -> Optional[str]:
|
|
38
42
|
return self.file_name
|
|
@@ -36,34 +36,25 @@ class ProcessingCaseItem(object):
|
|
|
36
36
|
self.feedback = self.feedback or []
|
|
37
37
|
self.metadata = self.metadata or {}
|
|
38
38
|
|
|
39
|
-
@property
|
|
40
|
-
def has_processed_csv(self) -> bool:
|
|
41
|
-
return self.processed_csv and self.processed_csv.is_valid
|
|
42
39
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
def __eq__(self, other: 'ProcessingCaseItem') -> bool:
|
|
41
|
+
if not other:
|
|
42
|
+
return False
|
|
46
43
|
|
|
47
|
-
@property
|
|
48
|
-
def has_processed_json(self) -> bool:
|
|
49
|
-
return self.processed_json and self.processed_json.is_valid
|
|
50
|
-
|
|
51
|
-
@property
|
|
52
|
-
def is_procesable(self) -> bool:
|
|
53
44
|
return (
|
|
54
|
-
|
|
55
|
-
and self.digest
|
|
56
|
-
and self.
|
|
57
|
-
and self.
|
|
45
|
+
self.uuid == other.uuid
|
|
46
|
+
and self.digest == other.digest
|
|
47
|
+
and self.status == other.status
|
|
48
|
+
and self.document_type == other.document_type
|
|
49
|
+
and self.document == other.document
|
|
50
|
+
and self.processing_time == other.processing_time
|
|
51
|
+
and self.processing_confidence == other.processing_confidence
|
|
52
|
+
and self.uploaded_at == other.uploaded_at
|
|
53
|
+
and self.started_at == other.started_at
|
|
54
|
+
and self.failed_at == other.failed_at
|
|
55
|
+
and self.completed_at == other.completed_at
|
|
58
56
|
)
|
|
59
57
|
|
|
60
|
-
@property
|
|
61
|
-
def is_finished(self) -> bool:
|
|
62
|
-
return self.status in [
|
|
63
|
-
ProcessingStatus.COMPLETED,
|
|
64
|
-
ProcessingStatus.FAILED,
|
|
65
|
-
]
|
|
66
|
-
|
|
67
58
|
def pending(self, timezone: tzinfo = la_paz_tz):
|
|
68
59
|
self.status = ProcessingStatus.PENDING
|
|
69
60
|
self.started_at = None
|
|
@@ -73,9 +64,9 @@ class ProcessingCaseItem(object):
|
|
|
73
64
|
self.started_at = datetime.now(tz=timezone)
|
|
74
65
|
|
|
75
66
|
def failed(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
67
|
+
self,
|
|
68
|
+
error_message: Optional[str] = None,
|
|
69
|
+
timezone: tzinfo = la_paz_tz,
|
|
79
70
|
):
|
|
80
71
|
self.status = ProcessingStatus.FAILED
|
|
81
72
|
self.failed_at = datetime.now(tz=timezone)
|
|
@@ -90,28 +81,71 @@ class ProcessingCaseItem(object):
|
|
|
90
81
|
|
|
91
82
|
def deleted(self):
|
|
92
83
|
self.status = ProcessingStatus.DELETED
|
|
93
|
-
|
|
84
|
+
|
|
94
85
|
def in_review(self):
|
|
95
86
|
self.status = ProcessingStatus.IN_REVIEW
|
|
96
87
|
|
|
97
|
-
def
|
|
98
|
-
|
|
99
|
-
|
|
88
|
+
def overload(
|
|
89
|
+
self,
|
|
90
|
+
new_instance: 'ProcessingCaseItem',
|
|
91
|
+
properties: List[str] = None,
|
|
92
|
+
):
|
|
93
|
+
instance_properties = properties or [
|
|
94
|
+
'status',
|
|
95
|
+
'document',
|
|
96
|
+
'document_type',
|
|
97
|
+
'uploaded_from',
|
|
98
|
+
'processed_csv',
|
|
99
|
+
'processed_xlsx',
|
|
100
|
+
'processed_json',
|
|
101
|
+
'processing_time',
|
|
102
|
+
'processing_confidence',
|
|
103
|
+
'uploaded_at',
|
|
104
|
+
'started_at',
|
|
105
|
+
'failed_at',
|
|
106
|
+
'completed_at',
|
|
107
|
+
'feedback',
|
|
108
|
+
'metadata',
|
|
109
|
+
]
|
|
110
|
+
for _property in instance_properties:
|
|
111
|
+
property_value = getattr(new_instance, _property)
|
|
112
|
+
if not hasattr(self, _property):
|
|
113
|
+
continue
|
|
114
|
+
setattr(self, _property, property_value)
|
|
115
|
+
return self
|
|
116
|
+
|
|
117
|
+
@property
|
|
118
|
+
def combined_id(self) -> str:
|
|
119
|
+
return f"{self.case_id}_{self.uuid}"
|
|
120
|
+
|
|
121
|
+
@property
|
|
122
|
+
def has_processed_csv(self) -> bool:
|
|
123
|
+
return self.processed_csv and self.processed_csv.is_valid
|
|
124
|
+
|
|
125
|
+
@property
|
|
126
|
+
def has_processed_xlsx(self) -> bool:
|
|
127
|
+
return self.processed_xlsx and self.processed_xlsx.is_valid
|
|
100
128
|
|
|
129
|
+
@property
|
|
130
|
+
def has_processed_json(self) -> bool:
|
|
131
|
+
return self.processed_json and self.processed_json.is_valid
|
|
132
|
+
|
|
133
|
+
@property
|
|
134
|
+
def is_procesable(self) -> bool:
|
|
101
135
|
return (
|
|
102
|
-
self.
|
|
103
|
-
and self.digest
|
|
104
|
-
and self.
|
|
105
|
-
and self.
|
|
106
|
-
and self.document == other.document
|
|
107
|
-
and self.processing_time == other.processing_time
|
|
108
|
-
and self.processing_confidence == other.processing_confidence
|
|
109
|
-
and self.uploaded_at == other.uploaded_at
|
|
110
|
-
and self.started_at == other.started_at
|
|
111
|
-
and self.failed_at == other.failed_at
|
|
112
|
-
and self.completed_at == other.completed_at
|
|
136
|
+
(self.status.is_pending or self.status.is_enqueued)
|
|
137
|
+
and self.digest
|
|
138
|
+
and self.document
|
|
139
|
+
and self.document.is_procesable
|
|
113
140
|
)
|
|
114
141
|
|
|
142
|
+
@property
|
|
143
|
+
def is_finished(self) -> bool:
|
|
144
|
+
return self.status in [
|
|
145
|
+
ProcessingStatus.COMPLETED,
|
|
146
|
+
ProcessingStatus.FAILED,
|
|
147
|
+
]
|
|
148
|
+
|
|
115
149
|
@property
|
|
116
150
|
def to_dict(self) -> dict:
|
|
117
151
|
return {
|
|
@@ -185,35 +219,6 @@ class ProcessingCaseItem(object):
|
|
|
185
219
|
simple_dict["processed_json_path"] = self.processed_json.file_path if self.processed_json else None
|
|
186
220
|
return simple_dict
|
|
187
221
|
|
|
188
|
-
def overload(
|
|
189
|
-
self,
|
|
190
|
-
new_instance: 'ProcessingCaseItem',
|
|
191
|
-
properties: List[str] = None,
|
|
192
|
-
):
|
|
193
|
-
instance_properties = properties or [
|
|
194
|
-
'status',
|
|
195
|
-
'document',
|
|
196
|
-
'document_type',
|
|
197
|
-
'uploaded_from',
|
|
198
|
-
'processed_csv',
|
|
199
|
-
'processed_xlsx',
|
|
200
|
-
'processed_json',
|
|
201
|
-
'processing_time',
|
|
202
|
-
'processing_confidence',
|
|
203
|
-
'uploaded_at',
|
|
204
|
-
'started_at',
|
|
205
|
-
'failed_at',
|
|
206
|
-
'completed_at',
|
|
207
|
-
'feedback',
|
|
208
|
-
'metadata',
|
|
209
|
-
]
|
|
210
|
-
for _property in instance_properties:
|
|
211
|
-
property_value = getattr(new_instance, _property)
|
|
212
|
-
if not hasattr(self, _property):
|
|
213
|
-
continue
|
|
214
|
-
setattr(self, _property, property_value)
|
|
215
|
-
return self
|
|
216
|
-
|
|
217
222
|
@classmethod
|
|
218
223
|
def from_dict(cls, data: dict) -> 'ProcessingCaseItem':
|
|
219
224
|
return cls(
|
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/application/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/application/digest.py
RENAMED
|
File without changes
|
{documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/application/exceptions.py
RENAMED
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/application/numbers.py
RENAMED
|
File without changes
|
{documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/application/payloads.py
RENAMED
|
File without changes
|
{documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/application/query_params.py
RENAMED
|
File without changes
|
{documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/application/time_utils.py
RENAMED
|
File without changes
|
{documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/application/timezone.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/domain/entities/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/domain/entities/scaling.py
RENAMED
|
File without changes
|
{documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/domain/enums/__init__.py
RENAMED
|
File without changes
|
{documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/domain/enums/common.py
RENAMED
|
File without changes
|
{documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/domain/enums/document.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/domain/interfaces/__init__.py
RENAMED
|
File without changes
|
{documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/domain/interfaces/scaling.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/infrastructure/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/infrastructure/lambdas.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/infrastructure/s3_bucket.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/infrastructure/sqs_queue.py
RENAMED
|
File without changes
|
{documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/presentation/__init__.py
RENAMED
|
File without changes
|
{documente_shared-0.1.105 → documente_shared-0.1.107}/documente_shared/presentation/presenters.py
RENAMED
|
File without changes
|