leaf-framework 0.10.1__tar.gz → 0.10.2__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.
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/PKG-INFO +1 -1
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/phase_modules/measure.py +63 -16
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/pyproject.toml +1 -1
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/LICENSE +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/README.md +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/__init__.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/adapters/__init__.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/adapters/core_adapters/__init__.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/adapters/core_adapters/continuous_experiment_adapter.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/adapters/core_adapters/discrete_experiment_adapter.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/adapters/core_adapters/upload_adapter.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/adapters/equipment_adapter.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/config/configuration.yaml +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/data/marketplace.yaml +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/error_handler/__init__.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/error_handler/error_holder.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/error_handler/exceptions.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/measurement_handler/__init__.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/measurement_handler/handler.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/measurement_handler/measurements.yaml +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/measurement_handler/terms.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/.gitkeep +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/__init__.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/input_modules/__init__.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/input_modules/ble_watcher.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/input_modules/db_watcher.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/input_modules/event_watcher.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/input_modules/external_api_watcher.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/input_modules/external_event_watcher.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/input_modules/file_watcher.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/input_modules/http_watcher.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/input_modules/modbus_watcher.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/input_modules/mqtt_external_event_watcher.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/input_modules/mqtt_watcher.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/input_modules/opc_watcher.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/input_modules/polling_watcher.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/input_modules/simple_watcher.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/measurement_modules/__init__.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/measurement_modules/carbon_dioxide.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/measurement_modules/dissolved_oxygen.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/measurement_modules/fluorescence.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/measurement_modules/measurement_module.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/measurement_modules/optical_density.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/measurement_modules/ph.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/measurement_modules/temperature.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/output_modules/__init__.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/output_modules/file.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/output_modules/keydb.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/output_modules/mqtt.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/output_modules/output_module.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/output_modules/sql.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/output_modules/topic_store.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/phase_modules/__init__.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/phase_modules/control.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/phase_modules/error.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/phase_modules/external_event_phase.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/phase_modules/initialisation.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/phase_modules/phase.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/phase_modules/start.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/phase_modules/stop.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/process_modules/__init__.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/process_modules/continous_module.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/process_modules/discrete_module.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/process_modules/external_event_process.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/process_modules/process_module.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/process_modules/upload_module.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/register/__init__.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/register/abstract_leaf.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/register/equipment_actions.yaml +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/register/equipment_data.yaml +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/register/metadata.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/register/py.typed +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/register/topic_utilities.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/registry/discovery.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/registry/loader.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/registry/registry.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/registry/utils.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/start.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/ui/__init__.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/ui/adapter_ui_extension.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/ui/components/__init__.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/ui/components/header.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/ui/constants.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/ui/desktop_launcher.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/ui/images/icon.icns +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/ui/images/icon.ico +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/ui/images/icon.svg +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/ui/interface.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/ui/markdown/configuration_help.md +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/ui/markdown/documentation_main.md +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/ui/markdown/documentation_protips.md +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/ui/scripts.js +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/ui/styles.css +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/ui/tabs/__init__.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/ui/tabs/adapters.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/ui/tabs/configuration.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/ui/tabs/documentation.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/ui/tabs/logs.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/ui/tabs/monitoring.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/ui/utils.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/utility/config_utils.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/utility/logger/__init__.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/utility/logger/logger_utils.py +0 -0
- {leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/utility/running_utilities.py +0 -0
|
@@ -94,11 +94,11 @@ class MeasurePhase(PhaseModule):
|
|
|
94
94
|
for index, chunk in enumerate(chunks):
|
|
95
95
|
if index % 10 == 0:
|
|
96
96
|
logger.debug(f"Sending chunk {index + 1} of {len(chunks)} with {len(chunk)} measurements.")
|
|
97
|
-
messages.
|
|
97
|
+
messages.extend(self._form_message(exp_id, chunk))
|
|
98
98
|
time.sleep(0.1)
|
|
99
99
|
return messages
|
|
100
100
|
else:
|
|
101
|
-
return
|
|
101
|
+
return self._form_message(exp_id, result)
|
|
102
102
|
else:
|
|
103
103
|
experiment_id = kwargs.get("experiment_id", "unknown")
|
|
104
104
|
measurement = kwargs.get("measurement", "unknown")
|
|
@@ -106,28 +106,75 @@ class MeasurePhase(PhaseModule):
|
|
|
106
106
|
action = self._term_builder(experiment_id=experiment_id, measurement=measurement)
|
|
107
107
|
return [(action, data)]
|
|
108
108
|
|
|
109
|
-
def _form_message(self, experiment_id: str, result: Any) -> tuple:
|
|
109
|
+
def _form_message(self, experiment_id: str, result: Any) -> list[tuple]:
|
|
110
110
|
"""
|
|
111
|
-
Formulate
|
|
111
|
+
Formulate one or more (topic, data) messages for a measurement result.
|
|
112
|
+
|
|
113
|
+
A list/set of points can mix several distinct measurement types
|
|
114
|
+
(e.g. pH, temperature, oxygen) in the same batch. Since the topic
|
|
115
|
+
encodes a single measurement type, each distinct type present in
|
|
116
|
+
the batch is split out into its own message rather than all being
|
|
117
|
+
published under whichever type happened to come first.
|
|
112
118
|
|
|
113
119
|
Args:
|
|
114
120
|
experiment_id (str): The ID of the experiment.
|
|
115
121
|
result (Any): The measurement result data.
|
|
116
122
|
|
|
117
123
|
Returns:
|
|
118
|
-
tuple: A
|
|
124
|
+
list[tuple]: A list of (action, result) tuples.
|
|
119
125
|
"""
|
|
120
|
-
measurement = "unknown"
|
|
121
126
|
if isinstance(result, dict):
|
|
122
|
-
measurement =
|
|
123
|
-
|
|
127
|
+
measurement = self._resolve_measurement(result)
|
|
128
|
+
action = self._term_builder(experiment_id=experiment_id, measurement=measurement)
|
|
129
|
+
return [(action, result)]
|
|
130
|
+
|
|
131
|
+
if isinstance(result, InfluxPoint):
|
|
124
132
|
result = result.to_json()
|
|
125
|
-
measurement =
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
133
|
+
measurement = self._resolve_measurement(result)
|
|
134
|
+
action = self._term_builder(experiment_id=experiment_id, measurement=measurement)
|
|
135
|
+
return [(action, result)]
|
|
136
|
+
|
|
137
|
+
if isinstance(result, list):
|
|
138
|
+
converted = []
|
|
139
|
+
for item in result:
|
|
140
|
+
if isinstance(item, InfluxPoint):
|
|
141
|
+
converted.append(item.to_json())
|
|
142
|
+
else:
|
|
143
|
+
converted.append(item)
|
|
144
|
+
|
|
145
|
+
groups: dict[str, list] = {}
|
|
146
|
+
for item in converted:
|
|
147
|
+
if isinstance(item, dict):
|
|
148
|
+
key = self._resolve_measurement(item)
|
|
149
|
+
else:
|
|
150
|
+
key = "unknown"
|
|
151
|
+
groups.setdefault(key, []).append(item)
|
|
152
|
+
|
|
153
|
+
messages = []
|
|
154
|
+
for key, group in groups.items():
|
|
155
|
+
action = self._term_builder(experiment_id=experiment_id, measurement=key)
|
|
156
|
+
messages.append((action, group))
|
|
157
|
+
return messages
|
|
158
|
+
|
|
159
|
+
excp = AdapterLogicError(f"Unknown measurement data type: {type(result)}")
|
|
160
|
+
self._handle_exception(excp)
|
|
161
|
+
return []
|
|
162
|
+
|
|
163
|
+
def _resolve_measurement(self, item: dict) -> str:
|
|
164
|
+
"""
|
|
165
|
+
Resolve the measurement label used for the topic's last segment.
|
|
166
|
+
|
|
167
|
+
Prefers the "metric" tag (e.g. "temperature", "ph") over the
|
|
168
|
+
top-level "measurement" field, since adapters commonly set
|
|
169
|
+
"measurement" to a constant device/point type shared by every
|
|
170
|
+
point (e.g. all Pioreactor points use "pioreactor"), while the
|
|
171
|
+
"metric" tag is what actually distinguishes one point from another.
|
|
172
|
+
"""
|
|
173
|
+
tags = item.get("tags")
|
|
174
|
+
if isinstance(tags, dict) and tags.get("metric"):
|
|
175
|
+
return tags["metric"]
|
|
176
|
+
|
|
177
|
+
if item.get("measurement"):
|
|
178
|
+
return item["measurement"]
|
|
131
179
|
|
|
132
|
-
|
|
133
|
-
return (action, result)
|
|
180
|
+
return "unknown"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/adapters/core_adapters/upload_adapter.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/input_modules/external_api_watcher.py
RENAMED
|
File without changes
|
{leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/input_modules/external_event_watcher.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/input_modules/modbus_watcher.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/input_modules/polling_watcher.py
RENAMED
|
File without changes
|
{leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/input_modules/simple_watcher.py
RENAMED
|
File without changes
|
{leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/measurement_modules/__init__.py
RENAMED
|
File without changes
|
{leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/measurement_modules/carbon_dioxide.py
RENAMED
|
File without changes
|
{leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/measurement_modules/dissolved_oxygen.py
RENAMED
|
File without changes
|
{leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/measurement_modules/fluorescence.py
RENAMED
|
File without changes
|
|
File without changes
|
{leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/measurement_modules/optical_density.py
RENAMED
|
File without changes
|
|
File without changes
|
{leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/measurement_modules/temperature.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/output_modules/output_module.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/phase_modules/external_event_phase.py
RENAMED
|
File without changes
|
{leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/phase_modules/initialisation.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/process_modules/continous_module.py
RENAMED
|
File without changes
|
{leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/process_modules/discrete_module.py
RENAMED
|
File without changes
|
|
File without changes
|
{leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/process_modules/process_module.py
RENAMED
|
File without changes
|
{leaf_framework-0.10.1 → leaf_framework-0.10.2}/leaf/modules/process_modules/upload_module.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|