- Add TestMapDetailController for managing test mapping details
- Create TestMapDetailModel with CRUD operations
- Add migration for TestSiteID column in testmap table
- Update TestMapController and TestMapModel
- Update routes, seeder and PatVisitModel
- Regenerate API documentation bundle
- Add TestMapController for managing test-to-analyzer mappings
- Create TestMapModel with database operations for test mappings
- Update TestsController to support test mapping operations
- Add testmap API routes to Routes.php
- Create migration updates for test definitions table
- Add OpenAPI specification for test mapping endpoints
- Include unit tests for TestDef models
- Update bundled API documentation
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
- Add audit-logging-plan.md with comprehensive logging implementation guide
- Update AGENTS.md with project guidelines
- Refactor test models: remove RefTHoldModel, RefVSetModel, TestDefTechModel
- Update TestDefSiteModel and related migrations
- Update seeder and test data files
- Update API documentation (OpenAPI specs)
- TestsController: Remove duplicate rangeTypeOptions assignment that was being
set inside the NUM condition block, causing it to be set unnecessarily
when it's also handled elsewhere
- ResponseTrait: Convert global helper function convert_empty_strings_to_null()
to private class method convertEmptyStringsToNull() for better encapsulation
and to avoid dependency on global functions
- Database schema: Update clqms_database.dbml with accurate table structure
derived from app/Models/ directory, reorganizing tables by functional
categories (Patient, Visit, Organization, Location, Test, Specimen,
Order, Contact management)
- Create App\Traits\ResponseTrait that wraps CodeIgniter\API\ResponseTrait
- Add json_helper with convert_empty_strings_to_null() and prepare_json_response() functions
- Replace all imports of CodeIgniter\API\ResponseTrait with App\Traits\ResponseTrait across all controllers
- Add 'json' helper to BaseController helpers array
- Ensure consistent API response formatting across the application
- Split monolithic master-data.yaml into separate contact.yaml and locations.yaml files
- Replace 'Master Data' tag with dedicated 'Contacts' and 'Locations' tags for better API organization
- Add complete CRUD operations for Contacts (GET, POST, PATCH, DELETE, GET by ID)
- Add complete CRUD operations for Locations (GET, POST, PATCH, DELETE, GET by ID)
- Enhance Contact schema with comprehensive fields: NameFirst, NameLast, Title, Initial,
Birthdate, EmailAddress1/2, Phone, MobilePhone1/2, Specialty, SubSpecialty
- Enhance Location schema with additional fields: Description, LocType, improved Parent
field documentation for hierarchical locations
- Update bundled API documentation to reflect new endpoint structure
- Remove deprecated Occupation, MedicalSpecialty, and Counter schemas from bundled docs
- Document TEST, PARAM, CALC, and GROUP test type categories
- Include usage examples and frontend display guidance
- Provide quick reference card for developers
- Covers standard lab tests, components, calculations, and panels
- Add PatVisitController with CRUD operations
- Add use case documentation (docx and md files)
- Update API documentation in api-docs.yaml
- Remove USER_STORIES.md (migrated to docs/)
- Update TODO.md with current tasks
- Update Routes.php for new endpoints
- Update DummySeeder with additional test data
- Extract PatIdt, PatCom, PatAtt arrays before patient insert to prevent MySQL error 1241
- Fix Custodian handling when InternalPID is null
- Apply same fix to updatePatient method
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`.
- PatientModel: Convert Custodian from array to integer InternalPID when received as object
- PatientModel: Convert LinkTo from array of objects to comma-separated InternalPID string
- API docs: Add LinkedPatient, Custodian, and PatAttEntry schema definitions
- API docs: Extend Patient schema with DeathIndicator, TimeOfDeath, PatCom,
PatAtt, Province, City, Country, Race, MaritalStatus, Religion, Ethnic fields
- Add AGENTS.md to .gitignore
- ValueSet::transformLabels() was outputting values incorrectly:
- Field contained label text (e.g., Race: 'Jawa')
- *Key contained original value (e.g., RaceKey: 'JAWA')
- Fixed to output correct format for all static JSON ValueSets:
- Field contains original value (e.g., Race: 'JAWA')
- *Label contains label text (e.g., RaceLabel: 'Jawa')
- Affected ValueSets: Race, Sex, Country, Religion, Ethnic,
DeathIndicator, MaritalStatus
- Patient show endpoint now returns: Race:'JAWA', RaceLabel:'Jawa',
Sex:'1', SexLabel:'Female' as expected
● refactor: update API responses to use {field}Label format
- Transform coded fields to lowercase with Label suffix for display text - Controllers: OrderTestController, DemoOrderController, SpecimenController,
SpecimenStatusController, SpecimenCollectionController, ContainerDefController,
ContactController, TestMapController
- Example: Priority: "R" → priority: "R", priorityLabel: "Routine"
- Update api-docs.yaml with new OpenAPI schema definitions
- Add API docs reminder to CLAUDE.md
- 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.
- Restructure valueset pages from single master page to separate views:
- Library Valuesets (read-only lookup browser)
- Result Valuesets (CRUD for valueset table)
- Valueset Definitions (CRUD for valuesetdef table)
- Add new ResultValueSetController for result-specific valueset operations
- Move views from master/valuesets to result/valueset and result/valuesetdef
- Convert valueset sidebar to collapsible nested menu
- Add search filtering to ValueSetController index
- Remove deprecated welcome_message.php and old nested CRUD view
- Update routes to organize under /result namespace
Summary of changes: This commit reorganizes the valueset management UI by splitting the monolithic master/valuesets page into three distinct sections, adds a new controller for result-related valueset operations, and restructures the sidebar navigation for better usability.
- 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