sapiopycommons 2024.8.28a315__py3-none-any.whl → 2024.8.29a317__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.
- sapiopycommons/callbacks/callback_util.py +37 -133
- sapiopycommons/datatype/attachment_util.py +10 -11
- sapiopycommons/eln/experiment_handler.py +48 -209
- sapiopycommons/eln/experiment_report_util.py +129 -33
- sapiopycommons/files/complex_data_loader.py +4 -5
- sapiopycommons/files/file_bridge.py +14 -15
- sapiopycommons/files/file_bridge_handler.py +5 -27
- sapiopycommons/files/file_data_handler.py +5 -2
- sapiopycommons/files/file_util.py +5 -38
- sapiopycommons/files/file_validator.py +11 -26
- sapiopycommons/files/file_writer.py +15 -44
- sapiopycommons/general/aliases.py +3 -147
- sapiopycommons/general/custom_report_util.py +32 -34
- sapiopycommons/general/popup_util.py +0 -17
- sapiopycommons/general/time_util.py +0 -40
- sapiopycommons/multimodal/multimodal_data.py +1 -0
- sapiopycommons/processtracking/endpoints.py +22 -22
- sapiopycommons/recordmodel/record_handler.py +77 -228
- sapiopycommons/rules/eln_rule_handler.py +25 -34
- sapiopycommons/rules/on_save_rule_handler.py +31 -34
- sapiopycommons/webhook/webhook_handlers.py +26 -90
- {sapiopycommons-2024.8.28a315.dist-info → sapiopycommons-2024.8.29a317.dist-info}/METADATA +1 -1
- sapiopycommons-2024.8.29a317.dist-info/RECORD +43 -0
- sapiopycommons/customreport/__init__.py +0 -0
- sapiopycommons/customreport/column_builder.py +0 -60
- sapiopycommons/customreport/custom_report_builder.py +0 -125
- sapiopycommons/customreport/term_builder.py +0 -299
- sapiopycommons/general/audit_log.py +0 -196
- sapiopycommons/general/sapio_links.py +0 -50
- sapiopycommons/webhook/webservice_handlers.py +0 -67
- sapiopycommons-2024.8.28a315.dist-info/RECORD +0 -50
- {sapiopycommons-2024.8.28a315.dist-info → sapiopycommons-2024.8.29a317.dist-info}/WHEEL +0 -0
- {sapiopycommons-2024.8.28a315.dist-info → sapiopycommons-2024.8.29a317.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
|
|
2
3
|
|
|
3
|
-
from sapiopycommons.general.aliases import RecordIdentifier, AliasUtil, ExperimentIdentifier
|
|
4
|
-
UserIdentifier
|
|
4
|
+
from sapiopycommons.general.aliases import RecordIdentifier, AliasUtil, ExperimentIdentifier
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
class ProcessTracking:
|
|
8
8
|
@staticmethod
|
|
9
|
-
def assign_to_process(context:
|
|
9
|
+
def assign_to_process(context: SapioWebhookContext | SapioUser, data_type: str, 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":
|
|
30
|
+
"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 = context if isinstance(context, SapioUser) else context.user
|
|
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: SapioWebhookContext | SapioUser, data_type: str, 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":
|
|
57
|
+
"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 = context if isinstance(context, SapioUser) else context.user
|
|
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: SapioWebhookContext | SapioUser, data_type: str, 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":
|
|
83
|
+
"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 = context if isinstance(context, SapioUser) else context.user
|
|
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: SapioWebhookContext | SapioUser, data_type: str, 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":
|
|
106
|
+
"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 = context if isinstance(context, SapioUser) else context.user
|
|
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: SapioWebhookContext | SapioUser, data_type: str,
|
|
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":
|
|
132
|
+
"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 = context if isinstance(context, SapioUser) else context.user
|
|
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: SapioWebhookContext | SapioUser, data_type: str,
|
|
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":
|
|
162
|
+
"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 = context if isinstance(context, SapioUser) else context.user
|
|
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: SapioWebhookContext | SapioUser, 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 = context if isinstance(context, SapioUser) else context.user
|
|
191
191
|
response = user.post(sub_path, payload=payload)
|
|
192
192
|
user.raise_for_status(response)
|