documente_shared 0.1.61__tar.gz → 0.1.63__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.61 → documente_shared-0.1.63}/PKG-INFO +1 -1
- {documente_shared-0.1.61 → documente_shared-0.1.63}/documente_shared/domain/entities/document.py +53 -29
- {documente_shared-0.1.61 → documente_shared-0.1.63}/pyproject.toml +1 -1
- {documente_shared-0.1.61 → documente_shared-0.1.63}/README.md +0 -0
- {documente_shared-0.1.61 → documente_shared-0.1.63}/documente_shared/__init__.py +0 -0
- {documente_shared-0.1.61 → documente_shared-0.1.63}/documente_shared/application/__init__.py +0 -0
- {documente_shared-0.1.61 → documente_shared-0.1.63}/documente_shared/application/digest.py +0 -0
- {documente_shared-0.1.61 → documente_shared-0.1.63}/documente_shared/application/exceptions.py +0 -0
- {documente_shared-0.1.61 → documente_shared-0.1.63}/documente_shared/application/time_utils.py +0 -0
- {documente_shared-0.1.61 → documente_shared-0.1.63}/documente_shared/application/timezone.py +0 -0
- {documente_shared-0.1.61 → documente_shared-0.1.63}/documente_shared/domain/__init__.py +0 -0
- {documente_shared-0.1.61 → documente_shared-0.1.63}/documente_shared/domain/base_enum.py +0 -0
- {documente_shared-0.1.61 → documente_shared-0.1.63}/documente_shared/domain/constants.py +0 -0
- {documente_shared-0.1.61 → documente_shared-0.1.63}/documente_shared/domain/entities/__init__.py +0 -0
- {documente_shared-0.1.61 → documente_shared-0.1.63}/documente_shared/domain/entities/document_metadata.py +0 -0
- {documente_shared-0.1.61 → documente_shared-0.1.63}/documente_shared/domain/enums.py +0 -0
- {documente_shared-0.1.61 → documente_shared-0.1.63}/documente_shared/domain/repositories.py +0 -0
- {documente_shared-0.1.61 → documente_shared-0.1.63}/documente_shared/infrastructure/__init__.py +0 -0
- {documente_shared-0.1.61 → documente_shared-0.1.63}/documente_shared/infrastructure/dynamo_repositories.py +0 -0
- {documente_shared-0.1.61 → documente_shared-0.1.63}/documente_shared/infrastructure/dynamo_table.py +0 -0
- {documente_shared-0.1.61 → documente_shared-0.1.63}/documente_shared/infrastructure/s3_bucket.py +0 -0
- {documente_shared-0.1.61 → documente_shared-0.1.63}/documente_shared/infrastructure/sqs_queue.py +0 -0
{documente_shared-0.1.61 → documente_shared-0.1.63}/documente_shared/domain/entities/document.py
RENAMED
|
@@ -45,6 +45,7 @@ class DocumentProcessing(object):
|
|
|
45
45
|
failed_reason: Optional[str] = None
|
|
46
46
|
feedback: Optional[list | dict] = None
|
|
47
47
|
completed_at: Optional[datetime] = None
|
|
48
|
+
metadata: Optional[dict] = None
|
|
48
49
|
metadata_items: Optional[List[DocumentProcessingMetadata]] = None
|
|
49
50
|
|
|
50
51
|
def __post_init__(self):
|
|
@@ -93,6 +94,55 @@ class DocumentProcessing(object):
|
|
|
93
94
|
DocumentProcessingStatus.FAILED,
|
|
94
95
|
]
|
|
95
96
|
|
|
97
|
+
@property
|
|
98
|
+
def file_key(self) -> str:
|
|
99
|
+
return remove_slash_from_path(self.file_path)
|
|
100
|
+
|
|
101
|
+
@property
|
|
102
|
+
def processed_csv_key(self) -> str:
|
|
103
|
+
return remove_slash_from_path(self.processed_csv_path)
|
|
104
|
+
|
|
105
|
+
@property
|
|
106
|
+
def processed_xlsx_key(self) -> str:
|
|
107
|
+
return remove_slash_from_path(self.processed_xlsx_path)
|
|
108
|
+
|
|
109
|
+
@property
|
|
110
|
+
def processed_json_key(self) -> str:
|
|
111
|
+
return remove_slash_from_path(self.processed_json_path)
|
|
112
|
+
|
|
113
|
+
@property
|
|
114
|
+
def processed_metadata_key(self) -> str:
|
|
115
|
+
return remove_slash_from_path(self.processed_metadata_path)
|
|
116
|
+
|
|
117
|
+
@property
|
|
118
|
+
def extended_filename(self) -> str:
|
|
119
|
+
return self.file_path.split('/')[-1]
|
|
120
|
+
|
|
121
|
+
@property
|
|
122
|
+
def filename(self) -> str:
|
|
123
|
+
filename_with_extension = self.extended_filename
|
|
124
|
+
return filename_with_extension.split('.')[0]
|
|
125
|
+
|
|
126
|
+
@property
|
|
127
|
+
def has_original_file(self) -> bool:
|
|
128
|
+
return bool(self.file_path) and self.file_bytes
|
|
129
|
+
|
|
130
|
+
@property
|
|
131
|
+
def has_processed_csv(self) -> bool:
|
|
132
|
+
return bool(self.processed_csv_path) and self.processed_csv_bytes
|
|
133
|
+
|
|
134
|
+
@property
|
|
135
|
+
def has_processed_xlsx(self) -> bool:
|
|
136
|
+
return bool(self.processed_xlsx_path) and self.processed_xlsx_bytes
|
|
137
|
+
|
|
138
|
+
@property
|
|
139
|
+
def has_processed_json(self) -> bool:
|
|
140
|
+
return bool(self.processed_json_path) and self.processed_json_bytes
|
|
141
|
+
|
|
142
|
+
@property
|
|
143
|
+
def has_processed_metadata(self) -> bool:
|
|
144
|
+
return bool(self.processed_metadata_path) and self.metadata_items
|
|
145
|
+
|
|
96
146
|
def pending(self, timezone: tzinfo = la_paz_tz):
|
|
97
147
|
self.status = DocumentProcessingStatus.PENDING
|
|
98
148
|
self.started_at = None
|
|
@@ -129,35 +179,6 @@ class DocumentProcessing(object):
|
|
|
129
179
|
|
|
130
180
|
def in_review(self):
|
|
131
181
|
self.status = DocumentProcessingStatus.IN_REVIEW
|
|
132
|
-
|
|
133
|
-
@property
|
|
134
|
-
def file_key(self) -> str:
|
|
135
|
-
return remove_slash_from_path(self.file_path)
|
|
136
|
-
|
|
137
|
-
@property
|
|
138
|
-
def processed_csv_key(self) -> str:
|
|
139
|
-
return remove_slash_from_path(self.processed_csv_path)
|
|
140
|
-
|
|
141
|
-
@property
|
|
142
|
-
def processed_xlsx_key(self) -> str:
|
|
143
|
-
return remove_slash_from_path(self.processed_xlsx_path)
|
|
144
|
-
|
|
145
|
-
@property
|
|
146
|
-
def processed_json_key(self) -> str:
|
|
147
|
-
return remove_slash_from_path(self.processed_json_path)
|
|
148
|
-
|
|
149
|
-
@property
|
|
150
|
-
def processed_metadata_key(self) -> str:
|
|
151
|
-
return remove_slash_from_path(self.processed_metadata_path)
|
|
152
|
-
|
|
153
|
-
@property
|
|
154
|
-
def extended_filename(self) -> str:
|
|
155
|
-
return self.file_path.split('/')[-1]
|
|
156
|
-
|
|
157
|
-
@property
|
|
158
|
-
def filename(self) -> str:
|
|
159
|
-
filename_with_extension = self.extended_filename
|
|
160
|
-
return filename_with_extension.split('.')[0]
|
|
161
182
|
|
|
162
183
|
def __eq__(self, other: 'DocumentProcessing') -> bool:
|
|
163
184
|
if not other:
|
|
@@ -212,6 +233,7 @@ class DocumentProcessing(object):
|
|
|
212
233
|
'failed_at': self.failed_at.isoformat() if self.failed_at else None,
|
|
213
234
|
'failed_reason': self.failed_reason,
|
|
214
235
|
'feedback': self.feedback,
|
|
236
|
+
'metadata': self.metadata,
|
|
215
237
|
'completed_at': self.completed_at.isoformat() if self.completed_at else None,
|
|
216
238
|
'metadata_items': [metadata.to_dict for metadata in self.metadata_items],
|
|
217
239
|
}
|
|
@@ -252,6 +274,7 @@ class DocumentProcessing(object):
|
|
|
252
274
|
'failed_at',
|
|
253
275
|
'failed_reason',
|
|
254
276
|
'feedback',
|
|
277
|
+
'metadata',
|
|
255
278
|
'completed_at',
|
|
256
279
|
]
|
|
257
280
|
for _property in instance_properties:
|
|
@@ -298,6 +321,7 @@ class DocumentProcessing(object):
|
|
|
298
321
|
failed_at=get_datetime_from_data(input_datetime=data.get('failed_at')),
|
|
299
322
|
failed_reason=data.get('failed_reason'),
|
|
300
323
|
feedback=data.get('feedback'),
|
|
324
|
+
metadata=data.get('metadata', {}),
|
|
301
325
|
completed_at=get_datetime_from_data(input_datetime=data.get('completed_at')),
|
|
302
326
|
metadata_items=[
|
|
303
327
|
DocumentProcessingMetadata.from_dict(metadata)
|
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.61 → documente_shared-0.1.63}/documente_shared/application/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.61 → documente_shared-0.1.63}/documente_shared/application/exceptions.py
RENAMED
|
File without changes
|
{documente_shared-0.1.61 → documente_shared-0.1.63}/documente_shared/application/time_utils.py
RENAMED
|
File without changes
|
{documente_shared-0.1.61 → documente_shared-0.1.63}/documente_shared/application/timezone.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.61 → documente_shared-0.1.63}/documente_shared/domain/entities/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.61 → documente_shared-0.1.63}/documente_shared/infrastructure/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.61 → documente_shared-0.1.63}/documente_shared/infrastructure/dynamo_table.py
RENAMED
|
File without changes
|
{documente_shared-0.1.61 → documente_shared-0.1.63}/documente_shared/infrastructure/s3_bucket.py
RENAMED
|
File without changes
|
{documente_shared-0.1.61 → documente_shared-0.1.63}/documente_shared/infrastructure/sqs_queue.py
RENAMED
|
File without changes
|