documente_shared 0.1.83__tar.gz → 0.1.85__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.83 → documente_shared-0.1.85}/PKG-INFO +1 -1
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/domain/enums/common.py +17 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/domain/enums/document.py +53 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/infrastructure/documente_client.py +2 -1
- documente_shared-0.1.85/documente_shared/infrastructure/repositories/http_document_processing.py +51 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/pyproject.toml +1 -1
- {documente_shared-0.1.83 → documente_shared-0.1.85}/README.md +0 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/__init__.py +0 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/application/__init__.py +0 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/application/digest.py +0 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/application/exceptions.py +0 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/application/files.py +0 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/application/payloads.py +0 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/application/query_params.py +0 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/application/time_utils.py +0 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/application/timezone.py +0 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/domain/__init__.py +0 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/domain/base_enum.py +0 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/domain/constants.py +0 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/domain/entities/__init__.py +0 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/domain/entities/document.py +0 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/domain/entities/document_metadata.py +0 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/domain/entities/in_memory_result.py +0 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/domain/entities/processing_case.py +0 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/domain/entities/processing_case_filters.py +0 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/domain/entities/processing_case_item.py +0 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/domain/entities/processing_case_item_filters.py +0 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/domain/entities/processing_event.py +0 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/domain/enums/__init__.py +0 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/domain/enums/processing_case.py +0 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/domain/repositories/__init__.py +0 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/domain/repositories/document.py +0 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/domain/repositories/processing_case.py +0 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/domain/repositories/processing_case_item.py +0 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/infrastructure/__init__.py +0 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/infrastructure/dynamo_table.py +0 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/infrastructure/repositories/__init__.py +0 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/infrastructure/repositories/dynamo_document.py +0 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/infrastructure/repositories/dynamo_processing_case.py +0 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/infrastructure/repositories/dynamo_processing_case_item.py +0 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/infrastructure/repositories/http_processing_case.py +0 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/infrastructure/repositories/http_processing_case_item.py +0 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/infrastructure/s3_bucket.py +0 -0
- {documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/infrastructure/sqs_queue.py +0 -0
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from typing import List
|
|
2
|
+
|
|
1
3
|
from documente_shared.domain.base_enum import BaseEnum
|
|
2
4
|
|
|
3
5
|
|
|
@@ -45,6 +47,21 @@ class ProcessingStatus(BaseEnum):
|
|
|
45
47
|
CANCELLED = 'CANCELLED'
|
|
46
48
|
IN_REVIEW = 'IN_REVIEW'
|
|
47
49
|
|
|
50
|
+
@property
|
|
51
|
+
def procesable_statuses(self) -> List['ProcessingStatus']:
|
|
52
|
+
return [
|
|
53
|
+
ProcessingStatus.PENDING,
|
|
54
|
+
ProcessingStatus.ENQUEUED,
|
|
55
|
+
ProcessingStatus.PROCESSING,
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
@property
|
|
59
|
+
def final_statuses(self) -> List['ProcessingStatus']:
|
|
60
|
+
return [
|
|
61
|
+
ProcessingStatus.COMPLETED,
|
|
62
|
+
ProcessingStatus.FAILED,
|
|
63
|
+
]
|
|
64
|
+
|
|
48
65
|
@property
|
|
49
66
|
def is_pending(self):
|
|
50
67
|
return self == ProcessingStatus.PENDING
|
{documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/domain/enums/document.py
RENAMED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from typing import List
|
|
2
|
+
|
|
1
3
|
from documente_shared.domain.base_enum import BaseEnum
|
|
2
4
|
|
|
3
5
|
|
|
@@ -12,6 +14,57 @@ class DocumentProcessingStatus(BaseEnum):
|
|
|
12
14
|
CANCELLED = 'CANCELLED'
|
|
13
15
|
IN_REVIEW = 'IN_REVIEW'
|
|
14
16
|
|
|
17
|
+
@property
|
|
18
|
+
def procesable_statuses(self) -> List['DocumentProcessingStatus']:
|
|
19
|
+
return [
|
|
20
|
+
DocumentProcessingStatus.PENDING,
|
|
21
|
+
DocumentProcessingStatus.ENQUEUED,
|
|
22
|
+
DocumentProcessingStatus.PROCESSING,
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
@property
|
|
26
|
+
def final_statuses(self) -> List['DocumentProcessingStatus']:
|
|
27
|
+
return [
|
|
28
|
+
DocumentProcessingStatus.COMPLETED,
|
|
29
|
+
DocumentProcessingStatus.FAILED,
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
@property
|
|
33
|
+
def is_pending(self):
|
|
34
|
+
return self == DocumentProcessingStatus.PENDING
|
|
35
|
+
|
|
36
|
+
@property
|
|
37
|
+
def is_enqueued(self):
|
|
38
|
+
return self == DocumentProcessingStatus.ENQUEUED
|
|
39
|
+
|
|
40
|
+
@property
|
|
41
|
+
def is_processing(self):
|
|
42
|
+
return self == DocumentProcessingStatus.PROCESSING
|
|
43
|
+
|
|
44
|
+
@property
|
|
45
|
+
def is_completed(self):
|
|
46
|
+
return self == DocumentProcessingStatus.COMPLETED
|
|
47
|
+
|
|
48
|
+
@property
|
|
49
|
+
def is_incomplete(self):
|
|
50
|
+
return self == DocumentProcessingStatus.INCOMPLETE
|
|
51
|
+
|
|
52
|
+
@property
|
|
53
|
+
def is_failed(self):
|
|
54
|
+
return self == DocumentProcessingStatus.FAILED
|
|
55
|
+
|
|
56
|
+
@property
|
|
57
|
+
def is_deleted(self):
|
|
58
|
+
return self == DocumentProcessingStatus.DELETED
|
|
59
|
+
|
|
60
|
+
@property
|
|
61
|
+
def is_cancelled(self):
|
|
62
|
+
return self == DocumentProcessingStatus.CANCELLED
|
|
63
|
+
|
|
64
|
+
@property
|
|
65
|
+
def is_in_review(self):
|
|
66
|
+
return self == DocumentProcessingStatus.IN_REVIEW
|
|
67
|
+
|
|
15
68
|
|
|
16
69
|
class DocumentProcessingCategory(BaseEnum):
|
|
17
70
|
CIRCULAR = 'CIRCULAR'
|
documente_shared-0.1.85/documente_shared/infrastructure/repositories/http_document_processing.py
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from typing import List, Optional
|
|
3
|
+
from requests import Response
|
|
4
|
+
|
|
5
|
+
from documente_shared.application.payloads import camel_to_snake
|
|
6
|
+
from documente_shared.domain.entities.document import DocumentProcessing
|
|
7
|
+
from documente_shared.domain.enums.document import DocumentProcessingStatus, DocumentProcessingCategory
|
|
8
|
+
from documente_shared.domain.repositories.document import DocumentProcessingRepository
|
|
9
|
+
from documente_shared.infrastructure.documente_client import DocumenteClientMixin
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@dataclass
|
|
13
|
+
class HttpDocumentProcessingRepository(
|
|
14
|
+
DocumenteClientMixin,
|
|
15
|
+
DocumentProcessingRepository,
|
|
16
|
+
):
|
|
17
|
+
def find(self, digest: str) -> Optional[DocumentProcessing]:
|
|
18
|
+
response = self.session.get(f"{self.api_url}/documents/{digest}/")
|
|
19
|
+
if response.status_code == 200:
|
|
20
|
+
return self._build_processing_case(response)
|
|
21
|
+
return None
|
|
22
|
+
|
|
23
|
+
def persist(self, instance: DocumentProcessing) -> DocumentProcessing:
|
|
24
|
+
response = self.session.put(
|
|
25
|
+
url=f"{self.api_url}/documents/{instance.digest}/",
|
|
26
|
+
json=instance.to_simple_dict,
|
|
27
|
+
)
|
|
28
|
+
if response.status_code in [200, 201]:
|
|
29
|
+
raise Exception(f'Error persisting document processing: {response.text}')
|
|
30
|
+
return self._build_processing_case(response)
|
|
31
|
+
|
|
32
|
+
def remove(self, instance: DocumentProcessing):
|
|
33
|
+
self.session.delete(f"{self.api_url}/documents/{instance.digest}/")
|
|
34
|
+
|
|
35
|
+
def filter(self, statuses: List[DocumentProcessingStatus]) -> List[DocumentProcessing]:
|
|
36
|
+
response = self.session.get(f"{self.api_url}/documents/?statuses={statuses}")
|
|
37
|
+
if response.status_code == 200:
|
|
38
|
+
raw_response = response.json()
|
|
39
|
+
return [
|
|
40
|
+
DocumentProcessing.from_dict(camel_to_snake(item['documentProcessing']))
|
|
41
|
+
for item in raw_response.get('data', [])
|
|
42
|
+
]
|
|
43
|
+
return []
|
|
44
|
+
|
|
45
|
+
@classmethod
|
|
46
|
+
def _build_processing_case(cls, response: Response) -> DocumentProcessing:
|
|
47
|
+
response_json = response.json()
|
|
48
|
+
instance_data = response_json.get('data', {})
|
|
49
|
+
return DocumentProcessing.from_dict(camel_to_snake(instance_data))
|
|
50
|
+
|
|
51
|
+
|
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/application/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/application/exceptions.py
RENAMED
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/application/payloads.py
RENAMED
|
File without changes
|
{documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/application/query_params.py
RENAMED
|
File without changes
|
{documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/application/time_utils.py
RENAMED
|
File without changes
|
{documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/application/timezone.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/domain/entities/__init__.py
RENAMED
|
File without changes
|
{documente_shared-0.1.83 → documente_shared-0.1.85}/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
|
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/domain/enums/__init__.py
RENAMED
|
File without changes
|
{documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/domain/enums/processing_case.py
RENAMED
|
File without changes
|
{documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/domain/repositories/__init__.py
RENAMED
|
File without changes
|
{documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/domain/repositories/document.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/infrastructure/__init__.py
RENAMED
|
File without changes
|
{documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/infrastructure/dynamo_table.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/infrastructure/s3_bucket.py
RENAMED
|
File without changes
|
{documente_shared-0.1.83 → documente_shared-0.1.85}/documente_shared/infrastructure/sqs_queue.py
RENAMED
|
File without changes
|