biosero-data-models 0.1.3__tar.gz
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.
- biosero_data_models-0.1.3/LICENSE +202 -0
- biosero_data_models-0.1.3/PKG-INFO +21 -0
- biosero_data_models-0.1.3/README.md +23 -0
- biosero_data_models-0.1.3/pyproject.toml +32 -0
- biosero_data_models-0.1.3/setup.cfg +4 -0
- biosero_data_models-0.1.3/src/biosero/__init__.py +0 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/__init__.py +13 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/adapter/__init__.py +9 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/adapter/decorators.py +51 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/adapter/generate_library.py +154 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/adapter/helpers.py +109 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/adapter/order_processer.py +286 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/adapter/template_categories.py +23 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/adapter/template_icons.py +22 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/adapter/template_registrar.py +188 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/clients/__init__.py +4 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/clients/iorder_client.py +160 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/events/__init__.py +9 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/events/event.py +23 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/events/event_message.py +126 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/events/event_search_parameters.py +51 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/events/eventcontext.py +32 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/events/liquid_transfer_event.py +71 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/events/location_changed_event.py +43 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/events/module_status_update_event.py +42 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/extensions/__init__.py +4 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/extensions/exception_extensions.py +18 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/extensions/object_extesion.py +19 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/extensions/string_extensions.py +61 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/helpers/__init__.py +8 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/helpers/enum_helper.py +39 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/helpers/http_client_helper.py +25 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/helpers/string_helper.py +35 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/helpers/unique_identifier_provider.py +7 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/helpers/well_helper.py +45 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/measurement/__init__.py +12 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/measurement/concentration.py +55 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/measurement/coordinates.py +8 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/measurement/evaluator.py +15 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/measurement/inventorylevel.py +8 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/measurement/inventorythreshold.py +18 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/measurement/location.py +27 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/measurement/materialstate.py +7 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/measurement/temperature.py +45 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/measurement/volume.py +57 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/measurement/weight.py +45 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/ordering/__init__.py +5 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/ordering/order.py +104 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/ordering/ordertemplate.py +60 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/ordering/workflow_process.py +21 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/parameters/__init__.py +7 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/parameters/converters/__init__.py +4 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/parameters/converters/json_parameter_validation_rule_converter.py +63 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/parameters/converters/json_parameter_value_type_converter.py +47 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/parameters/parameter.py +91 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/parameters/parameter_collection.py +57 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/parameters/parameter_value_type.py +9 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/parameters/validation/__init__.py +26 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/parameters/validation/parameter_validation_result.py +17 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/parameters/validation/rules/__init__.py +15 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/parameters/validation/rules/constraint_to_options_parameter_validation_rule.py +36 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/parameters/validation/rules/empty_parameter_validation_rule.py +25 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/parameters/validation/rules/iparamter_validation_rule.py +24 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/parameters/validation/rules/max_length_parameter_validation_rule.py +41 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/parameters/validation/rules/parameter_validation_result.py +36 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/parameters/validation/rules/parameter_validation_rule_base.py +41 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/parameters/validation/rules/range_parameter_validation_rule.py +56 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/parameters/validation/rules/regex_parameter_validation_rule.py +35 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/resources/__init__.py +9 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/resources/commontypeidentifiers.py +40 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/resources/identity.py +107 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/resources/material_in_container_search_result.py +21 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/resources/plate.py +12 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/resources/platetype.py +16 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/resources/sample_in_container_search_result.py +21 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/restclients/__init__.py +6 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/restclients/dtos/__init__.py +7 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/restclients/dtos/identity_registration_dto.py +8 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/restclients/dtos/multi_identity_registration_dto.py +9 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/restclients/dtos/order_dto.py +58 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/restclients/dtos/transfer_request_dto.py +11 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/restclients/event_client.py +73 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/restclients/order_client.py +146 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/restclients/order_scheduler.py +259 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/transportation/__init__.py +5 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/transportation/station_manager.py +10 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/transportation/transportation_device.py +8 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/transportation/transportation_request.py +69 -0
- biosero_data_models-0.1.3/src/biosero/datamodels/view_model.py +39 -0
- biosero_data_models-0.1.3/src/biosero/dataservices/__init__.py +2 -0
- biosero_data_models-0.1.3/src/biosero/dataservices/restclient/__init__.py +25 -0
- biosero_data_models-0.1.3/src/biosero/dataservices/restclient/accessioningclient.py +110 -0
- biosero_data_models-0.1.3/src/biosero/dataservices/restclient/queryclient.py +506 -0
- biosero_data_models-0.1.3/src/biosero/dataservices/restclient/transportation_client.py +280 -0
- biosero_data_models-0.1.3/src/biosero/identities/__init__.py +10 -0
- biosero_data_models-0.1.3/src/biosero/identities/accesioning.py +172 -0
- biosero_data_models-0.1.3/src/biosero/identities/assignment_api.py +170 -0
- biosero_data_models-0.1.3/src/biosero/identities/container.py +34 -0
- biosero_data_models-0.1.3/src/biosero/identities/device.py +31 -0
- biosero_data_models-0.1.3/src/biosero/identities/resource.py +36 -0
- biosero_data_models-0.1.3/src/biosero/identities/vessel.py +33 -0
- biosero_data_models-0.1.3/src/biosero/identities/workcell.py +32 -0
- biosero_data_models-0.1.3/src/biosero/utilities/__init__.py +6 -0
- biosero_data_models-0.1.3/src/biosero/utilities/event_retriever.py +37 -0
- biosero_data_models-0.1.3/src/biosero/utilities/flow_control.py +142 -0
- biosero_data_models-0.1.3/src/biosero/utilities/liquid.py +89 -0
- biosero_data_models-0.1.3/src/biosero/utilities/plate_data.py +136 -0
- biosero_data_models-0.1.3/src/biosero/utilities/registration.py +43 -0
- biosero_data_models-0.1.3/src/biosero_data_models.egg-info/PKG-INFO +21 -0
- biosero_data_models-0.1.3/src/biosero_data_models.egg-info/SOURCES.txt +115 -0
- biosero_data_models-0.1.3/src/biosero_data_models.egg-info/dependency_links.txt +1 -0
- biosero_data_models-0.1.3/src/biosero_data_models.egg-info/requires.txt +12 -0
- biosero_data_models-0.1.3/src/biosero_data_models.egg-info/top_level.txt +5 -0
- biosero_data_models-0.1.3/src/module_update.py +36 -0
- biosero_data_models-0.1.3/src/registrar_test.py +7 -0
- biosero_data_models-0.1.3/src/test_3.py +84 -0
- biosero_data_models-0.1.3/src/workflow_example.py +94 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity granting the License.
|
|
13
|
+
|
|
14
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
15
|
+
other entities that control, are controlled by, or are under common
|
|
16
|
+
control with that entity. For the purposes of this definition,
|
|
17
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
18
|
+
direction or management of such entity, whether by contract or
|
|
19
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
20
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
21
|
+
|
|
22
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
23
|
+
exercising permissions granted by this License.
|
|
24
|
+
|
|
25
|
+
"Source" shall mean the preferred form for making modifications,
|
|
26
|
+
including but not limited to software source code, documentation
|
|
27
|
+
source, and configuration files.
|
|
28
|
+
|
|
29
|
+
"Object" shall mean any form resulting from mechanical
|
|
30
|
+
transformation or translation of a Source form, including but
|
|
31
|
+
not limited to compiled object code, generated documentation,
|
|
32
|
+
and conversions to other media types.
|
|
33
|
+
|
|
34
|
+
"Work" shall mean the work of authorship covered by this License,
|
|
35
|
+
whether in Source or binary form, that is made available under the
|
|
36
|
+
License, as indicated by a copyright notice that is included in or
|
|
37
|
+
attached to the work. (I shall use "the Work" to refer to such work
|
|
38
|
+
of authorship.)
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based upon (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and derivative works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control
|
|
57
|
+
systems, and issue tracking systems that are managed by, or on behalf
|
|
58
|
+
of, the Licensor for the purpose of discussing and improving the Work,
|
|
59
|
+
but excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to use, reproduce, modify, distribute, and prepare
|
|
70
|
+
Derivative Works of, publicly display, publicly perform, sublicense,
|
|
71
|
+
and distribute the Work and such Derivative Works in Source or Object
|
|
72
|
+
form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright notice to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. When redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2025 Biosero
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: biosero-data-models
|
|
3
|
+
Version: 0.1.3
|
|
4
|
+
Summary: A python library with client and contract code to work with the Data Services API
|
|
5
|
+
Author-email: Pete Werner <peterwerner@biosero.com>
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/biosero/data-models-python
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: anyio==4.4.0
|
|
10
|
+
Requires-Dist: aiohttp==3.9.5
|
|
11
|
+
Requires-Dist: certifi==2024.6.2
|
|
12
|
+
Requires-Dist: charset-normalizer==3.3.2
|
|
13
|
+
Requires-Dist: h11==0.14.0
|
|
14
|
+
Requires-Dist: httpcore==1.0.5
|
|
15
|
+
Requires-Dist: httpx==0.27.0
|
|
16
|
+
Requires-Dist: idna==3.7
|
|
17
|
+
Requires-Dist: jsonpickle==4.0.5
|
|
18
|
+
Requires-Dist: requests==2.32.3
|
|
19
|
+
Requires-Dist: sniffio==1.3.1
|
|
20
|
+
Requires-Dist: rich==13.7.1
|
|
21
|
+
Dynamic: license-file
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Data Models Python
|
|
2
|
+
|
|
3
|
+
A Python library with client and contract code to interact with the Data Services API.
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
- Python 3.12.3
|
|
8
|
+
|
|
9
|
+
## Build
|
|
10
|
+
|
|
11
|
+
python setup.py sdist bdist_wheel
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
```sh
|
|
16
|
+
pip install biosero-0.1.0-py3-none-any.whl
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### From PyPI (currently not available)
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
pip install biosero
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "biosero-data-models"
|
|
7
|
+
version = "0.1.3"
|
|
8
|
+
description = "A python library with client and contract code to work with the Data Services API"
|
|
9
|
+
authors = [
|
|
10
|
+
{ name="Pete Werner", email="peterwerner@biosero.com" }
|
|
11
|
+
]
|
|
12
|
+
license = {text = "Apache-2.0"}
|
|
13
|
+
dependencies = [
|
|
14
|
+
"anyio==4.4.0",
|
|
15
|
+
"aiohttp==3.9.5",
|
|
16
|
+
"certifi==2024.6.2",
|
|
17
|
+
"charset-normalizer==3.3.2",
|
|
18
|
+
"h11==0.14.0",
|
|
19
|
+
"httpcore==1.0.5",
|
|
20
|
+
"httpx==0.27.0",
|
|
21
|
+
"idna==3.7",
|
|
22
|
+
"jsonpickle==4.0.5",
|
|
23
|
+
"requests==2.32.3",
|
|
24
|
+
"sniffio==1.3.1",
|
|
25
|
+
"rich==13.7.1"
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
[project.urls]
|
|
29
|
+
"Homepage" = "https://github.com/biosero/data-models-python"
|
|
30
|
+
|
|
31
|
+
[project.scripts]
|
|
32
|
+
# Example: script_name = "module:function"
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from .events import EventMessage, EventContext,LiquidTransferEvent, LocationChangedEvent, ModuleStatus, ModuleStatusUpdateEvent
|
|
2
|
+
from .extensions import ExceptionExtensions, ObjectExtension, StringExtensions
|
|
3
|
+
from .helpers import EnumHelper,HttpClientHelper, StringHelper, UniqueIdentifierProvider, well_helper
|
|
4
|
+
from .measurement import Concentration, Evaluator, InventoryThreshold, inventorylevel, Location, MaterialState, Temperature, Volume, Weight, Coordinates
|
|
5
|
+
from .ordering import Order, OrderPriority, OrderStatus, SchedulingStrategy, ModuleRestrictionStrategy
|
|
6
|
+
from .parameters import Parameter, ParameterCollection, ParameterValueType
|
|
7
|
+
from .resources import Identity, Plate, PlateType, CommonTypeIdentifiers
|
|
8
|
+
from .restclients import EventClient, OrderClient, OrderScheduler
|
|
9
|
+
from .adapter import OrderProcessor, TemplateRegistrar, ClientLibraryGenerator
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
__all__ = ['EventMessage', 'OrderClient','EventContext', 'LiquidTransferEvent', 'LocationChangedEvent', 'ExceptionExtensions', 'ObjectExtension', 'StringExtensions', 'EnumHelper', 'HttpClientHelper', 'StringHelper', 'UniqueIdentifierProvider', 'well_helper', 'Concentration', 'Evaluator', 'InventoryThreshold', 'inventorylevel', 'Location', 'Coordinates', 'MaterialState', 'Temperature', 'Volume', 'Weight', 'Order', 'OrderPriority', 'OrderStatus', 'SchedulingStrategy', 'ModuleRestrictionStrategy', 'Parameter', 'ParameterCollection', 'ParameterValueType', 'Identity', 'Plate', 'PlateType', 'CommonTypeIdentifiers', 'EventClient', 'OrderProcessor', 'TemplateRegistrar', 'ClientLibraryGenerator', 'ModuleStatus', 'ModuleStatusUpdateEvent', 'OrderScheduler']
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
from .decorators import parameter, action
|
|
2
|
+
from .template_icons import Icons
|
|
3
|
+
from .helpers import Helpers
|
|
4
|
+
from .template_categories import Categories
|
|
5
|
+
from .order_processer import OrderProcessor
|
|
6
|
+
from .template_registrar import TemplateRegistrar
|
|
7
|
+
from .generate_library import ClientLibraryGenerator
|
|
8
|
+
|
|
9
|
+
__all__ = ['parameter', 'action', 'Icons', 'Helpers', 'Categories', 'OrderProcessor', 'TemplateRegistrar', 'ClientLibraryGenerator']
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from biosero.datamodels.adapter.template_icons import Icons
|
|
3
|
+
from rich.logging import RichHandler
|
|
4
|
+
import functools
|
|
5
|
+
|
|
6
|
+
logger = logging.getLogger("rich")
|
|
7
|
+
logging.basicConfig(
|
|
8
|
+
level=logging.INFO,
|
|
9
|
+
format="%(message)s",
|
|
10
|
+
handlers=[RichHandler(rich_tracebacks=True)]
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
def parameter(name=None, inputs=None, outputs=None, icon=Icons.CODE.value, category="Python", color="#FFFFFF"):
|
|
14
|
+
def decorator(func):
|
|
15
|
+
@functools.wraps(func)
|
|
16
|
+
def wrapper(*args, **kwargs):
|
|
17
|
+
result = func(*args, **kwargs)
|
|
18
|
+
return result
|
|
19
|
+
|
|
20
|
+
# Attach the metadata to the wrapper function
|
|
21
|
+
wrapper._parameter_decorator = {
|
|
22
|
+
'name': name,
|
|
23
|
+
'inputs': inputs,
|
|
24
|
+
'outputs': outputs,
|
|
25
|
+
'icon': icon,
|
|
26
|
+
'category': category,
|
|
27
|
+
'color': color
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return wrapper
|
|
31
|
+
|
|
32
|
+
return decorator
|
|
33
|
+
|
|
34
|
+
def action(name=None):
|
|
35
|
+
def decorator(func):
|
|
36
|
+
@functools.wraps(func) # Apply the wraps decorator here
|
|
37
|
+
def wrapper(*args, **kwargs):
|
|
38
|
+
logger.info(f"[blue]Action: {func.__name__} is being executed.[/blue]", extra={"markup": True})
|
|
39
|
+
result = func(*args, **kwargs)
|
|
40
|
+
return result
|
|
41
|
+
|
|
42
|
+
# Attach the metadata to the wrapper function
|
|
43
|
+
wrapper._action_decorator = {
|
|
44
|
+
'name': name or func.__name__,
|
|
45
|
+
'inputs': [],
|
|
46
|
+
'outputs': []
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return wrapper
|
|
50
|
+
|
|
51
|
+
return decorator
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import inspect
|
|
3
|
+
import subprocess
|
|
4
|
+
import sys
|
|
5
|
+
import types
|
|
6
|
+
from typing import Tuple, Any
|
|
7
|
+
from biosero.datamodels.adapter.decorators import parameter
|
|
8
|
+
from biosero.datamodels.adapter.helpers import Helpers
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class ClientLibraryGenerator:
|
|
12
|
+
CLASS_TEMPLATE = """
|
|
13
|
+
from biosero.datamodels.adapter.decorators import parameter
|
|
14
|
+
from biosero.datamodels.adapter.helpers import Helpers
|
|
15
|
+
from typing import Tuple, Any
|
|
16
|
+
|
|
17
|
+
class Actions(object):
|
|
18
|
+
|
|
19
|
+
def __init__(self, url):
|
|
20
|
+
self.helpers = Helpers(url)
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
METHOD_TEMPLATE = """
|
|
24
|
+
@parameter(name='{template_name}', inputs={inputs}, outputs={outputs})
|
|
25
|
+
def {name}(self, {params}) -> Tuple[{return_type}]:
|
|
26
|
+
return self.helpers.process_order()
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
def __init__(self, base_path: str, action_templates):
|
|
30
|
+
"""
|
|
31
|
+
Initializes the client library generator.
|
|
32
|
+
|
|
33
|
+
:param base_path: The base directory where the client library will be generated.
|
|
34
|
+
:param action_templates: The imported action_templates module.
|
|
35
|
+
"""
|
|
36
|
+
self.base_path = os.path.abspath(base_path) # Ensure absolute path
|
|
37
|
+
self.package_dir = os.path.join(self.base_path, "src/dataservices/adapter")
|
|
38
|
+
self.dist_dir = os.path.join(self.base_path, "dist")
|
|
39
|
+
self.build_dir = os.path.join(self.base_path, "build")
|
|
40
|
+
self.egg_info_dir = os.path.join(self.base_path, "src/dataservices.egg-info")
|
|
41
|
+
self.action_templates = action_templates # Pass action_templates dynamically
|
|
42
|
+
|
|
43
|
+
def extract_outputs(self, decorator):
|
|
44
|
+
"""Extract the outputs from the parameter decorator."""
|
|
45
|
+
return decorator.get('outputs', [])
|
|
46
|
+
|
|
47
|
+
def generate_methods(self):
|
|
48
|
+
methods = []
|
|
49
|
+
for name in dir(self.action_templates):
|
|
50
|
+
method = getattr(self.action_templates, name)
|
|
51
|
+
if isinstance(method, types.FunctionType) and hasattr(method, '_parameter_decorator'):
|
|
52
|
+
methods.append(method)
|
|
53
|
+
|
|
54
|
+
generated_methods = []
|
|
55
|
+
for method in methods:
|
|
56
|
+
decorator = method._parameter_decorator
|
|
57
|
+
template_name = decorator['name']
|
|
58
|
+
print(f"Generating method for {template_name}")
|
|
59
|
+
|
|
60
|
+
name = method.__name__
|
|
61
|
+
sig = inspect.signature(method)
|
|
62
|
+
params = ", ".join(
|
|
63
|
+
[f"{p}: {t.annotation.__name__ if t.annotation != inspect._empty else 'Any'}"
|
|
64
|
+
for p, t in sig.parameters.items()]
|
|
65
|
+
)
|
|
66
|
+
inputs = [p.replace("_", " ").title() for p in sig.parameters.keys()]
|
|
67
|
+
outputs = self.extract_outputs(decorator)
|
|
68
|
+
|
|
69
|
+
return_annotation = sig.return_annotation
|
|
70
|
+
if return_annotation is inspect._empty:
|
|
71
|
+
return_type = "Any"
|
|
72
|
+
elif hasattr(return_annotation, '__args__'):
|
|
73
|
+
return_type = ", ".join([t.__name__ for t in return_annotation.__args__])
|
|
74
|
+
else:
|
|
75
|
+
return_type = return_annotation.__name__
|
|
76
|
+
|
|
77
|
+
method_code = self.METHOD_TEMPLATE.format(
|
|
78
|
+
name=name,
|
|
79
|
+
template_name=template_name,
|
|
80
|
+
params=params,
|
|
81
|
+
inputs=inputs,
|
|
82
|
+
outputs=outputs,
|
|
83
|
+
return_type=return_type
|
|
84
|
+
)
|
|
85
|
+
generated_methods.append(method_code)
|
|
86
|
+
return generated_methods
|
|
87
|
+
|
|
88
|
+
def generate_client_library(self):
|
|
89
|
+
# Step 1: Create necessary directories
|
|
90
|
+
os.makedirs(self.package_dir, exist_ok=True)
|
|
91
|
+
os.makedirs(self.dist_dir, exist_ok=True)
|
|
92
|
+
os.makedirs(self.build_dir, exist_ok=True)
|
|
93
|
+
|
|
94
|
+
# Step 2: Create __init__.py files
|
|
95
|
+
self.create_init_file(os.path.join(self.base_path, "src/dataservices"))
|
|
96
|
+
self.create_init_file(self.package_dir)
|
|
97
|
+
|
|
98
|
+
# Step 3: Generate the Python file
|
|
99
|
+
with open(os.path.join(self.package_dir, "actions.py"), "w") as f:
|
|
100
|
+
class_code = self.CLASS_TEMPLATE + "\n".join(self.generate_methods())
|
|
101
|
+
f.write(class_code)
|
|
102
|
+
|
|
103
|
+
# Step 4: Create setup.py file
|
|
104
|
+
self.create_setup_file()
|
|
105
|
+
|
|
106
|
+
print(f"Client library generated successfully in {self.base_path}!")
|
|
107
|
+
|
|
108
|
+
# Step 5: Ensure wheel is installed
|
|
109
|
+
subprocess.run([sys.executable, "-m", "pip", "install", "wheel"], check=True)
|
|
110
|
+
|
|
111
|
+
# Step 6: Build the distribution files
|
|
112
|
+
self.build_distribution()
|
|
113
|
+
|
|
114
|
+
def create_init_file(self, path):
|
|
115
|
+
with open(os.path.join(path, "__init__.py"), "w") as init_file:
|
|
116
|
+
init_file.write("# This is the __init__.py file\n")
|
|
117
|
+
|
|
118
|
+
def create_setup_file(self):
|
|
119
|
+
setup_path = os.path.join(self.base_path, "setup.py")
|
|
120
|
+
with open(setup_path, "w") as setup_file:
|
|
121
|
+
setup_file.write(
|
|
122
|
+
f"""from setuptools import setup, find_packages
|
|
123
|
+
|
|
124
|
+
setup(
|
|
125
|
+
name='dataservices',
|
|
126
|
+
version='0.1',
|
|
127
|
+
package_dir={{'': 'src'}},
|
|
128
|
+
packages=find_packages(where='src'),
|
|
129
|
+
install_requires=[
|
|
130
|
+
# Add your dependencies here
|
|
131
|
+
],
|
|
132
|
+
)
|
|
133
|
+
"""
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
def build_distribution(self):
|
|
138
|
+
try:
|
|
139
|
+
subprocess.run(
|
|
140
|
+
[sys.executable, os.path.join(self.base_path, "setup.py"), "sdist", "bdist_wheel"],
|
|
141
|
+
cwd=self.base_path, # Ensure build output stays in base path
|
|
142
|
+
check=True
|
|
143
|
+
)
|
|
144
|
+
print(f"Distribution files generated successfully in {self.base_path}!")
|
|
145
|
+
|
|
146
|
+
# Ensure dataservices.egg-info is in the base path
|
|
147
|
+
if os.path.exists(self.egg_info_dir):
|
|
148
|
+
print(f"Egg info directory created: {self.egg_info_dir}")
|
|
149
|
+
else:
|
|
150
|
+
print("dataservices.egg-info not found. It may be created dynamically during install.")
|
|
151
|
+
|
|
152
|
+
except subprocess.CalledProcessError as e:
|
|
153
|
+
print(f"Error occurred while building distribution files: {e}")
|
|
154
|
+
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import inspect
|
|
2
|
+
from biosero.datamodels.adapter.decorators import parameter
|
|
3
|
+
from biosero.datamodels.parameters import Parameter, ParameterValueType, ParameterCollection
|
|
4
|
+
from biosero.datamodels.restclients import OrderClient
|
|
5
|
+
from biosero.datamodels.ordering import Order, OrderStatus
|
|
6
|
+
import time
|
|
7
|
+
from typing import Tuple, get_type_hints
|
|
8
|
+
|
|
9
|
+
class Helpers(object):
|
|
10
|
+
|
|
11
|
+
def __init__(self, data_services_url: str):
|
|
12
|
+
|
|
13
|
+
self.data_services_url = data_services_url
|
|
14
|
+
|
|
15
|
+
def process_order(self):
|
|
16
|
+
|
|
17
|
+
type_mapping = {
|
|
18
|
+
str: ParameterValueType.STRING,
|
|
19
|
+
bool: ParameterValueType.BOOLEAN,
|
|
20
|
+
float: ParameterValueType.DOUBLE,
|
|
21
|
+
int: ParameterValueType.INTEGER,
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
# Get the current function's frame
|
|
25
|
+
frame = inspect.currentframe().f_back
|
|
26
|
+
# Get the current function's arguments
|
|
27
|
+
_, _, _, values = inspect.getargvalues(frame)
|
|
28
|
+
values = {k: v for k, v in values.items() if k != 'self'}
|
|
29
|
+
# Get the current function's name
|
|
30
|
+
func_name = frame.f_code.co_name
|
|
31
|
+
# Get the class object
|
|
32
|
+
cls = frame.f_locals['self'].__class__
|
|
33
|
+
# Get the function object from the class
|
|
34
|
+
func = getattr(cls, func_name)
|
|
35
|
+
# Access the decorator metadata
|
|
36
|
+
template_name = func._parameter_decorator['name']
|
|
37
|
+
inputs = func._parameter_decorator['inputs']
|
|
38
|
+
outputs = func._parameter_decorator['outputs']
|
|
39
|
+
|
|
40
|
+
type_hints = get_type_hints(func)
|
|
41
|
+
|
|
42
|
+
input_parameters = ParameterCollection()
|
|
43
|
+
|
|
44
|
+
for index, input_name in enumerate(inputs):
|
|
45
|
+
param = Parameter()
|
|
46
|
+
param.name = input_name
|
|
47
|
+
# Get the value based on the current index
|
|
48
|
+
param.value = list(values.values())[index] # Assuming values is a dictionary
|
|
49
|
+
# Set the parameter value type based on type hints
|
|
50
|
+
param_type = type_hints.get(input_name.replace(" ", "_").lower(), str)
|
|
51
|
+
param.value_type = type_mapping.get(param_type, ParameterValueType.OTHER)
|
|
52
|
+
input_parameters.append(param)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
# output_parameters = ParameterCollection()
|
|
56
|
+
|
|
57
|
+
# for index, output_name in enumerate(outputs):
|
|
58
|
+
# param = Parameter()
|
|
59
|
+
# param.name = output_name
|
|
60
|
+
# # Get the value based on the current index
|
|
61
|
+
# param.value = list(values.values())[index] # Assuming values is a dictionary
|
|
62
|
+
# # Set the parameter value type based on type hints
|
|
63
|
+
# param_type = type_hints.get(output_name.replace(" ", "_").lower(), str)
|
|
64
|
+
# param.value_type = type_mapping.get(param_type, ParameterValueType.OTHER)
|
|
65
|
+
# output_parameters.append(param)
|
|
66
|
+
output_parameters = ParameterCollection()
|
|
67
|
+
|
|
68
|
+
for output_name in outputs:
|
|
69
|
+
param = Parameter()
|
|
70
|
+
param.name = output_name
|
|
71
|
+
param.value = None
|
|
72
|
+
param_type = type_hints.get(output_name.replace(" ", "_").lower(), str)
|
|
73
|
+
param.value_type = type_mapping.get(param_type, ParameterValueType.OTHER)
|
|
74
|
+
output_parameters.append(param)
|
|
75
|
+
|
|
76
|
+
order = Order()
|
|
77
|
+
|
|
78
|
+
# Create the order
|
|
79
|
+
order_client = OrderClient(self.data_services_url)
|
|
80
|
+
order.moduleRestrictionStrategy = "NoRestriction"
|
|
81
|
+
order.templateName = template_name
|
|
82
|
+
order.createdBy = "data services action"
|
|
83
|
+
order.inputParameters = input_parameters.to_dict()
|
|
84
|
+
order.outputParameters = output_parameters.to_dict()
|
|
85
|
+
|
|
86
|
+
response = order_client.create_order(order)
|
|
87
|
+
return_order = order_client.get_order(response)
|
|
88
|
+
|
|
89
|
+
while return_order.status != OrderStatus.Complete.name:
|
|
90
|
+
print("Waiting for Order to Complete")
|
|
91
|
+
time.sleep(2)
|
|
92
|
+
return_order = order_client.get_order(response)
|
|
93
|
+
|
|
94
|
+
if return_order.status == OrderStatus.Error.name:
|
|
95
|
+
print("Order failed")
|
|
96
|
+
break
|
|
97
|
+
|
|
98
|
+
# Retrieve output parameters from the completed order
|
|
99
|
+
extracted_output_params = {param['name']: param['value'] for param in return_order.outputParameters}
|
|
100
|
+
|
|
101
|
+
tuple_output = ()
|
|
102
|
+
|
|
103
|
+
for output_name in outputs:
|
|
104
|
+
|
|
105
|
+
item = extracted_output_params.get(output_name)
|
|
106
|
+
|
|
107
|
+
tuple_output += (item,)
|
|
108
|
+
|
|
109
|
+
return tuple_output
|