Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Improve order flow) Export skip reception control #4144

Merged
merged 3 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions cg/services/orders/lims_service/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ def __init__(self, lims_api: LimsAPI):

@staticmethod
def _build_lims_sample(
customer: str, samples: list[Sample], workflow: Workflow, delivery_type: DataDelivery
customer: str,
samples: list[Sample],
workflow: Workflow,
delivery_type: DataDelivery,
skip_reception_control: bool,
) -> list[LimsSample]:
"""Convert order input to LIMS interface input."""
samples_lims = []
Expand All @@ -26,6 +30,8 @@ def _build_lims_sample(
dict_sample["data_analysis"] = workflow
dict_sample["data_delivery"] = delivery_type
dict_sample["family_name"] = sample._case_name
if skip_reception_control:
dict_sample["skip_reception_control"] = True
lims_sample: LimsSample = LimsSample.parse_obj(dict_sample)
samples_lims.append(lims_sample)
return samples_lims
Expand All @@ -38,10 +44,15 @@ def process_lims(
order_name: str,
workflow: Workflow,
delivery_type: DataDelivery,
skip_reception_control: bool,
) -> tuple[any, dict]:
"""Process samples to add them to LIMS."""
samples_lims: list[LimsSample] = self._build_lims_sample(
customer=customer, samples=samples, workflow=workflow, delivery_type=delivery_type
customer=customer,
samples=samples,
workflow=workflow,
delivery_type=delivery_type,
skip_reception_control=skip_reception_control,
)
project_name: str = str(ticket) or order_name
# Create new lims project
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def store_order(self, order: OrderWithCases) -> dict:
order_name=order.name,
workflow=ORDER_TYPE_WORKFLOW_MAP[order.order_type],
delivery_type=order.delivery_type,
skip_reception_control=order.skip_reception_control,
)
if lims_map:
self._fill_in_sample_ids(samples=new_samples, lims_map=lims_map)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def store_order(self, order: FastqOrder) -> dict:
workflow=Workflow.RAW_DATA,
customer=order.customer,
delivery_type=DataDelivery(order.delivery_type),
skip_reception_control=order.skip_reception_control,
)
self._fill_in_sample_ids(samples=order.samples, lims_map=lims_map)
new_samples: list[Sample] = self.store_order_data_in_status_db(order=order)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def store_order(self, order: OrderMetagenome) -> dict:
order_name=order.name,
workflow=ORDER_TYPE_WORKFLOW_MAP[order.order_type],
delivery_type=DataDelivery(order.delivery_type),
skip_reception_control=order.skip_reception_control,
)
self._fill_in_sample_ids(samples=order.samples, lims_map=lims_map)
new_samples = self.store_order_data_in_status_db(order)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def store_order(self, order: MicrobialFastqOrder) -> dict:
workflow=Workflow.RAW_DATA,
customer=order.customer,
delivery_type=DataDelivery(order.delivery_type),
skip_reception_control=order.skip_reception_control,
)
self._fill_in_sample_ids(samples=order.samples, lims_map=lims_map)
new_samples: list[Sample] = self.store_order_data_in_status_db(order=order)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def store_order(self, order: MicrobialOrder) -> dict:
order_name=order.name,
workflow=ORDER_TYPE_WORKFLOW_MAP[order.order_type],
delivery_type=DataDelivery(order.delivery_type),
skip_reception_control=order.skip_reception_control,
)
self._fill_in_sample_ids(samples=order.samples, lims_map=lims_map)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def store_order(self, order: PacbioOrder) -> dict:
workflow=Workflow.RAW_DATA,
customer=order.customer,
delivery_type=DataDelivery(order.delivery_type),
skip_reception_control=order.skip_reception_control,
)
self._fill_in_sample_ids(samples=order.samples, lims_map=lims_map)
new_samples = self.store_order_data_in_status_db(order=order)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def store_order(self, order: OrderWithIndexedSamples) -> dict:
order_name=order.name,
workflow=ORDER_TYPE_WORKFLOW_MAP[order.order_type],
delivery_type=order.delivery_type,
skip_reception_control=order.skip_reception_control,
)
self._fill_in_sample_ids(samples=order.samples, lims_map=lims_map)
new_records: list[Pool] = self.store_order_data_in_status_db(order=order)
Expand Down
4 changes: 2 additions & 2 deletions cg/services/orders/validation/rules/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ def is_volume_missing(sample: Sample) -> bool:
def has_sample_invalid_concentration(
sample: SampleWithSkipRC, allowed_interval: tuple[float, float]
) -> bool:
concentration: float = sample.concentration_ng_ul
return not is_sample_concentration_within_interval(
concentration: float | None = sample.concentration_ng_ul
return concentration and not is_sample_concentration_within_interval(
concentration=concentration, interval=allowed_interval
)

Expand Down
Loading