diff --git a/README.md b/README.md index 1278e45..1d5e3af 100644 --- a/README.md +++ b/README.md @@ -5,15 +5,8 @@ This repo contains a boilerplate setup for spinning up 3 Docker containers: 1. A Python Flask container to implement a REST API 1. A Local AppSmith Server -## How to setup and start the containers -**Important** - you need Docker Desktop installed +The platform aims to provide cancer patients and their families with comprehensive information about different types of cancer, treatment options, available support resources, and opportunities to connect with others who have similar experiences. The platform aims to solve the problem of a lack of easily accessible and reliable information about cancer and its related resources. Cancer patients and their families often face overwhelming amounts of information and uncertainty about their diagnosis, treatment options, and support resources. This can lead to confusion, anxiety, and difficulty in making informed decisions about their care. By offering a comprehensive source of information and community support, this platform can help to alleviate some of the stress and uncertainty associated with a cancer diagnosis and treatment. -1. Clone this repository. -1. Create a file named `db_root_password.txt` in the `secrets/` folder and put inside of it the root password for MySQL. -1. Create a file named `db_password.txt` in the `secrets/` folder and put inside of it the password you want to use for the a non-root user named webapp. -1. In a terminal or command prompt, navigate to the folder with the `docker-compose.yml` file. -1. Build the images with `docker compose build` -1. Start the containers with `docker compose up`. To run in detached mode, run `docker compose up -d`. diff --git a/db/00_healing_hearts_db.sql b/db/00_healing_hearts_db.sql new file mode 100644 index 0000000..0d7152d --- /dev/null +++ b/db/00_healing_hearts_db.sql @@ -0,0 +1,293 @@ +# noinspection SqlCurrentSchemaInspectionForFile + +DROP DATABASE cancer_patient_platform + + +-- Create the database +CREATE DATABASE cancer_patient_platform; + + +-- Use the database +USE cancer_patient_platform; + + +-- Create the Cancer Type table +CREATE TABLE cancer_type ( + cancer_type_id INT NOT NULL AUTO_INCREMENT, + name VARCHAR(50) NOT NULL, + description VARCHAR(255), + PRIMARY KEY (cancer_type_id) +); + +-- Create the User table +CREATE TABLE user ( + user_id INT NOT NULL AUTO_INCREMENT, + first_name VARCHAR(50) NOT NULL, + last_name VARCHAR(50) NOT NULL, + occupation VARCHAR(100) NOT NULL, + birth_date DATE NOT NULL, + gender VARCHAR(50) NOT NULL, + city VARCHAR(100) NOT NULL, + state VARCHAR(50) NOT NULL, + cancer_type_id INT NOT NULL, + email_1 VARCHAR(50) NOT NULL, + email_2 VARCHAR(50), + phone_1 VARCHAR(50) NOT NULL, + phone_2 VARCHAR(50), + PRIMARY KEY (user_id), + FOREIGN KEY (cancer_type_id) REFERENCES cancer_type(cancer_type_id) +); + +-- Create the Treatment table +CREATE TABLE treatment( + treatment_id INT NOT NULL AUTO_INCREMENT, + name VARCHAR(100) NOT NULL, + description VARCHAR(255), + PRIMARY KEY (treatment_id) +); + +-- Create the Support Group Leader table +CREATE TABLE support_group_leader ( + group_leader_id INT NOT NULL AUTO_INCREMENT, + first_name VARCHAR(50) NOT NULL, + last_name VARCHAR(50) NOT NULL, + email VARCHAR(100) NOT NULL, + PRIMARY KEY (group_leader_id) +); + +-- Create the Support Group table +CREATE TABLE support_group ( + support_group_id INT NOT NULL AUTO_INCREMENT, + group_leader_id INT NOT NULL, + name VARCHAR(50) NOT NULL, + location VARCHAR(50), + capacity INT, + PRIMARY KEY (support_group_id), + FOREIGN KEY (group_leader_id) REFERENCES support_group_leader(group_leader_id) +); + +-- Create the Support Resource table +CREATE TABLE support_resource ( + resource_id INT NOT NULL AUTO_INCREMENT, + name VARCHAR(50) NOT NULL, + organization VARCHAR(50), + first_name VARCHAR(50), + last_name VARCHAR(50), + email VARCHAR(50), + support_group_id INT, + PRIMARY KEY (resource_id), + FOREIGN KEY (support_group_id) REFERENCES support_group(support_group_id) +); + +-- Create the Symptom table +CREATE TABLE symptom ( +symptom_id INT NOT NULL AUTO_INCREMENT, +name VARCHAR(100) NOT NULL, +description VARCHAR(500) NOT NULL, +PRIMARY KEY (symptom_id) +); + +-- Create the Exhibits table +CREATE TABLE exhibits ( +user_id INT NOT NULL, +symptom_id INT NOT NULL, +start_date DATE NOT NULL, +end_date DATE, +severity VARCHAR(50), +PRIMARY KEY (symptom_id), +FOREIGN KEY (symptom_id) REFERENCES symptom(symptom_id), +FOREIGN KEY (user_id) REFERENCES user(user_id) +); + +-- Create the Typically Exhibits table +CREATE TABLE typically_exhibits ( +symptom_id INT NOT NULL, +cancer_type_id INT NOT NULL, +PRIMARY KEY (symptom_id), +FOREIGN KEY (symptom_id) REFERENCES symptom(symptom_id), +FOREIGN KEY (cancer_type_id) REFERENCES user(cancer_type_id) +); + +-- Create the Typically Treated With table +CREATE TABLE typically_treated_with( + cancer_type_id INT NOT NULL, + treatment_id INT NOT NULL, + PRIMARY KEY (cancer_type_id, treatment_id), + FOREIGN KEY (cancer_type_id) REFERENCES cancer_type(cancer_type_id), + FOREIGN KEY (treatment_id) REFERENCES treatment(treatment_id) +); + +-- Create the Makes Connection table +CREATE TABLE makes_connection ( +user_id_1 INT NOT NULL, +user_id_2 INT NOT NULL, +relationship VARCHAR(100) NOT NULL, +FOREIGN KEY (user_id_1) REFERENCES user(user_id) ON DELETE CASCADE, +FOREIGN KEY (user_id_2) REFERENCES user(user_id) ON DELETE CASCADE +); + +-- Create the Medical Professional table +CREATE TABLE medical_professional ( +professional_id INT NOT NULL AUTO_INCREMENT, +first_name VARCHAR(50) NOT NULL, +last_name VARCHAR(50) NOT NULL, +specialty VARCHAR(100) NOT NULL, +treatment_id INT, +PRIMARY KEY (professional_id), +FOREIGN KEY (treatment_id) REFERENCES treatment(treatment_id) +); + +-- Create the Treatment Center table +CREATE TABLE treatment_center ( +center_id INT NOT NULL AUTO_INCREMENT, +street_address VARCHAR(100) NOT NULL, +state VARCHAR(100) NOT NULL, +city VARCHAR(100) NOT NULL, +zip_code VARCHAR(10) NOT NULL, +website VARCHAR(100), +professional_id INT, +email_1 VARCHAR(50) NOT NULL, +email_2 VARCHAR(50), +phone_1 VARCHAR(50) NOT NULL, +phone_2 VARCHAR(50), +PRIMARY KEY (center_id), +FOREIGN KEY (professional_id) REFERENCES medical_professional(professional_id) +); + +-- Create the Medication table +CREATE TABLE medication ( +medication_id INT NOT NULL AUTO_INCREMENT, +name VARCHAR(100) NOT NULL, +description VARCHAR(500), +PRIMARY KEY (medication_id) +); + +-- Create the Symptom Treated With table +CREATE TABLE symptom_treated_with ( +symptom_id INT NOT NULL, +medication_id INT NOT NULL, +PRIMARY KEY (symptom_id, medication_id), +FOREIGN KEY (symptom_id) REFERENCES symptom(symptom_id), +FOREIGN KEY (medication_id) REFERENCES medication(medication_id) +); + +-- Create the Involves table +CREATE TABLE involves ( +treatment_id INT NOT NULL, +medication_id INT NOT NULL, +PRIMARY KEY (treatment_id, medication_id), +FOREIGN KEY (treatment_id) REFERENCES treatment(treatment_id), +FOREIGN KEY (medication_id) REFERENCES medication(medication_id) +); + +-- Create the Member Of table +CREATE TABLE member_of ( +support_group_id INT NOT NULL, +user_id INT NOT NULL, +PRIMARY KEY (support_group_id, user_id), +FOREIGN KEY (support_group_id) REFERENCES support_group(support_group_id), +FOREIGN KEY (user_id) REFERENCES user(user_id) +); + +-- Create the Supported By table +CREATE TABLE supported_by ( +resource_id INT NOT NULL, +user_id INT NOT NULL, +PRIMARY KEY (resource_id, user_id), +FOREIGN KEY (resource_id) REFERENCES support_resource(resource_id), +FOREIGN KEY (user_id) REFERENCES user(user_id) +); + + +-- Create the Meeting table +CREATE TABLE meeting ( +meeting_number INT NOT NULL AUTO_INCREMENT, +support_group_id INT NOT NULL, +PRIMARY KEY (meeting_number, support_group_id), +FOREIGN KEY (support_group_id) REFERENCES support_group(support_group_id) +); + + + + + + +-- Create the Meeting table + + +# INSERT INTO cancer_type (name, description) +# VALUES +# ('Breast Cancer', 'Cancer that forms in the cells of the breasts.'), +# ('Prostate Cancer', 'Cancer that occurs in the prostate — a small walnut-shaped gland in men that produces the seminal fluid that nourishes and transports sperm.'), +# ('Lung Cancer', 'Cancer that forms in tissues of the lung, usually in the cells lining air passages.'), +# ('Colon Cancer', 'Cancer that occurs in the colon or rectum.'); +# +# INSERT INTO treatment_option (name, description, cancer_type_id) +# VALUES +# ('Chemotherapy', 'Uses drugs to destroy cancer cells.', 1), +# ('Radiation Therapy', 'Uses high-energy radiation to kill cancer cells.', 2), +# ('Surgery', 'Involves removing the tumor and surrounding tissue during an operation.', 3); +# +# +# INSERT INTO support_resource (name, organization, contact_person, contact_email, cancer_type_id) +# VALUES +# ('Counseling Services', 'American Cancer Society', 'John Smith', 'john.smith@cancer.org', 1), +# ('Financial Assistance Programs', 'National Cancer Institute', 'Mary Johnson', 'mary.johnson@nci.gov', 2), +# ('Educational Materials', 'American Lung Association', 'David Lee', 'david.lee@lung.org', 3), +# ('Support Groups', 'Susan G. Komen', 'Sarah Kim', 'sarah.kim@komen.org', 1); +# +# +# INSERT INTO support_group (group_leader_id, name, cancer_type_id, location, frequency, capacity) +# VALUES +# (1, 'Breast Cancer Support Group', 1, 'Los Angeles, CA', 'Monthly', 20), +# (2, 'Prostate Cancer Support Group', 2, 'New York, NY', 'Weekly', 15), +# (3, 'Lung Cancer Support Group', 3, 'Chicago, IL', 'Bi-weekly', 10), +# (4, 'Breast Cancer Survivors Support Group', 1, 'Houston, TX', 'Monthly', 30); +# +# +# INSERT INTO support_group_leader (first_name, last_name, email) +# VALUES +# ('Emily', 'Smith', 'emily.smith@gmail.com'), +# ('Ryan', 'Johnson', 'ryan.johnson@yahoo.com'), +# ('Jessica', 'Lee', 'jessica.lee@hotmail.com'); +# +# +# -- Insert sample data into the Symptom table +# INSERT INTO symptom (user_id, severity, start_date, end_date, cancer_type_id) +# VALUES +# (1, 'moderate', '2023-03-15', NULL, 3), +# (2, 'severe', '2023-02-20', '2023-03-05', 2), +# (3, 'mild', '2023-03-01', NULL, 1); +# +# +# -- Insert sample data into the Treatment table +# INSERT INTO treatment (user_id, treatment_id, start_date, end_date) +# VALUES +# (1, 1, '2023-03-01', NULL), +# (2, 2, '2023-02-15', '2023-03-30'), +# (3, 3, '2023-03-01', NULL); +# +# +# +# +# -- Insert sample data into the Treatment Centers table +# INSERT INTO treatment_center (name, address, phone_number, email, website) +# VALUES +# ('Memorial Sloan Kettering Cancer Center', '1275 York Ave, New York, NY 10065', '+1 (212) 639-2000', 'contact@mskcc.org', 'https://www.mskcc.org/'), +# ('Mayo Clinic', '200 1st St SW, Rochester, MN 55905', '+1 (507) 284-2511', 'mayoclinic@mayoclinic.org', 'https://www.mayoclinic.org/'), +# ('Johns Hopkins Hospital', '1800 Orleans St, Baltimore, MD 21287', '+1 (410) 955-5000', 'jhmi@jhmi.edu', 'https://www.hopkinsmedicine.org/'); +# +# +# +# +# -- Insert sample data into the Community Forum Posts table +# INSERT INTO community_forum_post (user_id, title, tag) +# VALUES +# (1, 'Dealing with fatigue during treatment', 'fatigue'), +# (2, 'Tips for managing chemo-induced nausea', 'nausea'), +# (3, 'Looking for recommendations for support groups in the Chicago area', 'support groups'), +# (4, 'Sharing my experience with radiation therapy', 'radiation'), +# (5, 'Coping with anxiety after a cancer diagnosis', 'anxiety'); +# +# +# diff --git a/db/00_northwind.sql b/db/00_northwind.sql deleted file mode 100644 index 57678cf..0000000 --- a/db/00_northwind.sql +++ /dev/null @@ -1,546 +0,0 @@ -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='TRADITIONAL,ALLOW_INVALID_DATES'; - -DROP SCHEMA IF EXISTS `northwind` ; -CREATE SCHEMA IF NOT EXISTS `northwind` DEFAULT CHARACTER SET latin1 ; -USE `northwind` ; - --- ----------------------------------------------------- --- Table `northwind`.`customers` --- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `northwind`.`customers` ( - `id` INT(11) NOT NULL AUTO_INCREMENT, - `company` VARCHAR(50) NULL DEFAULT NULL, - `last_name` VARCHAR(50) NULL DEFAULT NULL, - `first_name` VARCHAR(50) NULL DEFAULT NULL, - `email_address` VARCHAR(50) NULL DEFAULT NULL, - `job_title` VARCHAR(50) NULL DEFAULT NULL, - `business_phone` VARCHAR(25) NULL DEFAULT NULL, - `home_phone` VARCHAR(25) NULL DEFAULT NULL, - `mobile_phone` VARCHAR(25) NULL DEFAULT NULL, - `fax_number` VARCHAR(25) NULL DEFAULT NULL, - `address` LONGTEXT NULL DEFAULT NULL, - `city` VARCHAR(50) NULL DEFAULT NULL, - `state_province` VARCHAR(50) NULL DEFAULT NULL, - `zip_postal_code` VARCHAR(15) NULL DEFAULT NULL, - `country_region` VARCHAR(50) NULL DEFAULT NULL, - `web_page` LONGTEXT NULL DEFAULT NULL, - `notes` LONGTEXT NULL DEFAULT NULL, - `attachments` LONGBLOB NULL DEFAULT NULL, - PRIMARY KEY (`id`), - INDEX `city` (`city` ASC), - INDEX `company` (`company` ASC), - INDEX `first_name` (`first_name` ASC), - INDEX `last_name` (`last_name` ASC), - INDEX `zip_postal_code` (`zip_postal_code` ASC), - INDEX `state_province` (`state_province` ASC)) -ENGINE = InnoDB -DEFAULT CHARACTER SET = utf8; - - --- ----------------------------------------------------- --- Table `northwind`.`employees` --- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `northwind`.`employees` ( - `id` INT(11) NOT NULL AUTO_INCREMENT, - `company` VARCHAR(50) NULL DEFAULT NULL, - `last_name` VARCHAR(50) NULL DEFAULT NULL, - `first_name` VARCHAR(50) NULL DEFAULT NULL, - `email_address` VARCHAR(50) NULL DEFAULT NULL, - `job_title` VARCHAR(50) NULL DEFAULT NULL, - `business_phone` VARCHAR(25) NULL DEFAULT NULL, - `home_phone` VARCHAR(25) NULL DEFAULT NULL, - `mobile_phone` VARCHAR(25) NULL DEFAULT NULL, - `fax_number` VARCHAR(25) NULL DEFAULT NULL, - `address` LONGTEXT NULL DEFAULT NULL, - `city` VARCHAR(50) NULL DEFAULT NULL, - `state_province` VARCHAR(50) NULL DEFAULT NULL, - `zip_postal_code` VARCHAR(15) NULL DEFAULT NULL, - `country_region` VARCHAR(50) NULL DEFAULT NULL, - `web_page` LONGTEXT NULL DEFAULT NULL, - `notes` LONGTEXT NULL DEFAULT NULL, - `attachments` LONGBLOB NULL DEFAULT NULL, - PRIMARY KEY (`id`), - INDEX `city` (`city` ASC), - INDEX `company` (`company` ASC), - INDEX `first_name` (`first_name` ASC), - INDEX `last_name` (`last_name` ASC), - INDEX `zip_postal_code` (`zip_postal_code` ASC), - INDEX `state_province` (`state_province` ASC)) -ENGINE = InnoDB -DEFAULT CHARACTER SET = utf8; - - --- ----------------------------------------------------- --- Table `northwind`.`privileges` --- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `northwind`.`privileges` ( - `id` INT(11) NOT NULL AUTO_INCREMENT, - `privilege_name` VARCHAR(50) NULL DEFAULT NULL, - PRIMARY KEY (`id`)) -ENGINE = InnoDB -DEFAULT CHARACTER SET = utf8; - - --- ----------------------------------------------------- --- Table `northwind`.`employee_privileges` --- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `northwind`.`employee_privileges` ( - `employee_id` INT(11) NOT NULL, - `privilege_id` INT(11) NOT NULL, - PRIMARY KEY (`employee_id`, `privilege_id`), - INDEX `employee_id` (`employee_id` ASC), - INDEX `privilege_id` (`privilege_id` ASC), - INDEX `privilege_id_2` (`privilege_id` ASC), - CONSTRAINT `fk_employee_privileges_employees1` - FOREIGN KEY (`employee_id`) - REFERENCES `northwind`.`employees` (`id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION, - CONSTRAINT `fk_employee_privileges_privileges1` - FOREIGN KEY (`privilege_id`) - REFERENCES `northwind`.`privileges` (`id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION) -ENGINE = InnoDB -DEFAULT CHARACTER SET = utf8; - - --- ----------------------------------------------------- --- Table `northwind`.`inventory_transaction_types` --- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `northwind`.`inventory_transaction_types` ( - `id` TINYINT(4) NOT NULL, - `type_name` VARCHAR(50) NOT NULL, - PRIMARY KEY (`id`)) -ENGINE = InnoDB -DEFAULT CHARACTER SET = utf8; - - --- ----------------------------------------------------- --- Table `northwind`.`shippers` --- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `northwind`.`shippers` ( - `id` INT(11) NOT NULL AUTO_INCREMENT, - `company` VARCHAR(50) NULL DEFAULT NULL, - `last_name` VARCHAR(50) NULL DEFAULT NULL, - `first_name` VARCHAR(50) NULL DEFAULT NULL, - `email_address` VARCHAR(50) NULL DEFAULT NULL, - `job_title` VARCHAR(50) NULL DEFAULT NULL, - `business_phone` VARCHAR(25) NULL DEFAULT NULL, - `home_phone` VARCHAR(25) NULL DEFAULT NULL, - `mobile_phone` VARCHAR(25) NULL DEFAULT NULL, - `fax_number` VARCHAR(25) NULL DEFAULT NULL, - `address` LONGTEXT NULL DEFAULT NULL, - `city` VARCHAR(50) NULL DEFAULT NULL, - `state_province` VARCHAR(50) NULL DEFAULT NULL, - `zip_postal_code` VARCHAR(15) NULL DEFAULT NULL, - `country_region` VARCHAR(50) NULL DEFAULT NULL, - `web_page` LONGTEXT NULL DEFAULT NULL, - `notes` LONGTEXT NULL DEFAULT NULL, - `attachments` LONGBLOB NULL DEFAULT NULL, - PRIMARY KEY (`id`), - INDEX `city` (`city` ASC), - INDEX `company` (`company` ASC), - INDEX `first_name` (`first_name` ASC), - INDEX `last_name` (`last_name` ASC), - INDEX `zip_postal_code` (`zip_postal_code` ASC), - INDEX `state_province` (`state_province` ASC)) -ENGINE = InnoDB -DEFAULT CHARACTER SET = utf8; - - --- ----------------------------------------------------- --- Table `northwind`.`orders_tax_status` --- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `northwind`.`orders_tax_status` ( - `id` TINYINT(4) NOT NULL, - `tax_status_name` VARCHAR(50) NOT NULL, - PRIMARY KEY (`id`)) -ENGINE = InnoDB -DEFAULT CHARACTER SET = utf8; - - --- ----------------------------------------------------- --- Table `northwind`.`orders_status` --- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `northwind`.`orders_status` ( - `id` TINYINT(4) NOT NULL, - `status_name` VARCHAR(50) NOT NULL, - PRIMARY KEY (`id`)) -ENGINE = InnoDB -DEFAULT CHARACTER SET = utf8; - - --- ----------------------------------------------------- --- Table `northwind`.`orders` --- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `northwind`.`orders` ( - `id` INT(11) NOT NULL AUTO_INCREMENT, - `employee_id` INT(11) NULL DEFAULT NULL, - `customer_id` INT(11) NULL DEFAULT NULL, - `order_date` DATETIME NULL DEFAULT NULL, - `shipped_date` DATETIME NULL DEFAULT NULL, - `shipper_id` INT(11) NULL DEFAULT NULL, - `ship_name` VARCHAR(50) NULL DEFAULT NULL, - `ship_address` LONGTEXT NULL DEFAULT NULL, - `ship_city` VARCHAR(50) NULL DEFAULT NULL, - `ship_state_province` VARCHAR(50) NULL DEFAULT NULL, - `ship_zip_postal_code` VARCHAR(50) NULL DEFAULT NULL, - `ship_country_region` VARCHAR(50) NULL DEFAULT NULL, - `shipping_fee` DECIMAL(19,4) NULL DEFAULT '0.0000', - `taxes` DECIMAL(19,4) NULL DEFAULT '0.0000', - `payment_type` VARCHAR(50) NULL DEFAULT NULL, - `paid_date` DATETIME NULL DEFAULT NULL, - `notes` LONGTEXT NULL DEFAULT NULL, - `tax_rate` DOUBLE NULL DEFAULT '0', - `tax_status_id` TINYINT(4) NULL DEFAULT NULL, - `status_id` TINYINT(4) NULL DEFAULT '0', - PRIMARY KEY (`id`), - INDEX `customer_id` (`customer_id` ASC), - INDEX `customer_id_2` (`customer_id` ASC), - INDEX `employee_id` (`employee_id` ASC), - INDEX `employee_id_2` (`employee_id` ASC), - INDEX `id` (`id` ASC), - INDEX `id_2` (`id` ASC), - INDEX `shipper_id` (`shipper_id` ASC), - INDEX `shipper_id_2` (`shipper_id` ASC), - INDEX `id_3` (`id` ASC), - INDEX `tax_status` (`tax_status_id` ASC), - INDEX `ship_zip_postal_code` (`ship_zip_postal_code` ASC), - CONSTRAINT `fk_orders_customers` - FOREIGN KEY (`customer_id`) - REFERENCES `northwind`.`customers` (`id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION, - CONSTRAINT `fk_orders_employees1` - FOREIGN KEY (`employee_id`) - REFERENCES `northwind`.`employees` (`id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION, - CONSTRAINT `fk_orders_shippers1` - FOREIGN KEY (`shipper_id`) - REFERENCES `northwind`.`shippers` (`id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION, - CONSTRAINT `fk_orders_orders_tax_status1` - FOREIGN KEY (`tax_status_id`) - REFERENCES `northwind`.`orders_tax_status` (`id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION, - CONSTRAINT `fk_orders_orders_status1` - FOREIGN KEY (`status_id`) - REFERENCES `northwind`.`orders_status` (`id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION) -ENGINE = InnoDB -DEFAULT CHARACTER SET = utf8; - - --- ----------------------------------------------------- --- Table `northwind`.`products` --- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `northwind`.`products` ( - `supplier_ids` LONGTEXT NULL DEFAULT NULL, - `id` INT(11) NOT NULL AUTO_INCREMENT, - `product_code` VARCHAR(25) NULL DEFAULT NULL, - `product_name` VARCHAR(50) NULL DEFAULT NULL, - `description` LONGTEXT NULL DEFAULT NULL, - `standard_cost` DECIMAL(19,4) NULL DEFAULT '0.0000', - `list_price` DECIMAL(19,4) NOT NULL DEFAULT '0.0000', - `reorder_level` INT(11) NULL DEFAULT NULL, - `target_level` INT(11) NULL DEFAULT NULL, - `quantity_per_unit` VARCHAR(50) NULL DEFAULT NULL, - `discontinued` TINYINT(1) NOT NULL DEFAULT '0', - `minimum_reorder_quantity` INT(11) NULL DEFAULT NULL, - `category` VARCHAR(50) NULL DEFAULT NULL, - `attachments` LONGBLOB NULL DEFAULT NULL, - PRIMARY KEY (`id`), - INDEX `product_code` (`product_code` ASC)) -ENGINE = InnoDB -DEFAULT CHARACTER SET = utf8; - - --- ----------------------------------------------------- --- Table `northwind`.`purchase_order_status` --- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `northwind`.`purchase_order_status` ( - `id` INT(11) NOT NULL, - `status` VARCHAR(50) NULL DEFAULT NULL, - PRIMARY KEY (`id`)) -ENGINE = InnoDB -DEFAULT CHARACTER SET = utf8; - - --- ----------------------------------------------------- --- Table `northwind`.`suppliers` --- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `northwind`.`suppliers` ( - `id` INT(11) NOT NULL AUTO_INCREMENT, - `company` VARCHAR(50) NULL DEFAULT NULL, - `last_name` VARCHAR(50) NULL DEFAULT NULL, - `first_name` VARCHAR(50) NULL DEFAULT NULL, - `email_address` VARCHAR(50) NULL DEFAULT NULL, - `job_title` VARCHAR(50) NULL DEFAULT NULL, - `business_phone` VARCHAR(25) NULL DEFAULT NULL, - `home_phone` VARCHAR(25) NULL DEFAULT NULL, - `mobile_phone` VARCHAR(25) NULL DEFAULT NULL, - `fax_number` VARCHAR(25) NULL DEFAULT NULL, - `address` LONGTEXT NULL DEFAULT NULL, - `city` VARCHAR(50) NULL DEFAULT NULL, - `state_province` VARCHAR(50) NULL DEFAULT NULL, - `zip_postal_code` VARCHAR(15) NULL DEFAULT NULL, - `country_region` VARCHAR(50) NULL DEFAULT NULL, - `web_page` LONGTEXT NULL DEFAULT NULL, - `notes` LONGTEXT NULL DEFAULT NULL, - `attachments` LONGBLOB NULL DEFAULT NULL, - PRIMARY KEY (`id`), - INDEX `city` (`city` ASC), - INDEX `company` (`company` ASC), - INDEX `first_name` (`first_name` ASC), - INDEX `last_name` (`last_name` ASC), - INDEX `zip_postal_code` (`zip_postal_code` ASC), - INDEX `state_province` (`state_province` ASC)) -ENGINE = InnoDB -DEFAULT CHARACTER SET = utf8; - - --- ----------------------------------------------------- --- Table `northwind`.`purchase_orders` --- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `northwind`.`purchase_orders` ( - `id` INT(11) NOT NULL AUTO_INCREMENT, - `supplier_id` INT(11) NULL DEFAULT NULL, - `created_by` INT(11) NULL DEFAULT NULL, - `submitted_date` DATETIME NULL DEFAULT NULL, - `creation_date` DATETIME NULL DEFAULT NULL, - `status_id` INT(11) NULL DEFAULT '0', - `expected_date` DATETIME NULL DEFAULT NULL, - `shipping_fee` DECIMAL(19,4) NOT NULL DEFAULT '0.0000', - `taxes` DECIMAL(19,4) NOT NULL DEFAULT '0.0000', - `payment_date` DATETIME NULL DEFAULT NULL, - `payment_amount` DECIMAL(19,4) NULL DEFAULT '0.0000', - `payment_method` VARCHAR(50) NULL DEFAULT NULL, - `notes` LONGTEXT NULL DEFAULT NULL, - `approved_by` INT(11) NULL DEFAULT NULL, - `approved_date` DATETIME NULL DEFAULT NULL, - `submitted_by` INT(11) NULL DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE INDEX `id` (`id` ASC), - INDEX `created_by` (`created_by` ASC), - INDEX `status_id` (`status_id` ASC), - INDEX `id_2` (`id` ASC), - INDEX `supplier_id` (`supplier_id` ASC), - INDEX `supplier_id_2` (`supplier_id` ASC), - CONSTRAINT `fk_purchase_orders_employees1` - FOREIGN KEY (`created_by`) - REFERENCES `northwind`.`employees` (`id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION, - CONSTRAINT `fk_purchase_orders_purchase_order_status1` - FOREIGN KEY (`status_id`) - REFERENCES `northwind`.`purchase_order_status` (`id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION, - CONSTRAINT `fk_purchase_orders_suppliers1` - FOREIGN KEY (`supplier_id`) - REFERENCES `northwind`.`suppliers` (`id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION) -ENGINE = InnoDB -DEFAULT CHARACTER SET = utf8; - - --- ----------------------------------------------------- --- Table `northwind`.`inventory_transactions` --- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `northwind`.`inventory_transactions` ( - `id` INT(11) NOT NULL AUTO_INCREMENT, - `transaction_type` TINYINT(4) NOT NULL, - `transaction_created_date` DATETIME NULL DEFAULT NULL, - `transaction_modified_date` DATETIME NULL DEFAULT NULL, - `product_id` INT(11) NOT NULL, - `quantity` INT(11) NOT NULL, - `purchase_order_id` INT(11) NULL DEFAULT NULL, - `customer_order_id` INT(11) NULL DEFAULT NULL, - `comments` VARCHAR(255) NULL DEFAULT NULL, - PRIMARY KEY (`id`), - INDEX `customer_order_id` (`customer_order_id` ASC), - INDEX `customer_order_id_2` (`customer_order_id` ASC), - INDEX `product_id` (`product_id` ASC), - INDEX `product_id_2` (`product_id` ASC), - INDEX `purchase_order_id` (`purchase_order_id` ASC), - INDEX `purchase_order_id_2` (`purchase_order_id` ASC), - INDEX `transaction_type` (`transaction_type` ASC), - CONSTRAINT `fk_inventory_transactions_orders1` - FOREIGN KEY (`customer_order_id`) - REFERENCES `northwind`.`orders` (`id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION, - CONSTRAINT `fk_inventory_transactions_products1` - FOREIGN KEY (`product_id`) - REFERENCES `northwind`.`products` (`id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION, - CONSTRAINT `fk_inventory_transactions_purchase_orders1` - FOREIGN KEY (`purchase_order_id`) - REFERENCES `northwind`.`purchase_orders` (`id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION, - CONSTRAINT `fk_inventory_transactions_inventory_transaction_types1` - FOREIGN KEY (`transaction_type`) - REFERENCES `northwind`.`inventory_transaction_types` (`id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION) -ENGINE = InnoDB -DEFAULT CHARACTER SET = utf8; - - --- ----------------------------------------------------- --- Table `northwind`.`invoices` --- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `northwind`.`invoices` ( - `id` INT(11) NOT NULL AUTO_INCREMENT, - `order_id` INT(11) NULL DEFAULT NULL, - `invoice_date` DATETIME NULL DEFAULT NULL, - `due_date` DATETIME NULL DEFAULT NULL, - `tax` DECIMAL(19,4) NULL DEFAULT '0.0000', - `shipping` DECIMAL(19,4) NULL DEFAULT '0.0000', - `amount_due` DECIMAL(19,4) NULL DEFAULT '0.0000', - PRIMARY KEY (`id`), - INDEX `id` (`id` ASC), - INDEX `id_2` (`id` ASC), - INDEX `fk_invoices_orders1_idx` (`order_id` ASC), - CONSTRAINT `fk_invoices_orders1` - FOREIGN KEY (`order_id`) - REFERENCES `northwind`.`orders` (`id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION) -ENGINE = InnoDB -DEFAULT CHARACTER SET = utf8; - - --- ----------------------------------------------------- --- Table `northwind`.`order_details_status` --- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `northwind`.`order_details_status` ( - `id` INT(11) NOT NULL, - `status_name` VARCHAR(50) NOT NULL, - PRIMARY KEY (`id`)) -ENGINE = InnoDB -DEFAULT CHARACTER SET = utf8; - - --- ----------------------------------------------------- --- Table `northwind`.`order_details` --- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `northwind`.`order_details` ( - `id` INT(11) NOT NULL AUTO_INCREMENT, - `order_id` INT(11) NOT NULL, - `product_id` INT(11) NULL DEFAULT NULL, - `quantity` DECIMAL(18,4) NOT NULL DEFAULT '0.0000', - `unit_price` DECIMAL(19,4) NULL DEFAULT '0.0000', - `discount` DOUBLE NOT NULL DEFAULT '0', - `status_id` INT(11) NULL DEFAULT NULL, - `date_allocated` DATETIME NULL DEFAULT NULL, - `purchase_order_id` INT(11) NULL DEFAULT NULL, - `inventory_id` INT(11) NULL DEFAULT NULL, - PRIMARY KEY (`id`), - INDEX `id` (`id` ASC), - INDEX `inventory_id` (`inventory_id` ASC), - INDEX `id_2` (`id` ASC), - INDEX `id_3` (`id` ASC), - INDEX `id_4` (`id` ASC), - INDEX `product_id` (`product_id` ASC), - INDEX `product_id_2` (`product_id` ASC), - INDEX `purchase_order_id` (`purchase_order_id` ASC), - INDEX `id_5` (`id` ASC), - INDEX `fk_order_details_orders1_idx` (`order_id` ASC), - INDEX `fk_order_details_order_details_status1_idx` (`status_id` ASC), - CONSTRAINT `fk_order_details_orders1` - FOREIGN KEY (`order_id`) - REFERENCES `northwind`.`orders` (`id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION, - CONSTRAINT `fk_order_details_products1` - FOREIGN KEY (`product_id`) - REFERENCES `northwind`.`products` (`id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION, - CONSTRAINT `fk_order_details_order_details_status1` - FOREIGN KEY (`status_id`) - REFERENCES `northwind`.`order_details_status` (`id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION) -ENGINE = InnoDB -DEFAULT CHARACTER SET = utf8; - - --- ----------------------------------------------------- --- Table `northwind`.`purchase_order_details` --- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `northwind`.`purchase_order_details` ( - `id` INT(11) NOT NULL AUTO_INCREMENT, - `purchase_order_id` INT(11) NOT NULL, - `product_id` INT(11) NULL DEFAULT NULL, - `quantity` DECIMAL(18,4) NOT NULL, - `unit_cost` DECIMAL(19,4) NOT NULL, - `date_received` DATETIME NULL DEFAULT NULL, - `posted_to_inventory` TINYINT(1) NOT NULL DEFAULT '0', - `inventory_id` INT(11) NULL DEFAULT NULL, - PRIMARY KEY (`id`), - INDEX `id` (`id` ASC), - INDEX `inventory_id` (`inventory_id` ASC), - INDEX `inventory_id_2` (`inventory_id` ASC), - INDEX `purchase_order_id` (`purchase_order_id` ASC), - INDEX `product_id` (`product_id` ASC), - INDEX `product_id_2` (`product_id` ASC), - INDEX `purchase_order_id_2` (`purchase_order_id` ASC), - CONSTRAINT `fk_purchase_order_details_inventory_transactions1` - FOREIGN KEY (`inventory_id`) - REFERENCES `northwind`.`inventory_transactions` (`id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION, - CONSTRAINT `fk_purchase_order_details_products1` - FOREIGN KEY (`product_id`) - REFERENCES `northwind`.`products` (`id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION, - CONSTRAINT `fk_purchase_order_details_purchase_orders1` - FOREIGN KEY (`purchase_order_id`) - REFERENCES `northwind`.`purchase_orders` (`id`) - ON DELETE NO ACTION - ON UPDATE NO ACTION) -ENGINE = InnoDB -DEFAULT CHARACTER SET = utf8; - - --- ----------------------------------------------------- --- Table `northwind`.`sales_reports` --- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `northwind`.`sales_reports` ( - `group_by` VARCHAR(50) NOT NULL, - `display` VARCHAR(50) NULL DEFAULT NULL, - `title` VARCHAR(50) NULL DEFAULT NULL, - `filter_row_source` LONGTEXT NULL DEFAULT NULL, - `default` TINYINT(1) NOT NULL DEFAULT '0', - PRIMARY KEY (`group_by`)) -ENGINE = InnoDB -DEFAULT CHARACTER SET = utf8; - - --- ----------------------------------------------------- --- Table `northwind`.`strings` --- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `northwind`.`strings` ( - `string_id` INT(11) NOT NULL AUTO_INCREMENT, - `string_data` VARCHAR(255) NULL DEFAULT NULL, - PRIMARY KEY (`string_id`)) -ENGINE = InnoDB -DEFAULT CHARACTER SET = utf8; - - -SET SQL_MODE=@OLD_SQL_MODE; -SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; -SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; diff --git a/db/01_db_bootstrap.sql b/db/01_db_bootstrap.sql new file mode 100644 index 0000000..23f2f01 --- /dev/null +++ b/db/01_db_bootstrap.sql @@ -0,0 +1,284 @@ +-- Create a new database. +create database cancer_patient_platform; + +-- Via the Docker Compose file, a special user called webapp will be created in MySQL. Grant that user all privilages to the new database we just created. +grant all privileges on cancer_patient_platform.* to 'webapp'@'%'; +flush privileges; + +-- Move into the database we just created. +use cancer_patient_platform; + +-- Cancer Type table +insert into cancer_type (cancer_type_id, name, description) values (1, 'Toxic effect of venom of scorpion, accidental, init', 'Insertion of Facet Replacement Spinal Stabilization Device into Occipital-cervical Joint, Percutaneous Approach'); +insert into cancer_type (cancer_type_id, name, description) values (2, 'Open bite of unspecified external genital organs', 'Fragmentation in Uterus, External Approach'); +insert into cancer_type (cancer_type_id, name, description) values (3, 'Capslr glaucoma w/pseudxf lens, unsp eye, indeterminate stg', 'Dressing of Face using Bandage'); +insert into cancer_type (cancer_type_id, name, description) values (4, 'Oth incomplete lesion at C4, sequela', 'Tomographic (Tomo) Nuclear Medicine Imaging of Pelvic Region using Fluorine 18 (F-18)'); +insert into cancer_type (cancer_type_id, name, description) values (5, 'Burn of third degree of right toe(s) (nail)', 'Reattachment of Left Foot Tendon, Open Approach'); +insert into cancer_type (cancer_type_id, name, description) values (6, 'Nondisp Maisonneuve''s fx l leg, 7thQ', 'Revision of Internal Fixation Device in Right Sacroiliac Joint, Open Approach'); +insert into cancer_type (cancer_type_id, name, description) values (7, 'Occ of anml-drn vehicle injured in clsn w ped/anml, init', 'Insertion of Intraluminal Device into Large Intestine, Percutaneous Approach'); +insert into cancer_type (cancer_type_id, name, description) values (8, 'Assault by drowning and submersion while in bathtub, init', 'Magnetic Resonance Imaging (MRI) of Bilateral Kidneys using Other Contrast'); +insert into cancer_type (cancer_type_id, name, description) values (9, 'Stable burst fracture of fourth thoracic vertebra, sequela', 'High Dose Rate (HDR) Brachytherapy of Duodenum using Californium 252 (Cf-252)'); +insert into cancer_type (cancer_type_id, name, description) values (10, 'Injury of median nerve at forearm level, left arm, init', 'Restriction of Cervix, Percutaneous Endoscopic Approach'); +insert into cancer_type (cancer_type_id, name, description) values (11, 'Injury of vertebral artery', 'Bypass Ileum to Descending Colon, Via Natural or Artificial Opening Endoscopic'); +insert into cancer_type (cancer_type_id, name, description) values (12, 'Partial traumatic MCP amputation of left thumb, sequela', 'Supplement Right Axillary Vein with Autologous Tissue Substitute, Open Approach'); +insert into cancer_type (cancer_type_id, name, description) values (13, 'Pain in right foot', 'Dilation of Left Ulnar Artery with Four or More Intraluminal Devices, Open Approach'); +insert into cancer_type (cancer_type_id, name, description) values (14, 'Unsp fx shaft of unsp tibia, subs for clos fx w routn heal', 'Supplement Scrotum with Nonautologous Tissue Substitute, Percutaneous Endoscopic Approach'); +insert into cancer_type (cancer_type_id, name, description) values (15, 'Contact with workbench tool, subsequent encounter', 'Revision of Nonautologous Tissue Substitute in Tracheobronchial Tree, Open Approach'); + +-- Users table +insert into user (user_id, first_name, last_name, occupation, birth_date, gender, city, state, cancer_type_id, email_1, email_2, phone_1, phone_2) values (1, 'Babbie', 'Bettles', 'Administrative Assistant III', '10/07/1975', 'Non-binary', 'Bloomington', 'Illinois', '12', 'bbettles0@t.co', 'bbettles0@techcrunch.com', '309-203-5885', '785-967-9662'); +insert into user (user_id, first_name, last_name, occupation, birth_date, gender, city, state, cancer_type_id, email_1, email_2, phone_1, phone_2) values (2, 'Daryl', 'Conen', 'Statistician I', '01/03/2007', 'Female', 'Young America', 'Minnesota', '1', 'dconen1@huffingtonpost.com', 'dconen1@yellowpages.com', '952-697-7775', '312-665-0800'); +insert into user (user_id, first_name, last_name, occupation, birth_date, gender, city, state, cancer_type_id, email_1, email_2, phone_1, phone_2) values (3, 'Iolanthe', 'Kull', 'Developer II', '08/18/2022', 'Female', 'Naples', 'Florida', '2', 'ikull2@merriam-webster.com', 'ikull2@soundcloud.com', '305-233-2032', '503-505-3712'); +insert into user (user_id, first_name, last_name, occupation, birth_date, gender, city, state, cancer_type_id, email_1, email_2, phone_1, phone_2) values (4, 'Bentlee', 'Pyecroft', 'Developer III', '08/19/2021', 'Bigender', 'Memphis', 'Tennessee', '6', 'bpyecroft3@mashable.com', 'bpyecroft3@instagram.com', '615-771-9855', '585-920-1622'); +insert into user (user_id, first_name, last_name, occupation, birth_date, gender, city, state, cancer_type_id, email_1, email_2, phone_1, phone_2) values (5, 'Gaspar', 'Bowmer', 'Tax Accountant', '03/05/1997', 'Genderqueer', 'Spokane', 'Washington', '5', 'gbowmer4@umich.edu', 'gbowmer4@reddit.com', '509-685-1319', '816-418-6791'); +insert into user (user_id, first_name, last_name, occupation, birth_date, gender, city, state, cancer_type_id, email_1, email_2, phone_1, phone_2) values (6, 'Gideon', 'Duplain', 'Staff Accountant IV', '09/08/1954', 'Male', 'Grand Forks', 'North Dakota', '10', 'gduplain5@amazon.de', 'gduplain5@tumblr.com', '701-921-0359', '915-933-7533'); +insert into user (user_id, first_name, last_name, occupation, birth_date, gender, city, state, cancer_type_id, email_1, email_2, phone_1, phone_2) values (7, 'Ezekiel', 'McPhilip', 'Assistant Manager', '08/09/1975', 'Male', 'Raleigh', 'North Carolina', '14', 'emcphilip6@nasa.gov', 'emcphilip6@aol.com', '919-545-4875', '801-436-2614'); +insert into user (user_id, first_name, last_name, occupation, birth_date, gender, city, state, cancer_type_id, email_1, email_2, phone_1, phone_2) values (8, 'Ingmar', 'Charer', 'Assistant Media Planner', '09/21/1990', 'Male', 'Flint', 'Michigan', '3', 'icharer7@cpanel.net', 'icharer7@hhs.gov', '810-361-7231', '956-763-3371'); +insert into user (user_id, first_name, last_name, occupation, birth_date, gender, city, state, cancer_type_id, email_1, email_2, phone_1, phone_2) values (9, 'Kalina', 'Byer', 'Professor', '05/30/1959', 'Female', 'Fresno', 'California', '8', 'kbyer8@vinaora.com', 'kbyer8@addthis.com', '559-610-2434', '510-234-6064'); +insert into user (user_id, first_name, last_name, occupation, birth_date, gender, city, state, cancer_type_id, email_1, email_2, phone_1, phone_2) values (10, 'Lowell', 'Golby', 'Senior Sales Associate', '07/11/1987', 'Male', 'Alexandria', 'Virginia', '15', 'lgolby9@narod.ru', 'lgolby9@mashable.com', '571-560-1589', '408-119-1435'); +insert into user (user_id, first_name, last_name, occupation, birth_date, gender, city, state, cancer_type_id, email_1, email_2, phone_1, phone_2) values (11, 'Graeme', 'Whiting', 'Quality Control Specialist', '04/18/1985', 'Male', 'Charlotte', 'North Carolina', '13', 'gwhitinga@mysql.com', 'gwhitinga@nifty.com', '704-894-4482', '808-312-8488'); +insert into user (user_id, first_name, last_name, occupation, birth_date, gender, city, state, cancer_type_id, email_1, email_2, phone_1, phone_2) values (12, 'Loree', 'Barttrum', 'Director of Sales', '03/26/1975', 'Female', 'Conroe', 'Texas', '11', 'lbarttrumb@craigslist.org', 'lbarttrumb@gov.uk', '936-482-6124', '803-320-1701'); +insert into user (user_id, first_name, last_name, occupation, birth_date, gender, city, state, cancer_type_id, email_1, email_2, phone_1, phone_2) values (13, 'Elissa', 'Habishaw', 'Dental Hygienist', '09/01/2001', 'Genderqueer', 'Phoenix', 'Arizona', '9', 'ehabishawc@jiathis.com', 'ehabishawc@unicef.org', '480-779-4777', '915-788-2628'); +insert into user (user_id, first_name, last_name, occupation, birth_date, gender, city, state, cancer_type_id, email_1, email_2, phone_1, phone_2) values (14, 'Kliment', 'Garrattley', 'Staff Accountant II', '07/17/1979', 'Male', 'Jacksonville', 'Florida', '7', 'kgarrattleyd@quantcast.com', 'kgarrattleyd@cornell.edu', '904-927-9779', '702-716-5101'); +insert into user (user_id, first_name, last_name, occupation, birth_date, gender, city, state, cancer_type_id, email_1, email_2, phone_1, phone_2) values (15, 'Mei', 'Shakesby', 'Graphic Designer', '01/19/1989', 'Female', 'New York City', 'New York', '4', 'mshakesbye@netlog.com', 'mshakesbye@nydailynews.com', '917-620-8264', '202-283-8104'); +insert into user (user_id, first_name, last_name, occupation, birth_date, gender, city, state, cancer_type_id, email_1, email_2, phone_1, phone_2) values (16, 'Suzy', 'Gamlen', 'Legal Assistant', '05/21/2014', 'Female', 'Dallas', 'Texas', '2', 'sgamlenf@opensource.org', 'sgamlenf@sourceforge.net', '972-340-8641', '202-260-8751'); +insert into user (user_id, first_name, last_name, occupation, birth_date, gender, city, state, cancer_type_id, email_1, email_2, phone_1, phone_2) values (17, 'Anabella', 'Loughnan', 'Clinical Specialist', '03/18/1988', 'Female', 'New York City', 'New York', '3', 'aloughnang@comcast.net', 'aloughnang@home.pl', '212-982-0719', '912-941-6675'); +insert into user (user_id, first_name, last_name, occupation, birth_date, gender, city, state, cancer_type_id, email_1, email_2, phone_1, phone_2) values (18, 'Cristal', 'Van Merwe', 'Research Assistant IV', '08/09/1968', 'Female', 'Indianapolis', 'Indiana', '7', 'cvanmerweh@arstechnica.com', 'cvanmerweh@vk.com', '317-932-8130', '360-773-9130'); +insert into user (user_id, first_name, last_name, occupation, birth_date, gender, city, state, cancer_type_id, email_1, email_2, phone_1, phone_2) values (19, 'Agace', 'Pinckard', 'Internal Auditor', '07/10/1971', 'Female', 'Boston', 'Massachusetts', '14', 'apinckardi@dagondesign.com', 'apinckardi@imageshack.us', '508-182-0182', '716-816-5817'); +insert into user (user_id, first_name, last_name, occupation, birth_date, gender, city, state, cancer_type_id, email_1, email_2, phone_1, phone_2) values (20, 'Louisette', 'Longley', 'Engineer I', '08/14/1993', 'Female', 'Birmingham', 'Alabama', '9', 'llongleyj@360.cn', 'llongleyj@guardian.co.uk', '205-994-8093', '615-404-4179'); + +-- Treatment table +insert into treatment (treatment_id, name, description) values (1, 'Tinidazole', 'Microscopic examination of specimen from bladder, urethra, prostate, seminal vesicle, perivesical tissue, and of urine and semen, cell block and Papanicolaou smear'); +insert into treatment (treatment_id, name, description) values (2, 'Octinoxate and Titanium dioxide', 'Microscopic examination of specimen from lymph node and of lymph, bacterial smear'); +insert into treatment (treatment_id, name, description) values (3, 'NITROGEN', 'Open reduction of fracture without internal fixation, unspecified site'); +insert into treatment (treatment_id, name, description) values (4, 'Promethazine Hydrochloride', 'Transapical replacement of aortic valve'); +insert into treatment (treatment_id, name, description) values (5, 'meloxicam', 'Percutaneous ablation of renal lesion or tissue'); +insert into treatment (treatment_id, name, description) values (6, 'PREGABALIN', 'Exploration of thymus field'); +insert into treatment (treatment_id, name, description) values (7, 'Alcohol', 'Microscopic examination of blood, toxicology'); +insert into treatment (treatment_id, name, description) values (8, 'Pyrrole,', 'Laparoscopic salpingo-oophoroplasty'); +insert into treatment (treatment_id, name, description) values (9, 'bimatoprost', 'Open biopsy of tongue'); +insert into treatment (treatment_id, name, description) values (10, 'METFORMIN HYDROCHLORIDE', 'Other diagnostic procedures on spinal cord and spinal canal structures'); +insert into treatment (treatment_id, name, description) values (11, 'Lidocaine', 'Autologous hematopoietic stem cell transplant without purging'); +insert into treatment (treatment_id, name, description) values (12, 'Avobenzone, Homosalate, Octisalate, and Octocrylene', 'Administration of other antitoxins'); +insert into treatment (treatment_id, name, description) values (13, 'Black Locust', 'Insertion of spinal disc prosthesis, thoracic'); +insert into treatment (treatment_id, name, description) values (14, 'Dicloxacillin Sodium', 'Insertion or replacement of skull tongs or halo traction device'); +insert into treatment (treatment_id, name, description) values (15, 'Quinapril', 'Arterial catheterization'); +insert into treatment (treatment_id, name, description) values (16, 'Avobenzone,Homosalate,Octisalate,Oxybenzone', 'Closed reduction of separated epiphysis, humerus'); +insert into treatment (treatment_id, name, description) values (17, 'TRAMADOL HYDROCHLORIDE', 'Cystoscopy through artificial stoma'); +insert into treatment (treatment_id, name, description) values (18, 'amiodarone hydrochloride', 'Other operations on lacrimal gland'); +insert into treatment (treatment_id, name, description) values (19, 'Cetirizine HCl', 'Closure of esophagostomy'); +insert into treatment (treatment_id, name, description) values (20, 'MEPROBAMATE', 'Division of joint capsule, ligament, or cartilage, elbow'); + +#Support group table +insert into support_group (support_group_id, group_leader_id, name, location, capacity) values (1, '3', 'Justino Thwaite', null, 16); +insert into support_group (support_group_id, group_leader_id, name, location, capacity) values (2, '4', 'Gaston Grimsell', 'Coimbra', 12); +insert into support_group (support_group_id, group_leader_id, name, location, capacity) values (3, '5', 'Noland Dundredge', null, 35); +insert into support_group (support_group_id, group_leader_id, name, location, capacity) values (4, '1', 'Ronalda Cordero', null, 38); +insert into support_group (support_group_id, group_leader_id, name, location, capacity) values (5, '2', 'Halette Dennert', 'Braga', 38); +insert into support_group (support_group_id, group_leader_id, name, location, capacity) values (6, '2', 'Alard Braisted', 'Illinois', 40); +insert into support_group (support_group_id, group_leader_id, name, location, capacity) values (7, '1', 'Faustina Vynarde', null, 34); + +#Symptom table +insert into symptom (symptom_id, name, description) values (1, 'Embryonic cyst of cervix', 'Embryonic cyst of cervix'); +insert into symptom (symptom_id, name, description) values (2, 'Oth foreign object in trachea causing oth injury, subs', 'Other foreign object in trachea causing other injury, subsequent encounter'); +insert into symptom (symptom_id, name, description) values (3, 'Other superficial bite of left elbow, subsequent encounter', 'Other superficial bite of left elbow, subsequent encounter'); +insert into symptom (symptom_id, name, description) values (4, 'Other hookworm diseases', 'Other hookworm diseases'); +insert into symptom (symptom_id, name, description) values (5, 'Oth disrd of synovium and tendon, unspecified elbow', 'Other specified disorders of synovium and tendon, unspecified elbow'); +insert into symptom (symptom_id, name, description) values (6, 'Type I occipital condyle fracture, left side, 7thG', 'Type I occipital condyle fracture, left side, subsequent encounter for fracture with delayed healing'); +insert into symptom (symptom_id, name, description) values (7, 'Stress fracture, pelvis, initial encounter for fracture', 'Stress fracture, pelvis, initial encounter for fracture'); +insert into symptom (symptom_id, name, description) values (8, 'Displ commnt fx shaft of unsp fibula, 7thP', 'Displaced comminuted fracture of shaft of unspecified fibula, subsequent encounter for closed fracture with malunion'); +insert into symptom (symptom_id, name, description) values (9, 'Unsp fx upr end unsp rad, 7thE', 'Unspecified fracture of upper end of unspecified radius, subsequent encounter for open fracture type I or II with routine healing'); +insert into symptom (symptom_id, name, description) values (10, 'Strain extn/abdr musc/fasc/tend of r thm at forarm lv, init', 'Strain of extensor or abductor muscles, fascia and tendons of right thumb at forearm level, initial encounter'); +insert into symptom (symptom_id, name, description) values (11, 'Newborn affected by abnormality of membranes, unspecified', 'Newborn affected by abnormality of membranes, unspecified'); +insert into symptom (symptom_id, name, description) values (12, 'Athscl autol vein bypass of the left leg w ulcer of calf', 'Atherosclerosis of autologous vein bypass graft(s) of the left leg with ulceration of calf'); +insert into symptom (symptom_id, name, description) values (13, 'Explosion on board unspecified watercraft', 'Explosion on board unspecified watercraft'); +insert into symptom (symptom_id, name, description) values (14, 'Crushing injury of right wrist, initial encounter', 'Crushing injury of right wrist, initial encounter'); +insert into symptom (symptom_id, name, description) values (15, 'Other superficial injuries of shoulder', 'Other superficial injuries of shoulder'); +insert into symptom (symptom_id, name, description) values (16, 'Oth ultralt/microlt/pwr-glider acc injuring occupant, subs', 'Other ultralight, microlight or powered-glider accident injuring occupant, subsequent encounter'); +insert into symptom (symptom_id, name, description) values (17, 'Dislocation of proximal interphaln joint of l rng fngr, init', 'Dislocation of proximal interphalangeal joint of left ring finger, initial encounter'); +insert into symptom (symptom_id, name, description) values (18, 'Struck by object due to collapse of building, init encntr', 'Struck by object due to collapse of building, initial encounter'); +insert into symptom (symptom_id, name, description) values (19, 'Disloc of distal interphaln joint of left thumb, sequela', 'Dislocation of distal interphalangeal joint of left thumb, sequela'); +insert into symptom (symptom_id, name, description) values (20, 'Injury of unspecified iliac vein, subsequent encounter', 'Injury of unspecified iliac vein, subsequent encounter'); + +#Exhibits table +insert into exhibits (user_id, symptom_id, start_date, end_date, severity) values ('13', '9', '07/01/2014', '02/14/1982', 'Mal neo paraurethral'); +insert into exhibits (user_id, symptom_id, start_date, end_date, severity) values ('1', '8', '12/25/1952', '06/19/1990', 'Cl skl w oth fx w/o coma'); +insert into exhibits (user_id, symptom_id, start_date, end_date, severity) values ('9', '3', '04/05/1958', '06/11/2011', 'Ac infect polyneuritis'); +insert into exhibits (user_id, symptom_id, start_date, end_date, severity) values ('6', '7', '11/18/1964', '03/20/1974', 'Hered hemolytic anem NEC'); +insert into exhibits (user_id, symptom_id, start_date, end_date, severity) values ('12', '13', '04/30/1963', '03/07/1982', 'Gonococcal peritonitis'); +insert into exhibits (user_id, symptom_id, start_date, end_date, severity) values ('15', '1', '08/04/1949', '02/07/1982', 'Acq deformity NEC'); +insert into exhibits (user_id, symptom_id, start_date, end_date, severity) values ('16', '20', '05/24/1960', '07/11/1965', 'Gastrojejun ulc NOS-obst'); +insert into exhibits (user_id, symptom_id, start_date, end_date, severity) values ('11', '15', '07/09/1986', '01/13/1953', 'Stomach cont asp w resp'); +insert into exhibits (user_id, symptom_id, start_date, end_date, severity) values ('4', '18', '01/04/1994', '05/14/1957', 'War inj:therml radiation'); +insert into exhibits (user_id, symptom_id, start_date, end_date, severity) values ('5', '10', '09/11/1962', '11/20/1962', 'Adv eff anti-common cold'); +insert into exhibits (user_id, symptom_id, start_date, end_date, severity) values ('2', '11', '11/04/1985', '03/30/1980', 'Cl skul fx NEC-deep coma'); +insert into exhibits (user_id, symptom_id, start_date, end_date, severity) values ('14', '17', '02/22/2021', '07/30/1970', 'Obesity-postpartum'); +insert into exhibits (user_id, symptom_id, start_date, end_date, severity) values ('7', '5', '03/20/1994', '02/03/1950', 'Histoplasm caps endocard'); +insert into exhibits (user_id, symptom_id, start_date, end_date, severity) values ('18', '2', '06/08/2022', '09/30/1980', 'Disturbances of vision'); +insert into exhibits (user_id, symptom_id, start_date, end_date, severity) values ('8', '4', '01/03/1975', '03/07/1971', 'Malig neo retromolar'); +insert into exhibits (user_id, symptom_id, start_date, end_date, severity) values ('17', '12', '05/29/1957', '03/13/1977', 'General medical exam NOS'); +insert into exhibits (user_id, symptom_id, start_date, end_date, severity) values ('20', '16', '10/17/2019', '12/29/2019', 'Excitativ type psychosis'); +insert into exhibits (user_id, symptom_id, start_date, end_date, severity) values ('19', '6', '10/24/2005', '03/18/2001', 'History-pre-term labor'); +insert into exhibits (user_id, symptom_id, start_date, end_date, severity) values ('10', '19', '02/28/1987', '11/06/2021', 'Dust pneumonopathy NEC'); +insert into exhibits (user_id, symptom_id, start_date, end_date, severity) values ('3', '14', '11/24/1992', '08/29/1955', 'Ac laryngitis w obstruct'); + +#Typically exhibits table +insert into typically_exhibits (symptom_id, cancer_type_id) values ('19', '1'); +insert into typically_exhibits (symptom_id, cancer_type_id) values ('4', '4'); +insert into typically_exhibits (symptom_id, cancer_type_id) values ('7', '10'); +insert into typically_exhibits (symptom_id, cancer_type_id) values ('8', '3'); +insert into typically_exhibits (symptom_id, cancer_type_id) values ('16', '14'); +insert into typically_exhibits (symptom_id, cancer_type_id) values ('2', '2'); +insert into typically_exhibits (symptom_id, cancer_type_id) values ('6', '7'); + +#Typically treated with table +insert into typically_treated_with (cancer_type_id, treatment_id) values ('8', '8'); +insert into typically_treated_with (cancer_type_id, treatment_id) values ('12', '12'); +insert into typically_treated_with (cancer_type_id, treatment_id) values ('4', '10'); +insert into typically_treated_with (cancer_type_id, treatment_id) values ('15', '13'); +insert into typically_treated_with (cancer_type_id, treatment_id) values ('3', '9'); +insert into typically_treated_with (cancer_type_id, treatment_id) values ('10', '20'); +insert into typically_treated_with (cancer_type_id, treatment_id) values ('1', '6'); +insert into typically_treated_with (cancer_type_id, treatment_id) values ('11', '3'); +insert into typically_treated_with (cancer_type_id, treatment_id) values ('14', '1'); +insert into typically_treated_with (cancer_type_id, treatment_id) values ('9', '7'); +insert into typically_treated_with (cancer_type_id, treatment_id) values ('13', '15'); +insert into typically_treated_with (cancer_type_id, treatment_id) values ('5', '5'); +insert into typically_treated_with (cancer_type_id, treatment_id) values ('6', '2'); +insert into typically_treated_with (cancer_type_id, treatment_id) values ('2', '17'); + +#Makes connection table +insert into makes_connection (user_id_1, user_id_2, relationship) values (8, 2, 'stable'); +insert into makes_connection (user_id_1, user_id_2, relationship) values (20, 18, 'incremental'); +insert into makes_connection (user_id_1, user_id_2, relationship) values (1, 5, 'Adaptive'); +insert into makes_connection (user_id_1, user_id_2, relationship) values (14, 12, 'radical'); +insert into makes_connection (user_id_1, user_id_2, relationship) values (14, 16, 'methodology'); +insert into makes_connection (user_id_1, user_id_2, relationship) values (3, 7, 'Secured'); +insert into makes_connection (user_id_1, user_id_2, relationship) values (5, 19, 'demand-driven'); +insert into makes_connection (user_id_1, user_id_2, relationship) values (16, 9, 'Synergized'); +insert into makes_connection (user_id_1, user_id_2, relationship) values (17, 18, 'frame'); +insert into makes_connection (user_id_1, user_id_2, relationship) values (17, 7, 'tertiary'); +insert into makes_connection (user_id_1, user_id_2, relationship) values (14, 9, 'logistical'); +insert into makes_connection (user_id_1, user_id_2, relationship) values (10, 18, 'moratorium'); +insert into makes_connection (user_id_1, user_id_2, relationship) values (11, 18, 'Implemented'); +insert into makes_connection (user_id_1, user_id_2, relationship) values (6, 13, 'Phased'); +insert into makes_connection (user_id_1, user_id_2, relationship) values (10, 1, 'global'); +insert into makes_connection (user_id_1, user_id_2, relationship) values (14, 15, 'Universal'); +insert into makes_connection (user_id_1, user_id_2, relationship) values (8, 18, 'instruction set'); +insert into makes_connection (user_id_1, user_id_2, relationship) values (4, 7, 'Robust'); +insert into makes_connection (user_id_1, user_id_2, relationship) values (9, 1, 'client-server'); +insert into makes_connection (user_id_1, user_id_2, relationship) values (19, 9, 'methodical'); +insert into makes_connection (user_id_1, user_id_2, relationship) values (14, 19, 'paradigm'); +insert into makes_connection (user_id_1, user_id_2, relationship) values (3, 2, 'attitude'); +insert into makes_connection (user_id_1, user_id_2, relationship) values (17, 13, 'client-server'); +insert into makes_connection (user_id_1, user_id_2, relationship) values (13, 20, 'uniform'); +insert into makes_connection (user_id_1, user_id_2, relationship) values (19, 9, 'directional'); +insert into makes_connection (user_id_1, user_id_2, relationship) values (1, 4, 'heuristic'); +insert into makes_connection (user_id_1, user_id_2, relationship) values (7, 11, 'complexity'); +insert into makes_connection (user_id_1, user_id_2, relationship) values (1, 5, 'Programmable'); +insert into makes_connection (user_id_1, user_id_2, relationship) values (12, 11, 'methodical'); + +#Medical professional table +insert into medical_professional (professional_id, first_name, last_name, specialty, treatment_id) values (1, 'Billy', 'McCuffie', 'Unc beh neo brain/spinal', '17'); +insert into medical_professional (professional_id, first_name, last_name, specialty, treatment_id) values (2, 'Archibald', 'Dermot', 'Open wound auricle-compl', '4'); +insert into medical_professional (professional_id, first_name, last_name, specialty, treatment_id) values (3, 'Doti', 'Pleace', 'Infect nipple preg-unsp', '5'); +insert into medical_professional (professional_id, first_name, last_name, specialty, treatment_id) values (4, 'Kalil', 'Bucknell', 'Delay conjugat jaund NOS', '15'); +insert into medical_professional (professional_id, first_name, last_name, specialty, treatment_id) values (5, 'Herbert', 'Endersby', 'Viral pneumonia NEC', '14'); +insert into medical_professional (professional_id, first_name, last_name, specialty, treatment_id) values (6, 'Georgeanne', 'Rummer', 'Benign neo skin ear', '13'); +insert into medical_professional (professional_id, first_name, last_name, specialty, treatment_id) values (7, 'Bethanne', 'Tomley', 'C1-c4 fx-op/cen cord syn', '3'); +insert into medical_professional (professional_id, first_name, last_name, specialty, treatment_id) values (8, 'Ware', 'Portam', 'Flat anterior chamber', '1'); +insert into medical_professional (professional_id, first_name, last_name, specialty, treatment_id) values (9, 'Nicko', 'Boustred', 'Adv eff mix bact vaccine', '12'); +insert into medical_professional (professional_id, first_name, last_name, specialty, treatment_id) values (10, 'Benyamin', 'Trevor', 'Fx shaft tibia-closed', '8'); +insert into medical_professional (professional_id, first_name, last_name, specialty, treatment_id) values (11, 'Con', 'Knee', 'Mv collis NOS-pers NOS', '20'); +insert into medical_professional (professional_id, first_name, last_name, specialty, treatment_id) values (12, 'Dotty', 'Shitliffe', 'TB fem gen NEC-oth test', '6'); +insert into medical_professional (professional_id, first_name, last_name, specialty, treatment_id) values (13, 'Nigel', 'Emmens', 'Extradural hemor-no coma', '10'); +insert into medical_professional (professional_id, first_name, last_name, specialty, treatment_id) values (14, 'Desiri', 'Paydon', 'Popliteal synovial cyst', '18'); +insert into medical_professional (professional_id, first_name, last_name, specialty, treatment_id) values (15, 'Angelita', 'Ida', 'Late eff motor vehic acc', '16'); + +#Treatment center table +insert into treatment_center (center_id, street_address, state, city, zip_code, professional_id, email_1, email_2, phone_1, phone_2) values (1, '8773 Old Gate Plaza', 'AL', 'Birmingham', '29', '6', 'vbroxholme0@netvibes.com', 'amcgready0@dailymail.co.uk', '205-449-5880', '720-697-6765'); +insert into treatment_center (center_id, street_address, state, city, zip_code, professional_id, email_1, email_2, phone_1, phone_2) values (2, '44 Texas Court', 'MA', 'Newton', '8', '1737', 'ikeynes1@craigslist.org', 'fhaskell1@taobao.com', '508-112-3218', '805-160-9624'); +insert into treatment_center (center_id, street_address, state, city, zip_code, professional_id, email_1, email_2, phone_1, phone_2) values (3, '51 Dovetail Trail', 'KY', 'Louisville', '20043', '03840', 'alancley2@nifty.com', 'mburgan2@livejournal.com', '502-584-5922', '202-164-1134'); +insert into treatment_center (center_id, street_address, state, city, zip_code, professional_id, email_1, email_2, phone_1, phone_2) values (4, '075 Sundown Pass', 'CA', 'San Jose', '7819', '274', 'xhamber3@tiny.cc', 'prougier3@google.ca', '408-143-3468', '804-298-2811'); +insert into treatment_center (center_id, street_address, state, city, zip_code, professional_id, email_1, email_2, phone_1, phone_2) values (5, '08350 Grayhawk Way', 'NY', 'New York City', '4088', '9', 'jhansard4@is.gd', 'cglas4@scientificamerican.com', '212-210-7513', '716-519-2235'); +insert into treatment_center (center_id, street_address, state, city, zip_code, professional_id, email_1, email_2, phone_1, phone_2) values (6, '4425 South Plaza', 'GA', 'Atlanta', '8', '9277', 'rcowle5@goodreads.com', 'ldickenson5@so-net.ne.jp', '404-522-1254', '215-256-6422'); +insert into treatment_center (center_id, street_address, state, city, zip_code, professional_id, email_1, email_2, phone_1, phone_2) values (7, '44 Maple Circle', 'PA', 'Bethlehem', '8901', '65227', 'fhinkens6@theguardian.com', 'gphillipps6@uiuc.edu', '610-397-3972', '206-875-8447'); +insert into treatment_center (center_id, street_address, state, city, zip_code, professional_id, email_1, email_2, phone_1, phone_2) values (8, '1762 Oxford Center', 'CO', 'Denver', '63892', '86', 'mhurne7@discuz.net', 'bbaldazzi7@hud.gov', '303-748-8552', '727-318-6917'); +insert into treatment_center (center_id, street_address, state, city, zip_code, professional_id, email_1, email_2, phone_1, phone_2) values (9, '790 Florence Point', 'CA', 'Orange', '4', '73', 'mhuffey8@hexun.com', 'mklossmann8@friendfeed.com', '760-170-4763', '312-364-9811'); +insert into treatment_center (center_id, street_address, state, city, zip_code, professional_id, email_1, email_2, phone_1, phone_2) values (10, '8653 Katie Circle', 'TX', 'Austin', '93', '597', 'codevey9@over-blog.com', 'ashimon9@elegantthemes.com', '512-506-8312', '559-849-4933'); +insert into treatment_center (center_id, street_address, state, city, zip_code, professional_id, email_1, email_2, phone_1, phone_2) values (11, '31803 Killdeer Court', 'AZ', 'Phoenix', '09', '6425', 'hcamelia@pinterest.com', 'walesioa@multiply.com', '623-187-8557', '513-108-0537'); + +#Medication table +insert into medication (medication_id, name, description) values (1, 'Warfarin Sodium', 'Imaging, Axial Skel, Exc Skull Facial, CT Scan'); +insert into medication (medication_id, name, description) values (2, 'CTCA Foaming Hand Sanitizer', 'Inspection of Lower Intestinal Tract, Percutaneous Approach'); +insert into medication (medication_id, name, description) values (3, 'Rugby', 'LDR Brachytherapy of Pancreas using Oth Isotope'); +insert into medication (medication_id, name, description) values (4, 'Head and Shoulders', 'Bypass R Int Iliac Art to Low Ex Art, Perc Endo Approach'); +insert into medication (medication_id, name, description) values (5, 'Artificial Tears', 'Revision of Autol Sub in R Ankle Jt, Extern Approach'); +insert into medication (medication_id, name, description) values (6, 'Clean All', 'Supplement Uvula with Synthetic Substitute, Open Approach'); +insert into medication (medication_id, name, description) values (7, 'Pollen Mix', 'Repair Bilateral External Ear, Perc Endo Approach'); +insert into medication (medication_id, name, description) values (8, 'SAVELLA', 'Transfuse of Autol Platelets into Central Art, Perc Approach'); +insert into medication (medication_id, name, description) values (9, 'Sunmark Chest Congestion Relief DM', 'CT Scan of R Eye using H Osm Contrast'); +insert into medication (medication_id, name, description) values (10, 'Medroxyprogesterone Acetate', 'Exercise Treatment of Musculosk Up Back/UE using Orthosis'); +insert into medication (medication_id, name, description) values (11, 'Epitol', 'Restriction of Right Subclavian Vein, Percutaneous Approach'); +insert into medication (medication_id, name, description) values (12, 'White Real Time Pain Relief', 'Fusion of Right Elbow Joint with Nonaut Sub, Open Approach'); +insert into medication (medication_id, name, description) values (13, 'OXY Clinical', 'Bypass R Axilla Art to L Extracran Art w Nonaut Sub, Open'); + +#Symptom treated with table +insert into symptom_treated_with (symptom_id, medication_id) values ('8', '6'); +insert into symptom_treated_with (symptom_id, medication_id) values ('7', '8'); +insert into symptom_treated_with (symptom_id, medication_id) values ('14', '1'); +insert into symptom_treated_with (symptom_id, medication_id) values ('18', '7'); +insert into symptom_treated_with (symptom_id, medication_id) values ('20', '12'); +insert into symptom_treated_with (symptom_id, medication_id) values ('10', '4'); +insert into symptom_treated_with (symptom_id, medication_id) values ('5', '10'); + +#Involves table +insert into involves (treatment_id, medication_id) values ('8', '2'); +insert into involves (treatment_id, medication_id) values ('17', '9'); +insert into involves (treatment_id, medication_id) values ('6', '1'); +insert into involves (treatment_id, medication_id) values ('1', '8'); +insert into involves (treatment_id, medication_id) values ('3', '10'); +insert into involves (treatment_id, medication_id) values ('18', '13'); + +#Member of table +insert into member_of (support_group_id, user_id) values ('7', '8'); +insert into member_of (support_group_id, user_id) values ('5', '13'); +insert into member_of (support_group_id, user_id) values ('2', '7'); +insert into member_of (support_group_id, user_id) values ('4', '16'); +insert into member_of (support_group_id, user_id) values ('6', '9'); +insert into member_of (support_group_id, user_id) values ('1', '3'); +insert into member_of (support_group_id, user_id) values ('3', '2'); +insert into member_of (support_group_id, user_id) values ('2', '20'); +insert into member_of (support_group_id, user_id) values ('5', '14'); +insert into member_of (support_group_id, user_id) values ('3', '15'); +insert into member_of (support_group_id, user_id) values ('4', '17'); +insert into member_of (support_group_id, user_id) values ('7', '19'); +insert into member_of (support_group_id, user_id) values ('1', '5'); +insert into member_of (support_group_id, user_id) values ('6', '4'); + +#Supported by table +insert into supported_by (resource_id, user_id) values ('5', '7'); +insert into supported_by (resource_id, user_id) values ('4', '6'); +insert into supported_by (resource_id, user_id) values ('13', '14'); +insert into supported_by (resource_id, user_id) values ('7', '9'); +insert into supported_by (resource_id, user_id) values ('2', '15'); +insert into supported_by (resource_id, user_id) values ('1', '2'); +insert into supported_by (resource_id, user_id) values ('6', '11'); + +#Meeting table +insert into meeting (meeting_number, support_group_id) values (1, '6'); +insert into meeting (meeting_number, support_group_id) values (2, '7'); +insert into meeting (meeting_number, support_group_id) values (3, '1'); +insert into meeting (meeting_number, support_group_id) values (4, '4'); +insert into meeting (meeting_number, support_group_id) values (5, '5'); +insert into meeting (meeting_number, support_group_id) values (6, '2'); +insert into meeting (meeting_number, support_group_id) values (7, '3'); +insert into meeting (meeting_number, support_group_id) values (8, '5'); +insert into meeting (meeting_number, support_group_id) values (9, '2'); +insert into meeting (meeting_number, support_group_id) values (10, '3'); +insert into meeting (meeting_number, support_group_id) values (11, '7'); +insert into meeting (meeting_number, support_group_id) values (12, '6'); +insert into meeting (meeting_number, support_group_id) values (13, '1'); +insert into meeting (meeting_number, support_group_id) values (14, '4'); +insert into meeting (meeting_number, support_group_id) values (15, '3'); + diff --git a/db/db_bootstrap.sql b/db/db_bootstrap.sql deleted file mode 100644 index 003f24d..0000000 --- a/db/db_bootstrap.sql +++ /dev/null @@ -1,33 +0,0 @@ --- This file is to bootstrap a database for the CS3200 project. - --- Create a new database. You can change the name later. You'll --- need this name in the FLASK API file(s), the AppSmith --- data source creation. -create database cool_db; - --- Via the Docker Compose file, a special user called webapp will --- be created in MySQL. We are going to grant that user --- all privilages to the new database we just created. --- TODO: If you changed the name of the database above, you need --- to change it here too. -grant all privileges on cool_db.* to 'webapp'@'%'; -flush privileges; - --- Move into the database we just created. --- TODO: If you changed the name of the database above, you need to --- change it here too. -use cool_db; - --- Put your DDL -CREATE TABLE test_table ( - name VARCHAR(20), - color VARCHAR(10) -); - --- Add sample data. -INSERT INTO test_table - (name, color) -VALUES - ('dev', 'blue'), - ('pro', 'yellow'), - ('junior', 'red'); \ No newline at end of file diff --git a/db/mywind b/db/mywind deleted file mode 160000 index f99e93e..0000000 --- a/db/mywind +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f99e93e616145cbcaaa9e8b48131c6824211b749 diff --git a/flask-app/src/caregiver/caregiver.py b/flask-app/src/caregiver/caregiver.py new file mode 100644 index 0000000..e5be8c2 --- /dev/null +++ b/flask-app/src/caregiver/caregiver.py @@ -0,0 +1,113 @@ +@caregivers.route('/user', methods=['GET']) +def get_user_caregivers(): + # Get all caregivers associated with the current user + caregivers = User.query.filter_by(id=user_id).first().caregivers + return jsonify(caregivers=[c.serialize() for c in caregivers]) + +@caregivers.route('/user', methods=['POST']) +def add_user_caregiver(): + # Add a new caregiver for the current user + data = request.get_json() + name = data.get('name') + email = data.get('email') + phone = data.get('phone') + caregiver = Caregiver(name=name, email=email, phone=phone, user_id=current_user.id) + db.session.add(caregiver) + db.session.commit() + return jsonify(message='Caregiver added successfully!') + +@caregivers.route('/user/', methods=['PUT']) +def update_user_caregiver(user_id): + # Update an existing caregiver for the current user + caregiver = Caregiver.query.filter_by(id=user_id, user_id=current_user.id).first() + if not caregiver: + return jsonify(error='Caregiver not found!') + data = request.get_json() + caregiver.name = data.get('name', caregiver.name) + caregiver.email = data.get('email', caregiver.email) + caregiver.phone = data.get('phone', caregiver.phone) + db.session.commit() + return jsonify(message='Caregiver updated successfully!') + +@caregivers.route('/user/', methods=['DELETE']) +def delete_user_caregiver(user_id): + # Delete an existing caregiver for the current user + caregiver = Caregiver.query.filter_by(id=caregiver_id, user_id=current_user.id).first() + if not caregiver: + return jsonify(error='Caregiver not found!') + db.session.delete(caregiver) + db.session.commit() + return jsonify(message='Caregiver deleted successfully!') + +@caregivers.route('/medical-professionals/add', methods=['POST']) +def add_medical_professional(): + if request.method == 'POST': + first_name = request.form['first_name'] + last_name = request.form['last_name'] + specialty = request.form['specialty'] + treatment_id = request.form['treatment_id'] + + # create a new medical professional object + new_professional = MedicalProfessional(first_name=first_name, last_name=last_name, specialty=specialty, treatment_id=treatment_id) + + # add the new professional to the database + db.session.add(new_professional) + db.session.commit() + + # return success message + return 'New medical professional added successfully!' + +@caregivers.route('/treatment-centers', methods=['GET']) +def get_treatment_centers(): + centers = TreatmentCenter.query.all() + center_list = [] + + # loop through all centers and add them to the center_list + for center in centers: + center_dict = {} + center_dict['center_id'] = center.center_id + center_dict['street_address'] = center.street_address + center_dict['state'] = center.state + center_dict['city'] = center.city + center_dict['zip_code'] = center.zip_code + center_dict['website'] = center.website + center_dict['professional_id'] = center.professional_id + center_dict['email_1'] = center.email_1 + center_dict['email_2'] = center.email_2 + center_dict['phone_1'] = center.phone_1 + center_dict['phone_2'] = center.phone_2 + center_list.append(center_dict) + + # return the center_list as JSON + return jsonify(center_list) + +@caregivers.route('/supported-by', methods=['POST']) +def create_supported_by(): + try: + resource_id = request.json['resource_id'] + user_id = request.json['user_id'] + # check if both resource_id and user_id are present + if not resource_id or not user_id: + return jsonify({'error': 'Please provide both resource_id and user_id.'}), 400 + # create a new supported_by entry + new_entry = SupportedBy(resource_id=resource_id, user_id=user_id) + db.session.add(new_entry) + db.session.commit() + return jsonify({'message': 'New entry added to supported_by table.'}), 201 + except: + return jsonify({'error': 'Failed to create a new entry in supported_by table.'}), 500 + +@caregivers.route('/meeting', methods=['POST']) +def create_meeting(): + try: + support_group_id = request.json['support_group_id'] + # check if support_group_id is present + if not support_group_id: + return jsonify({'error': 'Please provide support_group_id.'}), 400 + # create a new meeting entry + new_entry = Meeting(support_group_id=support_group_id) + db.session.add(new_entry) + db.session.commit() + return jsonify({'message': 'New entry added to meeting table.'}), 201 + except: + return jsonify({'error': 'Failed to create a new entry in meeting table.'}), 500 diff --git a/flask-app/src/patients/patients.py b/flask-app/src/patients/patients.py new file mode 100644 index 0000000..937d666 --- /dev/null +++ b/flask-app/src/patients/patients.py @@ -0,0 +1,176 @@ +from flask import Blueprint, request, jsonify, make_response +import json +from src import db + +patients = Blueprint('user', __name__) + +# Get all users from the DB and their cancer type id +@patients.route('/user', methods=['GET']) +def get_users(): + cursor = db.get_db().cursor() + cursor.execute('SELECT cancer_type_id FROM user') + row_headers = [x[0] for x in cursor.description] + json_data = [] + theData = cursor.fetchall() + for row in theData: + json_data.append(dict(zip(row_headers, row))) + the_response = make_response(jsonify(json_data)) + the_response.status_code = 200 + the_response.mimetype = 'application/json' + return the_response + +@patients.route('/user', methods=['POST']) +def create_user(): + # Get the request body + user_data = request.get_json() + + # Extract the necessary fields + name = user_data.get('name') + age = user_data.get('age') + cancer_type_id = user_data.get('cancer_type_id') + + # Insert the new user into the database + cursor = db.get_db().cursor() + cursor.execute('INSERT INTO user (name, age, cancer_type_id) VALUES (%s, %s, %s)', (name, age, cancer_type_id)) + db.get_db().commit() + + # Return a success message + response = make_response(jsonify({'message': 'User created successfully'})) + response.status_code = 201 + response.mimetype = 'application/json' + return response + +# Delete a user by id +@patients.route('/user/', methods=['DELETE']) +def delete_user(user_id): + cursor = db.get_db().cursor() + cursor.execute('SELECT * FROM user WHERE user_id = {0}'.format(user_id)) + user = cursor.fetchone() + if user: + cursor.execute('DELETE FROM user WHERE user_id = {0}'.format(user_id)) + db.get_db().commit() + the_response = make_response(jsonify({'message': 'User has been deleted.'})) + the_response.status_code = 200 + the_response.mimetype = 'application/json' + else: + the_response = make_response(jsonify({'message': 'User not found.'})) + the_response.status_code = 404 + the_response.mimetype = 'application/json' + return the_response + +# Get users with specified cancer type ID +@patients.route('/user/', methods=['GET']) +def get_users_by_cancer_type(cancer_type_id): + cursor = db.get_db().cursor() + cursor.execute('SELECT * FROM user WHERE cancer_type_id = {0}'.format(cancer_type_id)) + row_headers = [x[0] for x in cursor.description] + json_data = [] + theData = cursor.fetchall() + for row in theData: + json_data.append(dict(zip(row_headers, row))) + the_response = make_response(jsonify(json_data)) + the_response.status_code = 200 + the_response.mimetype = 'application/json' + return the_response + +# Get all cancer types typically associated with a given symptom +@patients.route('/typically_exhibits/', methods=['GET']) +def typically_exhibits(symptom_id): + cursor = db.get_db().cursor() + cursor.execute('SELECT ct.cancer_type_id, ct.name FROM cancer_type ct JOIN typically_exhibits te ON ct.cancer_type_id = te.cancer_type_id WHERE te.symptom_id = {0}'.format(symptom_id)) + row_headers = [x[0] for x in cursor.description] + json_data = [] + theData = cursor.fetchall() + for row in theData: + json_data.append(dict(zip(row_headers, row))) + the_response = make_response(jsonify(json_data)) + the_response.status_code = 200 + the_response.mimetype = 'application/json' + return the_response + +# Get all treatments typically used for a given cancer type +@patients.route('/treatment/', methods=['GET']) +def treatment(cancer_type_id): + cursor = db.get_db().cursor() + cursor.execute('SELECT t.treatment_id, t.name FROM treatment t JOIN typically_treated_with tt ON t.treatment_id = tt.treatment_id WHERE tt.cancer_type_id = {0}'.format(cancer_type_id)) + row_headers = [x[0] for x in cursor.description] + json_data = [] + theData = cursor.fetchall() + for row in theData: + json_data.append(dict(zip(row_headers, row))) + the_response = make_response(jsonify(json_data)) + the_response.status_code = 200 + the_response.mimetype = 'application/json' + return the_response + +# Get all members of a support group +@patients.route('/support_group//members', methods=['GET']) +def get_support_group_members(support_group_id): + cursor = db.get_db().cursor() + cursor.execute('SELECT u.user_id, u.name FROM user u JOIN member_of m ON u.user_id = m.user_id WHERE m.support_group_id = {0}'.format(support_group_id)) + row_headers = [x[0] for x in cursor.description] + json_data = [] + theData = cursor.fetchall() + for row in theData: + json_data.append(dict(zip(row_headers, row))) + the_response = make_response(jsonify(json_data)) + the_response.status_code = 200 + the_response.mimetype = 'application/json' + return the_response + +# Get all treatments typically used for a given cancer type +@patients.route('/cancer_type//treatments', methods=['GET']) +def get_typical_treatments(cancer_type_id): + cursor = db.get_db().cursor() + cursor.execute('SELECT t.treatment_id, t.name FROM treatment t JOIN typically_treated_with tt ON t.treatment_id = tt.treatment_id WHERE tt.cancer_type_id = {0}'.format(cancer_type_id)) + row_headers = [x[0] for x in cursor.description] + json_data = [] + theData = cursor.fetchall() + for row in theData: + json_data.append(dict(zip(row_headers, row))) + the_response = make_response(jsonify(json_data)) + the_response.status_code = 200 + the_response.mimetype = 'application/json' + return the_response + +@patients.route('/cancer_type//support_groups', methods=['GET']) +def get_support_groups_by_cancer_type(cancer_type_id): + cursor = db.get_db().cursor() + cursor.execute('SELECT sg.support_group_id, sg.name FROM support_group sg JOIN typically_supports ts ON sg.support_group_id = ts.support_group_id WHERE ts.cancer_type_id = {0}'.format(cancer_type_id)) + row_headers = [x[0] for x in cursor.description] + json_data = [] + theData = cursor.fetchall() + for row in theData: + json_data.append(dict(zip(row_headers, row))) + the_response = make_response(jsonify(json_data)) + the_response.status_code = 200 + the_response.mimetype = 'application/json' + return the_response + +@patients.route('/support_group//cancer_type//users', methods=['GET']) +def get_users_by_support_group_and_cancer_type(support_group_id, cancer_type_id): + cursor = db.get_db().cursor() + cursor.execute('SELECT u.user_id, u.name FROM user u JOIN member_of m ON u.user_id = m.user_id WHERE m.support_group_id = {0} AND u.cancer_type_id = {1}'.format(support_group_id, cancer_type_id)) + row_headers = [x[0] for x in cursor.description] + json_data = [] + theData = cursor.fetchall() + for row in theData: + json_data.append(dict(zip(row_headers, row))) + the_response = make_response(jsonify(json_data)) + the_response.status_code = 200 + the_response.mimetype = 'application/json' + return the_response + +#Update treatments typically used for a given cancer type for a given user +@patients.route('/treatment/', methods=['PUT']) +def update_treatment(cancer_type_id): + user_id = request.json['user_id'] + updated_treatments = request.json['treatments'] + cursor = db.get_db().cursor() + for treatment_id in updated_treatments: + cursor.execute('UPDATE user_treatments SET treatment_id = {0} WHERE user_id = {1} AND cancer_type_id = {2}'.format(treatment_id, user_id, cancer_type_id)) + db.get_db().commit() + the_response = make_response(jsonify({'message': 'Updated treatments for user {0} with cancer type {1}'.format(user_id, cancer_type_id)})) + the_response.status_code = 200 + the_response.mimetype = 'application/json' + return the_response \ No newline at end of file diff --git a/secrets/db_password.txt b/secrets/db_password.txt new file mode 100644 index 0000000..ad366d9 --- /dev/null +++ b/secrets/db_password.txt @@ -0,0 +1 @@ +password123 diff --git a/secrets/db_root_password.txt b/secrets/db_root_password.txt new file mode 100644 index 0000000..9a019d3 --- /dev/null +++ b/secrets/db_root_password.txt @@ -0,0 +1 @@ +cancerplatformpassword \ No newline at end of file