Skip to content

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

Merged
chrisknoll merged 2 commits into
OHDSI:masterfrom
DG47:fix/condition-treemap-level1
Nov 2, 2026
Merged

chrisknoll merged 2 commits 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
@DG47

DG47 commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

@chrisknoll could you take a look at this one too? It fixes #2468: condition/treemap.sql builds concept_path with level2_concept_name twice, so every condition in the Data Sources treemap repeats the HLT name and loses the level1 (MedDRA PT) name. It now uses level1_concept_name, like the condition era and cohort results treemaps. It's mergeable and doesn't touch the files of #2562 or #2566.

@chrisknoll
chrisknoll merged commit c728fec into OHDSI:master Nov 2, 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.

level2_concept_name condition duplicated

2 participants