From 8c013fba06714bbccca5679cfaf56bdb87fe6e7a Mon Sep 17 00:00:00 2001 From: Sebastian Diaz Date: Fri, 17 Jan 2025 11:01:54 +0100 Subject: [PATCH] move new validation service to orders --- cg/meta/orders/api.py | 8 +-- cg/meta/orders/ticket_handler.py | 6 +- cg/server/ext.py | 4 +- .../models/case_aliases.py | 6 -- .../models/order_aliases.py | 16 ----- .../models/sample_aliases.py | 25 ------- .../case_sample/pedigree/validate_pedigree.py | 14 ---- .../workflows/balsamic_umi/models/case.py | 16 ----- .../workflows/balsamic_umi/models/sample.py | 5 -- .../workflows/fastq/models/order.py | 12 ---- .../workflows/metagenome/models/order.py | 18 ----- .../workflows/microsalt/models/order.py | 12 ---- .../workflows/mip_dna/models/order.py | 14 ---- .../workflows/mip_rna/models/order.py | 20 ------ .../workflows/mutant/models/order.py | 12 ---- .../pacbio_long_read/models/order.py | 16 ----- .../workflows/rna_fusion/models/order.py | 18 ----- .../workflows/taxprofiler/models/order.py | 16 ----- .../workflows/tomte/models/order.py | 16 ----- .../service.py} | 6 +- .../errors => orders/storing}/__init__.py | 0 .../constants.py | 0 .../storing/implementations}/__init__.py | 0 .../implementations/case_order_service.py} | 12 ++-- .../implementations/fastq_order_service.py} | 10 +-- .../metagenome_order_service.py} | 14 ++-- .../microbial_fastq_order_service.py} | 10 ++- .../microbial_order_service.py} | 12 ++-- .../implementations/pacbio_order_service.py} | 10 ++- .../implementations/pool_order_service.py} | 8 +-- .../service.py} | 6 +- .../service_registry.py} | 26 +++---- .../case => orders/validation}/__init__.py | 0 .../validation}/constants.py | 0 .../validation/errors}/__init__.py | 0 .../validation}/errors/case_errors.py | 2 +- .../validation}/errors/case_sample_errors.py | 6 +- .../validation}/errors/order_errors.py | 0 .../validation}/errors/sample_errors.py | 6 +- .../validation}/errors/validation_errors.py | 8 +-- .../validation}/index_sequences.py | 2 +- .../model_validator/model_validator.py | 6 +- .../validation}/model_validator/utils.py | 14 ++-- .../validation/models}/__init__.py | 0 .../validation}/models/case.py | 6 +- .../orders/validation/models/case_aliases.py | 6 ++ .../validation}/models/discriminators.py | 0 .../validation}/models/existing_case.py | 0 .../validation}/models/existing_sample.py | 0 .../validation}/models/order.py | 0 .../orders/validation/models/order_aliases.py | 12 ++++ .../validation}/models/order_with_cases.py | 10 +-- .../validation}/models/order_with_samples.py | 4 +- .../validation}/models/sample.py | 0 .../validation/models/sample_aliases.py | 23 ++++++ .../validation}/order_type_maps.py | 72 +++++++++---------- .../validation}/response_mapper.py | 10 +-- .../validation/rules}/__init__.py | 0 .../validation/rules/case}/__init__.py | 0 .../validation}/rules/case/rules.py | 18 ++--- .../validation}/rules/case/utils.py | 4 +- .../validation/rules/case_sample}/__init__.py | 0 .../rules/case_sample/pedigree}/__init__.py | 0 .../rules/case_sample/pedigree/models.py | 8 +-- .../rules/case_sample/pedigree/utils.py | 10 +-- .../case_sample/pedigree/validate_pedigree.py | 14 ++++ .../validation}/rules/case_sample/rules.py | 16 ++--- .../validation}/rules/case_sample/utils.py | 16 ++--- .../validation/rules/order}/__init__.py | 0 .../validation}/rules/order/rules.py | 4 +- .../validation/rules/sample}/__init__.py | 0 .../validation}/rules/sample/rules.py | 14 ++-- .../validation}/rules/sample/utils.py | 18 ++--- .../validation}/rules/utils.py | 6 +- .../validation/service.py} | 22 +++--- .../validation}/utils.py | 12 ++-- .../validation/workflows}/__init__.py | 0 .../workflows/balsamic}/__init__.py | 0 .../workflows/balsamic/constants.py | 0 .../workflows/balsamic/models/case.py | 10 ++- .../workflows/balsamic/models/order.py | 10 +-- .../workflows/balsamic/models/sample.py | 6 +- .../validation}/workflows/balsamic/rules.py | 8 +-- .../validation}/workflows/balsamic/utils.py | 2 +- .../workflows/balsamic/validation_rules.py | 6 +- .../workflows/balsamic_umi/constants.py | 0 .../workflows/balsamic_umi/models/case.py | 14 ++++ .../workflows/balsamic_umi/models/order.py | 12 ++-- .../workflows/balsamic_umi/models/sample.py | 5 ++ .../balsamic_umi/validation_rules.py | 2 +- .../validation}/workflows/fastq/constants.py | 0 .../workflows/fastq/models/order.py | 12 ++++ .../workflows/fastq/models/sample.py | 6 +- .../workflows/fastq/validation_rules.py | 2 +- .../validation}/workflows/fluffy/constants.py | 0 .../workflows/fluffy/models/order.py | 6 +- .../workflows/fluffy/models/sample.py | 6 +- .../workflows/fluffy/validation_rules.py | 2 +- .../workflows/metagenome/constants.py | 0 .../workflows/metagenome/models/order.py | 12 ++++ .../workflows/metagenome/models/sample.py | 6 +- .../workflows/metagenome/validation_rules.py | 2 +- .../workflows/microbial_fastq/constants.py | 0 .../workflows/microbial_fastq/models/order.py | 6 +- .../microbial_fastq/models/sample.py | 6 +- .../microbial_fastq/validation_rules.py | 2 +- .../workflows/microsalt/constants.py | 0 .../workflows/microsalt/models/order.py | 12 ++++ .../workflows/microsalt/models/sample.py | 10 +-- .../workflows/microsalt/validation_rules.py | 2 +- .../workflows/mip_dna/models/case.py | 8 +-- .../workflows/mip_dna/models/order.py | 14 ++++ .../workflows/mip_dna/models/sample.py | 6 +- .../workflows/mip_dna/validation_rules.py | 4 +- .../workflows/mip_rna/constants.py | 0 .../workflows/mip_rna/models/case.py | 10 ++- .../workflows/mip_rna/models/order.py | 16 +++++ .../workflows/mip_rna/models/sample.py | 6 +- .../workflows/mip_rna/validation_rules.py | 4 +- .../validation}/workflows/mutant/constants.py | 0 .../workflows/mutant/models/order.py | 12 ++++ .../workflows/mutant/models/sample.py | 12 ++-- .../workflows/mutant/validation_rules.py | 2 +- .../workflows/order_validation_rules.py | 2 +- .../workflows/pacbio_long_read/constants.py | 0 .../pacbio_long_read/models/order.py | 12 ++++ .../pacbio_long_read/models/sample.py | 2 +- .../pacbio_long_read/validation_rules.py | 2 +- .../validation}/workflows/rml/constants.py | 0 .../validation}/workflows/rml/models/order.py | 6 +- .../workflows/rml/models/sample.py | 6 +- .../workflows/rml/validation_rules.py | 2 +- .../workflows/rna_fusion/constants.py | 0 .../workflows/rna_fusion/models/case.py | 8 +-- .../workflows/rna_fusion/models/order.py | 16 +++++ .../workflows/rna_fusion/models/sample.py | 6 +- .../workflows/rna_fusion/validation_rules.py | 4 +- .../workflows/taxprofiler/constants.py | 0 .../workflows/taxprofiler/models/order.py | 12 ++++ .../workflows/taxprofiler/models/sample.py | 6 +- .../workflows/taxprofiler/validation_rules.py | 2 +- .../validation}/workflows/tomte/constants.py | 0 .../workflows/tomte/models/case.py | 8 +-- .../workflows/tomte/models/order.py | 16 +++++ .../workflows/tomte/models/sample.py | 6 +- .../workflows/tomte/validation_rules.py | 4 +- tests/conftest.py | 2 +- .../orders_fixtures/order_fixtures.py | 30 ++++---- .../services_and_api_fixtures.py | 4 +- .../orders_fixtures/store_fixtures.py | 6 +- .../orders_fixtures/store_service_fixtures.py | 24 +++---- tests/meta/orders/test_meta_orders_api.py | 12 ++-- .../workflows/balsamic/__init__.py | 0 .../workflows/tomte/__init__.py | 0 .../test_order_lims_service.py | 16 ++--- .../test_fastq_order_service.py | 11 +-- .../test_generic_order_store_service.py | 12 ++-- .../test_metagenome_store_service.py | 7 +- ...est_microbial_fastq_order_store_service.py | 6 +- .../test_microbial_store_order_service.py | 8 +-- .../test_pacbio_order_service.py | 6 +- .../test_pool_order_store_service.py | 8 +-- .../conftest.py | 0 .../test_order_summary_service.py | 0 .../validation_service}/conftest.py | 16 ++--- .../sample_rules}/__init__.py | 0 .../sample_rules/conftest.py | 12 ++-- .../sample_rules/test_data_validators.py | 10 +-- .../test_inter_field_validators.py | 6 +- .../sample_rules/test_sample_rules.py | 20 +++--- .../validation_service}/test_case_rules.py | 12 ++-- .../test_case_sample_rules.py | 14 ++-- .../validation_service}/test_order_rules.py | 6 +- .../validation_service/workflows}/__init__.py | 0 .../workflows/balsamic}/__init__.py | 0 .../workflows/balsamic/conftest.py | 14 ++-- .../workflows/balsamic/test_rules.py | 12 ++-- .../balsamic/test_validation_integration.py | 6 +- .../workflows/tomte}/__init__.py | 0 .../workflows/tomte/test_case_sample_rules.py | 12 ++-- .../workflows/tomte/test_model_validation.py | 6 +- .../tomte/test_validation_integration.py | 6 +- tests/store/conftest.py | 4 +- 183 files changed, 646 insertions(+), 760 deletions(-) delete mode 100644 cg/services/order_validation_service/models/case_aliases.py delete mode 100644 cg/services/order_validation_service/models/order_aliases.py delete mode 100644 cg/services/order_validation_service/models/sample_aliases.py delete mode 100644 cg/services/order_validation_service/rules/case_sample/pedigree/validate_pedigree.py delete mode 100644 cg/services/order_validation_service/workflows/balsamic_umi/models/case.py delete mode 100644 cg/services/order_validation_service/workflows/balsamic_umi/models/sample.py delete mode 100644 cg/services/order_validation_service/workflows/fastq/models/order.py delete mode 100644 cg/services/order_validation_service/workflows/metagenome/models/order.py delete mode 100644 cg/services/order_validation_service/workflows/microsalt/models/order.py delete mode 100644 cg/services/order_validation_service/workflows/mip_dna/models/order.py delete mode 100644 cg/services/order_validation_service/workflows/mip_rna/models/order.py delete mode 100644 cg/services/order_validation_service/workflows/mutant/models/order.py delete mode 100644 cg/services/order_validation_service/workflows/pacbio_long_read/models/order.py delete mode 100644 cg/services/order_validation_service/workflows/rna_fusion/models/order.py delete mode 100644 cg/services/order_validation_service/workflows/taxprofiler/models/order.py delete mode 100644 cg/services/order_validation_service/workflows/tomte/models/order.py rename cg/services/orders/{order_lims_service/order_lims_service.py => lims_service/service.py} (88%) rename cg/services/{order_validation_service/errors => orders/storing}/__init__.py (100%) rename cg/services/orders/{store_order_services => storing}/constants.py (100%) rename cg/services/{order_validation_service/model_validator => orders/storing/implementations}/__init__.py (100%) rename cg/services/orders/{store_order_services/implementations/store_case_order.py => storing/implementations/case_order_service.py} (94%) rename cg/services/orders/{store_order_services/implementations/store_fastq_order_service.py => storing/implementations/fastq_order_service.py} (93%) rename cg/services/orders/{store_order_services/implementations/store_metagenome_order.py => storing/implementations/metagenome_order_service.py} (87%) rename cg/services/orders/{store_order_services/implementations/store_microbial_fastq_order_service.py => storing/implementations/microbial_fastq_order_service.py} (91%) rename cg/services/orders/{store_order_services/implementations/store_microbial_order.py => storing/implementations/microbial_order_service.py} (90%) rename cg/services/orders/{store_order_services/implementations/store_pacbio_order_service.py => storing/implementations/pacbio_order_service.py} (92%) rename cg/services/orders/{store_order_services/implementations/store_pool_order.py => storing/implementations/pool_order_service.py} (94%) rename cg/services/orders/{store_order_services/store_order_service.py => storing/service.py} (78%) rename cg/services/orders/{store_order_services/storing_service_registry.py => storing/service_registry.py} (77%) rename cg/services/{order_validation_service/rules/case => orders/validation}/__init__.py (100%) rename cg/services/{order_validation_service => orders/validation}/constants.py (100%) rename cg/services/{order_validation_service/rules/case_sample => orders/validation/errors}/__init__.py (100%) rename cg/services/{order_validation_service => orders/validation}/errors/case_errors.py (94%) rename cg/services/{order_validation_service => orders/validation}/errors/case_sample_errors.py (94%) rename cg/services/{order_validation_service => orders/validation}/errors/order_errors.py (100%) rename cg/services/{order_validation_service => orders/validation}/errors/sample_errors.py (94%) rename cg/services/{order_validation_service => orders/validation}/errors/validation_errors.py (56%) rename cg/services/{order_validation_service => orders/validation}/index_sequences.py (99%) rename cg/services/{order_validation_service => orders/validation}/model_validator/model_validator.py (66%) rename cg/services/{order_validation_service => orders/validation}/model_validator/utils.py (92%) rename cg/services/{order_validation_service/rules/case_sample/pedigree => orders/validation/models}/__init__.py (100%) rename cg/services/{order_validation_service => orders/validation}/models/case.py (89%) create mode 100644 cg/services/orders/validation/models/case_aliases.py rename cg/services/{order_validation_service => orders/validation}/models/discriminators.py (100%) rename cg/services/{order_validation_service => orders/validation}/models/existing_case.py (100%) rename cg/services/{order_validation_service => orders/validation}/models/existing_sample.py (100%) rename cg/services/{order_validation_service => orders/validation}/models/order.py (100%) create mode 100644 cg/services/orders/validation/models/order_aliases.py rename cg/services/{order_validation_service => orders/validation}/models/order_with_cases.py (77%) rename cg/services/{order_validation_service => orders/validation}/models/order_with_samples.py (54%) rename cg/services/{order_validation_service => orders/validation}/models/sample.py (100%) create mode 100644 cg/services/orders/validation/models/sample_aliases.py rename cg/services/{order_validation_service => orders/validation}/order_type_maps.py (52%) rename cg/services/{order_validation_service => orders/validation}/response_mapper.py (88%) rename cg/services/{order_validation_service/rules/order => orders/validation/rules}/__init__.py (100%) rename cg/services/{order_validation_service/rules/sample => orders/validation/rules/case}/__init__.py (100%) rename cg/services/{order_validation_service => orders/validation}/rules/case/rules.py (85%) rename cg/services/{order_validation_service => orders/validation}/rules/case/utils.py (83%) rename cg/services/{order_validation_service/workflows/fluffy => orders/validation/rules/case_sample}/__init__.py (100%) rename cg/services/{order_validation_service/workflows/fluffy/models => orders/validation/rules/case_sample/pedigree}/__init__.py (100%) rename cg/services/{order_validation_service => orders/validation}/rules/case_sample/pedigree/models.py (88%) rename cg/services/{order_validation_service => orders/validation}/rules/case_sample/pedigree/utils.py (84%) create mode 100644 cg/services/orders/validation/rules/case_sample/pedigree/validate_pedigree.py rename cg/services/{order_validation_service => orders/validation}/rules/case_sample/rules.py (95%) rename cg/services/{order_validation_service => orders/validation}/rules/case_sample/utils.py (94%) rename cg/services/{order_validation_service/workflows/microsalt => orders/validation/rules/order}/__init__.py (100%) rename cg/services/{order_validation_service => orders/validation}/rules/order/rules.py (90%) rename cg/services/{order_validation_service/workflows/microsalt/models => orders/validation/rules/sample}/__init__.py (100%) rename cg/services/{order_validation_service => orders/validation}/rules/sample/rules.py (96%) rename cg/services/{order_validation_service => orders/validation}/rules/sample/utils.py (93%) rename cg/services/{order_validation_service => orders/validation}/rules/utils.py (91%) rename cg/services/{order_validation_service/order_validation_service.py => orders/validation/service.py} (77%) rename cg/services/{order_validation_service => orders/validation}/utils.py (79%) rename cg/services/{order_validation_service/workflows/mutant/models => orders/validation/workflows}/__init__.py (100%) rename cg/services/orders/{store_order_services => validation/workflows/balsamic}/__init__.py (100%) rename cg/services/{order_validation_service => orders/validation}/workflows/balsamic/constants.py (100%) rename cg/services/{order_validation_service => orders/validation}/workflows/balsamic/models/case.py (51%) rename cg/services/{order_validation_service => orders/validation}/workflows/balsamic/models/order.py (59%) rename cg/services/{order_validation_service => orders/validation}/workflows/balsamic/models/sample.py (80%) rename cg/services/{order_validation_service => orders/validation}/workflows/balsamic/rules.py (64%) rename cg/services/{order_validation_service => orders/validation}/workflows/balsamic/utils.py (82%) rename cg/services/{order_validation_service => orders/validation}/workflows/balsamic/validation_rules.py (91%) rename cg/services/{order_validation_service => orders/validation}/workflows/balsamic_umi/constants.py (100%) create mode 100644 cg/services/orders/validation/workflows/balsamic_umi/models/case.py rename cg/services/{order_validation_service => orders/validation}/workflows/balsamic_umi/models/order.py (58%) create mode 100644 cg/services/orders/validation/workflows/balsamic_umi/models/sample.py rename cg/services/{order_validation_service => orders/validation}/workflows/balsamic_umi/validation_rules.py (70%) rename cg/services/{order_validation_service => orders/validation}/workflows/fastq/constants.py (100%) create mode 100644 cg/services/orders/validation/workflows/fastq/models/order.py rename cg/services/{order_validation_service => orders/validation}/workflows/fastq/models/sample.py (72%) rename cg/services/{order_validation_service => orders/validation}/workflows/fastq/validation_rules.py (94%) rename cg/services/{order_validation_service => orders/validation}/workflows/fluffy/constants.py (100%) rename cg/services/{order_validation_service => orders/validation}/workflows/fluffy/models/order.py (80%) rename cg/services/{order_validation_service => orders/validation}/workflows/fluffy/models/sample.py (76%) rename cg/services/{order_validation_service => orders/validation}/workflows/fluffy/validation_rules.py (94%) rename cg/services/{order_validation_service => orders/validation}/workflows/metagenome/constants.py (100%) create mode 100644 cg/services/orders/validation/workflows/metagenome/models/order.py rename cg/services/{order_validation_service => orders/validation}/workflows/metagenome/models/sample.py (68%) rename cg/services/{order_validation_service => orders/validation}/workflows/metagenome/validation_rules.py (93%) rename cg/services/{order_validation_service => orders/validation}/workflows/microbial_fastq/constants.py (100%) rename cg/services/{order_validation_service => orders/validation}/workflows/microbial_fastq/models/order.py (54%) rename cg/services/{order_validation_service => orders/validation}/workflows/microbial_fastq/models/sample.py (65%) rename cg/services/{order_validation_service => orders/validation}/workflows/microbial_fastq/validation_rules.py (93%) rename cg/services/{order_validation_service => orders/validation}/workflows/microsalt/constants.py (100%) create mode 100644 cg/services/orders/validation/workflows/microsalt/models/order.py rename cg/services/{order_validation_service => orders/validation}/workflows/microsalt/models/sample.py (68%) rename cg/services/{order_validation_service => orders/validation}/workflows/microsalt/validation_rules.py (93%) rename cg/services/{order_validation_service => orders/validation}/workflows/mip_dna/models/case.py (68%) create mode 100644 cg/services/orders/validation/workflows/mip_dna/models/order.py rename cg/services/{order_validation_service => orders/validation}/workflows/mip_dna/models/sample.py (80%) rename cg/services/{order_validation_service => orders/validation}/workflows/mip_dna/validation_rules.py (94%) rename cg/services/{order_validation_service => orders/validation}/workflows/mip_rna/constants.py (100%) rename cg/services/{order_validation_service => orders/validation}/workflows/mip_rna/models/case.py (51%) create mode 100644 cg/services/orders/validation/workflows/mip_rna/models/order.py rename cg/services/{order_validation_service => orders/validation}/workflows/mip_rna/models/sample.py (77%) rename cg/services/{order_validation_service => orders/validation}/workflows/mip_rna/validation_rules.py (93%) rename cg/services/{order_validation_service => orders/validation}/workflows/mutant/constants.py (100%) create mode 100644 cg/services/orders/validation/workflows/mutant/models/order.py rename cg/services/{order_validation_service => orders/validation}/workflows/mutant/models/sample.py (75%) rename cg/services/{order_validation_service => orders/validation}/workflows/mutant/validation_rules.py (93%) rename cg/services/{order_validation_service => orders/validation}/workflows/order_validation_rules.py (79%) rename cg/services/{order_validation_service => orders/validation}/workflows/pacbio_long_read/constants.py (100%) create mode 100644 cg/services/orders/validation/workflows/pacbio_long_read/models/order.py rename cg/services/{order_validation_service => orders/validation}/workflows/pacbio_long_read/models/sample.py (84%) rename cg/services/{order_validation_service => orders/validation}/workflows/pacbio_long_read/validation_rules.py (93%) rename cg/services/{order_validation_service => orders/validation}/workflows/rml/constants.py (100%) rename cg/services/{order_validation_service => orders/validation}/workflows/rml/models/order.py (80%) rename cg/services/{order_validation_service => orders/validation}/workflows/rml/models/sample.py (76%) rename cg/services/{order_validation_service => orders/validation}/workflows/rml/validation_rules.py (94%) rename cg/services/{order_validation_service => orders/validation}/workflows/rna_fusion/constants.py (100%) rename cg/services/{order_validation_service => orders/validation}/workflows/rna_fusion/models/case.py (52%) create mode 100644 cg/services/orders/validation/workflows/rna_fusion/models/order.py rename cg/services/{order_validation_service => orders/validation}/workflows/rna_fusion/models/sample.py (77%) rename cg/services/{order_validation_service => orders/validation}/workflows/rna_fusion/validation_rules.py (93%) rename cg/services/{order_validation_service => orders/validation}/workflows/taxprofiler/constants.py (100%) create mode 100644 cg/services/orders/validation/workflows/taxprofiler/models/order.py rename cg/services/{order_validation_service => orders/validation}/workflows/taxprofiler/models/sample.py (68%) rename cg/services/{order_validation_service => orders/validation}/workflows/taxprofiler/validation_rules.py (93%) rename cg/services/{order_validation_service => orders/validation}/workflows/tomte/constants.py (100%) rename cg/services/{order_validation_service => orders/validation}/workflows/tomte/models/case.py (68%) create mode 100644 cg/services/orders/validation/workflows/tomte/models/order.py rename cg/services/{order_validation_service => orders/validation}/workflows/tomte/models/sample.py (81%) rename cg/services/{order_validation_service => orders/validation}/workflows/tomte/validation_rules.py (94%) delete mode 100644 tests/services/order_validation_service/workflows/balsamic/__init__.py delete mode 100644 tests/services/order_validation_service/workflows/tomte/__init__.py rename tests/services/orders/{order_lims_service => lims_service}/test_order_lims_service.py (92%) rename tests/services/orders/{order_store_service => store_service}/test_fastq_order_service.py (93%) rename tests/services/orders/{order_store_service => store_service}/test_generic_order_store_service.py (90%) rename tests/services/orders/{order_store_service => store_service}/test_metagenome_store_service.py (66%) rename tests/services/orders/{order_store_service => store_service}/test_microbial_fastq_order_store_service.py (84%) rename tests/services/orders/{order_store_service => store_service}/test_microbial_store_order_service.py (90%) rename tests/services/orders/{order_store_service => store_service}/test_pacbio_order_service.py (90%) rename tests/services/orders/{order_store_service => store_service}/test_pool_order_store_service.py (91%) rename tests/services/orders/{order_status_service => summary_service}/conftest.py (100%) rename tests/services/orders/{order_status_service => summary_service}/test_order_summary_service.py (100%) rename tests/services/{order_validation_service => orders/validation_service}/conftest.py (92%) rename {cg/services/orders/store_order_services/implementations => tests/services/orders/validation_service/sample_rules}/__init__.py (100%) rename tests/services/{order_validation_service => orders/validation_service}/sample_rules/conftest.py (83%) rename tests/services/{order_validation_service => orders/validation_service}/sample_rules/test_data_validators.py (87%) rename tests/services/{order_validation_service => orders/validation_service}/sample_rules/test_inter_field_validators.py (85%) rename tests/services/{order_validation_service => orders/validation_service}/sample_rules/test_sample_rules.py (94%) rename tests/services/{order_validation_service => orders/validation_service}/test_case_rules.py (86%) rename tests/services/{order_validation_service => orders/validation_service}/test_case_sample_rules.py (96%) rename tests/services/{order_validation_service => orders/validation_service}/test_order_rules.py (91%) rename tests/services/{order_validation_service => orders/validation_service/workflows}/__init__.py (100%) rename tests/services/{order_validation_service/sample_rules => orders/validation_service/workflows/balsamic}/__init__.py (100%) rename tests/services/{order_validation_service => orders/validation_service}/workflows/balsamic/conftest.py (81%) rename tests/services/{order_validation_service => orders/validation_service}/workflows/balsamic/test_rules.py (87%) rename tests/services/{order_validation_service => orders/validation_service}/workflows/balsamic/test_validation_integration.py (91%) rename tests/services/{order_validation_service/workflows => orders/validation_service/workflows/tomte}/__init__.py (100%) rename tests/services/{order_validation_service => orders/validation_service}/workflows/tomte/test_case_sample_rules.py (91%) rename tests/services/{order_validation_service => orders/validation_service}/workflows/tomte/test_model_validation.py (94%) rename tests/services/{order_validation_service => orders/validation_service}/workflows/tomte/test_validation_integration.py (91%) diff --git a/cg/meta/orders/api.py b/cg/meta/orders/api.py index e466ba01e9..480195f3e9 100644 --- a/cg/meta/orders/api.py +++ b/cg/meta/orders/api.py @@ -12,10 +12,10 @@ from cg.apps.lims import LimsAPI from cg.meta.orders.ticket_handler import TicketHandler from cg.models.orders.constants import OrderType -from cg.services.order_validation_service.models.order import Order -from cg.services.order_validation_service.order_validation_service import OrderValidationService -from cg.services.orders.store_order_services.store_order_service import StoreOrderService -from cg.services.orders.store_order_services.storing_service_registry import StoringServiceRegistry +from cg.services.orders.storing.service import StoreOrderService +from cg.services.orders.storing.service_registry import StoringServiceRegistry +from cg.services.orders.validation.models.order import Order +from cg.services.orders.validation.service import OrderValidationService from cg.store.models import User LOG = logging.getLogger(__name__) diff --git a/cg/meta/orders/ticket_handler.py b/cg/meta/orders/ticket_handler.py index 2627053aa8..54ff979156 100644 --- a/cg/meta/orders/ticket_handler.py +++ b/cg/meta/orders/ticket_handler.py @@ -6,10 +6,10 @@ from cg.clients.freshdesk.freshdesk_client import FreshdeskClient from cg.clients.freshdesk.models import TicketCreate, TicketResponse from cg.models.orders.constants import OrderType -from cg.services.order_validation_service.models.order import Order -from cg.services.order_validation_service.models.order_with_cases import OrderWithCases -from cg.services.order_validation_service.models.order_with_samples import OrderWithSamples from cg.services.orders.constants import ORDER_TYPE_WORKFLOW_MAP +from cg.services.orders.validation.models.order import Order +from cg.services.orders.validation.models.order_with_cases import OrderWithCases +from cg.services.orders.validation.models.order_with_samples import OrderWithSamples from cg.store.models import Customer, Sample from cg.store.store import Store diff --git a/cg/server/ext.py b/cg/server/ext.py index fee60f462c..d8b9d18b00 100644 --- a/cg/server/ext.py +++ b/cg/server/ext.py @@ -12,13 +12,13 @@ from cg.server.app_config import app_config from cg.services.application.service import ApplicationsWebService from cg.services.delivery_message.delivery_message_service import DeliveryMessageService -from cg.services.order_validation_service.order_validation_service import OrderValidationService from cg.services.orders.order_service.order_service import OrderService from cg.services.orders.order_summary_service.order_summary_service import OrderSummaryService -from cg.services.orders.store_order_services.storing_service_registry import ( +from cg.services.orders.storing.service_registry import ( StoringServiceRegistry, setup_storing_service_registry, ) +from cg.services.orders.validation.service import OrderValidationService from cg.services.sample_run_metrics_service.sample_run_metrics_service import ( SampleRunMetricsService, ) diff --git a/cg/services/order_validation_service/models/case_aliases.py b/cg/services/order_validation_service/models/case_aliases.py deleted file mode 100644 index ffae294367..0000000000 --- a/cg/services/order_validation_service/models/case_aliases.py +++ /dev/null @@ -1,6 +0,0 @@ -from cg.services.order_validation_service.workflows.mip_dna.models.case import MipDnaCase -from cg.services.order_validation_service.workflows.tomte.models.case import TomteCase - -CaseContainingRelatives = TomteCase | MipDnaCase - -CaseWithSkipRC = TomteCase | MipDnaCase diff --git a/cg/services/order_validation_service/models/order_aliases.py b/cg/services/order_validation_service/models/order_aliases.py deleted file mode 100644 index 6ad046cac4..0000000000 --- a/cg/services/order_validation_service/models/order_aliases.py +++ /dev/null @@ -1,16 +0,0 @@ -from cg.services.order_validation_service.workflows.fluffy.models.order import FluffyOrder -from cg.services.order_validation_service.workflows.metagenome.models.sample import MetagenomeSample -from cg.services.order_validation_service.workflows.microbial_fastq.models.order import ( - MicrobialFastqOrder, -) -from cg.services.order_validation_service.workflows.microsalt.models.order import MicrosaltOrder -from cg.services.order_validation_service.workflows.mutant.models.order import MutantOrder -from cg.services.order_validation_service.workflows.rml.models.order import RmlOrder -from cg.services.order_validation_service.workflows.taxprofiler.models.sample import ( - TaxprofilerSample, -) - -OrderWithIndexedSamples = FluffyOrder | RmlOrder -OrderWithControlSamples = ( - MetagenomeSample | MicrobialFastqOrder | MicrosaltOrder | MutantOrder | TaxprofilerSample -) diff --git a/cg/services/order_validation_service/models/sample_aliases.py b/cg/services/order_validation_service/models/sample_aliases.py deleted file mode 100644 index a7e41836c5..0000000000 --- a/cg/services/order_validation_service/models/sample_aliases.py +++ /dev/null @@ -1,25 +0,0 @@ -from cg.services.order_validation_service.workflows.balsamic.models.sample import BalsamicSample -from cg.services.order_validation_service.workflows.balsamic_umi.models.sample import ( - BalsamicUmiSample, -) -from cg.services.order_validation_service.workflows.fastq.models.sample import FastqSample -from cg.services.order_validation_service.workflows.fluffy.models.sample import FluffySample -from cg.services.order_validation_service.workflows.mip_dna.models.sample import MipDnaSample -from cg.services.order_validation_service.workflows.mip_rna.models.sample import MipRnaSample -from cg.services.order_validation_service.workflows.rml.models.sample import RmlSample -from cg.services.order_validation_service.workflows.rna_fusion.models.sample import RnaFusionSample -from cg.services.order_validation_service.workflows.tomte.models.sample import TomteSample - -HumanSample = ( - BalsamicSample | BalsamicUmiSample | FastqSample | MipDnaSample | RnaFusionSample | TomteSample -) - -IndexedSample = FluffySample | RmlSample - -SampleInCase = ( - BalsamicSample | BalsamicUmiSample | MipDnaSample | MipRnaSample | RnaFusionSample | TomteSample -) - -SampleWithRelatives = TomteSample | MipDnaSample - -SampleWithSkipRC = TomteSample | MipDnaSample | FastqSample diff --git a/cg/services/order_validation_service/rules/case_sample/pedigree/validate_pedigree.py b/cg/services/order_validation_service/rules/case_sample/pedigree/validate_pedigree.py deleted file mode 100644 index e631bac608..0000000000 --- a/cg/services/order_validation_service/rules/case_sample/pedigree/validate_pedigree.py +++ /dev/null @@ -1,14 +0,0 @@ -from cg.services.order_validation_service.errors.case_sample_errors import PedigreeError -from cg.services.order_validation_service.rules.case_sample.pedigree.models import FamilyTree -from cg.services.order_validation_service.rules.case_sample.pedigree.utils import validate_tree -from cg.services.order_validation_service.workflows.mip_dna.models.case import MipDnaCase -from cg.services.order_validation_service.workflows.tomte.models.case import TomteCase -from cg.store.store import Store - - -def get_pedigree_errors( - case: TomteCase | MipDnaCase, case_index: int, store: Store -) -> list[PedigreeError]: - """Return a list of errors if any sample is labelled as its own ancestor in the family tree.""" - pedigree = FamilyTree(case=case, case_index=case_index, store=store) - return validate_tree(pedigree) diff --git a/cg/services/order_validation_service/workflows/balsamic_umi/models/case.py b/cg/services/order_validation_service/workflows/balsamic_umi/models/case.py deleted file mode 100644 index 670c92ee4e..0000000000 --- a/cg/services/order_validation_service/workflows/balsamic_umi/models/case.py +++ /dev/null @@ -1,16 +0,0 @@ -from pydantic import Discriminator, Tag -from typing_extensions import Annotated - -from cg.services.order_validation_service.models.discriminators import has_internal_id -from cg.services.order_validation_service.models.existing_sample import ExistingSample -from cg.services.order_validation_service.workflows.balsamic.models.case import BalsamicCase -from cg.services.order_validation_service.workflows.balsamic_umi.models.sample import ( - BalsamicUmiSample, -) - -NewSample = Annotated[BalsamicUmiSample, Tag("new")] -OldSample = Annotated[ExistingSample, Tag("existing")] - - -class BalsamicUmiCase(BalsamicCase): - samples: list[Annotated[NewSample | OldSample, Discriminator(has_internal_id)]] diff --git a/cg/services/order_validation_service/workflows/balsamic_umi/models/sample.py b/cg/services/order_validation_service/workflows/balsamic_umi/models/sample.py deleted file mode 100644 index 85b24a43c3..0000000000 --- a/cg/services/order_validation_service/workflows/balsamic_umi/models/sample.py +++ /dev/null @@ -1,5 +0,0 @@ -from cg.services.order_validation_service.workflows.balsamic.models.sample import BalsamicSample - - -class BalsamicUmiSample(BalsamicSample): - pass diff --git a/cg/services/order_validation_service/workflows/fastq/models/order.py b/cg/services/order_validation_service/workflows/fastq/models/order.py deleted file mode 100644 index f90d1e861c..0000000000 --- a/cg/services/order_validation_service/workflows/fastq/models/order.py +++ /dev/null @@ -1,12 +0,0 @@ -from cg.services.order_validation_service.models.order_with_samples import OrderWithSamples -from cg.services.order_validation_service.workflows.fastq.constants import FastqDeliveryType -from cg.services.order_validation_service.workflows.fastq.models.sample import FastqSample - - -class FastqOrder(OrderWithSamples): - delivery_type: FastqDeliveryType - samples: list[FastqSample] - - @property - def enumerated_samples(self) -> enumerate[FastqSample]: - return enumerate(self.samples) diff --git a/cg/services/order_validation_service/workflows/metagenome/models/order.py b/cg/services/order_validation_service/workflows/metagenome/models/order.py deleted file mode 100644 index 9fbca37689..0000000000 --- a/cg/services/order_validation_service/workflows/metagenome/models/order.py +++ /dev/null @@ -1,18 +0,0 @@ -from cg.services.order_validation_service.models.order_with_samples import ( - OrderWithSamples, -) -from cg.services.order_validation_service.workflows.metagenome.constants import ( - MetagenomeDeliveryType, -) -from cg.services.order_validation_service.workflows.metagenome.models.sample import ( - MetagenomeSample, -) - - -class MetagenomeOrder(OrderWithSamples): - delivery_type: MetagenomeDeliveryType - samples: list[MetagenomeSample] - - @property - def enumerated_samples(self) -> enumerate[MetagenomeSample]: - return enumerate(self.samples) diff --git a/cg/services/order_validation_service/workflows/microsalt/models/order.py b/cg/services/order_validation_service/workflows/microsalt/models/order.py deleted file mode 100644 index a91e20e922..0000000000 --- a/cg/services/order_validation_service/workflows/microsalt/models/order.py +++ /dev/null @@ -1,12 +0,0 @@ -from cg.services.order_validation_service.models.order_with_samples import OrderWithSamples -from cg.services.order_validation_service.workflows.microsalt.constants import MicrosaltDeliveryType -from cg.services.order_validation_service.workflows.microsalt.models.sample import MicrosaltSample - - -class MicrosaltOrder(OrderWithSamples): - delivery_type: MicrosaltDeliveryType - samples: list[MicrosaltSample] - - @property - def enumerated_samples(self) -> enumerate[MicrosaltSample]: - return enumerate(self.samples) diff --git a/cg/services/order_validation_service/workflows/mip_dna/models/order.py b/cg/services/order_validation_service/workflows/mip_dna/models/order.py deleted file mode 100644 index c79226cc43..0000000000 --- a/cg/services/order_validation_service/workflows/mip_dna/models/order.py +++ /dev/null @@ -1,14 +0,0 @@ -from pydantic import Discriminator, Tag -from typing_extensions import Annotated - -from cg.services.order_validation_service.models.discriminators import has_internal_id -from cg.services.order_validation_service.models.existing_case import ExistingCase -from cg.services.order_validation_service.models.order_with_cases import OrderWithCases -from cg.services.order_validation_service.workflows.mip_dna.models.case import MipDnaCase - -NewCase = Annotated[MipDnaCase, Tag("new")] -OldCase = Annotated[ExistingCase, Tag("existing")] - - -class MipDnaOrder(OrderWithCases): - cases: list[Annotated[NewCase | OldCase, Discriminator(has_internal_id)]] diff --git a/cg/services/order_validation_service/workflows/mip_rna/models/order.py b/cg/services/order_validation_service/workflows/mip_rna/models/order.py deleted file mode 100644 index 587e55de08..0000000000 --- a/cg/services/order_validation_service/workflows/mip_rna/models/order.py +++ /dev/null @@ -1,20 +0,0 @@ -from pydantic import Discriminator, Tag -from typing_extensions import Annotated - -from cg.services.order_validation_service.models.discriminators import has_internal_id -from cg.services.order_validation_service.models.existing_case import ExistingCase -from cg.services.order_validation_service.models.order_with_cases import OrderWithCases -from cg.services.order_validation_service.workflows.mip_rna.constants import ( - MipRnaDeliveryType, -) -from cg.services.order_validation_service.workflows.mip_rna.models.case import ( - MipRnaCase, -) - -NewCase = Annotated[MipRnaCase, Tag("new")] -OldCase = Annotated[ExistingCase, Tag("existing")] - - -class MipRnaOrder(OrderWithCases): - cases: list[Annotated[NewCase | OldCase, Discriminator(has_internal_id)]] - delivery_type: MipRnaDeliveryType diff --git a/cg/services/order_validation_service/workflows/mutant/models/order.py b/cg/services/order_validation_service/workflows/mutant/models/order.py deleted file mode 100644 index f231cc3631..0000000000 --- a/cg/services/order_validation_service/workflows/mutant/models/order.py +++ /dev/null @@ -1,12 +0,0 @@ -from cg.services.order_validation_service.models.order_with_samples import OrderWithSamples -from cg.services.order_validation_service.workflows.mutant.constants import MutantDeliveryType -from cg.services.order_validation_service.workflows.mutant.models.sample import MutantSample - - -class MutantOrder(OrderWithSamples): - delivery_type: MutantDeliveryType - samples: list[MutantSample] - - @property - def enumerated_samples(self) -> enumerate[MutantSample]: - return enumerate(self.samples) diff --git a/cg/services/order_validation_service/workflows/pacbio_long_read/models/order.py b/cg/services/order_validation_service/workflows/pacbio_long_read/models/order.py deleted file mode 100644 index cc94ffadc4..0000000000 --- a/cg/services/order_validation_service/workflows/pacbio_long_read/models/order.py +++ /dev/null @@ -1,16 +0,0 @@ -from cg.services.order_validation_service.models.order_with_samples import OrderWithSamples -from cg.services.order_validation_service.workflows.pacbio_long_read.constants import ( - PacbioDeliveryType, -) -from cg.services.order_validation_service.workflows.pacbio_long_read.models.sample import ( - PacbioSample, -) - - -class PacbioOrder(OrderWithSamples): - delivery_type: PacbioDeliveryType - samples: list[PacbioSample] - - @property - def enumerated_samples(self) -> enumerate[PacbioSample]: - return enumerate(self.samples) diff --git a/cg/services/order_validation_service/workflows/rna_fusion/models/order.py b/cg/services/order_validation_service/workflows/rna_fusion/models/order.py deleted file mode 100644 index 87eb3a1234..0000000000 --- a/cg/services/order_validation_service/workflows/rna_fusion/models/order.py +++ /dev/null @@ -1,18 +0,0 @@ -from pydantic import Discriminator, Tag -from typing_extensions import Annotated - -from cg.services.order_validation_service.models.discriminators import has_internal_id -from cg.services.order_validation_service.models.existing_case import ExistingCase -from cg.services.order_validation_service.models.order_with_cases import OrderWithCases -from cg.services.order_validation_service.workflows.rna_fusion.constants import ( - RnaFusionDeliveryType, -) -from cg.services.order_validation_service.workflows.rna_fusion.models.case import RnaFusionCase - -NewCase = Annotated[RnaFusionCase, Tag("new")] -OldCase = Annotated[ExistingCase, Tag("existing")] - - -class RnaFusionOrder(OrderWithCases): - cases: list[Annotated[NewCase | OldCase, Discriminator(has_internal_id)]] - delivery_type: RnaFusionDeliveryType diff --git a/cg/services/order_validation_service/workflows/taxprofiler/models/order.py b/cg/services/order_validation_service/workflows/taxprofiler/models/order.py deleted file mode 100644 index 611c813d49..0000000000 --- a/cg/services/order_validation_service/workflows/taxprofiler/models/order.py +++ /dev/null @@ -1,16 +0,0 @@ -from cg.services.order_validation_service.models.order_with_samples import OrderWithSamples -from cg.services.order_validation_service.workflows.taxprofiler.constants import ( - TaxprofilerDeliveryType, -) -from cg.services.order_validation_service.workflows.taxprofiler.models.sample import ( - TaxprofilerSample, -) - - -class TaxprofilerOrder(OrderWithSamples): - delivery_type: TaxprofilerDeliveryType - samples: list[TaxprofilerSample] - - @property - def enumerated_samples(self) -> enumerate[TaxprofilerSample]: - return enumerate(self.samples) diff --git a/cg/services/order_validation_service/workflows/tomte/models/order.py b/cg/services/order_validation_service/workflows/tomte/models/order.py deleted file mode 100644 index 333495cbf8..0000000000 --- a/cg/services/order_validation_service/workflows/tomte/models/order.py +++ /dev/null @@ -1,16 +0,0 @@ -from pydantic import Discriminator, Tag -from typing_extensions import Annotated - -from cg.services.order_validation_service.models.discriminators import has_internal_id -from cg.services.order_validation_service.models.existing_case import ExistingCase -from cg.services.order_validation_service.models.order_with_cases import OrderWithCases -from cg.services.order_validation_service.workflows.tomte.constants import TomteDeliveryType -from cg.services.order_validation_service.workflows.tomte.models.case import TomteCase - -NewCase = Annotated[TomteCase, Tag("new")] -OldCase = Annotated[ExistingCase, Tag("existing")] - - -class TomteOrder(OrderWithCases): - cases: list[Annotated[NewCase | OldCase, Discriminator(has_internal_id)]] - delivery_type: TomteDeliveryType diff --git a/cg/services/orders/order_lims_service/order_lims_service.py b/cg/services/orders/lims_service/service.py similarity index 88% rename from cg/services/orders/order_lims_service/order_lims_service.py rename to cg/services/orders/lims_service/service.py index 59b0e5cdb2..ad35311301 100644 --- a/cg/services/orders/order_lims_service/order_lims_service.py +++ b/cg/services/orders/lims_service/service.py @@ -3,9 +3,9 @@ from cg.apps.lims import LimsAPI from cg.constants import DataDelivery, Workflow from cg.models.lims.sample import LimsSample -from cg.services.order_validation_service.models.sample import Sample -from cg.services.order_validation_service.workflows.microsalt.models.sample import MicrosaltSample -from cg.services.order_validation_service.workflows.mutant.models.sample import MutantSample +from cg.services.orders.validation.models.sample import Sample +from cg.services.orders.validation.workflows.microsalt.models.sample import MicrosaltSample +from cg.services.orders.validation.workflows.mutant.models.sample import MutantSample LOG = logging.getLogger(__name__) diff --git a/cg/services/order_validation_service/errors/__init__.py b/cg/services/orders/storing/__init__.py similarity index 100% rename from cg/services/order_validation_service/errors/__init__.py rename to cg/services/orders/storing/__init__.py diff --git a/cg/services/orders/store_order_services/constants.py b/cg/services/orders/storing/constants.py similarity index 100% rename from cg/services/orders/store_order_services/constants.py rename to cg/services/orders/storing/constants.py diff --git a/cg/services/order_validation_service/model_validator/__init__.py b/cg/services/orders/storing/implementations/__init__.py similarity index 100% rename from cg/services/order_validation_service/model_validator/__init__.py rename to cg/services/orders/storing/implementations/__init__.py diff --git a/cg/services/orders/store_order_services/implementations/store_case_order.py b/cg/services/orders/storing/implementations/case_order_service.py similarity index 94% rename from cg/services/orders/store_order_services/implementations/store_case_order.py rename to cg/services/orders/storing/implementations/case_order_service.py index 9f015e3307..3d174578c5 100644 --- a/cg/services/orders/store_order_services/implementations/store_case_order.py +++ b/cg/services/orders/storing/implementations/case_order_service.py @@ -3,13 +3,13 @@ from cg.constants.constants import CaseActions, DataDelivery, Workflow from cg.constants.pedigree import Pedigree -from cg.services.order_validation_service.models.case import Case -from cg.services.order_validation_service.models.existing_case import ExistingCase -from cg.services.order_validation_service.models.order_with_cases import OrderWithCases -from cg.services.order_validation_service.models.sample_aliases import SampleInCase from cg.services.orders.constants import ORDER_TYPE_WORKFLOW_MAP -from cg.services.orders.order_lims_service.order_lims_service import OrderLimsService -from cg.services.orders.store_order_services.store_order_service import StoreOrderService +from cg.services.orders.lims_service.service import OrderLimsService +from cg.services.orders.storing.service import StoreOrderService +from cg.services.orders.validation.models.case import Case +from cg.services.orders.validation.models.existing_case import ExistingCase +from cg.services.orders.validation.models.order_with_cases import OrderWithCases +from cg.services.orders.validation.models.sample_aliases import SampleInCase from cg.store.models import ApplicationVersion from cg.store.models import Case as DbCase from cg.store.models import CaseSample, Customer diff --git a/cg/services/orders/store_order_services/implementations/store_fastq_order_service.py b/cg/services/orders/storing/implementations/fastq_order_service.py similarity index 93% rename from cg/services/orders/store_order_services/implementations/store_fastq_order_service.py rename to cg/services/orders/storing/implementations/fastq_order_service.py index 30f21bf882..16f674b6c6 100644 --- a/cg/services/orders/store_order_services/implementations/store_fastq_order_service.py +++ b/cg/services/orders/storing/implementations/fastq_order_service.py @@ -5,11 +5,11 @@ from cg.constants.constants import CustomerId from cg.constants.sequencing import SeqLibraryPrepCategory from cg.models.orders.sample_base import SexEnum, StatusEnum -from cg.services.order_validation_service.workflows.fastq.models.order import FastqOrder -from cg.services.order_validation_service.workflows.fastq.models.sample import FastqSample -from cg.services.orders.order_lims_service.order_lims_service import OrderLimsService -from cg.services.orders.store_order_services.constants import MAF_ORDER_ID -from cg.services.orders.store_order_services.store_order_service import StoreOrderService +from cg.services.orders.lims_service.service import OrderLimsService +from cg.services.orders.storing.constants import MAF_ORDER_ID +from cg.services.orders.storing.service import StoreOrderService +from cg.services.orders.validation.workflows.fastq.models.order import FastqOrder +from cg.services.orders.validation.workflows.fastq.models.sample import FastqSample from cg.store.models import ApplicationVersion, Case, CaseSample, Customer, Order, Sample from cg.store.store import Store diff --git a/cg/services/orders/store_order_services/implementations/store_metagenome_order.py b/cg/services/orders/storing/implementations/metagenome_order_service.py similarity index 87% rename from cg/services/orders/store_order_services/implementations/store_metagenome_order.py rename to cg/services/orders/storing/implementations/metagenome_order_service.py index 3b0b4d13d0..5fb318e882 100644 --- a/cg/services/orders/store_order_services/implementations/store_metagenome_order.py +++ b/cg/services/orders/storing/implementations/metagenome_order_service.py @@ -3,15 +3,13 @@ from cg.constants import DataDelivery, Sex from cg.models.orders.sample_base import PriorityEnum, StatusEnum -from cg.services.order_validation_service.workflows.metagenome.models.order import MetagenomeOrder -from cg.services.order_validation_service.workflows.metagenome.models.sample import MetagenomeSample -from cg.services.order_validation_service.workflows.taxprofiler.models.order import TaxprofilerOrder -from cg.services.order_validation_service.workflows.taxprofiler.models.sample import ( - TaxprofilerSample, -) from cg.services.orders.constants import ORDER_TYPE_WORKFLOW_MAP -from cg.services.orders.order_lims_service.order_lims_service import OrderLimsService -from cg.services.orders.store_order_services.store_order_service import StoreOrderService +from cg.services.orders.lims_service.service import OrderLimsService +from cg.services.orders.storing.service import StoreOrderService +from cg.services.orders.validation.workflows.metagenome.models.order import MetagenomeOrder +from cg.services.orders.validation.workflows.metagenome.models.sample import MetagenomeSample +from cg.services.orders.validation.workflows.taxprofiler.models.order import TaxprofilerOrder +from cg.services.orders.validation.workflows.taxprofiler.models.sample import TaxprofilerSample from cg.store.models import ApplicationVersion from cg.store.models import Case as DbCase from cg.store.models import CaseSample, Customer diff --git a/cg/services/orders/store_order_services/implementations/store_microbial_fastq_order_service.py b/cg/services/orders/storing/implementations/microbial_fastq_order_service.py similarity index 91% rename from cg/services/orders/store_order_services/implementations/store_microbial_fastq_order_service.py rename to cg/services/orders/storing/implementations/microbial_fastq_order_service.py index 0459593796..3b5b306ac8 100644 --- a/cg/services/orders/store_order_services/implementations/store_microbial_fastq_order_service.py +++ b/cg/services/orders/storing/implementations/microbial_fastq_order_service.py @@ -2,14 +2,12 @@ from cg.constants import DataDelivery, SexOptions, Workflow from cg.models.orders.sample_base import StatusEnum -from cg.services.order_validation_service.workflows.microbial_fastq.models.order import ( - MicrobialFastqOrder, -) -from cg.services.order_validation_service.workflows.microbial_fastq.models.sample import ( +from cg.services.orders.lims_service.service import OrderLimsService +from cg.services.orders.storing.service import StoreOrderService +from cg.services.orders.validation.workflows.microbial_fastq.models.order import MicrobialFastqOrder +from cg.services.orders.validation.workflows.microbial_fastq.models.sample import ( MicrobialFastqSample, ) -from cg.services.orders.order_lims_service.order_lims_service import OrderLimsService -from cg.services.orders.store_order_services.store_order_service import StoreOrderService from cg.store.models import ApplicationVersion, Case, CaseSample, Customer, Order, Sample from cg.store.store import Store diff --git a/cg/services/orders/store_order_services/implementations/store_microbial_order.py b/cg/services/orders/storing/implementations/microbial_order_service.py similarity index 90% rename from cg/services/orders/store_order_services/implementations/store_microbial_order.py rename to cg/services/orders/storing/implementations/microbial_order_service.py index 8a98609466..9d7e2bdc5f 100644 --- a/cg/services/orders/store_order_services/implementations/store_microbial_order.py +++ b/cg/services/orders/storing/implementations/microbial_order_service.py @@ -2,13 +2,13 @@ from datetime import datetime from cg.constants import DataDelivery, Sex -from cg.services.order_validation_service.workflows.microsalt.models.order import MicrosaltOrder -from cg.services.order_validation_service.workflows.microsalt.models.sample import MicrosaltSample -from cg.services.order_validation_service.workflows.mutant.models.order import MutantOrder -from cg.services.order_validation_service.workflows.mutant.models.sample import MutantSample from cg.services.orders.constants import ORDER_TYPE_WORKFLOW_MAP -from cg.services.orders.order_lims_service.order_lims_service import OrderLimsService -from cg.services.orders.store_order_services.store_order_service import StoreOrderService +from cg.services.orders.lims_service.service import OrderLimsService +from cg.services.orders.storing.service import StoreOrderService +from cg.services.orders.validation.workflows.microsalt.models.order import MicrosaltOrder +from cg.services.orders.validation.workflows.microsalt.models.sample import MicrosaltSample +from cg.services.orders.validation.workflows.mutant.models.order import MutantOrder +from cg.services.orders.validation.workflows.mutant.models.sample import MutantSample from cg.store.models import ApplicationVersion from cg.store.models import Case as DbCase from cg.store.models import CaseSample, Customer diff --git a/cg/services/orders/store_order_services/implementations/store_pacbio_order_service.py b/cg/services/orders/storing/implementations/pacbio_order_service.py similarity index 92% rename from cg/services/orders/store_order_services/implementations/store_pacbio_order_service.py rename to cg/services/orders/storing/implementations/pacbio_order_service.py index 2fab5ac060..1776a07b95 100644 --- a/cg/services/orders/store_order_services/implementations/store_pacbio_order_service.py +++ b/cg/services/orders/storing/implementations/pacbio_order_service.py @@ -3,12 +3,10 @@ from cg.constants import DataDelivery, Workflow from cg.models.orders.sample_base import StatusEnum -from cg.services.order_validation_service.workflows.pacbio_long_read.models.order import PacbioOrder -from cg.services.order_validation_service.workflows.pacbio_long_read.models.sample import ( - PacbioSample, -) -from cg.services.orders.order_lims_service.order_lims_service import OrderLimsService -from cg.services.orders.store_order_services.store_order_service import StoreOrderService +from cg.services.orders.lims_service.service import OrderLimsService +from cg.services.orders.storing.service import StoreOrderService +from cg.services.orders.validation.workflows.pacbio_long_read.models.order import PacbioOrder +from cg.services.orders.validation.workflows.pacbio_long_read.models.sample import PacbioSample from cg.store.models import ApplicationVersion, Case, CaseSample, Customer, Order, Sample from cg.store.store import Store diff --git a/cg/services/orders/store_order_services/implementations/store_pool_order.py b/cg/services/orders/storing/implementations/pool_order_service.py similarity index 94% rename from cg/services/orders/store_order_services/implementations/store_pool_order.py rename to cg/services/orders/storing/implementations/pool_order_service.py index 0fadb85fb0..0d6fa1da54 100644 --- a/cg/services/orders/store_order_services/implementations/store_pool_order.py +++ b/cg/services/orders/storing/implementations/pool_order_service.py @@ -2,11 +2,11 @@ from datetime import datetime from cg.models.orders.sample_base import PriorityEnum, SexEnum, StatusEnum -from cg.services.order_validation_service.models.order_aliases import OrderWithIndexedSamples -from cg.services.order_validation_service.models.sample_aliases import IndexedSample from cg.services.orders.constants import ORDER_TYPE_WORKFLOW_MAP -from cg.services.orders.order_lims_service.order_lims_service import OrderLimsService -from cg.services.orders.store_order_services.store_order_service import StoreOrderService +from cg.services.orders.lims_service.service import OrderLimsService +from cg.services.orders.storing.service import StoreOrderService +from cg.services.orders.validation.models.order_aliases import OrderWithIndexedSamples +from cg.services.orders.validation.models.sample_aliases import IndexedSample from cg.store.models import ApplicationVersion, Case, CaseSample, Customer, Order, Pool, Sample from cg.store.store import Store diff --git a/cg/services/orders/store_order_services/store_order_service.py b/cg/services/orders/storing/service.py similarity index 78% rename from cg/services/orders/store_order_services/store_order_service.py rename to cg/services/orders/storing/service.py index 3e85d7c74f..b4a5c675e4 100644 --- a/cg/services/orders/store_order_services/store_order_service.py +++ b/cg/services/orders/storing/service.py @@ -3,9 +3,9 @@ import logging from abc import ABC, abstractmethod -from cg.services.order_validation_service.models.order import Order -from cg.services.order_validation_service.models.sample import Sample -from cg.services.orders.order_lims_service.order_lims_service import OrderLimsService +from cg.services.orders.lims_service.service import OrderLimsService +from cg.services.orders.validation.models.order import Order +from cg.services.orders.validation.models.sample import Sample from cg.store.store import Store LOG = logging.getLogger(__name__) diff --git a/cg/services/orders/store_order_services/storing_service_registry.py b/cg/services/orders/storing/service_registry.py similarity index 77% rename from cg/services/orders/store_order_services/storing_service_registry.py rename to cg/services/orders/storing/service_registry.py index 5e4736d8d5..a0b56ae11b 100644 --- a/cg/services/orders/store_order_services/storing_service_registry.py +++ b/cg/services/orders/storing/service_registry.py @@ -1,28 +1,20 @@ from cg.apps.lims import LimsAPI from cg.models.orders.constants import OrderType -from cg.services.orders.order_lims_service.order_lims_service import OrderLimsService -from cg.services.orders.store_order_services.implementations.store_case_order import ( - StoreCaseOrderService, -) -from cg.services.orders.store_order_services.implementations.store_fastq_order_service import ( - StoreFastqOrderService, -) -from cg.services.orders.store_order_services.implementations.store_metagenome_order import ( +from cg.services.orders.lims_service.service import OrderLimsService +from cg.services.orders.storing.implementations.case_order_service import StoreCaseOrderService +from cg.services.orders.storing.implementations.fastq_order_service import StoreFastqOrderService +from cg.services.orders.storing.implementations.metagenome_order_service import ( StoreMetagenomeOrderService, ) -from cg.services.orders.store_order_services.implementations.store_microbial_fastq_order_service import ( +from cg.services.orders.storing.implementations.microbial_fastq_order_service import ( StoreMicrobialFastqOrderService, ) -from cg.services.orders.store_order_services.implementations.store_microbial_order import ( +from cg.services.orders.storing.implementations.microbial_order_service import ( StoreMicrobialOrderService, ) -from cg.services.orders.store_order_services.implementations.store_pacbio_order_service import ( - StorePacBioOrderService, -) -from cg.services.orders.store_order_services.implementations.store_pool_order import ( - StorePoolOrderService, -) -from cg.services.orders.store_order_services.store_order_service import StoreOrderService +from cg.services.orders.storing.implementations.pacbio_order_service import StorePacBioOrderService +from cg.services.orders.storing.implementations.pool_order_service import StorePoolOrderService +from cg.services.orders.storing.service import StoreOrderService from cg.store.store import Store diff --git a/cg/services/order_validation_service/rules/case/__init__.py b/cg/services/orders/validation/__init__.py similarity index 100% rename from cg/services/order_validation_service/rules/case/__init__.py rename to cg/services/orders/validation/__init__.py diff --git a/cg/services/order_validation_service/constants.py b/cg/services/orders/validation/constants.py similarity index 100% rename from cg/services/order_validation_service/constants.py rename to cg/services/orders/validation/constants.py diff --git a/cg/services/order_validation_service/rules/case_sample/__init__.py b/cg/services/orders/validation/errors/__init__.py similarity index 100% rename from cg/services/order_validation_service/rules/case_sample/__init__.py rename to cg/services/orders/validation/errors/__init__.py diff --git a/cg/services/order_validation_service/errors/case_errors.py b/cg/services/orders/validation/errors/case_errors.py similarity index 94% rename from cg/services/order_validation_service/errors/case_errors.py rename to cg/services/orders/validation/errors/case_errors.py index caacaab191..ae83cdc864 100644 --- a/cg/services/order_validation_service/errors/case_errors.py +++ b/cg/services/orders/validation/errors/case_errors.py @@ -1,4 +1,4 @@ -from cg.services.order_validation_service.errors.order_errors import OrderError +from cg.services.orders.validation.errors.order_errors import OrderError class CaseError(OrderError): diff --git a/cg/services/order_validation_service/errors/case_sample_errors.py b/cg/services/orders/validation/errors/case_sample_errors.py similarity index 94% rename from cg/services/order_validation_service/errors/case_sample_errors.py rename to cg/services/orders/validation/errors/case_sample_errors.py index 8a0ab6a314..dcae82bd93 100644 --- a/cg/services/order_validation_service/errors/case_sample_errors.py +++ b/cg/services/orders/validation/errors/case_sample_errors.py @@ -1,6 +1,6 @@ -from cg.services.order_validation_service.constants import MAXIMUM_VOLUME, MINIMUM_VOLUME -from cg.services.order_validation_service.errors.case_errors import CaseError -from cg.services.order_validation_service.errors.sample_errors import SampleError +from cg.services.orders.validation.constants import MAXIMUM_VOLUME, MINIMUM_VOLUME +from cg.services.orders.validation.errors.case_errors import CaseError +from cg.services.orders.validation.errors.sample_errors import SampleError class CaseSampleError(CaseError, SampleError): diff --git a/cg/services/order_validation_service/errors/order_errors.py b/cg/services/orders/validation/errors/order_errors.py similarity index 100% rename from cg/services/order_validation_service/errors/order_errors.py rename to cg/services/orders/validation/errors/order_errors.py diff --git a/cg/services/order_validation_service/errors/sample_errors.py b/cg/services/orders/validation/errors/sample_errors.py similarity index 94% rename from cg/services/order_validation_service/errors/sample_errors.py rename to cg/services/orders/validation/errors/sample_errors.py index 9e827e02eb..c0b48d4a12 100644 --- a/cg/services/order_validation_service/errors/sample_errors.py +++ b/cg/services/orders/validation/errors/sample_errors.py @@ -1,6 +1,6 @@ -from cg.services.order_validation_service.constants import MAXIMUM_VOLUME, MINIMUM_VOLUME, IndexEnum -from cg.services.order_validation_service.errors.order_errors import OrderError -from cg.services.order_validation_service.index_sequences import INDEX_SEQUENCES +from cg.services.orders.validation.constants import MAXIMUM_VOLUME, MINIMUM_VOLUME, IndexEnum +from cg.services.orders.validation.errors.order_errors import OrderError +from cg.services.orders.validation.index_sequences import INDEX_SEQUENCES class SampleError(OrderError): diff --git a/cg/services/order_validation_service/errors/validation_errors.py b/cg/services/orders/validation/errors/validation_errors.py similarity index 56% rename from cg/services/order_validation_service/errors/validation_errors.py rename to cg/services/orders/validation/errors/validation_errors.py index a9085a8f20..d2c8d59104 100644 --- a/cg/services/order_validation_service/errors/validation_errors.py +++ b/cg/services/orders/validation/errors/validation_errors.py @@ -1,9 +1,9 @@ from pydantic import BaseModel -from cg.services.order_validation_service.errors.case_errors import CaseError -from cg.services.order_validation_service.errors.case_sample_errors import CaseSampleError -from cg.services.order_validation_service.errors.order_errors import OrderError -from cg.services.order_validation_service.errors.sample_errors import SampleError +from cg.services.orders.validation.errors.case_errors import CaseError +from cg.services.orders.validation.errors.case_sample_errors import CaseSampleError +from cg.services.orders.validation.errors.order_errors import OrderError +from cg.services.orders.validation.errors.sample_errors import SampleError class ValidationErrors(BaseModel): diff --git a/cg/services/order_validation_service/index_sequences.py b/cg/services/orders/validation/index_sequences.py similarity index 99% rename from cg/services/order_validation_service/index_sequences.py rename to cg/services/orders/validation/index_sequences.py index 7a63931186..a602c96654 100644 --- a/cg/services/order_validation_service/index_sequences.py +++ b/cg/services/orders/validation/index_sequences.py @@ -1,4 +1,4 @@ -from cg.services.order_validation_service.constants import IndexEnum +from cg.services.orders.validation.constants import IndexEnum INDEX_SEQUENCES = { IndexEnum.AVIDA_INDEX_PLATE: [ diff --git a/cg/services/order_validation_service/model_validator/model_validator.py b/cg/services/orders/validation/model_validator/model_validator.py similarity index 66% rename from cg/services/order_validation_service/model_validator/model_validator.py rename to cg/services/orders/validation/model_validator/model_validator.py index 22cdc6c920..5ff97d792f 100644 --- a/cg/services/order_validation_service/model_validator/model_validator.py +++ b/cg/services/orders/validation/model_validator/model_validator.py @@ -2,9 +2,9 @@ from pydantic_core import ValidationError -from cg.services.order_validation_service.errors.validation_errors import ValidationErrors -from cg.services.order_validation_service.model_validator.utils import convert_errors -from cg.services.order_validation_service.models.order import Order +from cg.services.orders.validation.errors.validation_errors import ValidationErrors +from cg.services.orders.validation.model_validator.utils import convert_errors +from cg.services.orders.validation.models.order import Order ParsedOrder = TypeVar("ParsedOrder", bound=Order) diff --git a/cg/services/order_validation_service/model_validator/utils.py b/cg/services/orders/validation/model_validator/utils.py similarity index 92% rename from cg/services/order_validation_service/model_validator/utils.py rename to cg/services/orders/validation/model_validator/utils.py index e026451e69..a4e736e955 100644 --- a/cg/services/order_validation_service/model_validator/utils.py +++ b/cg/services/orders/validation/model_validator/utils.py @@ -1,14 +1,10 @@ from pydantic_core import ErrorDetails, ValidationError -from cg.services.order_validation_service.errors.case_errors import CaseError -from cg.services.order_validation_service.errors.case_sample_errors import ( - CaseSampleError, -) -from cg.services.order_validation_service.errors.order_errors import OrderError -from cg.services.order_validation_service.errors.sample_errors import SampleError -from cg.services.order_validation_service.errors.validation_errors import ( - ValidationErrors, -) +from cg.services.orders.validation.errors.case_errors import CaseError +from cg.services.orders.validation.errors.case_sample_errors import CaseSampleError +from cg.services.orders.validation.errors.order_errors import OrderError +from cg.services.orders.validation.errors.sample_errors import SampleError +from cg.services.orders.validation.errors.validation_errors import ValidationErrors def convert_errors(pydantic_errors: ValidationError) -> ValidationErrors: diff --git a/cg/services/order_validation_service/rules/case_sample/pedigree/__init__.py b/cg/services/orders/validation/models/__init__.py similarity index 100% rename from cg/services/order_validation_service/rules/case_sample/pedigree/__init__.py rename to cg/services/orders/validation/models/__init__.py diff --git a/cg/services/order_validation_service/models/case.py b/cg/services/orders/validation/models/case.py similarity index 89% rename from cg/services/order_validation_service/models/case.py rename to cg/services/orders/validation/models/case.py index 2f9ee67b7b..6c7207b547 100644 --- a/cg/services/order_validation_service/models/case.py +++ b/cg/services/orders/validation/models/case.py @@ -3,9 +3,9 @@ from cg.constants.priority import PriorityTerms from cg.models.orders.sample_base import NAME_PATTERN -from cg.services.order_validation_service.models.discriminators import has_internal_id -from cg.services.order_validation_service.models.existing_sample import ExistingSample -from cg.services.order_validation_service.models.sample_aliases import SampleInCase +from cg.services.orders.validation.models.discriminators import has_internal_id +from cg.services.orders.validation.models.existing_sample import ExistingSample +from cg.services.orders.validation.models.sample_aliases import SampleInCase NewSample = Annotated[SampleInCase, Tag("new")] ExistingSampleType = Annotated[ExistingSample, Tag("existing")] diff --git a/cg/services/orders/validation/models/case_aliases.py b/cg/services/orders/validation/models/case_aliases.py new file mode 100644 index 0000000000..6ea53d6895 --- /dev/null +++ b/cg/services/orders/validation/models/case_aliases.py @@ -0,0 +1,6 @@ +from cg.services.orders.validation.workflows.mip_dna.models.case import MipDnaCase +from cg.services.orders.validation.workflows.tomte.models.case import TomteCase + +CaseContainingRelatives = TomteCase | MipDnaCase + +CaseWithSkipRC = TomteCase | MipDnaCase diff --git a/cg/services/order_validation_service/models/discriminators.py b/cg/services/orders/validation/models/discriminators.py similarity index 100% rename from cg/services/order_validation_service/models/discriminators.py rename to cg/services/orders/validation/models/discriminators.py diff --git a/cg/services/order_validation_service/models/existing_case.py b/cg/services/orders/validation/models/existing_case.py similarity index 100% rename from cg/services/order_validation_service/models/existing_case.py rename to cg/services/orders/validation/models/existing_case.py diff --git a/cg/services/order_validation_service/models/existing_sample.py b/cg/services/orders/validation/models/existing_sample.py similarity index 100% rename from cg/services/order_validation_service/models/existing_sample.py rename to cg/services/orders/validation/models/existing_sample.py diff --git a/cg/services/order_validation_service/models/order.py b/cg/services/orders/validation/models/order.py similarity index 100% rename from cg/services/order_validation_service/models/order.py rename to cg/services/orders/validation/models/order.py diff --git a/cg/services/orders/validation/models/order_aliases.py b/cg/services/orders/validation/models/order_aliases.py new file mode 100644 index 0000000000..237d1427a4 --- /dev/null +++ b/cg/services/orders/validation/models/order_aliases.py @@ -0,0 +1,12 @@ +from cg.services.orders.validation.workflows.fluffy.models.order import FluffyOrder +from cg.services.orders.validation.workflows.metagenome.models.sample import MetagenomeSample +from cg.services.orders.validation.workflows.microbial_fastq.models.order import MicrobialFastqOrder +from cg.services.orders.validation.workflows.microsalt.models.order import MicrosaltOrder +from cg.services.orders.validation.workflows.mutant.models.order import MutantOrder +from cg.services.orders.validation.workflows.rml.models.order import RmlOrder +from cg.services.orders.validation.workflows.taxprofiler.models.sample import TaxprofilerSample + +OrderWithIndexedSamples = FluffyOrder | RmlOrder +OrderWithControlSamples = ( + MetagenomeSample | MicrobialFastqOrder | MicrosaltOrder | MutantOrder | TaxprofilerSample +) diff --git a/cg/services/order_validation_service/models/order_with_cases.py b/cg/services/orders/validation/models/order_with_cases.py similarity index 77% rename from cg/services/order_validation_service/models/order_with_cases.py rename to cg/services/orders/validation/models/order_with_cases.py index a15c996e83..574b4fe1ab 100644 --- a/cg/services/order_validation_service/models/order_with_cases.py +++ b/cg/services/orders/validation/models/order_with_cases.py @@ -1,11 +1,11 @@ from pydantic import Discriminator, Tag from typing_extensions import Annotated -from cg.services.order_validation_service.models.case import Case -from cg.services.order_validation_service.models.discriminators import has_internal_id -from cg.services.order_validation_service.models.existing_case import ExistingCase -from cg.services.order_validation_service.models.order import Order -from cg.services.order_validation_service.models.sample import Sample +from cg.services.orders.validation.models.case import Case +from cg.services.orders.validation.models.discriminators import has_internal_id +from cg.services.orders.validation.models.existing_case import ExistingCase +from cg.services.orders.validation.models.order import Order +from cg.services.orders.validation.models.sample import Sample NewCaseType = Annotated[Case, Tag("new")] ExistingCaseType = Annotated[ExistingCase, Tag("existing")] diff --git a/cg/services/order_validation_service/models/order_with_samples.py b/cg/services/orders/validation/models/order_with_samples.py similarity index 54% rename from cg/services/order_validation_service/models/order_with_samples.py rename to cg/services/orders/validation/models/order_with_samples.py index 449615225c..91f228d825 100644 --- a/cg/services/order_validation_service/models/order_with_samples.py +++ b/cg/services/orders/validation/models/order_with_samples.py @@ -1,5 +1,5 @@ -from cg.services.order_validation_service.models.order import Order -from cg.services.order_validation_service.models.sample import Sample +from cg.services.orders.validation.models.order import Order +from cg.services.orders.validation.models.sample import Sample class OrderWithSamples(Order): diff --git a/cg/services/order_validation_service/models/sample.py b/cg/services/orders/validation/models/sample.py similarity index 100% rename from cg/services/order_validation_service/models/sample.py rename to cg/services/orders/validation/models/sample.py diff --git a/cg/services/orders/validation/models/sample_aliases.py b/cg/services/orders/validation/models/sample_aliases.py new file mode 100644 index 0000000000..f89c26df76 --- /dev/null +++ b/cg/services/orders/validation/models/sample_aliases.py @@ -0,0 +1,23 @@ +from cg.services.orders.validation.workflows.balsamic.models.sample import BalsamicSample +from cg.services.orders.validation.workflows.balsamic_umi.models.sample import BalsamicUmiSample +from cg.services.orders.validation.workflows.fastq.models.sample import FastqSample +from cg.services.orders.validation.workflows.fluffy.models.sample import FluffySample +from cg.services.orders.validation.workflows.mip_dna.models.sample import MipDnaSample +from cg.services.orders.validation.workflows.mip_rna.models.sample import MipRnaSample +from cg.services.orders.validation.workflows.rml.models.sample import RmlSample +from cg.services.orders.validation.workflows.rna_fusion.models.sample import RnaFusionSample +from cg.services.orders.validation.workflows.tomte.models.sample import TomteSample + +HumanSample = ( + BalsamicSample | BalsamicUmiSample | FastqSample | MipDnaSample | RnaFusionSample | TomteSample +) + +IndexedSample = FluffySample | RmlSample + +SampleInCase = ( + BalsamicSample | BalsamicUmiSample | MipDnaSample | MipRnaSample | RnaFusionSample | TomteSample +) + +SampleWithRelatives = TomteSample | MipDnaSample + +SampleWithSkipRC = TomteSample | MipDnaSample | FastqSample diff --git a/cg/services/order_validation_service/order_type_maps.py b/cg/services/orders/validation/order_type_maps.py similarity index 52% rename from cg/services/order_validation_service/order_type_maps.py rename to cg/services/orders/validation/order_type_maps.py index 289dfb292d..dd2a31379b 100644 --- a/cg/services/order_validation_service/order_type_maps.py +++ b/cg/services/orders/validation/order_type_maps.py @@ -1,71 +1,63 @@ from pydantic import BaseModel, ConfigDict from cg.models.orders.constants import OrderType -from cg.services.order_validation_service.models.order import Order -from cg.services.order_validation_service.workflows.balsamic.models.order import BalsamicOrder -from cg.services.order_validation_service.workflows.balsamic.validation_rules import ( +from cg.services.orders.validation.models.order import Order +from cg.services.orders.validation.workflows.balsamic.models.order import BalsamicOrder +from cg.services.orders.validation.workflows.balsamic.validation_rules import ( BALSAMIC_CASE_RULES, BALSAMIC_CASE_SAMPLE_RULES, ) -from cg.services.order_validation_service.workflows.balsamic_umi.models.order import ( - BalsamicUmiOrder, -) -from cg.services.order_validation_service.workflows.balsamic_umi.validation_rules import ( +from cg.services.orders.validation.workflows.balsamic_umi.models.order import BalsamicUmiOrder +from cg.services.orders.validation.workflows.balsamic_umi.validation_rules import ( BALSAMIC_UMI_CASE_RULES, BALSAMIC_UMI_CASE_SAMPLE_RULES, ) -from cg.services.order_validation_service.workflows.fastq.models.order import FastqOrder -from cg.services.order_validation_service.workflows.fastq.validation_rules import FASTQ_SAMPLE_RULES -from cg.services.order_validation_service.workflows.fluffy.models.order import FluffyOrder -from cg.services.order_validation_service.workflows.fluffy.validation_rules import ( - FLUFFY_SAMPLE_RULES, -) -from cg.services.order_validation_service.workflows.metagenome.models.order import MetagenomeOrder -from cg.services.order_validation_service.workflows.metagenome.validation_rules import ( +from cg.services.orders.validation.workflows.fastq.models.order import FastqOrder +from cg.services.orders.validation.workflows.fastq.validation_rules import FASTQ_SAMPLE_RULES +from cg.services.orders.validation.workflows.fluffy.models.order import FluffyOrder +from cg.services.orders.validation.workflows.fluffy.validation_rules import FLUFFY_SAMPLE_RULES +from cg.services.orders.validation.workflows.metagenome.models.order import MetagenomeOrder +from cg.services.orders.validation.workflows.metagenome.validation_rules import ( METAGENOME_SAMPLE_RULES, ) -from cg.services.order_validation_service.workflows.microbial_fastq.models.order import ( - MicrobialFastqOrder, -) -from cg.services.order_validation_service.workflows.microbial_fastq.validation_rules import ( +from cg.services.orders.validation.workflows.microbial_fastq.models.order import MicrobialFastqOrder +from cg.services.orders.validation.workflows.microbial_fastq.validation_rules import ( MICROBIAL_FASTQ_SAMPLE_RULES, ) -from cg.services.order_validation_service.workflows.microsalt.models.order import MicrosaltOrder -from cg.services.order_validation_service.workflows.microsalt.validation_rules import ( +from cg.services.orders.validation.workflows.microsalt.models.order import MicrosaltOrder +from cg.services.orders.validation.workflows.microsalt.validation_rules import ( MICROSALT_SAMPLE_RULES, ) -from cg.services.order_validation_service.workflows.mip_dna.models.order import MipDnaOrder -from cg.services.order_validation_service.workflows.mip_dna.validation_rules import ( +from cg.services.orders.validation.workflows.mip_dna.models.order import MipDnaOrder +from cg.services.orders.validation.workflows.mip_dna.validation_rules import ( MIP_DNA_CASE_RULES, MIP_DNA_CASE_SAMPLE_RULES, ) -from cg.services.order_validation_service.workflows.mip_rna.models.order import MipRnaOrder -from cg.services.order_validation_service.workflows.mip_rna.validation_rules import ( +from cg.services.orders.validation.workflows.mip_rna.models.order import MipRnaOrder +from cg.services.orders.validation.workflows.mip_rna.validation_rules import ( MIP_RNA_CASE_RULES, MIP_RNA_CASE_SAMPLE_RULES, ) -from cg.services.order_validation_service.workflows.mutant.models.order import MutantOrder -from cg.services.order_validation_service.workflows.mutant.validation_rules import ( - MUTANT_SAMPLE_RULES, -) -from cg.services.order_validation_service.workflows.order_validation_rules import ORDER_RULES -from cg.services.order_validation_service.workflows.pacbio_long_read.models.order import PacbioOrder -from cg.services.order_validation_service.workflows.pacbio_long_read.validation_rules import ( +from cg.services.orders.validation.workflows.mutant.models.order import MutantOrder +from cg.services.orders.validation.workflows.mutant.validation_rules import MUTANT_SAMPLE_RULES +from cg.services.orders.validation.workflows.order_validation_rules import ORDER_RULES +from cg.services.orders.validation.workflows.pacbio_long_read.models.order import PacbioOrder +from cg.services.orders.validation.workflows.pacbio_long_read.validation_rules import ( PACBIO_LONG_READ_SAMPLE_RULES, ) -from cg.services.order_validation_service.workflows.rml.models.order import RmlOrder -from cg.services.order_validation_service.workflows.rml.validation_rules import RML_SAMPLE_RULES -from cg.services.order_validation_service.workflows.rna_fusion.models.order import RnaFusionOrder -from cg.services.order_validation_service.workflows.rna_fusion.validation_rules import ( +from cg.services.orders.validation.workflows.rml.models.order import RmlOrder +from cg.services.orders.validation.workflows.rml.validation_rules import RML_SAMPLE_RULES +from cg.services.orders.validation.workflows.rna_fusion.models.order import RnaFusionOrder +from cg.services.orders.validation.workflows.rna_fusion.validation_rules import ( RNAFUSION_CASE_RULES, RNAFUSION_CASE_SAMPLE_RULES, ) -from cg.services.order_validation_service.workflows.taxprofiler.models.order import TaxprofilerOrder -from cg.services.order_validation_service.workflows.taxprofiler.validation_rules import ( +from cg.services.orders.validation.workflows.taxprofiler.models.order import TaxprofilerOrder +from cg.services.orders.validation.workflows.taxprofiler.validation_rules import ( TAXPROFILER_SAMPLE_RULES, ) -from cg.services.order_validation_service.workflows.tomte.models.order import TomteOrder -from cg.services.order_validation_service.workflows.tomte.validation_rules import ( +from cg.services.orders.validation.workflows.tomte.models.order import TomteOrder +from cg.services.orders.validation.workflows.tomte.validation_rules import ( TOMTE_CASE_RULES, TOMTE_CASE_SAMPLE_RULES, ) diff --git a/cg/services/order_validation_service/response_mapper.py b/cg/services/orders/validation/response_mapper.py similarity index 88% rename from cg/services/order_validation_service/response_mapper.py rename to cg/services/orders/validation/response_mapper.py index 031f59a7e5..48c6537101 100644 --- a/cg/services/order_validation_service/response_mapper.py +++ b/cg/services/orders/validation/response_mapper.py @@ -1,10 +1,10 @@ from typing import Any -from cg.services.order_validation_service.errors.case_errors import CaseError -from cg.services.order_validation_service.errors.case_sample_errors import CaseSampleError -from cg.services.order_validation_service.errors.order_errors import OrderError -from cg.services.order_validation_service.errors.sample_errors import SampleError -from cg.services.order_validation_service.errors.validation_errors import ValidationErrors +from cg.services.orders.validation.errors.case_errors import CaseError +from cg.services.orders.validation.errors.case_sample_errors import CaseSampleError +from cg.services.orders.validation.errors.order_errors import OrderError +from cg.services.orders.validation.errors.sample_errors import SampleError +from cg.services.orders.validation.errors.validation_errors import ValidationErrors def create_order_validation_response(raw_order: dict, errors: ValidationErrors) -> dict: diff --git a/cg/services/order_validation_service/rules/order/__init__.py b/cg/services/orders/validation/rules/__init__.py similarity index 100% rename from cg/services/order_validation_service/rules/order/__init__.py rename to cg/services/orders/validation/rules/__init__.py diff --git a/cg/services/order_validation_service/rules/sample/__init__.py b/cg/services/orders/validation/rules/case/__init__.py similarity index 100% rename from cg/services/order_validation_service/rules/sample/__init__.py rename to cg/services/orders/validation/rules/case/__init__.py diff --git a/cg/services/order_validation_service/rules/case/rules.py b/cg/services/orders/validation/rules/case/rules.py similarity index 85% rename from cg/services/order_validation_service/rules/case/rules.py rename to cg/services/orders/validation/rules/case/rules.py index 011f7e3f46..110994f0b1 100644 --- a/cg/services/order_validation_service/rules/case/rules.py +++ b/cg/services/orders/validation/rules/case/rules.py @@ -1,4 +1,4 @@ -from cg.services.order_validation_service.errors.case_errors import ( +from cg.services.orders.validation.errors.case_errors import ( CaseDoesNotExistError, CaseNameNotAvailableError, DoubleNormalError, @@ -9,20 +9,16 @@ RepeatedCaseNameError, RepeatedGenePanelsError, ) -from cg.services.order_validation_service.models.case import Case -from cg.services.order_validation_service.models.order_with_cases import OrderWithCases -from cg.services.order_validation_service.rules.case.utils import ( +from cg.services.orders.validation.models.case import Case +from cg.services.orders.validation.models.order_with_cases import OrderWithCases +from cg.services.orders.validation.rules.case.utils import ( contains_duplicates, is_double_normal, is_double_tumour, ) -from cg.services.order_validation_service.rules.case_sample.utils import ( - get_repeated_case_name_errors, -) -from cg.services.order_validation_service.workflows.balsamic.models.order import BalsamicOrder -from cg.services.order_validation_service.workflows.balsamic_umi.models.order import ( - BalsamicUmiOrder, -) +from cg.services.orders.validation.rules.case_sample.utils import get_repeated_case_name_errors +from cg.services.orders.validation.workflows.balsamic.models.order import BalsamicOrder +from cg.services.orders.validation.workflows.balsamic_umi.models.order import BalsamicUmiOrder from cg.store.store import Store diff --git a/cg/services/order_validation_service/rules/case/utils.py b/cg/services/orders/validation/rules/case/utils.py similarity index 83% rename from cg/services/order_validation_service/rules/case/utils.py rename to cg/services/orders/validation/rules/case/utils.py index 798c0b9215..e3a57f7816 100644 --- a/cg/services/order_validation_service/rules/case/utils.py +++ b/cg/services/orders/validation/rules/case/utils.py @@ -1,5 +1,5 @@ -from cg.services.order_validation_service.workflows.balsamic.models.case import BalsamicCase -from cg.services.order_validation_service.workflows.balsamic_umi.models.case import BalsamicUmiCase +from cg.services.orders.validation.workflows.balsamic.models.case import BalsamicCase +from cg.services.orders.validation.workflows.balsamic_umi.models.case import BalsamicUmiCase from cg.store.models import Sample from cg.store.store import Store diff --git a/cg/services/order_validation_service/workflows/fluffy/__init__.py b/cg/services/orders/validation/rules/case_sample/__init__.py similarity index 100% rename from cg/services/order_validation_service/workflows/fluffy/__init__.py rename to cg/services/orders/validation/rules/case_sample/__init__.py diff --git a/cg/services/order_validation_service/workflows/fluffy/models/__init__.py b/cg/services/orders/validation/rules/case_sample/pedigree/__init__.py similarity index 100% rename from cg/services/order_validation_service/workflows/fluffy/models/__init__.py rename to cg/services/orders/validation/rules/case_sample/pedigree/__init__.py diff --git a/cg/services/order_validation_service/rules/case_sample/pedigree/models.py b/cg/services/orders/validation/rules/case_sample/pedigree/models.py similarity index 88% rename from cg/services/order_validation_service/rules/case_sample/pedigree/models.py rename to cg/services/orders/validation/rules/case_sample/pedigree/models.py index 817ac10237..e4a3129e62 100644 --- a/cg/services/order_validation_service/rules/case_sample/pedigree/models.py +++ b/cg/services/orders/validation/rules/case_sample/pedigree/models.py @@ -1,7 +1,7 @@ -from cg.services.order_validation_service.models.case_aliases import CaseContainingRelatives -from cg.services.order_validation_service.models.existing_sample import ExistingSample -from cg.services.order_validation_service.workflows.mip_dna.models.sample import MipDnaSample -from cg.services.order_validation_service.workflows.tomte.models.sample import TomteSample +from cg.services.orders.validation.models.case_aliases import CaseContainingRelatives +from cg.services.orders.validation.models.existing_sample import ExistingSample +from cg.services.orders.validation.workflows.mip_dna.models.sample import MipDnaSample +from cg.services.orders.validation.workflows.tomte.models.sample import TomteSample from cg.store.store import Store SampleWithParents = TomteSample | MipDnaSample | ExistingSample diff --git a/cg/services/order_validation_service/rules/case_sample/pedigree/utils.py b/cg/services/orders/validation/rules/case_sample/pedigree/utils.py similarity index 84% rename from cg/services/order_validation_service/rules/case_sample/pedigree/utils.py rename to cg/services/orders/validation/rules/case_sample/pedigree/utils.py index aa99c72939..51b42a7c97 100644 --- a/cg/services/order_validation_service/rules/case_sample/pedigree/utils.py +++ b/cg/services/orders/validation/rules/case_sample/pedigree/utils.py @@ -1,15 +1,15 @@ from cg.constants.pedigree import Pedigree -from cg.services.order_validation_service.errors.case_sample_errors import ( +from cg.services.orders.validation.errors.case_sample_errors import ( DescendantAsFatherError, DescendantAsMotherError, PedigreeError, SampleIsOwnFatherError, SampleIsOwnMotherError, ) -from cg.services.order_validation_service.models.existing_sample import ExistingSample -from cg.services.order_validation_service.rules.case_sample.pedigree.models import FamilyTree, Node -from cg.services.order_validation_service.workflows.mip_dna.models.sample import MipDnaSample -from cg.services.order_validation_service.workflows.tomte.models.sample import TomteSample +from cg.services.orders.validation.models.existing_sample import ExistingSample +from cg.services.orders.validation.rules.case_sample.pedigree.models import FamilyTree, Node +from cg.services.orders.validation.workflows.mip_dna.models.sample import MipDnaSample +from cg.services.orders.validation.workflows.tomte.models.sample import TomteSample def validate_tree(pedigree: FamilyTree) -> list[PedigreeError]: diff --git a/cg/services/orders/validation/rules/case_sample/pedigree/validate_pedigree.py b/cg/services/orders/validation/rules/case_sample/pedigree/validate_pedigree.py new file mode 100644 index 0000000000..6918d1bc41 --- /dev/null +++ b/cg/services/orders/validation/rules/case_sample/pedigree/validate_pedigree.py @@ -0,0 +1,14 @@ +from cg.services.orders.validation.errors.case_sample_errors import PedigreeError +from cg.services.orders.validation.rules.case_sample.pedigree.models import FamilyTree +from cg.services.orders.validation.rules.case_sample.pedigree.utils import validate_tree +from cg.services.orders.validation.workflows.mip_dna.models.case import MipDnaCase +from cg.services.orders.validation.workflows.tomte.models.case import TomteCase +from cg.store.store import Store + + +def get_pedigree_errors( + case: TomteCase | MipDnaCase, case_index: int, store: Store +) -> list[PedigreeError]: + """Return a list of errors if any sample is labelled as its own ancestor in the family tree.""" + pedigree = FamilyTree(case=case, case_index=case_index, store=store) + return validate_tree(pedigree) diff --git a/cg/services/order_validation_service/rules/case_sample/rules.py b/cg/services/orders/validation/rules/case_sample/rules.py similarity index 95% rename from cg/services/order_validation_service/rules/case_sample/rules.py rename to cg/services/orders/validation/rules/case_sample/rules.py index 30020773c3..edb355b6f8 100644 --- a/cg/services/order_validation_service/rules/case_sample/rules.py +++ b/cg/services/orders/validation/rules/case_sample/rules.py @@ -1,9 +1,9 @@ from collections import Counter from cg.models.orders.constants import OrderType -from cg.services.order_validation_service.constants import ALLOWED_SKIP_RC_BUFFERS -from cg.services.order_validation_service.errors.case_errors import InvalidGenePanelsError -from cg.services.order_validation_service.errors.case_sample_errors import ( +from cg.services.orders.validation.constants import ALLOWED_SKIP_RC_BUFFERS +from cg.services.orders.validation.errors.case_errors import InvalidGenePanelsError +from cg.services.orders.validation.errors.case_sample_errors import ( ApplicationArchivedError, ApplicationNotCompatibleError, ApplicationNotValidError, @@ -31,12 +31,12 @@ WellFormatError, WellPositionMissingError, ) -from cg.services.order_validation_service.models.order_with_cases import OrderWithCases -from cg.services.order_validation_service.models.sample_aliases import SampleInCase -from cg.services.order_validation_service.rules.case_sample.pedigree.validate_pedigree import ( +from cg.services.orders.validation.models.order_with_cases import OrderWithCases +from cg.services.orders.validation.models.sample_aliases import SampleInCase +from cg.services.orders.validation.rules.case_sample.pedigree.validate_pedigree import ( get_pedigree_errors, ) -from cg.services.order_validation_service.rules.case_sample.utils import ( +from cg.services.orders.validation.rules.case_sample.utils import ( are_all_samples_unknown, get_counter_container_names, get_existing_sample_names, @@ -57,7 +57,7 @@ validate_concentration_in_case, validate_subject_ids_in_case, ) -from cg.services.order_validation_service.rules.utils import ( +from cg.services.orders.validation.rules.utils import ( is_application_compatible, is_volume_invalid, is_volume_missing, diff --git a/cg/services/order_validation_service/rules/case_sample/utils.py b/cg/services/orders/validation/rules/case_sample/utils.py similarity index 94% rename from cg/services/order_validation_service/rules/case_sample/utils.py rename to cg/services/orders/validation/rules/case_sample/utils.py index e4701a5342..adedd92b5e 100644 --- a/cg/services/order_validation_service/rules/case_sample/utils.py +++ b/cg/services/orders/validation/rules/case_sample/utils.py @@ -4,8 +4,8 @@ from cg.constants.constants import StatusOptions from cg.constants.subject import Sex from cg.models.orders.sample_base import ContainerEnum, SexEnum -from cg.services.order_validation_service.errors.case_errors import RepeatedCaseNameError -from cg.services.order_validation_service.errors.case_sample_errors import ( +from cg.services.orders.validation.errors.case_errors import RepeatedCaseNameError +from cg.services.orders.validation.errors.case_sample_errors import ( FatherNotInCaseError, InvalidConcentrationIfSkipRCError, InvalidFatherSexError, @@ -14,19 +14,19 @@ OccupiedWellError, SubjectIdSameAsCaseNameError, ) -from cg.services.order_validation_service.models.case import Case -from cg.services.order_validation_service.models.case_aliases import ( +from cg.services.orders.validation.models.case import Case +from cg.services.orders.validation.models.case_aliases import ( CaseContainingRelatives, CaseWithSkipRC, ) -from cg.services.order_validation_service.models.order_with_cases import OrderWithCases -from cg.services.order_validation_service.models.sample import Sample -from cg.services.order_validation_service.models.sample_aliases import ( +from cg.services.orders.validation.models.order_with_cases import OrderWithCases +from cg.services.orders.validation.models.sample import Sample +from cg.services.orders.validation.models.sample_aliases import ( HumanSample, SampleInCase, SampleWithRelatives, ) -from cg.services.order_validation_service.rules.utils import ( +from cg.services.orders.validation.rules.utils import ( get_concentration_interval, has_sample_invalid_concentration, is_in_container, diff --git a/cg/services/order_validation_service/workflows/microsalt/__init__.py b/cg/services/orders/validation/rules/order/__init__.py similarity index 100% rename from cg/services/order_validation_service/workflows/microsalt/__init__.py rename to cg/services/orders/validation/rules/order/__init__.py diff --git a/cg/services/order_validation_service/rules/order/rules.py b/cg/services/orders/validation/rules/order/rules.py similarity index 90% rename from cg/services/order_validation_service/rules/order/rules.py rename to cg/services/orders/validation/rules/order/rules.py index 6b0f8086dc..e7bd52b3f3 100644 --- a/cg/services/order_validation_service/rules/order/rules.py +++ b/cg/services/orders/validation/rules/order/rules.py @@ -1,9 +1,9 @@ -from cg.services.order_validation_service.errors.order_errors import ( +from cg.services.orders.validation.errors.order_errors import ( CustomerCannotSkipReceptionControlError, CustomerDoesNotExistError, UserNotAssociatedWithCustomerError, ) -from cg.services.order_validation_service.models.order import Order +from cg.services.orders.validation.models.order import Order from cg.store.store import Store diff --git a/cg/services/order_validation_service/workflows/microsalt/models/__init__.py b/cg/services/orders/validation/rules/sample/__init__.py similarity index 100% rename from cg/services/order_validation_service/workflows/microsalt/models/__init__.py rename to cg/services/orders/validation/rules/sample/__init__.py diff --git a/cg/services/order_validation_service/rules/sample/rules.py b/cg/services/orders/validation/rules/sample/rules.py similarity index 96% rename from cg/services/order_validation_service/rules/sample/rules.py rename to cg/services/orders/validation/rules/sample/rules.py index f66cdc3dee..bf6a58f255 100644 --- a/cg/services/order_validation_service/rules/sample/rules.py +++ b/cg/services/orders/validation/rules/sample/rules.py @@ -1,5 +1,5 @@ from cg.models.orders.constants import OrderType -from cg.services.order_validation_service.errors.sample_errors import ( +from cg.services.orders.validation.errors.sample_errors import ( ApplicationArchivedError, ApplicationNotCompatibleError, ApplicationNotValidError, @@ -25,12 +25,12 @@ WellPositionMissingError, WellPositionRmlMissingError, ) -from cg.services.order_validation_service.models.order_aliases import ( +from cg.services.orders.validation.models.order_aliases import ( OrderWithControlSamples, OrderWithIndexedSamples, ) -from cg.services.order_validation_service.models.sample_aliases import IndexedSample -from cg.services.order_validation_service.rules.sample.utils import ( +from cg.services.orders.validation.models.sample_aliases import IndexedSample +from cg.services.orders.validation.rules.sample.utils import ( PlateSamplesValidator, get_indices_for_repeated_sample_names, get_indices_for_tube_repeated_container_name, @@ -48,13 +48,13 @@ validate_concentration_interval, validate_concentration_required, ) -from cg.services.order_validation_service.rules.utils import ( +from cg.services.orders.validation.rules.utils import ( is_application_compatible, is_volume_invalid, is_volume_missing, ) -from cg.services.order_validation_service.workflows.fastq.models.order import FastqOrder -from cg.services.order_validation_service.workflows.microsalt.models.order import OrderWithSamples +from cg.services.orders.validation.workflows.fastq.models.order import FastqOrder +from cg.services.orders.validation.workflows.microsalt.models.order import OrderWithSamples from cg.store.store import Store diff --git a/cg/services/order_validation_service/rules/sample/utils.py b/cg/services/orders/validation/rules/sample/utils.py similarity index 93% rename from cg/services/order_validation_service/rules/sample/utils.py rename to cg/services/orders/validation/rules/sample/utils.py index 34fe4f6eac..15bf38f765 100644 --- a/cg/services/order_validation_service/rules/sample/utils.py +++ b/cg/services/orders/validation/rules/sample/utils.py @@ -2,8 +2,8 @@ from collections import Counter from cg.models.orders.sample_base import ContainerEnum, ControlEnum -from cg.services.order_validation_service.constants import ALLOWED_SKIP_RC_BUFFERS, IndexEnum -from cg.services.order_validation_service.errors.sample_errors import ( +from cg.services.orders.validation.constants import ALLOWED_SKIP_RC_BUFFERS, IndexEnum +from cg.services.orders.validation.errors.sample_errors import ( BufferInvalidError, ConcentrationInvalidIfSkipRCError, ConcentrationRequiredError, @@ -13,18 +13,18 @@ SampleNameNotAvailableError, WellPositionMissingError, ) -from cg.services.order_validation_service.index_sequences import INDEX_SEQUENCES -from cg.services.order_validation_service.models.order_with_samples import OrderWithSamples -from cg.services.order_validation_service.models.sample import Sample -from cg.services.order_validation_service.models.sample_aliases import IndexedSample -from cg.services.order_validation_service.rules.utils import ( +from cg.services.orders.validation.index_sequences import INDEX_SEQUENCES +from cg.services.orders.validation.models.order_with_samples import OrderWithSamples +from cg.services.orders.validation.models.sample import Sample +from cg.services.orders.validation.models.sample_aliases import IndexedSample +from cg.services.orders.validation.rules.utils import ( get_application_concentration_interval, get_concentration_interval, has_sample_invalid_concentration, is_sample_cfdna, ) -from cg.services.order_validation_service.workflows.fastq.models.order import FastqOrder -from cg.services.order_validation_service.workflows.fastq.models.sample import FastqSample +from cg.services.orders.validation.workflows.fastq.models.order import FastqOrder +from cg.services.orders.validation.workflows.fastq.models.sample import FastqSample from cg.store.models import Application from cg.store.store import Store diff --git a/cg/services/order_validation_service/rules/utils.py b/cg/services/orders/validation/rules/utils.py similarity index 91% rename from cg/services/order_validation_service/rules/utils.py rename to cg/services/orders/validation/rules/utils.py index d9e7a7af7e..e8bd973bff 100644 --- a/cg/services/order_validation_service/rules/utils.py +++ b/cg/services/orders/validation/rules/utils.py @@ -1,9 +1,9 @@ from cg.constants.sample_sources import SourceType from cg.models.orders.constants import OrderType from cg.models.orders.sample_base import ContainerEnum -from cg.services.order_validation_service.constants import MAXIMUM_VOLUME, MINIMUM_VOLUME -from cg.services.order_validation_service.models.sample import Sample -from cg.services.order_validation_service.models.sample_aliases import SampleWithSkipRC +from cg.services.orders.validation.constants import MAXIMUM_VOLUME, MINIMUM_VOLUME +from cg.services.orders.validation.models.sample import Sample +from cg.services.orders.validation.models.sample_aliases import SampleWithSkipRC from cg.store.models import Application from cg.store.store import Store diff --git a/cg/services/order_validation_service/order_validation_service.py b/cg/services/orders/validation/service.py similarity index 77% rename from cg/services/order_validation_service/order_validation_service.py rename to cg/services/orders/validation/service.py index b26b2e9bb0..3ef2c95b58 100644 --- a/cg/services/order_validation_service/order_validation_service.py +++ b/cg/services/orders/validation/service.py @@ -1,20 +1,20 @@ from cg.exc import OrderError as OrderValidationError from cg.models.orders.constants import OrderType -from cg.services.order_validation_service.errors.case_errors import CaseError -from cg.services.order_validation_service.errors.case_sample_errors import CaseSampleError -from cg.services.order_validation_service.errors.order_errors import OrderError -from cg.services.order_validation_service.errors.sample_errors import SampleError -from cg.services.order_validation_service.errors.validation_errors import ValidationErrors -from cg.services.order_validation_service.model_validator.model_validator import ModelValidator -from cg.services.order_validation_service.models.order import Order -from cg.services.order_validation_service.models.order_with_cases import OrderWithCases -from cg.services.order_validation_service.order_type_maps import ( +from cg.services.orders.validation.errors.case_errors import CaseError +from cg.services.orders.validation.errors.case_sample_errors import CaseSampleError +from cg.services.orders.validation.errors.order_errors import OrderError +from cg.services.orders.validation.errors.sample_errors import SampleError +from cg.services.orders.validation.errors.validation_errors import ValidationErrors +from cg.services.orders.validation.model_validator.model_validator import ModelValidator +from cg.services.orders.validation.models.order import Order +from cg.services.orders.validation.models.order_with_cases import OrderWithCases +from cg.services.orders.validation.order_type_maps import ( ORDER_TYPE_MODEL_MAP, ORDER_TYPE_RULE_SET_MAP, RuleSet, ) -from cg.services.order_validation_service.response_mapper import create_order_validation_response -from cg.services.order_validation_service.utils import ( +from cg.services.orders.validation.response_mapper import create_order_validation_response +from cg.services.orders.validation.utils import ( apply_case_sample_validation, apply_case_validation, apply_order_validation, diff --git a/cg/services/order_validation_service/utils.py b/cg/services/orders/validation/utils.py similarity index 79% rename from cg/services/order_validation_service/utils.py rename to cg/services/orders/validation/utils.py index 3eb65f0a02..cc32c9905b 100644 --- a/cg/services/order_validation_service/utils.py +++ b/cg/services/orders/validation/utils.py @@ -1,12 +1,12 @@ from typing import Callable from cg.models.orders.sample_base import ControlEnum -from cg.services.order_validation_service.constants import ElutionBuffer, ExtractionMethod -from cg.services.order_validation_service.errors.case_errors import CaseError -from cg.services.order_validation_service.errors.case_sample_errors import CaseSampleError -from cg.services.order_validation_service.errors.order_errors import OrderError -from cg.services.order_validation_service.errors.sample_errors import SampleError -from cg.services.order_validation_service.models.order import Order +from cg.services.orders.validation.constants import ElutionBuffer, ExtractionMethod +from cg.services.orders.validation.errors.case_errors import CaseError +from cg.services.orders.validation.errors.case_sample_errors import CaseSampleError +from cg.services.orders.validation.errors.order_errors import OrderError +from cg.services.orders.validation.errors.sample_errors import SampleError +from cg.services.orders.validation.models.order import Order from cg.store.store import Store diff --git a/cg/services/order_validation_service/workflows/mutant/models/__init__.py b/cg/services/orders/validation/workflows/__init__.py similarity index 100% rename from cg/services/order_validation_service/workflows/mutant/models/__init__.py rename to cg/services/orders/validation/workflows/__init__.py diff --git a/cg/services/orders/store_order_services/__init__.py b/cg/services/orders/validation/workflows/balsamic/__init__.py similarity index 100% rename from cg/services/orders/store_order_services/__init__.py rename to cg/services/orders/validation/workflows/balsamic/__init__.py diff --git a/cg/services/order_validation_service/workflows/balsamic/constants.py b/cg/services/orders/validation/workflows/balsamic/constants.py similarity index 100% rename from cg/services/order_validation_service/workflows/balsamic/constants.py rename to cg/services/orders/validation/workflows/balsamic/constants.py diff --git a/cg/services/order_validation_service/workflows/balsamic/models/case.py b/cg/services/orders/validation/workflows/balsamic/models/case.py similarity index 51% rename from cg/services/order_validation_service/workflows/balsamic/models/case.py rename to cg/services/orders/validation/workflows/balsamic/models/case.py index 59bda05c99..03cda79259 100644 --- a/cg/services/order_validation_service/workflows/balsamic/models/case.py +++ b/cg/services/orders/validation/workflows/balsamic/models/case.py @@ -1,12 +1,10 @@ from pydantic import Discriminator, Tag from typing_extensions import Annotated -from cg.services.order_validation_service.models.case import Case -from cg.services.order_validation_service.models.discriminators import has_internal_id -from cg.services.order_validation_service.models.existing_sample import ExistingSample -from cg.services.order_validation_service.workflows.balsamic.models.sample import ( - BalsamicSample, -) +from cg.services.orders.validation.models.case import Case +from cg.services.orders.validation.models.discriminators import has_internal_id +from cg.services.orders.validation.models.existing_sample import ExistingSample +from cg.services.orders.validation.workflows.balsamic.models.sample import BalsamicSample NewSample = Annotated[BalsamicSample, Tag("new")] OldSample = Annotated[ExistingSample, Tag("existing")] diff --git a/cg/services/order_validation_service/workflows/balsamic/models/order.py b/cg/services/orders/validation/workflows/balsamic/models/order.py similarity index 59% rename from cg/services/order_validation_service/workflows/balsamic/models/order.py rename to cg/services/orders/validation/workflows/balsamic/models/order.py index c95f122380..a8ca38de79 100644 --- a/cg/services/order_validation_service/workflows/balsamic/models/order.py +++ b/cg/services/orders/validation/workflows/balsamic/models/order.py @@ -1,11 +1,11 @@ from pydantic import Discriminator, Tag from typing_extensions import Annotated -from cg.services.order_validation_service.models.discriminators import has_internal_id -from cg.services.order_validation_service.models.existing_case import ExistingCase -from cg.services.order_validation_service.models.order_with_cases import OrderWithCases -from cg.services.order_validation_service.workflows.balsamic.constants import BalsamicDeliveryType -from cg.services.order_validation_service.workflows.balsamic.models.case import BalsamicCase +from cg.services.orders.validation.models.discriminators import has_internal_id +from cg.services.orders.validation.models.existing_case import ExistingCase +from cg.services.orders.validation.models.order_with_cases import OrderWithCases +from cg.services.orders.validation.workflows.balsamic.constants import BalsamicDeliveryType +from cg.services.orders.validation.workflows.balsamic.models.case import BalsamicCase NewCase = Annotated[BalsamicCase, Tag("new")] OldCase = Annotated[ExistingCase, Tag("existing")] diff --git a/cg/services/order_validation_service/workflows/balsamic/models/sample.py b/cg/services/orders/validation/workflows/balsamic/models/sample.py similarity index 80% rename from cg/services/order_validation_service/workflows/balsamic/models/sample.py rename to cg/services/orders/validation/workflows/balsamic/models/sample.py index 8d66bd7788..1f2e6ebe63 100644 --- a/cg/services/order_validation_service/workflows/balsamic/models/sample.py +++ b/cg/services/orders/validation/workflows/balsamic/models/sample.py @@ -2,9 +2,9 @@ from typing_extensions import Annotated from cg.models.orders.sample_base import NAME_PATTERN, ControlEnum, SexEnum, StatusEnum -from cg.services.order_validation_service.constants import ElutionBuffer, TissueBlockEnum -from cg.services.order_validation_service.models.sample import Sample -from cg.services.order_validation_service.utils import parse_buffer, parse_control +from cg.services.orders.validation.constants import ElutionBuffer, TissueBlockEnum +from cg.services.orders.validation.models.sample import Sample +from cg.services.orders.validation.utils import parse_buffer, parse_control class BalsamicSample(Sample): diff --git a/cg/services/order_validation_service/workflows/balsamic/rules.py b/cg/services/orders/validation/workflows/balsamic/rules.py similarity index 64% rename from cg/services/order_validation_service/workflows/balsamic/rules.py rename to cg/services/orders/validation/workflows/balsamic/rules.py index 62893f5ab1..4c7d087772 100644 --- a/cg/services/order_validation_service/workflows/balsamic/rules.py +++ b/cg/services/orders/validation/workflows/balsamic/rules.py @@ -1,8 +1,6 @@ -from cg.services.order_validation_service.errors.case_sample_errors import CaptureKitMissingError -from cg.services.order_validation_service.workflows.balsamic.models.order import BalsamicOrder -from cg.services.order_validation_service.workflows.balsamic.utils import ( - is_sample_missing_capture_kit, -) +from cg.services.orders.validation.errors.case_sample_errors import CaptureKitMissingError +from cg.services.orders.validation.workflows.balsamic.models.order import BalsamicOrder +from cg.services.orders.validation.workflows.balsamic.utils import is_sample_missing_capture_kit from cg.store.store import Store diff --git a/cg/services/order_validation_service/workflows/balsamic/utils.py b/cg/services/orders/validation/workflows/balsamic/utils.py similarity index 82% rename from cg/services/order_validation_service/workflows/balsamic/utils.py rename to cg/services/orders/validation/workflows/balsamic/utils.py index 750239d45f..b097f03f40 100644 --- a/cg/services/order_validation_service/workflows/balsamic/utils.py +++ b/cg/services/orders/validation/workflows/balsamic/utils.py @@ -1,5 +1,5 @@ from cg.constants.sequencing import SeqLibraryPrepCategory -from cg.services.order_validation_service.workflows.balsamic.models.sample import BalsamicSample +from cg.services.orders.validation.workflows.balsamic.models.sample import BalsamicSample from cg.store.models import Application from cg.store.store import Store diff --git a/cg/services/order_validation_service/workflows/balsamic/validation_rules.py b/cg/services/orders/validation/workflows/balsamic/validation_rules.py similarity index 91% rename from cg/services/order_validation_service/workflows/balsamic/validation_rules.py rename to cg/services/orders/validation/workflows/balsamic/validation_rules.py index 07c5203fdc..8851992bd3 100644 --- a/cg/services/order_validation_service/workflows/balsamic/validation_rules.py +++ b/cg/services/orders/validation/workflows/balsamic/validation_rules.py @@ -1,11 +1,11 @@ -from cg.services.order_validation_service.rules.case.rules import ( +from cg.services.orders.validation.rules.case.rules import ( validate_at_most_two_samples_per_case, validate_case_internal_ids_exist, validate_case_names_available, validate_case_names_not_repeated, validate_number_of_normal_samples, ) -from cg.services.order_validation_service.rules.case_sample.rules import ( +from cg.services.orders.validation.rules.case_sample.rules import ( validate_application_compatibility, validate_application_exists, validate_application_not_archived, @@ -27,7 +27,7 @@ validate_well_positions_required, validate_wells_contain_at_most_one_sample, ) -from cg.services.order_validation_service.workflows.balsamic.rules import ( +from cg.services.orders.validation.workflows.balsamic.rules import ( validate_capture_kit_panel_requirement, ) diff --git a/cg/services/order_validation_service/workflows/balsamic_umi/constants.py b/cg/services/orders/validation/workflows/balsamic_umi/constants.py similarity index 100% rename from cg/services/order_validation_service/workflows/balsamic_umi/constants.py rename to cg/services/orders/validation/workflows/balsamic_umi/constants.py diff --git a/cg/services/orders/validation/workflows/balsamic_umi/models/case.py b/cg/services/orders/validation/workflows/balsamic_umi/models/case.py new file mode 100644 index 0000000000..9452bec2bc --- /dev/null +++ b/cg/services/orders/validation/workflows/balsamic_umi/models/case.py @@ -0,0 +1,14 @@ +from pydantic import Discriminator, Tag +from typing_extensions import Annotated + +from cg.services.orders.validation.models.discriminators import has_internal_id +from cg.services.orders.validation.models.existing_sample import ExistingSample +from cg.services.orders.validation.workflows.balsamic.models.case import BalsamicCase +from cg.services.orders.validation.workflows.balsamic_umi.models.sample import BalsamicUmiSample + +NewSample = Annotated[BalsamicUmiSample, Tag("new")] +OldSample = Annotated[ExistingSample, Tag("existing")] + + +class BalsamicUmiCase(BalsamicCase): + samples: list[Annotated[NewSample | OldSample, Discriminator(has_internal_id)]] diff --git a/cg/services/order_validation_service/workflows/balsamic_umi/models/order.py b/cg/services/orders/validation/workflows/balsamic_umi/models/order.py similarity index 58% rename from cg/services/order_validation_service/workflows/balsamic_umi/models/order.py rename to cg/services/orders/validation/workflows/balsamic_umi/models/order.py index f4e7730e36..b327ee6cfd 100644 --- a/cg/services/order_validation_service/workflows/balsamic_umi/models/order.py +++ b/cg/services/orders/validation/workflows/balsamic_umi/models/order.py @@ -1,13 +1,11 @@ from pydantic import Discriminator, Tag from typing_extensions import Annotated -from cg.services.order_validation_service.models.discriminators import has_internal_id -from cg.services.order_validation_service.models.existing_case import ExistingCase -from cg.services.order_validation_service.workflows.balsamic.models.order import BalsamicOrder -from cg.services.order_validation_service.workflows.balsamic_umi.constants import ( - BalsamicUmiDeliveryType, -) -from cg.services.order_validation_service.workflows.balsamic_umi.models.case import BalsamicUmiCase +from cg.services.orders.validation.models.discriminators import has_internal_id +from cg.services.orders.validation.models.existing_case import ExistingCase +from cg.services.orders.validation.workflows.balsamic.models.order import BalsamicOrder +from cg.services.orders.validation.workflows.balsamic_umi.constants import BalsamicUmiDeliveryType +from cg.services.orders.validation.workflows.balsamic_umi.models.case import BalsamicUmiCase NewCase = Annotated[BalsamicUmiCase, Tag("new")] OldCase = Annotated[ExistingCase, Tag("existing")] diff --git a/cg/services/orders/validation/workflows/balsamic_umi/models/sample.py b/cg/services/orders/validation/workflows/balsamic_umi/models/sample.py new file mode 100644 index 0000000000..9a325780bd --- /dev/null +++ b/cg/services/orders/validation/workflows/balsamic_umi/models/sample.py @@ -0,0 +1,5 @@ +from cg.services.orders.validation.workflows.balsamic.models.sample import BalsamicSample + + +class BalsamicUmiSample(BalsamicSample): + pass diff --git a/cg/services/order_validation_service/workflows/balsamic_umi/validation_rules.py b/cg/services/orders/validation/workflows/balsamic_umi/validation_rules.py similarity index 70% rename from cg/services/order_validation_service/workflows/balsamic_umi/validation_rules.py rename to cg/services/orders/validation/workflows/balsamic_umi/validation_rules.py index d55bacf6ed..afd21d659d 100644 --- a/cg/services/order_validation_service/workflows/balsamic_umi/validation_rules.py +++ b/cg/services/orders/validation/workflows/balsamic_umi/validation_rules.py @@ -1,4 +1,4 @@ -from cg.services.order_validation_service.workflows.balsamic.validation_rules import ( +from cg.services.orders.validation.workflows.balsamic.validation_rules import ( BALSAMIC_CASE_RULES, BALSAMIC_CASE_SAMPLE_RULES, ) diff --git a/cg/services/order_validation_service/workflows/fastq/constants.py b/cg/services/orders/validation/workflows/fastq/constants.py similarity index 100% rename from cg/services/order_validation_service/workflows/fastq/constants.py rename to cg/services/orders/validation/workflows/fastq/constants.py diff --git a/cg/services/orders/validation/workflows/fastq/models/order.py b/cg/services/orders/validation/workflows/fastq/models/order.py new file mode 100644 index 0000000000..b4acfcf245 --- /dev/null +++ b/cg/services/orders/validation/workflows/fastq/models/order.py @@ -0,0 +1,12 @@ +from cg.services.orders.validation.models.order_with_samples import OrderWithSamples +from cg.services.orders.validation.workflows.fastq.constants import FastqDeliveryType +from cg.services.orders.validation.workflows.fastq.models.sample import FastqSample + + +class FastqOrder(OrderWithSamples): + delivery_type: FastqDeliveryType + samples: list[FastqSample] + + @property + def enumerated_samples(self) -> enumerate[FastqSample]: + return enumerate(self.samples) diff --git a/cg/services/order_validation_service/workflows/fastq/models/sample.py b/cg/services/orders/validation/workflows/fastq/models/sample.py similarity index 72% rename from cg/services/order_validation_service/workflows/fastq/models/sample.py rename to cg/services/orders/validation/workflows/fastq/models/sample.py index f5b2956f83..29c9902767 100644 --- a/cg/services/order_validation_service/workflows/fastq/models/sample.py +++ b/cg/services/orders/validation/workflows/fastq/models/sample.py @@ -2,9 +2,9 @@ from typing_extensions import Annotated from cg.models.orders.sample_base import NAME_PATTERN, PriorityEnum, SexEnum -from cg.services.order_validation_service.constants import ElutionBuffer -from cg.services.order_validation_service.models.sample import Sample -from cg.services.order_validation_service.utils import parse_buffer +from cg.services.orders.validation.constants import ElutionBuffer +from cg.services.orders.validation.models.sample import Sample +from cg.services.orders.validation.utils import parse_buffer class FastqSample(Sample): diff --git a/cg/services/order_validation_service/workflows/fastq/validation_rules.py b/cg/services/orders/validation/workflows/fastq/validation_rules.py similarity index 94% rename from cg/services/order_validation_service/workflows/fastq/validation_rules.py rename to cg/services/orders/validation/workflows/fastq/validation_rules.py index f36275cb86..a93fa75f61 100644 --- a/cg/services/order_validation_service/workflows/fastq/validation_rules.py +++ b/cg/services/orders/validation/workflows/fastq/validation_rules.py @@ -1,4 +1,4 @@ -from cg.services.order_validation_service.rules.sample.rules import ( +from cg.services.orders.validation.rules.sample.rules import ( validate_application_compatibility, validate_application_exists, validate_applications_not_archived, diff --git a/cg/services/order_validation_service/workflows/fluffy/constants.py b/cg/services/orders/validation/workflows/fluffy/constants.py similarity index 100% rename from cg/services/order_validation_service/workflows/fluffy/constants.py rename to cg/services/orders/validation/workflows/fluffy/constants.py diff --git a/cg/services/order_validation_service/workflows/fluffy/models/order.py b/cg/services/orders/validation/workflows/fluffy/models/order.py similarity index 80% rename from cg/services/order_validation_service/workflows/fluffy/models/order.py rename to cg/services/orders/validation/workflows/fluffy/models/order.py index 6af11fd387..d20c3afa2b 100644 --- a/cg/services/order_validation_service/workflows/fluffy/models/order.py +++ b/cg/services/orders/validation/workflows/fluffy/models/order.py @@ -1,6 +1,6 @@ -from cg.services.order_validation_service.models.order_with_samples import OrderWithSamples -from cg.services.order_validation_service.workflows.fluffy.constants import FluffyDeliveryType -from cg.services.order_validation_service.workflows.fluffy.models.sample import FluffySample +from cg.services.orders.validation.models.order_with_samples import OrderWithSamples +from cg.services.orders.validation.workflows.fluffy.constants import FluffyDeliveryType +from cg.services.orders.validation.workflows.fluffy.models.sample import FluffySample class FluffyOrder(OrderWithSamples): diff --git a/cg/services/order_validation_service/workflows/fluffy/models/sample.py b/cg/services/orders/validation/workflows/fluffy/models/sample.py similarity index 76% rename from cg/services/order_validation_service/workflows/fluffy/models/sample.py rename to cg/services/orders/validation/workflows/fluffy/models/sample.py index 2f4f64d345..10174ac44f 100644 --- a/cg/services/order_validation_service/workflows/fluffy/models/sample.py +++ b/cg/services/orders/validation/workflows/fluffy/models/sample.py @@ -2,9 +2,9 @@ from typing_extensions import Annotated from cg.models.orders.sample_base import ContainerEnum, ControlEnum, PriorityEnum -from cg.services.order_validation_service.constants import IndexEnum -from cg.services.order_validation_service.models.sample import Sample -from cg.services.order_validation_service.utils import parse_control +from cg.services.orders.validation.constants import IndexEnum +from cg.services.orders.validation.models.sample import Sample +from cg.services.orders.validation.utils import parse_control class FluffySample(Sample): diff --git a/cg/services/order_validation_service/workflows/fluffy/validation_rules.py b/cg/services/orders/validation/workflows/fluffy/validation_rules.py similarity index 94% rename from cg/services/order_validation_service/workflows/fluffy/validation_rules.py rename to cg/services/orders/validation/workflows/fluffy/validation_rules.py index 1712c2ecec..4d828907d5 100644 --- a/cg/services/order_validation_service/workflows/fluffy/validation_rules.py +++ b/cg/services/orders/validation/workflows/fluffy/validation_rules.py @@ -1,4 +1,4 @@ -from cg.services.order_validation_service.rules.sample.rules import ( +from cg.services.orders.validation.rules.sample.rules import ( validate_application_compatibility, validate_application_exists, validate_applications_not_archived, diff --git a/cg/services/order_validation_service/workflows/metagenome/constants.py b/cg/services/orders/validation/workflows/metagenome/constants.py similarity index 100% rename from cg/services/order_validation_service/workflows/metagenome/constants.py rename to cg/services/orders/validation/workflows/metagenome/constants.py diff --git a/cg/services/orders/validation/workflows/metagenome/models/order.py b/cg/services/orders/validation/workflows/metagenome/models/order.py new file mode 100644 index 0000000000..43a2417700 --- /dev/null +++ b/cg/services/orders/validation/workflows/metagenome/models/order.py @@ -0,0 +1,12 @@ +from cg.services.orders.validation.models.order_with_samples import OrderWithSamples +from cg.services.orders.validation.workflows.metagenome.constants import MetagenomeDeliveryType +from cg.services.orders.validation.workflows.metagenome.models.sample import MetagenomeSample + + +class MetagenomeOrder(OrderWithSamples): + delivery_type: MetagenomeDeliveryType + samples: list[MetagenomeSample] + + @property + def enumerated_samples(self) -> enumerate[MetagenomeSample]: + return enumerate(self.samples) diff --git a/cg/services/order_validation_service/workflows/metagenome/models/sample.py b/cg/services/orders/validation/workflows/metagenome/models/sample.py similarity index 68% rename from cg/services/order_validation_service/workflows/metagenome/models/sample.py rename to cg/services/orders/validation/workflows/metagenome/models/sample.py index 7453a35433..2f2a180127 100644 --- a/cg/services/order_validation_service/workflows/metagenome/models/sample.py +++ b/cg/services/orders/validation/workflows/metagenome/models/sample.py @@ -2,9 +2,9 @@ from typing_extensions import Annotated from cg.models.orders.sample_base import ControlEnum, PriorityEnum -from cg.services.order_validation_service.constants import ElutionBuffer -from cg.services.order_validation_service.models.sample import Sample -from cg.services.order_validation_service.utils import parse_buffer, parse_control +from cg.services.orders.validation.constants import ElutionBuffer +from cg.services.orders.validation.models.sample import Sample +from cg.services.orders.validation.utils import parse_buffer, parse_control class MetagenomeSample(Sample): diff --git a/cg/services/order_validation_service/workflows/metagenome/validation_rules.py b/cg/services/orders/validation/workflows/metagenome/validation_rules.py similarity index 93% rename from cg/services/order_validation_service/workflows/metagenome/validation_rules.py rename to cg/services/orders/validation/workflows/metagenome/validation_rules.py index 7f390c914b..0b37ea183d 100644 --- a/cg/services/order_validation_service/workflows/metagenome/validation_rules.py +++ b/cg/services/orders/validation/workflows/metagenome/validation_rules.py @@ -1,4 +1,4 @@ -from cg.services.order_validation_service.rules.sample.rules import ( +from cg.services.orders.validation.rules.sample.rules import ( validate_application_compatibility, validate_application_exists, validate_applications_not_archived, diff --git a/cg/services/order_validation_service/workflows/microbial_fastq/constants.py b/cg/services/orders/validation/workflows/microbial_fastq/constants.py similarity index 100% rename from cg/services/order_validation_service/workflows/microbial_fastq/constants.py rename to cg/services/orders/validation/workflows/microbial_fastq/constants.py diff --git a/cg/services/order_validation_service/workflows/microbial_fastq/models/order.py b/cg/services/orders/validation/workflows/microbial_fastq/models/order.py similarity index 54% rename from cg/services/order_validation_service/workflows/microbial_fastq/models/order.py rename to cg/services/orders/validation/workflows/microbial_fastq/models/order.py index 27d424a08e..82aff7470f 100644 --- a/cg/services/order_validation_service/workflows/microbial_fastq/models/order.py +++ b/cg/services/orders/validation/workflows/microbial_fastq/models/order.py @@ -1,8 +1,8 @@ -from cg.services.order_validation_service.models.order_with_samples import OrderWithSamples -from cg.services.order_validation_service.workflows.microbial_fastq.constants import ( +from cg.services.orders.validation.models.order_with_samples import OrderWithSamples +from cg.services.orders.validation.workflows.microbial_fastq.constants import ( MicrobialFastqDeliveryType, ) -from cg.services.order_validation_service.workflows.microbial_fastq.models.sample import ( +from cg.services.orders.validation.workflows.microbial_fastq.models.sample import ( MicrobialFastqSample, ) diff --git a/cg/services/order_validation_service/workflows/microbial_fastq/models/sample.py b/cg/services/orders/validation/workflows/microbial_fastq/models/sample.py similarity index 65% rename from cg/services/order_validation_service/workflows/microbial_fastq/models/sample.py rename to cg/services/orders/validation/workflows/microbial_fastq/models/sample.py index 2937abe4de..ab74f89885 100644 --- a/cg/services/order_validation_service/workflows/microbial_fastq/models/sample.py +++ b/cg/services/orders/validation/workflows/microbial_fastq/models/sample.py @@ -2,9 +2,9 @@ from typing_extensions import Annotated from cg.models.orders.sample_base import ControlEnum, PriorityEnum -from cg.services.order_validation_service.constants import ElutionBuffer -from cg.services.order_validation_service.models.sample import Sample -from cg.services.order_validation_service.utils import parse_buffer, parse_control +from cg.services.orders.validation.constants import ElutionBuffer +from cg.services.orders.validation.models.sample import Sample +from cg.services.orders.validation.utils import parse_buffer, parse_control class MicrobialFastqSample(Sample): diff --git a/cg/services/order_validation_service/workflows/microbial_fastq/validation_rules.py b/cg/services/orders/validation/workflows/microbial_fastq/validation_rules.py similarity index 93% rename from cg/services/order_validation_service/workflows/microbial_fastq/validation_rules.py rename to cg/services/orders/validation/workflows/microbial_fastq/validation_rules.py index e353813be9..7e57856714 100644 --- a/cg/services/order_validation_service/workflows/microbial_fastq/validation_rules.py +++ b/cg/services/orders/validation/workflows/microbial_fastq/validation_rules.py @@ -1,4 +1,4 @@ -from cg.services.order_validation_service.rules.sample.rules import ( +from cg.services.orders.validation.rules.sample.rules import ( validate_application_compatibility, validate_application_exists, validate_applications_not_archived, diff --git a/cg/services/order_validation_service/workflows/microsalt/constants.py b/cg/services/orders/validation/workflows/microsalt/constants.py similarity index 100% rename from cg/services/order_validation_service/workflows/microsalt/constants.py rename to cg/services/orders/validation/workflows/microsalt/constants.py diff --git a/cg/services/orders/validation/workflows/microsalt/models/order.py b/cg/services/orders/validation/workflows/microsalt/models/order.py new file mode 100644 index 0000000000..4b16e17686 --- /dev/null +++ b/cg/services/orders/validation/workflows/microsalt/models/order.py @@ -0,0 +1,12 @@ +from cg.services.orders.validation.models.order_with_samples import OrderWithSamples +from cg.services.orders.validation.workflows.microsalt.constants import MicrosaltDeliveryType +from cg.services.orders.validation.workflows.microsalt.models.sample import MicrosaltSample + + +class MicrosaltOrder(OrderWithSamples): + delivery_type: MicrosaltDeliveryType + samples: list[MicrosaltSample] + + @property + def enumerated_samples(self) -> enumerate[MicrosaltSample]: + return enumerate(self.samples) diff --git a/cg/services/order_validation_service/workflows/microsalt/models/sample.py b/cg/services/orders/validation/workflows/microsalt/models/sample.py similarity index 68% rename from cg/services/order_validation_service/workflows/microsalt/models/sample.py rename to cg/services/orders/validation/workflows/microsalt/models/sample.py index 526492159d..99fe537c91 100644 --- a/cg/services/order_validation_service/workflows/microsalt/models/sample.py +++ b/cg/services/orders/validation/workflows/microsalt/models/sample.py @@ -2,13 +2,9 @@ from typing_extensions import Annotated from cg.models.orders.sample_base import ControlEnum, PriorityEnum -from cg.services.order_validation_service.constants import ElutionBuffer, ExtractionMethod -from cg.services.order_validation_service.models.sample import Sample -from cg.services.order_validation_service.utils import ( - parse_buffer, - parse_control, - parse_extraction_method, -) +from cg.services.orders.validation.constants import ElutionBuffer, ExtractionMethod +from cg.services.orders.validation.models.sample import Sample +from cg.services.orders.validation.utils import parse_buffer, parse_control, parse_extraction_method class MicrosaltSample(Sample): diff --git a/cg/services/order_validation_service/workflows/microsalt/validation_rules.py b/cg/services/orders/validation/workflows/microsalt/validation_rules.py similarity index 93% rename from cg/services/order_validation_service/workflows/microsalt/validation_rules.py rename to cg/services/orders/validation/workflows/microsalt/validation_rules.py index 46ead869b9..9a6770d5fc 100644 --- a/cg/services/order_validation_service/workflows/microsalt/validation_rules.py +++ b/cg/services/orders/validation/workflows/microsalt/validation_rules.py @@ -1,4 +1,4 @@ -from cg.services.order_validation_service.rules.sample.rules import ( +from cg.services.orders.validation.rules.sample.rules import ( validate_application_compatibility, validate_application_exists, validate_applications_not_archived, diff --git a/cg/services/order_validation_service/workflows/mip_dna/models/case.py b/cg/services/orders/validation/workflows/mip_dna/models/case.py similarity index 68% rename from cg/services/order_validation_service/workflows/mip_dna/models/case.py rename to cg/services/orders/validation/workflows/mip_dna/models/case.py index 28fddcf4b3..1a77df2902 100644 --- a/cg/services/order_validation_service/workflows/mip_dna/models/case.py +++ b/cg/services/orders/validation/workflows/mip_dna/models/case.py @@ -1,10 +1,10 @@ from pydantic import Discriminator, Tag from typing_extensions import Annotated -from cg.services.order_validation_service.models.case import Case -from cg.services.order_validation_service.models.discriminators import has_internal_id -from cg.services.order_validation_service.models.existing_sample import ExistingSample -from cg.services.order_validation_service.workflows.mip_dna.models.sample import MipDnaSample +from cg.services.orders.validation.models.case import Case +from cg.services.orders.validation.models.discriminators import has_internal_id +from cg.services.orders.validation.models.existing_sample import ExistingSample +from cg.services.orders.validation.workflows.mip_dna.models.sample import MipDnaSample NewSample = Annotated[MipDnaSample, Tag("new")] OldSample = Annotated[ExistingSample, Tag("existing")] diff --git a/cg/services/orders/validation/workflows/mip_dna/models/order.py b/cg/services/orders/validation/workflows/mip_dna/models/order.py new file mode 100644 index 0000000000..9a35c17590 --- /dev/null +++ b/cg/services/orders/validation/workflows/mip_dna/models/order.py @@ -0,0 +1,14 @@ +from pydantic import Discriminator, Tag +from typing_extensions import Annotated + +from cg.services.orders.validation.models.discriminators import has_internal_id +from cg.services.orders.validation.models.existing_case import ExistingCase +from cg.services.orders.validation.models.order_with_cases import OrderWithCases +from cg.services.orders.validation.workflows.mip_dna.models.case import MipDnaCase + +NewCase = Annotated[MipDnaCase, Tag("new")] +OldCase = Annotated[ExistingCase, Tag("existing")] + + +class MipDnaOrder(OrderWithCases): + cases: list[Annotated[NewCase | OldCase, Discriminator(has_internal_id)]] diff --git a/cg/services/order_validation_service/workflows/mip_dna/models/sample.py b/cg/services/orders/validation/workflows/mip_dna/models/sample.py similarity index 80% rename from cg/services/order_validation_service/workflows/mip_dna/models/sample.py rename to cg/services/orders/validation/workflows/mip_dna/models/sample.py index 29986461c6..fb0e3bba5d 100644 --- a/cg/services/order_validation_service/workflows/mip_dna/models/sample.py +++ b/cg/services/orders/validation/workflows/mip_dna/models/sample.py @@ -2,9 +2,9 @@ from typing_extensions import Annotated from cg.models.orders.sample_base import NAME_PATTERN, ControlEnum, SexEnum, StatusEnum -from cg.services.order_validation_service.constants import ElutionBuffer, TissueBlockEnum -from cg.services.order_validation_service.models.sample import Sample -from cg.services.order_validation_service.utils import parse_buffer, parse_control +from cg.services.orders.validation.constants import ElutionBuffer, TissueBlockEnum +from cg.services.orders.validation.models.sample import Sample +from cg.services.orders.validation.utils import parse_buffer, parse_control class MipDnaSample(Sample): diff --git a/cg/services/order_validation_service/workflows/mip_dna/validation_rules.py b/cg/services/orders/validation/workflows/mip_dna/validation_rules.py similarity index 94% rename from cg/services/order_validation_service/workflows/mip_dna/validation_rules.py rename to cg/services/orders/validation/workflows/mip_dna/validation_rules.py index bbe401e237..1c01634c38 100644 --- a/cg/services/order_validation_service/workflows/mip_dna/validation_rules.py +++ b/cg/services/orders/validation/workflows/mip_dna/validation_rules.py @@ -1,10 +1,10 @@ -from cg.services.order_validation_service.rules.case.rules import ( +from cg.services.orders.validation.rules.case.rules import ( validate_case_internal_ids_exist, validate_case_names_available, validate_case_names_not_repeated, validate_gene_panels_unique, ) -from cg.services.order_validation_service.rules.case_sample.rules import ( +from cg.services.orders.validation.rules.case_sample.rules import ( validate_application_compatibility, validate_application_exists, validate_application_not_archived, diff --git a/cg/services/order_validation_service/workflows/mip_rna/constants.py b/cg/services/orders/validation/workflows/mip_rna/constants.py similarity index 100% rename from cg/services/order_validation_service/workflows/mip_rna/constants.py rename to cg/services/orders/validation/workflows/mip_rna/constants.py diff --git a/cg/services/order_validation_service/workflows/mip_rna/models/case.py b/cg/services/orders/validation/workflows/mip_rna/models/case.py similarity index 51% rename from cg/services/order_validation_service/workflows/mip_rna/models/case.py rename to cg/services/orders/validation/workflows/mip_rna/models/case.py index ecdca89e69..0214ba1ded 100644 --- a/cg/services/order_validation_service/workflows/mip_rna/models/case.py +++ b/cg/services/orders/validation/workflows/mip_rna/models/case.py @@ -1,12 +1,10 @@ from pydantic import Discriminator, Tag from typing_extensions import Annotated -from cg.services.order_validation_service.models.case import Case -from cg.services.order_validation_service.models.discriminators import has_internal_id -from cg.services.order_validation_service.models.existing_sample import ExistingSample -from cg.services.order_validation_service.workflows.mip_rna.models.sample import ( - MipRnaSample, -) +from cg.services.orders.validation.models.case import Case +from cg.services.orders.validation.models.discriminators import has_internal_id +from cg.services.orders.validation.models.existing_sample import ExistingSample +from cg.services.orders.validation.workflows.mip_rna.models.sample import MipRnaSample NewSample = Annotated[MipRnaSample, Tag("new")] OldSample = Annotated[ExistingSample, Tag("existing")] diff --git a/cg/services/orders/validation/workflows/mip_rna/models/order.py b/cg/services/orders/validation/workflows/mip_rna/models/order.py new file mode 100644 index 0000000000..3a009d3234 --- /dev/null +++ b/cg/services/orders/validation/workflows/mip_rna/models/order.py @@ -0,0 +1,16 @@ +from pydantic import Discriminator, Tag +from typing_extensions import Annotated + +from cg.services.orders.validation.models.discriminators import has_internal_id +from cg.services.orders.validation.models.existing_case import ExistingCase +from cg.services.orders.validation.models.order_with_cases import OrderWithCases +from cg.services.orders.validation.workflows.mip_rna.constants import MipRnaDeliveryType +from cg.services.orders.validation.workflows.mip_rna.models.case import MipRnaCase + +NewCase = Annotated[MipRnaCase, Tag("new")] +OldCase = Annotated[ExistingCase, Tag("existing")] + + +class MipRnaOrder(OrderWithCases): + cases: list[Annotated[NewCase | OldCase, Discriminator(has_internal_id)]] + delivery_type: MipRnaDeliveryType diff --git a/cg/services/order_validation_service/workflows/mip_rna/models/sample.py b/cg/services/orders/validation/workflows/mip_rna/models/sample.py similarity index 77% rename from cg/services/order_validation_service/workflows/mip_rna/models/sample.py rename to cg/services/orders/validation/workflows/mip_rna/models/sample.py index a1bfaf5b22..acf407049e 100644 --- a/cg/services/order_validation_service/workflows/mip_rna/models/sample.py +++ b/cg/services/orders/validation/workflows/mip_rna/models/sample.py @@ -2,9 +2,9 @@ from typing_extensions import Annotated from cg.models.orders.sample_base import NAME_PATTERN, ControlEnum, SexEnum -from cg.services.order_validation_service.constants import ElutionBuffer, TissueBlockEnum -from cg.services.order_validation_service.models.sample import Sample -from cg.services.order_validation_service.utils import parse_buffer, parse_control +from cg.services.orders.validation.constants import ElutionBuffer, TissueBlockEnum +from cg.services.orders.validation.models.sample import Sample +from cg.services.orders.validation.utils import parse_buffer, parse_control class MipRnaSample(Sample): diff --git a/cg/services/order_validation_service/workflows/mip_rna/validation_rules.py b/cg/services/orders/validation/workflows/mip_rna/validation_rules.py similarity index 93% rename from cg/services/order_validation_service/workflows/mip_rna/validation_rules.py rename to cg/services/orders/validation/workflows/mip_rna/validation_rules.py index e986f9a15f..e7ea6d9213 100644 --- a/cg/services/order_validation_service/workflows/mip_rna/validation_rules.py +++ b/cg/services/orders/validation/workflows/mip_rna/validation_rules.py @@ -1,9 +1,9 @@ -from cg.services.order_validation_service.rules.case.rules import ( +from cg.services.orders.validation.rules.case.rules import ( validate_case_internal_ids_exist, validate_case_names_available, validate_case_names_not_repeated, ) -from cg.services.order_validation_service.rules.case_sample.rules import ( +from cg.services.orders.validation.rules.case_sample.rules import ( validate_application_compatibility, validate_application_exists, validate_application_not_archived, diff --git a/cg/services/order_validation_service/workflows/mutant/constants.py b/cg/services/orders/validation/workflows/mutant/constants.py similarity index 100% rename from cg/services/order_validation_service/workflows/mutant/constants.py rename to cg/services/orders/validation/workflows/mutant/constants.py diff --git a/cg/services/orders/validation/workflows/mutant/models/order.py b/cg/services/orders/validation/workflows/mutant/models/order.py new file mode 100644 index 0000000000..5c47295e3e --- /dev/null +++ b/cg/services/orders/validation/workflows/mutant/models/order.py @@ -0,0 +1,12 @@ +from cg.services.orders.validation.models.order_with_samples import OrderWithSamples +from cg.services.orders.validation.workflows.mutant.constants import MutantDeliveryType +from cg.services.orders.validation.workflows.mutant.models.sample import MutantSample + + +class MutantOrder(OrderWithSamples): + delivery_type: MutantDeliveryType + samples: list[MutantSample] + + @property + def enumerated_samples(self) -> enumerate[MutantSample]: + return enumerate(self.samples) diff --git a/cg/services/order_validation_service/workflows/mutant/models/sample.py b/cg/services/orders/validation/workflows/mutant/models/sample.py similarity index 75% rename from cg/services/order_validation_service/workflows/mutant/models/sample.py rename to cg/services/orders/validation/workflows/mutant/models/sample.py index 1de145b5dd..0ec7ed5dc7 100644 --- a/cg/services/order_validation_service/workflows/mutant/models/sample.py +++ b/cg/services/orders/validation/workflows/mutant/models/sample.py @@ -4,14 +4,10 @@ from typing_extensions import Annotated from cg.models.orders.sample_base import ControlEnum, PriorityEnum -from cg.services.order_validation_service.constants import ElutionBuffer, ExtractionMethod -from cg.services.order_validation_service.models.sample import Sample -from cg.services.order_validation_service.utils import ( - parse_buffer, - parse_control, - parse_extraction_method, -) -from cg.services.order_validation_service.workflows.mutant.constants import ( +from cg.services.orders.validation.constants import ElutionBuffer, ExtractionMethod +from cg.services.orders.validation.models.sample import Sample +from cg.services.orders.validation.utils import parse_buffer, parse_control, parse_extraction_method +from cg.services.orders.validation.workflows.mutant.constants import ( OriginalLab, PreProcessingMethod, Primer, diff --git a/cg/services/order_validation_service/workflows/mutant/validation_rules.py b/cg/services/orders/validation/workflows/mutant/validation_rules.py similarity index 93% rename from cg/services/order_validation_service/workflows/mutant/validation_rules.py rename to cg/services/orders/validation/workflows/mutant/validation_rules.py index 940fd11205..5132a29895 100644 --- a/cg/services/order_validation_service/workflows/mutant/validation_rules.py +++ b/cg/services/orders/validation/workflows/mutant/validation_rules.py @@ -1,4 +1,4 @@ -from cg.services.order_validation_service.rules.sample.rules import ( +from cg.services.orders.validation.rules.sample.rules import ( validate_application_compatibility, validate_application_exists, validate_applications_not_archived, diff --git a/cg/services/order_validation_service/workflows/order_validation_rules.py b/cg/services/orders/validation/workflows/order_validation_rules.py similarity index 79% rename from cg/services/order_validation_service/workflows/order_validation_rules.py rename to cg/services/orders/validation/workflows/order_validation_rules.py index 51797e14fc..cb876ebbe6 100644 --- a/cg/services/order_validation_service/workflows/order_validation_rules.py +++ b/cg/services/orders/validation/workflows/order_validation_rules.py @@ -1,4 +1,4 @@ -from cg.services.order_validation_service.rules.order.rules import ( +from cg.services.orders.validation.rules.order.rules import ( validate_customer_can_skip_reception_control, validate_customer_exists, validate_user_belongs_to_customer, diff --git a/cg/services/order_validation_service/workflows/pacbio_long_read/constants.py b/cg/services/orders/validation/workflows/pacbio_long_read/constants.py similarity index 100% rename from cg/services/order_validation_service/workflows/pacbio_long_read/constants.py rename to cg/services/orders/validation/workflows/pacbio_long_read/constants.py diff --git a/cg/services/orders/validation/workflows/pacbio_long_read/models/order.py b/cg/services/orders/validation/workflows/pacbio_long_read/models/order.py new file mode 100644 index 0000000000..21139caa4e --- /dev/null +++ b/cg/services/orders/validation/workflows/pacbio_long_read/models/order.py @@ -0,0 +1,12 @@ +from cg.services.orders.validation.models.order_with_samples import OrderWithSamples +from cg.services.orders.validation.workflows.pacbio_long_read.constants import PacbioDeliveryType +from cg.services.orders.validation.workflows.pacbio_long_read.models.sample import PacbioSample + + +class PacbioOrder(OrderWithSamples): + delivery_type: PacbioDeliveryType + samples: list[PacbioSample] + + @property + def enumerated_samples(self) -> enumerate[PacbioSample]: + return enumerate(self.samples) diff --git a/cg/services/order_validation_service/workflows/pacbio_long_read/models/sample.py b/cg/services/orders/validation/workflows/pacbio_long_read/models/sample.py similarity index 84% rename from cg/services/order_validation_service/workflows/pacbio_long_read/models/sample.py rename to cg/services/orders/validation/workflows/pacbio_long_read/models/sample.py index b2df55eaad..ac93b18454 100644 --- a/cg/services/order_validation_service/workflows/pacbio_long_read/models/sample.py +++ b/cg/services/orders/validation/workflows/pacbio_long_read/models/sample.py @@ -1,7 +1,7 @@ from pydantic import Field from cg.models.orders.sample_base import NAME_PATTERN, PriorityEnum, SexEnum -from cg.services.order_validation_service.models.sample import Sample +from cg.services.orders.validation.models.sample import Sample class PacbioSample(Sample): diff --git a/cg/services/order_validation_service/workflows/pacbio_long_read/validation_rules.py b/cg/services/orders/validation/workflows/pacbio_long_read/validation_rules.py similarity index 93% rename from cg/services/order_validation_service/workflows/pacbio_long_read/validation_rules.py rename to cg/services/orders/validation/workflows/pacbio_long_read/validation_rules.py index 5b973eeee4..af6add52bf 100644 --- a/cg/services/order_validation_service/workflows/pacbio_long_read/validation_rules.py +++ b/cg/services/orders/validation/workflows/pacbio_long_read/validation_rules.py @@ -1,4 +1,4 @@ -from cg.services.order_validation_service.rules.sample.rules import ( +from cg.services.orders.validation.rules.sample.rules import ( validate_application_compatibility, validate_application_exists, validate_applications_not_archived, diff --git a/cg/services/order_validation_service/workflows/rml/constants.py b/cg/services/orders/validation/workflows/rml/constants.py similarity index 100% rename from cg/services/order_validation_service/workflows/rml/constants.py rename to cg/services/orders/validation/workflows/rml/constants.py diff --git a/cg/services/order_validation_service/workflows/rml/models/order.py b/cg/services/orders/validation/workflows/rml/models/order.py similarity index 80% rename from cg/services/order_validation_service/workflows/rml/models/order.py rename to cg/services/orders/validation/workflows/rml/models/order.py index 7903ce213a..96a14dbf43 100644 --- a/cg/services/order_validation_service/workflows/rml/models/order.py +++ b/cg/services/orders/validation/workflows/rml/models/order.py @@ -1,6 +1,6 @@ -from cg.services.order_validation_service.models.order_with_samples import OrderWithSamples -from cg.services.order_validation_service.workflows.rml.constants import RmlDeliveryType -from cg.services.order_validation_service.workflows.rml.models.sample import RmlSample +from cg.services.orders.validation.models.order_with_samples import OrderWithSamples +from cg.services.orders.validation.workflows.rml.constants import RmlDeliveryType +from cg.services.orders.validation.workflows.rml.models.sample import RmlSample class RmlOrder(OrderWithSamples): diff --git a/cg/services/order_validation_service/workflows/rml/models/sample.py b/cg/services/orders/validation/workflows/rml/models/sample.py similarity index 76% rename from cg/services/order_validation_service/workflows/rml/models/sample.py rename to cg/services/orders/validation/workflows/rml/models/sample.py index 0c3fb26cb5..6c97aa1fbc 100644 --- a/cg/services/order_validation_service/workflows/rml/models/sample.py +++ b/cg/services/orders/validation/workflows/rml/models/sample.py @@ -2,9 +2,9 @@ from typing_extensions import Annotated from cg.models.orders.sample_base import ContainerEnum, ControlEnum, PriorityEnum -from cg.services.order_validation_service.constants import IndexEnum -from cg.services.order_validation_service.models.sample import Sample -from cg.services.order_validation_service.utils import parse_control +from cg.services.orders.validation.constants import IndexEnum +from cg.services.orders.validation.models.sample import Sample +from cg.services.orders.validation.utils import parse_control class RmlSample(Sample): diff --git a/cg/services/order_validation_service/workflows/rml/validation_rules.py b/cg/services/orders/validation/workflows/rml/validation_rules.py similarity index 94% rename from cg/services/order_validation_service/workflows/rml/validation_rules.py rename to cg/services/orders/validation/workflows/rml/validation_rules.py index 284fd5fc3f..e229cf2da7 100644 --- a/cg/services/order_validation_service/workflows/rml/validation_rules.py +++ b/cg/services/orders/validation/workflows/rml/validation_rules.py @@ -1,4 +1,4 @@ -from cg.services.order_validation_service.rules.sample.rules import ( +from cg.services.orders.validation.rules.sample.rules import ( validate_application_compatibility, validate_application_exists, validate_applications_not_archived, diff --git a/cg/services/order_validation_service/workflows/rna_fusion/constants.py b/cg/services/orders/validation/workflows/rna_fusion/constants.py similarity index 100% rename from cg/services/order_validation_service/workflows/rna_fusion/constants.py rename to cg/services/orders/validation/workflows/rna_fusion/constants.py diff --git a/cg/services/order_validation_service/workflows/rna_fusion/models/case.py b/cg/services/orders/validation/workflows/rna_fusion/models/case.py similarity index 52% rename from cg/services/order_validation_service/workflows/rna_fusion/models/case.py rename to cg/services/orders/validation/workflows/rna_fusion/models/case.py index af9e7d8a3a..d750c4a24a 100644 --- a/cg/services/order_validation_service/workflows/rna_fusion/models/case.py +++ b/cg/services/orders/validation/workflows/rna_fusion/models/case.py @@ -1,10 +1,10 @@ from pydantic import Discriminator, Tag from typing_extensions import Annotated -from cg.services.order_validation_service.models.case import Case -from cg.services.order_validation_service.models.discriminators import has_internal_id -from cg.services.order_validation_service.models.existing_sample import ExistingSample -from cg.services.order_validation_service.workflows.rna_fusion.models.sample import RnaFusionSample +from cg.services.orders.validation.models.case import Case +from cg.services.orders.validation.models.discriminators import has_internal_id +from cg.services.orders.validation.models.existing_sample import ExistingSample +from cg.services.orders.validation.workflows.rna_fusion.models.sample import RnaFusionSample NewSample = Annotated[RnaFusionSample, Tag("new")] OldSample = Annotated[ExistingSample, Tag("existing")] diff --git a/cg/services/orders/validation/workflows/rna_fusion/models/order.py b/cg/services/orders/validation/workflows/rna_fusion/models/order.py new file mode 100644 index 0000000000..2fe61b6e92 --- /dev/null +++ b/cg/services/orders/validation/workflows/rna_fusion/models/order.py @@ -0,0 +1,16 @@ +from pydantic import Discriminator, Tag +from typing_extensions import Annotated + +from cg.services.orders.validation.models.discriminators import has_internal_id +from cg.services.orders.validation.models.existing_case import ExistingCase +from cg.services.orders.validation.models.order_with_cases import OrderWithCases +from cg.services.orders.validation.workflows.rna_fusion.constants import RnaFusionDeliveryType +from cg.services.orders.validation.workflows.rna_fusion.models.case import RnaFusionCase + +NewCase = Annotated[RnaFusionCase, Tag("new")] +OldCase = Annotated[ExistingCase, Tag("existing")] + + +class RnaFusionOrder(OrderWithCases): + cases: list[Annotated[NewCase | OldCase, Discriminator(has_internal_id)]] + delivery_type: RnaFusionDeliveryType diff --git a/cg/services/order_validation_service/workflows/rna_fusion/models/sample.py b/cg/services/orders/validation/workflows/rna_fusion/models/sample.py similarity index 77% rename from cg/services/order_validation_service/workflows/rna_fusion/models/sample.py rename to cg/services/orders/validation/workflows/rna_fusion/models/sample.py index 904a4df23c..ff14daa735 100644 --- a/cg/services/order_validation_service/workflows/rna_fusion/models/sample.py +++ b/cg/services/orders/validation/workflows/rna_fusion/models/sample.py @@ -2,9 +2,9 @@ from typing_extensions import Annotated from cg.models.orders.sample_base import NAME_PATTERN, ControlEnum, SexEnum -from cg.services.order_validation_service.constants import ElutionBuffer, TissueBlockEnum -from cg.services.order_validation_service.models.sample import Sample -from cg.services.order_validation_service.utils import parse_buffer, parse_control +from cg.services.orders.validation.constants import ElutionBuffer, TissueBlockEnum +from cg.services.orders.validation.models.sample import Sample +from cg.services.orders.validation.utils import parse_buffer, parse_control class RnaFusionSample(Sample): diff --git a/cg/services/order_validation_service/workflows/rna_fusion/validation_rules.py b/cg/services/orders/validation/workflows/rna_fusion/validation_rules.py similarity index 93% rename from cg/services/order_validation_service/workflows/rna_fusion/validation_rules.py rename to cg/services/orders/validation/workflows/rna_fusion/validation_rules.py index 8cc64d0123..b49788160c 100644 --- a/cg/services/order_validation_service/workflows/rna_fusion/validation_rules.py +++ b/cg/services/orders/validation/workflows/rna_fusion/validation_rules.py @@ -1,10 +1,10 @@ -from cg.services.order_validation_service.rules.case.rules import ( +from cg.services.orders.validation.rules.case.rules import ( validate_case_internal_ids_exist, validate_case_names_available, validate_case_names_not_repeated, validate_one_sample_per_case, ) -from cg.services.order_validation_service.rules.case_sample.rules import ( +from cg.services.orders.validation.rules.case_sample.rules import ( validate_application_compatibility, validate_application_exists, validate_application_not_archived, diff --git a/cg/services/order_validation_service/workflows/taxprofiler/constants.py b/cg/services/orders/validation/workflows/taxprofiler/constants.py similarity index 100% rename from cg/services/order_validation_service/workflows/taxprofiler/constants.py rename to cg/services/orders/validation/workflows/taxprofiler/constants.py diff --git a/cg/services/orders/validation/workflows/taxprofiler/models/order.py b/cg/services/orders/validation/workflows/taxprofiler/models/order.py new file mode 100644 index 0000000000..26a425c647 --- /dev/null +++ b/cg/services/orders/validation/workflows/taxprofiler/models/order.py @@ -0,0 +1,12 @@ +from cg.services.orders.validation.models.order_with_samples import OrderWithSamples +from cg.services.orders.validation.workflows.taxprofiler.constants import TaxprofilerDeliveryType +from cg.services.orders.validation.workflows.taxprofiler.models.sample import TaxprofilerSample + + +class TaxprofilerOrder(OrderWithSamples): + delivery_type: TaxprofilerDeliveryType + samples: list[TaxprofilerSample] + + @property + def enumerated_samples(self) -> enumerate[TaxprofilerSample]: + return enumerate(self.samples) diff --git a/cg/services/order_validation_service/workflows/taxprofiler/models/sample.py b/cg/services/orders/validation/workflows/taxprofiler/models/sample.py similarity index 68% rename from cg/services/order_validation_service/workflows/taxprofiler/models/sample.py rename to cg/services/orders/validation/workflows/taxprofiler/models/sample.py index bf22e92bd3..5a034a17bb 100644 --- a/cg/services/order_validation_service/workflows/taxprofiler/models/sample.py +++ b/cg/services/orders/validation/workflows/taxprofiler/models/sample.py @@ -2,9 +2,9 @@ from typing_extensions import Annotated from cg.models.orders.sample_base import ControlEnum, PriorityEnum -from cg.services.order_validation_service.constants import ElutionBuffer -from cg.services.order_validation_service.models.sample import Sample -from cg.services.order_validation_service.utils import parse_buffer, parse_control +from cg.services.orders.validation.constants import ElutionBuffer +from cg.services.orders.validation.models.sample import Sample +from cg.services.orders.validation.utils import parse_buffer, parse_control class TaxprofilerSample(Sample): diff --git a/cg/services/order_validation_service/workflows/taxprofiler/validation_rules.py b/cg/services/orders/validation/workflows/taxprofiler/validation_rules.py similarity index 93% rename from cg/services/order_validation_service/workflows/taxprofiler/validation_rules.py rename to cg/services/orders/validation/workflows/taxprofiler/validation_rules.py index 631acf4577..790bdb8568 100644 --- a/cg/services/order_validation_service/workflows/taxprofiler/validation_rules.py +++ b/cg/services/orders/validation/workflows/taxprofiler/validation_rules.py @@ -1,4 +1,4 @@ -from cg.services.order_validation_service.rules.sample.rules import ( +from cg.services.orders.validation.rules.sample.rules import ( validate_application_compatibility, validate_application_exists, validate_applications_not_archived, diff --git a/cg/services/order_validation_service/workflows/tomte/constants.py b/cg/services/orders/validation/workflows/tomte/constants.py similarity index 100% rename from cg/services/order_validation_service/workflows/tomte/constants.py rename to cg/services/orders/validation/workflows/tomte/constants.py diff --git a/cg/services/order_validation_service/workflows/tomte/models/case.py b/cg/services/orders/validation/workflows/tomte/models/case.py similarity index 68% rename from cg/services/order_validation_service/workflows/tomte/models/case.py rename to cg/services/orders/validation/workflows/tomte/models/case.py index 1e78e140b0..ab4504e4ea 100644 --- a/cg/services/order_validation_service/workflows/tomte/models/case.py +++ b/cg/services/orders/validation/workflows/tomte/models/case.py @@ -1,10 +1,10 @@ from pydantic import Discriminator, Tag from typing_extensions import Annotated -from cg.services.order_validation_service.models.case import Case -from cg.services.order_validation_service.models.discriminators import has_internal_id -from cg.services.order_validation_service.models.existing_sample import ExistingSample -from cg.services.order_validation_service.workflows.tomte.models.sample import TomteSample +from cg.services.orders.validation.models.case import Case +from cg.services.orders.validation.models.discriminators import has_internal_id +from cg.services.orders.validation.models.existing_sample import ExistingSample +from cg.services.orders.validation.workflows.tomte.models.sample import TomteSample NewSample = Annotated[TomteSample, Tag("new")] OldSample = Annotated[ExistingSample, Tag("existing")] diff --git a/cg/services/orders/validation/workflows/tomte/models/order.py b/cg/services/orders/validation/workflows/tomte/models/order.py new file mode 100644 index 0000000000..e046b27e74 --- /dev/null +++ b/cg/services/orders/validation/workflows/tomte/models/order.py @@ -0,0 +1,16 @@ +from pydantic import Discriminator, Tag +from typing_extensions import Annotated + +from cg.services.orders.validation.models.discriminators import has_internal_id +from cg.services.orders.validation.models.existing_case import ExistingCase +from cg.services.orders.validation.models.order_with_cases import OrderWithCases +from cg.services.orders.validation.workflows.tomte.constants import TomteDeliveryType +from cg.services.orders.validation.workflows.tomte.models.case import TomteCase + +NewCase = Annotated[TomteCase, Tag("new")] +OldCase = Annotated[ExistingCase, Tag("existing")] + + +class TomteOrder(OrderWithCases): + cases: list[Annotated[NewCase | OldCase, Discriminator(has_internal_id)]] + delivery_type: TomteDeliveryType diff --git a/cg/services/order_validation_service/workflows/tomte/models/sample.py b/cg/services/orders/validation/workflows/tomte/models/sample.py similarity index 81% rename from cg/services/order_validation_service/workflows/tomte/models/sample.py rename to cg/services/orders/validation/workflows/tomte/models/sample.py index 7a906470a8..1af5e4c403 100644 --- a/cg/services/order_validation_service/workflows/tomte/models/sample.py +++ b/cg/services/orders/validation/workflows/tomte/models/sample.py @@ -3,9 +3,9 @@ from cg.constants.constants import GenomeVersion from cg.models.orders.sample_base import NAME_PATTERN, ControlEnum, SexEnum, StatusEnum -from cg.services.order_validation_service.constants import ElutionBuffer, TissueBlockEnum -from cg.services.order_validation_service.models.sample import Sample -from cg.services.order_validation_service.utils import parse_buffer, parse_control +from cg.services.orders.validation.constants import ElutionBuffer, TissueBlockEnum +from cg.services.orders.validation.models.sample import Sample +from cg.services.orders.validation.utils import parse_buffer, parse_control class TomteSample(Sample): diff --git a/cg/services/order_validation_service/workflows/tomte/validation_rules.py b/cg/services/orders/validation/workflows/tomte/validation_rules.py similarity index 94% rename from cg/services/order_validation_service/workflows/tomte/validation_rules.py rename to cg/services/orders/validation/workflows/tomte/validation_rules.py index 7a049ad38b..f989aad9fb 100644 --- a/cg/services/order_validation_service/workflows/tomte/validation_rules.py +++ b/cg/services/orders/validation/workflows/tomte/validation_rules.py @@ -1,10 +1,10 @@ -from cg.services.order_validation_service.rules.case.rules import ( +from cg.services.orders.validation.rules.case.rules import ( validate_case_internal_ids_exist, validate_case_names_available, validate_case_names_not_repeated, validate_gene_panels_unique, ) -from cg.services.order_validation_service.rules.case_sample.rules import ( +from cg.services.orders.validation.rules.case_sample.rules import ( validate_application_compatibility, validate_application_exists, validate_application_not_archived, diff --git a/tests/conftest.py b/tests/conftest.py index e8658b3aba..454875055b 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -60,7 +60,7 @@ from cg.services.deliver_files.rsync.service import DeliveryRsyncService from cg.services.illumina.backup.encrypt_service import IlluminaRunEncryptionService from cg.services.illumina.data_transfer.data_transfer_service import IlluminaDataTransferService -from cg.services.orders.store_order_services.constants import MAF_ORDER_ID +from cg.services.orders.storing.constants import MAF_ORDER_ID from cg.store.database import create_all_tables, drop_all_tables, initialize_database from cg.store.models import ( Application, diff --git a/tests/fixture_plugins/orders_fixtures/order_fixtures.py b/tests/fixture_plugins/orders_fixtures/order_fixtures.py index 415c036f63..3b290c0aa1 100644 --- a/tests/fixture_plugins/orders_fixtures/order_fixtures.py +++ b/tests/fixture_plugins/orders_fixtures/order_fixtures.py @@ -2,22 +2,20 @@ import pytest -from cg.services.order_validation_service.workflows.balsamic.models.order import BalsamicOrder -from cg.services.order_validation_service.workflows.fastq.models.order import FastqOrder -from cg.services.order_validation_service.workflows.fluffy.models.order import FluffyOrder -from cg.services.order_validation_service.workflows.metagenome.models.order import MetagenomeOrder -from cg.services.order_validation_service.workflows.microbial_fastq.models.order import ( - MicrobialFastqOrder, -) -from cg.services.order_validation_service.workflows.microsalt.models.order import MicrosaltOrder -from cg.services.order_validation_service.workflows.mip_dna.models.order import MipDnaOrder -from cg.services.order_validation_service.workflows.mip_rna.models.order import MipRnaOrder -from cg.services.order_validation_service.workflows.mutant.models.order import MutantOrder -from cg.services.order_validation_service.workflows.pacbio_long_read.models.order import PacbioOrder -from cg.services.order_validation_service.workflows.rml.models.order import RmlOrder -from cg.services.order_validation_service.workflows.rna_fusion.models.order import RnaFusionOrder -from cg.services.order_validation_service.workflows.taxprofiler.models.order import TaxprofilerOrder -from cg.services.order_validation_service.workflows.tomte.models.order import TomteOrder +from cg.services.orders.validation.workflows.balsamic.models.order import BalsamicOrder +from cg.services.orders.validation.workflows.fastq.models.order import FastqOrder +from cg.services.orders.validation.workflows.fluffy.models.order import FluffyOrder +from cg.services.orders.validation.workflows.metagenome.models.order import MetagenomeOrder +from cg.services.orders.validation.workflows.microbial_fastq.models.order import MicrobialFastqOrder +from cg.services.orders.validation.workflows.microsalt.models.order import MicrosaltOrder +from cg.services.orders.validation.workflows.mip_dna.models.order import MipDnaOrder +from cg.services.orders.validation.workflows.mip_rna.models.order import MipRnaOrder +from cg.services.orders.validation.workflows.mutant.models.order import MutantOrder +from cg.services.orders.validation.workflows.pacbio_long_read.models.order import PacbioOrder +from cg.services.orders.validation.workflows.rml.models.order import RmlOrder +from cg.services.orders.validation.workflows.rna_fusion.models.order import RnaFusionOrder +from cg.services.orders.validation.workflows.taxprofiler.models.order import TaxprofilerOrder +from cg.services.orders.validation.workflows.tomte.models.order import TomteOrder @pytest.fixture diff --git a/tests/fixture_plugins/orders_fixtures/services_and_api_fixtures.py b/tests/fixture_plugins/orders_fixtures/services_and_api_fixtures.py index 2f55066cd6..2d07009c71 100644 --- a/tests/fixture_plugins/orders_fixtures/services_and_api_fixtures.py +++ b/tests/fixture_plugins/orders_fixtures/services_and_api_fixtures.py @@ -3,11 +3,11 @@ from cg.clients.freshdesk.freshdesk_client import FreshdeskClient from cg.meta.orders import OrdersAPI from cg.meta.orders.ticket_handler import TicketHandler -from cg.services.order_validation_service.order_validation_service import OrderValidationService -from cg.services.orders.store_order_services.storing_service_registry import ( +from cg.services.orders.storing.service_registry import ( StoringServiceRegistry, setup_storing_service_registry, ) +from cg.services.orders.validation.service import OrderValidationService from cg.store.store import Store from tests.mocks.limsmock import MockLimsAPI diff --git a/tests/fixture_plugins/orders_fixtures/store_fixtures.py b/tests/fixture_plugins/orders_fixtures/store_fixtures.py index 85f4bba66b..652aa03dfd 100644 --- a/tests/fixture_plugins/orders_fixtures/store_fixtures.py +++ b/tests/fixture_plugins/orders_fixtures/store_fixtures.py @@ -4,9 +4,9 @@ from cg.constants.sequencing import SeqLibraryPrepCategory from cg.models.orders.constants import OrderType -from cg.services.order_validation_service.workflows.balsamic.models.order import BalsamicOrder -from cg.services.order_validation_service.workflows.mip_dna.models.order import MipDnaOrder -from cg.services.orders.store_order_services.constants import MAF_ORDER_ID +from cg.services.orders.storing.constants import MAF_ORDER_ID +from cg.services.orders.validation.workflows.balsamic.models.order import BalsamicOrder +from cg.services.orders.validation.workflows.mip_dna.models.order import MipDnaOrder from cg.store.models import Application, ApplicationVersion, Customer, Order from cg.store.store import Store from tests.store_helpers import StoreHelpers diff --git a/tests/fixture_plugins/orders_fixtures/store_service_fixtures.py b/tests/fixture_plugins/orders_fixtures/store_service_fixtures.py index 3257541ba9..2c78fdd8cd 100644 --- a/tests/fixture_plugins/orders_fixtures/store_service_fixtures.py +++ b/tests/fixture_plugins/orders_fixtures/store_service_fixtures.py @@ -1,27 +1,19 @@ import pytest -from cg.services.orders.order_lims_service.order_lims_service import OrderLimsService -from cg.services.orders.store_order_services.implementations.store_case_order import ( - StoreCaseOrderService, -) -from cg.services.orders.store_order_services.implementations.store_fastq_order_service import ( - StoreFastqOrderService, -) -from cg.services.orders.store_order_services.implementations.store_metagenome_order import ( +from cg.services.orders.lims_service.service import OrderLimsService +from cg.services.orders.storing.implementations.case_order_service import StoreCaseOrderService +from cg.services.orders.storing.implementations.fastq_order_service import StoreFastqOrderService +from cg.services.orders.storing.implementations.metagenome_order_service import ( StoreMetagenomeOrderService, ) -from cg.services.orders.store_order_services.implementations.store_microbial_fastq_order_service import ( +from cg.services.orders.storing.implementations.microbial_fastq_order_service import ( StoreMicrobialFastqOrderService, ) -from cg.services.orders.store_order_services.implementations.store_microbial_order import ( +from cg.services.orders.storing.implementations.microbial_order_service import ( StoreMicrobialOrderService, ) -from cg.services.orders.store_order_services.implementations.store_pacbio_order_service import ( - StorePacBioOrderService, -) -from cg.services.orders.store_order_services.implementations.store_pool_order import ( - StorePoolOrderService, -) +from cg.services.orders.storing.implementations.pacbio_order_service import StorePacBioOrderService +from cg.services.orders.storing.implementations.pool_order_service import StorePoolOrderService from cg.store.store import Store from tests.mocks.limsmock import MockLimsAPI from tests.store_helpers import StoreHelpers diff --git a/tests/meta/orders/test_meta_orders_api.py b/tests/meta/orders/test_meta_orders_api.py index 9eb2108380..4ced34c3f4 100644 --- a/tests/meta/orders/test_meta_orders_api.py +++ b/tests/meta/orders/test_meta_orders_api.py @@ -7,10 +7,10 @@ from cg.exc import TicketCreationError from cg.meta.orders import OrdersAPI from cg.models.orders.constants import OrderType -from cg.services.order_validation_service.errors.validation_errors import ValidationErrors -from cg.services.order_validation_service.models.order import Order -from cg.services.order_validation_service.models.order_with_cases import OrderWithCases -from cg.services.order_validation_service.models.order_with_samples import OrderWithSamples +from cg.services.orders.validation.errors.validation_errors import ValidationErrors +from cg.services.orders.validation.models.order import Order +from cg.services.orders.validation.models.order_with_cases import OrderWithCases +from cg.services.orders.validation.models.order_with_samples import OrderWithSamples from cg.store.models import Case, Pool, Sample, User from cg.store.store import Store @@ -25,7 +25,7 @@ def monkeypatch_process_lims(monkeypatch: pytest.MonkeyPatch, order: Order) -> N for case_index, sample_index, sample in order.enumerated_new_samples } monkeypatch.setattr( - "cg.services.orders.order_lims_service.order_lims_service.OrderLimsService.process_lims", + "cg.services.orders.lims_service.service.OrderLimsService.process_lims", lambda *args, **kwargs: (lims_project_data, lims_map), ) @@ -140,7 +140,7 @@ def test_submit_ticketexception( "cg.clients.freshdesk.freshdesk_client.FreshdeskClient.create_ticket", side_effect=TicketCreationError("ERROR"), ), patch( - "cg.services.order_validation_service.order_validation_service.OrderValidationService._get_rule_validation_errors", + "cg.services.orders.validation.service.OrderValidationService._get_rule_validation_errors", return_value=ValidationErrors(), ): # GIVEN an order that does not have a name (ticket_nr) diff --git a/tests/services/order_validation_service/workflows/balsamic/__init__.py b/tests/services/order_validation_service/workflows/balsamic/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/services/order_validation_service/workflows/tomte/__init__.py b/tests/services/order_validation_service/workflows/tomte/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/services/orders/order_lims_service/test_order_lims_service.py b/tests/services/orders/lims_service/test_order_lims_service.py similarity index 92% rename from tests/services/orders/order_lims_service/test_order_lims_service.py rename to tests/services/orders/lims_service/test_order_lims_service.py index fad59377c2..9394191fc4 100644 --- a/tests/services/orders/order_lims_service/test_order_lims_service.py +++ b/tests/services/orders/lims_service/test_order_lims_service.py @@ -2,14 +2,14 @@ from cg.constants import Workflow from cg.models.lims.sample import LimsSample -from cg.services.order_validation_service.workflows.balsamic.models.order import BalsamicOrder -from cg.services.order_validation_service.workflows.fastq.models.order import FastqOrder -from cg.services.order_validation_service.workflows.fluffy.models.order import FluffyOrder -from cg.services.order_validation_service.workflows.microsalt.models.order import MicrosaltOrder -from cg.services.order_validation_service.workflows.mip_dna.models.order import MipDnaOrder -from cg.services.order_validation_service.workflows.mutant.models.order import MutantOrder -from cg.services.order_validation_service.workflows.rml.models.order import RmlOrder -from cg.services.orders.order_lims_service.order_lims_service import OrderLimsService +from cg.services.orders.lims_service.service import OrderLimsService +from cg.services.orders.validation.workflows.balsamic.models.order import BalsamicOrder +from cg.services.orders.validation.workflows.fastq.models.order import FastqOrder +from cg.services.orders.validation.workflows.fluffy.models.order import FluffyOrder +from cg.services.orders.validation.workflows.microsalt.models.order import MicrosaltOrder +from cg.services.orders.validation.workflows.mip_dna.models.order import MipDnaOrder +from cg.services.orders.validation.workflows.mutant.models.order import MutantOrder +from cg.services.orders.validation.workflows.rml.models.order import RmlOrder def test_to_lims_mip(mip_dna_order_to_submit): diff --git a/tests/services/orders/order_store_service/test_fastq_order_service.py b/tests/services/orders/store_service/test_fastq_order_service.py similarity index 93% rename from tests/services/orders/order_store_service/test_fastq_order_service.py rename to tests/services/orders/store_service/test_fastq_order_service.py index ec6d493a23..e34ed4b7d4 100644 --- a/tests/services/orders/order_store_service/test_fastq_order_service.py +++ b/tests/services/orders/store_service/test_fastq_order_service.py @@ -1,17 +1,14 @@ from cg.constants import DataDelivery, Workflow from cg.constants.sequencing import SeqLibraryPrepCategory -from cg.services.order_validation_service.workflows.fastq.models.order import FastqOrder -from cg.services.orders.store_order_services.constants import MAF_ORDER_ID -from cg.services.orders.store_order_services.implementations.store_fastq_order_service import ( - StoreFastqOrderService, -) +from cg.services.orders.storing.constants import MAF_ORDER_ID +from cg.services.orders.storing.implementations.fastq_order_service import StoreFastqOrderService +from cg.services.orders.validation.workflows.fastq.models.order import FastqOrder from cg.store.models import Application, Case, Order, Sample from cg.store.store import Store def test_store_order_data_in_status_db( base_store: Store, - ticket_id: str, store_fastq_order_service: StoreFastqOrderService, fastq_order: FastqOrder, ): @@ -74,7 +71,6 @@ def test_store_fastq_samples_non_tumour_wgs_to_mip_maf_case( def test_store_fastq_samples_tumour_wgs_to_fastq_no_maf_case( base_store: Store, fastq_order: FastqOrder, - ticket_id: str, store_fastq_order_service: StoreFastqOrderService, ): """Test that a tumour WGS sample does not create MAF cases.""" @@ -101,7 +97,6 @@ def test_store_fastq_samples_tumour_wgs_to_fastq_no_maf_case( def test_store_fastq_samples_non_wgs_no_maf_case( base_store: Store, fastq_order: FastqOrder, - ticket_id: str, store_fastq_order_service: StoreFastqOrderService, ): """Test that an order with non-WGS samples creates no MAF cases.""" diff --git a/tests/services/orders/order_store_service/test_generic_order_store_service.py b/tests/services/orders/store_service/test_generic_order_store_service.py similarity index 90% rename from tests/services/orders/order_store_service/test_generic_order_store_service.py rename to tests/services/orders/store_service/test_generic_order_store_service.py index cc9cc5ac78..0c8e52f86f 100644 --- a/tests/services/orders/order_store_service/test_generic_order_store_service.py +++ b/tests/services/orders/store_service/test_generic_order_store_service.py @@ -1,12 +1,10 @@ """Module to test the StoreGenericOrderService class.""" from cg.constants import DataDelivery, Priority, Workflow -from cg.services.order_validation_service.workflows.balsamic.models.order import BalsamicOrder -from cg.services.order_validation_service.workflows.mip_dna.models.order import MipDnaOrder -from cg.services.order_validation_service.workflows.mip_rna.models.order import MipRnaOrder -from cg.services.orders.store_order_services.implementations.store_case_order import ( - StoreCaseOrderService, -) +from cg.services.orders.storing.implementations.case_order_service import StoreCaseOrderService +from cg.services.orders.validation.workflows.balsamic.models.order import BalsamicOrder +from cg.services.orders.validation.workflows.mip_dna.models.order import MipDnaOrder +from cg.services.orders.validation.workflows.mip_rna.models.order import MipRnaOrder from cg.store.models import Sample from cg.store.store import Store @@ -14,7 +12,6 @@ def test_store_mip( mip_dna_submit_store: Store, mip_dna_order: MipDnaOrder, - ticket_id: str, store_generic_order_service: StoreCaseOrderService, ): # GIVEN a basic store with no samples or nothing in it + scout order @@ -81,7 +78,6 @@ def test_store_mip_rna( def test_store_cancer_samples( balsamic_submit_store: Store, balsamic_order: BalsamicOrder, - ticket_id: str, store_generic_order_service: StoreCaseOrderService, ): diff --git a/tests/services/orders/order_store_service/test_metagenome_store_service.py b/tests/services/orders/store_service/test_metagenome_store_service.py similarity index 66% rename from tests/services/orders/order_store_service/test_metagenome_store_service.py rename to tests/services/orders/store_service/test_metagenome_store_service.py index b388984f1c..73b326cb95 100644 --- a/tests/services/orders/order_store_service/test_metagenome_store_service.py +++ b/tests/services/orders/store_service/test_metagenome_store_service.py @@ -1,15 +1,12 @@ -from cg.services.order_validation_service.workflows.metagenome.models.order import MetagenomeOrder -from cg.services.orders.store_order_services.implementations.store_metagenome_order import ( +from cg.services.orders.storing.implementations.metagenome_order_service import ( StoreMetagenomeOrderService, ) +from cg.services.orders.validation.workflows.metagenome.models.order import MetagenomeOrder from cg.store.models import Sample -from cg.store.store import Store def test_store_metagenome_samples( - base_store: Store, metagenome_order: MetagenomeOrder, - ticket_id: str, store_metagenome_order_service: StoreMetagenomeOrderService, ): # GIVEN a basic store with no samples and a valid metagenome order with two samples diff --git a/tests/services/orders/order_store_service/test_microbial_fastq_order_store_service.py b/tests/services/orders/store_service/test_microbial_fastq_order_store_service.py similarity index 84% rename from tests/services/orders/order_store_service/test_microbial_fastq_order_store_service.py rename to tests/services/orders/store_service/test_microbial_fastq_order_store_service.py index 96a81e50c6..a8d1ee403d 100644 --- a/tests/services/orders/order_store_service/test_microbial_fastq_order_store_service.py +++ b/tests/services/orders/store_service/test_microbial_fastq_order_store_service.py @@ -1,10 +1,8 @@ from cg.constants import DataDelivery -from cg.services.order_validation_service.workflows.microbial_fastq.models.order import ( - MicrobialFastqOrder, -) -from cg.services.orders.store_order_services.implementations.store_microbial_fastq_order_service import ( +from cg.services.orders.storing.implementations.microbial_fastq_order_service import ( StoreMicrobialFastqOrderService, ) +from cg.services.orders.validation.workflows.microbial_fastq.models.order import MicrobialFastqOrder from cg.store.models import Case, Sample from cg.store.store import Store diff --git a/tests/services/orders/order_store_service/test_microbial_store_order_service.py b/tests/services/orders/store_service/test_microbial_store_order_service.py similarity index 90% rename from tests/services/orders/order_store_service/test_microbial_store_order_service.py rename to tests/services/orders/store_service/test_microbial_store_order_service.py index 91a5274837..a800380644 100644 --- a/tests/services/orders/order_store_service/test_microbial_store_order_service.py +++ b/tests/services/orders/store_service/test_microbial_store_order_service.py @@ -1,11 +1,11 @@ from cg.constants import DataDelivery from cg.constants.constants import Workflow from cg.models.orders.sample_base import ControlEnum -from cg.services.order_validation_service.workflows.microsalt.models.order import MicrosaltOrder -from cg.services.order_validation_service.workflows.mutant.models.order import MutantOrder -from cg.services.orders.store_order_services.implementations.store_microbial_order import ( +from cg.services.orders.storing.implementations.microbial_order_service import ( StoreMicrobialOrderService, ) +from cg.services.orders.validation.workflows.microsalt.models.order import MicrosaltOrder +from cg.services.orders.validation.workflows.mutant.models.order import MutantOrder from cg.store.models import Case, Customer, Sample from cg.store.store import Store @@ -13,7 +13,6 @@ def test_store_microbial_samples( base_store: Store, microsalt_order: MicrosaltOrder, - ticket_id: str, store_microbial_order_service: StoreMicrobialOrderService, ): # GIVEN a basic store with no samples and a microbial order and one Organism @@ -36,7 +35,6 @@ def test_store_microbial_samples( def test_store_microbial_case_data_analysis_stored( base_store: Store, microsalt_order: MicrosaltOrder, - ticket_id: str, store_microbial_order_service: StoreMicrobialOrderService, ): # GIVEN a basic store with no samples and a microbial order and one Organism diff --git a/tests/services/orders/order_store_service/test_pacbio_order_service.py b/tests/services/orders/store_service/test_pacbio_order_service.py similarity index 90% rename from tests/services/orders/order_store_service/test_pacbio_order_service.py rename to tests/services/orders/store_service/test_pacbio_order_service.py index dfb95785c2..a43a23417d 100644 --- a/tests/services/orders/order_store_service/test_pacbio_order_service.py +++ b/tests/services/orders/store_service/test_pacbio_order_service.py @@ -1,10 +1,8 @@ from cg.constants import DataDelivery, Workflow from cg.constants.sequencing import SeqLibraryPrepCategory from cg.models.orders.sample_base import SexEnum -from cg.services.order_validation_service.workflows.pacbio_long_read.models.order import PacbioOrder -from cg.services.orders.store_order_services.implementations.store_pacbio_order_service import ( - StorePacBioOrderService, -) +from cg.services.orders.storing.implementations.pacbio_order_service import StorePacBioOrderService +from cg.services.orders.validation.workflows.pacbio_long_read.models.order import PacbioOrder from cg.store.models import Case, Order, Sample from cg.store.store import Store from tests.store_helpers import StoreHelpers diff --git a/tests/services/orders/order_store_service/test_pool_order_store_service.py b/tests/services/orders/store_service/test_pool_order_store_service.py similarity index 91% rename from tests/services/orders/order_store_service/test_pool_order_store_service.py rename to tests/services/orders/store_service/test_pool_order_store_service.py index 5fcbbe336c..7e646659e8 100644 --- a/tests/services/orders/order_store_service/test_pool_order_store_service.py +++ b/tests/services/orders/store_service/test_pool_order_store_service.py @@ -2,13 +2,10 @@ from cg.constants import Workflow from cg.constants.sequencing import SeqLibraryPrepCategory -from cg.services.order_validation_service.models.order_aliases import OrderWithIndexedSamples -from cg.services.orders.store_order_services.implementations.store_pool_order import ( - StorePoolOrderService, -) +from cg.services.orders.storing.implementations.pool_order_service import StorePoolOrderService +from cg.services.orders.validation.models.order_aliases import OrderWithIndexedSamples from cg.store.models import ApplicationVersion, Case, CaseSample, Order, Pool, Sample from cg.store.store import Store -from tests.store_helpers import StoreHelpers @pytest.mark.parametrize( @@ -22,7 +19,6 @@ def test_store_order_data_in_status_db( ticket_id: str, store_pool_order_service: StorePoolOrderService, workflow: Workflow, - helpers: StoreHelpers, request: pytest.FixtureRequest, ): """Test that a Fluffy or RML order is stored in the database.""" diff --git a/tests/services/orders/order_status_service/conftest.py b/tests/services/orders/summary_service/conftest.py similarity index 100% rename from tests/services/orders/order_status_service/conftest.py rename to tests/services/orders/summary_service/conftest.py diff --git a/tests/services/orders/order_status_service/test_order_summary_service.py b/tests/services/orders/summary_service/test_order_summary_service.py similarity index 100% rename from tests/services/orders/order_status_service/test_order_summary_service.py rename to tests/services/orders/summary_service/test_order_summary_service.py diff --git a/tests/services/order_validation_service/conftest.py b/tests/services/orders/validation_service/conftest.py similarity index 92% rename from tests/services/order_validation_service/conftest.py rename to tests/services/orders/validation_service/conftest.py index 1570910026..abd05ead4e 100644 --- a/tests/services/order_validation_service/conftest.py +++ b/tests/services/orders/validation_service/conftest.py @@ -4,14 +4,14 @@ from cg.constants.sequencing import SeqLibraryPrepCategory from cg.models.orders.constants import OrderType from cg.models.orders.sample_base import ContainerEnum, ControlEnum, SexEnum, StatusEnum -from cg.services.order_validation_service.constants import MINIMUM_VOLUME -from cg.services.order_validation_service.models.existing_sample import ExistingSample -from cg.services.order_validation_service.order_type_maps import ORDER_TYPE_RULE_SET_MAP, RuleSet -from cg.services.order_validation_service.order_validation_service import OrderValidationService -from cg.services.order_validation_service.workflows.tomte.constants import TomteDeliveryType -from cg.services.order_validation_service.workflows.tomte.models.case import TomteCase -from cg.services.order_validation_service.workflows.tomte.models.order import TomteOrder -from cg.services.order_validation_service.workflows.tomte.models.sample import TomteSample +from cg.services.orders.validation.constants import MINIMUM_VOLUME +from cg.services.orders.validation.models.existing_sample import ExistingSample +from cg.services.orders.validation.order_type_maps import ORDER_TYPE_RULE_SET_MAP, RuleSet +from cg.services.orders.validation.service import OrderValidationService +from cg.services.orders.validation.workflows.tomte.constants import TomteDeliveryType +from cg.services.orders.validation.workflows.tomte.models.case import TomteCase +from cg.services.orders.validation.workflows.tomte.models.order import TomteOrder +from cg.services.orders.validation.workflows.tomte.models.sample import TomteSample from cg.store.models import Application, Customer, User from cg.store.store import Store diff --git a/cg/services/orders/store_order_services/implementations/__init__.py b/tests/services/orders/validation_service/sample_rules/__init__.py similarity index 100% rename from cg/services/orders/store_order_services/implementations/__init__.py rename to tests/services/orders/validation_service/sample_rules/__init__.py diff --git a/tests/services/order_validation_service/sample_rules/conftest.py b/tests/services/orders/validation_service/sample_rules/conftest.py similarity index 83% rename from tests/services/order_validation_service/sample_rules/conftest.py rename to tests/services/orders/validation_service/sample_rules/conftest.py index df960da30d..60b91ebcc1 100644 --- a/tests/services/order_validation_service/sample_rules/conftest.py +++ b/tests/services/orders/validation_service/sample_rules/conftest.py @@ -2,14 +2,10 @@ from cg.models.orders.constants import OrderType from cg.models.orders.sample_base import ContainerEnum, PriorityEnum -from cg.services.order_validation_service.constants import ( - MINIMUM_VOLUME, - ElutionBuffer, - ExtractionMethod, -) -from cg.services.order_validation_service.workflows.microsalt.constants import MicrosaltDeliveryType -from cg.services.order_validation_service.workflows.microsalt.models.order import MicrosaltOrder -from cg.services.order_validation_service.workflows.microsalt.models.sample import MicrosaltSample +from cg.services.orders.validation.constants import MINIMUM_VOLUME, ElutionBuffer, ExtractionMethod +from cg.services.orders.validation.workflows.microsalt.constants import MicrosaltDeliveryType +from cg.services.orders.validation.workflows.microsalt.models.order import MicrosaltOrder +from cg.services.orders.validation.workflows.microsalt.models.sample import MicrosaltSample from cg.store.models import Application from cg.store.store import Store diff --git a/tests/services/order_validation_service/sample_rules/test_data_validators.py b/tests/services/orders/validation_service/sample_rules/test_data_validators.py similarity index 87% rename from tests/services/order_validation_service/sample_rules/test_data_validators.py rename to tests/services/orders/validation_service/sample_rules/test_data_validators.py index 31a3c4de8e..8eb2c5140c 100644 --- a/tests/services/order_validation_service/sample_rules/test_data_validators.py +++ b/tests/services/orders/validation_service/sample_rules/test_data_validators.py @@ -1,18 +1,18 @@ -from cg.services.order_validation_service.constants import MAXIMUM_VOLUME -from cg.services.order_validation_service.errors.sample_errors import ( +from cg.services.orders.validation.constants import MAXIMUM_VOLUME +from cg.services.orders.validation.errors.sample_errors import ( ApplicationArchivedError, ApplicationNotCompatibleError, ApplicationNotValidError, InvalidVolumeError, ) -from cg.services.order_validation_service.rules.sample.rules import ( +from cg.services.orders.validation.rules.sample.rules import ( validate_application_compatibility, validate_application_exists, validate_applications_not_archived, validate_volume_interval, ) -from cg.services.order_validation_service.workflows.microsalt.models.order import MicrosaltOrder -from cg.services.order_validation_service.workflows.microsalt.models.sample import MicrosaltSample +from cg.services.orders.validation.workflows.microsalt.models.order import MicrosaltOrder +from cg.services.orders.validation.workflows.microsalt.models.sample import MicrosaltSample from cg.store.models import Application from cg.store.store import Store diff --git a/tests/services/order_validation_service/sample_rules/test_inter_field_validators.py b/tests/services/orders/validation_service/sample_rules/test_inter_field_validators.py similarity index 85% rename from tests/services/order_validation_service/sample_rules/test_inter_field_validators.py rename to tests/services/orders/validation_service/sample_rules/test_inter_field_validators.py index 6ec4f17e9b..0ffb7fd4ff 100644 --- a/tests/services/order_validation_service/sample_rules/test_inter_field_validators.py +++ b/tests/services/orders/validation_service/sample_rules/test_inter_field_validators.py @@ -1,12 +1,12 @@ -from cg.services.order_validation_service.errors.sample_errors import ( +from cg.services.orders.validation.errors.sample_errors import ( OccupiedWellError, SampleNameRepeatedError, ) -from cg.services.order_validation_service.rules.sample.rules import ( +from cg.services.orders.validation.rules.sample.rules import ( validate_sample_names_unique, validate_wells_contain_at_most_one_sample, ) -from cg.services.order_validation_service.workflows.microsalt.models.order import MicrosaltOrder +from cg.services.orders.validation.workflows.microsalt.models.order import MicrosaltOrder def test_multiple_samples_in_well_not_allowed(order_with_samples_in_same_well: MicrosaltOrder): diff --git a/tests/services/order_validation_service/sample_rules/test_sample_rules.py b/tests/services/orders/validation_service/sample_rules/test_sample_rules.py similarity index 94% rename from tests/services/order_validation_service/sample_rules/test_sample_rules.py rename to tests/services/orders/validation_service/sample_rules/test_sample_rules.py index 47dbc8c811..2d3bdf17ab 100644 --- a/tests/services/order_validation_service/sample_rules/test_sample_rules.py +++ b/tests/services/orders/validation_service/sample_rules/test_sample_rules.py @@ -1,6 +1,6 @@ from cg.models.orders.sample_base import ContainerEnum, ControlEnum, PriorityEnum -from cg.services.order_validation_service.constants import ElutionBuffer, IndexEnum -from cg.services.order_validation_service.errors.sample_errors import ( +from cg.services.orders.validation.constants import ElutionBuffer, IndexEnum +from cg.services.orders.validation.errors.sample_errors import ( BufferInvalidError, ConcentrationInvalidIfSkipRCError, ConcentrationRequiredError, @@ -18,8 +18,8 @@ WellFormatError, WellFormatRmlError, ) -from cg.services.order_validation_service.index_sequences import INDEX_SEQUENCES -from cg.services.order_validation_service.rules.sample.rules import ( +from cg.services.orders.validation.index_sequences import INDEX_SEQUENCES +from cg.services.orders.validation.rules.sample.rules import ( validate_buffer_skip_rc_condition, validate_concentration_interval_if_skip_rc, validate_concentration_required_if_skip_rc, @@ -37,12 +37,12 @@ validate_well_position_format, validate_well_position_rml_format, ) -from cg.services.order_validation_service.workflows.fastq.models.order import FastqOrder -from cg.services.order_validation_service.workflows.fluffy.models.order import FluffyOrder -from cg.services.order_validation_service.workflows.microsalt.models.order import MicrosaltOrder -from cg.services.order_validation_service.workflows.mutant.models.order import MutantOrder -from cg.services.order_validation_service.workflows.rml.models.order import RmlOrder -from cg.services.order_validation_service.workflows.rml.models.sample import RmlSample +from cg.services.orders.validation.workflows.fastq.models.order import FastqOrder +from cg.services.orders.validation.workflows.fluffy.models.order import FluffyOrder +from cg.services.orders.validation.workflows.microsalt.models.order import MicrosaltOrder +from cg.services.orders.validation.workflows.mutant.models.order import MutantOrder +from cg.services.orders.validation.workflows.rml.models.order import RmlOrder +from cg.services.orders.validation.workflows.rml.models.sample import RmlSample from cg.store.models import Sample from cg.store.store import Store from tests.store_helpers import StoreHelpers diff --git a/tests/services/order_validation_service/test_case_rules.py b/tests/services/orders/validation_service/test_case_rules.py similarity index 86% rename from tests/services/order_validation_service/test_case_rules.py rename to tests/services/orders/validation_service/test_case_rules.py index 536c88d35b..37345f13bf 100644 --- a/tests/services/order_validation_service/test_case_rules.py +++ b/tests/services/orders/validation_service/test_case_rules.py @@ -1,21 +1,21 @@ from cg.constants import GenePanelMasterList from cg.models.orders.sample_base import ContainerEnum, SexEnum -from cg.services.order_validation_service.errors.case_errors import ( +from cg.services.orders.validation.errors.case_errors import ( CaseDoesNotExistError, CaseNameNotAvailableError, MultipleSamplesInCaseError, RepeatedCaseNameError, ) -from cg.services.order_validation_service.models.existing_case import ExistingCase -from cg.services.order_validation_service.models.order_with_cases import OrderWithCases -from cg.services.order_validation_service.rules.case.rules import ( +from cg.services.orders.validation.models.existing_case import ExistingCase +from cg.services.orders.validation.models.order_with_cases import OrderWithCases +from cg.services.orders.validation.rules.case.rules import ( validate_case_internal_ids_exist, validate_case_names_available, validate_case_names_not_repeated, validate_one_sample_per_case, ) -from cg.services.order_validation_service.workflows.rna_fusion.models.order import RnaFusionOrder -from cg.services.order_validation_service.workflows.rna_fusion.models.sample import RnaFusionSample +from cg.services.orders.validation.workflows.rna_fusion.models.order import RnaFusionOrder +from cg.services.orders.validation.workflows.rna_fusion.models.sample import RnaFusionSample from cg.store.models import Case from cg.store.store import Store diff --git a/tests/services/order_validation_service/test_case_sample_rules.py b/tests/services/orders/validation_service/test_case_sample_rules.py similarity index 96% rename from tests/services/order_validation_service/test_case_sample_rules.py rename to tests/services/orders/validation_service/test_case_sample_rules.py index 875a596463..3ca72b41a3 100644 --- a/tests/services/order_validation_service/test_case_sample_rules.py +++ b/tests/services/orders/validation_service/test_case_sample_rules.py @@ -1,7 +1,7 @@ import pytest from cg.models.orders.sample_base import ContainerEnum, SexEnum, StatusEnum -from cg.services.order_validation_service.errors.case_sample_errors import ( +from cg.services.orders.validation.errors.case_sample_errors import ( ApplicationArchivedError, ApplicationNotCompatibleError, ApplicationNotValidError, @@ -24,9 +24,9 @@ WellFormatError, WellPositionMissingError, ) -from cg.services.order_validation_service.models.existing_sample import ExistingSample -from cg.services.order_validation_service.models.order_with_cases import OrderWithCases -from cg.services.order_validation_service.rules.case_sample.rules import ( +from cg.services.orders.validation.models.existing_sample import ExistingSample +from cg.services.orders.validation.models.order_with_cases import OrderWithCases +from cg.services.orders.validation.rules.case_sample.rules import ( validate_application_compatibility, validate_application_exists, validate_application_not_archived, @@ -49,9 +49,9 @@ validate_well_positions_required, validate_wells_contain_at_most_one_sample, ) -from cg.services.order_validation_service.workflows.mip_dna.models.order import MipDnaOrder -from cg.services.order_validation_service.workflows.tomte.models.order import TomteOrder -from cg.services.order_validation_service.workflows.tomte.models.sample import TomteSample +from cg.services.orders.validation.workflows.mip_dna.models.order import MipDnaOrder +from cg.services.orders.validation.workflows.tomte.models.order import TomteOrder +from cg.services.orders.validation.workflows.tomte.models.sample import TomteSample from cg.store.models import Application, Sample from cg.store.store import Store diff --git a/tests/services/order_validation_service/test_order_rules.py b/tests/services/orders/validation_service/test_order_rules.py similarity index 91% rename from tests/services/order_validation_service/test_order_rules.py rename to tests/services/orders/validation_service/test_order_rules.py index 367d52ab77..cffac34469 100644 --- a/tests/services/order_validation_service/test_order_rules.py +++ b/tests/services/orders/validation_service/test_order_rules.py @@ -1,14 +1,14 @@ -from cg.services.order_validation_service.errors.order_errors import ( +from cg.services.orders.validation.errors.order_errors import ( CustomerCannotSkipReceptionControlError, CustomerDoesNotExistError, UserNotAssociatedWithCustomerError, ) -from cg.services.order_validation_service.rules.order.rules import ( +from cg.services.orders.validation.rules.order.rules import ( validate_customer_can_skip_reception_control, validate_customer_exists, validate_user_belongs_to_customer, ) -from cg.services.order_validation_service.workflows.tomte.models.order import TomteOrder +from cg.services.orders.validation.workflows.tomte.models.order import TomteOrder from cg.store.models import Customer from cg.store.store import Store diff --git a/tests/services/order_validation_service/__init__.py b/tests/services/orders/validation_service/workflows/__init__.py similarity index 100% rename from tests/services/order_validation_service/__init__.py rename to tests/services/orders/validation_service/workflows/__init__.py diff --git a/tests/services/order_validation_service/sample_rules/__init__.py b/tests/services/orders/validation_service/workflows/balsamic/__init__.py similarity index 100% rename from tests/services/order_validation_service/sample_rules/__init__.py rename to tests/services/orders/validation_service/workflows/balsamic/__init__.py diff --git a/tests/services/order_validation_service/workflows/balsamic/conftest.py b/tests/services/orders/validation_service/workflows/balsamic/conftest.py similarity index 81% rename from tests/services/order_validation_service/workflows/balsamic/conftest.py rename to tests/services/orders/validation_service/workflows/balsamic/conftest.py index c4a202fa51..0db505a3d7 100644 --- a/tests/services/order_validation_service/workflows/balsamic/conftest.py +++ b/tests/services/orders/validation_service/workflows/balsamic/conftest.py @@ -3,13 +3,13 @@ from cg.constants.constants import CAPTUREKIT_CANCER_OPTIONS, GenomeVersion from cg.models.orders.constants import OrderType from cg.models.orders.sample_base import ContainerEnum, ControlEnum, SexEnum, StatusEnum -from cg.services.order_validation_service.constants import MINIMUM_VOLUME, ElutionBuffer -from cg.services.order_validation_service.order_type_maps import ORDER_TYPE_RULE_SET_MAP, RuleSet -from cg.services.order_validation_service.order_validation_service import OrderValidationService -from cg.services.order_validation_service.workflows.balsamic.constants import BalsamicDeliveryType -from cg.services.order_validation_service.workflows.balsamic.models.case import BalsamicCase -from cg.services.order_validation_service.workflows.balsamic.models.order import BalsamicOrder -from cg.services.order_validation_service.workflows.balsamic.models.sample import BalsamicSample +from cg.services.orders.validation.constants import MINIMUM_VOLUME, ElutionBuffer +from cg.services.orders.validation.order_type_maps import ORDER_TYPE_RULE_SET_MAP, RuleSet +from cg.services.orders.validation.service import OrderValidationService +from cg.services.orders.validation.workflows.balsamic.constants import BalsamicDeliveryType +from cg.services.orders.validation.workflows.balsamic.models.case import BalsamicCase +from cg.services.orders.validation.workflows.balsamic.models.order import BalsamicOrder +from cg.services.orders.validation.workflows.balsamic.models.sample import BalsamicSample from cg.store.models import Application, Customer, User from cg.store.store import Store diff --git a/tests/services/order_validation_service/workflows/balsamic/test_rules.py b/tests/services/orders/validation_service/workflows/balsamic/test_rules.py similarity index 87% rename from tests/services/order_validation_service/workflows/balsamic/test_rules.py rename to tests/services/orders/validation_service/workflows/balsamic/test_rules.py index 7d1b63a1fc..fd6a62de7e 100644 --- a/tests/services/order_validation_service/workflows/balsamic/test_rules.py +++ b/tests/services/orders/validation_service/workflows/balsamic/test_rules.py @@ -1,17 +1,17 @@ -from cg.services.order_validation_service.errors.case_errors import ( +from cg.services.orders.validation.errors.case_errors import ( DoubleNormalError, DoubleTumourError, MoreThanTwoSamplesInCaseError, NumberOfNormalSamplesError, ) -from cg.services.order_validation_service.errors.case_sample_errors import CaptureKitMissingError -from cg.services.order_validation_service.rules.case.rules import ( +from cg.services.orders.validation.errors.case_sample_errors import CaptureKitMissingError +from cg.services.orders.validation.rules.case.rules import ( validate_at_most_two_samples_per_case, validate_number_of_normal_samples, ) -from cg.services.order_validation_service.workflows.balsamic.models.order import BalsamicOrder -from cg.services.order_validation_service.workflows.balsamic.models.sample import BalsamicSample -from cg.services.order_validation_service.workflows.balsamic.rules import ( +from cg.services.orders.validation.workflows.balsamic.models.order import BalsamicOrder +from cg.services.orders.validation.workflows.balsamic.models.sample import BalsamicSample +from cg.services.orders.validation.workflows.balsamic.rules import ( validate_capture_kit_panel_requirement, ) from cg.store.models import Application diff --git a/tests/services/order_validation_service/workflows/balsamic/test_validation_integration.py b/tests/services/orders/validation_service/workflows/balsamic/test_validation_integration.py similarity index 91% rename from tests/services/order_validation_service/workflows/balsamic/test_validation_integration.py rename to tests/services/orders/validation_service/workflows/balsamic/test_validation_integration.py index b6fd50f0e1..1273fec534 100644 --- a/tests/services/order_validation_service/workflows/balsamic/test_validation_integration.py +++ b/tests/services/orders/validation_service/workflows/balsamic/test_validation_integration.py @@ -1,7 +1,7 @@ from cg.models.orders.constants import OrderType -from cg.services.order_validation_service.order_type_maps import RuleSet -from cg.services.order_validation_service.order_validation_service import OrderValidationService -from cg.services.order_validation_service.workflows.balsamic.models.order import BalsamicOrder +from cg.services.orders.validation.order_type_maps import RuleSet +from cg.services.orders.validation.service import OrderValidationService +from cg.services.orders.validation.workflows.balsamic.models.order import BalsamicOrder def test_valid_order( diff --git a/tests/services/order_validation_service/workflows/__init__.py b/tests/services/orders/validation_service/workflows/tomte/__init__.py similarity index 100% rename from tests/services/order_validation_service/workflows/__init__.py rename to tests/services/orders/validation_service/workflows/tomte/__init__.py diff --git a/tests/services/order_validation_service/workflows/tomte/test_case_sample_rules.py b/tests/services/orders/validation_service/workflows/tomte/test_case_sample_rules.py similarity index 91% rename from tests/services/order_validation_service/workflows/tomte/test_case_sample_rules.py rename to tests/services/orders/validation_service/workflows/tomte/test_case_sample_rules.py index d03efa93e5..ed244d2330 100644 --- a/tests/services/order_validation_service/workflows/tomte/test_case_sample_rules.py +++ b/tests/services/orders/validation_service/workflows/tomte/test_case_sample_rules.py @@ -1,24 +1,24 @@ from cg.models.orders.sample_base import StatusEnum -from cg.services.order_validation_service.errors.case_errors import ( +from cg.services.orders.validation.errors.case_errors import ( InvalidGenePanelsError, RepeatedGenePanelsError, ) -from cg.services.order_validation_service.errors.case_sample_errors import ( +from cg.services.orders.validation.errors.case_sample_errors import ( DescendantAsFatherError, FatherNotInCaseError, InvalidFatherSexError, PedigreeError, SampleIsOwnFatherError, ) -from cg.services.order_validation_service.models.existing_sample import ExistingSample -from cg.services.order_validation_service.rules.case.rules import validate_gene_panels_unique -from cg.services.order_validation_service.rules.case_sample.rules import ( +from cg.services.orders.validation.models.existing_sample import ExistingSample +from cg.services.orders.validation.rules.case.rules import validate_gene_panels_unique +from cg.services.orders.validation.rules.case_sample.rules import ( validate_fathers_are_male, validate_fathers_in_same_case_as_children, validate_gene_panels_exist, validate_pedigree, ) -from cg.services.order_validation_service.workflows.tomte.models.order import TomteOrder +from cg.services.orders.validation.workflows.tomte.models.order import TomteOrder from cg.store.store import Store from tests.store_helpers import StoreHelpers diff --git a/tests/services/order_validation_service/workflows/tomte/test_model_validation.py b/tests/services/orders/validation_service/workflows/tomte/test_model_validation.py similarity index 94% rename from tests/services/order_validation_service/workflows/tomte/test_model_validation.py rename to tests/services/orders/validation_service/workflows/tomte/test_model_validation.py index 7213328932..c02fa58f60 100644 --- a/tests/services/order_validation_service/workflows/tomte/test_model_validation.py +++ b/tests/services/orders/validation_service/workflows/tomte/test_model_validation.py @@ -1,7 +1,5 @@ -from cg.services.order_validation_service.model_validator.model_validator import ( - ModelValidator, -) -from cg.services.order_validation_service.workflows.tomte.models.order import TomteOrder +from cg.services.orders.validation.model_validator.model_validator import ModelValidator +from cg.services.orders.validation.workflows.tomte.models.order import TomteOrder def test_valid_order_is_parsed(valid_order: TomteOrder): diff --git a/tests/services/order_validation_service/workflows/tomte/test_validation_integration.py b/tests/services/orders/validation_service/workflows/tomte/test_validation_integration.py similarity index 91% rename from tests/services/order_validation_service/workflows/tomte/test_validation_integration.py rename to tests/services/orders/validation_service/workflows/tomte/test_validation_integration.py index ed82416cc8..b6c0e4e954 100644 --- a/tests/services/order_validation_service/workflows/tomte/test_validation_integration.py +++ b/tests/services/orders/validation_service/workflows/tomte/test_validation_integration.py @@ -1,7 +1,7 @@ from cg.models.orders.constants import OrderType -from cg.services.order_validation_service.order_type_maps import RuleSet -from cg.services.order_validation_service.order_validation_service import OrderValidationService -from cg.services.order_validation_service.workflows.tomte.models.order import TomteOrder +from cg.services.orders.validation.order_type_maps import RuleSet +from cg.services.orders.validation.service import OrderValidationService +from cg.services.orders.validation.workflows.tomte.models.order import TomteOrder def test_valid_order( diff --git a/tests/store/conftest.py b/tests/store/conftest.py index 9a503fd2fc..49abb76f82 100644 --- a/tests/store/conftest.py +++ b/tests/store/conftest.py @@ -12,9 +12,7 @@ from cg.constants.priority import PriorityTerms from cg.constants.subject import PhenotypeStatus from cg.services.illumina.data_transfer.models import IlluminaFlowCellDTO -from cg.services.orders.store_order_services.implementations.store_pool_order import ( - StorePoolOrderService, -) +from cg.services.orders.storing.implementations.pool_order_service import StorePoolOrderService from cg.store.models import Analysis, Application, Case, CaseSample, IlluminaFlowCell, Sample from cg.store.store import Store from tests.store_helpers import StoreHelpers