clqms-be/app/Database/Seeds/PatientSeeder.php

313 lines
11 KiB
PHP
Raw Normal View History

2025-12-17 15:19:55 +07:00
<?php
namespace App\Database\Seeds;
use CodeIgniter\Database\Seeder;
/**
* PatientTestSeeder
*
* Seeds test data for Patient-related tables for PHPUnit testing.
* This includes: patient, patatt, patcom, patidt, valueset, areageo
*
* Run with: php spark db:seed PatientTestSeeder
* Or for test DB: php spark db:seed PatientTestSeeder --all --n tests
*/
feat(routes): add container alias endpoint for ContainerDefController Added an alternative route alias 'container' that points to ContainerDefController, providing backward compatibility and flexibility in API endpoint naming. - Routes '/api/specimen/container' to ContainerDefController methods - Supports GET, GET with ID, POST, and PATCH operations - Existing '/api/specimen/containerdef' routes remain unchanged File: app/Config/Routes.php (+7 lines) --- refactor(seeds): update and standardize seed data across multiple seeders Improved data consistency and coverage in database seeds: AreaGeoSeeder.php: - Updated geographic area data for better regional coverage - Standardized data format and field values DummySeeder.php: - Refactored dummy data generation for test environments - Improved data integrity and relationships PatientSeeder.php: - Enhanced patient test data with more realistic scenarios - Updated patient demographic information - Improved test result distributions Total: 111 lines changed across seed files --- docs: add CLQMS project documentation - Added project documentation file: "prj_clinical laboratory quality management system_3a.docx" - Comprehensive project specification and requirements document --- test: remove deprecated TestDefSiteTest.php - Removed obsolete test file that is no longer needed - Test coverage consolidated into other test classes File: tests/feature/TestDef/TestDefSiteTest.php (-374 lines) --- Summary: - +58 lines added (routes, seeds, docs) - -434 lines removed (deprecated test file) - 6 files affected
2026-01-07 16:55:25 +07:00
class PatientSeeder extends Seeder
2025-12-17 15:19:55 +07:00
{
feat(routes): add container alias endpoint for ContainerDefController Added an alternative route alias 'container' that points to ContainerDefController, providing backward compatibility and flexibility in API endpoint naming. - Routes '/api/specimen/container' to ContainerDefController methods - Supports GET, GET with ID, POST, and PATCH operations - Existing '/api/specimen/containerdef' routes remain unchanged File: app/Config/Routes.php (+7 lines) --- refactor(seeds): update and standardize seed data across multiple seeders Improved data consistency and coverage in database seeds: AreaGeoSeeder.php: - Updated geographic area data for better regional coverage - Standardized data format and field values DummySeeder.php: - Refactored dummy data generation for test environments - Improved data integrity and relationships PatientSeeder.php: - Enhanced patient test data with more realistic scenarios - Updated patient demographic information - Improved test result distributions Total: 111 lines changed across seed files --- docs: add CLQMS project documentation - Added project documentation file: "prj_clinical laboratory quality management system_3a.docx" - Comprehensive project specification and requirements document --- test: remove deprecated TestDefSiteTest.php - Removed obsolete test file that is no longer needed - Test coverage consolidated into other test classes File: tests/feature/TestDef/TestDefSiteTest.php (-374 lines) --- Summary: - +58 lines added (routes, seeds, docs) - -434 lines removed (deprecated test file) - 6 files affected
2026-01-07 16:55:25 +07:00
public function run()
2025-12-17 15:19:55 +07:00
{
$now = date('Y-m-d H:i:s');
feat(routes): add container alias endpoint for ContainerDefController Added an alternative route alias 'container' that points to ContainerDefController, providing backward compatibility and flexibility in API endpoint naming. - Routes '/api/specimen/container' to ContainerDefController methods - Supports GET, GET with ID, POST, and PATCH operations - Existing '/api/specimen/containerdef' routes remain unchanged File: app/Config/Routes.php (+7 lines) --- refactor(seeds): update and standardize seed data across multiple seeders Improved data consistency and coverage in database seeds: AreaGeoSeeder.php: - Updated geographic area data for better regional coverage - Standardized data format and field values DummySeeder.php: - Refactored dummy data generation for test environments - Improved data integrity and relationships PatientSeeder.php: - Enhanced patient test data with more realistic scenarios - Updated patient demographic information - Improved test result distributions Total: 111 lines changed across seed files --- docs: add CLQMS project documentation - Added project documentation file: "prj_clinical laboratory quality management system_3a.docx" - Comprehensive project specification and requirements document --- test: remove deprecated TestDefSiteTest.php - Removed obsolete test file that is no longer needed - Test coverage consolidated into other test classes File: tests/feature/TestDef/TestDefSiteTest.php (-374 lines) --- Summary: - +58 lines added (routes, seeds, docs) - -434 lines removed (deprecated test file) - 6 files affected
2026-01-07 16:55:25 +07:00
2025-12-17 15:19:55 +07:00
// ========================================
// 1. VALUESET - Required for joins
// ========================================
$valuesets = [
// Gender (VSetID = 1)
['VID' => 5, 'SiteID' => 1, 'VSetID' => 1, 'VOrder' => 1, 'VValue' => 'M', 'VDesc' => 'Male', 'CreateDate' => $now],
['VID' => 6, 'SiteID' => 1, 'VSetID' => 1, 'VOrder' => 2, 'VValue' => 'F', 'VDesc' => 'Female', 'CreateDate' => $now],
['VID' => 7, 'SiteID' => 1, 'VSetID' => 1, 'VOrder' => 3, 'VValue' => 'O', 'VDesc' => 'Other', 'CreateDate' => $now],
feat(routes): add container alias endpoint for ContainerDefController Added an alternative route alias 'container' that points to ContainerDefController, providing backward compatibility and flexibility in API endpoint naming. - Routes '/api/specimen/container' to ContainerDefController methods - Supports GET, GET with ID, POST, and PATCH operations - Existing '/api/specimen/containerdef' routes remain unchanged File: app/Config/Routes.php (+7 lines) --- refactor(seeds): update and standardize seed data across multiple seeders Improved data consistency and coverage in database seeds: AreaGeoSeeder.php: - Updated geographic area data for better regional coverage - Standardized data format and field values DummySeeder.php: - Refactored dummy data generation for test environments - Improved data integrity and relationships PatientSeeder.php: - Enhanced patient test data with more realistic scenarios - Updated patient demographic information - Improved test result distributions Total: 111 lines changed across seed files --- docs: add CLQMS project documentation - Added project documentation file: "prj_clinical laboratory quality management system_3a.docx" - Comprehensive project specification and requirements document --- test: remove deprecated TestDefSiteTest.php - Removed obsolete test file that is no longer needed - Test coverage consolidated into other test classes File: tests/feature/TestDef/TestDefSiteTest.php (-374 lines) --- Summary: - +58 lines added (routes, seeds, docs) - -434 lines removed (deprecated test file) - 6 files affected
2026-01-07 16:55:25 +07:00
2025-12-17 15:19:55 +07:00
// Marital Status (VSetID = 3)
['VID' => 8, 'SiteID' => 1, 'VSetID' => 3, 'VOrder' => 1, 'VValue' => 'S', 'VDesc' => 'Single', 'CreateDate' => $now],
['VID' => 9, 'SiteID' => 1, 'VSetID' => 3, 'VOrder' => 2, 'VValue' => 'M', 'VDesc' => 'Married', 'CreateDate' => $now],
['VID' => 10, 'SiteID' => 1, 'VSetID' => 3, 'VOrder' => 3, 'VValue' => 'D', 'VDesc' => 'Divorced', 'CreateDate' => $now],
['VID' => 11, 'SiteID' => 1, 'VSetID' => 3, 'VOrder' => 4, 'VValue' => 'W', 'VDesc' => 'Widowed', 'CreateDate' => $now],
feat(routes): add container alias endpoint for ContainerDefController Added an alternative route alias 'container' that points to ContainerDefController, providing backward compatibility and flexibility in API endpoint naming. - Routes '/api/specimen/container' to ContainerDefController methods - Supports GET, GET with ID, POST, and PATCH operations - Existing '/api/specimen/containerdef' routes remain unchanged File: app/Config/Routes.php (+7 lines) --- refactor(seeds): update and standardize seed data across multiple seeders Improved data consistency and coverage in database seeds: AreaGeoSeeder.php: - Updated geographic area data for better regional coverage - Standardized data format and field values DummySeeder.php: - Refactored dummy data generation for test environments - Improved data integrity and relationships PatientSeeder.php: - Enhanced patient test data with more realistic scenarios - Updated patient demographic information - Improved test result distributions Total: 111 lines changed across seed files --- docs: add CLQMS project documentation - Added project documentation file: "prj_clinical laboratory quality management system_3a.docx" - Comprehensive project specification and requirements document --- test: remove deprecated TestDefSiteTest.php - Removed obsolete test file that is no longer needed - Test coverage consolidated into other test classes File: tests/feature/TestDef/TestDefSiteTest.php (-374 lines) --- Summary: - +58 lines added (routes, seeds, docs) - -434 lines removed (deprecated test file) - 6 files affected
2026-01-07 16:55:25 +07:00
2025-12-17 15:19:55 +07:00
// Death Indicator (VSetID = 4)
['VID' => 16, 'SiteID' => 1, 'VSetID' => 4, 'VOrder' => 1, 'VValue' => 'Y', 'VDesc' => 'Deceased', 'CreateDate' => $now],
['VID' => 17, 'SiteID' => 1, 'VSetID' => 4, 'VOrder' => 2, 'VValue' => 'N', 'VDesc' => 'Alive', 'CreateDate' => $now],
feat(routes): add container alias endpoint for ContainerDefController Added an alternative route alias 'container' that points to ContainerDefController, providing backward compatibility and flexibility in API endpoint naming. - Routes '/api/specimen/container' to ContainerDefController methods - Supports GET, GET with ID, POST, and PATCH operations - Existing '/api/specimen/containerdef' routes remain unchanged File: app/Config/Routes.php (+7 lines) --- refactor(seeds): update and standardize seed data across multiple seeders Improved data consistency and coverage in database seeds: AreaGeoSeeder.php: - Updated geographic area data for better regional coverage - Standardized data format and field values DummySeeder.php: - Refactored dummy data generation for test environments - Improved data integrity and relationships PatientSeeder.php: - Enhanced patient test data with more realistic scenarios - Updated patient demographic information - Improved test result distributions Total: 111 lines changed across seed files --- docs: add CLQMS project documentation - Added project documentation file: "prj_clinical laboratory quality management system_3a.docx" - Comprehensive project specification and requirements document --- test: remove deprecated TestDefSiteTest.php - Removed obsolete test file that is no longer needed - Test coverage consolidated into other test classes File: tests/feature/TestDef/TestDefSiteTest.php (-374 lines) --- Summary: - +58 lines added (routes, seeds, docs) - -434 lines removed (deprecated test file) - 6 files affected
2026-01-07 16:55:25 +07:00
2025-12-17 15:19:55 +07:00
// Race (VSetID = 5)
['VID' => 175, 'SiteID' => 1, 'VSetID' => 5, 'VOrder' => 1, 'VValue' => 'AS', 'VDesc' => 'Asian', 'CreateDate' => $now],
['VID' => 176, 'SiteID' => 1, 'VSetID' => 5, 'VOrder' => 2, 'VValue' => 'WH', 'VDesc' => 'White', 'CreateDate' => $now],
feat(routes): add container alias endpoint for ContainerDefController Added an alternative route alias 'container' that points to ContainerDefController, providing backward compatibility and flexibility in API endpoint naming. - Routes '/api/specimen/container' to ContainerDefController methods - Supports GET, GET with ID, POST, and PATCH operations - Existing '/api/specimen/containerdef' routes remain unchanged File: app/Config/Routes.php (+7 lines) --- refactor(seeds): update and standardize seed data across multiple seeders Improved data consistency and coverage in database seeds: AreaGeoSeeder.php: - Updated geographic area data for better regional coverage - Standardized data format and field values DummySeeder.php: - Refactored dummy data generation for test environments - Improved data integrity and relationships PatientSeeder.php: - Enhanced patient test data with more realistic scenarios - Updated patient demographic information - Improved test result distributions Total: 111 lines changed across seed files --- docs: add CLQMS project documentation - Added project documentation file: "prj_clinical laboratory quality management system_3a.docx" - Comprehensive project specification and requirements document --- test: remove deprecated TestDefSiteTest.php - Removed obsolete test file that is no longer needed - Test coverage consolidated into other test classes File: tests/feature/TestDef/TestDefSiteTest.php (-374 lines) --- Summary: - +58 lines added (routes, seeds, docs) - -434 lines removed (deprecated test file) - 6 files affected
2026-01-07 16:55:25 +07:00
2025-12-17 15:19:55 +07:00
// Religion (VSetID = 6)
['VID' => 206, 'SiteID' => 1, 'VSetID' => 6, 'VOrder' => 1, 'VValue' => 'IS', 'VDesc' => 'Islam', 'CreateDate' => $now],
['VID' => 207, 'SiteID' => 1, 'VSetID' => 6, 'VOrder' => 2, 'VValue' => 'CH', 'VDesc' => 'Christian', 'CreateDate' => $now],
['VID' => 208, 'SiteID' => 1, 'VSetID' => 6, 'VOrder' => 3, 'VValue' => 'CA', 'VDesc' => 'Catholic', 'CreateDate' => $now],
['VID' => 209, 'SiteID' => 1, 'VSetID' => 6, 'VOrder' => 4, 'VValue' => 'HI', 'VDesc' => 'Hindu', 'CreateDate' => $now],
['VID' => 210, 'SiteID' => 1, 'VSetID' => 6, 'VOrder' => 5, 'VValue' => 'BU', 'VDesc' => 'Buddha', 'CreateDate' => $now],
feat(routes): add container alias endpoint for ContainerDefController Added an alternative route alias 'container' that points to ContainerDefController, providing backward compatibility and flexibility in API endpoint naming. - Routes '/api/specimen/container' to ContainerDefController methods - Supports GET, GET with ID, POST, and PATCH operations - Existing '/api/specimen/containerdef' routes remain unchanged File: app/Config/Routes.php (+7 lines) --- refactor(seeds): update and standardize seed data across multiple seeders Improved data consistency and coverage in database seeds: AreaGeoSeeder.php: - Updated geographic area data for better regional coverage - Standardized data format and field values DummySeeder.php: - Refactored dummy data generation for test environments - Improved data integrity and relationships PatientSeeder.php: - Enhanced patient test data with more realistic scenarios - Updated patient demographic information - Improved test result distributions Total: 111 lines changed across seed files --- docs: add CLQMS project documentation - Added project documentation file: "prj_clinical laboratory quality management system_3a.docx" - Comprehensive project specification and requirements document --- test: remove deprecated TestDefSiteTest.php - Removed obsolete test file that is no longer needed - Test coverage consolidated into other test classes File: tests/feature/TestDef/TestDefSiteTest.php (-374 lines) --- Summary: - +58 lines added (routes, seeds, docs) - -434 lines removed (deprecated test file) - 6 files affected
2026-01-07 16:55:25 +07:00
2025-12-17 15:19:55 +07:00
// Ethnic (VSetID = 7)
['VID' => 213, 'SiteID' => 1, 'VSetID' => 7, 'VOrder' => 1, 'VValue' => 'JV', 'VDesc' => 'Javanese', 'CreateDate' => $now],
['VID' => 214, 'SiteID' => 1, 'VSetID' => 7, 'VOrder' => 2, 'VValue' => 'SD', 'VDesc' => 'Sundanese', 'CreateDate' => $now],
['VID' => 215, 'SiteID' => 1, 'VSetID' => 7, 'VOrder' => 3, 'VValue' => 'BT', 'VDesc' => 'Batak', 'CreateDate' => $now],
feat(routes): add container alias endpoint for ContainerDefController Added an alternative route alias 'container' that points to ContainerDefController, providing backward compatibility and flexibility in API endpoint naming. - Routes '/api/specimen/container' to ContainerDefController methods - Supports GET, GET with ID, POST, and PATCH operations - Existing '/api/specimen/containerdef' routes remain unchanged File: app/Config/Routes.php (+7 lines) --- refactor(seeds): update and standardize seed data across multiple seeders Improved data consistency and coverage in database seeds: AreaGeoSeeder.php: - Updated geographic area data for better regional coverage - Standardized data format and field values DummySeeder.php: - Refactored dummy data generation for test environments - Improved data integrity and relationships PatientSeeder.php: - Enhanced patient test data with more realistic scenarios - Updated patient demographic information - Improved test result distributions Total: 111 lines changed across seed files --- docs: add CLQMS project documentation - Added project documentation file: "prj_clinical laboratory quality management system_3a.docx" - Comprehensive project specification and requirements document --- test: remove deprecated TestDefSiteTest.php - Removed obsolete test file that is no longer needed - Test coverage consolidated into other test classes File: tests/feature/TestDef/TestDefSiteTest.php (-374 lines) --- Summary: - +58 lines added (routes, seeds, docs) - -434 lines removed (deprecated test file) - 6 files affected
2026-01-07 16:55:25 +07:00
2025-12-17 15:19:55 +07:00
// Country (VSetID = 8)
['VID' => 221, 'SiteID' => 1, 'VSetID' => 8, 'VOrder' => 1, 'VValue' => 'ID', 'VDesc' => 'Indonesia', 'CreateDate' => $now],
['VID' => 222, 'SiteID' => 1, 'VSetID' => 8, 'VOrder' => 2, 'VValue' => 'MY', 'VDesc' => 'Malaysia', 'CreateDate' => $now],
['VID' => 223, 'SiteID' => 1, 'VSetID' => 8, 'VOrder' => 3, 'VValue' => 'SG', 'VDesc' => 'Singapore', 'CreateDate' => $now],
feat(routes): add container alias endpoint for ContainerDefController Added an alternative route alias 'container' that points to ContainerDefController, providing backward compatibility and flexibility in API endpoint naming. - Routes '/api/specimen/container' to ContainerDefController methods - Supports GET, GET with ID, POST, and PATCH operations - Existing '/api/specimen/containerdef' routes remain unchanged File: app/Config/Routes.php (+7 lines) --- refactor(seeds): update and standardize seed data across multiple seeders Improved data consistency and coverage in database seeds: AreaGeoSeeder.php: - Updated geographic area data for better regional coverage - Standardized data format and field values DummySeeder.php: - Refactored dummy data generation for test environments - Improved data integrity and relationships PatientSeeder.php: - Enhanced patient test data with more realistic scenarios - Updated patient demographic information - Improved test result distributions Total: 111 lines changed across seed files --- docs: add CLQMS project documentation - Added project documentation file: "prj_clinical laboratory quality management system_3a.docx" - Comprehensive project specification and requirements document --- test: remove deprecated TestDefSiteTest.php - Removed obsolete test file that is no longer needed - Test coverage consolidated into other test classes File: tests/feature/TestDef/TestDefSiteTest.php (-374 lines) --- Summary: - +58 lines added (routes, seeds, docs) - -434 lines removed (deprecated test file) - 6 files affected
2026-01-07 16:55:25 +07:00
2025-12-17 15:19:55 +07:00
// Link Type (VSetID = 9)
['VID' => 2, 'SiteID' => 1, 'VSetID' => 9, 'VOrder' => 1, 'VValue' => 'F', 'VDesc' => 'Family', 'CreateDate' => $now],
['VID' => 3, 'SiteID' => 1, 'VSetID' => 9, 'VOrder' => 2, 'VValue' => 'S', 'VDesc' => 'Spouse', 'CreateDate' => $now],
];
// Insert valuesets (ignore duplicates)
foreach ($valuesets as $vs) {
$exists = $this->db->table('valueset')->where('VID', $vs['VID'])->get()->getRow();
if (!$exists) {
$this->db->table('valueset')->insert($vs);
}
}
echo "Valueset data seeded.\n";
// ========================================
feat(routes): add container alias endpoint for ContainerDefController Added an alternative route alias 'container' that points to ContainerDefController, providing backward compatibility and flexibility in API endpoint naming. - Routes '/api/specimen/container' to ContainerDefController methods - Supports GET, GET with ID, POST, and PATCH operations - Existing '/api/specimen/containerdef' routes remain unchanged File: app/Config/Routes.php (+7 lines) --- refactor(seeds): update and standardize seed data across multiple seeders Improved data consistency and coverage in database seeds: AreaGeoSeeder.php: - Updated geographic area data for better regional coverage - Standardized data format and field values DummySeeder.php: - Refactored dummy data generation for test environments - Improved data integrity and relationships PatientSeeder.php: - Enhanced patient test data with more realistic scenarios - Updated patient demographic information - Improved test result distributions Total: 111 lines changed across seed files --- docs: add CLQMS project documentation - Added project documentation file: "prj_clinical laboratory quality management system_3a.docx" - Comprehensive project specification and requirements document --- test: remove deprecated TestDefSiteTest.php - Removed obsolete test file that is no longer needed - Test coverage consolidated into other test classes File: tests/feature/TestDef/TestDefSiteTest.php (-374 lines) --- Summary: - +58 lines added (routes, seeds, docs) - -434 lines removed (deprecated test file) - 6 files affected
2026-01-07 16:55:25 +07:00
// 2. PATIENT - Main patient data
2025-12-17 15:19:55 +07:00
// ========================================
$patients = [
[
'InternalPID' => 1,
'PatientID' => 'SMAJ1',
'AlternatePID' => 'ALT001',
'Prefix' => 'Mr.',
'NameFirst' => 'Dummy',
'NameMiddle' => 'Test',
'NameMaiden' => null,
'NameLast' => 'Patient',
'Suffix' => 'S.Kom',
'NameAlias' => 'DummyTest',
feat(valueset): refactor from ID-based to name-based lookups Complete overhaul of the valueset system to use human-readable names instead of numeric IDs for improved maintainability and API consistency. - PatientController: Renamed 'Gender' field to 'Sex' in validation rules - ValuesetController: Changed API endpoints from ID-based (/:num) to name-based (/:any) - TestsController: Refactored to use ValueSet library instead of direct valueset queries - Added ValueSet library (app/Libraries/ValueSet.php) with static lookup methods: - getOptions() - returns dropdown format [{value, label}] - getLabel(, ) - returns label for a value - transformLabels(, ) - batch transform records - get() and getRaw() for Lookups compatibility - Added ValueSetApiController for public valueset API endpoints - Added ValueSet refresh endpoint (POST /api/valueset/refresh) - Added DemoOrderController for testing order creation without auth - 2026-01-12-000001: Convert valueset references from VID to VValue - 2026-01-12-000002: Rename patient.Gender column to Sex - OrderTestController: Now uses OrderTestModel with proper model pattern - TestsController: Uses ValueSet library for all lookup operations - ValueSetController: Simplified to use name-based lookups - Updated all organization (account/site/workstation) dialogs and index views - Updated specimen container dialogs and index views - Updated tests_index.php with ValueSet integration - Updated patient dialog form and index views - Removed .factory/config.json and CLAUDE.md (replaced by AGENTS.md) - Consolidated lookups in Lookups.php (removed inline valueset constants) - Updated all test files to match new field names - 32 modified files, 17 new files, 2 deleted files - Net: +661 insertions, -1443 deletions (significant cleanup)
2026-01-12 16:53:41 +07:00
'Sex' => 5,
2025-12-17 15:19:55 +07:00
'PlaceOfBirth' => 'Jakarta',
'Birthdate' => '1990-05-15',
'Street_1' => 'Jl. Sudirman No. 123',
'Street_2' => 'RT 01 RW 02',
'Street_3' => 'Kelurahan Menteng',
feat(routes): add container alias endpoint for ContainerDefController Added an alternative route alias 'container' that points to ContainerDefController, providing backward compatibility and flexibility in API endpoint naming. - Routes '/api/specimen/container' to ContainerDefController methods - Supports GET, GET with ID, POST, and PATCH operations - Existing '/api/specimen/containerdef' routes remain unchanged File: app/Config/Routes.php (+7 lines) --- refactor(seeds): update and standardize seed data across multiple seeders Improved data consistency and coverage in database seeds: AreaGeoSeeder.php: - Updated geographic area data for better regional coverage - Standardized data format and field values DummySeeder.php: - Refactored dummy data generation for test environments - Improved data integrity and relationships PatientSeeder.php: - Enhanced patient test data with more realistic scenarios - Updated patient demographic information - Improved test result distributions Total: 111 lines changed across seed files --- docs: add CLQMS project documentation - Added project documentation file: "prj_clinical laboratory quality management system_3a.docx" - Comprehensive project specification and requirements document --- test: remove deprecated TestDefSiteTest.php - Removed obsolete test file that is no longer needed - Test coverage consolidated into other test classes File: tests/feature/TestDef/TestDefSiteTest.php (-374 lines) --- Summary: - +58 lines added (routes, seeds, docs) - -434 lines removed (deprecated test file) - 6 files affected
2026-01-07 16:55:25 +07:00
'City' => '2',
'Province' => '1',
2025-12-17 15:19:55 +07:00
'ZIP' => '10110',
'EmailAddress1' => 'dummy1@test.com',
'EmailAddress2' => 'dummy1alt@test.com',
'Phone' => '02112345678',
'MobilePhone' => '081234567890',
'Custodian' => null,
'AccountNumber' => null,
feat(routes): add container alias endpoint for ContainerDefController Added an alternative route alias 'container' that points to ContainerDefController, providing backward compatibility and flexibility in API endpoint naming. - Routes '/api/specimen/container' to ContainerDefController methods - Supports GET, GET with ID, POST, and PATCH operations - Existing '/api/specimen/containerdef' routes remain unchanged File: app/Config/Routes.php (+7 lines) --- refactor(seeds): update and standardize seed data across multiple seeders Improved data consistency and coverage in database seeds: AreaGeoSeeder.php: - Updated geographic area data for better regional coverage - Standardized data format and field values DummySeeder.php: - Refactored dummy data generation for test environments - Improved data integrity and relationships PatientSeeder.php: - Enhanced patient test data with more realistic scenarios - Updated patient demographic information - Improved test result distributions Total: 111 lines changed across seed files --- docs: add CLQMS project documentation - Added project documentation file: "prj_clinical laboratory quality management system_3a.docx" - Comprehensive project specification and requirements document --- test: remove deprecated TestDefSiteTest.php - Removed obsolete test file that is no longer needed - Test coverage consolidated into other test classes File: tests/feature/TestDef/TestDefSiteTest.php (-374 lines) --- Summary: - +58 lines added (routes, seeds, docs) - -434 lines removed (deprecated test file) - 6 files affected
2026-01-07 16:55:25 +07:00
'Country' => 221,
'Race' => 175,
'MaritalStatus' => 9,
'Religion' => 206,
'Ethnic' => 213,
2025-12-17 15:19:55 +07:00
'Citizenship' => 'WNI',
feat(routes): add container alias endpoint for ContainerDefController Added an alternative route alias 'container' that points to ContainerDefController, providing backward compatibility and flexibility in API endpoint naming. - Routes '/api/specimen/container' to ContainerDefController methods - Supports GET, GET with ID, POST, and PATCH operations - Existing '/api/specimen/containerdef' routes remain unchanged File: app/Config/Routes.php (+7 lines) --- refactor(seeds): update and standardize seed data across multiple seeders Improved data consistency and coverage in database seeds: AreaGeoSeeder.php: - Updated geographic area data for better regional coverage - Standardized data format and field values DummySeeder.php: - Refactored dummy data generation for test environments - Improved data integrity and relationships PatientSeeder.php: - Enhanced patient test data with more realistic scenarios - Updated patient demographic information - Improved test result distributions Total: 111 lines changed across seed files --- docs: add CLQMS project documentation - Added project documentation file: "prj_clinical laboratory quality management system_3a.docx" - Comprehensive project specification and requirements document --- test: remove deprecated TestDefSiteTest.php - Removed obsolete test file that is no longer needed - Test coverage consolidated into other test classes File: tests/feature/TestDef/TestDefSiteTest.php (-374 lines) --- Summary: - +58 lines added (routes, seeds, docs) - -434 lines removed (deprecated test file) - 6 files affected
2026-01-07 16:55:25 +07:00
'DeathIndicator' => 17,
2025-12-17 15:19:55 +07:00
'TimeOfDeath' => null,
'LinkTo' => null,
'CreateDate' => $now,
'DelDate' => null
],
[
'InternalPID' => 2,
'PatientID' => 'PAT002',
'AlternatePID' => 'ALT002',
'Prefix' => 'Mrs.',
'NameFirst' => 'Jane',
'NameMiddle' => null,
'NameMaiden' => 'Smith',
'NameLast' => 'Doe',
'Suffix' => null,
'NameAlias' => 'JaneDoe',
feat(valueset): refactor from ID-based to name-based lookups Complete overhaul of the valueset system to use human-readable names instead of numeric IDs for improved maintainability and API consistency. - PatientController: Renamed 'Gender' field to 'Sex' in validation rules - ValuesetController: Changed API endpoints from ID-based (/:num) to name-based (/:any) - TestsController: Refactored to use ValueSet library instead of direct valueset queries - Added ValueSet library (app/Libraries/ValueSet.php) with static lookup methods: - getOptions() - returns dropdown format [{value, label}] - getLabel(, ) - returns label for a value - transformLabels(, ) - batch transform records - get() and getRaw() for Lookups compatibility - Added ValueSetApiController for public valueset API endpoints - Added ValueSet refresh endpoint (POST /api/valueset/refresh) - Added DemoOrderController for testing order creation without auth - 2026-01-12-000001: Convert valueset references from VID to VValue - 2026-01-12-000002: Rename patient.Gender column to Sex - OrderTestController: Now uses OrderTestModel with proper model pattern - TestsController: Uses ValueSet library for all lookup operations - ValueSetController: Simplified to use name-based lookups - Updated all organization (account/site/workstation) dialogs and index views - Updated specimen container dialogs and index views - Updated tests_index.php with ValueSet integration - Updated patient dialog form and index views - Removed .factory/config.json and CLAUDE.md (replaced by AGENTS.md) - Consolidated lookups in Lookups.php (removed inline valueset constants) - Updated all test files to match new field names - 32 modified files, 17 new files, 2 deleted files - Net: +661 insertions, -1443 deletions (significant cleanup)
2026-01-12 16:53:41 +07:00
'Sex' => 6, // Female
2025-12-17 15:19:55 +07:00
'PlaceOfBirth' => 'Bandung',
'Birthdate' => '1985-10-20',
'Street_1' => 'Jl. Asia Afrika No. 456',
'Street_2' => 'RT 03 RW 04',
'Street_3' => null,
'City' => '8', // Bandung
'Province' => '7', // Jawa Barat
'ZIP' => '40112',
'EmailAddress1' => 'jane.doe@test.com',
'EmailAddress2' => null,
'Phone' => '02298765432',
'MobilePhone' => '089876543210',
'Custodian' => null,
'AccountNumber' => null,
'Country' => 221,
'Race' => 175,
'MaritalStatus' => 8, // Single
'Religion' => 207, // Christian
'Ethnic' => 214, // Sundanese
'Citizenship' => 'WNI',
'DeathIndicator' => 17,
'TimeOfDeath' => null,
'LinkTo' => null,
'CreateDate' => $now,
'DelDate' => null
],
[
'InternalPID' => 3,
'PatientID' => 'PAT003',
'AlternatePID' => 'ALT003',
'Prefix' => 'Mr.',
'NameFirst' => 'Budi',
'NameMiddle' => 'Santoso',
'NameMaiden' => null,
'NameLast' => 'Wijaya',
'Suffix' => null,
'NameAlias' => 'BudiW',
feat(valueset): refactor from ID-based to name-based lookups Complete overhaul of the valueset system to use human-readable names instead of numeric IDs for improved maintainability and API consistency. - PatientController: Renamed 'Gender' field to 'Sex' in validation rules - ValuesetController: Changed API endpoints from ID-based (/:num) to name-based (/:any) - TestsController: Refactored to use ValueSet library instead of direct valueset queries - Added ValueSet library (app/Libraries/ValueSet.php) with static lookup methods: - getOptions() - returns dropdown format [{value, label}] - getLabel(, ) - returns label for a value - transformLabels(, ) - batch transform records - get() and getRaw() for Lookups compatibility - Added ValueSetApiController for public valueset API endpoints - Added ValueSet refresh endpoint (POST /api/valueset/refresh) - Added DemoOrderController for testing order creation without auth - 2026-01-12-000001: Convert valueset references from VID to VValue - 2026-01-12-000002: Rename patient.Gender column to Sex - OrderTestController: Now uses OrderTestModel with proper model pattern - TestsController: Uses ValueSet library for all lookup operations - ValueSetController: Simplified to use name-based lookups - Updated all organization (account/site/workstation) dialogs and index views - Updated specimen container dialogs and index views - Updated tests_index.php with ValueSet integration - Updated patient dialog form and index views - Removed .factory/config.json and CLAUDE.md (replaced by AGENTS.md) - Consolidated lookups in Lookups.php (removed inline valueset constants) - Updated all test files to match new field names - 32 modified files, 17 new files, 2 deleted files - Net: +661 insertions, -1443 deletions (significant cleanup)
2026-01-12 16:53:41 +07:00
'Sex' => 5,
2025-12-17 15:19:55 +07:00
'PlaceOfBirth' => 'Surabaya',
'Birthdate' => '2000-01-01',
'Street_1' => 'Jl. Pahlawan No. 789',
'Street_2' => 'RT 05 RW 06',
'Street_3' => null,
'City' => '2',
'Province' => '1',
'ZIP' => '10220',
'EmailAddress1' => 'budi.wijaya@test.com',
'EmailAddress2' => null,
'Phone' => null,
'MobilePhone' => '081111222333',
'Custodian' => 1,
'AccountNumber' => null,
'Country' => 221,
'Race' => 175,
'MaritalStatus' => 8,
'Religion' => 206,
'Ethnic' => 213,
'Citizenship' => 'WNI',
'DeathIndicator' => 17,
'TimeOfDeath' => null,
'LinkTo' => '1,2',
'CreateDate' => $now,
'DelDate' => null
],
];
foreach ($patients as $patient) {
$exists = $this->db->table('patient')->where('InternalPID', $patient['InternalPID'])->get()->getRow();
if (!$exists) {
$this->db->table('patient')->insert($patient);
}
}
echo "Patient data seeded (3 patients).\n";
// ========================================
// 4. PATIDT - Patient Identifiers (KTP, etc.)
// ========================================
$patidts = [
[
'PatIdtID' => 1,
'InternalPID' => 1,
'IdentifierType' => 'KTP',
'Identifier' => '3171234567890001',
'EffectiveDate' => '2015-01-01',
'ExpirationDate' => '2025-01-01',
'CreateDate' => $now,
'DelDate' => null
],
[
'PatIdtID' => 2,
'InternalPID' => 3,
'IdentifierType' => 'SIM',
'Identifier' => '1234567890123456789',
'EffectiveDate' => '2020-06-15',
'ExpirationDate' => '2025-06-15',
'CreateDate' => $now,
'DelDate' => null
],
];
foreach ($patidts as $patidt) {
$exists = $this->db->table('patidt')->where('PatIdtID', $patidt['PatIdtID'])->get()->getRow();
if (!$exists) {
$this->db->table('patidt')->insert($patidt);
}
}
echo "PatIdt data seeded (2 identifiers).\n";
// ========================================
// 5. PATATT - Patient Attachments
// ========================================
$patatts = [
[
'PatAttID' => 1,
'InternalPID' => 1,
'Address' => '/api/upload/patient1_photo1.jpg',
'UserID' => 1,
'CreateDate' => $now,
'DelDate' => null
],
[
'PatAttID' => 2,
'InternalPID' => 1,
'Address' => '/api/upload/patient1_ktp.jpg',
'UserID' => 1,
'CreateDate' => $now,
'DelDate' => null
],
[
'PatAttID' => 3,
'InternalPID' => 3,
'Address' => '/api/upload/patient3_photo.jpg',
'UserID' => 1,
'CreateDate' => $now,
'DelDate' => null
],
];
foreach ($patatts as $patatt) {
$exists = $this->db->table('patatt')->where('PatAttID', $patatt['PatAttID'])->get()->getRow();
if (!$exists) {
$this->db->table('patatt')->insert($patatt);
}
}
echo "PatAtt data seeded (3 attachments).\n";
// ========================================
// 6. PATCOM - Patient Comments
// ========================================
$patcoms = [
[
'PatComID' => 1,
'InternalPID' => 1,
'Comment' => 'Test patient for unit testing. Has complete data including ID and attachments.',
'CreateDate' => $now,
'EndDate' => null
],
[
'PatComID' => 2,
'InternalPID' => 3,
'Comment' => 'Patient with custodian relationship to patient 1.',
'CreateDate' => $now,
'EndDate' => null
],
];
foreach ($patcoms as $patcom) {
$exists = $this->db->table('patcom')->where('PatComID', $patcom['PatComID'])->get()->getRow();
if (!$exists) {
$this->db->table('patcom')->insert($patcom);
}
}
echo "PatCom data seeded (2 comments).\n";
echo "\n✅ All Patient test data seeded successfully!\n";
echo "-------------------------------------------\n";
echo "Patients: 3 (IDs: 1, 2, 3)\n";
echo " - Patient 1: Full data with PatIdt, PatAtt (2), PatCom\n";
echo " - Patient 2: No PatIdt, PatAtt, PatCom (for null testing)\n";
echo " - Patient 3: Has PatIdt, PatAtt, PatCom, and Custodian link\n";
echo "-------------------------------------------\n";
}
}