documente_shared 0.1.62__py3-none-any.whl → 0.1.64__py3-none-any.whl
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/domain/entities/document.py +58 -29
- documente_shared/domain/entities/document_metadata.py +0 -1
- {documente_shared-0.1.62.dist-info → documente_shared-0.1.64.dist-info}/METADATA +1 -1
- {documente_shared-0.1.62.dist-info → documente_shared-0.1.64.dist-info}/RECORD +5 -5
- {documente_shared-0.1.62.dist-info → documente_shared-0.1.64.dist-info}/WHEEL +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import json
|
|
1
2
|
from dataclasses import dataclass
|
|
2
3
|
from datetime import datetime, tzinfo
|
|
3
4
|
from decimal import Decimal
|
|
@@ -94,6 +95,63 @@ class DocumentProcessing(object):
|
|
|
94
95
|
DocumentProcessingStatus.FAILED,
|
|
95
96
|
]
|
|
96
97
|
|
|
98
|
+
@property
|
|
99
|
+
def file_key(self) -> str:
|
|
100
|
+
return remove_slash_from_path(self.file_path)
|
|
101
|
+
|
|
102
|
+
@property
|
|
103
|
+
def processed_csv_key(self) -> str:
|
|
104
|
+
return remove_slash_from_path(self.processed_csv_path)
|
|
105
|
+
|
|
106
|
+
@property
|
|
107
|
+
def processed_xlsx_key(self) -> str:
|
|
108
|
+
return remove_slash_from_path(self.processed_xlsx_path)
|
|
109
|
+
|
|
110
|
+
@property
|
|
111
|
+
def processed_json_key(self) -> str:
|
|
112
|
+
return remove_slash_from_path(self.processed_json_path)
|
|
113
|
+
|
|
114
|
+
@property
|
|
115
|
+
def processed_metadata_key(self) -> str:
|
|
116
|
+
return remove_slash_from_path(self.processed_metadata_path)
|
|
117
|
+
|
|
118
|
+
@property
|
|
119
|
+
def extended_filename(self) -> str:
|
|
120
|
+
return self.file_path.split('/')[-1]
|
|
121
|
+
|
|
122
|
+
@property
|
|
123
|
+
def filename(self) -> str:
|
|
124
|
+
filename_with_extension = self.extended_filename
|
|
125
|
+
return filename_with_extension.split('.')[0]
|
|
126
|
+
|
|
127
|
+
@property
|
|
128
|
+
def processed_metadata_bytes(self) -> bytes:
|
|
129
|
+
metadata_items = [
|
|
130
|
+
metadata_item.to_dict
|
|
131
|
+
for metadata_item in self.metadata_items
|
|
132
|
+
]
|
|
133
|
+
return json.dumps(metadata_items).encode('utf-8')
|
|
134
|
+
|
|
135
|
+
@property
|
|
136
|
+
def has_original_file(self) -> bool:
|
|
137
|
+
return bool(self.file_path) and self.file_bytes
|
|
138
|
+
|
|
139
|
+
@property
|
|
140
|
+
def has_processed_csv(self) -> bool:
|
|
141
|
+
return bool(self.processed_csv_path) and self.processed_csv_bytes
|
|
142
|
+
|
|
143
|
+
@property
|
|
144
|
+
def has_processed_xlsx(self) -> bool:
|
|
145
|
+
return bool(self.processed_xlsx_path) and self.processed_xlsx_bytes
|
|
146
|
+
|
|
147
|
+
@property
|
|
148
|
+
def has_processed_json(self) -> bool:
|
|
149
|
+
return bool(self.processed_json_path) and self.processed_json_bytes
|
|
150
|
+
|
|
151
|
+
@property
|
|
152
|
+
def has_processed_metadata(self) -> bool:
|
|
153
|
+
return bool(self.processed_metadata_path) and self.metadata_items
|
|
154
|
+
|
|
97
155
|
def pending(self, timezone: tzinfo = la_paz_tz):
|
|
98
156
|
self.status = DocumentProcessingStatus.PENDING
|
|
99
157
|
self.started_at = None
|
|
@@ -130,35 +188,6 @@ class DocumentProcessing(object):
|
|
|
130
188
|
|
|
131
189
|
def in_review(self):
|
|
132
190
|
self.status = DocumentProcessingStatus.IN_REVIEW
|
|
133
|
-
|
|
134
|
-
@property
|
|
135
|
-
def file_key(self) -> str:
|
|
136
|
-
return remove_slash_from_path(self.file_path)
|
|
137
|
-
|
|
138
|
-
@property
|
|
139
|
-
def processed_csv_key(self) -> str:
|
|
140
|
-
return remove_slash_from_path(self.processed_csv_path)
|
|
141
|
-
|
|
142
|
-
@property
|
|
143
|
-
def processed_xlsx_key(self) -> str:
|
|
144
|
-
return remove_slash_from_path(self.processed_xlsx_path)
|
|
145
|
-
|
|
146
|
-
@property
|
|
147
|
-
def processed_json_key(self) -> str:
|
|
148
|
-
return remove_slash_from_path(self.processed_json_path)
|
|
149
|
-
|
|
150
|
-
@property
|
|
151
|
-
def processed_metadata_key(self) -> str:
|
|
152
|
-
return remove_slash_from_path(self.processed_metadata_path)
|
|
153
|
-
|
|
154
|
-
@property
|
|
155
|
-
def extended_filename(self) -> str:
|
|
156
|
-
return self.file_path.split('/')[-1]
|
|
157
|
-
|
|
158
|
-
@property
|
|
159
|
-
def filename(self) -> str:
|
|
160
|
-
filename_with_extension = self.extended_filename
|
|
161
|
-
return filename_with_extension.split('.')[0]
|
|
162
191
|
|
|
163
192
|
def __eq__(self, other: 'DocumentProcessing') -> bool:
|
|
164
193
|
if not other:
|
|
@@ -8,8 +8,8 @@ documente_shared/domain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
|
|
|
8
8
|
documente_shared/domain/base_enum.py,sha256=DojAfn-zQdtjtImeHUpBzE6TBTm07XrbMOdW3h8RVd8,1449
|
|
9
9
|
documente_shared/domain/constants.py,sha256=jOlMKFq12FgiYMJcQHku8IVwuOE5t-HEPuSV_zEeIFo,56
|
|
10
10
|
documente_shared/domain/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
|
-
documente_shared/domain/entities/document.py,sha256=
|
|
12
|
-
documente_shared/domain/entities/document_metadata.py,sha256=
|
|
11
|
+
documente_shared/domain/entities/document.py,sha256=hyz0uoQYKgA4-qN-IDCmnfzDc1YdR8vZJUF7fhJVuC0,12245
|
|
12
|
+
documente_shared/domain/entities/document_metadata.py,sha256=ygyFIC5qwxlm8DUM5kvVFny9zJfPQS8vNLM2br5XsQ8,2353
|
|
13
13
|
documente_shared/domain/enums.py,sha256=NltZA1YVgJ7dVfSQdJFIE0ZUGf9Y-nxNXsVQ6GiPLL4,1827
|
|
14
14
|
documente_shared/domain/repositories.py,sha256=g3qLUy2kT8esmvU4VxxSVnDaXeySKKQ7mUvIvxOwh9A,757
|
|
15
15
|
documente_shared/infrastructure/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -17,6 +17,6 @@ documente_shared/infrastructure/dynamo_repositories.py,sha256=SEad_HLppp2h_BKDSz
|
|
|
17
17
|
documente_shared/infrastructure/dynamo_table.py,sha256=dK05KgFvIYCmOdMpq9-OV_OBrP6cCngiUikCJrxlwt4,2112
|
|
18
18
|
documente_shared/infrastructure/s3_bucket.py,sha256=vT_yN42RFQXubtUn8ln-j13Os_-25UGClVtXg5Bkv6I,1932
|
|
19
19
|
documente_shared/infrastructure/sqs_queue.py,sha256=PSiTAnjXvQ-W-9mzLpH2UjbQJTvYkMiaxNaMecF-cR4,1505
|
|
20
|
-
documente_shared-0.1.
|
|
21
|
-
documente_shared-0.1.
|
|
22
|
-
documente_shared-0.1.
|
|
20
|
+
documente_shared-0.1.64.dist-info/METADATA,sha256=_hWcVqi2nqEPl7FswATh4nWO3zKCNuIEzqSatXffzPQ,800
|
|
21
|
+
documente_shared-0.1.64.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
22
|
+
documente_shared-0.1.64.dist-info/RECORD,,
|
|
File without changes
|