Institution Architecture
The multi-institution system is built on a hierarchical structure:Institution Model
File:protected/models/Institution.php
integer
Unique institution identifier
string
required
Full institution name (e.g., “Moorfields Eye Hospital”)
string
required
Abbreviated name for display (e.g., “MEH”)
integer
required
External system reference ID
string
Patient Administration System key (max 10 characters)
integer
Link to Contact record with address and contact details
integer
Institution logo for correspondence and reports
boolean
Whether to allow searching across different number types
Institution Relations
Creating an Institution
1
Access Institution Admin
Navigate to Admin → Institutions (typically
/admin/institutions)2
Add Institution Details
- Enter full name and short name
- Set remote ID for external system integration
- Add PAS key if using a Patient Administration System
3
Configure Contact Information
Link or create a Contact record with:
- Address
- Phone/fax numbers
- Email address
4
Set Up Authentication
Create at least one InstitutionAuthentication method
5
Add Sites
Create one or more sites within the institution
Multi-Tenancy & Authentication
Institutions can be “tenanted” - meaning they have their own authentication system and user base.Checking if Institution is Tenanted
Getting Tenanted Institutions
InstitutionAuthentication
Each institution can have multiple authentication methods configured:Authentication Flow
1
User Attempts Login
Enters username on login page
2
System Identifies Institution
Looks up username in
user_authentication tableJoins to institution_authentication to determine institution and auth method3
Apply Auth Method
- BASIC: Verify against local password hash
- LDAP: Forward to LDAP server
- SAML: Redirect to SAML IdP
- OIDC: Redirect to OIDC provider
4
Set Session Context
On success, set:
- Selected institution
- Selected site (default for institution)
- Selected firm (user’s last or default)
Site Management
Sites represent physical locations within an institution where clinical services are delivered.Site Model
Site-Specific Settings
Settings can be configured at the site level using thesetting_site table:
Current Institution and Site
Getting Current Context
The current institution context is stored in the session and used throughout the application to filter data and apply institution-specific settings.
Changing Institution Context
Users can switch between institutions they have access to:Institution-Specific Data
Many models support institution-specific instances:ReferenceData Model
Used by models like CommonOphthalmicDisorder, this provides multi-level data support:Managing Institution-Specific Data
User-Institution Relationships
Finding Institution Users
User Access Control
Non-admin users are typically restricted to their institution:Institution Settings
Institution-level settings override installation defaults:Patient Numbers
Patients can have different identification numbers at different institutions:API Reference
Institution Methods
getCurrent()- Get current institution from sessionisTenanted()- Check if institution has authenticationgetTenanted($condition, $params, $user_must_be_member)- Get tenanted institutionsgetTenantedList($current_only, $user_member, $json)- Get as listgetList($current_institution_only)- Get institutions as array
AdminController Institution Methods
File:protected/controllers/AdminController.php
actionEditCommonOphthalmicDisorderGroups()- Line 46actionEditCommonOphthalmicDisorder()- Line 366actionAddMapping()- Line 243actionRemoveMapping()- Line 274
Best Practices
Plan Your Structure
Design institution/site hierarchy before deployment
Use Tenancy
Enable multi-tenancy for true institution isolation
Test Data Segregation
Verify users can only access their institution’s data
Configure Settings Hierarchically
Use institution settings for institution-specific customization