OHDSI / dbt-synthea

[Under development] A dbt ETL project to convert a Synthea synthetic data set into the OMOP CDM
https://ohdsi.github.io/dbt-synthea/
Apache License 2.0
16 stars 6 forks source link

Database Error in test relationships_source_to_concept_map_source_concept_id__concept_id__ref_concept_ (models/omop/_models/source_to_concept_map.yml) #103

Closed dafraile closed 3 hours ago

dafraile commented 1 day ago

When running the default dbt build for omop (step 11 of README) it throw an error:

as below:

02:41:42 Finished running 85 table models, 28 seeds, 425 data tests in 0 hours 0 minutes and 34.85 seconds (34.85s). 02:41:42
02:41:42 Completed with 1 error and 0 warnings: 02:41:42
02:41:42 Database Error in test relationships_source_to_concept_map_source_concept_id__concept_id__refconcept (models/omop/_models/source_to_concept_map.yml) operator does not exist: character varying = integer LINE 27: on child.from_field = parent.to_field ^ HINT: No operator matches the given name and argument types. You might need to add explicit type casts. compiled code at target/run/synthea_omop_etl/models/omop/_models/source_to_concept_map.yml/relationships_source_to_concep_ef6f1abf0bff3c7fa99e473bcb2b6fcc.sql 02:41:42
02:41:42 Done. PASS=537 WARN=0 ERROR=1 SKIP=0 TOTAL=538

The error can be fixed by modifying /models/omop/source_to_concept_map.sql to this:

SELECT cast(null AS int) AS source_code , cast(null AS int) AS source_concept_id , cast(null AS int) AS source_vocabulary_id , cast(null AS varchar) AS source_code_description , cast(null AS int) AS target_concept_id , cast(null AS varchar) AS target_vocabulary_id , cast(null AS date) AS valid_start_date , cast(null AS date) AS valid_end_date , cast(null AS varchar(1)) AS invalid_reason WHERE false

katy-sadowski commented 5 hours ago

Whoops! Good catch, thanks for reporting this. Fix up for review in #104

katy-sadowski commented 3 hours ago

Fixed (thanks to @lawrenceadams quick review 😄 !)