Task #108
openTest Results (Based on Selected Tests in Registration)
0%
Description
MODULE: Test Results (Based on Selected Tests in Registration)
Navigation: Login β Sidebar β Test Results
π― TASK OBJECTIVE:
Develop Test Results module where:
β’ User searches a registration
β’ System automatically loads the tests selected during registration
β’ Parameters are fetched based on selected tests
β’ Result entry is dynamic
β’ Results saved per parameter
β’ No manual test selection in this module
π§ IMPORTANT LOGIC CHANGE
In registration table:
lab_test (JSON)
Example:
[1, 3]
Means:
β’ Test ID 1 (CBC)
β’ Test ID 3 (LFT)
So Test Results page must:
1. Read lab_test
2. Fetch parameters for each test
3. Render grouped result sections
PART 1 β FRONTEND IMPLEMENTATION
β 1. Sidebar Menu
Add menu: Test Results
β 2. Search Registration Section
Search by:
β’ Patient ID
β’ Date
β’ Owner Name
β’ Mobile number
Display listing:
| Patient ID | Patient Name | Tests | Date | Action |
Action:
Enter Results
β 3. After Clicking βEnter Resultsβ
Show patient details (Read Only):
β’ Patient ID
β’ Patient Name
β’ Owner Name
β’ Species
β’ Breed
β’ Registration Date
β
4. Load Selected Tests Automatically
From registration:
lab_test = [1, 3]
System must:
β’ Loop through each test_id
β’ Fetch test name
β’ Fetch parameters for each test
β
5. Dynamic Result Entry UI
Results must be grouped by Test.
Example UI:
πΉ CBC
Parameter Input
HB [ Decimal Input ]
WBC [ Number Input ]
COLOR [ Dropdown ]
πΉ LFT
Parameter Input
SGPT [ Decimal Input ]
Bilirubin [ Decimal Input ]
π¨ Rendering Rules
Parameter Type UI
INTEGER Number input
DOUBLE Decimal input
VARCHAR Text input
SELECT Dropdown
CHECKBOX Multi select
OPTION Radio button
β 6. Save Button
On click:
β’ Collect results for all tests
β’ Send structured payload
β PART 2 β BACKEND IMPLEMENTATION
β 1. Table: lab_test_result
id PK
patient_id FK
enterprise_id FK
registration_id FK
test_id FK
parameter_id FK
parameter_name FK
test_value TEXT
added_date DATE-TIME
β
2. API β Get Registration
GET /api/registration/{id}
Return:
β’ Registration details
β’ lab_test JSON
β
3. API β Get Parameters for Multiple Tests
GET /api/tests/{registration_id}/parameters/
Backend Logic:
β’ Read registration.lab_test
β’ Fetch all parameters for those tests
β’ Return grouped response
Example response:
{
"tests": [
{
"test_id": 1,
"test_name": "CBC",
"parameters": [...]
},
{
"test_id": 3,
"test_name": "LFT",
"parameters": [...]
}
]
}
βΈ»
β 4. Save Results API
POST /api/test-results/
Payload Example:
{
"registration_id": 101,
"results": [
{
"test_id": 1,
"parameter_id": "HB",
"value": 13.5
},
{
"test_id": 3,
"parameter_id": "SGPT",
"value": 45
}
]
}
Backend Processing
β Validate registration exists
β Validate test belongs to registration
β Validate parameter belongs to test
β Validate value type
β Store enterprise_id
βΈ»
π VALIDATION RULES
Same as Parameter module:
Type Rule
INTEGER Whole number only
DOUBLE Decimal allowed
VARCHAR Text
SELECT Must match one option
CHECKBOX All values must match options
OPTION Only one allowed
π SYSTEM FLOW
Registration created
β Tests selected and stored in lab_test
β User opens Test Results
β Select registration
β System loads tests automatically
β Render dynamic parameter UI
β Save results
β COMPLETION CRITERIA
β No manual test selection
β Multiple tests handled
β Dynamic UI grouped by test
β Validation enforced
β Results saved correctly
β Enterprise filtering working
Files