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: digits
Test name string consider a fixed length
Test date string fixed format like YYYYMM
Result floatingpoint value
For example, the following file has two medical tests:
: RBC
: LDL
Medical Tests:
Below is the list of medical tests with their normal range:
Hemoglobin Hgb: to grams per deciliter
Blood Glucose Test BGT: Normal Range Between to milligrams per deciliter mgdL
LDL Cholesterol LowDensity Lipoprotein LDL: Normal Range Less than mgdL
Blood Pressure Test BPT: Normal Range: Systolic Blood Pressure: Less than millimeters of
mercury mm Hg Diastolic Blood Pressure: Less than mm Hg
System Functionality:
Develop a textbased 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 nonexistent tests,
searching for nonexistent patient,
Data Validation: Validate user input to ensure proper data types eg integers for ID valid
dates and handle potentialerrorsdata
# Define data structures
teststruct: space # Assuming each test takes bytes for ID for name, for date, for result
testcount: word
patientids: space # Array to store patient IDs assuming bytes per ID
testnames: space # Array to store test names assuming fixed length
testdates: space # Array to store test dates YYYYMM format
testresults: space # Array to store test results float assuming bytes
# Define constants for normal ranges
Hgbmin: float
Hgbmax: float
BGTmin: float
BGTmax: float
LDLmax: float
BPTsystolicmax: float
BPTdiastolicmax: float
# Define constants for menu options
addoption: asciiz Add a new medical test
searchoption: asciiz Search for a test by patient ID
averageoption: asciiz Average test value
updateoption: asciiz Update an existing test result
deleteoption: asciiz Delete a test
exitoption: asciiz Exit
menuprompt: asciiz "Enter your choice:
text
main:
# Display menu
li $v
la $a addoption
syscall
li $v
la $a searchoption
syscall
li $v
la $a averageoption
syscall
li $v
la $a updateoption
syscall
li $v
la $a deleteoption
syscall
li $v
la $a exitoption
syscall
li $v
la $a menuprompt
syscall
# Get user input for menu option
li $v
syscall
move $t $v # Store user choice in $t
# Branch to corresponding function based on user choice
beq $t addtest
beq $t searchtest
beq $t averagetestvalue
beq $t updatetestresult
beq $t deletetest
beq $t exitprogram
j main # If invalid choice, display menu again
addtest:
# Implementation of addtest function
searchtest:
# Implementation of searchtest function
averagetestvalue:
# Implementation of averagetestvalue function
updatetestresult:
# Implementation of updatetestresult function
deletetest:
# Implementation of deletetest function
exitprogram:
# Exit the program
li $v
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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
