mirror of
https://github.com/Kalenis/kalenislims.git
synced 2023-12-14 07:13:04 +01:00
lims: significant digits: indicate when to use scientific notation
This commit is contained in:
parent
bd3beaa6f3
commit
8997a97ce9
|
@ -78,6 +78,7 @@ class Typification(ModelSQL, ModelView):
|
|||
by_default = fields.Boolean('By default', select=True)
|
||||
calc_decimals = fields.Integer('Calculation decimals', required=True)
|
||||
significant_digits = fields.Integer('Significant digits')
|
||||
scientific_notation = fields.Boolean('Scientific notation')
|
||||
report = fields.Boolean('Report')
|
||||
report_type = fields.Selection([
|
||||
('normal', 'Normal'),
|
||||
|
@ -137,6 +138,10 @@ class Typification(ModelSQL, ModelView):
|
|||
def default_calc_decimals():
|
||||
return 2
|
||||
|
||||
@staticmethod
|
||||
def default_scientific_notation():
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
def default_report():
|
||||
return True
|
||||
|
@ -423,7 +428,7 @@ class Typification(ModelSQL, ModelView):
|
|||
fields_check = ('detection_limit', 'quantification_limit',
|
||||
'lower_limit', 'upper_limit', 'initial_concentration',
|
||||
'final_concentration', 'start_uom', 'end_uom',
|
||||
'calc_decimals', 'significant_digits')
|
||||
'calc_decimals', 'significant_digits', 'scientific_notation')
|
||||
for field in fields_check:
|
||||
if field in vals:
|
||||
cls.update_laboratory_notebook(typifications)
|
||||
|
@ -468,6 +473,7 @@ class Typification(ModelSQL, ModelView):
|
|||
typification.end_uom.id or None),
|
||||
'decimals': typification.calc_decimals,
|
||||
'significant_digits': typification.significant_digits,
|
||||
'scientific_notation': typification.scientific_notation,
|
||||
})
|
||||
|
||||
# Update RM
|
||||
|
@ -2352,6 +2358,7 @@ class UpdateTypificationStart(ModelView):
|
|||
default_repetitions = fields.Integer('Default repetitions')
|
||||
calc_decimals = fields.Integer('Calculation decimals')
|
||||
significant_digits = fields.Integer('Significant digits')
|
||||
scientific_notation = fields.Boolean('Scientific notation')
|
||||
report = fields.Boolean('Report')
|
||||
referable = fields.Boolean('Referred by default')
|
||||
update_detection_limit = fields.Boolean('Update Detection limit')
|
||||
|
@ -2369,6 +2376,7 @@ class UpdateTypificationStart(ModelView):
|
|||
update_default_repetitions = fields.Boolean('Update Default repetitions')
|
||||
update_calc_decimals = fields.Boolean('Update Calculation decimals')
|
||||
update_significant_digits = fields.Boolean('Update Significant digits')
|
||||
update_scientific_notation = fields.Boolean('Update Scientific notation')
|
||||
update_report = fields.Boolean('Update Report')
|
||||
update_referable = fields.Boolean('Update Referred by default')
|
||||
|
||||
|
|
|
@ -952,7 +952,7 @@ class EntryDetailAnalysis(ModelSQL, ModelView):
|
|||
'initial_concentration, final_concentration, start_uom, '
|
||||
'end_uom, detection_limit, quantification_limit, '
|
||||
'lower_limit, upper_limit, calc_decimals, '
|
||||
'significant_digits, report '
|
||||
'significant_digits, scientific_notation, report '
|
||||
'FROM "' + Typification._table + '" '
|
||||
'WHERE product_type = %s '
|
||||
'AND matrix = %s '
|
||||
|
@ -976,7 +976,8 @@ class EntryDetailAnalysis(ModelSQL, ModelView):
|
|||
upper_limit = _str_value(typification[8])
|
||||
decimals = typification[9]
|
||||
significant_digits = typification[10]
|
||||
report = typification[11]
|
||||
scientific_notation = typification[11]
|
||||
report = typification[12]
|
||||
else:
|
||||
repetitions = 0
|
||||
initial_concentration = None
|
||||
|
@ -989,6 +990,7 @@ class EntryDetailAnalysis(ModelSQL, ModelView):
|
|||
upper_limit = None
|
||||
decimals = 2
|
||||
significant_digits = None
|
||||
scientific_notation = False
|
||||
report = False
|
||||
|
||||
results_estimated_waiting = None
|
||||
|
@ -1046,6 +1048,7 @@ class EntryDetailAnalysis(ModelSQL, ModelView):
|
|||
'upper_limit': upper_limit,
|
||||
'decimals': decimals,
|
||||
'significant_digits': significant_digits,
|
||||
'scientific_notation': scientific_notation,
|
||||
'report': report,
|
||||
'results_estimated_waiting': results_estimated_waiting,
|
||||
'department': department,
|
||||
|
|
|
@ -3111,6 +3111,10 @@ msgctxt "field:lims.notebook.line,sample:"
|
|||
msgid "Sample"
|
||||
msgstr "Muestra"
|
||||
|
||||
msgctxt "field:lims.notebook.line,scientific_notation:"
|
||||
msgid "Scientific notation"
|
||||
msgstr "Notación científica"
|
||||
|
||||
msgctxt "field:lims.notebook.line,service:"
|
||||
msgid "Service"
|
||||
msgstr "Servicio"
|
||||
|
@ -3371,6 +3375,10 @@ msgctxt "field:lims.notebook.line.all_fields,rm_correction_formula:"
|
|||
msgid "RM Correction Formula"
|
||||
msgstr "Fórmula Corrección RM"
|
||||
|
||||
msgctxt "field:lims.notebook.line.all_fields,scientific_notation:"
|
||||
msgid "Scientific notation"
|
||||
msgstr "Notación científica"
|
||||
|
||||
msgctxt "field:lims.notebook.line.all_fields,service:"
|
||||
msgid "Service"
|
||||
msgstr "Servicio"
|
||||
|
@ -6008,6 +6016,10 @@ msgctxt "field:lims.typification,report_type:"
|
|||
msgid "Report type"
|
||||
msgstr "Tipo de informe"
|
||||
|
||||
msgctxt "field:lims.typification,scientific_notation:"
|
||||
msgid "Scientific notation"
|
||||
msgstr "Notación científica"
|
||||
|
||||
msgctxt "field:lims.typification,significant_digits:"
|
||||
msgid "Significant digits"
|
||||
msgstr "Cifras significativas"
|
||||
|
@ -6193,6 +6205,10 @@ msgctxt "field:lims.typification.update.start,report:"
|
|||
msgid "Report"
|
||||
msgstr "Informe"
|
||||
|
||||
msgctxt "field:lims.typification.update.start,scientific_notation:"
|
||||
msgid "Scientific notation"
|
||||
msgstr "Notación científica"
|
||||
|
||||
msgctxt "field:lims.typification.update.start,significant_digits:"
|
||||
msgid "Significant digits"
|
||||
msgstr "Cifras significativas"
|
||||
|
@ -6249,6 +6265,10 @@ msgctxt "field:lims.typification.update.start,update_report:"
|
|||
msgid "Update Report"
|
||||
msgstr "Actualizar Informe"
|
||||
|
||||
msgctxt "field:lims.typification.update.start,update_scientific_notation:"
|
||||
msgid "Update Scientific notation"
|
||||
msgstr "Actualizar Notación científica"
|
||||
|
||||
msgctxt "field:lims.typification.update.start,update_significant_digits:"
|
||||
msgid "Update Significant digits"
|
||||
msgstr "Actualizar Cifras significativas"
|
||||
|
|
|
@ -844,6 +844,8 @@ class NotebookLine(ModelSQL, ModelView):
|
|||
states=_states, depends=_depends)
|
||||
significant_digits = fields.Integer('Significant digits',
|
||||
states=_states, depends=_depends)
|
||||
scientific_notation = fields.Boolean('Scientific notation',
|
||||
states=_states, depends=_depends)
|
||||
backup = fields.Char('Backup',
|
||||
states=_states, depends=_depends)
|
||||
reference = fields.Char('Reference',
|
||||
|
@ -1481,7 +1483,8 @@ class NotebookLine(ModelSQL, ModelView):
|
|||
res = self.literal_result
|
||||
else:
|
||||
res = self._format_result(self.result,
|
||||
self.decimals, self.significant_digits)
|
||||
self.decimals, self.significant_digits,
|
||||
self.scientific_notation)
|
||||
if result_modifier == 'eq':
|
||||
res = res
|
||||
elif result_modifier == 'low':
|
||||
|
@ -1509,7 +1512,8 @@ class NotebookLine(ModelSQL, ModelView):
|
|||
result_modifier = self.converted_result_modifier
|
||||
if not self.literal_result:
|
||||
res = self._format_result(self.converted_result,
|
||||
self.decimals, self.significant_digits)
|
||||
self.decimals, self.significant_digits,
|
||||
self.scientific_notation)
|
||||
if result_modifier == 'eq':
|
||||
res = res
|
||||
elif result_modifier == 'low':
|
||||
|
@ -1532,7 +1536,8 @@ class NotebookLine(ModelSQL, ModelView):
|
|||
res = result_modifier
|
||||
return res
|
||||
|
||||
def _format_result(self, result, decimals, significant_digits=None):
|
||||
def _format_result(self, result, decimals, significant_digits=None,
|
||||
scientific_notation=False):
|
||||
res = ''
|
||||
if not result:
|
||||
return res
|
||||
|
@ -1540,8 +1545,7 @@ class NotebookLine(ModelSQL, ModelView):
|
|||
if significant_digits:
|
||||
res = ("{0:.%ie}" % (significant_digits - 1)).format(
|
||||
float(result))
|
||||
if (res[-3] in ('+', '-') and
|
||||
int(res[-2:]) < significant_digits):
|
||||
if not scientific_notation:
|
||||
res = str(float(res))
|
||||
if float(res) < 1 and len(res) < (significant_digits + 2):
|
||||
res = res.ljust(significant_digits + 2, '0')
|
||||
|
@ -1632,6 +1636,7 @@ class NotebookLineAllFields(ModelSQL, ModelView):
|
|||
'Concentration level', readonly=True)
|
||||
decimals = fields.Integer('Decimals', readonly=True)
|
||||
significant_digits = fields.Integer('Significant digits', readonly=True)
|
||||
scientific_notation = fields.Boolean('Scientific notation', readonly=True)
|
||||
backup = fields.Char('Backup', readonly=True)
|
||||
reference = fields.Char('Reference', readonly=True)
|
||||
literal_result = fields.Char('Literal result', readonly=True)
|
||||
|
@ -1736,6 +1741,7 @@ class NotebookLineAllFields(ModelSQL, ModelView):
|
|||
line.concentration_level,
|
||||
line.decimals,
|
||||
line.significant_digits,
|
||||
line.scientific_notation,
|
||||
line.backup,
|
||||
line.reference,
|
||||
line.literal_result,
|
||||
|
@ -4613,6 +4619,7 @@ class NotebookLineRepeatAnalysis(Wizard):
|
|||
'device': line.device.id if line.device else None,
|
||||
'decimals': line.decimals,
|
||||
'significant_digits': line.significant_digits,
|
||||
'scientific_notation': line.scientific_notation,
|
||||
'report': line.report,
|
||||
'results_estimated_waiting': (
|
||||
line.results_estimated_waiting),
|
||||
|
|
|
@ -1992,6 +1992,7 @@ class AddFractionControl(Wizard):
|
|||
'upper_limit': nline.upper_limit,
|
||||
'decimals': nline.decimals,
|
||||
'significant_digits': nline.significant_digits,
|
||||
'scientific_notation': nline.scientific_notation,
|
||||
'report': nline.report,
|
||||
'concentration_level': (nline.concentration_level.id if
|
||||
nline.concentration_level else None),
|
||||
|
@ -2670,6 +2671,7 @@ class AddFractionRMBMZ(Wizard):
|
|||
'upper_limit': nline.upper_limit,
|
||||
'decimals': nline.decimals,
|
||||
'significant_digits': nline.significant_digits,
|
||||
'scientific_notation': nline.scientific_notation,
|
||||
'report': nline.report,
|
||||
'concentration_level': (nline.concentration_level.id if
|
||||
nline.concentration_level else None),
|
||||
|
@ -3467,6 +3469,7 @@ class AddFractionMRT(Wizard):
|
|||
'upper_limit': nline.upper_limit,
|
||||
'decimals': nline.decimals,
|
||||
'significant_digits': nline.significant_digits,
|
||||
'scientific_notation': nline.scientific_notation,
|
||||
'report': nline.report,
|
||||
'concentration_level': (nline.concentration_level.id if
|
||||
nline.concentration_level else None),
|
||||
|
|
|
@ -68,11 +68,13 @@
|
|||
<field name="theoretical_concentration"/>
|
||||
<label name="concentration_level"/>
|
||||
<field name="concentration_level"/>
|
||||
<group id="decimals" colspan="2" col="4">
|
||||
<group id="decimals" colspan="4" col="6">
|
||||
<label name="decimals"/>
|
||||
<field name="decimals"/>
|
||||
<label name="significant_digits"/>
|
||||
<field name="significant_digits"/>
|
||||
<label name="scientific_notation"/>
|
||||
<field name="scientific_notation"/>
|
||||
</group>
|
||||
<label name="backup"/>
|
||||
<field name="backup"/>
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
<field name="concentration_level"/>
|
||||
<field name="decimals"/>
|
||||
<field name="significant_digits"/>
|
||||
<field name="scientific_notation"/>
|
||||
<field name="backup"/>
|
||||
<field name="reference"/>
|
||||
<field name="literal_result"/>
|
||||
|
|
|
@ -77,11 +77,13 @@
|
|||
<field name="theoretical_concentration"/>
|
||||
<label name="concentration_level"/>
|
||||
<field name="concentration_level"/>
|
||||
<group id="decimals" colspan="2" col="4">
|
||||
<group id="decimals" colspan="4" col="6">
|
||||
<label name="decimals"/>
|
||||
<field name="decimals"/>
|
||||
<label name="significant_digits"/>
|
||||
<field name="significant_digits"/>
|
||||
<label name="scientific_notation"/>
|
||||
<field name="scientific_notation"/>
|
||||
</group>
|
||||
<label name="backup"/>
|
||||
<field name="backup"/>
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
<field name="concentration_level"/>
|
||||
<field name="decimals"/>
|
||||
<field name="significant_digits"/>
|
||||
<field name="scientific_notation"/>
|
||||
<field name="backup"/>
|
||||
<field name="reference"/>
|
||||
<field name="literal_result"/>
|
||||
|
|
|
@ -32,10 +32,14 @@
|
|||
<field name="final_concentration"/>
|
||||
<label name="end_uom"/>
|
||||
<field name="end_uom"/>
|
||||
<label name="calc_decimals"/>
|
||||
<field name="calc_decimals"/>
|
||||
<label name="significant_digits"/>
|
||||
<field name="significant_digits"/>
|
||||
<group id="decimals" colspan="4" col="6">
|
||||
<label name="calc_decimals"/>
|
||||
<field name="calc_decimals"/>
|
||||
<label name="significant_digits"/>
|
||||
<field name="significant_digits"/>
|
||||
<label name="scientific_notation"/>
|
||||
<field name="scientific_notation"/>
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="Additional analysis" id="additionals" >
|
||||
<label name="additional"/>
|
||||
|
|
|
@ -52,6 +52,10 @@
|
|||
<field name="significant_digits"/>
|
||||
<label name="update_significant_digits"/>
|
||||
<field name="update_significant_digits"/>
|
||||
<label name="scientific_notation"/>
|
||||
<field name="scientific_notation"/>
|
||||
<label name="update_scientific_notation"/>
|
||||
<field name="update_scientific_notation"/>
|
||||
<label name="report"/>
|
||||
<field name="report"/>
|
||||
<label name="update_report"/>
|
||||
|
|
|
@ -643,6 +643,7 @@ class RepeatAnalysis(Wizard):
|
|||
'initial_concentration': nline_to_repeat.initial_concentration,
|
||||
'decimals': nline_to_repeat.decimals,
|
||||
'significant_digits': nline_to_repeat.significant_digits,
|
||||
'scientific_notation': nline_to_repeat.scientific_notation,
|
||||
'report': nline_to_repeat.report,
|
||||
'concentration_level': (nline_to_repeat.concentration_level.id
|
||||
if nline_to_repeat.concentration_level else None),
|
||||
|
|
Loading…
Reference in a new issue