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

GeneXpert Instrument Import Interface Optimization #378

Merged
merged 8 commits into from
Nov 27, 2017
Merged
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Changelog

**Fixed**

- #378 Fix GeneXpert interface does not import results for multiple analyses
- #416 Fix inconsistencies with sorting criterias in lists
- #418 LabClerks don't have access to AR view after received and before verified
- #415 Referencefield JS UID check: Don't remove Profile UIDs
Expand Down
22 changes: 19 additions & 3 deletions bika/lims/exportimport/instruments/genexpert/genexpert.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,8 @@ def _parseline(self, line):
return the code error -1
"""
sline = line.split(SEPARATOR)
# If a line has only one column, then it is a Section or Subsection
# header.
if len(sline) == 1:

if is_header(sline):
return self._handle_header(sline)
# If it is not an header it contains some data. but we need data only
# from the RESULT TABLE section.
Expand Down Expand Up @@ -249,6 +248,8 @@ def _format_keyword(self, keyword):
result = ''
if keyword:
result = re.sub(r"\W", "", keyword)
# Remove underscores ('_') too.
result = re.sub(r"_", "", result)
return result

def _convert_result(self, value):
Expand Down Expand Up @@ -281,3 +282,18 @@ def __init__(self, parser, context, idsearchcriteria, override,
allowed_ar_states,
allowed_analysis_states,
instrument_uid)


def is_header(line):
"""
If a line has only one column, then it is a Section or Subsection
header.
:param line: Line to check
:return: boolean -If line is header
"""
if len(line) == 1:
return True
for idx, val in enumerate(line):
if idx > 0 and val:
return False
return True
4 changes: 3 additions & 1 deletion bika/lims/exportimport/instruments/resultsimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,6 @@ def _process_analysis(self, objid, analysis, values):
analysis.setResult(res)
if capturedate:
analysis.setResultCaptureDate(capturedate)
doActionFor(analysis, 'submit')
resultsaved = True

elif resultsaved == False:
Expand All @@ -833,6 +832,9 @@ def _process_analysis(self, objid, analysis, values):
"result":""
})

if resultsaved or len(interimsout) > 0:
doActionFor(analysis, 'submit')

if (resultsaved or len(interimsout) > 0) \
and values.get('Remarks', '') \
and analysis.portal_type == 'Analysis' \
Expand Down