Skip to content

fix stg_vocabulary__source_to_concept_map when seed_source is false#151

Open
odikia wants to merge 4 commits into
OHDSI:mainfrom
odikia:odikia__fix-stcm-seed-source
Open

fix stg_vocabulary__source_to_concept_map when seed_source is false#151
odikia wants to merge 4 commits into
OHDSI:mainfrom
odikia:odikia__fix-stcm-seed-source

Conversation

@odikia

@odikia odikia commented Feb 7, 2026

Copy link
Copy Markdown

Summary

  • source_to_concept_map_seed is not part of the Athena vocabulary download and only exists in the seeds schema
  • When seed_source: false, the vocabulary source schema switches to _vocab where this table does not exist
  • get_filtered_columns_in_relation() returns an empty list, causing Parser Error: SELECT clause without selection list
  • Add get_source wrapper macro that routes source_to_concept_map_seed to ref() (the seed) when seed_source: false, and passes all other tables through to source() as normal
  • Uses do return() to preserve the Relation object for introspection macros like get_filtered_columns_in_relation()

Verified on forked repo with full Athena vocabulary loaded and seed_source: false.

Note: #95 was closed as completed but no PR was merged — the bug remains on main.

Closes #95

source_to_concept_map_seed is not part of the Athena vocabulary download
and only exists in the seeds schema. When seed_source is false, the source
resolves to the vocab schema where the table does not exist, causing a
parser error. Add get_source wrapper macro that routes this table to ref()
when seed_source is false.

Closes OHDSI#95
@odikia

odikia commented Feb 7, 2026

Copy link
Copy Markdown
Author

@katy-sadowski , hey there! It's Dan from Kheiron BTW, just in case you don't recognize my github handle ;)

@katy-sadowski

Copy link
Copy Markdown
Collaborator

Hi Dan! Good catch! We actually did fix the issue in #95 but then I reverted that change later on and introduced a new bug.

I think there might be a simpler solution than what's proposed here. I believe you can override the schema param here at the table level - so just tell dbt to always look in the seed schema for the STCM table. It already tells it to source from the vocab seed table, but it's looking in the wrong schema.

https://github.com/OHDSI/dbt-synthea/blob/main/models/staging/vocabulary/_vocabulary__sources.yml

Add generate_schema_name macro and configure dbt_project.yml so that
vocabulary models materialize into dbt_synthea_dev_vocab and clinical
models into dbt_synthea_dev_cdm. Staging/intermediate remain in
dbt_synthea_dev. The file restructure (moving models into vocabulary/
and clinical/ subdirectories) is a prerequisite for this to take effect.
Restructure models/omop/ so dbt applies the +schema config from
dbt_project.yml. Vocabulary tables (concept, concept_ancestor, etc.)
go to models/omop/vocabulary/ -> dbt_synthea_dev_vocab schema.
Clinical tables (person, condition_occurrence, etc.) go to
models/omop/clinical/ -> dbt_synthea_dev_cdm schema.

No SQL or YML content changed — file moves only.
load_data_duckdb macro now skips strptime for DATE columns that
parquet files already provide as native dates. Added pyproject.toml
with dbt-core, dbt-duckdb, and duckdb dependencies for uv-based
execution.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create empty source_to_concept_map model instead of seeding it

2 participants