sapiopycommons 2024.8.28a313__py3-none-any.whl → 2024.8.28a315__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 sapiopycommons might be problematic. Click here for more details.
- sapiopycommons/callbacks/callback_util.py +407 -69
- sapiopycommons/chem/IndigoMolecules.py +1 -0
- sapiopycommons/chem/Molecules.py +1 -0
- sapiopycommons/customreport/__init__.py +0 -0
- sapiopycommons/customreport/column_builder.py +60 -0
- sapiopycommons/customreport/custom_report_builder.py +125 -0
- sapiopycommons/customreport/term_builder.py +299 -0
- sapiopycommons/datatype/attachment_util.py +11 -10
- sapiopycommons/eln/experiment_handler.py +209 -48
- sapiopycommons/eln/experiment_report_util.py +118 -0
- sapiopycommons/files/complex_data_loader.py +5 -4
- sapiopycommons/files/file_bridge.py +31 -24
- sapiopycommons/files/file_bridge_handler.py +340 -0
- sapiopycommons/files/file_data_handler.py +2 -5
- sapiopycommons/files/file_util.py +50 -10
- sapiopycommons/files/file_validator.py +92 -6
- sapiopycommons/files/file_writer.py +44 -15
- sapiopycommons/general/accession_service.py +375 -0
- sapiopycommons/general/aliases.py +147 -3
- sapiopycommons/general/audit_log.py +196 -0
- sapiopycommons/general/custom_report_util.py +211 -37
- sapiopycommons/general/popup_util.py +17 -0
- sapiopycommons/general/sapio_links.py +50 -0
- sapiopycommons/general/time_util.py +40 -0
- sapiopycommons/multimodal/multimodal.py +146 -0
- sapiopycommons/multimodal/multimodal_data.py +486 -0
- sapiopycommons/processtracking/endpoints.py +22 -22
- sapiopycommons/recordmodel/record_handler.py +481 -97
- sapiopycommons/rules/eln_rule_handler.py +34 -25
- sapiopycommons/rules/on_save_rule_handler.py +34 -31
- sapiopycommons/webhook/webhook_handlers.py +147 -26
- sapiopycommons/webhook/webservice_handlers.py +67 -0
- {sapiopycommons-2024.8.28a313.dist-info → sapiopycommons-2024.8.28a315.dist-info}/METADATA +4 -2
- sapiopycommons-2024.8.28a315.dist-info/RECORD +50 -0
- sapiopycommons-2024.8.28a313.dist-info/RECORD +0 -38
- {sapiopycommons-2024.8.28a313.dist-info → sapiopycommons-2024.8.28a315.dist-info}/WHEEL +0 -0
- {sapiopycommons-2024.8.28a313.dist-info → sapiopycommons-2024.8.28a315.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
from sapiopylib.rest.User import SapioUser
|
|
2
|
-
from sapiopylib.rest.pojo.webhook.WebhookContext import SapioWebhookContext
|
|
3
2
|
|
|
4
|
-
from sapiopycommons.general.aliases import RecordIdentifier, AliasUtil, ExperimentIdentifier
|
|
3
|
+
from sapiopycommons.general.aliases import RecordIdentifier, AliasUtil, ExperimentIdentifier, DataTypeIdentifier, \
|
|
4
|
+
UserIdentifier
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
class ProcessTracking:
|
|
8
8
|
@staticmethod
|
|
9
|
-
def assign_to_process(context:
|
|
9
|
+
def assign_to_process(context: UserIdentifier, data_type: DataTypeIdentifier, records: list[RecordIdentifier],
|
|
10
10
|
process_name: str, step_number: int | None = None, branch_id: int | None = None,
|
|
11
11
|
request: RecordIdentifier | None = None) -> None:
|
|
12
12
|
"""
|
|
@@ -27,19 +27,19 @@ class ProcessTracking:
|
|
|
27
27
|
"""
|
|
28
28
|
sub_path = '/ext/process-tracking/assign-to-process'
|
|
29
29
|
payload = {
|
|
30
|
-
"data-type-name": data_type,
|
|
30
|
+
"data-type-name": AliasUtil.to_data_type_name(data_type),
|
|
31
31
|
"record-ids": AliasUtil.to_record_ids(records),
|
|
32
32
|
"process-name": process_name,
|
|
33
33
|
"step-number": step_number,
|
|
34
34
|
"branch-id": branch_id,
|
|
35
35
|
"request-record-id": AliasUtil.to_record_ids([request])[0] if request is not None else None
|
|
36
36
|
}
|
|
37
|
-
user: SapioUser =
|
|
37
|
+
user: SapioUser = AliasUtil.to_sapio_user(context)
|
|
38
38
|
response = user.post(sub_path, payload=payload)
|
|
39
39
|
user.raise_for_status(response)
|
|
40
40
|
|
|
41
41
|
@staticmethod
|
|
42
|
-
def begin_protocol(context:
|
|
42
|
+
def begin_protocol(context: UserIdentifier, data_type: DataTypeIdentifier, records: list[RecordIdentifier],
|
|
43
43
|
experiment: ExperimentIdentifier) -> None:
|
|
44
44
|
"""
|
|
45
45
|
Begin the assigned processes of the given tracked records as the given experiment. This sets the status of the
|
|
@@ -54,16 +54,16 @@ class ProcessTracking:
|
|
|
54
54
|
"""
|
|
55
55
|
sub_path = '/ext/process-tracking/begin-protocol'
|
|
56
56
|
payload = {
|
|
57
|
-
"data-type-name": data_type,
|
|
57
|
+
"data-type-name": AliasUtil.to_data_type_name(data_type),
|
|
58
58
|
"record-ids": AliasUtil.to_record_ids(records),
|
|
59
59
|
"experiment-id": AliasUtil.to_notebook_id(experiment),
|
|
60
60
|
}
|
|
61
|
-
user: SapioUser =
|
|
61
|
+
user: SapioUser = AliasUtil.to_sapio_user(context)
|
|
62
62
|
response = user.post(sub_path, payload=payload)
|
|
63
63
|
user.raise_for_status(response)
|
|
64
64
|
|
|
65
65
|
@staticmethod
|
|
66
|
-
def complete_protocol(context:
|
|
66
|
+
def complete_protocol(context: UserIdentifier, data_type: DataTypeIdentifier, records: list[RecordIdentifier],
|
|
67
67
|
experiment: ExperimentIdentifier) -> None:
|
|
68
68
|
"""
|
|
69
69
|
Complete the current step that the given tracked records are at given the experiment.
|
|
@@ -80,16 +80,16 @@ class ProcessTracking:
|
|
|
80
80
|
"""
|
|
81
81
|
sub_path = '/ext/process-tracking/complete-protocol'
|
|
82
82
|
payload = {
|
|
83
|
-
"data-type-name": data_type,
|
|
83
|
+
"data-type-name": AliasUtil.to_data_type_name(data_type),
|
|
84
84
|
"record-ids": AliasUtil.to_record_ids(records),
|
|
85
85
|
"experiment-id": AliasUtil.to_notebook_id(experiment),
|
|
86
86
|
}
|
|
87
|
-
user: SapioUser =
|
|
87
|
+
user: SapioUser = AliasUtil.to_sapio_user(context)
|
|
88
88
|
response = user.post(sub_path, payload=payload)
|
|
89
89
|
user.raise_for_status(response)
|
|
90
90
|
|
|
91
91
|
@staticmethod
|
|
92
|
-
def fail(context:
|
|
92
|
+
def fail(context: UserIdentifier, data_type: DataTypeIdentifier, records: list[RecordIdentifier],
|
|
93
93
|
experiment: ExperimentIdentifier) -> None:
|
|
94
94
|
"""
|
|
95
95
|
Fail the assigned processes of the given tracked records, changing their statuses to "Failed -". The tracked
|
|
@@ -103,16 +103,16 @@ class ProcessTracking:
|
|
|
103
103
|
"""
|
|
104
104
|
sub_path = '/ext/process-tracking/fail'
|
|
105
105
|
payload = {
|
|
106
|
-
"data-type-name": data_type,
|
|
106
|
+
"data-type-name": AliasUtil.to_data_type_name(data_type),
|
|
107
107
|
"record-ids": AliasUtil.to_record_ids(records),
|
|
108
108
|
"experiment-id": AliasUtil.to_notebook_id(experiment),
|
|
109
109
|
}
|
|
110
|
-
user: SapioUser =
|
|
110
|
+
user: SapioUser = AliasUtil.to_sapio_user(context)
|
|
111
111
|
response = user.post(sub_path, payload=payload)
|
|
112
112
|
user.raise_for_status(response)
|
|
113
113
|
|
|
114
114
|
@staticmethod
|
|
115
|
-
def promote_to_next_by_experiment(context:
|
|
115
|
+
def promote_to_next_by_experiment(context: UserIdentifier, data_type: DataTypeIdentifier,
|
|
116
116
|
records: list[RecordIdentifier], experiment: ExperimentIdentifier) -> None:
|
|
117
117
|
"""
|
|
118
118
|
Promote the status of the given tracked records to the next status in their process using an experiment.
|
|
@@ -129,16 +129,16 @@ class ProcessTracking:
|
|
|
129
129
|
"""
|
|
130
130
|
sub_path = '/ext/process-tracking/promote-status-to-next'
|
|
131
131
|
payload = {
|
|
132
|
-
"data-type-name": data_type,
|
|
132
|
+
"data-type-name": AliasUtil.to_data_type_name(data_type),
|
|
133
133
|
"record-ids": AliasUtil.to_record_ids(records),
|
|
134
134
|
"experiment-id": AliasUtil.to_notebook_id(experiment),
|
|
135
135
|
}
|
|
136
|
-
user: SapioUser =
|
|
136
|
+
user: SapioUser = AliasUtil.to_sapio_user(context)
|
|
137
137
|
response = user.post(sub_path, payload=payload)
|
|
138
138
|
user.raise_for_status(response)
|
|
139
139
|
|
|
140
140
|
@staticmethod
|
|
141
|
-
def promote_to_next_by_step(context:
|
|
141
|
+
def promote_to_next_by_step(context: UserIdentifier, data_type: DataTypeIdentifier,
|
|
142
142
|
records: list[RecordIdentifier], process_name: str, step_number: int,
|
|
143
143
|
branch_id: int | None = None) -> None:
|
|
144
144
|
"""
|
|
@@ -159,7 +159,7 @@ class ProcessTracking:
|
|
|
159
159
|
"""
|
|
160
160
|
sub_path = '/ext/process-tracking/promote-status-to-next'
|
|
161
161
|
payload = {
|
|
162
|
-
"data-type-name": data_type,
|
|
162
|
+
"data-type-name": AliasUtil.to_data_type_name(data_type),
|
|
163
163
|
"record-ids": AliasUtil.to_record_ids(records),
|
|
164
164
|
"current-process-status": {
|
|
165
165
|
"process-name": process_name,
|
|
@@ -167,12 +167,12 @@ class ProcessTracking:
|
|
|
167
167
|
"branch-id": branch_id
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
|
-
user: SapioUser =
|
|
170
|
+
user: SapioUser = AliasUtil.to_sapio_user(context)
|
|
171
171
|
response = user.post(sub_path, payload=payload)
|
|
172
172
|
user.raise_for_status(response)
|
|
173
173
|
|
|
174
174
|
@staticmethod
|
|
175
|
-
def reprocess(context:
|
|
175
|
+
def reprocess(context: UserIdentifier, records: list[RecordIdentifier]) -> None:
|
|
176
176
|
"""
|
|
177
177
|
Reprocess tracked records to a previous step in their process. Reprocessing is controlled by ReturnPoint records
|
|
178
178
|
which are children of the AssignedProcess on the tracked records. Creates a new AssignedProcess record for the
|
|
@@ -187,6 +187,6 @@ class ProcessTracking:
|
|
|
187
187
|
payload = {
|
|
188
188
|
"record-ids": AliasUtil.to_record_ids(records)
|
|
189
189
|
}
|
|
190
|
-
user: SapioUser =
|
|
190
|
+
user: SapioUser = AliasUtil.to_sapio_user(context)
|
|
191
191
|
response = user.post(sub_path, payload=payload)
|
|
192
192
|
user.raise_for_status(response)
|