-
Notifications
You must be signed in to change notification settings - Fork 6
Fix: Scan FSH files and additional directories for Logical Models and ValueSets #183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: litlfred <662242+litlfred@users.noreply.github.com>
❌ Deployment FailedBranch: Deployment failed. Please check the build log for details. |
✅ Deployment SuccessfulBranch:
Deployment completed successfully! The site is now live at the URL above. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes the update_sushi_config.py script to properly discover Logical Models and ValueSets from FSH source files and additional JSON directories. The script was previously only scanning compiled JSON resources, missing the 16 Logical Models and 6 ValueSets defined in FSH files throughout the repository.
- Enhanced the script to parse FSH files directly using regex patterns to extract resource metadata
- Extended directory scanning from 2 to 6 locations including FSH source directories and alternative JSON paths
- Added comprehensive duplicate detection and QA reporting for all discovered resources
Reviewed Changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| input/scripts/update_sushi_config.py | Core enhancement adding FSH parsing functions and extending directory scanning to discover all Logical Models and ValueSets |
| input/pagecontent/ValueSet-*.md | Generated placeholder markdown files for discovered ValueSets with proper DAK API integration markers |
| input/pagecontent/StructureDefinition-*.md | Generated placeholder markdown files for discovered Logical Models with proper DAK API integration markers |
input/scripts/update_sushi_config.py
Outdated
| content = f.read() | ||
|
|
||
| # Look for Logical: declaration | ||
| logical_match = re.search(r'^Logical:\s+(\S+)', content, re.MULTILINE) |
Copilot
AI
Oct 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider extracting the regex patterns into module-level constants to improve maintainability and reduce duplication. For example: LOGICAL_PATTERN = r'^Logical:\s+(\S+)' and VALUESET_PATTERN = r'^ValueSet:\s+(\S+)'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot apply changes based on this feedback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extracted all FSH parsing regex patterns into module-level constants as suggested. The patterns are now defined once at the top of the module and reused in both parsing functions. Changes verified with tests. (80d0873)
input/scripts/update_sushi_config.py
Outdated
| content = f.read() | ||
|
|
||
| # Look for ValueSet: declaration | ||
| valueset_match = re.search(r'^ValueSet:\s+(\S+)', content, re.MULTILINE) |
Copilot
AI
Oct 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider extracting the regex patterns into module-level constants to improve maintainability and reduce duplication. For example: LOGICAL_PATTERN = r'^Logical:\s+(\S+)' and VALUESET_PATTERN = r'^ValueSet:\s+(\S+)'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot apply changes based on this feedback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes already applied in commit 80d0873. The regex pattern is now defined as the module-level constant VALUESET_PATTERN and used in both parsing functions.
input/scripts/update_sushi_config.py
Outdated
| model_id = logical_match.group(1) | ||
|
|
||
| # Extract title | ||
| title_match = re.search(r'^Title:\s*"([^"]+)"', content, re.MULTILINE) |
Copilot
AI
Oct 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The regex patterns for Title and Description are duplicated between both parsing functions. Consider extracting these into shared constants: TITLE_PATTERN = r'^Title:\s*\"([^\"]+)\"' and DESCRIPTION_PATTERN = r'^Description:\s*\"([^\"]+)\"'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot apply changes based on this feedback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes already applied in commit 80d0873. The Title and Description patterns are now defined as module-level constants TITLE_PATTERN and DESCRIPTION_PATTERN, shared between both parsing functions.
input/scripts/update_sushi_config.py
Outdated
| title = title_match.group(1) if title_match else model_id | ||
|
|
||
| # Extract description | ||
| desc_match = re.search(r'^Description:\s*"([^"]+)"', content, re.MULTILINE) |
Copilot
AI
Oct 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The regex patterns for Title and Description are duplicated between both parsing functions. Consider extracting these into shared constants: TITLE_PATTERN = r'^Title:\s*\"([^\"]+)\"' and DESCRIPTION_PATTERN = r'^Description:\s*\"([^\"]+)\"'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot apply changes based on this feedback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes already applied in commit 80d0873. The Title and Description patterns are now defined as module-level constants TITLE_PATTERN and DESCRIPTION_PATTERN, shared between both parsing functions.
input/scripts/update_sushi_config.py
Outdated
| valueset_id = valueset_match.group(1) | ||
|
|
||
| # Extract title | ||
| title_match = re.search(r'^Title:\s*"([^"]+)"', content, re.MULTILINE) |
Copilot
AI
Oct 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The regex patterns for Title and Description are duplicated between both parsing functions. Consider extracting these into shared constants: TITLE_PATTERN = r'^Title:\s*\"([^\"]+)\"' and DESCRIPTION_PATTERN = r'^Description:\s*\"([^\"]+)\"'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot apply changes based on this feedback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes already applied in commit 80d0873. The Title and Description patterns are now defined as module-level constants TITLE_PATTERN and DESCRIPTION_PATTERN, shared between both parsing functions.
input/scripts/update_sushi_config.py
Outdated
| title = title_match.group(1) if title_match else valueset_id | ||
|
|
||
| # Extract description | ||
| desc_match = re.search(r'^Description:\s*"([^"]+)"', content, re.MULTILINE) |
Copilot
AI
Oct 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The regex patterns for Title and Description are duplicated between both parsing functions. Consider extracting these into shared constants: TITLE_PATTERN = r'^Title:\s*\"([^\"]+)\"' and DESCRIPTION_PATTERN = r'^Description:\s*\"([^\"]+)\"'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot apply changes based on this feedback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes already applied in commit 80d0873. The Title and Description patterns are now defined as module-level constants TITLE_PATTERN and DESCRIPTION_PATTERN, shared between both parsing functions.
Co-authored-by: litlfred <662242+litlfred@users.noreply.github.com>
✅ Issue Resolved: LM and valusets not found
Summary
Successfully fixed the
update_sushi_config.pyscript to scan FSH files and additional directories for Logical Models and ValueSets.Recent Changes
LOGICAL_PATTERN- Pattern for matching Logical Model declarationsVALUESET_PATTERN- Pattern for matching ValueSet declarationsTITLE_PATTERN- Pattern for extracting Title metadataDESCRIPTION_PATTERN- Pattern for extracting Description metadataOriginal Implementation
parse_fsh_file_for_logical_model()function to parse FSH Logical Model definitionsparse_fsh_file_for_valueset()function to parse FSH ValueSet definitionsscan_for_valuesets_and_create_placeholders()to scan 4 additional directories:input/fsh/models(FSH Logical Models)input/fsh/valuesets(FSH ValueSets)input/models(JSON StructureDefinitions)input/vocabulary(JSON ValueSets)fsh-generated/resources(SUSHI output)input/resources(static JSON)Results
Before (Issue)
After (Fixed)
Resources Found
Testing
Original prompt
Fixes #179
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.