mirror of
https://github.com/Schrolli91/BOSWatch.git
synced 2026-01-12 03:20:09 +01:00
Merge pull request #271 from jbollacke/feature/subric_description
New feature: SubRIC is now used for a detailed description. Remember that you have to have an entry of the main RIC - it is used as fallback. The SubRICs are set as sufficix to the main description
This commit is contained in:
commit
daddd02279
|
|
@ -126,7 +126,7 @@ def decode(freq, decoded):
|
|||
# If enabled, look up description
|
||||
if globalVars.config.getint("POC", "idDescribed"):
|
||||
from includes import descriptionList
|
||||
data["description"] = descriptionList.getDescription("POC", poc_id)
|
||||
data["description"] = descriptionList.getDescription("POC", poc_id+data["functionChar"])
|
||||
# processing the alarm
|
||||
try:
|
||||
from includes import alarmHandler
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ Function to expand the dataset with a description.
|
|||
|
||||
import logging # Global logger
|
||||
import csv # for loading the description files
|
||||
import re # for matching IDs with a regular expression
|
||||
|
||||
from includes import globalVars # Global variables
|
||||
from includes.helper import stringConverter
|
||||
|
|
@ -41,10 +42,10 @@ def loadCSV(typ, idField):
|
|||
reader = csv.DictReader(csvfile)
|
||||
for row in reader:
|
||||
logging.debug(row)
|
||||
# only import rows with an integer as id
|
||||
if row[idField].isdigit() == True:
|
||||
# only import rows with an integer as id, allow subrics though
|
||||
if re.match("^[0-9]+[A-D]?$", row[idField], re.IGNORECASE):
|
||||
try:
|
||||
resultList[row[idField]] = stringConverter.convertToUTF8(row['description'])
|
||||
resultList[row[idField].lower()] = stringConverter.convertToUTF8(row['description'])
|
||||
except:
|
||||
# skip entry in case of an exception
|
||||
pass
|
||||
|
|
@ -112,7 +113,8 @@ def getDescription(typ, data):
|
|||
resultStr = zveiDescribtionList[data]
|
||||
elif typ == "POC":
|
||||
global ricDescribtionList
|
||||
resultStr = ricDescribtionList[data]
|
||||
resultStr = ricDescribtionList[data[:-1]] # MainRIC
|
||||
resultStr += " " + ricDescribtionList[data] # SubRIC
|
||||
else:
|
||||
logging.warning("Invalid Typ: %s", typ)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue