Rename legacy boolean helpers to is* naming across test definitions, patient models, and infrastructure data to match rest of backend.
Update controllers, models, migrations, seeders, tests, and OpenAPI docs/bundled spec so contracts and runtime align.
Normalize formatting/line endings across configs, controllers, models, tests, and OpenAPI specs.
Update rule expression/rule engine implementation and remove obsolete RuleAction controller/model.
Add unit tests for rule expression syntax and multi-action behavior, and include docs updates.
Major updates to order system:
- Add specimen and test data to order responses (index, show, create, update, status update)
- Implement getOrderSpecimens() and getOrderTests() private methods in OrderTestController
- Support 'include=details' query parameter for expanded order data
- Update OrderTestModel with enhanced query capabilities and transaction handling
API documentation:
- Update OpenAPI specs for orders, patient-visits, and tests
- Add new schemas for order specimens and tests
- Regenerate bundled API documentation
Database:
- Add Requestable field to TestDefSite migration
- Create OrderSeeder and ClearOrderDataSeeder for test data
- Update DBSeeder to include order seeding
Patient visits:
- Add filtering by PatientID, PatientName, and date ranges
- Include LastLocation in visit queries
Testing:
- Add OrderCreateTest with comprehensive test coverage
Documentation:
- Update AGENTS.md with improved controller structure examples
Major Features:
- Add comprehensive audit logging system with AuditService
- Create AuditLogs database migration for tracking changes
- Implement TestValidationService for test data validation
- Add FRONTEND_TEST_MANAGEMENT_PROMPT.md documentation
Controllers:
- Update TestsController with improved test management
Models:
- Enhance PatientModel with additional functionality
- Update TestDefSiteModel for better site management
Database:
- Add CreateAuditLogs migration (2026-02-20-000011)
- Update TestSeeder with new test data
Services:
- Add AuditService for comprehensive audit trail logging
Documentation:
- Update AGENTS.md with improved guidelines
- Update audit-logging-plan.md with implementation details
- Add FRONTEND_TEST_MANAGEMENT_PROMPT.md for frontend guidance
API Documentation:
- Update api-docs.bundled.yaml
- Update tests.yaml schema definitions
- Update tests.yaml paths
Testing:
- Enhance TestsControllerTest with new test cases
- Update TestDefModelsTest for model coverage
This commit marks a significant architectural shift, transitioning the CLQMS backend to a fully headless REST API. All view-related components have been removed to focus solely on providing a robust, stateless API for clinical laboratory workflows.
### Architectural Changes
- **Headless API Transition:**
- Removed all view files (`app/Views/v2`), associated page controllers (`PagesController`), and routes (`Routes.php`). The application no longer serves a front-end UI.
- The root endpoint (`/`) now returns a simple "Backend Running" status message.
- **Developer Tooling & Guidance:**
- Replaced `CLAUDE.md` with `GEMINI.md` to provide updated context and instructional guidelines for Gemini agents.
- Updated `.serena/project.yml` with project configuration.
### Feature Enhancements
- **Advanced Order Management (`OrderTestModel`):**
- **Test Expansion:** The `createOrder` process now automatically expands `GROUP` (panel) tests into their individual components and recursively includes all parameter dependencies for `CALC` (calculated) tests.
- **Order Comments:** Added support for attaching comments to an order via the `ordercom` table.
- **Status Tracking:** Order status updates are now correctly recorded in the `orderstatus` table.
- **Schema Alignment:** Switched from `OrderID` to `InternalOID` as the primary key for internal operations.
- **Reference Range Refactor (`TestsController`):**
- Simplified reference range logic by consolidating `refthold` and `refvset` into the main `refnum` and `reftxt` tables.
- Standardized `RefType` handling to support `NMRC`, `TEXT`, `THOLD`, and `VSET` codes from the `reference_type` ValueSet.
### Other Changes
- **Documentation:**
- `PRD.md`, `README.md`, and `TODO.md` were updated to reflect the headless architecture, refined scope, and current project priorities.
- **Database:**
- Removed obsolete `RefTHoldID` and `RefVSetID` columns from the `patres` table migration.
- **Testing:**
- Added new feature tests for `ContactController`, `OrganizationController`, and `TestsController`.
- Deleted obsolete v2 master test files and support classes:
- tests/_support/v2/MasterTestCase.php
- tests/unit/v2/master/TestDef/TestDefSiteModelTest.php
- tests/unit/v2/master/TestDef/TestDefTechModelTest.php
- tests/unit/v2/master/TestDef/TestMapModelTest.php
- tests/feature/v2/master/TestDef/TestDefSiteTest.php
- Cleaned up formatting and logic in tests/unit/HealthTest.php.
- Consolidate ValueSet routes from multiple nested groups to flat structure
- Delete deprecated ValueSet\ namespaced controllers (ValueSetController, ValueSetDefController)
- Remove ValueSetSeeder and ValueSetCountrySeeder from DBSeeder
- Simplify seeders (LocationSeeder, OrganizationSeeder, PatientSeeder, TestSeeder)
to use literal string values instead of ValueSet lookups
- Add new ValueSetController and ValueSetDefController in root namespace
- Update test files for new controller structure
The key changes are:
1. Routes: Consolidated from nested ValueSet\ namespace routes to flat ValueSetController routes with /items sub-endpoints
2. Controllers: Deleted old app/Controllers/ValueSet/ directory, created new root-level controllers
3. Seeders: Removed ValueSet dependencies, using literal values like 'ROOM', '1', 'TEST' instead of [12]['ROOM'] etc.
4. Tests: Updated tests to match new controller structure
Complete overhaul of the valueset system to use human-readable names
instead of numeric IDs for improved maintainability and API consistency.
- PatientController: Renamed 'Gender' field to 'Sex' in validation rules
- ValuesetController: Changed API endpoints from ID-based (/:num) to name-based (/:any)
- TestsController: Refactored to use ValueSet library instead of direct valueset queries
- Added ValueSet library (app/Libraries/ValueSet.php) with static lookup methods:
- getOptions() - returns dropdown format [{value, label}]
- getLabel(, ) - returns label for a value
- transformLabels(, ) - batch transform records
- get() and getRaw() for Lookups compatibility
- Added ValueSetApiController for public valueset API endpoints
- Added ValueSet refresh endpoint (POST /api/valueset/refresh)
- Added DemoOrderController for testing order creation without auth
- 2026-01-12-000001: Convert valueset references from VID to VValue
- 2026-01-12-000002: Rename patient.Gender column to Sex
- OrderTestController: Now uses OrderTestModel with proper model pattern
- TestsController: Uses ValueSet library for all lookup operations
- ValueSetController: Simplified to use name-based lookups
- Updated all organization (account/site/workstation) dialogs and index views
- Updated specimen container dialogs and index views
- Updated tests_index.php with ValueSet integration
- Updated patient dialog form and index views
- Removed .factory/config.json and CLAUDE.md (replaced by AGENTS.md)
- Consolidated lookups in Lookups.php (removed inline valueset constants)
- Updated all test files to match new field names
- 32 modified files, 17 new files, 2 deleted files
- Net: +661 insertions, -1443 deletions (significant cleanup)
Added an alternative route alias 'container' that points to ContainerDefController,
providing backward compatibility and flexibility in API endpoint naming.
- Routes '/api/specimen/container' to ContainerDefController methods
- Supports GET, GET with ID, POST, and PATCH operations
- Existing '/api/specimen/containerdef' routes remain unchanged
File: app/Config/Routes.php (+7 lines)
---
refactor(seeds): update and standardize seed data across multiple seeders
Improved data consistency and coverage in database seeds:
AreaGeoSeeder.php:
- Updated geographic area data for better regional coverage
- Standardized data format and field values
DummySeeder.php:
- Refactored dummy data generation for test environments
- Improved data integrity and relationships
PatientSeeder.php:
- Enhanced patient test data with more realistic scenarios
- Updated patient demographic information
- Improved test result distributions
Total: 111 lines changed across seed files
---
docs: add CLQMS project documentation
- Added project documentation file: "prj_clinical laboratory quality management system_3a.docx"
- Comprehensive project specification and requirements document
---
test: remove deprecated TestDefSiteTest.php
- Removed obsolete test file that is no longer needed
- Test coverage consolidated into other test classes
File: tests/feature/TestDef/TestDefSiteTest.php (-374 lines)
---
Summary:
- +58 lines added (routes, seeds, docs)
- -434 lines removed (deprecated test file)
- 6 files affected
- Rename all controllers from X.php to XController.php format
- Add new RefTxtModel for text-based reference ranges
- Rename group_dialog.php to grp_dialog.php and remove title_dialog.php
- Add comprehensive test suite for v2/master/TestDef module
- Update Routes.php to reflect controller renames
- Remove obsolete data files (clqms_v2.sql, lab.dbml)
- Refactor Tests.php controller with updated logic and error handling
- Update Test migration with schema improvements
- Enhance TestDefCalModel, TestDefGrpModel, TestDefTechModel with CRUD operations
- Improve TestMapModel with better test mapping relationships
- Redesign test dialog views (calc, group, param) with improved UX
- Update tests_index view with better data presentation
- Add CSS styles for test management UI components
- Add TestDefSiteTest feature test for site-based test definitions
- Add TestDefModelsTest unit test for model validation
- Remove obsolete Test Management.docx documentation
- Implemented dynamic VID retrieval from ValueSetModel for all test definitions
- Aligned ResultType, RefType, and SpcType with the valueset table
- Updated sample data for Hematology, Chemistry, and Urinalysis tests
- Ensured consistency between ValueSetSeeder and TestSeeder data