feat: map diagnosis facet term values to display value (#4722)#4723
Open
feat: map diagnosis facet term values to display value (#4722)#4723
Conversation
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>
Contributor
There was a problem hiding this comment.
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_VALUElookup for HP/OMIM term IDs. - Adds
mapDiagnosisValueand 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, butdiagnoses.phenotypeis 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 samemapSelectCategoryValue(mapDiagnosisValue)to theDIAGNOSIS_PHENOTYPEcategory 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.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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.DIAGNOSIS_DISPLAY_VALUEinsite-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:
mapDiagnosisValuefunction insite-config/anvil-cmg/dev/index/common/utils.tsto map diagnosis term IDs to their display names (with fallback to raw value if unmapped).app/viewModelBuilders/azul/anvil-cmg/common/viewModelBuilders.tsto display mapped diagnosis values in table cells.site-config/anvil-cmg/dev/config.tsto usemapDiagnosisValue, ensuring consistent labeling in filters and selectors.Codebase Cleanup and Imports:
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.