-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Validate unique sample names per case
- Loading branch information
Showing
3 changed files
with
34 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 13 additions & 1 deletion
14
cg/services/order_validation_service/workflows/tomte/validation/inter_field/rules.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,25 @@ | ||
from cg.services.order_validation_service.models.errors import OccupiedWellError | ||
from cg.services.order_validation_service.models.errors import ( | ||
OccupiedWellError, | ||
ReusedSampleNameError, | ||
) | ||
from cg.services.order_validation_service.workflows.tomte.models.order import TomteOrder | ||
from cg.services.order_validation_service.workflows.tomte.validation.inter_field.utils import ( | ||
_get_errors, | ||
_get_excess_samples, | ||
_get_plate_samples, | ||
get_duplicate_sample_name_errors, | ||
) | ||
|
||
|
||
def validate_wells_contain_at_most_one_sample(order: TomteOrder) -> list[OccupiedWellError]: | ||
samples_with_cases = _get_plate_samples(order) | ||
samples = _get_excess_samples(samples_with_cases) | ||
return _get_errors(samples) | ||
|
||
|
||
def validate_unique_sample_names_in_cases(order: TomteOrder) -> list[ReusedSampleNameError]: | ||
errors: list[ReusedSampleNameError] = [] | ||
for case in order.cases: | ||
case_errors = get_duplicate_sample_name_errors(case) | ||
errors.extend(case_errors) | ||
return errors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters