rdetoolkit 1.5.2__cp313-cp313-win_amd64.whl → 1.5.3__cp313-cp313-win_amd64.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.
- rdetoolkit/__init__.py +1 -1
- rdetoolkit/core.cp313-win_amd64.pyd +0 -0
- rdetoolkit/invoicefile.py +11 -9
- rdetoolkit/processing/processors/invoice.py +41 -0
- {rdetoolkit-1.5.2.dist-info → rdetoolkit-1.5.3.dist-info}/METADATA +1 -1
- {rdetoolkit-1.5.2.dist-info → rdetoolkit-1.5.3.dist-info}/RECORD +9 -9
- {rdetoolkit-1.5.2.dist-info → rdetoolkit-1.5.3.dist-info}/WHEEL +0 -0
- {rdetoolkit-1.5.2.dist-info → rdetoolkit-1.5.3.dist-info}/entry_points.txt +0 -0
- {rdetoolkit-1.5.2.dist-info → rdetoolkit-1.5.3.dist-info}/licenses/LICENSE +0 -0
rdetoolkit/__init__.py
CHANGED
|
Binary file
|
rdetoolkit/invoicefile.py
CHANGED
|
@@ -160,16 +160,18 @@ def check_exist_rawfiles(dfexcelinvoice: pd.DataFrame, excel_rawfiles: list[Path
|
|
|
160
160
|
excel_rawfiles (list[Path]): A list of Path objects representing file paths.
|
|
161
161
|
|
|
162
162
|
Raises:
|
|
163
|
-
|
|
163
|
+
StructuredError: If any file name in dfexcelinvoice is not found in excel_rawfiles.
|
|
164
164
|
|
|
165
165
|
Returns:
|
|
166
166
|
list[Path]: A list of Path objects corresponding to the file names in dfexcelinvoice, ordered as they appear in the DataFrame.
|
|
167
167
|
"""
|
|
168
|
-
file_set_group = {f.name for f in excel_rawfiles}
|
|
169
|
-
file_set_invoice = set(dfexcelinvoice["data_file_names/name"])
|
|
170
|
-
if file_set_invoice - file_set_group:
|
|
171
|
-
|
|
172
|
-
|
|
168
|
+
file_set_group = {f.name for f in excel_rawfiles}
|
|
169
|
+
file_set_invoice = set(dfexcelinvoice["data_file_names/name"])
|
|
170
|
+
if file_set_invoice - file_set_group:
|
|
171
|
+
missing = sorted(file_set_invoice - file_set_group)
|
|
172
|
+
missing_display = (str(name) for name in missing)
|
|
173
|
+
emsg = f"ERROR: raw file not found: {', '.join(missing_display)}"
|
|
174
|
+
raise StructuredError(emsg)
|
|
173
175
|
# Sort excel_rawfiles in the order they appear in the invoice
|
|
174
176
|
_tmp = {f.name: f for f in excel_rawfiles}
|
|
175
177
|
try:
|
|
@@ -1152,7 +1154,8 @@ class RuleBasedReplacer:
|
|
|
1152
1154
|
Args:
|
|
1153
1155
|
replacements (Mapping[str, Any]): The object containing mapping rules (read-only).
|
|
1154
1156
|
source_json_obj (MutableMapping[str, Any] | None): Objects of key and value to which you want to apply the rule (performs nested assignments).
|
|
1155
|
-
mapping_rules (Mapping[str, str] | None, optional): Rules for mapping key and value (read-only).
|
|
1157
|
+
mapping_rules (Mapping[str, str] | None, optional): Rules for mapping key and value (read-only).
|
|
1158
|
+
If None, uses self.rules. Defaults to None.
|
|
1156
1159
|
|
|
1157
1160
|
Returns:
|
|
1158
1161
|
dict[str, Any]: dictionary type data after conversion
|
|
@@ -1173,13 +1176,12 @@ class RuleBasedReplacer:
|
|
|
1173
1176
|
result = replacer.apply_rules(replacement_rule, save_file_path, mapping_rules = rule)
|
|
1174
1177
|
print(result)
|
|
1175
1178
|
"""
|
|
1176
|
-
# [TODO] Correction of type definitions in version 0.1.6
|
|
1177
1179
|
if mapping_rules is None:
|
|
1178
1180
|
mapping_rules = self.rules
|
|
1179
1181
|
if source_json_obj is None:
|
|
1180
1182
|
source_json_obj = {}
|
|
1181
1183
|
|
|
1182
|
-
for key, value in
|
|
1184
|
+
for key, value in mapping_rules.items():
|
|
1183
1185
|
keys = key.split(".")
|
|
1184
1186
|
replace_value = replacements.get(value, "")
|
|
1185
1187
|
current_obj: MutableMapping[str, Any] = source_json_obj
|
|
@@ -411,6 +411,7 @@ class SmartTableInvoiceInitializer(Processor):
|
|
|
411
411
|
"""Apply SmartTable row data to invoice and collect metadata updates."""
|
|
412
412
|
metadata_updates: dict[str, dict[str, Any]] = {}
|
|
413
413
|
metadata_def: dict[str, Any] | None = None
|
|
414
|
+
csv_has_sample_owner_id = False
|
|
414
415
|
|
|
415
416
|
# Handle empty CSV (no data rows)
|
|
416
417
|
if len(csv_data) == 0:
|
|
@@ -435,10 +436,50 @@ class SmartTableInvoiceInitializer(Processor):
|
|
|
435
436
|
meta_key, meta_entry = self._process_meta_mapping(col, value, metadata_def)
|
|
436
437
|
metadata_updates[meta_key] = meta_entry
|
|
437
438
|
continue
|
|
439
|
+
# Track if sample/ownerId is explicitly specified in CSV
|
|
440
|
+
if col == "sample/ownerId":
|
|
441
|
+
csv_has_sample_owner_id = True
|
|
438
442
|
self._process_mapping_key(col, value, invoice_data, invoice_schema_json_data)
|
|
439
443
|
|
|
444
|
+
# Set sample.ownerId to basic.dataOwnerId only if not specified in CSV
|
|
445
|
+
if not csv_has_sample_owner_id:
|
|
446
|
+
self._set_sample_owner_id(invoice_data)
|
|
447
|
+
|
|
440
448
|
return metadata_updates
|
|
441
449
|
|
|
450
|
+
def _set_sample_owner_id(self, invoice_data: dict[str, Any]) -> None:
|
|
451
|
+
"""Set sample.ownerId to basic.dataOwnerId for SmartTable processing.
|
|
452
|
+
|
|
453
|
+
This ensures that newly registered samples have the correct owner ID,
|
|
454
|
+
which should always be the data owner (registrant) rather than
|
|
455
|
+
any temporary sample owner selected in the invoice screen.
|
|
456
|
+
|
|
457
|
+
Args:
|
|
458
|
+
invoice_data: Invoice data dictionary to update.
|
|
459
|
+
|
|
460
|
+
Note:
|
|
461
|
+
- For new sample registration: Sets the correct owner ID
|
|
462
|
+
- For sample linking: The value is set but not used (safe to set)
|
|
463
|
+
- If basic.dataOwnerId is missing: Logs warning and preserves existing value
|
|
464
|
+
"""
|
|
465
|
+
basic_section = invoice_data.get("basic", {})
|
|
466
|
+
data_owner_id = basic_section.get("dataOwnerId")
|
|
467
|
+
|
|
468
|
+
if data_owner_id is None or data_owner_id == "":
|
|
469
|
+
logger.warning(
|
|
470
|
+
"basic.dataOwnerId is missing or empty; sample.ownerId will not be updated. "
|
|
471
|
+
"This may cause incorrect sample owner assignment.",
|
|
472
|
+
)
|
|
473
|
+
return
|
|
474
|
+
|
|
475
|
+
sample_section = invoice_data.setdefault("sample", {})
|
|
476
|
+
sample_section["ownerId"] = data_owner_id
|
|
477
|
+
|
|
478
|
+
logger.debug(
|
|
479
|
+
"Set sample.ownerId to basic.dataOwnerId: %s",
|
|
480
|
+
data_owner_id,
|
|
481
|
+
)
|
|
482
|
+
|
|
442
483
|
def _load_metadata_definition(self, metadata_def_path: Path) -> dict[str, Any]:
|
|
443
484
|
"""Load metadata definitions for SmartTable meta column processing.
|
|
444
485
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
rdetoolkit\__init__.py,sha256=
|
|
1
|
+
rdetoolkit\__init__.py,sha256=uCoUlAi84FYyEF_xSmSjaJmhqalz-B6Rd8fcqq89K-I,3306
|
|
2
2
|
rdetoolkit\__init__.pyi,sha256=2ILXdK0bu7extORHJnwcCw2GHmlSGrN6-hDV0SV7CF8,472
|
|
3
3
|
rdetoolkit\__main__.py,sha256=RpkjdhIR-v6U17ZAnT3DAIcDwADDqQabSkQoNFiCXQk,126
|
|
4
4
|
rdetoolkit\__main__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -30,7 +30,7 @@ rdetoolkit\cmd\validate.py,sha256=wFWbOEKvzpq3zur7wYMjvLfwxDg3zxM42PJefG4RgXY,28
|
|
|
30
30
|
rdetoolkit\cmd\validate.pyi,sha256=75ca4HTq93Z1ZFtlo7hGFiMVUoswvzCOjdWaaHvnBME,2691
|
|
31
31
|
rdetoolkit\config.py,sha256=7sblHYkOzMPg7cdkBNO4ynnxko896fW6AH6QY8GULfs,15301
|
|
32
32
|
rdetoolkit\config.pyi,sha256=MUZCZXOJtcIGWGNNtKToAfWnf7llO9Bdy4HxULNIYXQ,969
|
|
33
|
-
rdetoolkit\core.cp313-win_amd64.pyd,sha256=
|
|
33
|
+
rdetoolkit\core.cp313-win_amd64.pyd,sha256=vYOlqKjtgYUQSW2OF5yMA_B6oOW5g-4JlrjJpPC5ZVA,6623744
|
|
34
34
|
rdetoolkit\core.pyi,sha256=VxUXk6kEkwsA5a8t0FtfTPt5VtfHjMy7yMz9UzG6r4U,3154
|
|
35
35
|
rdetoolkit\errors.py,sha256=j2tHMViF3WsLXcsyTtC2uq0bOMagdB3Dg5J58-jnF5k,13966
|
|
36
36
|
rdetoolkit\errors.pyi,sha256=XRnfjCkS3k6NIncUUnvDEK9_9Yfe5dghnN1jXZr_9mE,1445
|
|
@@ -111,7 +111,7 @@ rdetoolkit\interfaces\filechecker.py,sha256=X3Wgkj4x7xC0blSpUhFyG7EgDq5W7zfMSLxS
|
|
|
111
111
|
rdetoolkit\interfaces\filechecker.pyi,sha256=gbCG0HY_H5kgjqk3kVfSeJt1AJZsLUb7fuIjJoXtFIM,1119
|
|
112
112
|
rdetoolkit\interfaces\report.py,sha256=HhjruApeOU4JEdQOTx-Q47_8_4cJxnH-ROJUrlLy9J4,914
|
|
113
113
|
rdetoolkit\interfaces\report.pyi,sha256=1reAAKS3Vz5aKCYylijF_VX4OwZUdae6ZtfiBgx7KNw,389
|
|
114
|
-
rdetoolkit\invoicefile.py,sha256=
|
|
114
|
+
rdetoolkit\invoicefile.py,sha256=Llp289WwhKaWHotV6C8mZOzmTtn_dOLHSuwgOgV94Hs,73920
|
|
115
115
|
rdetoolkit\invoicefile.pyi,sha256=r4DRMiy9aVu6Q-1iE3lWfCWLTwqYjSeXMuy0zat0OQE,5382
|
|
116
116
|
rdetoolkit\models\__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
117
117
|
rdetoolkit\models\__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -147,7 +147,7 @@ rdetoolkit\processing\processors\descriptions.py,sha256=eqySgvsk1JaOuTHi4wkSHmj7
|
|
|
147
147
|
rdetoolkit\processing\processors\descriptions.pyi,sha256=fpH5AhmLztaKdNrNd3CUKqJD-PluojHP7SYOG6E3XmM,323
|
|
148
148
|
rdetoolkit\processing\processors\files.py,sha256=QJAQl1-mxRgkn-eacpUW_hQhvIKaxAPEAHOQdej2Lys,10209
|
|
149
149
|
rdetoolkit\processing\processors\files.pyi,sha256=yLFx7Vz4HNzlaMSgzNHhHjIfRbEjeuIvglp3IQXGnBI,643
|
|
150
|
-
rdetoolkit\processing\processors\invoice.py,sha256=
|
|
150
|
+
rdetoolkit\processing\processors\invoice.py,sha256=YjYXQZSKOdlsLJUBGsT4bvSFJ_MdHBmPxK27CWnhW7U,23460
|
|
151
151
|
rdetoolkit\processing\processors\invoice.pyi,sha256=4Guu_l2BHxY7F5kiud7p0yf_fHnlPceSZwRA7liOOQA,856
|
|
152
152
|
rdetoolkit\processing\processors\smarttable_early_exit.py,sha256=YqrTEYrns_4aiYUFd9NQ4OTIFgQzCcLamz4QpFkbON0,7342
|
|
153
153
|
rdetoolkit\processing\processors\smarttable_early_exit.pyi,sha256=h8l8vf-HPbpA15xvHGYyvHGFK5q_QoTiXVi4jqdexNI,474
|
|
@@ -184,8 +184,8 @@ rdetoolkit\validation.py,sha256=ZIdULGWAzQHv8VdfbBZuKSD5eZHtjsMsBhPDD3y4uCA,1841
|
|
|
184
184
|
rdetoolkit\validation.pyi,sha256=916wLyRHzqtr9UNL9p8_vQC9ya-OpLDMOZkKukfKuyw,999
|
|
185
185
|
rdetoolkit\workflows.py,sha256=jVz_CHbNAVc2FLVyfV-Dhan-EWvoZDKWhMqXZVdwI38,22429
|
|
186
186
|
rdetoolkit\workflows.pyi,sha256=i2QN0RP0xQYCjs1Ctp1y6zoRBqeB0cCw7mYlDAS2jiQ,2199
|
|
187
|
-
rdetoolkit-1.5.
|
|
188
|
-
rdetoolkit-1.5.
|
|
189
|
-
rdetoolkit-1.5.
|
|
190
|
-
rdetoolkit-1.5.
|
|
191
|
-
rdetoolkit-1.5.
|
|
187
|
+
rdetoolkit-1.5.3.dist-info\METADATA,sha256=OTJK1vh4kfV2QpEIK8pvoIfVOJDhw_p-AUTBt30_olc,9120
|
|
188
|
+
rdetoolkit-1.5.3.dist-info\WHEEL,sha256=n_BmF69IyGtioVWE9c3M_zsEfe6-xMZy1v5HCL_6qE0,97
|
|
189
|
+
rdetoolkit-1.5.3.dist-info\entry_points.txt,sha256=WMEB0vLFWxdgPfIxgGPzK2djc-aVoGclcqvZlXxpxu4,52
|
|
190
|
+
rdetoolkit-1.5.3.dist-info\licenses\LICENSE,sha256=Xh2kqHbF9jlxeCxl_60qCRAAuO8DYe2hkv0bBAjxcko,1103
|
|
191
|
+
rdetoolkit-1.5.3.dist-info\RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|