Question: 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
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 potential errors. and this is my code data
# 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 bytes per ID
testnames: space # Array to store test names bytes per name
testdates: space # Array to store test dates bytes per date, assuming YYYYMM format
testresults: space # Array to store test results bytes per result, assuming float
buffer: space
# 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:
filename: asciiz "test.txt
# Prompts for user input
promptpatientid: asciiz
Enter Patient ID digits:
prompttestname: asciiz
Enter Test Name:
prompttestdate: asciiz
Enter Test Date YYYYMM:
promptresult: asciiz
Enter Test Result:
invalidpatientidmessage: asciiz "Invalid patient ID Please enter exactly digits.
invalidtestnamemessage: asciiz "Invalid test name. Please enter a name of characters or less.
invalidtestdatemessage: asciiz "Invalid test date format. Please enter date in YYYYMM format.
invalidtestresultmessage: asciiz "Invalid test result. Please enter a valid numerical value.
# Variables to store user input
userpatientid: space # Buffer to store patient ID
usertestname: space # Buffer to store test name
usertestdate: space # Buffer to store test date
userresult: space # Buffer to store test result
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 ave i need the completeion for all functions like search and delete and updtate and avg
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
