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

@@ -45,6 +45,7 @@ class DocumentProcessing(object):
45
45
  failed_reason: Optional[str] = None
46
46
  feedback: Optional[list | dict] = None
47
47
  completed_at: Optional[datetime] = None
48
+ metadata: Optional[dict] = None
48
49
  metadata_items: Optional[List[DocumentProcessingMetadata]] = None
49
50
 
50
51
  def __post_init__(self):
@@ -93,6 +94,55 @@ class DocumentProcessing(object):
93
94
  DocumentProcessingStatus.FAILED,
94
95
  ]
95
96
 
97
+ @property
98
+ def file_key(self) -> str:
99
+ return remove_slash_from_path(self.file_path)
100
+
101
+ @property
102
+ def processed_csv_key(self) -> str:
103
+ return remove_slash_from_path(self.processed_csv_path)
104
+
105
+ @property
106
+ def processed_xlsx_key(self) -> str:
107
+ return remove_slash_from_path(self.processed_xlsx_path)
108
+
109
+ @property
110
+ def processed_json_key(self) -> str:
111
+ return remove_slash_from_path(self.processed_json_path)
112
+
113
+ @property
114
+ def processed_metadata_key(self) -> str:
115
+ return remove_slash_from_path(self.processed_metadata_path)
116
+
117
+ @property
118
+ def extended_filename(self) -> str:
119
+ return self.file_path.split('/')[-1]
120
+
121
+ @property
122
+ def filename(self) -> str:
123
+ filename_with_extension = self.extended_filename
124
+ return filename_with_extension.split('.')[0]
125
+
126
+ @property
127
+ def has_original_file(self) -> bool:
128
+ return bool(self.file_path) and self.file_bytes
129
+
130
+ @property
131
+ def has_processed_csv(self) -> bool:
132
+ return bool(self.processed_csv_path) and self.processed_csv_bytes
133
+
134
+ @property
135
+ def has_processed_xlsx(self) -> bool:
136
+ return bool(self.processed_xlsx_path) and self.processed_xlsx_bytes
137
+
138
+ @property
139
+ def has_processed_json(self) -> bool:
140
+ return bool(self.processed_json_path) and self.processed_json_bytes
141
+
142
+ @property
143
+ def has_processed_metadata(self) -> bool:
144
+ return bool(self.processed_metadata_path) and self.metadata_items
145
+
96
146
  def pending(self, timezone: tzinfo = la_paz_tz):
97
147
  self.status = DocumentProcessingStatus.PENDING
98
148
  self.started_at = None
@@ -129,35 +179,6 @@ class DocumentProcessing(object):
129
179
 
130
180
  def in_review(self):
131
181
  self.status = DocumentProcessingStatus.IN_REVIEW
132
-
133
- @property
134
- def file_key(self) -> str:
135
- return remove_slash_from_path(self.file_path)
136
-
137
- @property
138
- def processed_csv_key(self) -> str:
139
- return remove_slash_from_path(self.processed_csv_path)
140
-
141
- @property
142
- def processed_xlsx_key(self) -> str:
143
- return remove_slash_from_path(self.processed_xlsx_path)
144
-
145
- @property
146
- def processed_json_key(self) -> str:
147
- return remove_slash_from_path(self.processed_json_path)
148
-
149
- @property
150
- def processed_metadata_key(self) -> str:
151
- return remove_slash_from_path(self.processed_metadata_path)
152
-
153
- @property
154
- def extended_filename(self) -> str:
155
- return self.file_path.split('/')[-1]
156
-
157
- @property
158
- def filename(self) -> str:
159
- filename_with_extension = self.extended_filename
160
- return filename_with_extension.split('.')[0]
161
182
 
162
183
  def __eq__(self, other: 'DocumentProcessing') -> bool:
163
184
  if not other:
@@ -212,6 +233,7 @@ class DocumentProcessing(object):
212
233
  'failed_at': self.failed_at.isoformat() if self.failed_at else None,
