-
Notifications
You must be signed in to change notification settings - Fork 2
Implement user scenarios functionality with @sgex/dak-core integration #1069
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
…rios Co-authored-by: litlfred <662242+litlfred@users.noreply.github.com>
Co-authored-by: litlfred <662242+litlfred@users.noreply.github.com>
Co-authored-by: litlfred <662242+litlfred@users.noreply.github.com>
Co-authored-by: litlfred <662242+litlfred@users.noreply.github.com>
Co-authored-by: litlfred <662242+litlfred@users.noreply.github.com>
|
for Editor Modal please Reuse and enhance PageEditModal.js and refactor if needed to make more resuable. IDs should start with capital letter and may contain hyphens (although not preferred). Resource IDs SHALL NOT contain underscores:
variable syntax is good and those are the correct persona properites. also at the top of the edit, there should be a button/select combo that allows a user to select and insert the variable reference for that persona. drop down should be persona title in display personas can be found as fsh under input/fsh/actors or as FHIR JSON under input/actors. both are potential sources. Proposed: input/pagecontent/userscenario-{id}.md is fine. please make sure that when a persona is saved to staging groun, the DAK JSON object is also updated and saved to staging ground to add/update UserSecnario
@copilot please begin implementation |
- Refactor PageEditModal.js to be more reusable with props for title, preview mode, variable helper - Create UserScenariosManager component for listing and editing user scenarios - Add support for WHO SMART Guidelines ID validation (capital letter start, no underscores) - Implement persona variable substitution with dropdown helper - Add edit/preview mode toggle for markdown editor - Integrate with staging ground for all saves - Auto-update DAK JSON with user scenario metadata - Add comprehensive help content for user scenarios - Create WHO SMART Guidelines naming conventions documentation - Update route configuration and lazy loading for user-scenarios component Co-authored-by: litlfred <662242+litlfred@users.noreply.github.com>
Implementation complete! ✅ Changes made:
Commit: b02955b (latest refactoring and implementation) Ready for testing at |
🚀 Deployment Status: Not Deployed🔗 Quick Actions: 📝 Recent Change SummaryLatest commit: 📊 Overall ProgressBranch: Available Actions: 💡 Click deploy links above, then "Run workflow" to deploy. Branch name will be pre-filled. |
🚀 Deployment Status: Successfully Deployed 🟢📊 Deployment InformationWorkflow: Deploy Feature Branch (🔀 Pull Request) 🌐 Preview URLs🔗 Quick Actions📊 Overall ProgressBranch: 📋 Deployment Timeline
💡 This comment is automatically updated as the deployment progresses. |
🔍 Page Framework Compliance Check ResultsFramework Structure Compliance
🔍 SGEX Page Framework Compliance CheckerFalling back to directory scan...
✅ BPMNEditor: 6/6 (100%) - COMPLIANT
✅ BPMNSource: 6/6 (100%) - COMPLIANT ✅ BPMNViewer: 6/6 (100%) - COMPLIANT
✅ BusinessProcessSelection: 6/6 (100%) - COMPLIANT
✅ ComponentEditor: 6/6 (100%) - COMPLIANT ✅ CoreDataDictionaryViewer: 6/6 (100%) - COMPLIANT ✅ DAKActionSelection: 6/6 (100%) - COMPLIANT
✅ DAKConfiguration: 6/6 (100%) - COMPLIANT ✅ DAKDashboard: 6/6 (100%) - COMPLIANT ✅ DAKDashboardWithFramework: 6/6 (100%) - COMPLIANT
✅ DAKSelection: 6/6 (100%) - COMPLIANT
✅ DashboardRedirect: 6/6 (100%) - COMPLIANT ✅ DecisionSupportLogicView: 6/6 (100%) - COMPLIANT
✅ FeatureFileEditor: 6/6 (100%) - COMPLIANT
✅ NotFound: 6/6 (100%) - COMPLIANT ✅ OrganizationSelection: 6/6 (100%) - COMPLIANT
✅ PersonaViewer: 6/6 (100%) - COMPLIANT
✅ RepositorySelection: 6/6 (100%) - COMPLIANT
✅ SelectProfilePage: 6/6 (100%) - COMPLIANT
✅ WelcomePage: 6/6 (100%) - COMPLIANT
📊 COMPLIANCE SUMMARY✅ Fully Compliant: 20/53 📈 Overall Compliance: 38%
✅ COMPLIANCE CHECK PASSED Profile Creation ComplianceStatus: ✅ PASSED
🔍 Starting Profile Creation Compliance Check... 📊 Profile Creation Compliance Report📁 Files scanned: 143 ✅ COMPLIANCE PASSED: No profile creation violations found! Next StepsFor guidance, see: |
🔒 Dependency Security Check Results |
🚀 Deployment Status: Successfully Deployed 🟢📊 Deployment InformationWorkflow: Deploy Feature Branch (🔀 Pull Request) 🌐 Preview URLs🔗 Quick Actions📊 Overall ProgressBranch: 📋 Deployment Timeline
💡 This comment is automatically updated as the deployment progresses. |
|
staging ground should be utilized for getting actors. in fact, there should be a getActors method to abstract this away as part of the DAK application framework services that can be utilized by this as well as other DAK component pages (e.g. BPMN diagrams that need to validate actors) @copilot |
- Create dakFrameworkService.js with getActors() method for centralized actor loading - Integrate with staging ground to prioritize draft changes over committed content - Add caching mechanism with 5-minute TTL for performance - Automatically clear cache on staging ground updates via listener - Support both FSH (input/fsh/actors) and FHIR JSON (input/actors) sources - Update UserScenariosManager to use dakFrameworkService.getActors() - Show staged indicator (📝) in persona variable dropdown for draft actors - Remove duplicated loadPersonas() code from UserScenariosManager - Make getActors() reusable for other DAK components (e.g., BPMN diagrams) Co-authored-by: litlfred <662242+litlfred@users.noreply.github.com>
Implemented! ✅ Created
Updated UserScenariosManager to use this service. Personas dropdown now shows 📝 indicator for staged actors. Commit: Latest commit adds dakFrameworkService.js and refactors UserScenariosManager Other DAK components can now import and use: import dakFrameworkService from '../services/dakFrameworkService';
const actors = await dakFrameworkService.getActors(owner, repo, branch); |
|
is there existing DAK application framework (e.g. to handle things like editing/parsing dak.json) that this can be better integrated with? |
Co-authored-by: litlfred <662242+litlfred@users.noreply.github.com>
🚀 Deployment Status: Successfully Deployed 🟢📊 Deployment InformationWorkflow: Deploy Feature Branch (🔀 Pull Request) 🌐 Preview URLs🔗 Quick Actions📊 Overall ProgressBranch: 📋 Deployment Timeline
💡 This comment is automatically updated as the deployment progresses. |
🔍 Framework Compliance ReportGenerated: 2025-10-13 16:56:54 UTC 📊 Summary
📦 Nested Layouts (4 components)
📄 Missing PageLayout (1 components)
|
🔒 Security Check Report🟢 5 passed • 🟡 1 warnings Security Checks
🔍 Action Items
|
|
is there existing DAK application framework (e.g. to handle things like editing/parsing dak.json) that this can be better integrated with? @copilot |
🚀 Deployment Status: Successfully Deployed 🟢📊 Deployment InformationWorkflow: Deploy Feature Branch (🔀 Pull Request) 🌐 Preview URLs🔗 Quick Actions📊 Overall ProgressBranch: 📋 Deployment Timeline
💡 This comment is automatically updated as the deployment progresses. |
Good question! Yes, there is an existing DAK application framework in Currently, UserScenariosManager directly manipulates dak.json. I can integrate with
The integration would:
Should I refactor |
- Merge main branch with DAK framework updates - Create dakIntegrationService to bridge DAK Component Objects with React components - Update dakFrameworkService to use new DAK framework for persona loading - Refactor UserScenariosManager to use DAK integration service - Remove direct file manipulation in favor of Component Object methods - User scenarios now saved through UserScenarioComponent - Personas loaded through GenericPersonaComponent - Automatic dak.json management via DAK framework - Backwards compatible fallback for legacy methods - Staging ground integration maintained through StagingGroundIntegrationService Co-authored-by: litlfred <662242+litlfred@users.noreply.github.com>
Integrated! ✅ Changes made:
Architecture: Benefits:
PersonaViewer check: Found Commit: Latest merge + integration commits |
Co-authored-by: litlfred <662242+litlfred@users.noreply.github.com>
Overview
This PR implements full user scenarios functionality for SGEX Workbench, addressing the issue where
/user-scenarios/{user}/{repo}/{branch}returns a 404 error. The implementation includes a refactored PageEditModal for reusability, a complete UserScenariosManager component, and full integration with the @sgex/dak-core framework from PR #1111.Problem Statement
Users attempting to access user scenarios at
/user-scenarios/litlfred/smart-ips-pilgrimage/mainreceive a 404 error. This PR adds the functionality to:input/pagecontent/userscenario-*.mdSolution Implemented
The implementation follows the proven PagesManager/PageEditModal pattern and integrates with the @sgex/dak-core framework (PR #1111):
All existing dependencies are reused (
@uiw/react-md-editor@4.0.8,stagingGroundService,githubService,helpContentService) with no new npm packages required.Key Features Implemented
✅ File Detection - Automatically detects
input/pagecontent/userscenario-*.mdfiles✅ List View - Displays all user scenarios with edit buttons
✅ Create New - Creates scenarios with WHO SMART Guidelines ID validation
✅ WHO SOP ID Validation - Enforces capital letter start, hyphens allowed, no underscores
✅ Markdown Editor - Full markdown editing with
@uiw/react-md-editor✅ Edit/Preview Toggle - Switches between editing and preview modes
✅ Variable Substitution - Inserts and previews persona variables like
{{persona.Healthcare-worker.title}}✅ Variable Helper UI - Dropdown to easily insert persona variables (shows persona titles)
✅ @sgex/dak-core Integration - Uses Component Objects (UserScenarioComponent, GenericPersonaComponent)
✅ Automatic dak.json Management - No manual JSON manipulation via StagingGroundIntegrationService
✅ Source Resolution - Supports canonical URI, absolute/relative URLs, and inline data
✅ Staging Ground Priority - Draft actors from staging ground shown first across all components
✅ Smart Caching - 5-minute cache with automatic invalidation on staging updates
✅ Staging Ground Integration - All changes saved to staging ground, not direct commits
✅ WHO Styling - Consistent WHO SMART Guidelines visual identity
✅ Contextual Help - 5 comprehensive help topics accessible via mascot
WHO SMART Guidelines Compliance
ID Validation Requirements
Per WHO SMART IG Starter Kit Authoring Conventions:
Examples:
Anc-registration-001(valid)HealthCheck(valid)anc-registration(must start with capital)Health_check(no underscores)Persona Variables
Syntax:
{{persona.{id}.{property}}}Properties: id, title, description
Sources:
input/fsh/actors/*.fsh- FSH Profile definitionsinput/actors/*.json- FHIR Person/Practitioner resourcesDAK JSON Integration
When a scenario is saved, the DAK JSON (
dak.json) is automatically updated through @sgex/dak-core Component Objects with:UserScenario.idand.titleUserScenario.description.uri- Relative path to markdown file (source resolution)UserScenario.personas- Array of personas referenced via template variablesReference: smart-base UserScenario Structure
Files Changed
New Components
src/components/UserScenariosManager.js(509 lines) - Main componentsrc/components/UserScenariosManager.css(470 lines) - StylingNew Services
src/services/dakIntegrationService.js(295 lines) - Bridge to @sgex/dak-core Component Objectssrc/services/dakFrameworkService.js(313 lines) - Centralized actor loading with dak-core integrationRefactored Components
src/components/PageEditModal.js- Enhanced reusability with new propssrc/components/PageEditModal.css- Added toggle buttons and variable helper stylesConfiguration
public/routes-config.json- Added user-scenarios routesrc/services/componentRouteService.js- Added lazy loading casesrc/services/helpContentService.js- Added 5 help topicsDocumentation
public/docs/who-smart-guidelines-naming-conventions.md- Comprehensive naming conventions guide for all WHO SMART Guidelines assetsdocs/DAK_FRAMEWORK_SERVICE_ARCHITECTURE.md- Complete architecture documentation for DAK framework servicedocs/DAK_FRAMEWORK_INTEGRATION_SUMMARY.md- Integration guide for @sgex/dak-core frameworkPlanning Documentation (Reference)
docs/README_USER_SCENARIOS.md- Navigation hubdocs/USER_SCENARIOS_VISUAL_SUMMARY.md- UI mockupsdocs/USER_SCENARIOS_QUICK_REFERENCE.md- Quick referencedocs/USER_SCENARIOS_FEEDBACK_NEEDED.md- Original questionsdocs/USER_SCENARIOS_IMPLEMENTATION_PLAN.md- Implementation plandocs/USER_SCENARIOS_ARCHITECTURE.md- Architecture detailsTechnical Implementation
PageEditModal Refactoring
Added new props for reusability:
title- Custom modal titleenablePreview- Enable edit/preview togglevariableHelper- Custom variable insertion UI componentadditionalMetadata- Extra metadata for staging groundonContentChange- Callback for content changes@sgex/dak-core Integration
New Bridge Service:
dakIntegrationService.jsloadUserScenarios(),saveUserScenario(),loadPersonas()DAKFactoryto create and manageDAKObjectinstancesStagingGroundIntegrationServiceArchitecture:
Key Features:
DAK Framework Service
Updated centralized service for actor/persona loading using @sgex/dak-core:
Key Features:
input/fsh/actors) and FHIR JSON (input/actors) formatsgetActors(owner, repo, branch)can be used by any DAK componentUsage Example:
UserScenariosManager Features
Scenario Loading (via dak-core):
Scenario Saving (via dak-core):
Actor Loading (via dak-core):
ID Validation:
Variable Substitution:
Visual Indicators:
Reusability for Other DAK Components
The updated
dakFrameworkServiceanddakIntegrationServicecan be used by any DAK component:BPMN Editor Example:
Other Component Example:
Testing
The implementation is ready for testing at
/user-scenarios/{user}/{repo}/{branch}:Benefits
For Content Authors: Easy-to-use markdown editor with persona variable insertion and preview
For Reviewers: All changes staged for review before commit
For Administrators: WHO SMART Guidelines ID compliance built-in
For Developers:
Status: ✅ Implementation Complete
Implementation Time: ~14 hours
Pattern: PagesManager/PageEditModal approach + @sgex/dak-core integration
Dependencies: 0 new packages needed (uses existing @sgex/dak-core)
Documentation: WHO naming conventions + DAK framework architecture + integration guide + 5 help topics
Fixes #998
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.