documente_shared 0.1.104__py3-none-any.whl → 0.1.106__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.

@@ -20,3 +20,8 @@ def remove_slash_from_path(file_path: str) -> str:
20
20
  if file_path and file_path.startswith('/'):
21
21
  return file_path[1:]
22
22
  return file_path
23
+
24
+ def remove_extension(filename: str) -> str:
25
+ if filename and '.' in filename:
26
+ return filename.rsplit('.', 1)[0]
27
+ return filename
@@ -0,0 +1,7 @@
1
+ from decimal import Decimal
2
+
3
+
4
+ def normalize_number(number: str | float | Decimal) -> str:
5
+ if not isinstance(number, Decimal):
6
+ number = Decimal(number)
7
+ return str(number.quantize(Decimal('0.001')))
@@ -4,7 +4,8 @@ from datetime import datetime, tzinfo
4
4
  from decimal import Decimal
5
5
  from typing import Optional, List
6
6
 
7
- from documente_shared.application.files import remove_slash_from_path, get_filename_from_path
7
+ from documente_shared.application.files import remove_slash_from_path, get_filename_from_path, remove_extension
8
+ from documente_shared.application.numbers import normalize_number
8
9
  from documente_shared.application.time_utils import get_datetime_from_data
9
10
  from documente_shared.domain.constants import la_paz_tz
10
11
  from documente_shared.domain.entities.document_metadata import DocumentProcessingMetadata
@@ -139,6 +140,10 @@ class DocumentProcessing(object):
139
140
  def extended_filename(self) -> str:
140
141
  return self.file_path.split('/')[-1]
141
142
 
143
+ @property
144
+ def raw_file_name(self) -> str:
145
+ return remove_extension(self.extended_filename)
146
+
142
147
  @property
143
148
  def filename(self) -> str:
144
149
  filename_with_extension = self.extended_filename
@@ -248,11 +253,11 @@ class DocumentProcessing(object):
248
253
  'processed_json_path': self.processed_json_path,
249
254
  'processed_metadata_path': self.processed_metadata_path,
250
255
  'processing_time': (
251
- str(self.processing_time.quantize(Decimal('0.00001')))
256
+ normalize_number(self.processing_time)
252
257
  if self.processing_time else None
253
258
  ),
254
259
  'processing_accuracy': (
255
- str(self.processing_accuracy.quantize(Decimal('0.00001')))
260
+ normalize_number(self.processing_accuracy)
256
261
  if self.processing_accuracy else None
257
262
  ),
258
263
  'issued_at': self.issued_at.isoformat() if self.issued_at else None,
@@ -2,7 +2,7 @@ import base64
2
2
  from typing import Optional
3
3
  from dataclasses import dataclass
4
4
 
5
- from documente_shared.application.files import get_filename_from_path
5
+ from documente_shared.application.files import get_filename_from_path, remove_extension
6
6
  from documente_shared.domain.exceptions import InMemoryDocumentContentError
7
7
 
8
8
 
@@ -33,6 +33,10 @@ class InMemoryDocument(object):
33
33
  def file_name(self) -> Optional[str]:
34
34
  return get_filename_from_path(self.file_path) if self.file_path else None
35
35
 
36
+ @property
37
+ def raw_file_name(self) -> str:
38
+ return remove_extension(self.file_name)
39
+
36
40
  @property
37
41
  def file_key(self) -> Optional[str]:
38
42
  return self.file_name
@@ -3,6 +3,7 @@ from datetime import datetime, tzinfo
3
3
  from decimal import Decimal
4
4
  from typing import Optional, List
5
5
 
6
+ from documente_shared.application.numbers import normalize_number
6
7
  from documente_shared.application.time_utils import get_datetime_from_data
7
8
  from documente_shared.domain.constants import la_paz_tz
8
9
  from documente_shared.domain.entities.in_memory_document import InMemoryDocument
@@ -143,11 +144,11 @@ class ProcessingCaseItem(object):
143
144
  if self.processed_json else None
144
145
  ),
145
146
  'processing_time': (
146
- str(self.processing_time.quantize(Decimal('0.001')))
147
+ normalize_number(self.processing_time)
147
148
  if self.processing_time else None
148
149
  ),
149
150
  'processing_confidence': (
150
- str(self.processing_confidence.quantize(Decimal('0.001')))
151
+ normalize_number(self.processing_confidence)
151
152
  if self.processing_confidence else None
152
153
  ),
