Skip to content

Only use standard ingredients when building the drug concept hierarchy (fixes #1966) - #2566

Open
DG47 wants to merge 1 commit into
OHDSI:masterfrom
DG47:fix/concept-hierarchy-standard-ingredient
Open

DG47 wants to merge 1 commit into
OHDSI:masterfrom
DG47:fix/concept-hierarchy-standard-ingredient

Conversation

@DG47

@DG47 DG47 commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Fixes #1966

The Drug section of ddl/results/init_concept_hierarchy.sql takes the level1 ingredient of each drug concept from concept_ancestor, filtering the ancestor on domain_id = 'Drug' and concept_class_id = 'Ingredient'. Classification concepts (standard_concept = 'C') with the Ingredient concept class also match, so every drug below one of them gets a second concept_hierarchy row with the classification concept as its ingredient. In the Data Sources drug treemap those drugs then show up under the classification concept (the ALKA-SELTZER PLUS example in the issue) as well as under their real ingredient.

This adds AND c2.standard_concept = 'S' to that ingredient join, as agreed in the issue discussion.

Changes:

  • src/main/resources/ddl/results/init_concept_hierarchy.sql: only standard concepts are used as the level1 ingredient in the Drug hierarchy.
  • src/test/java/org/ohdsi/webapi/service/DDLServiceTest.java: new test that renders the concept_hierarchy scripts (DDLService.INIT_CONCEPT_HIERARCHY_FILE_PATHS) for PostgreSQL, runs them against the embedded Postgres database with a small vocabulary (acetaminophen, an acetaminophen tablet, a classification concept with the Ingredient class, and an ATC chain), and checks that each drug gets exactly one Drug row with acetaminophen as level1 and the ATC levels above it. Before the change the query returns 4 rows instead of 2.

Testing:

  • mvn -B test -Dtest=DDLServiceTest fails on master (expected:<2> but was:<4>) and passes with this change.
  • mvn -B test: unit tests Tests run: 146, Failures: 0, Errors: 0, Skipped: 5. The integration test run reports the same 3 VocabularyServiceIT failures (404) with and without this change.

The Drug section of init_concept_hierarchy.sql picks the level1
ingredient of every drug concept from concept_ancestor using
domain_id = 'Drug' and concept_class_id = 'Ingredient'. Classification
concepts (standard_concept = 'C') that carry the Ingredient class also
match, so drugs below them get an extra concept_hierarchy row with the
classification concept as their ingredient, and the Data Sources drug
treemap shows them under that concept as well as under their real
ingredient. Restrict the ingredient to standard concepts.

Adds a test that runs the concept_hierarchy scripts against the
embedded Postgres database with a small vocabulary containing such a
classification concept.

Fixes OHDSI#1966
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.

ACHILLES in ATLAS Data Sources, Drug Exposure Report

1 participant