documente_shared 0.1.67__tar.gz → 0.1.68__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.67 → documente_shared-0.1.68}/PKG-INFO +1 -1
- documente_shared-0.1.68/documente_shared/domain/entities/in_memory_result.py +51 -0
- documente_shared-0.1.68/documente_shared/domain/entities/processing_case.py +139 -0
- documente_shared-0.1.68/documente_shared/domain/entities/processing_case_item.py +211 -0
- documente_shared-0.1.68/documente_shared/domain/enums/common.py +95 -0
- documente_shared-0.1.68/documente_shared/domain/enums/processing_case.py +54 -0
- documente_shared-0.1.68/documente_shared/infrastructure/__init__.py +0 -0
- {documente_shared-0.1.67 → documente_shared-0.1.68}/pyproject.toml +1 -1
- {documente_shared-0.1.67 → documente_shared-0.1.68}/README.md +0 -0
- {documente_shared-0.1.67 → documente_shared-0.1.68}/documente_shared/__init__.py +0 -0
- {documente_shared-0.1.67 → documente_shared-0.1.68}/documente_shared/application/__init__.py +0 -0
- {documente_shared-0.1.67 → documente_shared-0.1.68}/documente_shared/application/digest.py +0 -0
- {documente_shared-0.1.67 → documente_shared-0.1.68}/documente_shared/application/exceptions.py +0 -0
- {documente_shared-0.1.67 → documente_shared-0.1.68}/documente_shared/application/files.py +0 -0
- {documente_shared-0.1.67 → documente_shared-0.1.68}/documente_shared/application/time_utils.py +0 -0
- {documente_shared-0.1.67 → documente_shared-0.1.68}/documente_shared/application/timezone.py +0 -0
- {documente_shared-0.1.67 → documente_shared-0.1.68}/documente_shared/domain/__init__.py +0 -0
- {documente_shared-0.1.67 → documente_shared-0.1.68}/documente_shared/domain/base_enum.py +0 -0
- {documente_shared-0.1.67 → documente_shared-0.1.68}/documente_shared/domain/constants.py +0 -0
- {documente_shared-0.1.67 → documente_shared-0.1.68}/documente_shared/domain/entities/__init__.py +0 -0
- {documente_shared-0.1.67 → documente_shared-0.1.68}/documente_shared/domain/entities/document.py +0 -0
- {documente_shared-0.1.67 → documente_shared-0.1.68}/documente_shared/domain/entities/document_metadata.py +0 -0
- {documente_shared-0.1.67/documente_shared/infrastructure → documente_shared-0.1.68/documente_shared/domain/enums}/__init__.py +0 -0
- /documente_shared-0.1.67/documente_shared/domain/enums.py → /documente_shared-0.1.68/documente_shared/domain/enums/document.py +0 -0
- {documente_shared-0.1.67 → documente_shared-0.1.68}/documente_shared/domain/repositories.py +0 -0
- {documente_shared-0.1.67 → documente_shared-0.1.68}/documente_shared/infrastructure/dynamo_repositories.py +0 -0
- {documente_shared-0.1.67 → documente_shared-0.1.68}/documente_shared/infrastructure/dynamo_table.py +0 -0
- {documente_shared-0.1.67 → documente_shared-0.1.68}/documente_shared/infrastructure/s3_bucket.py +0 -0
- {documente_shared-0.1.67 → documente_shared-0.1.68}/documente_shared/infrastructure/sqs_queue.py +0 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from typing import Optional
|
|
3
|
+
|
|
4
|
+
from documente_shared.application.files import (
|
|
5
|
+
remove_slash_from_path,
|
|
6
|
+
get_filename_from_path,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@dataclass
|
|
11
|
+
class InMemoryDocument(object):
|
|
12
|
+
file_path: Optional[str] = None
|
|
13
|
+
file_bytes: Optional[bytes] = None
|
|
14
|
+
|
|
15
|
+
@property
|
|
16
|
+
def is_valid(self) -> bool:
|
|
17
|
+
return bool(self.file_path) and self.file_bytes
|
|
18
|
+
|
|
19
|
+
@property
|
|
20
|
+
def has_content(self) -> bool:
|
|
21
|
+
return bool(self.file_bytes)
|
|
22
|
+
|
|
23
|
+
@property
|
|
24
|
+
def file_key(self) -> Optional[str]:
|
|
25
|
+
if not self.file_path:
|
|
26
|
+
return None
|
|
27
|
+
return remove_slash_from_path(self.file_path)
|
|
28
|
+
|
|
29
|
+
@property
|
|
30
|
+
def file_name(self) -> Optional[str]:
|
|
31
|
+
if not self.file_path:
|
|
32
|
+
return None
|
|
33
|
+
return get_filename_from_path(self.file_path)
|
|
34
|
+
|
|
35
|
+
@property
|
|
36
|
+
def is_procesable(self) -> bool:
|
|
37
|
+
return self.is_valid and self.has_content
|
|
38
|
+
|
|
39
|
+
@property
|
|
40
|
+
def to_dict(self) -> dict:
|
|
41
|
+
return {
|
|
42
|
+
'file_path': self.file_path,
|
|
43
|
+
'file_bytes': self.file_bytes,
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@classmethod
|
|
47
|
+
def from_dict(cls, data: dict):
|
|
48
|
+
return cls(
|
|
49
|
+
file_path=data.get('file_path'),
|
|
50
|
+
file_bytes=data.get('file_bytes'),
|
|
51
|
+
)
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from datetime import datetime, tzinfo
|
|
3
|
+
from typing import Optional, List
|
|
4
|
+
|
|
5
|
+
from documente_shared.application.time_utils import get_datetime_from_data
|
|
6
|
+
from documente_shared.domain.constants import la_paz_tz
|
|
7
|
+
from documente_shared.domain.entities.processing_case_item import ProcessingCaseItem
|
|
8
|
+
from documente_shared.domain.enums.common import ProcessingStatus
|
|
9
|
+
from documente_shared.domain.enums.processing_case import ProcessingCaseCategory
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@dataclass
|
|
13
|
+
class ProcessingCase(object):
|
|
14
|
+
id: str
|
|
15
|
+
status: ProcessingStatus
|
|
16
|
+
category: Optional[ProcessingCaseCategory] = None
|
|
17
|
+
enqueued_at: Optional[datetime] = None
|
|
18
|
+
started_at: Optional[datetime] = None
|
|
19
|
+
failed_at: Optional[datetime] = None
|
|
20
|
+
feedback: Optional[list | dict] = None
|
|
21
|
+
completed_at: Optional[datetime] = None
|
|
22
|
+
metadata: Optional[dict] = None
|
|
23
|
+
items: Optional[List[ProcessingCaseItem]] = None
|
|
24
|
+
|
|
25
|
+
def __post_init__(self):
|
|
26
|
+
self.items = self.items or []
|
|
27
|
+
|
|
28
|
+
@property
|
|
29
|
+
def is_procesable(self) -> bool:
|
|
30
|
+
return self.items and len(self.items) > 0
|
|
31
|
+
|
|
32
|
+
def pending(self, timezone: tzinfo = la_paz_tz):
|
|
33
|
+
self.status = ProcessingStatus.PENDING
|
|
34
|
+
self.started_at = None
|
|
35
|
+
|
|
36
|
+
def enqueue(self, timezone: tzinfo = la_paz_tz):
|
|
37
|
+
self.status = ProcessingStatus.ENQUEUED
|
|
38
|
+
self.enqueued_at = datetime.now(tz=timezone)
|
|
39
|
+
|
|
40
|
+
def processing(self, timezone: tzinfo = la_paz_tz):
|
|
41
|
+
self.status = ProcessingStatus.PROCESSING
|
|
42
|
+
self.started_at = datetime.now(tz=timezone)
|
|
43
|
+
|
|
44
|
+
def failed(
|
|
45
|
+
self,
|
|
46
|
+
error_message: Optional[str] = None,
|
|
47
|
+
timezone: tzinfo = la_paz_tz,
|
|
48
|
+
):
|
|
49
|
+
self.status = ProcessingStatus.FAILED
|
|
50
|
+
self.failed_at = datetime.now(tz=timezone)
|
|
51
|
+
|
|
52
|
+
def completed(self, timezone: tzinfo = la_paz_tz):
|
|
53
|
+
self.status = ProcessingStatus.COMPLETED
|
|
54
|
+
self.completed_at = datetime.now(tz=timezone)
|
|
55
|
+
|
|
56
|
+
def deleted(self):
|
|
57
|
+
self.status = ProcessingStatus.DELETED
|
|
58
|
+
|
|
59
|
+
def __eq__(self, other: 'ProcessingCase') -> bool:
|
|
60
|
+
if not other:
|
|
61
|
+
return False
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
self.id == other.id
|
|
65
|
+
and self.status == other.status
|
|
66
|
+
and self.category == other.category
|
|
67
|
+
and self.enqueued_at == other.enqueued_at
|
|
68
|
+
and self.started_at == other.started_at
|
|
69
|
+
and self.failed_at == other.failed_at
|
|
70
|
+
and self.feedback == other.feedback
|
|
71
|
+
and self.completed_at == other.completed_at
|
|
72
|
+
and self.metadata == other.metadata
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
@property
|
|
76
|
+
def to_dict(self) -> dict:
|
|
77
|
+
return {
|
|
78
|
+
'id': self.id,
|
|
79
|
+
'status': str(self.status),
|
|
80
|
+
'category': (
|
|
81
|
+
str(self.category)
|
|
82
|
+
if self.category else None
|
|
83
|
+
),
|
|
84
|
+
'enqueued_at': self.enqueued_at.isoformat() if self.enqueued_at else None,
|
|
85
|
+
'started_at': self.started_at.isoformat() if self.started_at else None,
|
|
86
|
+
'failed_at': self.failed_at.isoformat() if self.failed_at else None,
|
|
87
|
+
'feedback': self.feedback,
|
|
88
|
+
'completed_at': self.completed_at.isoformat() if self.completed_at else None,
|
|
89
|
+
'metadata': self.metadata,
|
|
90
|
+
'items': [item.to_dict for item in self.items],
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
@property
|
|
94
|
+
def to_persist_dict(self) -> dict:
|
|
95
|
+
return self.to_dict
|
|
96
|
+
|
|
97
|
+
def overload(
|
|
98
|
+
self,
|
|
99
|
+
new_instance: 'ProcessingCase',
|
|
100
|
+
properties: List[str] = None,
|
|
101
|
+
):
|
|
102
|
+
instance_properties = properties or [
|
|
103
|
+
'status',
|
|
104
|
+
'category',
|
|
105
|
+
'enqueued_at',
|
|
106
|
+
'started_at',
|
|
107
|
+
'failed_at',
|
|
108
|
+
'feedback',
|
|
109
|
+
'completed_at',
|
|
110
|
+
'metadata',
|
|
111
|
+
'items',
|
|
112
|
+
]
|
|
113
|
+
for _property in instance_properties:
|
|
114
|
+
property_value = getattr(new_instance, _property)
|
|
115
|
+
if not hasattr(self, _property):
|
|
116
|
+
continue
|
|
117
|
+
setattr(self, _property, property_value)
|
|
118
|
+
return self
|
|
119
|
+
|
|
120
|
+
@classmethod
|
|
121
|
+
def from_dict(cls, data: dict) -> 'ProcessingCase':
|
|
122
|
+
return cls(
|
|
123
|
+
id=data.get('id'),
|
|
124
|
+
status=ProcessingStatus.from_value(data.get('status')),
|
|
125
|
+
category=(
|
|
126
|
+
ProcessingCaseCategory.from_value(data.get('category'))
|
|
127
|
+
if data.get('category') else None
|
|
128
|
+
),
|
|
129
|
+
enqueued_at=get_datetime_from_data(input_datetime=data.get('enqueued_at')),
|
|
130
|
+
started_at=get_datetime_from_data(input_datetime=data.get('started_at')),
|
|
131
|
+
failed_at=get_datetime_from_data(input_datetime=data.get('failed_at')),
|
|
132
|
+
feedback=data.get('feedback'),
|
|
133
|
+
metadata=data.get('metadata', {}),
|
|
134
|
+
completed_at=get_datetime_from_data(input_datetime=data.get('completed_at')),
|
|
135
|
+
items=[
|
|
136
|
+
ProcessingCaseItem.from_dict(item_dict)
|
|
137
|
+
for item_dict in data.get('items', [])
|
|
138
|
+
],
|
|
139
|
+
)
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from datetime import datetime, tzinfo
|
|
3
|
+
from decimal import Decimal
|
|
4
|
+
from typing import Optional, List
|
|
5
|
+
|
|
6
|
+
from documente_shared.application.time_utils import get_datetime_from_data
|
|
7
|
+
from documente_shared.domain.constants import la_paz_tz
|
|
8
|
+
from documente_shared.domain.entities.in_memory_result import InMemoryDocument
|
|
9
|
+
from documente_shared.domain.enums.common import ProcessingStatus, ProcessingSource
|
|
10
|
+
from documente_shared.domain.enums.processing_case import ProcessingDocumentType
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@dataclass
|
|
14
|
+
class ProcessingCaseItem(object):
|
|
15
|
+
id: str
|
|
16
|
+
case_id: str
|
|
17
|
+
digest: str
|
|
18
|
+
status: ProcessingStatus
|
|
19
|
+
document_type: ProcessingDocumentType
|
|
20
|
+
document: InMemoryDocument
|
|
21
|
+
uploaded_from: Optional[ProcessingSource] = None
|
|
22
|
+
processed_csv: Optional[InMemoryDocument] = None
|
|
23
|
+
processed_xlsx: Optional[InMemoryDocument] = None
|
|
24
|
+
processed_json: Optional[InMemoryDocument] = None
|
|
25
|
+
processing_time: Optional[Decimal] = None
|
|
26
|
+
processing_confidence: Optional[Decimal] = None
|
|
27
|
+
started_at: Optional[datetime] = None
|
|
28
|
+
failed_at: Optional[datetime] = None
|
|
29
|
+
completed_at: Optional[datetime] = None
|
|
30
|
+
feedback: Optional[list | dict] = None
|
|
31
|
+
metadata: Optional[dict] = None
|
|
32
|
+
|
|
33
|
+
def __post_init__(self):
|
|
34
|
+
self.feedback = self.feedback or []
|
|
35
|
+
self.metadata = self.metadata or {}
|
|
36
|
+
|
|
37
|
+
@property
|
|
38
|
+
def is_procesable(self) -> bool:
|
|
39
|
+
return (
|
|
40
|
+
(self.status.is_pending or self.status.is_enqueued)
|
|
41
|
+
and self.digest
|
|
42
|
+
and self.document
|
|
43
|
+
and self.document.is_procesable
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
@property
|
|
47
|
+
def is_finished(self) -> bool:
|
|
48
|
+
return self.status in [
|
|
49
|
+
ProcessingStatus.COMPLETED,
|
|
50
|
+
ProcessingStatus.FAILED,
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
def pending(self, timezone: tzinfo = la_paz_tz):
|
|
54
|
+
self.status = ProcessingStatus.PENDING
|
|
55
|
+
self.started_at = None
|
|
56
|
+
|
|
57
|
+
def processing(self, timezone: tzinfo = la_paz_tz):
|
|
58
|
+
self.status = ProcessingStatus.PROCESSING
|
|
59
|
+
self.started_at = datetime.now(tz=timezone)
|
|
60
|
+
|
|
61
|
+
def failed(
|
|
62
|
+
self,
|
|
63
|
+
error_message: Optional[str] = None,
|
|
64
|
+
timezone: tzinfo = la_paz_tz,
|
|
65
|
+
):
|
|
66
|
+
self.status = ProcessingStatus.FAILED
|
|
67
|
+
self.failed_at = datetime.now(tz=timezone)
|
|
68
|
+
|
|
69
|
+
def completed(self, timezone: tzinfo = la_paz_tz):
|
|
70
|
+
self.status = ProcessingStatus.COMPLETED
|
|
71
|
+
self.completed_at = datetime.now(tz=timezone)
|
|
72
|
+
|
|
73
|
+
def incomplete(self, timezone: tzinfo = la_paz_tz):
|
|
74
|
+
self.status = ProcessingStatus.INCOMPLETE
|
|
75
|
+
self.completed_at = datetime.now(tz=timezone)
|
|
76
|
+
|
|
77
|
+
def deleted(self):
|
|
78
|
+
self.status = ProcessingStatus.DELETED
|
|
79
|
+
|
|
80
|
+
def in_review(self):
|
|
81
|
+
self.status = ProcessingStatus.IN_REVIEW
|
|
82
|
+
|
|
83
|
+
def __eq__(self, other: 'ProcessingCaseItem') -> bool:
|
|
84
|
+
if not other:
|
|
85
|
+
return False
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
self.digest == other.digest
|
|
89
|
+
and self.status == other.status
|
|
90
|
+
and self.document_type == other.document_type
|
|
91
|
+
and self.document == other.document
|
|
92
|
+
and self.processing_time == other.processing_time
|
|
93
|
+
and self.processing_confidence == other.processing_confidence
|
|
94
|
+
and self.started_at == other.started_at
|
|
95
|
+
and self.failed_at == other.failed_at
|
|
96
|
+
and self.completed_at == other.completed_at
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
@property
|
|
100
|
+
def to_dict(self) -> dict:
|
|
101
|
+
return {
|
|
102
|
+
'id': self.id,
|
|
103
|
+
'case_id': self.case_id,
|
|
104
|
+
'digest': self.digest,
|
|
105
|
+
'status': str(self.status),
|
|
106
|
+
'document': self.document.to_dict,
|
|
107
|
+
'document_type': self.document_type,
|
|
108
|
+
'uploaded_from': (
|
|
109
|
+
str(self.uploaded_from)
|
|
110
|
+
if self.uploaded_from else None
|
|
111
|
+
),
|
|
112
|
+
'processed_csv': (
|
|
113
|
+
self.processed_csv.to_dict
|
|
114
|
+
if self.processed_csv else None
|
|
115
|
+
),
|
|
116
|
+
'processed_xlsx': (
|
|
117
|
+
self.processed_xlsx.to_dict
|
|
118
|
+
if self.processed_xlsx else None
|
|
119
|
+
),
|
|
120
|
+
'processed_json': (
|
|
121
|
+
self.processed_json.to_dict
|
|
122
|
+
if self.processed_json else None
|
|
123
|
+
),
|
|
124
|
+
'processing_time': (
|
|
125
|
+
str(self.processing_time.quantize(Decimal('0.001')))
|
|
126
|
+
if self.processing_time else None
|
|
127
|
+
),
|
|
128
|
+
'processing_confidence': (
|
|
129
|
+
str(self.processing_confidence.quantize(Decimal('0.001')))
|
|
130
|
+
if self.processing_confidence else None
|
|
131
|
+
),
|
|
132
|
+
'started_at': self.started_at.isoformat() if self.started_at else None,
|
|
133
|
+
'failed_at': self.failed_at.isoformat() if self.failed_at else None,
|
|
134
|
+
'feedback': self.feedback,
|
|
135
|
+
'metadata': self.metadata,
|
|
136
|
+
'completed_at': self.completed_at.isoformat() if self.completed_at else None,
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
@property
|
|
140
|
+
def to_simple_dict(self) -> dict:
|
|
141
|
+
simple_dict = self.to_dict.copy()
|
|
142
|
+
simple_dict.pop('metadata_items')
|
|
143
|
+
return simple_dict
|
|
144
|
+
|
|
145
|
+
def overload(
|
|
146
|
+
self,
|
|
147
|
+
new_instance: 'ProcessingCaseItem',
|
|
148
|
+
properties: List[str] = None,
|
|
149
|
+
):
|
|
150
|
+
instance_properties = properties or [
|
|
151
|
+
'status',
|
|
152
|
+
'document_type',
|
|
153
|
+
'document',
|
|
154
|
+
'uploaded_from',
|
|
155
|
+
'processed_csv',
|
|
156
|
+
'processed_xlsx',
|
|
157
|
+
'processed_json',
|
|
158
|
+
'processing_time',
|
|
159
|
+
'processing_confidence',
|
|
160
|
+
'started_at',
|
|
161
|
+
'failed_at',
|
|
162
|
+
'completed_at',
|
|
163
|
+
'feedback',
|
|
164
|
+
'metadata',
|
|
165
|
+
]
|
|
166
|
+
for _property in instance_properties:
|
|
167
|
+
property_value = getattr(new_instance, _property)
|
|
168
|
+
if not hasattr(self, _property):
|
|
169
|
+
continue
|
|
170
|
+
setattr(self, _property, property_value)
|
|
171
|
+
return self
|
|
172
|
+
|
|
173
|
+
@classmethod
|
|
174
|
+
def from_dict(cls, data: dict) -> 'ProcessingCaseItem':
|
|
175
|
+
return cls(
|
|
176
|
+
id=data.get('id'),
|
|
177
|
+
case_id=data.get('case_id'),
|
|
178
|
+
digest=data.get('digest'),
|
|
179
|
+
status=ProcessingStatus.from_value(data.get('status')),
|
|
180
|
+
document=InMemoryDocument.from_dict(data.get('document')),
|
|
181
|
+
document_type=ProcessingDocumentType.from_value(data.get('document_type')),
|
|
182
|
+
uploaded_from=(
|
|
183
|
+
ProcessingSource.from_value(data.get('uploaded_from'))
|
|
184
|
+
if data.get('uploaded_from') else None
|
|
185
|
+
),
|
|
186
|
+
processed_csv=(
|
|
187
|
+
InMemoryDocument.from_dict(data.get('processed_csv'))
|
|
188
|
+
if data.get('processed_csv') else None
|
|
189
|
+
),
|
|
190
|
+
processed_xlsx=(
|
|
191
|
+
InMemoryDocument.from_dict(data.get('processed_xlsx'))
|
|
192
|
+
if data.get('processed_xlsx') else None
|
|
193
|
+
),
|
|
194
|
+
processed_json=(
|
|
195
|
+
InMemoryDocument.from_dict(data.get('processed_json'))
|
|
196
|
+
if data.get('processed_json') else None
|
|
197
|
+
),
|
|
198
|
+
processing_time=(
|
|
199
|
+
Decimal(data.get('processing_time'))
|
|
200
|
+
if data.get('processing_time') else None
|
|
201
|
+
),
|
|
202
|
+
processing_confidence=(
|
|
203
|
+
Decimal(data.get('processing_confidence'))
|
|
204
|
+
if data.get('processing_confidence') else None
|
|
205
|
+
),
|
|
206
|
+
started_at=get_datetime_from_data(input_datetime=data.get('started_at')),
|
|
207
|
+
failed_at=get_datetime_from_data(input_datetime=data.get('failed_at')),
|
|
208
|
+
feedback=data.get('feedback'),
|
|
209
|
+
metadata=data.get('metadata', {}),
|
|
210
|
+
completed_at=get_datetime_from_data(input_datetime=data.get('completed_at')),
|
|
211
|
+
)
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
from documente_shared.domain.base_enum import BaseEnum
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class ProcessingSource(BaseEnum):
|
|
5
|
+
AGENT_UI = 'AGENT_UI'
|
|
6
|
+
AGENT_CRAWLER = 'AGENT_CRAWLER'
|
|
7
|
+
PLATFORM_UI = 'PLATFORM_UI'
|
|
8
|
+
PLATFORM_API = 'PLATFORM_API'
|
|
9
|
+
AWS_CONSOLE = 'AWS_CONSOLE'
|
|
10
|
+
LOCAL_MANUAL = 'LOCAL_MANUAL'
|
|
11
|
+
|
|
12
|
+
@property
|
|
13
|
+
def is_agent_ui(self):
|
|
14
|
+
return self == ProcessingSource.AGENT_UI
|
|
15
|
+
|
|
16
|
+
@property
|
|
17
|
+
def is_agent_crawler(self):
|
|
18
|
+
return self == ProcessingSource.AGENT_CRAWLER
|
|
19
|
+
|
|
20
|
+
@property
|
|
21
|
+
def is_platform_ui(self):
|
|
22
|
+
return self == ProcessingSource.PLATFORM_UI
|
|
23
|
+
|
|
24
|
+
@property
|
|
25
|
+
def is_platform_api(self):
|
|
26
|
+
return self == ProcessingSource.PLATFORM_API
|
|
27
|
+
|
|
28
|
+
@property
|
|
29
|
+
def is_aws_console(self):
|
|
30
|
+
return self == ProcessingSource.AWS_CONSOLE
|
|
31
|
+
|
|
32
|
+
@property
|
|
33
|
+
def is_local_manual(self):
|
|
34
|
+
return self == ProcessingSource.LOCAL_MANUAL
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class ProcessingStatus(BaseEnum):
|
|
38
|
+
PENDING = 'PENDING'
|
|
39
|
+
ENQUEUED = 'ENQUEUED'
|
|
40
|
+
PROCESSING = 'PROCESSING'
|
|
41
|
+
COMPLETED = 'COMPLETED'
|
|
42
|
+
INCOMPLETE = 'INCOMPLETE'
|
|
43
|
+
FAILED = 'FAILED'
|
|
44
|
+
DELETED = 'DELETED'
|
|
45
|
+
CANCELLED = 'CANCELLED'
|
|
46
|
+
IN_REVIEW = 'IN_REVIEW'
|
|
47
|
+
|
|
48
|
+
@property
|
|
49
|
+
def is_pending(self):
|
|
50
|
+
return self == ProcessingStatus.PENDING
|
|
51
|
+
|
|
52
|
+
@property
|
|
53
|
+
def is_enqueued(self):
|
|
54
|
+
return self == ProcessingStatus.ENQUEUED
|
|
55
|
+
|
|
56
|
+
@property
|
|
57
|
+
def is_processing(self):
|
|
58
|
+
return self == ProcessingStatus.PROCESSING
|
|
59
|
+
|
|
60
|
+
@property
|
|
61
|
+
def is_completed(self):
|
|
62
|
+
return self == ProcessingStatus.COMPLETED
|
|
63
|
+
|
|
64
|
+
@property
|
|
65
|
+
def is_incomplete(self):
|
|
66
|
+
return self == ProcessingStatus.INCOMPLETE
|
|
67
|
+
|
|
68
|
+
@property
|
|
69
|
+
def is_failed(self):
|
|
70
|
+
return self == ProcessingStatus.FAILED
|
|
71
|
+
|
|
72
|
+
@property
|
|
73
|
+
def is_deleted(self):
|
|
74
|
+
return self == ProcessingStatus.DELETED
|
|
75
|
+
|
|
76
|
+
@property
|
|
77
|
+
def is_cancelled(self):
|
|
78
|
+
return self == ProcessingStatus.CANCELLED
|
|
79
|
+
|
|
80
|
+
@property
|
|
81
|
+
def is_in_review(self):
|
|
82
|
+
return self == ProcessingStatus.IN_REVIEW
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class ProcessingType(BaseEnum):
|
|
86
|
+
DOCUMENT = 'DOCUMENT'
|
|
87
|
+
PROCESSING_CASE = 'PROCESSING_CASE'
|
|
88
|
+
|
|
89
|
+
@property
|
|
90
|
+
def is_document(self):
|
|
91
|
+
return self == ProcessingType.DOCUMENT
|
|
92
|
+
|
|
93
|
+
@property
|
|
94
|
+
def is_processing_case(self):
|
|
95
|
+
return self == ProcessingType.PROCESSING_CASE
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
from documente_shared.domain.base_enum import BaseEnum
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class ProcessingCaseCategory(BaseEnum):
|
|
5
|
+
BCP_MICROCREDITO = 'BCP_MICROCREDITO'
|
|
6
|
+
|
|
7
|
+
@property
|
|
8
|
+
def is_bcp_microcredito(self):
|
|
9
|
+
return self == ProcessingCaseCategory.BCP_MICROCREDITO
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ProcessingDocumentType(BaseEnum):
|
|
13
|
+
REVIEW_CHECKLIST = 'REVISION_CHECKLIST'
|
|
14
|
+
SOLICITUD_DE_CREDITO = 'SOLICITUD_DE_CREDITO'
|
|
15
|
+
RESOLUCION_DE_CREDITO = 'RESOLUCION_DE_CREDITO'
|
|
16
|
+
CEDULA_DE_IDENTIDAD = 'CEDULA_DE_IDENTIDAD'
|
|
17
|
+
NIT = 'NIT'
|
|
18
|
+
FICHA_VERIFICACION = 'FICHA_VERIFICACION'
|
|
19
|
+
FACTURA_ELECTRICIDAD = 'FACTURA_ELECTRICIDAD'
|
|
20
|
+
CARTA_CLIENTE = 'CARTA_CLIENTE'
|
|
21
|
+
|
|
22
|
+
@property
|
|
23
|
+
def is_review_checklist(self):
|
|
24
|
+
return self == ProcessingDocumentType.REVIEW_CHECKLIST
|
|
25
|
+
|
|
26
|
+
@property
|
|
27
|
+
def is_solicitud_de_credito(self):
|
|
28
|
+
return self == ProcessingDocumentType.SOLICITUD_DE_CREDITO
|
|
29
|
+
|
|
30
|
+
@property
|
|
31
|
+
def is_resolucion_de_credito(self):
|
|
32
|
+
return self == ProcessingDocumentType.RESOLUCION_DE_CREDITO
|
|
33
|
+
|
|
34
|
+
@property
|
|
35
|
+
def is_cedula_de_identidad(self):
|
|
36
|
+
return self == ProcessingDocumentType.CEDULA_DE_IDENTIDAD
|
|
37
|
+
|
|
38
|
+
@property
|
|
39
|
+
def is_nit(self):
|
|
40
|
+
return self == ProcessingDocumentType.NIT
|
|
41
|
+
|
|
42
|
+
@property
|
|
43
|
+
def is_ficha_verificacion(self):
|
|
44
|
+
return self == ProcessingDocumentType.FICHA_VERIFICACION
|
|
45
|
+
|
|
46
|
+
@property
|
|
47
|
+
def is_factura_electricidad(self):
|
|
48
|
+
return self == ProcessingDocumentType.FACTURA_ELECTRICIDAD
|
|
49
|
+
|
|
50
|
+
@property
|
|
51
|
+
def is_carta_cliente(self):
|
|
52
|
+
return self == ProcessingDocumentType.CARTA_CLIENTE
|
|
53
|
+
|
|
54
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.67 → documente_shared-0.1.68}/documente_shared/application/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.67 → documente_shared-0.1.68}/documente_shared/application/exceptions.py
RENAMED
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.67 → documente_shared-0.1.68}/documente_shared/application/time_utils.py
RENAMED
|
File without changes
|
{documente_shared-0.1.67 → documente_shared-0.1.68}/documente_shared/application/timezone.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.67 → documente_shared-0.1.68}/documente_shared/domain/entities/__init__.py
RENAMED
|
File without changes
|
{documente_shared-0.1.67 → documente_shared-0.1.68}/documente_shared/domain/entities/document.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.67 → documente_shared-0.1.68}/documente_shared/infrastructure/dynamo_table.py
RENAMED
|
File without changes
|
{documente_shared-0.1.67 → documente_shared-0.1.68}/documente_shared/infrastructure/s3_bucket.py
RENAMED
|
File without changes
|
{documente_shared-0.1.67 → documente_shared-0.1.68}/documente_shared/infrastructure/sqs_queue.py
RENAMED
|
File without changes
|