Bitwise Team Project Final Report

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 22

CST336 Final Team Project Documentation

Team Members – Bitwise: Jake Kroeker, Jeremiah McGrath, Christopher McMichael

Miscellaneous Info:

● Website URL: https://finalproject.jeremiahmcsumb.repl.co/

● Join Link: https://replit.com/join/owjshrkvag-jeremiahmcsumb

● Default Logins:
○ Username: admin
○ Password: secret

● SQL Schema and Data file: sqlSchema.sql

Project Title: Rx Made Easy

Project Description: Our project is a simple prescription management system where


doctors can write prescriptions for their patients, and patients can view their current
prescriptions. The project handles the creation and management of two separate
account types, doctor and patient. It presents a front-end that allows the database to be
modified in a friendly manner.

Project Task Distribution:

● Jake:
○ Handled back end work with the external API we used for address
validation and implemented account creation for both the patient and
doctors. Also completed the initial project plan document.
● Chris:
○ Created the log in system for both patient and doctor, which included
implementing Bcrypt. Also contributed to the SQL implementation of our
database, including functions that grab patient and doctor data directly, or
several local APIs that serve the same information.
● Jeremiah:
○ Primarily completed the front end’s design for all pages. Implemented the
homepages for both doctor and patient, which includes the viewing, and
modification of prescriptions.

Changes from original design: Our original design initially included a pharmacy
technician and the pharmacies which would have handled filling prescriptions, but we
reduced the scope of the project to just patient and doctor interactions in order to bring
the complexity down to a manageable level. Beyond this our project has stayed very
CST336 Final Team Project Documentation

similar to our original design. Our database initially included tables for the pharmacies –
which have since been removed. We also altered the patient and doctor databases to
rely on a userInformation table which includes login information and core personal data
such as SSN.
CST336 Final Team Project Documentation

Rubric:

● Project allows user interaction with at least three different types of form elements
(text box, select, radio, checkbox, etc).

○ Various pages will use text inputs, such as account creation and login
portals. Some data, such as doctor names, drug names, etc., will be
presented in pre-filled dropdown lists. Radio options are also shown
during patient account creation for a user to select their gender.

● Project uses Web storage or Sessions

○ The project uses sessions in order to store and pass around useful data.
Beyond this we also use sessions to store the login information of the
current user and whether or not that specific user is authorized to access
different pages.

● Project allows users to update existing records in the database, in a friendly way
(data is pre-filled). Must update at least three fields.

○ Patients can update their primary address. This will update four fields to
one record in the patient table: patientState, patientZip, patientCity, and
patientStreet.

● Project allow users to add records to the database

○ Doctors will be able to add new prescriptions in the system that are tied to
patient accounts. This will create a new record in the prescription table.
The creation of user accounts also adds records to the database.

● Project must have at least 50 lines of client-side JavaScript code (e.g. form data
validation, API calls, etc.)

○ We have multiple local javascript files for a couple functions throughout


the app, combined they well exceed the minimum 50 lines of code.

● Project includes at least two local or external Web APIs. As part of your
submission, please explain where the Fetch calls are.

○ We use the Google Address Validation API to validate address input


during account creation, and during the “update address” function on the
patient homepage. We also use several local APIs to grab drug,
prescription, and user information within our javascript files. In our index.js
file, beginning around line 870, we have multiple functions that define local
API interfaces. These interfaces provide a variety of information, such as
CST336 Final Team Project Documentation

returning current prescription data, or fetching a complete list of drug


names in the database.

■ Where the fetch calls are:

● doctorCreateAccount.js:

○ Local: Checks if username is available during input


validation.

○ Local: Checks if SSN is available during input


validation.

● patientCreateAccount.js:

○ Local: Checks if username is available during input


validation.

○ Local: Checks if SSN is available during input


validation.

○ Local and External: Checks if address exists during


input validation using the Google Address Validation
API.

● doctorHomepage.js:

○ Local: Retrieves list of all drugs upon page startup.

○ Local: Retrieves list of all patients belonging to


signed-in doctor.

○ Local: Retrieves patient name using the patient’s ID


