mahdahar 14baa6b758 docs: add comprehensive documentation and refactor API structure
This commit introduces a complete documentation suite, refactors the API layer for
better consistency, and updates the database schema and seeding logic.

Key Changes:
- Documentation:
  - Added `CLAUDE.md` with development guidelines and architecture overview.
  - Created `docs/` directory with detailed guides for architecture, development,
    and source tree analysis.
- Database & Migrations:
  - Implemented `RenameMasterColumns` migration to standardize column naming
    (e.g., `name` -> `dept_name`, `name` -> `control_name`).
  - Added `CmodQcSeeder` to populate the system with realistic sample data
    for depts, controls, tests, and results.
- Backend API:
  - Created `DashboardApiController` with `getRecent()` for dashboard stats.
  - Created `ReportApiController` for managed reporting access.
  - Updated `app/Config/Routes.php` with new API groupings and documentation routes.
- Frontend & Views:
  - Refactored master data views (`dept`, `test`, `control`) to use Alpine.js
    and the updated API structure.
  - Modernized `dashboard.php` and `main_layout.php` with improved UI/UX.
- Infrastructure:
  - Updated `.gitignore` to exclude development-specific artifacts (`_bmad/`, `.claude/`).
2026-01-20 14:44:46 +07:00

TinyQC - Quality Control Management System

A CodeIgniter 4 PHP application for quality control data management in laboratory settings. Built with Tailwind CSS, Alpine.js, and DaisyUI.

Features

  • Dictionary Management: Maintain departments, tests, and control parameters
  • Control Management: Configure and manage quality control standards
  • Daily Entries: Record daily quality control test results
  • Monthly Entries: Aggregate and track monthly quality control data
  • Comments System: Add notes and comments to results
  • Reporting: Generate quality control reports and analysis

Technology Stack

Layer Technology
Backend CodeIgniter 4 (PHP 8.1+)
Database SQL Server
Frontend TailwindCSS + Alpine.js + DaisyUI
Icons FontAwesome 7
Testing PHPUnit

Requirements

  • PHP 8.1 or higher
  • SQL Server 2016+
  • Composer
  • Web server (Apache/Nginx/IIS)

Installation

  1. Clone the repository

    git clone <repository-url> tinyqc
    cd tinyqc
    
  2. Install dependencies

    composer install
    
  3. Configure environment

    copy env .env
    

    Edit .env with your database settings:

    database.default.hostname = localhost
    database.default.port = 1433
    database.default.database = tinyqc
    database.default.username = sa
    database.default.password = your_password
    database.default.DBDriver = SQLSRV
    
  4. Set up database

    • Create a new SQL Server database
    • Run migrations if applicable
    • Seed initial data if needed
  5. Configure web server Point your web server to the public directory:

    <VirtualHost *:80>
        ServerName tinyqc.local
        DocumentRoot "D:/data/www/tinyqc/public"
        <Directory "D:/data/www/tinyqc">
            AllowOverride All
            Require all granted
        </Directory>
    </VirtualHost>
    
  6. Access the application Open http://localhost in your browser

Project Structure

tinyqc/
├── app/
│   ├── Config/          # Configuration files
│   │   ├── Database.php # Database settings
│   │   └── Routes.php   # Route definitions
│   ├── Controllers/     # Application controllers
│   │   ├── Api/         # API controllers
│   │   ├── Dashboard.php
│   │   ├── Dept.php
│   │   ├── Test.php
│   │   ├── Control.php
│   │   ├── Entry.php
│   │   ├── PageController.php
│   │   └── Report.php
│   ├── Models/          # Database models
│   │   ├── DictDeptModel.php
│   │   ├── DictTestModel.php
│   │   ├── DictControlModel.php
│   │   ├── ControlModel.php
│   │   ├── ControlTestModel.php
│   │   ├── DailyResultModel.php
│   │   └── ...
│   └── Views/           # View templates
│       ├── layout/      # Layout templates
│       ├── dashboard.php
│       ├── dept/        # Department views
│       ├── test/        # Test views
│       ├── control/     # Control views
│       ├── entry/       # Entry views
│       └── report/      # Report views
├── public/              # Web root
├── tests/               # Unit tests
├── writable/            # Writable directory
├── env                  # Environment template
├── composer.json
└── phpunit.xml.dist

Usage

Dashboard

The main dashboard provides an overview of quality control status and quick access to all modules.

Dictionary Management

  • Departments: Manage department/category entries
  • Tests: Maintain test parameters and specifications
  • Controls: Configure control standards and limits

Data Entry

  • Daily Entry: Record daily QC test results
  • Monthly Entry: Aggregate monthly data and comments

Reports

Generate quality control reports based on:

  • Date ranges
  • Test types
  • Control parameters

API Endpoints

Method Endpoint Description
GET /api/dept List departments
GET /api/dept/:id Get department details
POST /api/dept Create department
PUT /api/dept/:id Update department
DELETE /api/dept/:id Delete department
GET /api/test List tests
GET /api/test/:id Get test details
POST /api/test Create test
PUT /api/test/:id Update test
DELETE /api/test/:id Delete test
GET /api/control List controls
GET /api/control/:id Get control details
POST /api/control Create control
PUT /api/control/:id Update control
DELETE /api/control/:id Delete control
GET /api/entry/controls Get controls for entry
GET /api/entry/tests Get tests for entry
POST /api/entry/daily Save daily result
POST /api/entry/monthly Save monthly entry
POST /api/entry/comment Save comment

Development

Running Tests

# Run all tests
./vendor/bin/phpunit

# Run with coverage
./vendor/bin/phpunit --coverage-html coverage/

Code Style

Follow these guidelines:

  • PSR-12 coding standards
  • CamelCase for variables/functions
  • PascalCase for classes
  • snake_case for database tables/columns

Adding New Features

  1. Create model in app/Models/
  2. Create API controller in app/Controllers/Api/
  3. Add routes in app/Config/Routes.php
  4. Create views in app/Views/[module]/
  5. Add menu item in layout if needed

Documentation

License

This project is proprietary software.

Support

For support, please contact the development team.

Description
No description provided
Readme MIT 4.5 MiB
Languages
PHP 90.9%
HTML 5.9%
Hack 1.1%
TSQL 0.9%
CSS 0.7%
Other 0.5%