documente_shared 0.1.86__tar.gz → 0.1.87__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.86 → documente_shared-0.1.87}/PKG-INFO +2 -1
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/entities/processing_case_filters.py +1 -0
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/entities/processing_case_item_filters.py +1 -0
- documente_shared-0.1.87/documente_shared/domain/entities/scaling.py +25 -0
- documente_shared-0.1.87/documente_shared/domain/interfaces/scaling.py +10 -0
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/repositories/processing_case.py +1 -1
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/repositories/processing_case_item.py +0 -1
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/infrastructure/repositories/dynamo_processing_case.py +1 -1
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/infrastructure/repositories/dynamo_processing_case_item.py +1 -2
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/infrastructure/repositories/http_processing_case.py +3 -2
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/infrastructure/repositories/http_processing_case_item.py +12 -0
- documente_shared-0.1.87/documente_shared/infrastructure/services/__init__.py +0 -0
- documente_shared-0.1.87/documente_shared/infrastructure/services/http_scaling.py +24 -0
- documente_shared-0.1.87/documente_shared/presentation/__init__.py +0 -0
- {documente_shared-0.1.86 → documente_shared-0.1.87}/pyproject.toml +2 -1
- {documente_shared-0.1.86 → documente_shared-0.1.87}/README.md +0 -0
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/__init__.py +0 -0
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/application/__init__.py +0 -0
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/application/dates.py +0 -0
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/application/digest.py +0 -0
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/application/exceptions.py +0 -0
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/application/files.py +0 -0
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/application/payloads.py +0 -0
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/application/query_params.py +0 -0
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/application/time_utils.py +0 -0
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/application/timezone.py +0 -0
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/__init__.py +0 -0
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/base_enum.py +0 -0
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/constants.py +0 -0
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/entities/__init__.py +0 -0
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/entities/document.py +0 -0
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/entities/document_metadata.py +0 -0
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/entities/in_memory_result.py +0 -0
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/entities/processing_case.py +0 -0
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/entities/processing_case_item.py +0 -0
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/entities/processing_event.py +0 -0
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/enums/__init__.py +0 -0
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/enums/common.py +0 -0
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/enums/document.py +0 -0
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/enums/processing_case.py +0 -0
- {documente_shared-0.1.86/documente_shared/domain/repositories → documente_shared-0.1.87/documente_shared/domain/interfaces}/__init__.py +0 -0
- {documente_shared-0.1.86/documente_shared/infrastructure → documente_shared-0.1.87/documente_shared/domain/repositories}/__init__.py +0 -0
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/repositories/document.py +0 -0
- {documente_shared-0.1.86/documente_shared/infrastructure/repositories → documente_shared-0.1.87/documente_shared/infrastructure}/__init__.py +0 -0
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/infrastructure/documente_client.py +0 -0
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/infrastructure/dynamo_table.py +0 -0
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/infrastructure/lambdas.py +0 -0
- {documente_shared-0.1.86/documente_shared/presentation → documente_shared-0.1.87/documente_shared/infrastructure/repositories}/__init__.py +0 -0
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/infrastructure/repositories/dynamo_document.py +0 -0
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/infrastructure/repositories/http_document_processing.py +0 -0
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/infrastructure/s3_bucket.py +0 -0
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/infrastructure/sqs_queue.py +0 -0
- {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/presentation/presenters.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: documente_shared
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.87
|
|
4
4
|
Summary: Shared utilities for Documente AI projects
|
|
5
5
|
License: MIT
|
|
6
6
|
Author: Tech
|
|
@@ -13,6 +13,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.12
|
|
14
14
|
Requires-Dist: boto3 (>=1.37.19,<2.0.0)
|
|
15
15
|
Requires-Dist: botocore (>=1.37.19,<2.0.0)
|
|
16
|
+
Requires-Dist: loguru (>=0.7.3,<0.8.0)
|
|
16
17
|
Requires-Dist: pytz (>=2025.2,<2026.0)
|
|
17
18
|
Requires-Dist: requests (>=2.32.3,<3.0.0)
|
|
18
19
|
Requires-Dist: sentry-sdk (>=2.19.2,<3.0.0)
|
|
@@ -17,6 +17,7 @@ class ProcessingCaseFilters(object):
|
|
|
17
17
|
statuses: List[ProcessingStatus] = None
|
|
18
18
|
case_types: List[ProcessingCaseType] = None
|
|
19
19
|
include_archived: bool = False
|
|
20
|
+
tenant_slug: Optional[str] = None
|
|
20
21
|
|
|
21
22
|
def __post_init__(self):
|
|
22
23
|
self.case_ids = self.case_ids or []
|
|
@@ -20,6 +20,7 @@ class ProcessingCaseItemFilters(object):
|
|
|
20
20
|
statuses: List[ProcessingStatus] = None
|
|
21
21
|
document_types: List[ProcessingDocumentType] = None
|
|
22
22
|
include_archived: bool = False
|
|
23
|
+
tenant_slug: Optional[str] = None
|
|
23
24
|
|
|
24
25
|
def __post_init__(self):
|
|
25
26
|
self.statuses = self.statuses or []
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from typing import Optional
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@dataclass
|
|
6
|
+
class ScalingRequirements(object):
|
|
7
|
+
documents: Optional[int] = 0
|
|
8
|
+
processing_cases: Optional[int] = 0
|
|
9
|
+
processing_case_items: Optional[int] = 0
|
|
10
|
+
|
|
11
|
+
@property
|
|
12
|
+
def to_dict(self):
|
|
13
|
+
return {
|
|
14
|
+
"documents": self.documents,
|
|
15
|
+
"processing_cases": self.processing_cases,
|
|
16
|
+
"processing_case_items": self.processing_case_items,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@classmethod
|
|
20
|
+
def from_dict(cls, data: dict) -> "ScalingRequirements":
|
|
21
|
+
return cls(
|
|
22
|
+
documents=data.get("documents", 0),
|
|
23
|
+
processing_cases=data.get("processing_cases", 0),
|
|
24
|
+
processing_case_items=data.get("processing_case_items", 0),
|
|
25
|
+
)
|
|
@@ -20,5 +20,5 @@ class ProcessingCaseRepository(ABC):
|
|
|
20
20
|
raise NotImplementedError
|
|
21
21
|
|
|
22
22
|
@abstractmethod
|
|
23
|
-
def filter(self,
|
|
23
|
+
def filter(self, filters: ProcessingCaseFilters) -> List[ProcessingCase]:
|
|
24
24
|
raise NotImplementedError
|
|
@@ -26,7 +26,7 @@ class DynamoProcessingCaseRepository(
|
|
|
26
26
|
def remove(self, instance: ProcessingCase):
|
|
27
27
|
self.delete(key={'uuid': instance.uuid})
|
|
28
28
|
|
|
29
|
-
def filter(self,
|
|
29
|
+
def filter(self, filters: ProcessingCaseFilters) -> List[ProcessingCase]:
|
|
30
30
|
items = []
|
|
31
31
|
|
|
32
32
|
for status in filters.statuses:
|
|
@@ -34,7 +34,6 @@ class DynamoProcessingCaseItemRepository(
|
|
|
34
34
|
|
|
35
35
|
def filter(
|
|
36
36
|
self,
|
|
37
|
-
tenant_slug: str,
|
|
38
37
|
filters: ProcessingCaseItemFilters,
|
|
39
38
|
) -> List[ProcessingCaseItem]:
|
|
40
39
|
items = []
|
|
@@ -50,4 +49,4 @@ class DynamoProcessingCaseItemRepository(
|
|
|
50
49
|
return [
|
|
51
50
|
ProcessingCaseItem.from_dict(item)
|
|
52
51
|
for item in items
|
|
53
|
-
]
|
|
52
|
+
]
|
|
@@ -34,11 +34,11 @@ class HttpProcessingCaseRepository(
|
|
|
34
34
|
def remove(self, instance: ProcessingCase):
|
|
35
35
|
self.session.delete(f"{self.api_url}/v1/processing-cases/{instance.uuid}/")
|
|
36
36
|
|
|
37
|
-
def filter(self,
|
|
37
|
+
def filter(self, filters: ProcessingCaseFilters) -> List[ProcessingCase]:
|
|
38
38
|
response = self.session.get(
|
|
39
39
|
url=f"{self.api_url}/v1/processing-cases/",
|
|
40
40
|
headers={
|
|
41
|
-
"X-Tenant": tenant_slug,
|
|
41
|
+
"X-Tenant": filters.tenant_slug,
|
|
42
42
|
}
|
|
43
43
|
)
|
|
44
44
|
if response.status_code == 200:
|
|
@@ -49,6 +49,7 @@ class HttpProcessingCaseRepository(
|
|
|
49
49
|
]
|
|
50
50
|
return []
|
|
51
51
|
|
|
52
|
+
|
|
52
53
|
@classmethod
|
|
53
54
|
def _build_processing_case(cls, response: Response) -> ProcessingCase:
|
|
54
55
|
response_json = response.json()
|
|
@@ -40,6 +40,18 @@ class HttpProcessingCaseItemRepository(
|
|
|
40
40
|
self.session.delete(f"{self.api_url}/v1/processing-case-items/{instance.uuid}/")
|
|
41
41
|
|
|
42
42
|
def filter(
|
|
43
|
+
self,
|
|
44
|
+
filters: ProcessingCaseItemFilters,
|
|
45
|
+
) -> List[ProcessingCaseItem]:
|
|
46
|
+
response = self.session.get(f"{self.api_url}/v1/processing-case-items/")
|
|
47
|
+
if response.status_code == 200:
|
|
48
|
+
raw_response = response.json()
|
|
49
|
+
return [
|
|
50
|
+
ProcessingCaseItem.from_dict(camel_to_snake(item_data))
|
|
51
|
+
for item_data in raw_response.get('data', [])
|
|
52
|
+
]
|
|
53
|
+
return []
|
|
54
|
+
def filter_with_tenant(
|
|
43
55
|
self,
|
|
44
56
|
tenant_slug: str,
|
|
45
57
|
filters: ProcessingCaseItemFilters,
|
|
File without changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
from loguru import logger
|
|
4
|
+
|
|
5
|
+
from documente_shared.application.payloads import camel_to_snake
|
|
6
|
+
from documente_shared.domain.entities.scaling import ScalingRequirements
|
|
7
|
+
from documente_shared.domain.interfaces.scaling import ScalingService
|
|
8
|
+
from documente_shared.infrastructure.documente_client import DocumenteClientMixin
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass
|
|
12
|
+
class HttpScalingService(
|
|
13
|
+
DocumenteClientMixin,
|
|
14
|
+
ScalingService,
|
|
15
|
+
):
|
|
16
|
+
def get_scaling_requirements(self) -> ScalingRequirements:
|
|
17
|
+
response = self.session.get(f"{self.api_url}/v1/scaling-requirements/")
|
|
18
|
+
if response.status_code == 200:
|
|
19
|
+
return ScalingRequirements.from_dict(
|
|
20
|
+
data=camel_to_snake(response.json())
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
logger.warning(f'Error getting scaling requirements: {response.text}')
|
|
24
|
+
return ScalingRequirements()
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "documente_shared"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.87"
|
|
4
4
|
description = "Shared utilities for Documente AI projects"
|
|
5
5
|
authors = ["Tech <tech@llamitai.com>"]
|
|
6
6
|
license = "MIT"
|
|
@@ -13,6 +13,7 @@ botocore = "^1.37.19"
|
|
|
13
13
|
sentry-sdk = "^2.19.2"
|
|
14
14
|
pytz = "^2025.2"
|
|
15
15
|
requests = "^2.32.3"
|
|
16
|
+
loguru = "^0.7.3"
|
|
16
17
|
|
|
17
18
|
[tool.poetry.dev-dependencies]
|
|
18
19
|
pytest = "^8.3.4"
|
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/application/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/application/exceptions.py
RENAMED
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/application/payloads.py
RENAMED
|
File without changes
|
{documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/application/query_params.py
RENAMED
|
File without changes
|
{documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/application/time_utils.py
RENAMED
|
File without changes
|
{documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/application/timezone.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/entities/__init__.py
RENAMED
|
File without changes
|
{documente_shared-0.1.86 → documente_shared-0.1.87}/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
|
{documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/enums/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/enums/document.py
RENAMED
|
File without changes
|
{documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/enums/processing_case.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/repositories/document.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/infrastructure/dynamo_table.py
RENAMED
|
File without changes
|
{documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/infrastructure/lambdas.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/infrastructure/s3_bucket.py
RENAMED
|
File without changes
|
{documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/infrastructure/sqs_queue.py
RENAMED
|
File without changes
|
{documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/presentation/presenters.py
RENAMED
|
File without changes
|