153
154
  'uploaded_at': (
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: documente_shared
3
- Version: 0.1.104
3
+ Version: 0.1.106
4
4
  Summary: Shared utilities for Documente AI projects
5
5
  License: MIT
6
6
  Author: Tech
@@ -3,8 +3,9 @@ documente_shared/application/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NM
3
3
  documente_shared/application/dates.py,sha256=uExNddWmX9VEX_u420JGoC7fL-ieJ4956I0aw_WX3sQ,109
4
4
  documente_shared/application/digest.py,sha256=Um6E8WfFri2_lly4RFWydJyvSfPZGFcOX-opEOzDCWc,172
5
5
  documente_shared/application/exceptions.py,sha256=lQM8m7wmI9OTLGva0gd7s7YT7ldaTk_Ln4t32PpzNf8,654
6
- documente_shared/application/files.py,sha256=ADiWi6Mk3YQGx3boGsDqdb5wk8qmabkGRy7bhNFa1OY,649
6
+ documente_shared/application/files.py,sha256=_qkpeFPVmHyNhD6_PFZdzhyYvshJVeeSiwuTggK-A9Q,793
7
7
  documente_shared/application/json.py,sha256=5y67-DoiJlq_fLefgJ8YBVsdyua4KykxbSUKQqcwnnQ,1223
8
+ documente_shared/application/numbers.py,sha256=rik1SqMxLzXNL2S5Yh1Q8CSONdcjjoCBnByFasxR4_Q,212
8
9
  documente_shared/application/payloads.py,sha256=s6SjaNN18_aQ6IL083Zq2J8thRCZ_zC2sn7hkfjK_Go,453
9
10
  documente_shared/application/query_params.py,sha256=JscPqFBx28p-x9i2g6waY7Yl4FQM1zn2zSbEoTrkK1k,3938
10
11
  documente_shared/application/time_utils.py,sha256=_fxgh8VoGPkdsft47COJ16vFwt8pMbHIJCgDFHLSlrU,435
@@ -13,12 +14,12 @@ documente_shared/domain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
13
14
  documente_shared/domain/base_enum.py,sha256=DojAfn-zQdtjtImeHUpBzE6TBTm07XrbMOdW3h8RVd8,1449
14
15
  documente_shared/domain/constants.py,sha256=NG5BGaXBr_FnzudjTRPxpDpyiSDdaB_PLCdlYlFUQeU,187
15
16
  documente_shared/domain/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
- documente_shared/domain/entities/document.py,sha256=2OHn9mNjzqKSpw9fY6xCHIMRw3D4nZmmUTZZj_K4ISc,12885
17
+ documente_shared/domain/entities/document.py,sha256=9X6XCE-zTm0q8ASBn-5TAvNwK4iO_70KHkcgyMSO9JI,13044
17
18
  documente_shared/domain/entities/document_metadata.py,sha256=ygyFIC5qwxlm8DUM5kvVFny9zJfPQS8vNLM2br5XsQ8,2353
18
- documente_shared/domain/entities/in_memory_document.py,sha256=5MFG5V4EtNr-wwrLEFZusZPWvla52g5wuI6es5nQ4tM,1999
19
+ documente_shared/domain/entities/in_memory_document.py,sha256=BswTG1LjrQ8nP3pb0T2bSODPjJ2ud4ifbnYxRdFlIhY,2116
19
20
  documente_shared/domain/entities/processing_case.py,sha256=NwGGGMyXnNprtO1lCP6rkPbhGhZ6C_z30OeHi_LHXDY,5706
20
21
  documente_shared/domain/entities/processing_case_filters.py,sha256=harKyu7QEuL1bI_Z8_UxkVCMo5r9vHeNHyi_Ja07vjs,1953
21
- documente_shared/domain/entities/processing_case_item.py,sha256=VbVOqAUHtcCHfAF5VpG47IWkM8t6eSX4VuDifJe7ZzA,10108
22
+ documente_shared/domain/entities/processing_case_item.py,sha256=xmeN99qiGfVptIAs6t2DOksAJhkfnhzOaP9p5yiPR1s,10146
22
23
  documente_shared/domain/entities/processing_case_item_filters.py,sha256=R_AvDCB496Lww1qn2OwtltqULKE3IpcJB0ejnmRkg7Q,2009
23
24
  documente_shared/domain/entities/processing_documents.py,sha256=YYuTkdCNkqlO8cA0onJsZYtstxGt9M5NMuIO_87lB14,352
24
25
  documente_shared/domain/entities/processing_event.py,sha256=izdBXEz0TMNjxxZVjcM3YclzOv250JOV-amSpqmtQ9c,2180
@@ -54,6 +55,6 @@ documente_shared/infrastructure/services/http_scaling.py,sha256=cIo-61nfIwbtO86E
54
55
  documente_shared/infrastructure/sqs_queue.py,sha256=KZWeHZ9zmXmrxoNpOQX7GEdDhZ1knbPXgwSwFwJblGg,1504
55
56
  documente_shared/presentation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
56
57
  documente_shared/presentation/presenters.py,sha256=GGAEwefmjCIVepsUA2oZOVLxXbhhiISPM0Jgt6dT6O0,423
57
- documente_shared-0.1.104.dist-info/METADATA,sha256=GNOOWWV0lMU1B_D6PfrbouFMmtFwh0zXHOEc707xSeU,963
58
- documente_shared-0.1.104.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
59
- documente_shared-0.1.104.dist-info/RECORD,,
58
+ documente_shared-0.1.106.dist-info/METADATA,sha256=vsNpb4RO1NoOOjJT1ZGOGaNTkqc-Mfi6NqZs1jUX8ds,963
59
+ documente_shared-0.1.106.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
60
+ documente_shared-0.1.106.dist-info/RECORD,,