number.

○ Local: Retrieves information from ‘userInformation’


SQL table related to a patient using the patient's ID
number.

○ Local: Retrieves list of all prescriptions a doctor has


written.

○ Local: Deletes prescription using rxNum.

○ Local: Creates new entry in ‘prescription’ table using


doctorId, patientId, and drugId.
CST336 Final Team Project Documentation

● patientHomepage.js:

○ Local: Updates patient’s address with information


from filled fields.

○ Local: Verifies patient’s address is a valid entry.

○ Local: Retrieves patient address with the patient’s ID


number.

○ Local: Retrieves list of all prescriptions a patient has


prescribed to them.

● index.js:

○ External: Provides a local API that uses the Google


Address Validation API to check if an address exists.

● Project has a nice, professional and consistent design, free of typos. Uses at
least 50 CSS properties or Bootstrap.

○ We used a combination of bootstrap and individual CSS properties.


CST336 Final Team Project Documentation

Screenshots:

Login Selection Page:

Patient Login:
CST336 Final Team Project Documentation

Incorrect Patient Login:

Create Patient Account:


CST336 Final Team Project Documentation

Missing Account Information:

Patient Homepage:
CST336 Final Team Project Documentation

Viewing Patient Prescriptions:

Changing Patient Address:


CST336 Final Team Project Documentation

Invalid Patient Address:

Patient Address Confirmation:


CST336 Final Team Project Documentation

Doctor Login:

Incorrect Doctor Login:


CST336 Final Team Project Documentation

Create Doctor Account:

Missing Account Information:


CST336 Final Team Project Documentation

Doctor Homepage:

Viewing Doctor Prescriptions:


CST336 Final Team Project Documentation

No Current Prescriptions:

Creating New Prescription:


CST336 Final Team Project Documentation

No Patient Selected:
CST336 Final Team Project Documentation

Database Schema and Data:

-- MySQL Workbench Forward Engineering

SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;


SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS,
FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE,
SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DA
TE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTI
ON';

-- -----------------------------------------------------
-- Schema r9p4z1hjmljpenkt
-- -----------------------------------------------------
DROP SCHEMA IF EXISTS `r9p4z1hjmljpenkt`;
CREATE SCHEMA IF NOT EXISTS `r9p4z1hjmljpenkt` DEFAULT CHARACTER SET
utf8mb3 ;
USE `r9p4z1hjmljpenkt` ;

-- -----------------------------------------------------
-- Table `r9p4z1hjmljpenkt`.`userInformation`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `r9p4z1hjmljpenkt`.`userInformation` (
`loginId` INT NOT NULL AUTO_INCREMENT,
`userType` INT NOT NULL,
`username` VARCHAR(45) NOT NULL,
`passwordHash` VARCHAR(255) NOT NULL,
`firstName` VARCHAR(45) NOT NULL,
`lastName` VARCHAR(45) NOT NULL,
`SSN` CHAR(9) NOT NULL,
PRIMARY KEY (`loginId`))
ENGINE = InnoDB;

-- -----------------------------------------------------
-- Table `r9p4z1hjmljpenkt`.`doctor`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `r9p4z1hjmljpenkt`.`doctor` (
`doctorId` INT NOT NULL AUTO_INCREMENT,
`loginId` INT NOT NULL,
CST336 Final Team Project Documentation

PRIMARY KEY (`doctorId`),


INDEX `fk_doctor_loginCredentials1_idx` (`loginId` ASC) VISIBLE,
CONSTRAINT `fk_doctor_loginCredentials1`
FOREIGN KEY (`loginId`)
REFERENCES `r9p4z1hjmljpenkt`.`userInformation` (`loginId`)
ON DELETE CASCADE)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb3;

