loc rel1
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
from utils.database.connection import connetti_db
|
from utils.database.connection import connetti_db
|
||||||
import utils.timestamp.date_check as date_check
|
import utils.timestamp.date_check as date_check
|
||||||
import logging
|
import logging
|
||||||
|
import re
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -25,4 +26,18 @@ def make_matrix(cfg, id):
|
|||||||
for num_nodo, valori_nodo in enumerate(valori_nodi, start=1):
|
for num_nodo, valori_nodo in enumerate(valori_nodi, start=1):
|
||||||
valori = valori_nodo.split(';')
|
valori = valori_nodo.split(';')
|
||||||
matrice_valori.append([UnitName, ToolNameID, num_nodo, date_check.conforma_data(EventDate), EventTime, batlevel, temperature] + valori + ([None] * (19 - len(valori))))
|
matrice_valori.append([UnitName, ToolNameID, num_nodo, date_check.conforma_data(EventDate), EventTime, batlevel, temperature] + valori + ([None] * (19 - len(valori))))
|
||||||
|
|
||||||
|
return matrice_valori
|
||||||
|
|
||||||
|
def make_loc_matrix(cfg, id):
|
||||||
|
UnitName, ToolNameID, ToolData = get_data(cfg, id)
|
||||||
|
righe = ToolData.splitlines()
|
||||||
|
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))))
|
||||||
|
|
||||||
return matrice_valori
|
return matrice_valori
|
||||||
@@ -1,5 +1,12 @@
|
|||||||
import time
|
#!.venv/bin/python
|
||||||
def chi_sono(unit, tool):
|
from utils.database.loader import load_data
|
||||||
print(f'{__name__}: {unit} - {tool}')
|
from utils.parsers.data_preparation import make_loc_matrix
|
||||||
time.sleep(20)
|
import logging
|
||||||
return f'{__name__}: {unit} - {tool}'
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
def main_loader(cfg, id):
|
||||||
|
matrice_valori = make_loc_matrix(cfg, id)
|
||||||
|
load_data(cfg, matrice_valori)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user