Question: Objective: Develop a system in MIPS assembly to efficiently store, manage, and retrieve medical test data for individual patients. This system acts as a basic

Objective:
Develop a system in MIPS assembly to efficiently store, manage, and retrieve medical test data for
individual patients. This system acts as a basic patient record management system focusing on test
results.
File Format:
The medical test will be stored in text file. Each line in the text file represents a single medical test. The
representation will include fields for:
Patient ID (integer: 7 digits)
Test name (string - consider a fixed length)
Test date (string - fixed format like YYYY-MM)
Result (floating-point value)
For example, the following file has two medical tests:
1300500: RBC,2024-03,13.5
1300511: LDL,2024-03,110
Medical Tests:
Below is the list of medical tests with their normal range:
1. Hemoglobin (Hgb): 13.8 to 17.2 grams per deciliter
2. Blood Glucose Test (BGT): Normal Range Between 70 to 99 milligrams per deciliter (mg/dL)
3. LDL Cholesterol Low-Density Lipoprotein (LDL): Normal Range Less than 100 mg/dL
4. Blood Pressure Test (BPT): Normal Range: Systolic Blood Pressure: Less than 120 millimeters of
mercury (mm Hg). Diastolic Blood Pressure: Less than 80 mm Hg
System Functionality:
Develop a text-based menu that allows users to:
Add a new medical test: the system will allow the user to store a new medical test with the
required data. The system will check the validity of the input data.
Search for a test by patient ID: the system will have the following functionality based on user
selection:
Retrieve all patient tests
Retrieve all up normal patient tests
Retrieve all patient tests in a given specific period
Searching for unnormal tests: the system will retrieve all up normal patients tests based on the
input medical test.
Average test value: the system will retrieve the average value of each medical test
Update an existing test result
Delete a test
In addition to the above functionality, the system has capability for:
Error Handling: Implement error handling for invalid file name, searching for non-existent tests,
searching for non-existent patient, ....
Data Validation: Validate user input to ensure proper data types (e.g., integers for ID, valid
dates) and handle potentialerrors..data
# Define data structures
test_struct: .space 32 # Assuming each test takes 32 bytes (7 for ID,10 for name, 7 for date, 8 for result)
test_count: .word 0
patient_ids: .space 1000*4 # Array to store patient IDs (assuming 4 bytes per ID)
test_names: .space 1000*10 # Array to store test names (assuming fixed length)
test_dates: .space 1000*7 # Array to store test dates (YYYY-MM format)
test_results: .space 1000*8 # Array to store test results (float, assuming 8 bytes)
# Define constants for normal ranges
Hgb_min: .float 13.8
Hgb_max: .float 17.2
BGT_min: .float 70
BGT_max: .float 99
LDL_max: .float 100
BPT_systolic_max: .float 120
BPT_diastolic_max: .float 80
# Define constants for menu options
add_option: .asciiz "1. Add a new medical test
"
search_option: .asciiz "2. Search for a test by patient ID
"
average_option: .asciiz "3. Average test value
"
update_option: .asciiz "4. Update an existing test result
"
delete_option: .asciiz "5. Delete a test
"
exit_option: .asciiz "6. Exit
"
menu_prompt: .asciiz "Enter your choice: "
.text
main:
# Display menu
li $v0,4
la $a0, add_option
syscall
li $v0,4
la $a0, search_option
syscall
li $v0,4
la $a0, average_option
syscall
li $v0,4
la $a0, update_option
syscall
li $v0,4
la $a0, delete_option
syscall
li $v0,4
la $a0, exit_option
syscall
li $v0,4
la $a0, menu_prompt
syscall
# Get user input for menu option
li $v0,5
syscall
move $t0, $v0 # Store user choice in $t0
# Branch to corresponding function based on user choice
beq $t0,1, add_test
beq $t0,2, search_test
beq $t0,3, average_test_value
beq $t0,4, update_test_result
beq $t0,5, delete_test
beq $t0,6, exit_program
j main # If invalid choice, display menu again
add_test:
# Implementation of add_test function
...
search_test:
# Implementation of search_test function
...
average_test_value:
# Implementation of average_test_value function
...
update_test_result:
# Implementation of update_test_result function
...
delete_test:
# Implementation of delete_test function
...
exit_program:
# Exit the program
li $v0,10
syscall I NEED THE IMPEMATITION FOR ADD AND SEARCH AND AVERAGE AND UPDATE AND DELETE

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!