-- -----------------------------------------------------
-- Table `r9p4z1hjmljpenkt`.`drug`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `r9p4z1hjmljpenkt`.`drug` (
`drugId` INT NOT NULL AUTO_INCREMENT,
`drugName` VARCHAR(45) NOT NULL,
`drugInfo` VARCHAR(100) NULL,
PRIMARY KEY (`drugId`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb3;

-- -----------------------------------------------------
-- Table `r9p4z1hjmljpenkt`.`patient`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `r9p4z1hjmljpenkt`.`patient` (
`patientId` INT NOT NULL AUTO_INCREMENT,
`primaryDoctorId` INT NOT NULL,
`loginId` INT NOT NULL,
`patientBirthdate` DATE NOT NULL,
`patientState` VARCHAR(45) NOT NULL,
`patientZip` CHAR(5) NOT NULL,
`patientCity` VARCHAR(45) NOT NULL,
`patientStreet` VARCHAR(45) NOT NULL,
`patientGender` CHAR(1) NOT NULL,
PRIMARY KEY (`patientId`),
INDEX `fk_patient_doctor1_idx` (`primaryDoctorId` ASC) VISIBLE,
INDEX `fk_patient_loginCredentials1_idx` (`loginId` ASC) VISIBLE,
CONSTRAINT `fk_patient_doctor1`
FOREIGN KEY (`primaryDoctorId`)
REFERENCES `r9p4z1hjmljpenkt`.`doctor` (`doctorId`)
ON DELETE CASCADE,
CST336 Final Team Project Documentation

CONSTRAINT `fk_patient_loginCredentials1`
FOREIGN KEY (`loginId`)
REFERENCES `r9p4z1hjmljpenkt`.`userInformation` (`loginId`)
ON DELETE CASCADE)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb3;

-- -----------------------------------------------------
-- Table `r9p4z1hjmljpenkt`.`prescription`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `r9p4z1hjmljpenkt`.`prescription` (
`rxNum` INT NOT NULL AUTO_INCREMENT,
`doctorId` INT NOT NULL,
`patientId` INT NOT NULL,
`drugId` INT NOT NULL,
PRIMARY KEY (`rxNum`),
INDEX `fk_prescription_drug1_idx` (`drugId` ASC) VISIBLE,
INDEX `fk_prescription_patient1_idx` (`patientId` ASC) VISIBLE,
INDEX `fk_prescription_doctor1_idx` (`doctorId` ASC) VISIBLE,
CONSTRAINT `fk_prescription_doctor1`
FOREIGN KEY (`doctorId`)
REFERENCES `r9p4z1hjmljpenkt`.`doctor` (`doctorId`)
ON DELETE CASCADE,
CONSTRAINT `fk_prescription_drug1`
FOREIGN KEY (`drugId`)
REFERENCES `r9p4z1hjmljpenkt`.`drug` (`drugId`)
ON DELETE CASCADE,
CONSTRAINT `fk_prescription_patient1`
FOREIGN KEY (`patientId`)
REFERENCES `r9p4z1hjmljpenkt`.`patient` (`patientId`)
ON DELETE CASCADE)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb3;

-- -----------------------------------------------------
-- Insert values into userInformation table
-- -----------------------------------------------------

INSERT INTO `r9p4z1hjmljpenkt`.`userInformation`


(loginId, userType, username, passwordHash, firstName, lastName, SSN)
CST336 Final Team Project Documentation

VALUES
(1, 1, 'admin',
'$2b$10$ZvdOe5/Np68EnSNuMvJ78ugK1FkxeB6YxBDwkTwk2YPYcEzF0yYDC',
'Jane', 'Doe', '987654321'),
(2, 0, 'admin',
'$2b$10$ZvdOe5/Np68EnSNuMvJ78ugK1FkxeB6YxBDwkTwk2YPYcEzF0yYDC',
'John', 'Doe', '123456789');

-- -----------------------------------------------------
-- Insert values into doctor table
-- -----------------------------------------------------

INSERT INTO `r9p4z1hjmljpenkt`.`doctor`


(doctorId, loginId)
VALUES
(1, 1);

-- -----------------------------------------------------
-- Insert values into patient table
-- -----------------------------------------------------

INSERT INTO `r9p4z1hjmljpenkt`.`patient`


(patientId, primaryDoctorId, loginId, patientBirthdate, patientState, patientZip,
patientCity, patientStreet, patientGender)
VALUES
(1, 1, 2, '1969-01-01', 'CA', '93446', 'Paso Robles', '100 Niblick Rd', 'M');

-- -----------------------------------------------------
-- Insert values into drug table
-- -----------------------------------------------------

INSERT INTO `r9p4z1hjmljpenkt`.`drug`


(drugId, drugName, drugInfo)
VALUES
(1, 'Paracetamol', 'Commonly used for pain relief'),
(2, 'Ibuprofen', 'Nonsteroidal anti-inflammatory drug'),
(3, 'Omeprazole', 'Used for treating stomach ulcers'),
(4, 'Amoxicillin', 'Antibiotic for bacterial infections'),
(5, 'Atorvastatin', 'Lowers cholesterol levels'),
(6, 'Metformin', 'Treats type 2 diabetes'),
CST336 Final Team Project Documentation

(7, 'Sertraline', 'Antidepressant medication'),


(8, 'Amlodipine', 'Used for high blood pressure'),
(9, 'Simvastatin', 'Lowers cholesterol levels'),
(10, 'Alprazolam', 'Treats anxiety and panic disorders'),
(11, 'Lisinopril', 'Used for high blood pressure and heart failure'),
(12, 'Citalopram', 'Antidepressant medication'),
(13, 'Metoprolol', 'Treats high blood pressure and angina'),
(14, 'Losartan', 'Treats high blood pressure and diabetic kidney disease'),
(15, 'Prednisone', 'Used to treat inflammatory conditions'),
(16, 'Azithromycin', 'Antibiotic for bacterial infections'),
(17, 'Amitriptyline', 'Tricyclic antidepressant'),
(18, 'Hydrochlorothiazide', 'Diuretic used for high blood pressure'),
(19, 'Gabapentin', 'Anticonvulsant medication'),
(20, 'Ciprofloxacin', 'Antibiotic for bacterial infections'),
(21, 'Pantoprazole', 'Proton pump inhibitor for acid reflux'),
(22, 'Furosemide', 'Diuretic used for fluid retention'),
(23, 'Tamsulosin', 'Treats urinary problems in men with an enlarged prostate'),
(24, 'Warfarin', 'Anticoagulant (blood thinner)'),
(25, 'Doxycycline', 'Antibiotic for bacterial infections'),
(26, 'Clonazepam', 'Treats seizures and panic disorders'),
(27, 'Fluoxetine', 'Antidepressant medication'),
(28, 'Cephalexin', 'Antibiotic for bacterial infections'),
(29, 'Tramadol', 'Pain reliever used for moderate to severe pain'),
(30, 'Venlafaxine', 'Treats depression and anxiety disorders'),
(31, 'Carvedilol', 'Treats heart failure and high blood pressure'),
(32, 'Lorazepam', 'Treats anxiety disorders'),
(33, 'Bupropion', 'Antidepressant medication and aids in smoking cessation'),
(34, 'Sildenafil', 'Treats erectile dysfunction'),
(35, 'Levothyroxine', 'Treats hypothyroidism'),
(36, 'Folic acid', 'Supplement used to prevent certain types of anemia'),
(37, 'Albuterol', 'Bronchodilator used for asthma and COPD'),
(38, 'Ondansetron', 'Prevents nausea and vomiting caused by chemotherapy'),
(39, 'Meloxicam', 'Nonsteroidal anti-inflammatory drug'),
(40, 'Methylprednisolone', 'Corticosteroid used for various inflammatory conditions'),
(41, 'Duloxetine', 'Treats depression and chronic pain disorders'),
(42, 'Clindamycin', 'Antibiotic for bacterial infections'),
(43, 'Ranitidine', 'H2 blocker used for acid reflux and ulcers'),
(44, 'Clopidogrel', 'Antiplatelet medication to prevent blood clots'),
(45, 'Montelukast', 'Treats asthma and allergic rhinitis'),
(46, 'Fluticasone', 'Corticosteroid used for asthma and allergies'),
CST336 Final Team Project Documentation

(47, 'Amphetamine salts', 'Treats attention deficit hyperactivity disorder (ADHD)'),


(48, 'Quetiapine', 'Atypical antipsychotic medication'),
(49, 'Diazepam', 'Treats anxiety and muscle spasms'),
(50, 'Budesonide', 'Corticosteroid used for asthma and inflammatory bowel disease'),
(51, 'Lisinopril/Hydrochlorothiazide', 'Combination drug for high blood pressure'),
(52, 'Trazodone', 'Antidepressant medication'),
(53, 'Cyclobenzaprine', 'Muscle relaxant'),
(54, 'Metronidazole', 'Antibiotic for bacterial and parasitic infections'),
(55, 'Losartan/Hydrochlorothiazide', 'Combination drug for high blood pressure'),
(56, 'Glimepiride', 'Treats type 2 diabetes'),
(57, 'Donepezil', 'Treats Alzheimer\'s disease'),
(58, 'Celecoxib', 'Nonsteroidal anti-inflammatory drug'),
(59, 'Valsartan', 'Treats high blood pressure and heart failure'),
(60, 'Oxycodone', 'Opioid pain medication'),
(61, 'Candesartan', 'Treats high blood pressure and heart failure'),
(62, 'Benazepril', 'Treats high blood pressure'),
(63, 'Mirtazapine', 'Antidepressant medication'),
(64, 'Lansoprazole', 'Proton pump inhibitor for acid reflux and ulcers'),
(65, 'Dexamethasone', 'Corticosteroid used for various inflammatory conditions'),
(66, 'Diphenhydramine', 'Antihistamine used for allergies and sleep aid'),
(67, 'Baclofen', 'Muscle relaxant'),
(68, 'Tolterodine', 'Treats overactive bladder'),
(69, 'Phentermine', 'Appetite suppressant for weight loss'),
(70, 'Cetirizine', 'Antihistamine used for allergies'),
(71, 'Fluconazole', 'Antifungal medication'),
(72, 'Bimatoprost', 'Treats glaucoma and enhances eyelash growth'),
(73, 'Memantine', 'Treats Alzheimer\'s disease'),
(74, 'Citalopram/Hydrobromide', 'Combination drug for depression'),
(75, 'Paroxetine', 'Antidepressant medication'),
(76, 'Temazepam', 'Treats insomnia'),
(77, 'Risperidone', 'Atypical antipsychotic medication'),
(78, 'Alendronate', 'Treats osteoporosis'),
(79, 'Tiotropium', 'Bronchodilator used for COPD'),
(80, 'Pioglitazone', 'Treats type 2 diabetes'),
(81, 'Chlorhexidine', 'Antiseptic and disinfectant'),
(82, 'Triamcinolone', 'Corticosteroid used for various inflammatory conditions'),
(83, 'Terbinafine', 'Antifungal medication'),
(84, 'Allopurinol', 'Treats gout and kidney stones'),
(85, 'Desloratadine', 'Antihistamine used for allergies'),
(86, 'Codeine', 'Opioid pain medication'),
CST336 Final Team Project Documentation

(87, 'Clotrimazole', 'Antifungal medication'),


(88, 'Carbamazepine', 'Treats seizures and nerve pain'),
(89, 'Famotidine', 'H2 blocker used for acid reflux and ulcers'),
(90, 'Buprenorphine', 'Treats opioid addiction and pain'),
(91, 'Quinapril', 'Treats high blood pressure'),
(92, 'Insulin glargine', 'Long-acting insulin for diabetes'),
(93, 'Esomeprazole', 'Proton pump inhibitor for acid reflux and ulcers'),
(94, 'Hydroxyzine', 'Antihistamine used for allergies and anxiety'),
(95, 'Clobetasol', 'Corticosteroid used for various inflammatory conditions'),
(96, 'Ipratropium', 'Bronchodilator used for COPD'),
(97, 'Mometasone', 'Corticosteroid used for asthma and allergies');

-- -----------------------------------------------------
-- Insert values into prescription table
-- -----------------------------------------------------

INSERT INTO `r9p4z1hjmljpenkt`.`prescription`


(rxNum, doctorId, patientId, drugId)
VALUES
(1, 1, 1, 86);

SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;

You might also like