Skip to content

Use level1 concept name in Data Sources condition treemap path (fixes #2468) - #2559

Open
DG47 wants to merge 1 commit into
OHDSI:masterfrom
DG47:fix/condition-treemap-level1
Open

DG47 wants to merge 1 commit into
OHDSI:masterfrom
DG47:fix/condition-treemap-level1

Conversation

@DG47

@DG47 DG47 commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Fixes #2468

cdmresults/sql/report/condition/treemap.sql builds concept_path from level4 || level3 || level2 || level2 || concept_name. Because level2_concept_name appears twice, every condition in the Data Sources > Condition Occurrence treemap gets the HLT name twice and loses the level1 (MedDRA PT) name entirely. The Condition Era report (conditionera/treemap.sql) and the cohort results condition treemap (cohortresults/sql/condition/sqlConditionTreemap.sql) both use level1_concept_name in that spot, and init_concept_hierarchy.sql fills level1 with the PT name for the Condition treemap. No other treemap query has the duplicate.

On @chrisknoll's question in the issue about whether the condition hierarchy skips level 1 on purpose: all three condition treemap queries read the same treemap='Condition' rows of concept_hierarchy, and the condition era and cohort results ones already use level1_concept_name, so nothing in the hierarchy is set up to be skipped for this report. The path still has the same five segments, so the front end gets the same depth as before.

Changes:

  • condition/treemap.sql: replace the second level2_concept_name with level1_concept_name.
  • New CDMResultsTreemapTest: creates achilles_results and concept_hierarchy in a scratch schema on the embedded Postgres test database, runs CDMResultsAnalysisRunner.getTreemap(..., "condition", ...) and checks the full SOC||HLGT||HLT||PT||concept path.

Testing (JDK 8, -Pwebapi-postgresql):

  • Before the fix, CDMResultsTreemapTest fails: expected:<...tes mellitus (HLT)||[Type 2 diabetes mellitus (P]T)||...> but was:<...tes mellitus (HLT)||[Diabetes mellitus (HL]T)||...>
  • After the fix, mvn -DskipUnitTests=false -DskipITtests=true -Pwebapi-postgresql -Dtest=CDMResultsTreemapTest,CDMResultsAnalysisRunnerTest,CDMResultsCacheTest test gives Tests run: 15, Failures: 0, Errors: 0, Skipped: 0.

Note: sources that already have a condition treemap in the Achilles cache will keep showing the old path until that cache entry is cleared or rebuilt.

The condition occurrence treemap query concatenated level2_concept_name
twice, so every concept path showed the HLT level twice and never the
level1 (PT) name. Use level1_concept_name like the condition era report
and the cohort results condition treemap do.

Adds a test that runs the condition treemap query against the embedded
Postgres database and checks the full concept path.

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

level2_concept_name condition duplicated

1 participant