# Project Structure

## Directory Layout
```
gdc_cmod/
├── app/                          # Application code
│   ├── Controllers/              # Controllers (API & Pages)
│   │   ├── Pages/               # Page controllers by role
│   │   │   ├── AdminController.php
│   │   │   ├── CsController.php
│   │   │   ├── LabController.php
│   │   │   ├── PhlebotomistController.php
│   │   │   └── SuperuserController.php
│   │   ├── ApiDashboard.php
│   │   ├── ApiRequestsAuditController.php
│   │   ├── ApiValidateController.php
│   │   ├── AuthController.php
│   │   ├── BaseController.php
│   │   ├── ErrorPage.php
│   │   ├── Home.php
│   │   ├── LabelController.php
│   │   ├── RequestsController.php
│   │   ├── SamplesController.php
│   │   └── UsersController.php
│   ├── Config/                   # Configuration
│   │   ├── App.php
│   │   ├── Database.php
│   │   ├── Filters.php          # Filter definitions
│   │   ├── Routes.php            # Route definitions
│   │   └── ...
│   ├── Database/                 # Database configurations
│   ├── Filters/                  # Custom filters
│   │   ├── GuestFilter.php
│   │   ├── RoleFilter.php
│   │   └── .gitkeep
│   ├── Helpers/                  # Helper functions
│   ├── Language/                 # Language files
│   ├── Libraries/                # Custom libraries
│   ├── Models/                   # Models (none used in this project)
│   ├── ThirdParty/               # Third-party code
│   └── Views/                    # Views
│       ├── admin/                # Admin views
│       ├── cs/                   # CS views
│       ├── errors/               # Error pages
│       ├── lab/                  # Lab views
│       ├── phlebo/               # Phlebo views
│       ├── shared/               # Shared components
│       ├── superuser/            # Superuser views
│       └── ...
├── public/                       # Web root
│   ├── index.php                 # Front controller
│   ├── .htaccess
│   ├── web.config
│   ├── css/                      # Local CSS
│   └── js/                       # Local JavaScript
├── tests/                        # PHPUnit tests
│   ├── _support/                 # Test support files
│   ├── database/                 # Database tests
│   ├── session/                  # Session tests
│   ├── unit/                     # Unit tests
│   └── README.md
├── writable/                     # Writeable directories
├── vendor/                       # Composer dependencies
├── .env                          # Environment variables (git ignored)
├── env                           # Example environment file
├── .gitignore                    # Git ignore rules
├── AGENTS.md                     # Agent guidelines (this file)
├── CHECKLIST.md                  # Feature checklist
├── CLAUDE.md                     # Claude Code guidelines
├── composer.json                 # Composer dependencies
├── composer.lock                 # Locked dependencies
├── phpunit.xml.dist              # PHPUnit configuration
├── preload.php                   # PHP OpCache preload
├── README.md                     # Project README
├── spark                         # CodeIgniter CLI tool
└── LICENSE                       # MIT License
```

## Key Files & Their Purposes

### Configuration
- **app/Config/Database.php** - Database connections (SQL Server + Firebird ODBC)
- **app/Config/Filters.php** - Filter definitions (RoleFilter, GuestFilter)
- **app/Config/Routes.php** - Route definitions (API and page routes)
- **app/Config/App.php** - Application settings (baseURL, etc.)

### Controllers
- **Pages/[Role]Controller.php** - Page controllers for each role
- **Api[Resource]Controller.php** - API controllers for JSON endpoints
- **AuthController.php** - Authentication (login/logout)
- **UsersController.php** - User management API
- **RequestsController.php** - Request validation API
- **SamplesController.php** - Sample collection API

### Filters
- **app/Filters/RoleFilter.php** - Check user role on protected routes
- **app/Filters/GuestFilter.php** - Redirect logged-in users from public pages

### Views
- **views/shared/** - Shared components used across roles
- **views/{role}/** - Role-specific views
- **views/login.php** - Login page

### Tests
- **tests/unit/** - Unit tests (HealthTest, etc.)
- **tests/database/** - Database tests
- **tests/session/** - Session tests
