The purpose of this project is to display skills in programming Bourne shell script using some fundamental concepts, including variable assignment and access, variable reading, positional variables, branches and loops, and simple arithmetic. Advanced Unix utilities such as awk, sed, tr will also be used.
In terms of interface and functionality this project is similar as the Database Management System that was original written on the C language but re-written on Bourne Shell.
Compared against C language, shell programming language usually does simpler things. There are no data structures maintained here using shell script. Instead, the database is maintained by writing to and reading from a regular text file directly.
The text file maintains a collection of patient records and the risk factor for stroke due to hypertension.
The program will provide several basic functions:
Each patient record contains the following information fields:
Upon entering a new patient into the database, the program reads in patient’s name, age, high blood pressure and low blood pressure. It then calculates and sets the risk factor of the new patient. The program then creates a new patient record and inserts the new record into the database.
Assume a high blood pressure is higher than a low blood pressure. Assume the optimal high blood pressure (optimalH) is 120 and optimal low blood pressure (optimalL) is 80. The risk factor is evaluated as follows:
The above evaluation criterion applies to patients who are no more than 50 years of age. If the patient is more than 50 years of age, then each case above has additional risk factor of 0.5, except the first case where both the blood pressure are below (or equal to) their optimal values.