Clinical-Genomics / cg

Glue between Clinical Genomics apps
8 stars 2 forks source link

Bug: Error when submitting a microbial order #3520

Closed moedarrah closed 3 months ago

moedarrah commented 3 months ago

In the order portal with a microbial order:

message: "400: Unavailable well: Invalid format for row. Expected numeric but got A"

Screenshot 2024-08-06 at 10 24 00
moedarrah commented 3 months ago

Multiple tickets were created in SUSY, despite the frontend app indicating that the order submission had failed.

Screenshot 2024-08-06 at 13 10 17

seallard commented 3 months ago

Reproduced with the following order form 1603.11.microbial.xlsx

seallard commented 3 months ago

Error

Aug 07 08:58:16 cg-services-stage.scilifelab.se podman[3117263]: 10.0.2.100 - - [07/Aug/2024:08:58:16 +0200] "POST /api/v1/submit_order/microsalt HTTP/1.0" 500 88 "https://clinical-genomics-stage.web.app/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:128.0) Gecko/20100101 Fi>
Aug 07 08:58:16 cg-services-stage.scilifelab.se podman[3117263]: requests.exceptions.HTTPError: 400: Unavailable well: Invalid format for row. Expected numeric but got A
Aug 07 08:58:16 cg-services-stage.scilifelab.se podman[3117263]:     raise requests.exceptions.HTTPError(message, response=response)
Aug 07 08:58:16 cg-services-stage.scilifelab.se podman[3117263]:   File "/usr/local/lib/python3.11/site-packages/genologics/lims.py", line 202, in validate_response
Aug 07 08:58:16 cg-services-stage.scilifelab.se podman[3117263]:     self.validate_response(response, accept_status_codes)
Aug 07 08:58:16 cg-services-stage.scilifelab.se podman[3117263]:   File "/usr/local/lib/python3.11/site-packages/genologics/lims.py", line 209, in parse_response
Aug 07 08:58:16 cg-services-stage.scilifelab.se podman[3117263]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Aug 07 08:58:16 cg-services-stage.scilifelab.se podman[3117263]:     return self.parse_response(r, accept_status_codes=[200, 201, 202])
Aug 07 08:58:16 cg-services-stage.scilifelab.se podman[3117263]:   File "/usr/local/lib/python3.11/site-packages/genologics/lims.py", line 158, in post
Aug 07 08:58:16 cg-services-stage.scilifelab.se podman[3117263]:              ^^^^^^^^^^^^^^^^^^^^
Aug 07 08:58:16 cg-services-stage.scilifelab.se podman[3117263]:     result = self.post(uri, data)
Aug 07 08:58:16 cg-services-stage.scilifelab.se podman[3117263]:   File "/home/src/app/cg/apps/lims/order.py", line 20, in save_xml
Aug 07 08:58:16 cg-services-stage.scilifelab.se podman[3117263]:               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Aug 07 08:58:16 cg-services-stage.scilifelab.se podman[3117263]:     results = self.save_xml(sample_uri, sample_details)
Aug 07 08:58:16 cg-services-stage.scilifelab.se podman[3117263]:   File "/home/src/app/cg/apps/lims/order.py", line 36, in save_samples
Aug 07 08:58:16 cg-services-stage.scilifelab.se podman[3117263]:                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Aug 07 08:58:16 cg-services-stage.scilifelab.se podman[3117263]:     sample_map = self.save_samples(sample_details, map_samples=process_reagentlabels)
Aug 07 08:58:16 cg-services-stage.scilifelab.se podman[3117263]:   File "/home/src/app/cg/apps/lims/order.py", line 90, in submit_project
Aug 07 08:58:16 cg-services-stage.scilifelab.se podman[3117263]:                    ^^^^^^^^^^^^^^^^^^^^^^^^
Aug 07 08:58:16 cg-services-stage.scilifelab.se podman[3117263]:     project_data = lims_api.submit_project(
Aug 07 08:58:16 cg-services-stage.scilifelab.se podman[3117263]:   File "/home/src/app/cg/meta/orders/lims.py", line 28, in process_lims
Aug 07 08:58:16 cg-services-stage.scilifelab.se podman[3117263]:                              ^^^^^^^^^^^^^
Aug 07 08:58:16 cg-services-stage.scilifelab.se podman[3117263]:     project_data, lims_map = process_lims(
Aug 07 08:58:16 cg-services-stage.scilifelab.se podman[3117263]:   File "/home/src/app/cg/meta/orders/microbial_submitter.py", line 50, in submit_order
Aug 07 08:58:16 cg-services-stage.scilifelab.se podman[3117263]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Aug 07 08:58:16 cg-services-stage.scilifelab.se podman[3117263]:     return submit_handler.submit_order(order=order_in)
Aug 07 08:58:16 cg-services-stage.scilifelab.se podman[3117263]:   File "/home/src/app/cg/meta/orders/api.py", line 89, in submit
Aug 07 08:58:16 cg-services-stage.scilifelab.se podman[3117263]:                    ^^^^^^^^^^^
Aug 07 08:58:16 cg-services-stage.scilifelab.se podman[3117263]:     result: dict = api.submit(
Aug 07 08:58:16 cg-services-stage.scilifelab.se podman[3117263]:   File "/home/src/app/cg/server/api.py", line 86, in submit_order
Aug 07 08:58:16 cg-services-stage.scilifelab.se podman[3117263]: Traceback (most recent call last):
Aug 07 08:58:16 cg-services-stage.scilifelab.se podman[3117263]: 2024-08-07 08:58:16 17f13e3841f8 cg.server.api[9] ERROR 400: Unavailable well: Invalid format for row. Expected numeric but got A
seallard commented 3 months ago

The issue is not present for sars, rml, nipt etc. It seems to only occur specifically for the microbial order form.

seallard commented 3 months ago

Flow: Order portal -> CG web API -> genologics package -> lims.

The error originates from lims, complaining about the well formatting after the genologics package submits a request against samples/batch/create to create the samples.

seallard commented 3 months ago

The root cause is that the order form used for testing is invalidly formatted. Basically, it specifies wells for samples in tubes. I'll update it to make sure this does not happen again.