documente_shared 0.1.14__tar.gz → 0.1.16__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.14 → documente_shared-0.1.16}/PKG-INFO +1 -1
- documente_shared-0.1.16/documente_shared/application/digest.py +7 -0
- {documente_shared-0.1.14 → documente_shared-0.1.16}/documente_shared/domain/entities.py +34 -6
- {documente_shared-0.1.14 → documente_shared-0.1.16}/documente_shared/domain/enums.py +10 -0
- {documente_shared-0.1.14 → documente_shared-0.1.16}/documente_shared/domain/repositories.py +5 -0
- documente_shared-0.1.16/documente_shared/infrastructure/__init__.py +0 -0
- {documente_shared-0.1.14 → documente_shared-0.1.16}/documente_shared/infrastructure/dynamo_repositories.py +6 -0
- {documente_shared-0.1.14 → documente_shared-0.1.16}/pyproject.toml +1 -1
- {documente_shared-0.1.14 → documente_shared-0.1.16}/README.md +0 -0
- {documente_shared-0.1.14 → documente_shared-0.1.16}/documente_shared/__init__.py +0 -0
- {documente_shared-0.1.14/documente_shared/domain → documente_shared-0.1.16/documente_shared/application}/__init__.py +0 -0
- {documente_shared-0.1.14/documente_shared/infrastructure → documente_shared-0.1.16/documente_shared/domain}/__init__.py +0 -0
- {documente_shared-0.1.14 → documente_shared-0.1.16}/documente_shared/domain/base_enum.py +0 -0
- {documente_shared-0.1.14 → documente_shared-0.1.16}/documente_shared/infrastructure/dynamo_table.py +0 -0
- {documente_shared-0.1.14 → documente_shared-0.1.16}/documente_shared/infrastructure/s3_bucket.py +0 -0
- {documente_shared-0.1.14 → documente_shared-0.1.16}/documente_shared/infrastructure/sqs_queue.py +0 -0
|
@@ -3,7 +3,11 @@ from datetime import datetime
|
|
|
3
3
|
from decimal import Decimal
|
|
4
4
|
from typing import Optional
|
|
5
5
|
|
|
6
|
-
from documente_shared.domain.enums import
|
|
6
|
+
from documente_shared.domain.enums import (
|
|
7
|
+
DocumentProcessStatus,
|
|
8
|
+
DocumentProcessSubCategory,
|
|
9
|
+
DocumentProcessCategory,
|
|
10
|
+
)
|
|
7
11
|
|
|
8
12
|
|
|
9
13
|
@dataclass
|
|
@@ -11,13 +15,16 @@ class DocumentProcess(object):
|
|
|
11
15
|
digest: str
|
|
12
16
|
status: DocumentProcessStatus
|
|
13
17
|
file_path: str
|
|
18
|
+
category: Optional[DocumentProcessCategory] = None
|
|
19
|
+
sub_category: Optional[DocumentProcessSubCategory] = None
|
|
14
20
|
processed_csv_path: Optional[str] = None
|
|
15
21
|
processed_xlsx_path: Optional[str] = None
|
|
16
22
|
processing_time: Optional[Decimal] = None
|
|
23
|
+
uploded_at: Optional[datetime] = None
|
|
17
24
|
enqueued_at: Optional[datetime] = None
|
|
18
25
|
started_at: Optional[datetime] = None
|
|
19
26
|
failed_at: Optional[datetime] = None
|
|
20
|
-
|
|
27
|
+
completed_at: Optional[datetime] = None
|
|
21
28
|
|
|
22
29
|
@property
|
|
23
30
|
def is_pending(self) -> bool:
|
|
@@ -61,7 +68,7 @@ class DocumentProcess(object):
|
|
|
61
68
|
|
|
62
69
|
def completed(self):
|
|
63
70
|
self.status = DocumentProcessStatus.COMPLETED
|
|
64
|
-
self.
|
|
71
|
+
self.completed_at = datetime.now()
|
|
65
72
|
|
|
66
73
|
def deleted(self):
|
|
67
74
|
self.status = DocumentProcessStatus.DELETED
|
|
@@ -77,16 +84,25 @@ class DocumentProcess(object):
|
|
|
77
84
|
'digest': self.digest,
|
|
78
85
|
'status': self.status.value,
|
|
79
86
|
'file_path': self.file_path,
|
|
87
|
+
'category': (
|
|
88
|
+
str(self.category)
|
|
89
|
+
if self.category else None
|
|
90
|
+
),
|
|
91
|
+
'sub_category': (
|
|
92
|
+
str(self.sub_category)
|
|
93
|
+
if self.sub_category else None
|
|
94
|
+
),
|
|
80
95
|
'processed_csv_path': self.processed_csv_path,
|
|
81
96
|
'processed_xlsx_path': self.processed_xlsx_path,
|
|
82
97
|
'processing_time': (
|
|
83
98
|
str(self.processing_time)
|
|
84
99
|
if self.processing_time else None
|
|
85
100
|
),
|
|
101
|
+
'uploded_at': self.uploded_at.isoformat() if self.uploded_at else None,
|
|
86
102
|
'enqueued_at': self.enqueued_at.isoformat() if self.enqueued_at else None,
|
|
87
103
|
'started_at': self.started_at.isoformat() if self.started_at else None,
|
|
88
104
|
'failed_at': self.failed_at.isoformat() if self.failed_at else None,
|
|
89
|
-
'
|
|
105
|
+
'completed_at': self.completed_at.isoformat() if self.completed_at else None,
|
|
90
106
|
}
|
|
91
107
|
|
|
92
108
|
@classmethod
|
|
@@ -95,12 +111,24 @@ class DocumentProcess(object):
|
|
|
95
111
|
digest=data.get('digest'),
|
|
96
112
|
status=DocumentProcessStatus.from_value(data.get('status')),
|
|
97
113
|
file_path=data.get('file_path'),
|
|
114
|
+
category=(
|
|
115
|
+
DocumentProcessCategory.from_value(data.get('category'))
|
|
116
|
+
if data.get('category') else None
|
|
117
|
+
),
|
|
118
|
+
sub_category=(
|
|
119
|
+
DocumentProcessSubCategory.from_value(data.get('sub_category'))
|
|
120
|
+
if data.get('sub_category') else None
|
|
121
|
+
),
|
|
98
122
|
processed_csv_path=data.get('processed_csv_path'),
|
|
99
123
|
processed_xlsx_path=data.get('processed_xlsx_path'),
|
|
100
124
|
processing_time=(
|
|
101
125
|
Decimal(data.get('processing_time'))
|
|
102
126
|
if data.get('processing_time') else None
|
|
103
127
|
),
|
|
128
|
+
uploded_at=(
|
|
129
|
+
datetime.fromisoformat(data.get('uploded_at'))
|
|
130
|
+
if data.get('uploded_at') else None
|
|
131
|
+
),
|
|
104
132
|
enqueued_at=(
|
|
105
133
|
datetime.fromisoformat(data.get('enqueued_at'))
|
|
106
134
|
if data.get('enqueued_at') else None
|
|
@@ -113,8 +141,8 @@ class DocumentProcess(object):
|
|
|
113
141
|
datetime.fromisoformat(data.get('failed_at'))
|
|
114
142
|
if data.get('failed_at') else None
|
|
115
143
|
),
|
|
116
|
-
|
|
117
|
-
datetime.fromisoformat(data.get('
|
|
144
|
+
completed_at=(
|
|
145
|
+
datetime.fromisoformat(data.get('completed_at'))
|
|
118
146
|
if data.get('processed_at') else None
|
|
119
147
|
),
|
|
120
148
|
)
|
|
@@ -9,3 +9,13 @@ class DocumentProcessStatus(BaseEnum):
|
|
|
9
9
|
FAILED = 'FAILED'
|
|
10
10
|
DELETED = 'DELETED'
|
|
11
11
|
|
|
12
|
+
|
|
13
|
+
class DocumentProcessCategory(BaseEnum):
|
|
14
|
+
CIRCULAR = 'CIRCULAR'
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class DocumentProcessSubCategory(BaseEnum):
|
|
18
|
+
CC_COMBINADA = 'CC_COMBINADA'
|
|
19
|
+
CC_NORMATIVA = 'CC_NORMATIVA'
|
|
20
|
+
|
|
21
|
+
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
from abc import ABC, abstractmethod
|
|
2
2
|
|
|
3
3
|
from documente_shared.domain.entities import DocumentProcess
|
|
4
|
+
from python_layer.python.typing_extensions import Optional
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
class DocumentProcessRepository(ABC):
|
|
7
8
|
|
|
9
|
+
@abstractmethod
|
|
10
|
+
def find(self, digest: str) ->Optional[DocumentProcess]:
|
|
11
|
+
raise NotImplementedError
|
|
12
|
+
|
|
8
13
|
@abstractmethod
|
|
9
14
|
def persist(self, instance: DocumentProcess) -> DocumentProcess:
|
|
10
15
|
raise NotImplementedError
|
|
File without changes
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
from documente_shared.domain.entities import DocumentProcess
|
|
2
2
|
from documente_shared.domain.repositories import DocumentProcessRepository
|
|
3
3
|
from documente_shared.infrastructure.dynamo_table import DynamoDBTable
|
|
4
|
+
from python_layer.python.typing_extensions import Optional
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
class DynamoDocumentProcessRepository(
|
|
7
8
|
DynamoDBTable,
|
|
8
9
|
DocumentProcessRepository,
|
|
9
10
|
):
|
|
11
|
+
def find(self, digest: str) -> Optional[DocumentProcess]:
|
|
12
|
+
item = self.get(key=digest)
|
|
13
|
+
if item:
|
|
14
|
+
return DocumentProcess.from_dict(item)
|
|
15
|
+
return None
|
|
10
16
|
|
|
11
17
|
def persist(self, instance: DocumentProcess) -> DocumentProcess:
|
|
12
18
|
self.put(instance.to_dict)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.14 → documente_shared-0.1.16}/documente_shared/infrastructure/dynamo_table.py
RENAMED
|
File without changes
|
{documente_shared-0.1.14 → documente_shared-0.1.16}/documente_shared/infrastructure/s3_bucket.py
RENAMED
|
File without changes
|
{documente_shared-0.1.14 → documente_shared-0.1.16}/documente_shared/infrastructure/sqs_queue.py
RENAMED
|
File without changes
|