feat(clqms): restructure project documentation and add feedback modules

- Restructured 'clqms01' workspace with dedicated 'suggestion' and 'review' directories.
- Converted project landing page from Markdown to Nunjucks (index.njk) for an enhanced UI.
- Added new suggestion indices and initial technical templates (testdef, valueset).
- Updated core technical documents (001-006) for consistency and better formatting.
- Added site favicon and updated base layouts (base.njk, clqms-post.njk).
- Cleaned up .vscode settings and redundant project files.
This commit is contained in:
mahdahar 2026-01-09 09:56:54 +07:00
parent 6ed4dc1fa4
commit 01bfb4e2f2
21 changed files with 614 additions and 96 deletions

12
.factory/config.json Normal file
View File

@ -0,0 +1,12 @@
{
"custom_models": [
{
"model_display_name": "MiniMax-M2.1",
"model": "MiniMax-M2.1",
"base_url": "https://api.minimax.io/anthropic",
"api_key": "sk-cp-eMsvq_OqP6UiCBirrr3W6gZlG6-NXnIQeneGNpAJ8aWxywzNq5I9mibfQFBBy84C2Mm7jCqMtjKmbpnx6h02nz_D7xG6ETmBY4K6Nog454cYs_ZkYgMyG_g",
"provider": "anthropic",
"max_tokens": 64000
}
]
}

View File

@ -1 +0,0 @@
{}

View File

@ -10,6 +10,7 @@
<meta property="og:description" content="{{ description | default('Portfolio & Documentation') }}"> <meta property="og:description" content="{{ description | default('Portfolio & Documentation') }}">
<meta property="og:type" content="{{ ogType | default('website') }}"> <meta property="og:type" content="{{ ogType | default('website') }}">
<title>{{ title | default("5Panda") }}</title> <title>{{ title | default("5Panda") }}</title>
<link rel="icon" type="image/svg+xml" href="/assets/favicon.svg">
<!-- Fonts --> <!-- Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
@ -70,7 +71,7 @@
</summary> </summary>
<ul class="p-2 bg-base-100 rounded-t-none bg-base-100/95 backdrop-blur-xl border border-white/5 shadow-xl w-60 z-[100]"> <ul class="p-2 bg-base-100 rounded-t-none bg-base-100/95 backdrop-blur-xl border border-white/5 shadow-xl w-60 z-[100]">
<li> <li>
<a href="/clqms/" class="{% if page.url == '/clqms/' %}text-primary bg-primary/10{% endif %} hover:text-primary hover:bg-primary/10"> <a href="/projects/clqms01/" class="{% if page.url == '/projects/clqms01/' %}text-primary bg-primary/10{% endif %} hover:text-primary hover:bg-primary/10">
CLQMS CLQMS
</a> </a>
</li> </li>

View File

