-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix models to reflect new samples (#3671) (patch)
### Fixed - Required fields are marked as required for new samples
- Loading branch information
Showing
5 changed files
with
58 additions
and
12 deletions.
There are no files selected for viewing
14 changes: 12 additions & 2 deletions
14
cg/services/order_validation_service/workflows/balsamic/models/case.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,18 @@ | ||
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.workflows.balsamic.models.sample import BalsamicSample | ||
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, | ||
) | ||
|
||
NewSample = Annotated[BalsamicSample, Tag("new")] | ||
OldSample = Annotated[ExistingSample, Tag("existing")] | ||
|
||
|
||
class BalsamicCase(Case): | ||
samples: list[BalsamicSample] | ||
cohorts: list[str] | None = None | ||
samples: list[Annotated[NewSample | OldSample, Discriminator(has_internal_id)]] | ||
synopsis: str | None = None |
18 changes: 15 additions & 3 deletions
18
cg/services/order_validation_service/workflows/balsamic/models/order.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,20 @@ | ||
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.order_validation_service.workflows.balsamic.constants import ( | ||
BalsamicDeliveryType, | ||
) | ||
from cg.services.order_validation_service.workflows.balsamic.models.case import ( | ||
BalsamicCase, | ||
) | ||
|
||
NewCase = Annotated[BalsamicCase, Tag("new")] | ||
OldCase = Annotated[ExistingCase, Tag("existing")] | ||
|
||
|
||
class BalsamicOrder(OrderWithCases): | ||
cases: list[BalsamicCase] | ||
cases: list[Annotated[NewCase | OldCase, Discriminator(has_internal_id)]] | ||
delivery_type: BalsamicDeliveryType |
17 changes: 15 additions & 2 deletions
17
cg/services/order_validation_service/workflows/mip_dna/models/case.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,19 @@ | ||
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.workflows.mip_dna.models.sample import MipDnaSample | ||
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, | ||
) | ||
|
||
NewSample = Annotated[MipDnaSample, Tag("new")] | ||
OldSample = Annotated[ExistingSample, Tag("existing")] | ||
|
||
|
||
class MipDnaCase(Case): | ||
samples: list[MipDnaSample] | ||
cohorts: list[str] | None = None | ||
panels: list[str] | ||
synopsis: str | None = None | ||
samples: list[Annotated[NewSample | OldSample, Discriminator(has_internal_id)]] |
14 changes: 12 additions & 2 deletions
14
cg/services/order_validation_service/workflows/mip_dna/models/order.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,16 @@ | ||
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 | ||
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[MipDnaCase] | ||
cases: list[Annotated[NewCase | OldCase, Discriminator(has_internal_id)]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters