Skip to content

feat: map diagnosis facet term values to display value (#4722)#4723

Open
frano-m wants to merge 7 commits intomainfrom
noopfran/4722-facet-term-mapping
Open

feat: map diagnosis facet term values to display value (#4722)#4723
frano-m wants to merge 7 commits intomainfrom
noopfran/4722-facet-term-mapping

Conversation

@frano-m
Copy link
Copy Markdown
Contributor

@frano-m frano-m commented Mar 24, 2026

Closes #4722.

This pull request introduces a new mapping for diagnosis term IDs to human-readable names, and updates the application to display these improved labels throughout the UI. The main focus is on enhancing the clarity of diagnosis-related data by showing both the name and the ontology ID (e.g., "Autism (OMIM:209850)") wherever diagnosis terms appear. The most important changes are grouped below:

Diagnosis Term Mapping Infrastructure:

  • Added a script (scripts/lookup-diagnosis-terms.ts) to fetch HP and OMIM term names from authoritative sources and generate a mapping of diagnosis term IDs to their display names. This script outputs a JS constant used by the app.
  • Introduced DIAGNOSIS_DISPLAY_VALUE in site-config/anvil-cmg/dev/index/common/diagnosis.ts (referenced, not shown) and imported it into utility files for use in value mapping.

UI Integration and Value Mapping:

  • Added the mapDiagnosisValue function in site-config/anvil-cmg/dev/index/common/utils.ts to map diagnosis term IDs to their display names (with fallback to raw value if unmapped).
  • Updated the diagnoses cell builder in app/viewModelBuilders/azul/anvil-cmg/common/viewModelBuilders.ts to display mapped diagnosis values in table cells.
  • Updated the select category configuration for diagnoses in site-config/anvil-cmg/dev/config.ts to use mapDiagnosisValue, ensuring consistent labeling in filters and selectors.

Codebase Cleanup and Imports:

  • Cleaned up and reorganized imports in several files to reflect the new mapping utility and remove unused or redundant imports. [1] [2] [3] [4]

These changes collectively ensure that all diagnosis terms shown in the UI are now much more user-friendly and informative, improving both accessibility and user experience.

@frano-m frano-m requested a review from NoopDog March 24, 2026 06:41
NoopDog and others added 3 commits March 23, 2026 23:55
Script fetches term IDs from the AnVIL Azul API and resolves names
from authoritative sources (hp.obo for HP, phenotype.hpoa for OMIM).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…#4722

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@frano-m frano-m marked this pull request as ready for review March 24, 2026 06:59
@frano-m frano-m requested a review from Copilot March 24, 2026 06:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a diagnosis code → human-readable label mapping to the AnVIL CMG site config so diagnosis facet values can be displayed as friendly names rather than raw HP/OMIM IDs.

Changes:

  • Introduces an auto-generated DIAGNOSIS_DISPLAY_VALUE lookup for HP/OMIM term IDs.
  • Adds mapDiagnosisValue and wires it into the diagnosis select category configuration.
  • Adds a generator script (scripts/lookup-diagnosis-terms.ts) to build/update the mapping from authoritative sources.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
site-config/anvil-cmg/dev/index/common/utils.ts Adds mapDiagnosisValue using the new diagnosis display mapping.
site-config/anvil-cmg/dev/index/common/diagnosis.ts New generated dictionary mapping HP/OMIM IDs to display names.
site-config/anvil-cmg/dev/config.ts Applies diagnosis value mapping in the diagnosis select category configuration and refactors imports.
scripts/lookup-diagnosis-terms.ts New script to generate the diagnosis mapping from Azul + HPO/OMIM sources.
Comments suppressed due to low confidence (1)

site-config/anvil-cmg/dev/config.ts:90

  • Diagnosis mapping is only applied to diagnoses.disease, but diagnoses.phenotype is also a diagnosis facet and the mapping dictionary/script covers phenotype IDs too. If the intent is to make diagnosis facets human-readable, apply the same mapSelectCategoryValue(mapDiagnosisValue) to the DIAGNOSIS_PHENOTYPE category as well (or clarify why phenotype is excluded).
            {
              key: ANVIL_CMG_CATEGORY_KEY.DIAGNOSE_DISEASE,
              label: ANVIL_CMG_CATEGORY_LABEL.DIAGNOSE_DISEASE,
              mapSelectCategoryValue: mapSelectCategoryValue(mapDiagnosisValue),
            },
            {
              key: ANVIL_CMG_CATEGORY_KEY.DONOR_ORGANISM_TYPE,
              label: ANVIL_CMG_CATEGORY_LABEL.DONOR_ORGANISM_TYPE,
            },
            {
              key: ANVIL_CMG_CATEGORY_KEY.DIAGNOSIS_PHENOTYPE,
              label: ANVIL_CMG_CATEGORY_LABEL.DIAGNOSIS_PHENOTYPE,
            },

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

Map diagnosis facet term values to display value

3 participants