bikalims / bika.lims

Open Source Web-based Laboratory Information Management System
http://www.bikalims.org
Other
223 stars 168 forks source link

Setup data file does not work once Calculations are inserted #835

Closed chlarsen closed 11 years ago

chlarsen commented 11 years ago

As soon as the following calculation, or similar, is inserted into the data setup file., an import into a virgin system is not possible anymore.

[DIAMETER] <= [LOWER_LIMIT] 
and "{0:0.0f} mm - Resistant ( Resistant: ≤{1} )".format(
    [DIAMETER], [LOWER_LIMIT]) 

or 

([DIAMETER] > [LOWER_LIMIT] and [DIAMETER] < [UPPER_LIMIT]) 
and "{0:0.0f} mm - Intermediate ( Intermediate: >{1}, <{2} )".format(
    [DIAMETER], [LOWER_LIMIT], [UPPER_LIMIT]) 

or 

[DIAMETER] >= [UPPER_LIMIT] 
and "{0:0.0f} mm - Sensitive ( Sensitive: ≥{1} )".format(
    [DIAMETER], [UPPER_LIMIT])

It crashes saying:

Traceback (innermost last): Module ZPublisher.Publish, line 126, in publish Module ZPublisher.mapply, line 77, in mapply Module ZPublisher.Publish, line 46, in call_object Module bika.lims.exportimport.import, line 47, in call Module bika.lims.exportimport.load_setup_data, line 197, in call Module bika.lims.exportimport.load_setup_data, line 1172, in load_calculations UnicodeEncodeError: 'ascii' codec can't encode character u'\u2264' in position 75: ordinal not in range(128)

Any remedy? The calculations, if inserted manually into Bika, work like a charm, and do not cause any error messages.

chlarsen commented 11 years ago

The file can be found here: -> Dropbox -> Bika -> Setup data -> epid: CARPHASetupData-2013-05-14.ods and CARPHASetupData-2013-05-14.xlsx (the latter does not edit well in LibreOffice, hence inclusion of the original .ods file)

chlarsen commented 11 years ago

A thought: Do I have to protect the quotation marks by backslashes? Upon copying them from the .xlsx file into the LIMS fields (online), the quotation marks get duplicated... Will check.

lemoene commented 11 years ago

Not sure how those line breaks / carriage returns will be handled... Have you tried using just 1 line?

Looks like only 2 or 3 calculation entries are required. For now, as a workaround, these will have to be copy pastad into the setup manually, and the issue be moved to Phase II fro final resolution

chlarsen commented 11 years ago

Have tried using one line, and I get errors due to non-ASCII characters in results legend. Sample calculation, all in one line: [DIAMETER] <= [LOWER_LIMIT] and "{0:0.0f} mm - Resistant ( Resistant: ≤{1} )".format([DIAMETER], [LOWER_LIMIT]) or ([DIAMETER] > [LOWER_LIMIT] and [DIAMETER] < [UPPER_LIMIT]) and "{0:0.0f} mm - Intermediate ( Intermediate: >{1}, <{2} )".format([DIAMETER], [LOWER_LIMIT], [UPPER_LIMIT]) or [DIAMETER] >= [UPPER_LIMIT] and "{0:0.0f} mm - Sensitive ( Sensitive: ≥{1} )".format([DIAMETER], [UPPER_LIMIT]) "≤" and "≥" are required for usability, of course only in legends, not in calculations proper. Ideally, multi-line calculations should be importable in the same way as they can be entered inside Bika LIMs for easy readability.

lemoene commented 11 years ago

Consolidated in https://github.com/bikalabs/Bika-LIMS/issues/894

rockfruit commented 11 years ago

Hi,

At the moment, calculation formulas must be ASCII text only. This will change in later revisions. This means that pasting text from Office Packages is not really a good idea, as these programs replace normal characters with special ones (ie, minus -> hyphen).

Also, for the time being, '≤' should be written as <=.

chlarsen commented 11 years ago

Thanks, Campbell. Certainly no pasting from Office apps! '≤' seems to be the culprit. Any way to escape it ('\' does not work, though!)? C.

rockfruit commented 11 years ago

No, it's the existence of the character that's causing issues. If you really do want it, transmit the issue back to the debugger carpha milestone, and I'll make it work in the current epid branch.

On 24/05/2013 13:06, Christoph H. Larsen wrote:

Thanks, Campbell. Certainly no pasting from Office apps! '≤' seems to be the culprit. Any way to escape it ('\' does not work, though!)? C.

— Reply to this email directly or view it on GitHub https://github.com/bikalabs/Bika-LIMS/issues/835#issuecomment-18398888.