From 9601e196220480fdfbfd8e7b82465bdf25d0279a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Cant=C3=B9?= Date: Mon, 18 Mar 2024 12:39:31 +0100 Subject: [PATCH] add interrex environment data logger parser --- wizard/parsers/other_sensor/__init__.py | 3 +++ wizard/parsers/other_sensor/interrex.py | 21 +++++++++++++++++++++ wizard/parsers/parser.py | 10 +++------- 3 files changed, 27 insertions(+), 7 deletions(-) create mode 100644 wizard/parsers/other_sensor/__init__.py create mode 100644 wizard/parsers/other_sensor/interrex.py diff --git a/wizard/parsers/other_sensor/__init__.py b/wizard/parsers/other_sensor/__init__.py new file mode 100644 index 0000000..da74ddf --- /dev/null +++ b/wizard/parsers/other_sensor/__init__.py @@ -0,0 +1,3 @@ +from .interrex import PARSERS as INTERREX + +PARSERS = INTERREX diff --git a/wizard/parsers/other_sensor/interrex.py b/wizard/parsers/other_sensor/interrex.py new file mode 100644 index 0000000..2cd3be1 --- /dev/null +++ b/wizard/parsers/other_sensor/interrex.py @@ -0,0 +1,21 @@ +from parsers.parser_base import CSVParser + + +class InterrexEnvironmentParser(CSVParser): + ''' + Parser for Interrex Environment Data Logger + ''' + DATATYPE = "other_sensor" + FIELDS = [ + "UUID", + "Transmitting time", + "Collecting time", + "Temperature", + "Light intensity", + "Voltage", + "Data Source" + ] + +PARSERS = [ + InterrexEnvironmentParser, +] diff --git a/wizard/parsers/parser.py b/wizard/parsers/parser.py index e7f0d52..7f4fefd 100644 --- a/wizard/parsers/parser.py +++ b/wizard/parsers/parser.py @@ -1,18 +1,14 @@ import traceback import logging -from chardet.universaldetector import UniversalDetector -from .parser_base import Parser, ParserNotSupported, Parsable +from .parser_base import ParserNotSupported, Parsable from .gps import PARSERS as GPS_PARSERS from .accelerometer import PARSERS as ACCELEROMETER_PARSERS from .tdr import PARSERS as TDR_PARSERS -# from .parser_excel import GPSUnknownFormatExcelParser +from .other_sensor import PARSERS as OTHER_SENSOR_PARSERS -available_parsers = GPS_PARSERS + ACCELEROMETER_PARSERS + TDR_PARSERS +available_parsers = GPS_PARSERS + ACCELEROMETER_PARSERS + TDR_PARSERS + OTHER_SENSOR_PARSERS -binary_parsers = [ - # GPSUnknownFormatExcelParser, -] def detect_file(path): parsable = Parsable(file_path=path)