> **The core backend engine for modern clinical laboratory workflows.**
CLQMS is a robust, mission-critical API suite designed to streamline laboratory operations, ensure data integrity, and manage complex diagnostic workflows. Built on a foundation of precision and regulatory compliance, this system handles everything from patient registration to high-throughput test resulting.
---
## 🏛️ Core Architecture & Design
The system is currently undergoing a strategic **Architectural Redesign** to consolidate legacy structures into a high-performance, maintainable schema. This design, spearheaded by leadership, focuses on reducing technical debt and improving data consistency across:
- **Unified Test Definitions:** Consolidating technical, calculated, and site-specific test data.
- **Reference Range Centralization:** A unified engine for numeric, threshold, text, and coded results.
- **Ordered Workflow Management:** Precise tracking of orders from collection to verification.
---
## 🛡️ Strategic Pillars
- **Precision & Accuracy:** Strict validation for all laboratory parameters and reference ranges.
- **Scalability:** Optimized for high-volume diagnostic environments.
- **Compliance:** Built-in audit trails and status history for full traceability.
- **Interoperability:** Modular architecture designed for LIS, HIS, and analyzer integrations.
---
## 🛠️ Technical Stack
| Component | Specification |
| :------------- | :------------ |
| **Language** | PHP 8.1+ (PSR-compliant) |
| **Framework** | CodeIgniter 4 |
| **Security** | JWT (JSON Web Tokens) Authorization |
| **Database** | MySQL (Optimized Schema Migration in progress) |
When working on UI components or dropdowns, **always check for existing ValueSets** before hardcoding options. Use the API endpoint `/api/valueset/valuesetdef/{ID}` to fetch options dynamically.
| VSetDefID | Purpose | Usage |
|-----------|---------|-------|
| 27 | Test Types | TEST, PARAM, GROUP, CALC, TITLE |
> **Important:** Always use ValueSet lookups for configurable options. This ensures consistency and allows administrators to modify options without code changes.
For frequently used lookup values, CLQMS provides a **static library** with all values hardcoded. This eliminates database queries for common dropdowns and improves performance.
### Available Lookups
| Constant | VSetID | Description |
|----------|--------|-------------|
| `WS_TYPE` | 1 | Workstation type (Primary, Secondary) |
| `ENABLE_DISABLE` | 2 | Enable/disable flags |
| `GENDER` | 3 | Gender (Female, Male, Unknown) |
| `MARITAL_STATUS` | 4 | Marital status (A/D/M/S/W/B/U/O) |
CLQMS provides comprehensive master data management for laboratory operations. All master data is accessible via the V2 UI at `/v2/master/*` endpoints.
### 🧪 Laboratory Tests (`/v2/master/tests`)
The Test Definitions module manages all laboratory test configurations including parameters, calculated tests, and test panels.
#### Test Types
| Type Code | Description | Table |
|-----------|-------------|-------|
| `TEST` | Individual laboratory test with technical specs | `testdefsite` + `testdeftech` |
| `GET` | `/api/refnum` | List numeric reference ranges |
| `GET` | `/api/refnum/{id}` | Get reference range details |
| `POST` | `/api/refnum` | Create reference range |
| `PATCH` | `/api/refnum` | Update reference range |
| `DELETE` | `/api/refnum` | Soft delete reference range |
### 📑 Value Sets (`/v2/master/valuesets`)
Value Sets are configurable dropdown options used throughout the system. Each Value Set Definition (VSetDef) contains multiple Value Set Values (ValueSet).
The **Edge API** provides endpoints for integrating laboratory instruments via the `tiny-edge` middleware. Results from instruments are staged in the `edgeres` table before processing into the main patient results (`patres`).