Psyter Web Application - Enhanced Documentation¶
Overview¶
The Psyter Web Application is an ASP.NET MVC 5 web portal that serves as the primary user interface for the Psyter telemedicine platform. It provides comprehensive functionality for patients, care providers, administrators, and other stakeholders to access mental health services, manage appointments, conduct video sessions, and handle various administrative tasks.
Technology Stack¶
- Framework: ASP.NET MVC 5.2.3 (.NET Framework 4.7.2)
- Language: C# with Razor view engine
- Frontend:
- jQuery 3.3.1
- Bootstrap 3.0.0 / Bootstrap 5 (mixed usage)
- Custom CSS with RTL support for Arabic
- JavaScript/TypeScript
- Backend Services:
- RESTful API integration (PsyterAPI)
- Google Analytics Data API integration
- gRPC services
- Key Libraries:
- Newtonsoft.Json 13.0.1 (JSON serialization)
- DocumentFormat.OpenXml 2.11.3 (Excel/Word document generation)
- SpreadsheetLight 3.5.0 (Excel operations)
- Microsoft Application Insights (telemetry)
- Google APIs (Analytics, Auth)
- Grpc.Core 2.46.3 (gRPC communication)
Architecture¶
Pattern: Model-View-Controller (MVC)
- Models: Data structures for API requests/responses, view models
- Views: Razor views organized by feature and language (English/Arabic)
- Controllers: Business logic, API orchestration, session management
Key Components:
1. Controllers - Organized by role and feature
2. DataAccess Layer - API communication (ApiDataAccess, DALManager)
3. Common - Shared utilities, constants, authentication
4. Filters - Authorization, authentication, exception handling
5. Views - Bilingual UI (English/Arabic) with Razor templates
Project Structure¶
Web/
├── Psyter/ # Main web application
│ ├── App_Start/ # Application configuration
│ │ ├── BundleConfig.cs # JS/CSS bundling
│ │ ├── FilterConfig.cs # Global filters
│ │ └── RouteConfig.cs # URL routing
│ ├── Common/ # Shared utilities
│ │ ├── AppConstants.cs # Application constants
│ │ ├── APIAuthenticationToken.cs# API token management
│ │ └── Common.cs # Common helper methods
│ ├── Controllers/ # MVC Controllers
│ │ ├── Accountant/ # Accountant features
│ │ ├── Admin/ # Admin features
│ │ │ └── Catalogue/ # Catalog management
│ │ ├── Patient/ # Patient/Client features
│ │ ├── Physician/ # Care provider features
│ │ ├── WebController.cs # Public pages
│ │ ├── UserManagerController.cs # User management
│ │ ├── CommonController.cs # Shared endpoints
│ │ └── ...
│ ├── DataAccess/ # Data layer
│ │ ├── ApiDataAccess.cs # API HTTP client
│ │ └── DALManager.cs # Data access manager
│ ├── Filters/ # Custom filters
│ │ ├── AuthenticateUser.cs # Authentication
│ │ ├── IsAdmin.cs # Role-based filters
│ │ ├── exceptionFilter.cs # Exception handling
│ │ └── ...
│ ├── Models/ # Data models
│ │ ├── Request/ # API request DTOs
│ │ ├── Response/ # API response DTOs
│ │ ├── Enums/ # Enumerations
│ │ └── ...
│ ├── Views/ # Razor views
│ │ ├── Web/ # Public pages
│ │ │ ├── English/ # English views
│ │ │ └── Arabic/ # Arabic views
│ │ ├── Patient/ # Patient views
│ │ ├── Physician/ # Provider views
│ │ ├── Admin/ # Admin views
│ │ ├── Shared/ # Shared layouts/partials
│ │ └── ...
│ ├── Content/ # Static assets
│ │ ├── css/ # Stylesheets
│ │ │ ├── Arabic/ # RTL styles
│ │ │ └── ...
│ │ ├── images/ # Images
│ │ ├── fonts/ # Custom fonts
│ │ ├── stylesheets/ # Page-specific styles
│ │ └── payslip/ # Payslip templates
│ ├── Scripts/ # JavaScript files
│ │ ├── JS/ # Custom scripts
│ │ └── ... # Third-party libraries
│ ├── Web.config # Application configuration
│ ├── Global.asax.cs # Application lifecycle
│ ├── packages.config # NuGet packages
│ └── Psyter.csproj # Project file
├── azure-pipelines.yml # CI/CD pipeline
└── Psyter.sln # Visual Studio solution
Features¶
User Roles¶
- Patients/Clients - Book appointments, screening, video sessions
- Care Providers - Manage schedule, appointments, prescriptions
- Administrators - System configuration, user management
- Accountants - Financial reports, payment management
- Content Managers - Content management
- Marketing Managers - Promotional campaigns
- SEO Managers - SEO optimization
- Organizations - Corporate accounts management
Core Functionality¶
Public Features¶
- Bilingual interface (English/Arabic with RTL support)
- Home page with service information
- Care provider listings and profiles
- Psychological assessments/screening
- User registration (patients and care providers)
- Login/logout, password reset
- FAQ, About Us, Contact pages
- Blog/Content pages
- Privacy Policy, Terms & Conditions
Patient Features¶
- Profile management
- Care provider search and filtering
- Appointment booking and management
- Screening questionnaires
- Video/audio sessions
- Messaging with providers
- Prescription viewing
- Payment processing
- Diary/journal
- Homework assignments
- Session history
- Referral management
Care Provider Features¶
- Profile and CV management
- Availability/schedule management
- Appointment management
- Patient list and history
- Video/audio session interface
- Prescription creation
- Clinical notes
- Homework assignment
- Group session management
- Package management
- Financial reports (payslips)
- Referral management
- Collaboration tools
Admin Features¶
- User management
- Care provider verification
- Catalog management (specialties, services, etc.)
- Promotion/discount management
- Payment configuration
- System configuration
- Reports and analytics
- Organization management
- Event management
Setup Instructions¶
Prerequisites¶
-
Development Environment:
- Visual Studio 2017 or later
- .NET Framework 4.7.2 or later
- IIS Express or IIS 10+
- SQL Server (for session state, if configured) -
Dependencies:
- NuGet Package Manager
- Node.js (for frontend build tools, if used)
Installation Steps¶
-
Clone the Repository
git clone <repository-url> cd Psyter/Web -
Restore NuGet Packages
# In Visual Studio Tools > NuGet Package Manager > Restore NuGet Packages # Or via command line nuget restore Psyter.sln -
Configure Application Settings
Edit Web/Psyter/Web.config:
<appSettings>
<!-- API Base URL -->
<add key="PsyterApiBasePath" value="https://your-api-url/"/>
<!-- Application Token -->
<add key="PsyterApplicationToken" value="your-app-token"/>
<!-- Session Timeout (seconds) -->
<add key="SessionTimeoutCountDown" value="180"/>
</appSettings>
- SSL Configuration
Ensure SSL certificate is properly configured in IIS or IIS Express.
- The application requires HTTPS
- Update IISExpressSSLPort in project properties if needed
-
Build the Solution
# In Visual Studio Build > Build Solution (Ctrl+Shift+B) # Or via MSBuild msbuild Psyter.sln /p:Configuration=Release -
Run the Application
# In Visual Studio F5 (Debug) or Ctrl+F5 (Without Debugging) # Or configure IIS # Point IIS to the Psyter/bin directory
Environment Configuration¶
Development¶
- Debug mode enabled
- Detailed error messages
- No caching
- Local API endpoints
Production¶
- Custom errors enabled
- HTTPS enforced
- Security headers configured
- Caching enabled
- Production API endpoints
API Integration¶
The application depends on the following APIs:
1. PsyterAPI - Main backend API (configured in PsyterApiBasePath)
2. Media Upload API - Media/file uploads
3. Scheduling API - Appointment scheduling (if separate)
Update API endpoints in Web.config:
<add key="PsyterApiBasePath" value="https://api.psyter.com/"/>
Security Configuration¶
Important security headers are configured in Web.config:
- X-Frame-Options: SAMEORIGIN
- X-XSS-Protection: 1; mode=block
- X-Content-Type-Options: nosniff
- Strict-Transport-Security (HSTS)
- Content-Security-Policy (commented out - needs review)
- HTTP-only cookies
- SSL/TLS required
Development Guidelines¶
Coding Standards¶
-
C# Conventions
- Follow Microsoft C# coding conventions
- Use meaningful variable names
- Add XML documentation for public methods
- Use async/await for I/O operations -
Frontend
- Separate JavaScript files for major features
- Use jQuery for DOM manipulation
- Maintain consistent CSS naming
- Support both LTR and RTL layouts -
Security
- All user inputs must be validated
- Use parameterized API calls
- Implement CSRF protection
- Sanitize HTML output
- Use authentication filters
Adding New Features¶
-
Create Controller Action
[Authorize] [IsClient] // or appropriate role filter public async Task<ActionResult> NewFeature() { // Implementation } -
Create View
- Create English view:Views/[Area]/English/[Feature].cshtml
- Create Arabic view:Views/[Area]/Arabic/[Feature].cshtml -
Add Route (if needed)
routes.MapRoute( name: "NewFeature", url: "new-feature", defaults: new { controller = "Controller", action = "Action" } ); -
Create Model/DTO (if needed)
- Request models inModels/Request/
- Response models inModels/Response/
Localization¶
The application supports English and Arabic:
- Language is stored in Session[SessionVariables.CurrentLanguage]
- Views are organized by language
- Use language-specific resource files or inline translations
- Ensure RTL support for Arabic layouts
Deployment¶
Azure DevOps Pipeline¶
The project includes azure-pipelines.yml:
trigger:
- master
pool: 'DevWebServerAgentPool'
steps:
- NuGet restore
- VS Build (Release configuration)
- Publish artifacts
- Copy to deployment directory
Manual Deployment¶
-
Build Release Package
msbuild Psyter.sln /p:Configuration=Release /p:DeployOnBuild=true -
Publish to IIS
- Copy build output to IIS directory
- Configure application pool (.NET Framework 4.7.2)
- Set up SSL certificate
- Configure security settings -
Post-Deployment
- Verify Web.config transformations
- Test API connectivity
- Check SSL configuration
- Verify session state
- Test authentication
Troubleshooting¶
Common Issues¶
-
API Connection Failures
- VerifyPsyterApiBasePathin Web.config
- Check firewall/network settings
- Validate API authentication token -
Session Timeout Issues
- CheckSessionTimeoutCountDownsetting
- Verify session state configuration
- Check application pool recycling -
Arabic/RTL Layout Issues
- Verify correct CSS files are loaded
- Check language session variable
- Ensure RTL-specific styles are applied -
Video Session Issues
- Check WebRTC compatibility
- Verify media permissions
- Check WebSocket connections (if used) -
File Upload Issues
- Check IIS upload size limits
- Verify media API endpoint
- Check file permissions
Logging¶
Application Insights is configured for telemetry:
- Performance monitoring
- Exception tracking
- Dependency tracking
- Custom events
Access logs through Azure Portal or Application Insights dashboard.
Testing¶
Manual Testing¶
- Test all user roles
- Verify bilingual functionality
- Test video/audio sessions
- Validate payment flows
- Check mobile responsiveness
Browser Compatibility¶
- Chrome (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)
- Mobile browsers
Performance Optimization¶
- Bundling and Minification - Configured in
BundleConfig.cs - Caching - Static content caching configured
- CDN - Consider CDN for static assets
- Image Optimization - Optimize images before upload
- Lazy Loading - Implement for heavy content
Security Considerations¶
- HTTPS Only - Enforced via configuration
- Authentication - Session-based with filters
- Authorization - Role-based access control
- CSRF Protection - Anti-forgery tokens
- XSS Prevention - Input validation and encoding
- SQL Injection - API layer handles data access
- Security Headers - Configured in Web.config
Maintenance¶
Regular Tasks¶
- Update NuGet packages quarterly
- Review and rotate API tokens
- Monitor Application Insights
- Review error logs weekly
- Update SSL certificates before expiry
- Test backup/restore procedures
Updates¶
- Follow semantic versioning
- Document breaking changes
- Test in staging before production
- Maintain rollback plan
Related Documentation¶
- API Documentation: See APIs folder
- Mobile Apps: See Android/AndroidCareProvider folders
- Database Schema: Contact DBA team
- Architecture Diagrams: See docs/code-structure/
Support¶
For technical issues or questions:
- Create an issue in the repository
- Contact the development team
- Review the audit documentation in /Audit/Web/
License¶
[Specify license information]
Last Updated: November 2025
Version: 1.0
Maintained By: Psyter Development Team