-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from EURAC-EEBgroup/pre/beta
Pre/beta
- Loading branch information
Showing
21 changed files
with
377 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
from .check_sensor_presence import check_sensor_presence | ||
from .validate_condition import validate_condition | ||
from .validate_condition_local import validate_condition_local | ||
|
||
__all__ = ["validate_condition", "validate_condition_local"] | ||
__all__ = ["validate_condition", "validate_condition_local", "check_sensor_presence"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from typing import Any, Dict, Literal | ||
|
||
from ..logger import custom_logger | ||
from ..utils import get_hierarchical_info | ||
|
||
|
||
def check_sensor_presence( | ||
state: Dict[str, Any] | ||
) -> Literal["get_sensors", "schema_to_ttl"]: | ||
""" | ||
Check if the sensors are present in the building structure. | ||
Args: | ||
state (Dict[str, Any]): The current state containing the sensor structure. | ||
Returns: | ||
Literal["get_sensors", "schema_to_ttl"]: The next node to visit. | ||
""" | ||
|
||
custom_logger.eurac("📡 Checking for sensor presence") | ||
|
||
elem_list = state.get("elem_list", []) | ||
|
||
parents, children = get_hierarchical_info("Point") | ||
|
||
children_dict = {} | ||
for child in children: | ||
children_dict[child] = get_hierarchical_info(child)[1] | ||
|
||
# Flatten the dictionary in a list | ||
children_list = [elem for sublist in children_dict.values() for elem in sublist] | ||
|
||
is_sensor = False | ||
|
||
for elem in elem_list: | ||
if elem in children_list: | ||
is_sensor = True | ||
|
||
if is_sensor: | ||
return "get_sensors" | ||
else: | ||
return "schema_to_ttl" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.