@ -25,9 +25,34 @@ layout: base.njk
</h3> </h3>
<nav class="space-y-1"> <nav class="space-y-1">
{% for post in collections.clqms %} {% for post in collections.clqms %}
{# Determine if we should show this post based on current section #}
{% set show_post = false %}
{% if "/review/" in page.url %}
{# If in Review section, only show reviews #}
{% if "/review/" in post.url %}
{% set show_post = true %}
{% endif %}
{% elif "/suggestion/" in page.url %}
{# If in Suggestion section, only show suggestions #}
{% if "/suggestion/" in post.url %}
{% set show_post = true %}
{% endif %}
{% else %}
{# Main section (Architecture etc): Show everything EXCEPT reviews and suggestions #}
{% if not ("/review/" in post.url) and not ("/suggestion/" in post.url) %}
{% set show_post = true %}
{% endif %}
{% endif %}
{# Hide current page from list if it is an index page to avoid redundancy, or keep it? User said 'only reviews', usually implies lists of *other* reviews or all reviews. #}
{# Check if it's an index page by checking if the URL ends in a slash or index.html logic, but usually simple filter is enough. #}
{% if show_post %}
<a href="{{ post.url }}" class="block px-3 py-2 rounded-lg text-sm transition-colors {% if page.url == post.url %}bg-primary/10 text-primary font-medium border-l-2 border-primary{% else %}text-base-content/70 hover:bg-base-300 hover:text-base-content{% endif %}"> <a href="{{ post.url }}" class="block px-3 py-2 rounded-lg text-sm transition-colors {% if page.url == post.url %}bg-primary/10 text-primary font-medium border-l-2 border-primary{% else %}text-base-content/70 hover:bg-base-300 hover:text-base-content{% endif %}">
{{ post.data.title }} {{ post.data.title }}
</a> </a>
{% endif %}
{% endfor %} {% endfor %}
</nav> </nav>
</div> </div>

26
src/assets/favicon.svg Normal file
View File

@ -0,0 +1,26 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
<defs>
<linearGradient id="g" x1="0%" y1="0%" x2="0%" y2="100%">
<stop offset="0%" style="stop-color:#f8fafc;stop-opacity:1" />
<stop offset="100%" style="stop-color:#e2e8f0;stop-opacity:1" />
</linearGradient>
</defs>
<!-- Ears -->
<circle cx="16" cy="18" r="10" fill="#1e293b"/>
<circle cx="48" cy="18" r="10" fill="#1e293b"/>
<!-- Face -->
<circle cx="32" cy="36" r="26" fill="url(#g)" stroke="#1e293b" stroke-width="2"/>
<!-- Eye Patches -->
<ellipse cx="22" cy="32" rx="8" ry="10" fill="#1e293b" transform="rotate(-15 22 32)"/>
<ellipse cx="42" cy="32" rx="8" ry="10" fill="#1e293b" transform="rotate(15 42 32)"/>
<!-- Eyes -->
<circle cx="23" cy="30" r="2.5" fill="white"/>
<circle cx="41" cy="30" r="2.5" fill="white"/>
<!-- Nose -->
<ellipse cx="32" cy="44" rx="5" ry="3.5" fill="#1e293b"/>
<!-- Blush -->
<circle cx="16" cy="42" r="3" fill="#f43f5e" opacity="0.4"/>
<circle cx="48" cy="42" r="3" fill="#f43f5e" opacity="0.4"/>
<!-- Mouth -->
<path d="M26 50 Q32 55 38 50" stroke="#1e293b" stroke-width="2.5" fill="none" stroke-linecap="round"/>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -1,41 +0,0 @@
---
layout: base.njk
title: "CLQMS Documentation"
description: "Clinical Laboratory Quality Management System documentation"
---
<!-- Hero Section -->
<section class="py-20 bg-base-200/30">
<div class="section-container">
<div class="text-center mb-12">
<span class="badge badge-secondary badge-outline mb-4">CLQMS</span>
<h1 class="text-4xl md:text-5xl font-bold mb-4">Project Documentation</h1>
<p class="text-base-content/70 max-w-2xl mx-auto">
Technical documentation, API references, and architectural decisions for CLQMS v1.0
</p>
</div>
</div>
</section>
<!-- Documentation List -->
<section class="py-20">
<div class="section-container">
<div class="max-w-4xl mx-auto">
{% for post in collections.clqms %}
<a href="{{ post.url }}" class="post-card group block mb-6">
<div class="flex items-center gap-3 mb-3">
<span class="text-sm text-base-content/50">CLQMS</span>
{% if post.data.order %}
<span class="text-base-content/30">•</span>
<span class="text-sm text-base-content/50">Order: {{ post.data.order }}</span>
{% endif %}
<span class="text-base-content/30">•</span>
<span class="text-sm text-base-content/50">{{ post.content | readingTime }}</span>
</div>
<h2 class="text-2xl font-bold mb-2 group-hover:text-secondary transition-colors">{{ post.data.title }}</h2>
<p class="text-base-content/70">{{ post.data.description | excerpt(200) }}</p>
</a>
{% endfor %}
</div>
</div>
</section>

View File

@ -892,6 +892,56 @@
======================================== */ ======================================== */
@layer utilities { @layer utilities {
.grid {
display: grid;
}
.grid-cols-1 {
grid-template-columns: repeat(1, minmax(0, 1fr));
}
.grid-cols-2 {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.grid-cols-3 {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
.grid-cols-4 {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
.gap-4 {
gap: 1rem;
}
.gap-6 {
gap: 1.5rem;
}
@media (min-width: 640px) {
.sm\:grid-cols-2 {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
@media (min-width: 768px) {
.md\:grid-cols-2 {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.md\:grid-cols-3 {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
}
@media (min-width: 1024px) {
.lg\:grid-cols-4 {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
}
.text-balance { .text-balance {
text-wrap: balance; text-wrap: balance;
} }

View File

@ -117,7 +117,7 @@ description: Innovative projects and ideas
</div> </div>
{% if collections.clqms.length > 4 %} {% if collections.clqms.length > 4 %}
<div class="text-center mt-10"> <div class="text-center mt-10">
<a href="/clqms/" class="btn btn-outline btn-secondary">View All Documentation</a> <a href="/projects/clqms01/" class="btn btn-outline btn-secondary">View All Documentation</a>
</div> </div>
{% endif %} {% endif %}
</div> </div>

View File

@ -2,6 +2,7 @@
layout: clqms-post.njk layout: clqms-post.njk
tags: clqms tags: clqms
title: "CLQMS: v1.0 Architecture Finalized" title: "CLQMS: v1.0 Architecture Finalized"
description: "Overview of the finalized v1.0 architecture and core design decisions."
date: 2025-12-01 date: 2025-12-01
order: 1 order: 1
--- ---

View File

@ -2,6 +2,7 @@
layout: clqms-post.njk layout: clqms-post.njk
tags: clqms tags: clqms
title: "CLQMS: JWT Authentication Module" title: "CLQMS: JWT Authentication Module"
description: "Stateless security implementation using JWT tokens and RBAC."
date: 2025-12-02 date: 2025-12-02
order: 2 order: 2
--- ---

View File

@ -2,6 +2,7 @@
layout: clqms-post.njk layout: clqms-post.njk
tags: clqms tags: clqms
title: "CLQMS: Frontend Stack Decision" title: "CLQMS: Frontend Stack Decision"
description: "Choosing SvelteKit 5 and DaisyUI for a performant, reactive dashboard."
date: 2025-12-03 date: 2025-12-03
order: 3 order: 3
--- ---

View File

@ -2,6 +2,7 @@
layout: clqms-post.njk layout: clqms-post.njk
tags: clqms tags: clqms
title: "Project Pandaria: Next-Gen LIS Architecture" title: "Project Pandaria: Next-Gen LIS Architecture"
description: "Offline-first, event-driven WST architecture for maximum laboratory reliability."
date: 2025-12-06 date: 2025-12-06
order: 6 order: 6
--- ---

View File

@ -2,6 +2,7 @@
layout: clqms-post.njk layout: clqms-post.njk
tags: clqms tags: clqms
title: "Edge Workstation: SQLite Database Schema" title: "Edge Workstation: SQLite Database Schema"
description: "SQL Schema for local edge databases, supporting sync queues and offline reliability."
date: 2025-12-07 date: 2025-12-07
order: 7 order: 7
--- ---

View File

@ -2,6 +2,7 @@
layout: clqms-post.njk layout: clqms-post.njk
tags: clqms tags: clqms
title: "CLQMS: Test Definition API Examples" title: "CLQMS: Test Definition API Examples"
description: "Reference documentation for test maintenance API endpoints and data structures."
date: 2025-12-10 date: 2025-12-10
order: 10 order: 10
--- ---

View File

@ -0,0 +1,30 @@
---
layout: base.njk
title: Debug CLQMS Collection
---
<div class="p-10">
<h1>Debug Collection</h1>
<table class="table w-full">
<thead>
<tr>
<th>Index</th>
<th>Title</th>
<th>URL</th>
<th>File Path</th>
<th>Tags</th>
</tr>
</thead>
<tbody>
{% for post in collections.clqms %}
<tr>
<td>{{ loop.index }}</td>
<td>'{{ post.data.title }}'</td>
<td>{{ post.url }}</td>
<td>{{ post.inputPath }}</td>
<td>{{ post.data.tags }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>

View File

@ -1,49 +0,0 @@
---
layout: clqms-post.njk
tags: clqms
title: "CLQMS (Clinical Laboratory Quality Management System)"
date: 2025-12-01
order: 0
---
# CLQMS (Clinical Laboratory Quality Management System)
> 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) |
---
## 📜 Usage Notice
This repository contains proprietary information intended for the 5Panda Team and authorized collaborators.

View File

@ -0,0 +1,134 @@
---
layout: base.njk
title: "CLQMS - Clinical Laboratory Quality Management System"
description: "The core backend engine for modern clinical laboratory workflows"
date: 2025-12-01
order: 0
---
<!-- Hero Section -->
<section class="pt-20 pb-12 bg-base-200/30 overflow-hidden relative">
<div class="section-container relative z-10">
<div class="text-center mb-12">
<span class="badge badge-secondary badge-outline mb-4">Project Workspace</span>
<h1 class="text-4xl md:text-5xl font-bold mb-4">Clinical Laboratory Quality Management System</h1>
<p class="text-base-content/70 max-w-2xl mx-auto">
A robust, mission-critical API suite designed to streamline modern laboratory operations through precision, scalability,
and modular design.
</p>
</div>
</div>
</section>
<!-- Module Navigation -->
<section id="modules" class="py-12 bg-base-100">
<div class="section-container">
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
<a
href="/projects/clqms01/001-architecture/"
class="card bg-base-200 hover:bg-base-300 transition-all hover:-translate-y-1 border border-white/5">
<div class="card-body p-6">
<div class="flex items-center gap-3 mb-2">
<span class="p-2 rounded bg-primary/10 text-primary text-xl">🏗️</span>
<h2 class="card-title text-base">Architecture</h2>
</div>
<p class="text-sm text-base-content/70">Core system design, authentication, and strategic pillars</p>
</div>
</a>
<!-- Authentication moved to Core Documentation list below -->
<a
href="/projects/clqms01/suggestion/"
class="card bg-base-200 border border-success/20 hover:bg-success/5 transition-all hover:-translate-y-1">
<div class="card-body p-6">
<div class="flex items-center gap-3 mb-2">
<span class="p-2 rounded bg-success/10 text-success text-xl">💡</span>
<h2 class="card-title text-base">Suggestions</h2>
</div>
<p class="text-sm text-base-content/70">Future proposals and roadmap ideas</p>
</div>
</a>
<a
href="/projects/clqms01/review/"
class="card bg-base-200 border border-accent/20 hover:bg-accent/5 transition-all hover:-translate-y-1">
<div class="card-body p-6">
<div class="flex items-center gap-3 mb-2">
<span class="p-2 rounded bg-accent/10 text-accent text-xl">🔍</span>
<h2 class="card-title text-base">Reviews</h2>
</div>
<p class="text-sm text-base-content/70">Expert code reviews and technical audits</p>
</div>
</a>
</div>
</div>
</section>
<!-- Core Documentation -->
<section id="docs" class="py-12">
<div class="section-container">
<div class="flex items-center justify-between mb-8">
<h2 class="text-2xl font-bold flex items-center gap-2">
<span class="text-secondary opacity-50">#</span>
Core Documentation
</h2>
</div>
<div class="max-w-4xl mx-auto space-y-2">
{% for post in collections.clqms %}
{# Filter to show only root-level docs, excluding index and sub-directories #}
{% set is_suggestion = "/suggestion/" in post.url %}
{% set is_review = "/review/" in post.url %}
{% if post.url != page.url and not is_suggestion and not is_review and post.data.title %}
<a href="{{ post.url }}" title="{{ post.inputPath }}" class="group block p-5 rounded-xl bg-base-200/50 hover:bg-base-200 border border-base-content/10 transition-all">
<div class="flex flex-col md:flex-row md:items-center justify-between gap-2">
<div>
<h3 class="text-lg font-bold group-hover:text-secondary transition-colors mb-1">{{ post.data.title }}</h3>
<p class="text-base-content/60 text-sm max-w-2xl leading-relaxed">
{{ post.data.description | default('Technical reference for CLQMS implementation.') }}
</p>
</div>
<div class="flex items-center gap-4 text-xs font-mono text-base-content/40 whitespace-nowrap">
<span class="hidden md:inline">{{ post.content | readingTime }}</span>
</div>
</div>
</a>
{% endif %}
{% endfor %}
</div>
</div>
</section>
<!-- Strategy Section -->
<section class="py-12 bg-base-200/30">
<div class="section-container">
<div class="max-w-4xl mx-auto">
<h2 class="text-2xl font-bold mb-8 text-center md:text-left">Strategic Pillars</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div class="glass-card p-6 border border-white/5 rounded-2xl">
<h3 class="text-lg font-bold mb-2 flex items-center gap-2">
<span class="text-primary">🎯</span>
Precision & Accuracy
</h3>
<p class="text-base-content/70 text-sm">Strict validation for all laboratory parameters and multi-variant reference
ranges.</p>
</div>
<div class="glass-card p-6 border border-white/5 rounded-2xl">
<h3 class="text-lg font-bold mb-2 flex items-center gap-2">
<span class="text-secondary">⚡</span>
Scalability
</h3>
<p class="text-base-content/70 text-sm">Optimized database and API architecture for high-volume diagnostic environments.</p>
</div>
<div class="glass-card p-6 border border-white/5 rounded-2xl">
<h3 class="text-lg font-bold mb-2 flex items-center gap-2">
<span class="text-success">📜</span>
Compliance
</h3>
<p class="text-base-content/70 text-sm">Built-in audit trails and granular status history for full medical traceability.</p>
</div>
<div class="glass-card p-6 border border-white/5 rounded-2xl">
<h3 class="text-lg font-bold mb-2 flex items-center gap-2">
<span class="text-accent">🔗</span>
Interoperability
</h3>
<p class="text-base-content/70 text-sm">Modular drivers designed for seamless LIS, HIS, and analyzer integration.</p>
</div>
</div>
</div>
</div>
</section>

View File

@ -0,0 +1,53 @@
---
layout: clqms-post.njk
tags: clqms
title: "Code Review Index"
description: "Code review notes and walkthroughs for CLQMS"
date: 2026-01-09
order: 0
---
# Code Review Notes
> Code review notes, walkthroughs, and feedback for the CLQMS project.
## Overview
This section captures code review findings, best practices, and learning points from code reviews.
### What to Include
- **Bug Fixes**: Issues found and their resolutions
- **Code Improvements**: Refactoring suggestions and optimizations
- **Patterns**: Recommended patterns and anti-patterns to avoid
- **Learning Points**: Lessons from reviews
### Review Format
When documenting a review, include:
1. **File/Component**: What's being reviewed
2. **Finding**: What was found
3. **Severity**: Critical, Major, Minor, or Info
4. **Recommendation**: Suggested fix or improvement
---
## Review List
### [TBD] Add new review notes here
<!-- Use the format below for each review:
#### [Severity] Brief Title
**File/Component:**
>
**Finding:**
>
**Recommendation:**
>
-->

View File

@ -0,0 +1,105 @@
---
layout: clqms-post.njk
tags: clqms
title: "Proposal: Test Definition Architecture Overhaul"
description: "Simplify database schema and improve query performance for test definitions"
date: 2026-01-09
order: 1
---
# 🚀 Proposal: Test Definition Architecture Overhaul by Gemini 3
**Target:** `testdef` Module
**Objective:** Simplify database schema, improve query performance, and reduce code complexity.
---
## 1. The Problem: "The Shredded Document" 🧩
**Current Status:**
Defining a single Lab Test currently requires joining 4-5 rigid tables:
* `testdefsite` (General Info)
* `testdeftech` (Technical Details)
* `testdefcal` (Calculations)
* `testdefgrp` (Grouping)
**Why it hurts:**
* **Complex Queries:** To get a full test definition, we write massive SQL joins.
* **Rigid Schema:** Adding a new technical attribute requires altering table schemas and updating multiple DAO files.
* **Maintenance Nightmare:** Logic is scattered. To understand a test, you have to look in five places.
---
## 2. The Solution: JSON Configuration 📄
**Strategy:** Treat a Test Definition as a **Document**.
We will consolidate the variable details (Technique, Calculations, Reference Ranges) into a structured `JSON` column within a single table.
### Schema Change
Old 5 tables $\rightarrow$ **1 Main Table**.
```sql
CREATE TABLE LabTestDefinitions (
id INT PRIMARY KEY AUTO_INCREMENT,
code VARCHAR(50) NOT NULL UNIQUE, -- e.g., "GLUC"
name VARCHAR(100) NOT NULL, -- e.g., "Fasting Glucose"
active BOOLEAN DEFAULT TRUE,
-- 🌟 The Solution: All variable logic lives here
configuration JSON NOT NULL
);
```
### The Configuration Structure (JSON)
Instead of columns for every possible biological variable, we store a flexible document:
```json
{
"technique": "Photometry",
"specimen": "Serum",
"result_type": "NUMERIC",
"units": "mg/dL",
"formulas": {
"calculation": "primary_result * dilution_factor"
},
"reference_ranges": [
{
"label": "Adult Male",
"sex": "M",
"min_age": 18,
"max_age": 99,
"min_val": 70,
"max_val": 100
},
{
"label": "Pediatric",
"max_age": 18,
"min_val": 60,
"max_val": 90
}
]
}
```
---
## 3. The Benefits 🏆
| Feature | Old Way (Relational) | New Way (JSON Document) |
| :--- | :--- | :--- |
| **Fetch Speed** | Slow (4+ Joins) | Instant (1 Row Select) |
| **Flexibility** | Requires ALTER TABLE | Edit JSON & Save |
| **Search** | Complex SQL | Fast JSON Indexing |
| **Code Logic** | Mapping 5 SQL results | `json_decode()` → Object |
---
### Next Steps 🗒️
- [ ] Create migration for `LabTestDefinitions` table.
- [ ] Port 5 sample tests from the old structure to JSON format for verification.
---
_Last updated: 2026-01-09 08:40:21_

View File

@ -0,0 +1,113 @@
---
layout: clqms-post.njk
tags: clqms
title: "Proposal: Valueset Replacement"
description: "Remove magic numbers and enforce type safety using PHP Enums and Svelte stores"
date: 2026-01-09
order: 2
---
# 🚀 Proposal: Valueset ("God Table") Replacement by Gemini 3
**Target:** `valueset` / `valuesetdef` Tables
**Objective:** Remove "Magic Numbers," enforce Type Safety, and optimize Frontend performance.
---
## 1. The Problem: "Magic Number Soup" 🥣
**Current Status:**
We store disparate system logic (Gender, Test Status, Colors, Payment Types) in a single massive table called `valueset`.
* **Code relies on IDs:** `if ($status == 1045) ...`
* **Frontend Overload:** Frontend makes frequent DB calls just to populate simple dropdowns.
* **No Type Safety:** Nothing stops a developer from assigning a "Payment Status" ID to a "Gender" column.
---
## 2. The Solution: Enums & API Store 🛠️
**Strategy:** Split "System Logic" from the Database.
Use **PHP 8.1 Native Enums** for business rules and serve them via a cached API to Svelte.
### Step A: The Backend (PHP Enums)
We delete the rows from the database and define them in code where they belong.
**File:** `App/Enums/TestStatus.php`
```php
enum TestStatus: string {
case PENDING = 'PENDING';
case VERIFIED = 'VERIFIED';
case REJECTED = 'REJECTED';
// Helper for Frontend Labels
public function label(): string {
return match($this) {
self::PENDING => 'Waiting for Results',
self::VERIFIED => 'Verified & Signed',
self::REJECTED => 'Sample Rejected',
};
}
}
```
### Step B: The API Contract
**GET `/api/config/valueset`**
Instead of 20 small network requests for 20 dropdowns, the Frontend requests the entire dictionary once on load.
**Response:**
```json
{
"test_status": [
{ "value": "PENDING", "label": "Waiting for Results" },
{ "value": "VERIFIED", "label": "Verified & Signed" }
],
"gender": [
{ "value": "M", "label": "Male" },
{ "value": "F", "label": "Female" }
]
}
```
### Step C: The Frontend (Svelte Store)
We use a Svelte Store to cache this data globally. No more SQL queries for dropdowns.
**Component Usage:**
```svelte
{% raw %}
<script>
import { config } from '../stores/configStore';
</script>
<label>Status:</label>
<select bind:value={status}>
{#each $config.test_status as option}
<option value={option.value}>{option.label}</option>
{/each}
</select>
{% endraw %}
```
---
## 3. The Benefits 🏆
| Feature | Old Way (valueset Table) | New Way (Enums + Store) |
| :--- | :--- | :--- |
| **Performance** | DB Query per dropdown | Zero DB Hits (Cached) |
| **Code Quality** | `if ($id == 505)` | `if ($s == Status::PENDING)` |
| **Reliability** | IDs can change/break | Code is immutable |
| **Network** | "Chatty" (Many requests) | Efficient (One request) |
---
### Next Steps 🗒️
- [ ] Define `TestStatus` and `TestType` Enums in PHP.
- [ ] Create the `/api/config/valueset` endpoint.
- [ ] Update one Svelte form to use the new Store instead of an API fetch.
---
_Last updated: 2026-01-09 08:40:21_

View File

@ -0,0 +1,54 @@
---
layout: clqms-post.njk
tags: clqms
title: "Suggestions Index"
description: "Suggestions and feedback for CLQMS core system"
date: 2026-01-09
order: 0
---
# Core System Suggestions
> Feedback and improvement suggestions for the CLQMS core system.
## Manager's Core System Review
This document captures suggestions and observations regarding the core system architecture and implementation.
### Key Areas of Review
- System architecture and design patterns
- Database schema and relationships
- API endpoints and authorization
- Performance and scalability considerations
### Submitting Suggestions
When documenting suggestions, please include:
1. **Issue Description**: Clear description of the problem or improvement.
2. **Impact**: Who/what is affected.
3. **Proposed Solution**: Your suggested approach.
4. **Priority**: High, Medium, or Low.
---
## Suggestion List
### [TBD] Add new suggestions here
<!-- Use the format below for each suggestion:
#### [Priority] Brief Title
**Description:**
>
**Impact:**
**Proposed Solution:**
-->
---
_Last updated: 2026-01-09 08:40:21_