213
234
  'failed_reason': self.failed_reason,
214
235
  'feedback': self.feedback,
236
+ 'metadata': self.metadata,
215
237
  'completed_at': self.completed_at.isoformat() if self.completed_at else None,
216
238
  'metadata_items': [metadata.to_dict for metadata in self.metadata_items],
217
239
  }
@@ -252,6 +274,7 @@ class DocumentProcessing(object):
252
274
  'failed_at',
253
275
  'failed_reason',
254
276
  'feedback',
277
+ 'metadata',
255
278
  'completed_at',
256
279
  ]
257
280
  for _property in instance_properties:
@@ -298,6 +321,7 @@ class DocumentProcessing(object):
298
321
  failed_at=get_datetime_from_data(input_datetime=data.get('failed_at')),
299
322
  failed_reason=data.get('failed_reason'),
300
323
  feedback=data.get('feedback'),
324
+ metadata=data.get('metadata', {}),
301
325
  completed_at=get_datetime_from_data(input_datetime=data.get('completed_at')),
302
326
  metadata_items=[
303
327
  DocumentProcessingMetadata.from_dict(metadata)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: documente_shared
3
- Version: 0.1.61
3
+ Version: 0.1.63
4
4
  Summary: Shared utilities for Documente AI projects
5
5
  License: MIT
6
6
  Author: Tech
@@ -8,7 +8,7 @@ documente_shared/domain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
8
8
  documente_shared/domain/base_enum.py,sha256=DojAfn-zQdtjtImeHUpBzE6TBTm07XrbMOdW3h8RVd8,1449
9
9
  documente_shared/domain/constants.py,sha256=jOlMKFq12FgiYMJcQHku8IVwuOE5t-HEPuSV_zEeIFo,56
10
10
  documente_shared/domain/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
- documente_shared/domain/entities/document.py,sha256=L5d9MOeIMp4-7LZJcLuX0g6w7K23yIxPMmRE4-5eAQM,11202
11
+ documente_shared/domain/entities/document.py,sha256=2B-XbBumM750_zdlfBGDAETAu0IyvC1-K8qYym0D9Vw,11987
12
12
  documente_shared/domain/entities/document_metadata.py,sha256=Oa-c0xJODXaGtFkNxt9k86rSWGxY2LHVDOgu9tQxCGY,2354
13
13
  documente_shared/domain/enums.py,sha256=NltZA1YVgJ7dVfSQdJFIE0ZUGf9Y-nxNXsVQ6GiPLL4,1827
14
14
  documente_shared/domain/repositories.py,sha256=g3qLUy2kT8esmvU4VxxSVnDaXeySKKQ7mUvIvxOwh9A,757
@@ -17,6 +17,6 @@ documente_shared/infrastructure/dynamo_repositories.py,sha256=SEad_HLppp2h_BKDSz
17
17
  documente_shared/infrastructure/dynamo_table.py,sha256=dK05KgFvIYCmOdMpq9-OV_OBrP6cCngiUikCJrxlwt4,2112
18
18
  documente_shared/infrastructure/s3_bucket.py,sha256=vT_yN42RFQXubtUn8ln-j13Os_-25UGClVtXg5Bkv6I,1932
19
19
  documente_shared/infrastructure/sqs_queue.py,sha256=PSiTAnjXvQ-W-9mzLpH2UjbQJTvYkMiaxNaMecF-cR4,1505
20
- documente_shared-0.1.61.dist-info/METADATA,sha256=j4po1Cl3AH2rUx5A7naPzFTt3rWgDlXKlbQ0Dyw6GrA,800
21
- documente_shared-0.1.61.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
22
- documente_shared-0.1.61.dist-info/RECORD,,
20
+ documente_shared-0.1.63.dist-info/METADATA,sha256=DnJ41dmAYYLIoUaBF8buBnC5LbdMo2SLhQ6gkSh2IhA,800
21
+ documente_shared-0.1.63.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
22
+ documente_shared-0.1.63.dist-info/RECORD,,