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`.
75 lines
3.4 KiB
PHP
75 lines
3.4 KiB
PHP
<?php
|
|
|
|
namespace App\Database\Migrations;
|
|
|
|
use CodeIgniter\Database\Migration;
|
|
|
|
class CreateResults extends Migration {
|
|
public function up() {
|
|
$this->forge->addField([
|
|
'ResultID' => ['type' => 'INT', 'auto_increment' => true],
|
|
'SiteID' => ['type' => 'INT', 'null' => true],
|
|
'OrderID' => ['type' => 'INT', 'null' => true],
|
|
'InternalSID' => ['type' => 'INT', 'null' => true],
|
|
'SID' => ['type' => 'varchar', 'constraint' => 30],
|
|
'SampleID' => ['type' => 'varchar', 'constraint' => 30],
|
|
'TestSiteID' => ['type' => 'INT', 'null' => true],
|
|
'TestSiteCode' => ['type' => 'CHAR', 'constraint' => 6, 'null' => true],
|
|
'AspCnt' => ['type' => 'INT', 'default' => 1, 'null' => true],
|
|
'Result' => ['type' => 'varchar', 'constraint' => 255, 'null' => true],
|
|
'SampleType' => ['type' => 'varchar', 'constraint' => 50, 'null' => true],
|
|
'ResultDateTime' => ['type' => 'DATETIME'],
|
|
'WorkstationID' => ['type' => 'INT', 'null' => true],
|
|
'EquipmentID' => ['type' => 'INT', 'null' => true],
|
|
'RefNumID' => ['type' => 'INT', 'null' => true],
|
|
'RefTxtID' => ['type' => 'INT', 'null' => true],
|
|
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
|
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
|
'ArchiveDate' => ['type' => 'DATETIME', 'null' => true],
|
|
'DelDate' => ['type' => 'DATETIME', 'null' => true],
|
|
]);
|
|
$this->forge->addPrimaryKey('ResultID');
|
|
$this->forge->createTable('patres');
|
|
|
|
$this->forge->addField([
|
|
'ResFlagID' => ['type' => 'INT', 'auto_increment' => true],
|
|
'ResultID' => ['type' => 'INT', 'null' => false],
|
|
'Flag' => ['type' => 'varchar', 'constraint' => 50, 'null' => true],
|
|
'CreateDate' => ['type' => 'DATETIME', 'null' => true],
|
|
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
|
'ArchiveDate' => ['type' => 'DATETIME', 'null' => true],
|
|
'DelDate' => ['type' => 'DATETIME', 'null' => true],
|
|
]);
|
|
$this->forge->addPrimaryKey('ResFlagID');
|
|
$this->forge->createTable('patresflag');
|
|
|
|
$this->forge->addField([
|
|
'ResStatusID' => ['type' => 'INT', 'auto_increment' => true],
|
|
'ResultID' => ['type' => 'INT', 'null' => false],
|
|
'SID' => ['type' => 'varchar', 'constraint' => 30],
|
|
'TestAct' => ['type' => 'varchar', 'constraint' => 255],
|
|
'ActRes' => ['type' => 'INT', 'null' => true],
|
|
'TestStatus' => ['type' => 'INT', 'null' => true],
|
|
'CurrSiteID' => ['type' => 'INT', 'null' => true],
|
|
'CurrLocID' => ['type' => 'INT', 'null' => true],
|
|
'Origin' => ['type' => 'varchar', 'constraint' => 255, 'null' => true],
|
|
'GeoLocationSystem' => ['type' => 'varchar', 'constraint' => 255, 'null' => true],
|
|
'GeoLocationData' => ['type' => 'TEXT', 'null' => true],
|
|
'DIDType' => ['type' => 'varchar', 'constraint' => 255, 'null' => true],
|
|
'DID' => ['type' => 'varchar', 'constraint' => 255, 'null' => true],
|
|
'UserID' => ['type' => 'varchar', 'constraint' => 255, 'null' => true],
|
|
'LogDate' => ['type' => 'DATETIME', 'null' => true],
|
|
'EndDate' => ['type' => 'DATETIME', 'null' => true],
|
|
'ArchiveDate' => ['type' => 'DATETIME', 'null' => true],
|
|
]);
|
|
$this->forge->addPrimaryKey('ResStatusID');
|
|
$this->forge->createTable('patrestatus');
|
|
}
|
|
|
|
public function down() {
|
|
$this->forge->dropTable('patrestatus');
|
|
$this->forge->dropTable('patresflag');
|
|
$this->forge->dropTable('patres');
|
|
}
|
|
}
|