documente_shared 0.1.121__py3-none-any.whl → 0.1.124__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/application/query_params.py +1 -1
- documente_shared/domain/entities/processing_case_item.py +1 -6
- documente_shared/domain/repositories/processing_case_item.py +1 -0
- documente_shared/infrastructure/repositories/dynamo_document.py +2 -2
- documente_shared/infrastructure/repositories/dynamo_processing_case_item.py +6 -1
- documente_shared/infrastructure/repositories/http_document.py +14 -3
- documente_shared/infrastructure/repositories/http_processing_case.py +8 -3
- documente_shared/infrastructure/repositories/http_processing_case_item.py +19 -7
- documente_shared/infrastructure/repositories/mem_processing_case_item.py +1 -0
- {documente_shared-0.1.121.dist-info → documente_shared-0.1.124.dist-info}/METADATA +1 -1
- {documente_shared-0.1.121.dist-info → documente_shared-0.1.124.dist-info}/RECORD +12 -12
- {documente_shared-0.1.121.dist-info → documente_shared-0.1.124.dist-info}/WHEEL +0 -0
|
@@ -233,12 +233,7 @@ class ProcessingCaseItem(object):
|
|
|
233
233
|
|
|
234
234
|
@property
|
|
235
235
|
def to_persist_dict(self) -> dict:
|
|
236
|
-
|
|
237
|
-
simple_dict["document_path"] = self.document.file_path if self.document else None
|
|
238
|
-
simple_dict["processed_csv_path"] = self.processed_csv.file_path if self.processed_csv else None
|
|
239
|
-
simple_dict["processed_xlsx_path"] = self.processed_xlsx.file_path if self.processed_xlsx else None
|
|
240
|
-
simple_dict["processed_json_path"] = self.processed_json.file_path if self.processed_json else None
|
|
241
|
-
return simple_dict
|
|
236
|
+
return self.to_dict
|
|
242
237
|
|
|
243
238
|
@classmethod
|
|
244
239
|
def from_dict(cls, data: dict) -> 'ProcessingCaseItem':
|
|
@@ -13,13 +13,13 @@ class DynamoDocumentProcessingRepository(
|
|
|
13
13
|
DynamoDBTable,
|
|
14
14
|
DocumentProcessingRepository,
|
|
15
15
|
):
|
|
16
|
-
def find(self, digest: str) -> Optional[DocumentProcessing]:
|
|
16
|
+
def find(self, digest: str, read_bytes: bool = False) -> Optional[DocumentProcessing]:
|
|
17
17
|
item = self.get(key={'digest': digest})
|
|
18
18
|
if item:
|
|
19
19
|
return DocumentProcessing.from_dict(item)
|
|
20
20
|
return None
|
|
21
21
|
|
|
22
|
-
def persist(self, instance: DocumentProcessing) -> DocumentProcessing:
|
|
22
|
+
def persist(self, instance: DocumentProcessing, read_bytes: bool = False) -> DocumentProcessing:
|
|
23
23
|
self.put(instance.to_simple_dict)
|
|
24
24
|
return instance
|
|
25
25
|
|
|
@@ -25,7 +25,12 @@ class DynamoProcessingCaseItemRepository(
|
|
|
25
25
|
return ProcessingCaseItem.from_dict(item)
|
|
26
26
|
return None
|
|
27
27
|
|
|
28
|
-
def persist(
|
|
28
|
+
def persist(
|
|
29
|
+
self,
|
|
30
|
+
instance: ProcessingCaseItem,
|
|
31
|
+
read_bytes: bool = False,
|
|
32
|
+
persist_bytes: bool = False,
|
|
33
|
+
) -> ProcessingCaseItem:
|
|
29
34
|
self.put(instance.to_simple_dict)
|
|
30
35
|
return instance
|
|
31
36
|
|
|
@@ -5,6 +5,7 @@ from loguru import logger
|
|
|
5
5
|
from requests import Response
|
|
6
6
|
|
|
7
7
|
from documente_shared.application.payloads import camel_to_snake
|
|
8
|
+
from documente_shared.application.query_params import parse_bool_to_str
|
|
8
9
|
from documente_shared.domain.entities.document import DocumentProcessing
|
|
9
10
|
from documente_shared.domain.enums.document import DocumentProcessingStatus
|
|
10
11
|
from documente_shared.domain.repositories.document import DocumentProcessingRepository
|
|
@@ -16,16 +17,26 @@ class HttpDocumentProcessingRepository(
|
|
|
16
17
|
DocumenteClientMixin,
|
|
17
18
|
DocumentProcessingRepository,
|
|
18
19
|
):
|
|
19
|
-
def find(self, digest: str) -> Optional[DocumentProcessing]:
|
|
20
|
-
|
|
20
|
+
def find(self, digest: str, read_bytes: bool = False) -> Optional[DocumentProcessing]:
|
|
21
|
+
params = {
|
|
22
|
+
"read_bytes": parse_bool_to_str(read_bytes),
|
|
23
|
+
}
|
|
24
|
+
response = self.session.get(
|
|
25
|
+
url=f"{self.api_url}/v1/documents/{digest}/",
|
|
26
|
+
params=params,
|
|
27
|
+
)
|
|
21
28
|
if response.status_code not in [200, 201]:
|
|
22
29
|
return None
|
|
23
30
|
return self._build_document_processing(response)
|
|
24
31
|
|
|
25
|
-
def persist(self, instance: DocumentProcessing) -> DocumentProcessing:
|
|
32
|
+
def persist(self, instance: DocumentProcessing, read_bytes: bool = False) -> DocumentProcessing:
|
|
26
33
|
logger.info(f"PERSISTING_DOCUMENT: data={instance.to_simple_dict}")
|
|
34
|
+
params = {
|
|
35
|
+
"read_bytes": parse_bool_to_str(read_bytes),
|
|
36
|
+
}
|
|
27
37
|
response = self.session.put(
|
|
28
38
|
url=f"{self.api_url}/v1/documents/{instance.digest}/",
|
|
39
|
+
params=params,
|
|
29
40
|
json=instance.to_simple_dict,
|
|
30
41
|
)
|
|
31
42
|
if response.status_code not in [200, 201]:
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
|
+
from sqlite3.dbapi2 import paramstyle
|
|
2
3
|
from typing import List, Optional
|
|
3
4
|
|
|
4
5
|
from loguru import logger
|
|
5
6
|
from requests import Response
|
|
6
7
|
|
|
7
8
|
from documente_shared.application.payloads import camel_to_snake
|
|
8
|
-
from documente_shared.application.query_params import
|
|
9
|
+
from documente_shared.application.query_params import parse_bool_to_str
|
|
9
10
|
from documente_shared.domain.entities.processing_case import ProcessingCase
|
|
10
11
|
from documente_shared.domain.entities.processing_case_filters import ProcessingCaseFilters
|
|
11
12
|
from documente_shared.domain.repositories.processing_case import ProcessingCaseRepository
|
|
@@ -33,9 +34,13 @@ class HttpProcessingCaseRepository(
|
|
|
33
34
|
instance: ProcessingCase,
|
|
34
35
|
persist_items: bool = False,
|
|
35
36
|
) -> ProcessingCase:
|
|
36
|
-
logger.info(f"PERSISTING_PROCESSING_CASE: data={instance.
|
|
37
|
+
logger.info(f"PERSISTING_PROCESSING_CASE: data={instance.to_queue_dict}")
|
|
38
|
+
params = {
|
|
39
|
+
"persist_items": parse_bool_to_str(persist_items),
|
|
40
|
+
}
|
|
37
41
|
response = self.session.put(
|
|
38
|
-
url=f"{self.api_url}/v1/processing-cases/{instance.uuid}
|
|
42
|
+
url=f"{self.api_url}/v1/processing-cases/{instance.uuid}/",
|
|
43
|
+
params=params,
|
|
39
44
|
json=instance.to_dict,
|
|
40
45
|
)
|
|
41
46
|
if response.status_code not in [200, 201]:
|
|
@@ -5,7 +5,7 @@ from loguru import logger
|
|
|
5
5
|
from requests import Response
|
|
6
6
|
|
|
7
7
|
from documente_shared.application.payloads import camel_to_snake
|
|
8
|
-
from documente_shared.application.query_params import
|
|
8
|
+
from documente_shared.application.query_params import parse_bool_to_str
|
|
9
9
|
from documente_shared.domain.entities.processing_case_item import ProcessingCaseItem
|
|
10
10
|
from documente_shared.domain.entities.processing_case_item_filters import ProcessingCaseItemFilters
|
|
11
11
|
from documente_shared.domain.repositories.processing_case_item import ProcessingCaseItemRepository
|
|
@@ -19,7 +19,7 @@ class HttpProcessingCaseItemRepository(
|
|
|
19
19
|
):
|
|
20
20
|
def find(self, uuid: str, read_bytes: bool = False) -> Optional[ProcessingCaseItem]:
|
|
21
21
|
response = self.session.get(
|
|
22
|
-
url=f"{self.api_url}/v1/processing-case-items/{uuid}/?read_bytes={
|
|
22
|
+
url=f"{self.api_url}/v1/processing-case-items/{uuid}/?read_bytes={parse_bool_to_str(read_bytes)}",
|
|
23
23
|
)
|
|
24
24
|
if response.status_code not in [200, 201]:
|
|
25
25
|
return None
|
|
@@ -27,17 +27,29 @@ class HttpProcessingCaseItemRepository(
|
|
|
27
27
|
|
|
28
28
|
def find_by_digest(self, digest: str, read_bytes: bool = False) -> Optional[ProcessingCaseItem]:
|
|
29
29
|
response = self.session.get(
|
|
30
|
-
url=f"{self.api_url}/v1/processing-case-items/{digest}/?read_bytes={
|
|
30
|
+
url=f"{self.api_url}/v1/processing-case-items/{digest}/?read_bytes={parse_bool_to_str(read_bytes)}",
|
|
31
31
|
)
|
|
32
32
|
if response.status_code not in [200, 201]:
|
|
33
33
|
return None
|
|
34
34
|
return self._build_processing_case_item(response)
|
|
35
35
|
|
|
36
|
-
def persist(
|
|
37
|
-
|
|
36
|
+
def persist(
|
|
37
|
+
self,
|
|
38
|
+
instance: ProcessingCaseItem,
|
|
39
|
+
read_bytes: bool = False,
|
|
40
|
+
persist_bytes: bool = False,
|
|
41
|
+
) -> ProcessingCaseItem:
|
|
42
|
+
logger.info(f"PERSISTING_PROCESSING_CASE_ITEM: data={instance.to_queue_dict}")
|
|
43
|
+
params = {
|
|
44
|
+
"read_bytes": parse_bool_to_str(read_bytes),
|
|
45
|
+
}
|
|
38
46
|
response: Response = self.session.put(
|
|
39
|
-
url=f"{self.api_url}/v1/processing-case-items/{instance.uuid}
|
|
40
|
-
|
|
47
|
+
url=f"{self.api_url}/v1/processing-case-items/{instance.uuid}/",
|
|
48
|
+
params=params,
|
|
49
|
+
json=(
|
|
50
|
+
instance.to_persist_dict
|
|
51
|
+
if persist_bytes else instance.to_queue_dict
|
|
52
|
+
),
|
|
41
53
|
)
|
|
42
54
|
if response.status_code not in [200, 201]:
|
|
43
55
|
logger.info(f"PERSISTING_PROCESSING_CASE_ITEM ERROR: data={response.text}")
|
|
@@ -38,6 +38,7 @@ class MemoryProcessingCaseItemRepository(ProcessingCaseItemRepository):
|
|
|
38
38
|
self,
|
|
39
39
|
instance: ProcessingCaseItem,
|
|
40
40
|
read_bytes: bool = False,
|
|
41
|
+
persist_bytes: bool = False,
|
|
41
42
|
) -> ProcessingCaseItem:
|
|
42
43
|
self.collection[instance.uuid] = instance
|
|
43
44
|
return instance
|
|
@@ -7,7 +7,7 @@ documente_shared/application/files.py,sha256=_qkpeFPVmHyNhD6_PFZdzhyYvshJVeeSiwu
|
|
|
7
7
|
documente_shared/application/json.py,sha256=5y67-DoiJlq_fLefgJ8YBVsdyua4KykxbSUKQqcwnnQ,1223
|
|
8
8
|
documente_shared/application/numbers.py,sha256=rik1SqMxLzXNL2S5Yh1Q8CSONdcjjoCBnByFasxR4_Q,212
|
|
9
9
|
documente_shared/application/payloads.py,sha256=s6SjaNN18_aQ6IL083Zq2J8thRCZ_zC2sn7hkfjK_Go,453
|
|
10
|
-
documente_shared/application/query_params.py,sha256=
|
|
10
|
+
documente_shared/application/query_params.py,sha256=dy-OcCzLt4ZDseMm5vB3uzYzFFjEiit8nKaTzODUGPg,4025
|
|
11
11
|
documente_shared/application/time_utils.py,sha256=_fxgh8VoGPkdsft47COJ16vFwt8pMbHIJCgDFHLSlrU,435
|
|
12
12
|
documente_shared/application/timezone.py,sha256=NHpzTzOPD_fWQiJ4BrRqt_TIDs5XyB5ZMR7x8vUk8gQ,183
|
|
13
13
|
documente_shared/domain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -19,7 +19,7 @@ documente_shared/domain/entities/document_metadata.py,sha256=ygyFIC5qwxlm8DUM5kv
|
|
|
19
19
|
documente_shared/domain/entities/in_memory_document.py,sha256=8JfVxbgqxkU3QvsuWzjpSp-end6JfffYDUSvMvrQsps,2284
|
|
20
20
|
documente_shared/domain/entities/processing_case.py,sha256=D57zP704mBtt563Pbmd41PFQSna4chVWsWTR_2ZAtTU,6602
|
|
21
21
|
documente_shared/domain/entities/processing_case_filters.py,sha256=harKyu7QEuL1bI_Z8_UxkVCMo5r9vHeNHyi_Ja07vjs,1953
|
|
22
|
-
documente_shared/domain/entities/processing_case_item.py,sha256=
|
|
22
|
+
documente_shared/domain/entities/processing_case_item.py,sha256=XyHCVCOoZawTw70_LyEiLBmWCTV4ScXBmKHjmZoEzuA,10469
|
|
23
23
|
documente_shared/domain/entities/processing_case_item_filters.py,sha256=R_AvDCB496Lww1qn2OwtltqULKE3IpcJB0ejnmRkg7Q,2009
|
|
24
24
|
documente_shared/domain/entities/processing_documents.py,sha256=YYuTkdCNkqlO8cA0onJsZYtstxGt9M5NMuIO_87lB14,352
|
|
25
25
|
documente_shared/domain/entities/processing_event.py,sha256=sejo9eM4A6fDDFq3qCX3V1GMGwQVUh_5oJaPDiUwpoc,2350
|
|
@@ -34,27 +34,27 @@ documente_shared/domain/interfaces/scaling.py,sha256=yWAud0rcLKMMf2-QxEE__GRpzqU
|
|
|
34
34
|
documente_shared/domain/repositories/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
35
35
|
documente_shared/domain/repositories/document.py,sha256=EZCbz8ManC1C2JcGuQQIJKON28AUAnUITZjy2zotRbY,819
|
|
36
36
|
documente_shared/domain/repositories/processing_case.py,sha256=ruML2bciJ-3RShl0e6Ca09OXGtslBsH89j96ctnRC6I,912
|
|
37
|
-
documente_shared/domain/repositories/processing_case_item.py,sha256=
|
|
37
|
+
documente_shared/domain/repositories/processing_case_item.py,sha256=HW-xeq-X5PxI6yyGyePQeO4HI_OKU8B1lqpcPbTgnrE,1156
|
|
38
38
|
documente_shared/infrastructure/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
39
39
|
documente_shared/infrastructure/documente_client.py,sha256=u6k73yIefuEkCsHULMpVCydFzrSXclf_5oQd2D7CkKU,698
|
|
40
40
|
documente_shared/infrastructure/dynamo_table.py,sha256=TMQbcuty7wjDMbuhI8PbT0IGXelgELsNTtqTEQeZ824,2112
|
|
41
41
|
documente_shared/infrastructure/lambdas.py,sha256=sGgkw7Mhvuq2TpbW_RNdf5JvQnuzxWYH6gPOVtQ4DtE,357
|
|
42
42
|
documente_shared/infrastructure/repositories/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
43
|
-
documente_shared/infrastructure/repositories/dynamo_document.py,sha256=
|
|
43
|
+
documente_shared/infrastructure/repositories/dynamo_document.py,sha256=CU3bljm83TwHO4YSUkFDUI0RPhV1yCllpNSL8_8dwBo,1495
|
|
44
44
|
documente_shared/infrastructure/repositories/dynamo_processing_case.py,sha256=n99X6OGTG5bHtIJY_1Z9HqabgWz-jbFXnQeqzeas7R8,1580
|
|
45
|
-
documente_shared/infrastructure/repositories/dynamo_processing_case_item.py,sha256=
|
|
46
|
-
documente_shared/infrastructure/repositories/http_document.py,sha256=
|
|
47
|
-
documente_shared/infrastructure/repositories/http_processing_case.py,sha256=
|
|
48
|
-
documente_shared/infrastructure/repositories/http_processing_case_item.py,sha256=
|
|
45
|
+
documente_shared/infrastructure/repositories/dynamo_processing_case_item.py,sha256=CqcVLuB2h6QZki5CuQ1ZsY76jgbB5UYkhb5NB77oJE8,1875
|
|
46
|
+
documente_shared/infrastructure/repositories/http_document.py,sha256=Qc5D5Q0fpHYLyxOMlBYMdnRhGM-lF7ZNqQxZyClsvsA,2666
|
|
47
|
+
documente_shared/infrastructure/repositories/http_processing_case.py,sha256=scdl3R-lzZIDOili433BKW0vvs92E-J1mXWb0eOYrG4,2725
|
|
48
|
+
documente_shared/infrastructure/repositories/http_processing_case_item.py,sha256=6R-oDj4AeCBoDjd7FRkclxxQUnCtRZttiNjAJUx490Y,3748
|
|
49
49
|
documente_shared/infrastructure/repositories/mem_document.py,sha256=jg4rIjgSZijymjY9o7Q1lLcaiW9h-O8j6XljO1bJI7c,1299
|
|
50
50
|
documente_shared/infrastructure/repositories/mem_processing_case.py,sha256=59ZHCU32fu7MMvLvhxFfG7sKmJQ1R0449WVoTtfzpqY,1250
|
|
51
|
-
documente_shared/infrastructure/repositories/mem_processing_case_item.py,sha256=
|
|
51
|
+
documente_shared/infrastructure/repositories/mem_processing_case_item.py,sha256=kGURB2dmnhpRWxzxLCdQmhzsMAboGEKLyI3_F9UV2AQ,1566
|
|
52
52
|
documente_shared/infrastructure/s3_bucket.py,sha256=vT_yN42RFQXubtUn8ln-j13Os_-25UGClVtXg5Bkv6I,1932
|
|
53
53
|
documente_shared/infrastructure/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
54
54
|
documente_shared/infrastructure/services/http_scaling.py,sha256=cIo-61nfIwbtO86EGi5r1tFi9g3VJXldhguddt4JUyc,906
|
|
55
55
|
documente_shared/infrastructure/sqs_queue.py,sha256=KZWeHZ9zmXmrxoNpOQX7GEdDhZ1knbPXgwSwFwJblGg,1504
|
|
56
56
|
documente_shared/presentation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
57
57
|
documente_shared/presentation/presenters.py,sha256=GGAEwefmjCIVepsUA2oZOVLxXbhhiISPM0Jgt6dT6O0,423
|
|
58
|
-
documente_shared-0.1.
|
|
59
|
-
documente_shared-0.1.
|
|
60
|
-
documente_shared-0.1.
|
|
58
|
+
documente_shared-0.1.124.dist-info/METADATA,sha256=pH_IH9LfyhubYPA6CNV-KEzgtTBJFHq6eaSctcgPfiI,963
|
|
59
|
+
documente_shared-0.1.124.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
60
|
+
documente_shared-0.1.124.dist-info/RECORD,,
|
|
File without changes
|