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

Ejl/fix date consistency #137

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,12 @@ make clean && make run

Consult `docs/`.


# Troubleshooting possible development errors

## bifrost_db container ERROR: child process failed, exited with 1
When running make run. If the bifrost conainer keeps failing with an error message saying "ERROR: child process failed, exited with 1". Look for if "Error creating journal directory".
One way to get around this error is by running `make run` with sudo privilidges:
```shell
sudo make run
```
8 changes: 4 additions & 4 deletions bifrost/bifrost_queue_broker/common/database.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os, sys
import binascii
import logging
import datetime
from datetime import datetime

from typing import Dict, Literal, Tuple, overload

Expand Down Expand Up @@ -173,9 +173,9 @@ def encrypt_dict(encryption_client: ClientEncryption, val, filter_list=None):
def coerce_date(dayfirst):
def parse_value(v):
try:
if isinstance(v, datetime.datetime):
return v.isoformat()
return parser.parse(v, dayfirst=dayfirst).isoformat() if v else None
if isinstance(v, datetime):
return v
return parser.parse(v, dayfirst=dayfirst) if v else None
except:
return None
return parse_value
Expand Down
4 changes: 3 additions & 1 deletion docker-compose.local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ services:
- "bifrost_db"

sap_broker_queue:
image: sekvensanalyseplatform/sap-queue-broker:437
build:
context: ./bifrost/bifrost_queue_broker
dockerfile: Dockerfile
depends_on:
- "sap_api"
- "bifrost_db"
Expand Down
6 changes: 3 additions & 3 deletions sap_tbr_integration/DG.SAP.TBRIntegration/tbr.generated.jsonl
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{"isolate_id":"2010F00006","institution":"SSI","date_received":"1945-12-13T12:05:56.143Z","run_id":"culpa tempor","provided_species":"culpa officia sint id","primary_isolate":false,"date_run":"1978-01-12T02:11:46.207Z","project_number":-27841476.650654063,"project_title":"nisi officia","date_sample":"1973-11-09T21:59:05.017Z","public":"amet ut eu sit deserunt","cpr_nr":"2902007734","gender":"K","name":"Elliot Rosenbaum","age":53,"travel":"et occaecat Lorem adipisicing","travel_country":"Guernsey","date_received_kma":"1947-08-02T21:01:12.522Z","kma":"ul","region":"sint cupidatat veniam","fud_number":"nostrud occaecat","cluster_id":"cillum nostrud cupidatat non officia","epi_export":"consequat enim exercitation"}
{"isolate_id":"2010F00048","institution":"SSI","date_received":"1994-11-20T22:49:04.27Z","run_id":"laboris tempor","provided_species":"eu culpa exercitation","primary_isolate":true,"date_run":"1945-01-15T16:52:56.924Z","project_number":-33496873.684678532,"project_title":"labore","date_sample":"2003-11-26T18:48:06.257Z","public":"dolore aute consectetur","cpr_nr":"0000000002","gender":"M","name":"Adaline Waelchi","age":0,"travel":"Duis","travel_country":"Serbia","date_received_kma":"1971-03-15T05:10:15.052Z","kma":"ea","region":"cupidatat ex","fud_number":"non","cluster_id":"tempor i","epi_export":"dolor aute"}
{"isolate_id":"2009T00243","institution":"SSI","date_received":"1987-05-15T16:41:34.514Z","run_id":"in Excepteur nostrud proident","provided_species":"aute minim","primary_isolate":false,"date_run":"1980-01-04T05:31:12.256Z","project_number":12997890.419586033,"project_title":"consectetur esse","date_sample":"1946-03-26T02:37:54.67Z","public":"pariatur","cpr_nr":"0000000001","gender":"K","name":"Brendon Ledner","age":6,"travel":"incididunt est veniam","travel_country":"Ethiopia","date_received_kma":"1987-07-10T12:45:08.443Z","kma":"nostrud aliquip velit dolor Lore","region":"sint et","fud_number":"enim nulla ut","cluster_id":"do Ut incididunt magna nisi","epi_export":"laboris mollit"}
{"isolate_id":"2010F00006","institution":"SSI","ssi_date":"1945-12-13T12:05:56.143Z","run_id":"culpa tempor","provided_species":"culpa officia sint id","primary_isolate":false,"date_run":"1978-01-12T02:11:46.207Z","project_number":-27841476.650654063,"project_title":"nisi officia","test_date":"1973-11-09T21:59:05.017Z","public":"amet ut eu sit deserunt","cpr_nr":"2902007734","gender":"K","name":"Elliot Rosenbaum","age":53,"travel":"et occaecat Lorem adipisicing","travel_country":"Guernsey","kma_date":"1947-08-02T21:01:12.522Z","kma_name":"ul","region":"sint cupidatat veniam","fud_number":"nostrud occaecat","cluster_id":"cillum nostrud cupidatat non officia","epi_export":"consequat enim exercitation"}
{"isolate_id":"2010F00048","institution":"SSI","ssi_date":"1994-11-20T22:49:04.27Z","run_id":"laboris tempor","provided_species":"eu culpa exercitation","primary_isolate":true,"date_run":"1945-01-15T16:52:56.924Z","project_number":-33496873.684678532,"project_title":"labore","test_date":"2003-11-26T18:48:06.257Z","public":"dolore aute consectetur","cpr_nr":"0000000002","gender":"M","name":"Adaline Waelchi","age":0,"travel":"Duis","travel_country":"Serbia","kma_date":"1971-03-15T05:10:15.052Z","kma_name":"ea","region":"cupidatat ex","fud_number":"non","cluster_id":"tempor i","epi_export":"dolor aute"}
{"isolate_id":"2009T00243","institution":"SSI","ssi_date":"1987-05-15T16:41:34.514Z","run_id":"in Excepteur nostrud proident","provided_species":"aute minim","primary_isolate":false,"date_run":"1980-01-04T05:31:12.256Z","project_number":12997890.419586033,"project_title":"consectetur esse","test_date":"1946-03-26T02:37:54.67Z","public":"pariatur","cpr_nr":"0000000001","gender":"K","name":"Brendon Ledner","age":6,"travel":"incididunt est veniam","travel_country":"Ethiopia","kma_date":"1987-07-10T12:45:08.443Z","kma_name":"nostrud aliquip velit dolor Lore","region":"sint et","fud_number":"enim nulla ut","cluster_id":"do Ut incididunt magna nisi","epi_export":"laboris mollit"}
8 changes: 4 additions & 4 deletions web/src/SAP/common/database.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os, sys
import binascii
import logging
import datetime
from datetime import datetime

from typing import Dict, Literal, Tuple, overload

Expand Down Expand Up @@ -173,9 +173,9 @@ def encrypt_dict(encryption_client: ClientEncryption, val, filter_list=None):
def coerce_date(dayfirst):
def parse_value(v):
try:
if isinstance(v, datetime.datetime):
return v.isoformat()
return parser.parse(v, dayfirst=dayfirst).isoformat() if v else None
if isinstance(v, datetime):
return v
return parser.parse(v, dayfirst=dayfirst) if v else None
except:
return None
return parse_value
Expand Down