Skip to content

Keep Procedure concepts without a vocabulary row in the concept hierarchy (fixes OHDSI/Atlas#2926) - #2581

Merged
chrisknoll merged 1 commit into
OHDSI:masterfrom
DG47:fix/procedure-hierarchy-custom-vocabulary
Nov 6, 2026
Merged

chrisknoll merged 1 commit into
OHDSI:masterfrom
DG47:fix/procedure-hierarchy-custom-vocabulary

Conversation

@DG47

@DG47 DG47 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Fixes OHDSI/Atlas#2926

The Data Sources Procedure report (cdmresults/sql/report/procedure/treemap.sql) inner-joins achilles_results (analysis 600/601) to concept_hierarchy rows with treemap = 'Procedure', so a procedure concept only shows up if init_concept_hierarchy.sql produced a hierarchy row for it.

The Procedure section of init_concept_hierarchy.sql is the only section that inner-joins the vocabulary table (it uses vocabulary_name to build the displayed concept name). A concept whose vocabulary_id has no row in vocabulary — typically site-specific concepts in the 2 billion range loaded into a local vocabulary — gets no concept_hierarchy row and silently disappears from the Procedure report, while the same kind of concept in the Condition, Observation, Measurement or Drug domains is reported. That is the asymmetry described in OHDSI/Atlas#2926 (custom concepts visible in the Observation report but not in the Procedure report).

Changes:

  • init_concept_hierarchy.sql: the Procedure section uses LEFT JOIN vocabulary and COALESCE(v1.vocabulary_name, c1.vocabulary_id) for the name prefix, so concepts without a vocabulary row are kept and labelled with their vocabulary_id.
  • DDLServiceTest: new test that runs the concept_hierarchy scripts against the embedded Postgres with one SNOMED procedure concept (vocabulary row present) and one local procedure concept (no vocabulary row) and asserts both get a Procedure hierarchy row with the expected names. Helper methods were extracted so the existing drug test and the new one share the script-running code.

Testing:

  • mvn -DskipUnitTests=false -Dtest=DDLServiceTest test -Pwebapi-postgresql: the new test fails on master (expected:<2> but was:<1>) and passes with this change (Tests run: 2, Failures: 0).
  • Checked the SqlRender translation of the changed statement for sql server, postgresql, snowflake, bigquery, spark, redshift and oracle; COALESCE and LEFT JOIN translate without changes.

Existing deployments need to re-run the concept hierarchy initialization (Configuration > Results schema init / ddl/results with initConceptHierarchy=true) to rebuild the table.

…rchy

The Procedure section of init_concept_hierarchy.sql inner-joins the
vocabulary table to build the displayed concept name. A concept whose
vocabulary_id has no row in vocabulary (typically site-specific concepts
loaded into a local vocabulary) therefore gets no concept_hierarchy row
and disappears from the Data Sources Procedure report, while the same
concept in any other domain is reported. Use a LEFT JOIN and fall back
to the vocabulary_id when the vocabulary name is missing.

Adds a test that builds the hierarchy from a Procedure concept with a
vocabulary row and one without.

Fixes OHDSI/Atlas#2926
@chrisknoll
chrisknoll merged commit ea3adc2 into OHDSI:master Nov 6, 2026
4 checks passed
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.

Custom concept IDs not displaying for the Procedure report within the Data Sources section

2 participants