diff --git a/README.md b/README.md index 8515aee..811b11a 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # ABXinRLS -Antibiotics in Resource Limited Settings (CCMC) +Antibiotics in Resource Limited Settings (CCMC). Typing some stuff to test BK. \ No newline at end of file diff --git a/add-diagnosis.html b/add-diagnosis.html new file mode 100644 index 0000000..fef5ffb --- /dev/null +++ b/add-diagnosis.html @@ -0,0 +1,86 @@ + + + + + + + + ABXinRLS + + + + + + + + + + + + +
+

ABXinRLS

+
+ + arrow_back + +
+

Add Diagnosis

+ +
+
+ + +
+
+ + + +
+ +
+ + + +
+
+
+ +
+ + +
+
+ +
+ + + + + + + + + + + + + diff --git a/add-organism.html b/add-organism.html new file mode 100644 index 0000000..fc2494e --- /dev/null +++ b/add-organism.html @@ -0,0 +1,69 @@ + + + + + + + + ABXinRLS + + + + + + + + + + + + +
+

ABXinRLS

+
+ + arrow_back + +
+

Add Organism

+ +
+
+ + +
+
+ + + +
+
+ + +
+
+ + + + + + + +
+ + + + + + + + + + + + + diff --git a/add-user.html b/add-user.html new file mode 100644 index 0000000..384fbce --- /dev/null +++ b/add-user.html @@ -0,0 +1,73 @@ + + + + + + + + ABXinRLS + + + + + + + + + + + + +
+

ABXinRLS

+
+ + arrow_back + +
+

Add User

+ +
+
+ + +
+
+ + + +
+
Password + +
+
Confirm Password + +
+
+ + + + + + + +
+ + + + + + + + + + + + + diff --git a/antibiotic.html b/antibiotic.html index 5d75061..6c33f6c 100644 --- a/antibiotic.html +++ b/antibiotic.html @@ -10,6 +10,8 @@ + @@ -20,98 +22,116 @@
-

ABXinRLS

+
+

ABXinRLS

+
+
+ + account_circle + +
+
+ + arrow_back + +
+
+
-
+
-
-
+

Antibiotic Name

-
+
-
+
-

Antibiotic Notes

+
+

+ Antibiotic Notes +

