evol 5
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
def chi_sono(unit, tool):
|
||||
def main_loader(unit, tool):
|
||||
print(f'{__name__}: {unit} - {tool}')
|
||||
return f'{__name__}: {unit} - {tool}'
|
||||
@@ -4,6 +4,8 @@ import utils.timestamp.date_check as date_check
|
||||
import logging
|
||||
import re
|
||||
|
||||
from itertools import islice
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
def get_data(cfg: object, id: int) -> tuple:
|
||||
@@ -92,9 +94,27 @@ def make_loc_matrix(cfg: object, id: int) -> list:
|
||||
matrice_valori = []
|
||||
pattern = r'(?:\d{4}/\d{2}/\d{2}|\d{2}/\d{2}/\d{4}) \d{2}:\d{2}:\d{2}(;[^;]+)+'
|
||||
for riga in [riga for riga in righe if re.match(pattern, riga)]:
|
||||
timestamp, batlevel, temperature, ain1, ain2, din1, din2, = riga.split(';')
|
||||
EventDate, EventTime = timestamp.split(' ')
|
||||
valori = [ain1, ain2, din1, din2]
|
||||
matrice_valori.append([UnitName, ToolNameID, 1, date_check.conforma_data(EventDate), EventTime, batlevel, temperature] + valori + ([None] * (19 - len(valori))))
|
||||
timestamp, battery_voltage, unit_temperature, analog_input1, analog_input2, digital_input1, digital_input2 = riga.split(';')
|
||||
event_date, event_time = timestamp.split(' ')
|
||||
valori = [analog_input1, analog_input2, digital_input1, digital_input2]
|
||||
matrice_valori.append([UnitName, ToolNameID, 1, date_check.conforma_data(event_date), event_time, battery_voltage, unit_temperature] + valori + ([None] * (19 - len(valori))))
|
||||
|
||||
return matrice_valori
|
||||
|
||||
def make_matrix_with_channels(cfg: object, id: int, node_channels: list) -> list:
|
||||
UnitName, ToolNameID, ToolData = get_data(cfg, id)
|
||||
righe = ToolData.splitlines()
|
||||
matrice_valori = []
|
||||
for riga in [riga for riga in righe if ';|;' in riga]:
|
||||
timestamp, batlevel, temperature, rilevazioni = riga.split(';',3)
|
||||
EventDate, EventTime = timestamp.split(' ')
|
||||
valori_splitted = [valore for valore in rilevazioni.split(';') if valore != '|']
|
||||
valori_iter = iter(valori_splitted)
|
||||
valori_nodi = [list(islice(valori_iter, channels)) for channels in node_channels]
|
||||
|
||||
for num_nodo, valori in enumerate(valori_nodi, start=1):
|
||||
matrice_valori.append([UnitName, ToolNameID, num_nodo, date_check.conforma_data(EventDate), EventTime, batlevel, temperature] + valori + ([None] * (19 - len(valori))))
|
||||
|
||||
return matrice_valori
|
||||
|
||||
|
||||
return matrice_valori
|
||||
@@ -1,3 +1,4 @@
|
||||
def chi_sono(unit, tool):
|
||||
print(f'{__name__}: {unit} - {tool}')
|
||||
return f'{__name__}: {unit} - {tool}'
|
||||
from .g801_mums import main_loader as g801_mums_main_loader
|
||||
|
||||
def main_loader(cfg: object, id: int) -> None:
|
||||
return g801_mums_main_loader(cfg, id)
|
||||
@@ -1,5 +1,5 @@
|
||||
#!.venv/bin/python
|
||||
from utils.database.loader import load_data
|
||||
from utils.database.loader_action import load_data
|
||||
from utils.parsers.data_preparation import make_loc_matrix
|
||||
import logging
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!.venv/bin/python
|
||||
# Import necessary modules
|
||||
from utils.database.loader import load_data
|
||||
from utils.database.loader_action import load_data, update_status, DATA_LOADED
|
||||
from utils.parsers.data_preparation import make_matrix
|
||||
import logging
|
||||
|
||||
@@ -11,4 +11,5 @@ def main_loader(cfg: object, id: int) -> None:
|
||||
# Create a matrix of values from the data
|
||||
matrice_valori = make_matrix(cfg, id)
|
||||
# Load the data into the database
|
||||
load_data(cfg, matrice_valori)
|
||||
if load_data(cfg, matrice_valori):
|
||||
update_status(cfg, id, DATA_LOADED)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import time
|
||||
def chi_sono(unit, tool):
|
||||
print(f'{__name__}: {unit} - {tool}')
|
||||
time.sleep(20)
|
||||
return f'{__name__}: {unit} - {tool}'
|
||||
from .g801_mums import main_loader as g801_mums_main_loader
|
||||
|
||||
def main_loader(cfg: object, id: int) -> None:
|
||||
return g801_mums_main_loader(cfg, id)
|
||||
@@ -1,5 +1,4 @@
|
||||
import time
|
||||
def chi_sono(unit, tool):
|
||||
print(f'{__name__}: {unit} - {tool}')
|
||||
time.sleep(20)
|
||||
return f'{__name__}: {unit} - {tool}'
|
||||
from .g801_loc import main_loader as g801_loc_main_loader
|
||||
|
||||
def main_loader(cfg: object, id: int) -> None:
|
||||
return g801_loc_main_loader(cfg, id)
|
||||
@@ -1,5 +1,4 @@
|
||||
import time
|
||||
def chi_sono(unit, tool):
|
||||
print(f'{__name__}: {unit} - {tool}')
|
||||
time.sleep(20)
|
||||
return f'{__name__}: {unit} - {tool}'
|
||||
from .g801_mums import main_loader as g801_mums_main_loader
|
||||
|
||||
def main_loader(cfg: object, id: int) -> None:
|
||||
return g801_mums_main_loader(cfg, id)
|
||||
@@ -1,5 +1,4 @@
|
||||
import time
|
||||
def chi_sono(unit, tool):
|
||||
print(f'{__name__}: {unit} - {tool}')
|
||||
time.sleep(20)
|
||||
return f'{__name__}: {unit} - {tool}'
|
||||
from .g801_mums import main_loader as g801_mums_main_loader
|
||||
|
||||
def main_loader(cfg: object, id: int) -> None:
|
||||
return g801_mums_main_loader(cfg, id)
|
||||
@@ -1,5 +1,4 @@
|
||||
import time
|
||||
def chi_sono(unit, tool):
|
||||
print(f'{__name__}: {unit} - {tool}')
|
||||
time.sleep(20)
|
||||
return f'{__name__}: {unit} - {tool}'
|
||||
from .g801_mux import main_loader as g801_mux_main_loader
|
||||
|
||||
def main_loader(cfg: object, id: int) -> None:
|
||||
return g801_mux_main_loader(cfg, id)
|
||||
@@ -1,5 +1,4 @@
|
||||
import time
|
||||
def chi_sono(unit, tool):
|
||||
print(f'{__name__}: {unit} - {tool}')
|
||||
time.sleep(20)
|
||||
return f'{__name__}: {unit} - {tool}'
|
||||
from .tlp_tlp import main_loader as tlp_tlp_main_loader
|
||||
|
||||
def main_loader(cfg: object, id: int) -> None:
|
||||
return tlp_tlp_main_loader(cfg, id)
|
||||
4
utils/parsers/hortus_hortus.py
Normal file
4
utils/parsers/hortus_hortus.py
Normal file
@@ -0,0 +1,4 @@
|
||||
from .cr1000x_cr1000x import main_loader as cr1000x_cr1000x_main_loader
|
||||
|
||||
def main_loader(cfg: object, id: int) -> None:
|
||||
return cr1000x_cr1000x_main_loader(cfg, id)
|
||||
@@ -1,5 +0,0 @@
|
||||
import time
|
||||
def chi_sono(unit, tool):
|
||||
print(f'{__name__}: {unit} - {tool}')
|
||||
time.sleep(20)
|
||||
return f'{__name__}: {unit} - {tool}'
|
||||
Reference in New Issue
Block a user