Skip to content

Commit

Permalink
Feat(Orders) Introduce comprehensive order validation (#3815)(major)
Browse files Browse the repository at this point in the history
### Added

- New validation flow for all order types
- New OrderValidationService
- New BaseModel's for all order types performing basic validation such as type checking
- Rules written for each validation for more complicated rules, including database checks and fields dependent on each other.
- New endpoint for validating orders
- New Request handling in submit_order
  • Loading branch information
islean authored Jan 23, 2025
1 parent 3c17afc commit f8a0f80
Show file tree
Hide file tree
Showing 241 changed files with 14,261 additions and 5,643 deletions.
2 changes: 1 addition & 1 deletion cg/apps/orderform/excel_orderform_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
from cg.constants import DataDelivery
from cg.constants.orderforms import Orderform
from cg.exc import OrderFormError
from cg.models.orders.constants import OrderType
from cg.models.orders.excel_sample import ExcelSample
from cg.models.orders.order import OrderType

LOG = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion cg/apps/orderform/json_orderform_parser.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from cg.apps.orderform.orderform_parser import OrderformParser
from cg.constants import DataDelivery, Workflow
from cg.exc import OrderFormError
from cg.models.orders.constants import OrderType
from cg.models.orders.json_sample import JsonSample
from cg.models.orders.order import OrderType


class JsonOrderformParser(OrderformParser):
Expand Down
2 changes: 1 addition & 1 deletion cg/apps/orderform/orderform_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from cg.apps.orderform.utils import ORDER_TYPES_WITH_CASES
from cg.constants import DataDelivery
from cg.exc import OrderFormError
from cg.models.orders.order import OrderType
from cg.models.orders.constants import OrderType
from cg.models.orders.orderform_schema import OrderCase, Orderform, OrderPool
from cg.models.orders.sample_base import OrderSample
from cg.store.models import Customer
Expand Down
9 changes: 1 addition & 8 deletions cg/constants/orderforms.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
from enum import StrEnum

from cg.constants import ANALYSIS_SOURCES, METAGENOME_SOURCES
from cg.models.orders.order import OrderType

SEX_MAP = {"male": "M", "female": "F", "unknown": "unknown"}
REV_SEX_MAP = {value: key for key, value in SEX_MAP.items()}
CONTAINER_TYPES = ["Tube", "96 well plate"]
SOURCE_TYPES = set().union(METAGENOME_SOURCES, ANALYSIS_SOURCES)

CASE_PROJECT_TYPES = [
OrderType.MIP_DNA,
OrderType.BALSAMIC,
OrderType.MIP_RNA,
]


class Orderform(StrEnum):
BALSAMIC: str = "1508"
Expand Down Expand Up @@ -79,4 +71,5 @@ def get_current_orderform_version(order_form: str) -> str:
"LaboratorieMedicinskt Centrum Gotland": "621 84 Visby",
"Unilabs Eskilstuna Laboratorium": "631 88 Eskilstuna",
"Norrland University Hospital": "901 85 Umeå",
"Länssjukhuset Sundsvall": "856 43 Sundsvall",
}
6 changes: 6 additions & 0 deletions cg/exc.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,12 @@ class OrderError(CgError):
"""


class OrderSubmissionError(CgError):
"""
Exception related to order submission.
"""


class OrderFormError(CgError):
"""
Exception related to the order form.
Expand Down
1 change: 0 additions & 1 deletion cg/meta/orders/__init__.py

This file was deleted.

48 changes: 0 additions & 48 deletions cg/meta/orders/api.py

This file was deleted.

43 changes: 0 additions & 43 deletions cg/models/orders/order.py

This file was deleted.

Loading

0 comments on commit f8a0f80

Please sign in to comment.