MTR Disruption Helper - Hackathon Project
Problem Statement and Solution
The Problem We Solved
Hong Kong's Mass Transit Railway (MTR) system serves over 4 million passengers daily across 93 stations and 10 lines. When service disruptions occur—whether due to signal failures, track maintenance, or unexpected incidents—commuters face significant challenges:
Information Fragmentation: Disruption announcements are scattered across multiple channels (mobile apps, station displays, social media), making it difficult to get comprehensive alternative route information quickly.
Route Planning Complexity: The MTR network's interconnected nature means that when one line is disrupted, multiple alternative paths may exist, but calculating optimal routes requires deep knowledge of the entire network topology.
Time-Critical Decision Making: During peak hours, delays in finding alternative routes can cascade into significant productivity losses and passenger frustration.
Cognitive Load: Stressed commuters must mentally process complex route alternatives while dealing with crowded stations and time pressure.
Our Solution
We developed an AI-powered chatbot that provides instant, contextual alternative route suggestions during MTR disruptions. The solution leverages Amazon Nova Lite, a state-of-the-art language model, to understand natural language queries and provide intelligent routing recommendations.
Key Features:
- Natural Language Interface: Users can describe their journey in plain English (e.g., "Central to Tsim Sha Tsui, Island Line is down")
- Comprehensive Route Analysis: The system considers all available MTR lines, interchange stations, and provides multiple alternatives
- Real-time Context Awareness: Incorporates disruption information to avoid affected routes
- Multi-modal Suggestions: Includes bus and taxi alternatives when MTR options are limited
- Estimated Journey Times: Provides realistic time estimates for each suggested route
Technical Architecture:
- Frontend: Simple web interface for user interaction
- Backend: Node.js server with Express framework
- AI Engine: Amazon Nova Lite via AWS Bedrock
- Integration: AWS SDK for seamless cloud service connectivity
Amazon Q Developer CLI Integration
Development Workflow Enhancement
Amazon Q Developer CLI served as our primary development assistant throughout the project lifecycle, significantly accelerating development velocity and code quality.
Key Use Cases and Implementation
1. Model Integration and API Compatibility
Challenge: Migrating from Anthropic Claude to Amazon Nova Lite required understanding different API schemas and request/response formats.
Q Developer CLI Solution:
- Analyzed existing code structure and identified compatibility issues
- Provided step-by-step guidance for API format conversion
- Debugged validation errors in real-time:
- Removed unsupported
max_tokensparameter - Eliminated Claude-specific
anthropic_versionfield - Converted string-based
systemparameter to required array format - Updated response parsing from
content[0].texttooutput.message.content[0].text
- Removed unsupported
2. Code Refactoring and Optimization
Implementation:
// Before (Claude format)
body: JSON.stringify({
anthropic_version: "bedrock-2023-05-31",
max_tokens: 500,
system: systemPrompt,
messages: [{ role: "user", content: userPrompt }]
})
// After (Nova Lite format) - guided by Q Developer CLI
body: JSON.stringify({
system: [{ text: systemPrompt }],
messages: [{ role: "user", content: [{ text: userPrompt }] }]
})
3. Documentation Generation and Maintenance
Q Developer CLI Contributions:
- Generated comprehensive setup documentation with AWS IAM policy configurations
- Created step-by-step Bedrock model access instructions
- Maintained README.md with current project status and configuration details
- Automated git operations for clean version control
4. Error Handling and Debugging
Real-time Problem Resolution:
- Identified and resolved ValidationException errors through iterative debugging
- Provided fallback response mechanisms for service availability
- Implemented proper error logging and user feedback systems
5. Infrastructure as Code Guidance
AWS Integration:
- Generated precise IAM policies with minimal required permissions
- Configured environment variable management for secure credential handling
- Provided AWS CLI integration patterns for Bedrock service interaction
Development Efficiency Metrics
Time Savings Achieved:
- API Migration: Reduced from estimated 4-6 hours to 30 minutes through guided debugging
- Documentation: Automated generation of setup guides and technical specifications
- Error Resolution: Real-time debugging eliminated trial-and-error development cycles
- Code Quality: Consistent formatting and best practices enforcement
Technical Learning Outcomes
Through Q Developer CLI integration, we gained practical experience with:
- Amazon Bedrock service architecture and model management
- Nova Lite model capabilities and limitations
- AWS IAM security best practices for AI applications
- Modern JavaScript async/await patterns for cloud service integration
- Git workflow optimization for collaborative development
Conclusion
Amazon Q Developer CLI transformed our development process from traditional documentation-heavy research to interactive, guided implementation. The tool's ability to understand context, debug in real-time, and provide actionable solutions significantly reduced development friction and enabled rapid prototyping of a production-ready AI application.
The combination of Amazon Nova Lite's language understanding capabilities and Q Developer CLI's development assistance created a powerful synergy that allowed us to focus on solving the core transportation problem rather than wrestling with technical implementation details.
Built With
- amazon-bedrock
- amazon-q
- html
- javascript
- node.js
Log in or sign up for Devpost to join the conversation.