+
Antibiotic Content Info
-
+
-
+
- + + keyboard_arrow_down
-
+
- + + keyboard_arrow_down
-
+
- + + keyboard_arrow_down
-
+
- + + keyboard_arrow_down
-
+
- + + keyboard_arrow_down
-
+
- +
@@ -119,5 +139,6 @@ + - \ No newline at end of file + diff --git a/api/antibiotic.php b/api/antibiotic.php new file mode 100644 index 0000000..260ca6f --- /dev/null +++ b/api/antibiotic.php @@ -0,0 +1,37 @@ +prepare( "SELECT * from antibiotic WHERE id = :id " ); // return all fields (*) from the table WHERE the id is the var $id passed to the function + $query->bindParam( ':id', $id ); + $query->execute(); // Run the SQL query on our database + $query->setFetchMode( PDO::FETCH_OBJ ); // A PHP method to tell the database we want to return all the data as objects with each table represented as a property of that object. This will be the case for most of our calls that return information from the database. http://php.net/manual/en/pdo.constants.php + $data = $query->fetchAll(); + + $data = $data[0]; + + // Build our local object + $this->id = $data->id; + $this->name = $data->name; + $this->notes = $data->notes; + } + } + + + public function get () { + $res['id'] = $this->id; + $res['name'] = $this->name; + $res['notes'] = $this->notes; + + return $res; + } + +} \ No newline at end of file diff --git a/api/database.php b/api/database.php new file mode 100644 index 0000000..972c83a --- /dev/null +++ b/api/database.php @@ -0,0 +1,25 @@ +setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + + + return $database; +} \ No newline at end of file diff --git a/api/diagnosis.php b/api/diagnosis.php new file mode 100644 index 0000000..36a52b5 --- /dev/null +++ b/api/diagnosis.php @@ -0,0 +1,56 @@ +prepare( "SELECT * from diagnosis WHERE id = :id " ); // return all fields (*) from the table WHERE the id is the var $id passed to the function + $query->bindParam( ':id', $id ); + $query->execute(); // Run the SQL query on our database + $query->setFetchMode( PDO::FETCH_OBJ ); // A PHP method to tell the database we want to return all the data as objects with each table represented as a property of that object. This will be the case for most of our calls that return information from the database. http://php.net/manual/en/pdo.constants.php + $data = $query->fetchAll(); + + $data = $data[0]; + + // Build our local object + $this->id = $data->id; + $this->name = $data->name; + $this->notes = $data->notes; + $this->buildRelatedAntibiotics(); + } + } + + private function buildRelatedAntibiotics() { + $db = getDatabase(); + $query = $db->prepare( "SELECT antibiotic_id from diagnosis_antibiotic WHERE diagnosis_id = :id " ); // return all fields (*) from the table WHERE the id is the var $id of current diagnosis + $query->bindParam( ':id', $this->id ); + $query->execute(); // Run the SQL query on our database + $query->setFetchMode( PDO::FETCH_OBJ ); + $data = $query->fetchAll(); + + foreach ($data as $row) { + $anti = new Antibiotic($row->antibiotic_id); + $this->relatedAntibiotics[] = $anti->get(); + } + } + + public function get() { + $res['id'] = $this->id; + $res['name'] = $this->name; + $res['notes'] = $this->notes; + $res['relatedAntibiotics'] = $this->relatedAntibiotics; + return $res; + } + + public function getRelatedAntibiotics() { + return $this->relatedAntibiotics; + } + +} \ No newline at end of file diff --git a/api/index.php b/api/index.php new file mode 100644 index 0000000..fcb75a1 --- /dev/null +++ b/api/index.php @@ -0,0 +1,48 @@ +get()); + + + break; + + + case 'getAllDiagnoses': + + $db = getDatabase(); + + $query = $db->prepare( "SELECT id, name from diagnosis" ); + $query->execute(); + $query->setFetchMode( PDO::FETCH_OBJ ); + $data = $query->fetchAll(); + + prepareResponse($data); + + + break; + + } +} else { + die("You need to specify an operation."); +} + + + + +function prepareResponse( $arr ) { + echo json_encode( $arr ); +} \ No newline at end of file diff --git a/ccmc_antibiotics.xml b/ccmc_antibiotics.xml new file mode 100644 index 0000000..f98d1c4 --- /dev/null +++ b/ccmc_antibiotics.xml @@ -0,0 +1,79 @@ + + + + + + + + + CREATE TABLE `antibiotic` ( + `id` int(11) NOT NULL, + `name` varchar(255) NOT NULL, + `notes` text NOT NULL, + PRIMARY KEY (`id`) + ) ENGINE=InnoDB DEFAULT CHARSET=latin1; + + + CREATE TABLE `diagnosis` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `notes` text NOT NULL, + PRIMARY KEY (`id`) + ) ENGINE=InnoDB DEFAULT CHARSET=latin1; + + + CREATE TABLE `diagnosis_antibiotic` ( + `id` int(11) NOT NULL, + `diagnosis_id` int(11) NOT NULL, + `antibiotic_id` int(11) NOT NULL, + `rank` enum('1','2','3') NOT NULL, + PRIMARY KEY (`id`), + KEY `diagnosis_id` (`diagnosis_id`,`antibiotic_id`) + ) ENGINE=InnoDB DEFAULT CHARSET=latin1; + + + CREATE TABLE `diagnosis_organism` ( + `id` int(11) NOT NULL, + `diagnosis_id` int(11) NOT NULL, + `organism_id` int(11) NOT NULL, + `notes` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `diagnosis_id` (`diagnosis_id`), + KEY `organism_id` (`organism_id`), + CONSTRAINT `diagnosis_organism_ibfk_1` FOREIGN KEY (`diagnosis_id`) REFERENCES `diagnosis` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `diagnosis_organism_ibfk_2` FOREIGN KEY (`organism_id`) REFERENCES `organism` (`id`) ON DELETE CASCADE ON UPDATE CASCADE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + + + CREATE TABLE `organism` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `classification` enum('GP','GN','AE','') NOT NULL, + PRIMARY KEY (`id`) + ) ENGINE=InnoDB DEFAULT CHARSET=latin1; + + + + + + + + + + + + + \ No newline at end of file diff --git a/css/main.css b/css/main.css index e70d938..eecb91c 100644 --- a/css/main.css +++ b/css/main.css @@ -1,5 +1,7 @@ +@import url('https://fonts.googleapis.com/css?family=Roboto:400,700,900'); + .page-name{ - text-align: right; + text-align: left; } .panel{ margin:auto; @@ -11,6 +13,11 @@ .classification{ text-align: right; font-style: italic; + background-color: #311B92; + color: #fff; + min-height: 3em; + margin-top: -15px; + padding: 10px; } .profile-button{ padding:60px 0 60px 0; @@ -22,4 +29,248 @@ #profile-edit{ display:block; text-align: center; -} \ No newline at end of file +} +/*headings*/ +h2 { + font-family: Roboto,sans-serif;; + font-weight: 700; +} +h1 { + color: #4527A0; + font-family: Roboto,sans-serif; + font-weight: 900; + text-decoration: none; +} +a:hover { + text-decoration: none; +} +/*arrow back*/ +.arrow-bck { + padding: 5px 20px 5px 20px; + margin-bottom: 20px; +} +/*search bar*/ +.form-control { + border-width: 0.5px; + border-radius: 2px; + box-shadow: 0 2px 2px 0 rgba(0,0,0,0.16),0 0 0 1px rgba(0,0,0,0.08); + transition: box-shadow 200ms cubic-bezier(0.4, 0.0, 0.2, 1); +} +.form-control:focus { + box-shadow: 0 3px 6px rgba(0,0,0,0.25), 0 4px 4px rgba(0,0,0,0.22); +} +.input-group.col-md-12 { + width: 100%; +} +/*button*/ +.btn-info { + background-color: #4527A0; + border-radius: 4px; +} +.btn-info:hover { + background-color: #212121; +} +.btn-info:focus { + background-color: #4527A0; +} +/*user button*/ +.btn-primary { + background-color: #4527A0; +} +.btn-primary:hover { + background-color: #424242; +} +.user-btn { + margin-top: 0.5em; + padding: 5px 30px 1px 30px; +} +i.material-icons.md-48 { + font-size: 36px; +} +.input-group-btn { + position: absolute; + right: 30px; + top: 8px; +} +#custom-search-input button { + border: 0; + background: none; + padding: 0; + margin-top: 2px; + /* IE7-8 doesn't have border-radius, so don't indent the padding */ + margin-bottom: 0; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + color:#4527A0; + z-index: 3; +} +/*title card*/ +.page-name { + background-color: #4527A0; + color: #fff; + min-height: 5em; + padding: 4.5em 0 1em 0.5em; + box-shadow: 0 2px 5px rgba(0, 0, 0, 0.26); +} +/*panels*/ +.panel-group { + margin-bottom: 10px; +} +.panel-default>.panel-heading { + color: #fff; + background-color: #424242; + box-shadow: 0 2px 5px rgba(0, 0, 0, 0.26); + transition: all 0.3s cubic-bezier(.25,.8,.25,1); +} +.panel-default>.panel-heading:hover { + box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22); +} +.abx-result { + margin: -40px 15px 0 0; + z-index: 3; +} +.panel-title { + font-family: Roboto, sans-serif; + font-weight: 400; + padding: 2.5em 0 0.5em 0; + font-size: 1.5em; +} +.panel-body a { + font-family: Roboto,sans-serif; + font-weight: 700; + color: #424242; +} +.more-link { + color: #4527A0; +} +.panel-footer { + background-color: #fff; +} +======= +.form-signin{ + max-width: 330px; + padding:15px; + margin:0 auto; +} + + +/*---------------------------------- add diagnosis button ---------------------------*/ +.btn-select { + position: relative; + padding: 0; + min-width: 236px; + width: 100%; + border-radius: 0; + margin-bottom: 20px; +} + +.btn-select .btn-select-value { + padding: 6px 12px; + display: block; + position: absolute; + left: 0; + right: 34px; + text-align: left; + text-overflow: ellipsis; + overflow: hidden; + border-top: none !important; + border-bottom: none !important; + border-left: none !important; +} + +.btn-select .btn-select-arrow { + float: right; + line-height: 20px; + padding: 6px 10px; + top: 0; +} + +.btn-select ul { + display: none; + background-color: white; + color: black; + clear: both; + list-style: none; + padding: 0; + margin: 0; + border-top: none !important; + position: absolute; + left: -1px; + right: -1px; + top: 33px; + z-index: 999; +} + +.btn-select ul li { + padding: 3px 6px; + text-align: left; +} + +.btn-select ul li:hover { + background-color: #f4f4f4; +} + +.btn-select ul li.selected { + color: white; +} + +/* Default Start */ +.btn-select.btn-default:hover, .btn-select.btn-default:active, .btn-select.btn-default.active { + border-color: #ccc; +} + +.btn-select.btn-default ul li.selected { + background-color: #ccc; +} + +.btn-select.btn-default ul, .btn-select.btn-default .btn-select-value { + background-color: white; + border: #ccc 1px solid; +} + +.btn-select.btn-default:hover, .btn-select.btn-default.active { + background-color: #e6e6e6; +} +.add-button{ + display:block; + margin:0 auto; +} +.dropdown-option{ + display:block; + margin:auto; +} + +/*index*/ +.index-ccmc { + text-align: center; + font-size: 4em; +} +.index h4 { + text-align: center; + margin-bottom: 20px; +} +.index-search { + margin-top: 25vh; +} +/*login*/ +.btn-block { + background-color: #4527A0; +} +/*add ...*/ +h5 { + font-weight: 700; +} +.add-heading { + color: #4527A0; + font-weight: 700; +} +/*profile*/ +.profile-button { + color: #fff; + margin-left: 0; +} +.profile-button:hover { + background: #212121; + color: #fff; +} diff --git a/diagnosis.html b/diagnosis.html index 6361529..cfa5ee2 100644 --- a/diagnosis.html +++ b/diagnosis.html @@ -10,6 +10,8 @@ + @@ -19,83 +21,96 @@ -
-

ABXinRLS

+
+

ABXinRLS

+
+ + +
+
-
+
- +
-
-
+

Diagnosis Name

- -
+ +
-
+

Antibiotics + keyboard_arrow_down

- + + keyboard_arrow_down
-
+
- + + keyboard_arrow_down
-
+
- + + keyboard_arrow_down
-
+
- + + keyboard_arrow_down
-
+
- + + keyboard_arrow_down
-
+
@@ -104,16 +119,18 @@
-
+
-
+

Organisms + keyboard_arrow_down

- + + keyboard_arrow_down
- + + keyboard_arrow_down
- + + keyboard_arrow_down
- - + + + keyboard_arrow_down
- + + keyboard_arrow_down