diff --git a/CHANGES.rst b/CHANGES.rst index 97767aa999..42ccd873a2 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -6,6 +6,7 @@ Changelog **Added** +- #741 CSV Importer for 'Cobas Taqman 48' Instrument Interface - #737 Added Instrument: Metler Toledo DL55 - #730 Added Instrument: LaChat QuickChem FIA - #729 Added Instrument: Varian Vista-PRO ICP diff --git a/bika/lims/exportimport/instruments/__init__.py b/bika/lims/exportimport/instruments/__init__.py index 03629b792c..37fb7e0310 100644 --- a/bika/lims/exportimport/instruments/__init__.py +++ b/bika/lims/exportimport/instruments/__init__.py @@ -108,7 +108,7 @@ ['horiba.jobinyvon.icp', 'HoribaJobinYvonCSVParser'], ['metler.toledo.dl55', 'MetlerToledoDL55Parser'], ['rigaku.supermini.wxrf', 'RigakuSuperminiWXRFCSVParser'], - ['rochecobas.taqman.model48', 'RocheCobasTaqmanRSFParser'], + ['rochecobas.taqman.model48', 'RocheCobasTaqmanParser'], ['rochecobas.taqman.model96', 'RocheCobasTaqmanRSFParser'], ['thermoscientific.arena.xt20', 'ThermoArena20XTRPRCSVParser'], ['thermoscientific.gallery.Ts9861x', 'ThermoGallery9861xTSVParser'], diff --git a/bika/lims/exportimport/instruments/rochecobas/taqman/model48.py b/bika/lims/exportimport/instruments/rochecobas/taqman/model48.py index 7e1f41576f..17ca1c9f86 100644 --- a/bika/lims/exportimport/instruments/rochecobas/taqman/model48.py +++ b/bika/lims/exportimport/instruments/rochecobas/taqman/model48.py @@ -19,17 +19,22 @@ title = "Roche Cobas - Taqman - 48" -class RocheCobasTaqmanRSFParser(InstrumentCSVResultsFileParser): - def __init__(self, rsf): +class RocheCobasTaqmanParser(InstrumentCSVResultsFileParser): + + def __init__(self, rsf, fileformat=None): InstrumentCSVResultsFileParser.__init__(self, rsf) self._columns = [] # The different columns names self._values = {} # The analysis services from the same resid self._resid = '' # A stored resid self._rownum = None self._end_header = False + self._fileformat = fileformat + self._separator = ',' if self._fileformat == 'csv' else '\t' def _parseline(self, line): - sline = line.replace('"', '').split('\t') + + sline = line.replace('"', '').split(self._separator) + if len(sline) > 0 and not self._end_header: self._columns = sline self._end_header = True @@ -113,7 +118,9 @@ def Import(context, request): if not hasattr(infile, 'filename'): errors.append(_("No file selected")) if fileformat == 'rsf': - parser = RocheCobasTaqmanRSFParser(infile) + parser = RocheCobasTaqmanParser(infile) + if fileformat == 'csv': + parser = RocheCobasTaqmanParser(infile, "csv") else: errors.append(t(_("Unrecognized file format ${fileformat}", mapping={"fileformat": fileformat}))) @@ -166,7 +173,7 @@ def Import(context, request): return json.dumps(results) -class BeckmancoulterAccess2RSFParser(RocheCobasTaqmanRSFParser): +class BeckmancoulterAccess2RSFParser(RocheCobasTaqmanParser): def getAttachmentFileType(self): return "Roche Cobas Taqman 48" diff --git a/bika/lims/exportimport/instruments/rochecobas/taqman/model48_import.pt b/bika/lims/exportimport/instruments/rochecobas/taqman/model48_import.pt index 061acd3ad6..64e0e32177 100644 --- a/bika/lims/exportimport/instruments/rochecobas/taqman/model48_import.pt +++ b/bika/lims/exportimport/instruments/rochecobas/taqman/model48_import.pt @@ -6,6 +6,7 @@  

Advanced options