Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSV Importer for 'Cobas Taqman 48' Instrument Interface #741

Merged
merged 4 commits into from
Mar 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion bika/lims/exportimport/instruments/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
17 changes: 12 additions & 5 deletions bika/lims/exportimport/instruments/rochecobas/taqman/model48.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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})))
Expand Down Expand Up @@ -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"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<label for='rochecobas_taqman_model48_format'>Format</label>&nbsp;
<select name="rochecobas_taqman_model48_format" id="rochecobas_taqman_model48_format">
<option value='rsf'>RFS</option>
<option value='csv'>CSV</option>
</select>
<p></p>
<h3>Advanced options</h3>
Expand Down