ref: f1dc6b7292bbe80feb1fe32506af60ea5b93a5ee
parent: 84ba80cf6c8e6187a51ee3ff982e69fe39ca28c1
author: Michael Misch <michaelmisch1985@gmail.com>
date: Thu Nov 7 01:15:22 PST 2019
start moving plugins out
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
client
vscode.code-workspace
+.DS_Store
--- /dev/null
+++ b/plugins/countries.go
@@ -1,0 +1,82 @@
+package plugins
+
+import (
+ "sort"
+ "strings"
+
+ "github.com/pariz/gountries"
+ "golang.org/x/text/message"
+)
+
+// Country - Mapping token to internationalized country code
+type Country struct {
+ ID string
+ Name string
+}
+
+type countries struct {
+ list []gountries.Country
+}
+
+var cache *countries
+
+func init() {
+ var l []gountries.Country
+ c := gountries.New()
+ for _, c := range c.FindAllCountries() {
+ l = append(l, c)
+ }
+ cache = &countries{
+ list: l,
+ }
+ sort.Sort(cache)
+}
+
+func (c *countries) Len() int {
+ return len(c.list)
+}
+
+func (c *countries) Less(i, j int) bool {
+ switch strings.Compare(c.list[i].Name.Common, c.list[j].Name.Common) {
+ case -1:
+ return true
+ default:
+ return false
+ }
+}
+
+func (c *countries) Swap(i, j int) {
+ tmp := c.list[i]
+ c.list[i] = c.list[j]
+ c.list[j] = tmp
+}
+
+// TODO: Filter out any countries we don't support
+func listcountries() []Country {
+ var c []Country
+ for _, item := range cache.list {
+ c = append(c, Country{
+ ID: item.Name.Common,
+ Name: item.Name.Common,
+ })
+ }
+ return c
+}
+
+func validateCountries(p *message.Printer, countries []string) string {
+ for _, c := range countries {
+ if msg := validateCountry(p, c); msg != "" {
+ return msg
+ }
+ }
+ return ""
+}
+
+func validateCountry(p *message.Printer, country string) string {
+ for _, item := range cache.list {
+ if item.Name.Common == country {
+ return ""
+ }
+ }
+ return p.Sprint("No country entered/nil value entered")
+}
--- /dev/null
+++ b/plugins/doctor.go
@@ -1,0 +1,37 @@
+package plugins
+
+type doctor struct {
+ Image string
+ AlmaMater string
+ Name string
+ Residency string
+ Current string
+ Country string
+ Specialty string
+ Rate string
+}
+
+func listdoctors() []doctor {
+ return []doctor{
+ {
+ Image: "AbuzamzamMD.jpg",
+ AlmaMater: "University of Southern California School of Medicine",
+ Residency: "University of Southern California, San Diego. Internal Medicine Residency",
+ Name: "Mark Abuzamzam, MD",
+ Current: "Current Faculty at University of California Irvine Program Director",
+ Country: "United States of America",
+ Specialty: "Internal Medicine and Addictions Medicine",
+ Rate: "0.0013 BTC",
+ },
+ {
+ Image: "WoodfinMD.jpg",
+ Name: "Martha Woodfin, MD",
+ AlmaMater: "University Seoul School of Medicine",
+ Residency: "University of Las Vegas Nevada, Pediatric Medicine Residency",
+ Current: "Current Staff at Mercy Hospital Jackson NC",
+ Country: "United States of America",
+ Specialty: "Internal Medicine",
+ Rate: "0.0011 BTC",
+ },
+ }
+}
--- /dev/null
+++ b/plugins/specialties.go
@@ -1,0 +1,70 @@
+package plugins
+
+import (
+ "golang.org/x/text/message"
+)
+
+// TODO: inverse function to get the actual specialty back from a whitelist
+
+// Specialty - mapping our token to internationalized string
+type Specialty struct {
+ ID string
+ Name string
+}
+
+func specialties(p *message.Printer) []Specialty {
+ return []Specialty{
+ {"acutepain", p.Sprintf("Acute Pain Medicine")},
+ {"anesthesiology", p.Sprintf("Anesthesiology")},
+ {"bariatric", p.Sprintf("Bariatric Surgery")},
+ {"cardiology", p.Sprintf("Cardiology")},
+ {"chiropractic", p.Sprintf("Chiropractics")},
+ {"chronic", p.Sprintf("Chronic Pain")},
+ {"critcare", p.Sprintf("Critical Care")},
+ {"dermatology", p.Sprintf("Dermatology")},
+ {"emergency", p.Sprintf("Emergency Medicine")},
+ {"endocrinology", p.Sprintf("Endocrinology")},
+ {"otolaringology", p.Sprintf("Ear Nose and Throat")},
+ {"familymedicine", p.Sprintf("Family Medicine")},
+ {"gastro", p.Sprintf("Gastrointestinology")},
+ {"headneck", p.Sprintf("Head and Neck")},
+ {"hematology", p.Sprintf("Hematology and Oncology")},
+ {"hepatology", p.Sprintf("Hepatology")},
+ {"hyperbaric", p.Sprintf("Hyperbaric")},
+ {"immunology", p.Sprintf("Immunology")},
+ {"diseases", p.Sprintf("Infectious Diseases")},
+ {"internal", p.Sprintf("Internal Medicine")},
+ {"neonatal", p.Sprintf("Neonatology")},
+ {"nephrology", p.Sprintf("Nephrology")},
+ {"neurology", p.Sprintf("Neurology")},
+ {"neurosurgery", p.Sprintf("Neurosurgery")},
+ {"obstetrics", p.Sprintf("Obstetrics and Gynecology")},
+ {"occupational", p.Sprintf("Occupational Medicine")},
+ {"opthamology", p.Sprintf("Opthamology")},
+ {"orthopedics", p.Sprintf("Orthopedic Surgery")},
+ {"palliative", p.Sprintf("Palliative Care")},
+ {"pediatrics", p.Sprintf("Pediatrics")},
+ {"podiatry", p.Sprintf("Podiatry")},
+ {"pulmonology", p.Sprintf("Pulmonology")},
+ {"radiology", p.Sprintf("Radiology")},
+ {"radiation", p.Sprintf("Radiaton Oncology")},
+ {"transplants", p.Sprintf("Transplant Surgery")},
+ }
+}
+
+func validateSpecialties(p *message.Printer, specialties []string) string {
+ for _, s := range specialties {
+ if msg := validateSpecialty(p, s); msg != "" {
+ return msg
+ }
+ }
+ return ""
+}
+
+func validateSpecialty(p *message.Printer, specialty string) string {
+ switch specialty {
+ case "acutepain", "anesthesiology", "bariatric", "cardiology", "chiropractic", "chronic", "critcare", "dermatology", "emergency", "endocrinology", "otolaringology", "familymedicine", "gastro", "headneck", "hematology", "hepatology", "hyperbaric", "immunology", "diseases", "internal", "neonatal", "nephrology", "neurology", "neurosurgery", "obstetrics", "occupational", "opthamology", "orthopedics", "palliative", "pediatrics", "podiatry", "pulmonology", "radiology", "radiation", "transplants":
+ return ""
+ }
+ return p.Sprint("Unknown or nil specialty entered")
+}
--- a/router/countries.go
+++ /dev/null
@@ -1,82 +1,0 @@
-package router
-
-import (
- "sort"
- "strings"
-
- "github.com/pariz/gountries"
- "golang.org/x/text/message"
-)
-
-// Country - Mapping token to internationalized country code
-type Country struct {
- ID string
- Name string
-}
-
-type countries struct {
- list []gountries.Country
-}
-
-var cache *countries
-
-func init() {
- var l []gountries.Country
- c := gountries.New()
- for _, c := range c.FindAllCountries() {
- l = append(l, c)
- }
- cache = &countries{
- list: l,
- }
- sort.Sort(cache)
-}
-
-func (c *countries) Len() int {
- return len(c.list)
-}
-
-func (c *countries) Less(i, j int) bool {
- switch strings.Compare(c.list[i].Name.Common, c.list[j].Name.Common) {
- case -1:
- return true
- default:
- return false
- }
-}
-
-func (c *countries) Swap(i, j int) {
- tmp := c.list[i]
- c.list[i] = c.list[j]
- c.list[j] = tmp
-}
-
-// TODO: Filter out any countries we don't support
-func listcountries() []Country {
- var c []Country
- for _, item := range cache.list {
- c = append(c, Country{
- ID: item.Name.Common,
- Name: item.Name.Common,
- })
- }
- return c
-}
-
-func validateCountries(p *message.Printer, countries []string) string {
- for _, c := range countries {
- if msg := validateCountry(p, c); msg != "" {
- return msg
- }
- }
- return ""
-}
-
-func validateCountry(p *message.Printer, country string) string {
- for _, item := range cache.list {
- if item.Name.Common == country {
- return ""
- }
- }
- return p.Sprint("No country entered/nil value entered")
-}
--- a/router/doctor.go
+++ /dev/null
@@ -1,37 +1,0 @@
-package router
-
-type doctor struct {
- Image string
- AlmaMater string
- Name string
- Residency string
- Current string
- Country string
- Specialty string
- Rate string
-}
-
-func listdoctors() []doctor {
- return []doctor{
- {
- Image: "AbuzamzamMD.jpg",
- AlmaMater: "University of Southern California School of Medicine",
- Residency: "University of Southern California, San Diego. Internal Medicine Residency",
- Name: "Mark Abuzamzam, MD",
- Current: "Current Faculty at University of California Irvine Program Director",
- Country: "United States of America",
- Specialty: "Internal Medicine and Addictions Medicine",
- Rate: "0.0013 BTC",
- },
- {
- Image: "WoodfinMD.jpg",
- Name: "Martha Woodfin, MD",
- AlmaMater: "University Seoul School of Medicine",
- Residency: "University of Las Vegas Nevada, Pediatric Medicine Residency",
- Current: "Current Staff at Mercy Hospital Jackson NC",
- Country: "United States of America",
- Specialty: "Internal Medicine",
- Rate: "0.0011 BTC",
- },
- }
-}
--- a/router/specialties.go
+++ /dev/null
@@ -1,70 +1,0 @@
-package router
-
-import (
- "golang.org/x/text/message"
-)
-
-// TODO: inverse function to get the actual specialty back from a whitelist
-
-// Specialty - mapping our token to internationalized string
-type Specialty struct {
- ID string
- Name string
-}
-
-func specialties(p *message.Printer) []Specialty {
- return []Specialty{
- {"acutepain", p.Sprintf("Acute Pain Medicine")},
- {"anesthesiology", p.Sprintf("Anesthesiology")},
- {"bariatric", p.Sprintf("Bariatric Surgery")},
- {"cardiology", p.Sprintf("Cardiology")},
- {"chiropractic", p.Sprintf("Chiropractics")},
- {"chronic", p.Sprintf("Chronic Pain")},
- {"critcare", p.Sprintf("Critical Care")},
- {"dermatology", p.Sprintf("Dermatology")},
- {"emergency", p.Sprintf("Emergency Medicine")},
- {"endocrinology", p.Sprintf("Endocrinology")},
- {"otolaringology", p.Sprintf("Ear Nose and Throat")},
- {"familymedicine", p.Sprintf("Family Medicine")},
- {"gastro", p.Sprintf("Gastrointestinology")},
- {"headneck", p.Sprintf("Head and Neck")},
- {"hematology", p.Sprintf("Hematology and Oncology")},
- {"hepatology", p.Sprintf("Hepatology")},
- {"hyperbaric", p.Sprintf("Hyperbaric")},
- {"immunology", p.Sprintf("Immunology")},
- {"diseases", p.Sprintf("Infectious Diseases")},
- {"internal", p.Sprintf("Internal Medicine")},
- {"neonatal", p.Sprintf("Neonatology")},
- {"nephrology", p.Sprintf("Nephrology")},
- {"neurology", p.Sprintf("Neurology")},
- {"neurosurgery", p.Sprintf("Neurosurgery")},
- {"obstetrics", p.Sprintf("Obstetrics and Gynecology")},
- {"occupational", p.Sprintf("Occupational Medicine")},
- {"opthamology", p.Sprintf("Opthamology")},
- {"orthopedics", p.Sprintf("Orthopedic Surgery")},
- {"palliative", p.Sprintf("Palliative Care")},
- {"pediatrics", p.Sprintf("Pediatrics")},
- {"podiatry", p.Sprintf("Podiatry")},
- {"pulmonology", p.Sprintf("Pulmonology")},
- {"radiology", p.Sprintf("Radiology")},
- {"radiation", p.Sprintf("Radiaton Oncology")},
- {"transplants", p.Sprintf("Transplant Surgery")},
- }
-}
-
-func validateSpecialties(p *message.Printer, specialties []string) string {
- for _, s := range specialties {
- if msg := validateSpecialty(p, s); msg != "" {
- return msg
- }
- }
- return ""
-}
-
-func validateSpecialty(p *message.Printer, specialty string) string {
- switch specialty {
- case "acutepain","anesthesiology", "bariatric", "cardiology", "chiropractic", "chronic", "critcare", "dermatology", "emergency", "endocrinology", "otolaringology", "familymedicine", "gastro", "headneck", "hematology", "hepatology", "hyperbaric", "immunology", "diseases", "internal", "neonatal", "nephrology", "neurology", "neurosurgery", "obstetrics", "occupational", "opthamology", "orthopedics", "palliative", "pediatrics", "podiatry", "pulmonology", "radiology", "radiation", "transplants":
- return ""
- }
- return p.Sprint("Unknown or nil specialty entered")
-}