|
@@ 1527-1549 (lines=23) @@
|
| 1524 |
|
)) |
| 1525 |
|
|
| 1526 |
|
|
| 1527 |
|
class UpperLimitOfQuantificationValidator(object): |
| 1528 |
|
"""Validates that the Upper Limit of Quantification (ULOD) is lower than |
| 1529 |
|
or equal to the Upper Limit of Detection (ULOD) |
| 1530 |
|
""" |
| 1531 |
|
implements(IValidator) |
| 1532 |
|
name = "upper_limit_of_quantification_validator" |
| 1533 |
|
|
| 1534 |
|
def __call__(self, value, **kwargs): |
| 1535 |
|
instance = kwargs["instance"] |
| 1536 |
|
field_name = kwargs["field"].getName() |
| 1537 |
|
|
| 1538 |
|
# get the value (or fallback to field's default) |
| 1539 |
|
default = instance.getField(field_name).getDefault(instance) |
| 1540 |
|
uloq = api.to_float(value, default) |
| 1541 |
|
|
| 1542 |
|
# compare with the lower limit of detection |
| 1543 |
|
form = kwargs["REQUEST"].form |
| 1544 |
|
ulod = form.get("UpperDetectionLimit", None) |
| 1545 |
|
ulod = api.to_float(ulod, uloq) |
| 1546 |
|
if uloq > ulod: |
| 1547 |
|
return _t(_( |
| 1548 |
|
u"validator_uloq_above_ulod", |
| 1549 |
|
default=u"The Upper Limit of Quantification (LLOQ) cannot be " |
| 1550 |
|
u"greater than the Upper Limit of Detection (ULOD)." |
| 1551 |
|
)) |
| 1552 |
|
|
|
@@ 1499-1521 (lines=23) @@
|
| 1496 |
|
)) |
| 1497 |
|
|
| 1498 |
|
|
| 1499 |
|
class LowerLimitOfQuantificationValidator(object): |
| 1500 |
|
"""Validates that the Lower Limit of Quantification (LLOQ) is lower than |
| 1501 |
|
the Upper Limit of Quantification (ULOQ) |
| 1502 |
|
""" |
| 1503 |
|
implements(IValidator) |
| 1504 |
|
name = "lower_limit_of_quantification_validator" |
| 1505 |
|
|
| 1506 |
|
def __call__(self, value, **kwargs): |
| 1507 |
|
instance = kwargs["instance"] |
| 1508 |
|
field_name = kwargs["field"].getName() |
| 1509 |
|
|
| 1510 |
|
# get the value (or fallback to field's default) |
| 1511 |
|
default = instance.getField(field_name).getDefault(instance) |
| 1512 |
|
lloq = api.to_float(value, default) |
| 1513 |
|
|
| 1514 |
|
# compare with the lower limit of detection |
| 1515 |
|
form = kwargs["REQUEST"].form |
| 1516 |
|
uloq = form.get("UpperLimitOfQuantification", None) |
| 1517 |
|
uloq = api.to_float(uloq, lloq) |
| 1518 |
|
if lloq >= uloq: |
| 1519 |
|
return _t(_( |
| 1520 |
|
u"validator_lloq_above_uloq", |
| 1521 |
|
default=u"The Lower Limit of Quantification (LLOQ) cannot be " |
| 1522 |
|
u"greater than or equal to the Upper Limit of " |
| 1523 |
|
u"Quantification (ULOQ)." |
| 1524 |
|
)) |
|
@@ 1472-1493 (lines=22) @@
|
| 1469 |
|
validation.register(ServiceConditionsValidator()) |
| 1470 |
|
|
| 1471 |
|
|
| 1472 |
|
class LowerLimitOfDetectionValidator(object): |
| 1473 |
|
"""Validates that the Lower Limit of Detection (LLOD) is lower than or |
| 1474 |
|
equal to the Lower Limit of Quantification (LLOQ) |
| 1475 |
|
""" |
| 1476 |
|
implements(IValidator) |
| 1477 |
|
name = "lower_limit_of_detection_validator" |
| 1478 |
|
|
| 1479 |
|
def __call__(self, value, **kwargs): |
| 1480 |
|
instance = kwargs["instance"] |
| 1481 |
|
field_name = kwargs["field"].getName() |
| 1482 |
|
|
| 1483 |
|
# get the value (or fallback to field's default) |
| 1484 |
|
default = instance.getField(field_name).getDefault(instance) |
| 1485 |
|
llod = api.to_float(value, default) |
| 1486 |
|
|
| 1487 |
|
form = kwargs["REQUEST"].form |
| 1488 |
|
lloq = form.get("LowerLimitOfQuantification", None) |
| 1489 |
|
lloq = api.to_float(lloq, llod) |
| 1490 |
|
if llod > lloq: |
| 1491 |
|
return _t(_( |
| 1492 |
|
u"validator_llod_above_lloq", |
| 1493 |
|
default=u"The Lower Limit of Detection (LLOD) cannot be " |
| 1494 |
|
u"greater than the Lower Limit of Quantification " |
| 1495 |
|
u"(LLOQ)." |
| 1496 |
|
)) |