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.

Files changed (53) hide show
  1. {documente_shared-0.1.86 → documente_shared-0.1.87}/PKG-INFO +2 -1
  2. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/entities/processing_case_filters.py +1 -0
  3. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/entities/processing_case_item_filters.py +1 -0
  4. documente_shared-0.1.87/documente_shared/domain/entities/scaling.py +25 -0
  5. documente_shared-0.1.87/documente_shared/domain/interfaces/scaling.py +10 -0
  6. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/repositories/processing_case.py +1 -1
  7. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/repositories/processing_case_item.py +0 -1
  8. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/infrastructure/repositories/dynamo_processing_case.py +1 -1
  9. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/infrastructure/repositories/dynamo_processing_case_item.py +1 -2
  10. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/infrastructure/repositories/http_processing_case.py +3 -2
  11. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/infrastructure/repositories/http_processing_case_item.py +12 -0
  12. documente_shared-0.1.87/documente_shared/infrastructure/services/__init__.py +0 -0
  13. documente_shared-0.1.87/documente_shared/infrastructure/services/http_scaling.py +24 -0
  14. documente_shared-0.1.87/documente_shared/presentation/__init__.py +0 -0
  15. {documente_shared-0.1.86 → documente_shared-0.1.87}/pyproject.toml +2 -1
  16. {documente_shared-0.1.86 → documente_shared-0.1.87}/README.md +0 -0
  17. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/__init__.py +0 -0
  18. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/application/__init__.py +0 -0
  19. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/application/dates.py +0 -0
  20. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/application/digest.py +0 -0
  21. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/application/exceptions.py +0 -0
  22. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/application/files.py +0 -0
  23. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/application/payloads.py +0 -0
  24. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/application/query_params.py +0 -0
  25. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/application/time_utils.py +0 -0
  26. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/application/timezone.py +0 -0
  27. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/__init__.py +0 -0
  28. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/base_enum.py +0 -0
  29. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/constants.py +0 -0
  30. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/entities/__init__.py +0 -0
  31. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/entities/document.py +0 -0
  32. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/entities/document_metadata.py +0 -0
  33. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/entities/in_memory_result.py +0 -0
  34. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/entities/processing_case.py +0 -0
  35. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/entities/processing_case_item.py +0 -0
  36. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/entities/processing_event.py +0 -0
  37. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/enums/__init__.py +0 -0
  38. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/enums/common.py +0 -0
  39. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/enums/document.py +0 -0
  40. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/enums/processing_case.py +0 -0
  41. {documente_shared-0.1.86/documente_shared/domain/repositories → documente_shared-0.1.87/documente_shared/domain/interfaces}/__init__.py +0 -0
  42. {documente_shared-0.1.86/documente_shared/infrastructure → documente_shared-0.1.87/documente_shared/domain/repositories}/__init__.py +0 -0
  43. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/domain/repositories/document.py +0 -0
  44. {documente_shared-0.1.86/documente_shared/infrastructure/repositories → documente_shared-0.1.87/documente_shared/infrastructure}/__init__.py +0 -0
  45. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/infrastructure/documente_client.py +0 -0
  46. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/infrastructure/dynamo_table.py +0 -0
  47. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/infrastructure/lambdas.py +0 -0
  48. {documente_shared-0.1.86/documente_shared/presentation → documente_shared-0.1.87/documente_shared/infrastructure/repositories}/__init__.py +0 -0
  49. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/infrastructure/repositories/dynamo_document.py +0 -0
  50. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/infrastructure/repositories/http_document_processing.py +0 -0
  51. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/infrastructure/s3_bucket.py +0 -0
  52. {documente_shared-0.1.86 → documente_shared-0.1.87}/documente_shared/infrastructure/sqs_queue.py +0 -0
  53. {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.86
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
+ )
@@ -0,0 +1,10 @@
1
+ from abc import ABC, abstractmethod
2
+
3
+ from documente_shared.domain.entities.scaling import ScalingRequirements
4
+
5
+
6
+ class ScalingService(ABC):
7
+
8
+ @abstractmethod
9
+ def get_scaling_requirements(self) -> ScalingRequirements:
10
+ raise NotImplementedError
@@ -20,5 +20,5 @@ class ProcessingCaseRepository(ABC):
20
20
  raise NotImplementedError
21
21
 
22
22
  @abstractmethod
23
- def filter(self, tenant_slug: str, filters: ProcessingCaseFilters) -> List[ProcessingCase]:
23
+ def filter(self, filters: ProcessingCaseFilters) -> List[ProcessingCase]:
24
24
  raise NotImplementedError
@@ -26,7 +26,6 @@ class ProcessingCaseItemRepository(ABC):
26
26
  @abstractmethod
27
27
  def filter(
28
28
  self,
29
- tenant_slug: str,
30
29
  filters: ProcessingCaseItemFilters,
31
30
  ) -> List[ProcessingCaseItem]:
32
31
  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, tenant_slug: str, filters: ProcessingCaseFilters) -> List[ProcessingCase]:
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, tenant_slug: str, filters: ProcessingCaseFilters) -> List[ProcessingCase]:
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,
@@ -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()
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "documente_shared"
3
- version = "0.1.86"
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"