Random
📘 Random Pool Selection Engine
This document outlinesdefines the technical and functional logic governingof the Random Pool Selection process,engine, asdesigned to ensure total transparency and mathematical determinism in audit processes, validated by the project's comprehensive unit testing suite (RandomPoolServiceImpTest). suite.
1. SelectionAudit StrategyTransparency &Structure Quota(Super LogicTable)
The systemengine supports two primary modes for determining selection quotas, ensuring flexibility for different compliance requirements:
Math.ceil2. Organization Grouping System
The logic supports multi-organizational pools through the GroupRandom attribute:
GroupRandomD|A 3. Advanced Inclusion Scenarios (Validated)
The selection engine accounts for specific operational cases confirmed via unit tests:breakdown:
| Functional |
|
|---|---|
INCLUDE_INACTIVE_EMPLOYEE |
{c};tMath.ceil.
4.2. Exclusion Logic & Eligibility
The system applies exclusion filters to prevent duplicate testing based on organization settings:
TypeFormGroupRandom of each organization. If an organization is "SOLO DRUG", its Alcohol columns will always report 0|0.
Deterministic Selection: The Preview and the Real Execution process share the same engine, ensuring that visualized results are identical to those processed.
3. Data Integrity & Constraints
Uniqueness (Double-Dip Protection:Protection): TheWhen system ensures that a single physicalan employee is selected for both Drug and Alcohol tests(ALL resultsmode), inthe system generates a single physical selection record within the execution logs(RandomPoolPerson) to prevent database constraint violations, while correctlymaintaining reportingtraceability themfor inboth the "BOTH" categorycategories in summary tables.counters (BOTH Category).
5.4. ErrorSecurity Handling & ValidationValidations
The process will abort and throwwith a controlled RuntimeException if:
- The total eligible population (Active + Rescued Inactive + 2nd Org) is
empty for the selected criteria.zero. - No
Clinical Service Providers (Stakeholders)(Service Providers) are assigned totheperformorganizations"RandominPool" tests for thepool.organizations.