3104 lines
72 KiB
Go
3104 lines
72 KiB
Go
package readBiobankData
|
||
|
||
// file openSNP.go provides a datastructure and function to read data from the OpenSNP.org biobank.
|
||
|
||
import "seekia/internal/helpers"
|
||
|
||
import "encoding/csv"
|
||
import "os"
|
||
import "io"
|
||
import "strings"
|
||
import "slices"
|
||
|
||
|
||
type PhenotypeData_OpenSNP struct{
|
||
|
||
UserID int
|
||
|
||
|
||
EyeColorIsKnown bool
|
||
|
||
// Options: "Green", "Blue", "Hazel", "Brown"
|
||
EyeColor string
|
||
|
||
|
||
LactoseToleranceIsKnown bool
|
||
|
||
// true == Is Lactose Tolerant
|
||
LactoseTolerance bool
|
||
|
||
|
||
HairColorIsKnown bool
|
||
|
||
// Options: "Dark Brown", "Brown", "Light Brown", "Blonde", "Black", "Orange", "Dark Red"
|
||
HairColor string
|
||
|
||
|
||
HeightIsKnown bool
|
||
|
||
// Height is expressed in centimeters
|
||
Height float64
|
||
|
||
|
||
HappinessIsKnown bool
|
||
|
||
// Happiness expressed as a value between 0 and 1
|
||
// -0 == Very sad
|
||
// -1 == Very happy
|
||
Happiness float64
|
||
|
||
|
||
MentalIllnessIsKnown bool
|
||
|
||
// Mental Illness expressed as a value between 0 and 1
|
||
// -0 == Very mentally well adjusted
|
||
// -1 == Very mentally ill
|
||
MentalIllness float64
|
||
|
||
|
||
HomosexualnessIsKnown bool
|
||
|
||
// Homosexualness expressed as a value between 0 and 1
|
||
// -0 == Very Heterosexual
|
||
// -0.5 == Bisexual desires
|
||
// -1 == Very homosexual
|
||
Homosexualness float64
|
||
|
||
|
||
SupernaturalismIsKnown bool
|
||
|
||
// Supernaturalism expressed as a value between 0 and 1
|
||
// -0 == Atheist
|
||
// -1 == Strong belief in the supernatural (religious/spiritual)
|
||
Supernaturalism float64
|
||
|
||
|
||
ObesityIsKnown bool
|
||
|
||
// Obesity expressed as a value between 0 and 1
|
||
// -0 == Very skinny
|
||
// -1 == Very obese
|
||
Obesity float64
|
||
|
||
|
||
AnxietyIsKnown bool
|
||
|
||
// Anxiety expressed as a value between 0 and 1
|
||
// -0 == Very relaxed
|
||
// -1 == Very anxious
|
||
Anxiety float64
|
||
|
||
|
||
AutismIsKnown bool
|
||
|
||
// Autism expressed as a value between 0 and 1
|
||
// -0 == Very non-autistic
|
||
// -1 == Very autistic
|
||
Autism float64
|
||
}
|
||
|
||
|
||
// This function reads the phenotypes_202308230100.csv file in the openSNP biobank data.
|
||
//
|
||
//Outputs:
|
||
// -bool: Able to read file (file is well formed and not corrupt)
|
||
// -[]PhenotypeData_OpenSNP
|
||
func ReadOpenSNPPhenotypesFile(fileObject *os.File)(bool, []PhenotypeData_OpenSNP){
|
||
|
||
csvFileReader := csv.NewReader(fileObject)
|
||
csvFileReader.LazyQuotes = true
|
||
csvFileReader.Comma = ';'
|
||
|
||
// First we read the first line (header line)
|
||
|
||
_, err := csvFileReader.Read()
|
||
if (err != nil){
|
||
|
||
// File is corrupt
|
||
return false, nil
|
||
}
|
||
|
||
// Now we iterate through each user's phenotype data
|
||
|
||
//Map Structure: User ID -> Phenotype data object
|
||
userPhenotypeDataMap := make(map[int]PhenotypeData_OpenSNP)
|
||
|
||
for {
|
||
|
||
userDataLineSlice, err := csvFileReader.Read()
|
||
if (err != nil) {
|
||
|
||
if (err == io.EOF){
|
||
// We have reached the end of the file
|
||
break
|
||
}
|
||
// File is corrupt
|
||
return false, nil
|
||
}
|
||
|
||
userIDString := userDataLineSlice[0]
|
||
|
||
userID, err := helpers.ConvertStringToInt(userIDString)
|
||
if (err != nil){
|
||
// File is corrupt
|
||
return false, nil
|
||
}
|
||
|
||
_, exists := userPhenotypeDataMap[userID]
|
||
if (exists == true){
|
||
|
||
// This user has multiple entries
|
||
// Each entry is identical except for the raw genome filename
|
||
// We will continue
|
||
|
||
continue
|
||
}
|
||
|
||
//Outputs:
|
||
// -bool: User eye color is known
|
||
// -string: User eye color
|
||
getUserEyeColor := func()(bool, string){
|
||
|
||
//Outputs:
|
||
// -bool: Eye color is known
|
||
// -string: Eye color
|
||
convertRawEyeColorToEyeColor := func(inputRawEyeColor string)(bool, string){
|
||
|
||
switch inputRawEyeColor{
|
||
|
||
case "-":{
|
||
return false, ""
|
||
}
|
||
case "Brown",
|
||
"brown",
|
||
"Dark brown",
|
||
"Brown/black",
|
||
"Grey brown":{
|
||
|
||
return true, "Brown"
|
||
}
|
||
case "Hazel",
|
||
"hazel",
|
||
"Brown-green",
|
||
"brown-green",
|
||
"Hazel/Light Brown",
|
||
"Hazel (light brown, dark green, dark blue)",
|
||
"Brown-amber",
|
||
"Indeterminate brown-green with a subtle grey caste",
|
||
"Hazel (brown/green)",
|
||
"Green-hazel",
|
||
"Amber - (yellow/ocre brown)",
|
||
"Hazel/light brown",
|
||
"Green-brown",
|
||
"green-brown",
|
||
"Brown - brown and green in bright sunlight",
|
||
"Hazel/yellow",
|
||
"Brown-(green when external temperature rises)",
|
||
"Ambar-green",
|
||
"Olive-brown ringing burnt umber-brown",
|
||
"Green with brown freckles",
|
||
"Green-Hazel",
|
||
"Ambar-Green",
|
||
"Brown-Amber",
|
||
"Hazel/Yellow",
|
||
"Brown center starburst, amber and olive green, with dark gray outer ring",
|
||
"Amber/brown",
|
||
"Amber/Brown",
|
||
"Brown green starburst",
|
||
"brown green starburst",
|
||
"Brown inner, dark green outer",
|
||
"Brown with blue outer ring",
|
||
"Green with amber burst and gray outer ring",
|
||
"Hazel, olive green with amber starburst",
|
||
"light brown",
|
||
"Light brown",
|
||
"one brown one green",
|
||
"Red/blood",
|
||
"Olive-Brown ringing Burnt Umber-Brown",
|
||
"Losing eye pigment as i age, currently in the light brown almost green phase",
|
||
"Brown - Brown and green in bright sunlight",
|
||
"green-blue outer ring and brown flecks around iris",
|
||
"Grey and Amber",
|
||
"Grey and amber",
|
||
"indeterminate brown-green with a subtle grey caste",
|
||
"Hazel light green",
|
||
"Hazel dark green",
|
||
"Hazel green",
|
||
" green brown",
|
||
"hazel light green",
|
||
"light brown with dark green tint",
|
||
"Light brown with dark green tint":{
|
||
|
||
return true, "Hazel"
|
||
}
|
||
case "Blue",
|
||
"Blue-grey",
|
||
"Blue grey",
|
||
"Gray-blue",
|
||
"Blue-grey with central heterochromia",
|
||
"Dark blue",
|
||
"blue",
|
||
"Light blue-green",
|
||
"blue-grey",
|
||
"Dark Grayish-Blue Eyes (like a stone)",
|
||
"Blue with yellow parts",
|
||
"Blue-grey; broken amber collarette",
|
||
"Blue/gray",
|
||
"gray-blue",
|
||
"blue spot of brown",
|
||
"Blue spot of brown",
|
||
"Blue with yellow inner ring",
|
||
"DARK BLUE",
|
||
"Light Gray Blue",
|
||
"Changes blue/green/grey",
|
||
"Light Gray/Blue. Amber/Med Brown on Sphincter. Gray ring around outer edge. Flecks (Nevi).",
|
||
"Light gray/blue. amber/med brown on sphincter. gray ring around outer edge. flecks (nevi).":{
|
||
|
||
return true, "Blue"
|
||
}
|
||
case "Green",
|
||
"Green ",
|
||
"green",
|
||
"Green-gray",
|
||
"Blue-green ",
|
||
"Blue-green",
|
||
"blue-green ",
|
||
"Light-mixed green",
|
||
"blue-green",
|
||
"Blue with a yellow ring of flecks that make my eyes look green depending on the light or my mood",
|
||
"Light-mixed Green",
|
||
"Blue-green heterochromia",
|
||
"Blue-green-grey",
|
||
"Blue-green; amber collarette, and gray-blue ringing",
|
||
"Blue, grey, green, changing",
|
||
"blue, grey, green, changing",
|
||
"Blue/Green",
|
||
"Green with blue halo",
|
||
"Ice blue mixed with slate blue, with an amber pupil burst in both eyes and a brown spot adjacent to lower left pupil. eyes were green into my 20's.",
|
||
"Split - one side dark blue / other side light blue and green",
|
||
"Blue with a yellow ring of flecks that make my eyes look green depending on the light or my mood ",
|
||
"Blue/green/gold",
|
||
"blue/green/gold",
|
||
"green yellow",
|
||
"Green yellow",
|
||
"Blue/green",
|
||
"Light Green",
|
||
"Light green",
|
||
"Blue/Green/Grey - changes with lighting and clothing",
|
||
"Blue/green/grey - changes with lighting and clothing",
|
||
"Changes with mood blue/grey/green",
|
||
"changes with mood blue/grey/green",
|
||
"Dark gray, blue, green (central heterochromia), yellow/brown ring around pupil, ",
|
||
"changes blue/green/grey":{
|
||
|
||
return true, "Green"
|
||
}
|
||
}
|
||
|
||
return false, ""
|
||
}
|
||
|
||
userResponsesList := make([]string, 0)
|
||
|
||
getResponse1 := func()(bool, string){
|
||
|
||
// Column Name: "Eye Color"
|
||
|
||
userEyeColorRaw := userDataLineSlice[5]
|
||
|
||
eyeColorIsKnown, eyeColor := convertRawEyeColorToEyeColor(userEyeColorRaw)
|
||
|
||
return eyeColorIsKnown, eyeColor
|
||
}
|
||
|
||
response1Exists, response1 := getResponse1()
|
||
if (response1Exists == true){
|
||
userResponsesList = append(userResponsesList, response1)
|
||
}
|
||
|
||
getResponse2 := func()(bool, string){
|
||
|
||
// Column Name: "eye colour"
|
||
|
||
userEyeColorRaw := userDataLineSlice[159]
|
||
|
||
eyeColorIsKnown, eyeColor := convertRawEyeColorToEyeColor(userEyeColorRaw)
|
||
|
||
return eyeColorIsKnown, eyeColor
|
||
}
|
||
|
||
response2Exists, response2 := getResponse2()
|
||
if (response2Exists == true){
|
||
userResponsesList = append(userResponsesList, response2)
|
||
}
|
||
|
||
getResponse3 := func()(bool, string){
|
||
|
||
// Column Name: "Eye pigmentation "
|
||
|
||
userEyeColorRaw := userDataLineSlice[392]
|
||
|
||
eyeColorIsKnown, eyeColor := convertRawEyeColorToEyeColor(userEyeColorRaw)
|
||
|
||
return eyeColorIsKnown, eyeColor
|
||
}
|
||
|
||
response3Exists, response3 := getResponse3()
|
||
if (response3Exists == true){
|
||
userResponsesList = append(userResponsesList, response3)
|
||
}
|
||
|
||
getResponse4 := func()(bool, string){
|
||
|
||
// Column Name: "Eye Color"
|
||
|
||
userEyeColorRaw := userDataLineSlice[341]
|
||
|
||
eyeColorIsKnown, eyeColor := convertRawEyeColorToEyeColor(userEyeColorRaw)
|
||
|
||
return eyeColorIsKnown, eyeColor
|
||
}
|
||
|
||
response4Exists, response4 := getResponse4()
|
||
if (response4Exists == true){
|
||
userResponsesList = append(userResponsesList, response4)
|
||
}
|
||
|
||
if (len(userResponsesList) == 0){
|
||
return false, ""
|
||
}
|
||
|
||
// We check if all responses are the same
|
||
|
||
allResponsesAreIdentical := helpers.CheckIfAllItemsInSliceAreIdentical(userResponsesList)
|
||
if (allResponsesAreIdentical == false){
|
||
// User contradicted themselves
|
||
return false, ""
|
||
}
|
||
|
||
userEyeColor := userResponsesList[0]
|
||
|
||
return true, userEyeColor
|
||
}
|
||
|
||
userEyeColorIsKnown, userEyeColor := getUserEyeColor()
|
||
|
||
//Outputs:
|
||
// -bool: User lactose Tolerance is known
|
||
// -bool: User lactose Tolerance
|
||
getUserLactoseTolerance := func()(bool, bool){
|
||
|
||
// Column Name == "Lactose intolerance"
|
||
|
||
userLactoseToleranceRaw := userDataLineSlice[6]
|
||
|
||
switch userLactoseToleranceRaw{
|
||
|
||
case "-":{
|
||
return false, false
|
||
}
|
||
case "Yes",
|
||
"Lactose-intolerant",
|
||
"Lactose intolerant",
|
||
"lactose-intolerant",
|
||
" allergic to all forms of dairy ",
|
||
" Allergic to all forms of dairy ",
|
||
"Severe gi pain ",
|
||
"severe GI pain ":{
|
||
|
||
return true, false
|
||
}
|
||
case "No",
|
||
"Lactose-tolerant",
|
||
"Lactose tolerant",
|
||
"lactose-tolerant",
|
||
"lactose tolerant",
|
||
"False":{
|
||
return true, true
|
||
}
|
||
}
|
||
|
||
return false, false
|
||
}
|
||
|
||
userLactoseToleranceIsKnown, userLactoseTolerance := getUserLactoseTolerance()
|
||
|
||
//Outputs:
|
||
// -bool: User hair color is known
|
||
// -string: Hair Color
|
||
// Either "Dark Brown", "Brown", "Light Brown", "Blonde", "Black", "Orange", "Dark Red"
|
||
getUserHairColor := func()(bool, string){
|
||
|
||
// We create a list with each response
|
||
userResponsesList := make([]string, 0)
|
||
|
||
convertRawHairColorToHairColor := func(inputRawHairColor string)(bool, string){
|
||
|
||
switch inputRawHairColor{
|
||
case "-":{
|
||
return false, ""
|
||
}
|
||
case "Black",
|
||
"Black ",
|
||
"Black (very slight tint of red)",
|
||
"Very dark brown",
|
||
"Darkest brown to black":{
|
||
|
||
return true, "Black"
|
||
}
|
||
case "dark brown",
|
||
"Brown-black",
|
||
"Brown-Black",
|
||
"Dark brown",
|
||
"Dirt-brown",
|
||
"Dirt-Brown",
|
||
"Dark Brown",
|
||
"Blackish brown",
|
||
"Blond as child. started turning dark brown after puberty",
|
||
"Blond born, today dark brown",
|
||
"Dark brown; red highlights",
|
||
"Dark blonde as a child, dark brown as an adult",
|
||
"blond born, today dark brown",
|
||
"Strawberry blond as a child, now dark auburn brown",
|
||
"dark blonde as a child, dark brown as an adult",
|
||
"Darkest brown to black ":{
|
||
|
||
return true, "Dark Brown"
|
||
}
|
||
case "Brown",
|
||
"brown",
|
||
"Medium brown",
|
||
"Chestnut brown",
|
||
"Chestnut",
|
||
"Grey and Brown",
|
||
"Grey and brown",
|
||
"Blonde as a child, to brown as an adult",
|
||
"Medium brown with highlights",
|
||
"Medium brown, red highlights",
|
||
"medium brown, red highlights",
|
||
"Hair darkening with age, starting blonde, ending dark brown",
|
||
"hair darkening with age, starting blonde, ending dark brown",
|
||
"Dark blonde as a child, chestnut brown as an adult",
|
||
"Blonde to light brown as child, medium brown as adult with blonde highlights from sun",
|
||
"blonde to light brown as child, medium brown as adult with blonde highlights from sun",
|
||
"Brown and silver",
|
||
"Brown going to white in early 40s",
|
||
"Dark brown; blonde highlights",
|
||
"blonde as a child, to brown as an adult",
|
||
"brown going to white in early 40s":{
|
||
|
||
return true, "Brown"
|
||
}
|
||
case "Light brown",
|
||
"light brown",
|
||
"Light to Medium brown",
|
||
"Light to medium brown",
|
||
"Dirt-blonde",
|
||
"Dark blonde",
|
||
"Between dark blonde and light brown",
|
||
" light blonde as a child and medium blonde as an adult. ",
|
||
" Light blonde as a child and medium blonde as an adult. ",
|
||
"Blond as a child and Light Brown as an Adult",
|
||
"Blond as a child and light brown as an adult",
|
||
"Blond as a child. Dark blond as an adult.",
|
||
"Blond as a child. dark blond as an adult.",
|
||
"Blonde as a child, light brown as an adult",
|
||
"Dirty blonde, light brown, something?",
|
||
"Dirty Blond, Dark Red Beard",
|
||
"Medium golden brown",
|
||
"Dirt-Blonde",
|
||
"Dark blonde, strawberry",
|
||
"Dark blonde (light brown)",
|
||
"Medium Golden Brown",
|
||
"Light ashy brown",
|
||
"Dark blonde, ",
|
||
"Dark blonde ",
|
||
"Strawberry brown",
|
||
"strawberry brown",
|
||
"Towhead to light ashy brown by 20s",
|
||
"White as child. slowly darkened after age 3, golden by puberty, beige by 20s",
|
||
"between dark blonde and light brown":{
|
||
|
||
return true, "Light Brown"
|
||
}
|
||
case "Reddish Brown",
|
||
"Reddish brown",
|
||
"Reddish-brown",
|
||
"reddish brown",
|
||
"Copper/Red",
|
||
"Copper/red",
|
||
"Auburn",
|
||
"Auburn (reddish-brown)",
|
||
"Auburn (Reddish-Brown)",
|
||
"Red (gone blond-grey)",
|
||
"Dark blonde with a little of every colour but black.",
|
||
"Brown,red,blond",
|
||
"brown,red,blond",
|
||
"Blondish reddish brown",
|
||
"Toe head to dark reddish brown",
|
||
"blondish reddish brown",
|
||
"dark blonde, strawberry":{
|
||
|
||
return true, "Dark Red"
|
||
}
|
||
case "Red",
|
||
"red",
|
||
"Bright Copper Ginger into my 40s. Light Auburn with grey temples as I age.":{
|
||
|
||
return true, "Orange"
|
||
}
|
||
case "Blonde",
|
||
"Blond",
|
||
"Strawberry blonde",
|
||
"BLOND",
|
||
"strawberry blonde",
|
||
"Blonde as child, ash blonde as adult, early white":{
|
||
|
||
return true, "Blonde"
|
||
}
|
||
}
|
||
|
||
return false, ""
|
||
}
|
||
|
||
getResponse1 := func()(bool, string){
|
||
|
||
// Column Name == "Hair Color"
|
||
|
||
userHairColorRaw := userDataLineSlice[11]
|
||
|
||
hairColorIsKnown, hairColor := convertRawHairColorToHairColor(userHairColorRaw)
|
||
|
||
return hairColorIsKnown, hairColor
|
||
}
|
||
|
||
response1Exists, response1 := getResponse1()
|
||
if (response1Exists == true){
|
||
userResponsesList = append(userResponsesList, response1)
|
||
}
|
||
|
||
getResponse2 := func()(bool, string){
|
||
|
||
// Column Name == "Hair color"
|
||
|
||
userHairColorRaw := userDataLineSlice[268]
|
||
|
||
hairColorIsKnown, hairColor := convertRawHairColorToHairColor(userHairColorRaw)
|
||
|
||
return hairColorIsKnown, hairColor
|
||
}
|
||
|
||
response2Exists, response2 := getResponse2()
|
||
if (response2Exists == true){
|
||
userResponsesList = append(userResponsesList, response2)
|
||
}
|
||
|
||
getResponse3 := func()(bool, string){
|
||
|
||
// Column Name == "hair color"
|
||
|
||
userHairColorRaw := userDataLineSlice[432]
|
||
|
||
hairColorIsKnown, hairColor := convertRawHairColorToHairColor(userHairColorRaw)
|
||
|
||
return hairColorIsKnown, hairColor
|
||
}
|
||
|
||
response3Exists, response3 := getResponse3()
|
||
if (response3Exists == true){
|
||
userResponsesList = append(userResponsesList, response3)
|
||
}
|
||
|
||
getResponse4 := func()(bool, string){
|
||
|
||
// Column Name == "hair colour"
|
||
|
||
userHairColorRaw := userDataLineSlice[288]
|
||
|
||
hairColorIsKnown, hairColor := convertRawHairColorToHairColor(userHairColorRaw)
|
||
|
||
return hairColorIsKnown, hairColor
|
||
}
|
||
|
||
response4Exists, response4 := getResponse4()
|
||
if (response4Exists == true){
|
||
userResponsesList = append(userResponsesList, response4)
|
||
}
|
||
|
||
// Columns TODO:
|
||
// -"brown hair colour"
|
||
// -"Red Hair"
|
||
// -"Hair and eye color Brown"
|
||
// -"brown hair colour blue eyes"
|
||
// -"Black hair and Green Eyes"
|
||
|
||
if (len(userResponsesList) == 0){
|
||
return false, ""
|
||
}
|
||
|
||
// We check if all responses are the same
|
||
|
||
allResponsesAreIdentical := helpers.CheckIfAllItemsInSliceAreIdentical(userResponsesList)
|
||
if (allResponsesAreIdentical == false){
|
||
// User contradicted themselves
|
||
return false, ""
|
||
}
|
||
|
||
userHairColor := userResponsesList[0]
|
||
|
||
return true, userHairColor
|
||
}
|
||
|
||
userHairColorIsKnown, userHairColor := getUserHairColor()
|
||
|
||
|
||
// Outputs:
|
||
// -bool: User height is known
|
||
// -int: User height (in centimeters)
|
||
getUserHeight := func()(bool, float64){
|
||
|
||
// Column Name == "Height"
|
||
|
||
userHeightRaw := userDataLineSlice[13]
|
||
|
||
switch userHeightRaw{
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case `4'0"`:{
|
||
return true, 121.92
|
||
}
|
||
case `4'1"`:{
|
||
return true, 124.46
|
||
}
|
||
case `4'2"`:{
|
||
return true, 127
|
||
}
|
||
case `4'3"`:{
|
||
return true, 129.54
|
||
}
|
||
case `4'4"`:{
|
||
return true, 132.08
|
||
}
|
||
case `4'5"`:{
|
||
return true, 134.62
|
||
}
|
||
case `4'6"`:{
|
||
return true, 137.16
|
||
}
|
||
case `4'7"`:{
|
||
return true, 139.7
|
||
}
|
||
case `4'8"`:{
|
||
return true, 142.24
|
||
}
|
||
case `4'9"`:{
|
||
return true, 144.78
|
||
}
|
||
case `4'10"`, `4'10`:{
|
||
return true, 147.32
|
||
}
|
||
case `4'11"`, `4' 11"`:{
|
||
return true, 149.86
|
||
}
|
||
case `5'`, `5' 0"`, `5' 0'`, `5'0"`, `5'0`:{
|
||
return true, 152.4
|
||
}
|
||
case `5'1"`, `5'1" or 155cm`:{
|
||
return true, 154.94
|
||
}
|
||
case `5'1.5"`:{
|
||
return true, 156.21
|
||
}
|
||
case `5'2"`:{
|
||
return true, 157.48
|
||
}
|
||
case `5' 2 1/2"`:{
|
||
return true, 158.75
|
||
}
|
||
case `5'2.75" at max`:{
|
||
return true, 159.385
|
||
}
|
||
case `5'3"`, `5'3''`:{
|
||
return true, 160
|
||
}
|
||
case `5' 3.5" `:{
|
||
return true, 161.29
|
||
}
|
||
case `5'4"`, `5'4`, `5'4''`, "162.56", `64"`:{
|
||
return true, 162.56
|
||
}
|
||
case `5'4 3/4, taller than all females in my family`:{
|
||
return true, 164.465
|
||
}
|
||
case `5'5"`, `5' 5"`, `5'5" `, `5’5”`:{
|
||
return true, 165.1
|
||
}
|
||
case "167":{
|
||
return true, 167
|
||
}
|
||
case `5'6"`, `5’6`:{
|
||
return true, 167.64
|
||
}
|
||
case `5' 6.5" `:{
|
||
return true, 168.91
|
||
}
|
||
case `169.316`:{
|
||
return true, 169.316
|
||
}
|
||
case `5'7"`:{
|
||
return true, 170.18
|
||
}
|
||
case `Average ( 165cm < x < 180cm )`:{
|
||
return true, 172.5
|
||
}
|
||
case `5'8"`:{
|
||
return true, 172.72
|
||
}
|
||
case `Average 173cm`:{
|
||
return true, 173
|
||
}
|
||
case `5'8.5"`:{
|
||
return true, 173.99
|
||
}
|
||
case `5'9"`, `5'9"/176cm`:{
|
||
return true, 175.26
|
||
}
|
||
case `5" 9 1/2"`:{
|
||
return true, 176.53
|
||
}
|
||
case `5'10"`, `5'10''`:{
|
||
return true, 177.8
|
||
}
|
||
case `5'11"`:{
|
||
return true, 180.34
|
||
}
|
||
case `6'`, `6 ft 0 in`, `6'0" - 183cm`:{
|
||
return true, 182.88
|
||
}
|
||
case `6'1"`, `6' 1" - 185 cm`:{
|
||
return true, 185.42
|
||
}
|
||
case `6'2"`:{
|
||
return true, 187.96
|
||
}
|
||
case `6'3"`:{
|
||
return true, 190.5
|
||
}
|
||
case "192":{
|
||
return true, 192
|
||
}
|
||
case `6'4"`:{
|
||
return true, 193.04
|
||
}
|
||
case `6'5"`:{
|
||
return true, 195.58
|
||
}
|
||
case `6'6"`:{
|
||
return true, 198.12
|
||
}
|
||
case `>200cm`:{
|
||
return true, 200
|
||
}
|
||
case `6'7"`:{
|
||
return true, 200.66
|
||
}
|
||
case `6'8"`:{
|
||
return true, 203.2
|
||
}
|
||
case `6'9"`:{
|
||
return true, 205.74
|
||
}
|
||
case `6'10"`:{
|
||
return true, 208.28
|
||
}
|
||
case `6'11"`:{
|
||
return true, 210.82
|
||
}
|
||
case `7'`:{
|
||
return true, 213.36
|
||
}
|
||
}
|
||
|
||
trimmedHeight, suffixExists := strings.CutSuffix(userHeightRaw, "cm")
|
||
if (suffixExists == true){
|
||
heightFloat64, err := helpers.ConvertStringToFloat64(trimmedHeight)
|
||
if (err == nil){
|
||
return true, heightFloat64
|
||
}
|
||
}
|
||
|
||
trimmedHeight, suffixExists = strings.CutSuffix(userHeightRaw, " cm")
|
||
if (suffixExists == true){
|
||
heightFloat64, err := helpers.ConvertStringToFloat64(trimmedHeight)
|
||
if (err == nil){
|
||
return true, heightFloat64
|
||
}
|
||
}
|
||
|
||
// This is an outcome with backticks and quotes
|
||
result := "6`" + `2"`
|
||
if (userHeightRaw == result){
|
||
return true, 187.96
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
userHeightIsKnown, userHeight := getUserHeight()
|
||
|
||
//Outputs:
|
||
// -bool: User happiness is known
|
||
// -float64: User happiness (0-1)
|
||
// -0 == Extremely depressed
|
||
// -1 == Extremely happy
|
||
getUserHappiness := func()(bool, float64){
|
||
|
||
// We sum all known responses and average them out
|
||
|
||
responsesSum := float64(0)
|
||
responsesCount := 0
|
||
|
||
getResponse1 := func()(bool, float64){
|
||
|
||
// Column Name: "Depression"
|
||
|
||
userDepressionRaw := userDataLineSlice[173]
|
||
|
||
switch userDepressionRaw{
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case "Yes",
|
||
"Diagnosed.":{
|
||
|
||
return true, 0
|
||
}
|
||
case "Yes at times":{
|
||
|
||
return true, 0.3
|
||
}
|
||
case "Situational Depression",
|
||
"Situational depression":{
|
||
|
||
return true, 0.35
|
||
}
|
||
case "No":{
|
||
|
||
return true, 1
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
response1Exists, response1 := getResponse1()
|
||
if (response1Exists == true){
|
||
responsesSum += response1
|
||
responsesCount += 1
|
||
}
|
||
|
||
getResponse2 := func()(bool, float64){
|
||
|
||
// Column Name == "Episodic Major Depression"
|
||
|
||
userDepressionRaw := userDataLineSlice[586]
|
||
|
||
switch userDepressionRaw{
|
||
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case "No":{
|
||
return true, 1
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
response2Exists, response2 := getResponse2()
|
||
if (response2Exists == true){
|
||
responsesSum += response2
|
||
responsesCount += 1
|
||
}
|
||
|
||
getResponse3 := func()(bool, float64){
|
||
|
||
// Column Name == "Suicidality"
|
||
|
||
userSuicidalityRaw := userDataLineSlice[541]
|
||
|
||
switch userSuicidalityRaw{
|
||
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case "Regular ideation",
|
||
"Several attempts, and/or depression",
|
||
"Multiple attempts, first thought about it at age 9, diagnosed with major depressive disorder and PTSD. Have had passive suicidal ideation for most of my life.":{
|
||
|
||
return true, 0
|
||
}
|
||
case "Anxitey, ptsd, major depression without suicidal ideation",
|
||
"Anxitey, PTSD, Major Depression without suicidal ideation",
|
||
"Sometimes think about it but never want to actually kill myself",
|
||
"sometimes think about it but never want to actually kill myself":{
|
||
|
||
return true, 0.2
|
||
}
|
||
case "Never even thought about suicide",
|
||
"No",
|
||
"never even thought about Suicide":{
|
||
|
||
return true, 1
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
response3Exists, response3 := getResponse3()
|
||
if (response3Exists == true){
|
||
responsesSum += response3
|
||
responsesCount += 1
|
||
}
|
||
|
||
getResponse4 := func()(bool, float64){
|
||
|
||
// Column Name == "Mental Disease"
|
||
|
||
userMentalDiseaseRaw := userDataLineSlice[165]
|
||
|
||
switch userMentalDiseaseRaw{
|
||
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case "Major Depressive Disorder, Generalized Anxiety, Binge Eating Disorder",
|
||
"anxiety, ocd, agoraphobia, depression",
|
||
"Anxiety and Depression",
|
||
"Anxiety and depression",
|
||
"Depression",
|
||
"major depressive disorder, PTSD, generalized anxiety, panic disorder, ADD, OCD",
|
||
"Paranoid Schizophrenia",
|
||
"Paranoid schizophrenia",
|
||
"Anxiety (esp. social), depression, ocd, autistic tendencies, maladaptive daydreaming",
|
||
"Anorexia nervosa, anxiety, depression",
|
||
"Adhd, anxiety, depression, adjustment disorder",
|
||
"ADHD, Anxiety, Depression, Adjustment Disorder",
|
||
"Major depressive disorder, dysthymia, asd, social anxiety disorder, ocd, adhd, unspecified dissociative disorder, developmental speech/language disorder",
|
||
"Major depressive disorder, generalized anxiety, binge eating disorder",
|
||
"Major depressive disorder, ptsd, generalized anxiety, panic disorder, add, ocd",
|
||
"Multiple diagnosed",
|
||
"multiple diagnosed":{
|
||
return true, 0
|
||
}
|
||
case "Borderline Personality Disorder ",
|
||
"Ptsd and results of it(dissociative disorder, depression, anxiety), maladaptive daydreaming, and autistic tendencies":{
|
||
return true, 0.2
|
||
}
|
||
case "Bipolar",
|
||
"Prob a few of them",
|
||
"Asperger's Syndrome, ADHD, schizoaffective bipolar, and Agoraphobia",
|
||
"Bipolar 2, ADHD, PTSD",
|
||
"Bipolar 2, adhd, ptsd",
|
||
"Hypomania/OCD/Anxiety",
|
||
"Panic disorder agoraphobia",
|
||
"panic disorder agoraphobia",
|
||
"SAD depression",
|
||
"Sad depression":{
|
||
return true, 0.25
|
||
}
|
||
case "Anxiety",
|
||
"Asperger's disorder",
|
||
"PDD-NOS and ADHD",
|
||
"Panic disorder",
|
||
"panic disorder",
|
||
"Schizoid":{
|
||
return true, 0.3
|
||
}
|
||
case "None",
|
||
"none":{
|
||
return true, 1
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
response4Exists, response4 := getResponse4()
|
||
if (response4Exists == true){
|
||
responsesSum += response4
|
||
responsesCount += 1
|
||
}
|
||
|
||
getResponse5 := func()(bool, float64){
|
||
|
||
// Column Name == "Personality Disorder test - top result"
|
||
|
||
userPersonalityDisorderRaw := userDataLineSlice[193]
|
||
|
||
switch userPersonalityDisorderRaw{
|
||
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case "Depression",
|
||
"Anxiety and depression",
|
||
"Multiple anxiety disorders, depression, chronic insomnia",
|
||
"Depression add aspergers panic disorder",
|
||
"Prob 3 or more of them",
|
||
"Anxiety (esp. social), depression, OCD, autistic tendencies, maladaptive daydreaming",
|
||
"depression",
|
||
"depression add aspergers panic disorder":{
|
||
|
||
return true, 0
|
||
}
|
||
case "Borderline",
|
||
"Schizotypal",
|
||
"Anxiety, ocd, bipolar 1 wo psychosis",
|
||
"Paranoid +",
|
||
"Passive aggressive, Paranoid ":{
|
||
|
||
return true, 0.2
|
||
}
|
||
case "Anxiety",
|
||
"Aspergers",
|
||
"anxiety",
|
||
"Ocd",
|
||
"Obsessive-Compulsive+",
|
||
"Obsessive-Compulsive",
|
||
"Ocd add asd",
|
||
"OCD ADD ASD",
|
||
"-Paranoid (I'm not, but I am schizoid (2nd result)":{
|
||
|
||
return true, 0.25
|
||
}
|
||
case "Antisocial and cold",
|
||
"Antisocial",
|
||
"Avoidant",
|
||
"Avoidant+":{
|
||
|
||
return true, 0.3
|
||
}
|
||
case "None",
|
||
"none":{
|
||
|
||
return true, 1
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
response5Exists, response5 := getResponse5()
|
||
if (response5Exists == true){
|
||
responsesSum += response5
|
||
responsesCount += 1
|
||
}
|
||
|
||
getResponse6 := func()(bool, float64){
|
||
|
||
// Column Name: "Anxiety"
|
||
|
||
userAnxietyRaw := userDataLineSlice[318]
|
||
|
||
switch userAnxietyRaw{
|
||
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case "Ptsd-related",
|
||
"PTSD-related":{
|
||
|
||
return true, 0.3
|
||
}
|
||
case "Diagnosed with anxiety",
|
||
"Diagnosed.",
|
||
"Generalized Anxiety Disorder",
|
||
"Generalized anxiety disorder",
|
||
"Yes",
|
||
"PDD-NOS related anxiety ":{
|
||
|
||
return true, 0.4
|
||
}
|
||
case "Mild, not diagnosed",
|
||
"mild, not diagnosed":{
|
||
|
||
return true, 0.85
|
||
}
|
||
case "No anxiety problems ":{
|
||
|
||
return true, 1
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
response6Exists, response6 := getResponse6()
|
||
if (response6Exists == true){
|
||
responsesSum += response6
|
||
responsesCount += 1
|
||
}
|
||
|
||
// Columns TODO:
|
||
// -"Bipolar disorder"
|
||
// -"Alcohol Consumption (per week)"
|
||
// -"Alcoholism"
|
||
// -"Cocaine addiction"
|
||
// -"Heroin addiction"
|
||
// -"Post traumatic Stress Disorder or PTSD?"
|
||
// -"generalized anxiety disorder"
|
||
// -"Bipolar Disorder (Immediate Family or Personal Diagnosis)"
|
||
// -"Autistic Spectrum Disorder"
|
||
// -"Dissociative Identity Disorder"
|
||
// -"Mood disorders"
|
||
// -"Panic Disorder"
|
||
// -"OCD - Obsessive-Compulsive Disorder"
|
||
// -"Schizophrenia"
|
||
// -"Squizophrenia"
|
||
// -"Ambition"
|
||
// -"Purposefulness"
|
||
// -"Nicotine dependence"
|
||
// -"Autism"
|
||
// -"autism"
|
||
|
||
if (responsesCount == 0){
|
||
return false, 0
|
||
}
|
||
|
||
// We average out all responses
|
||
|
||
result := responsesSum/float64(responsesCount)
|
||
|
||
return true, result
|
||
}
|
||
|
||
userHappinessIsKnown, userHappiness := getUserHappiness()
|
||
|
||
|
||
//Outputs:
|
||
// -bool: User mental illness is known
|
||
// -float64: User mental illness (0-1)
|
||
// -0 == Well adjusted, happy, healthy
|
||
// -1 == Extremely mentally ill
|
||
getUserMentalIllness := func()(bool, float64){
|
||
|
||
// We create a list for each mental illness
|
||
// We take the highest value in the list
|
||
// We do this to find out the worst mental illness the person has
|
||
// For example, if someone has severe depression, but not autism/anxiety/bipolar, they are still extremely mentally ill
|
||
|
||
responsesList := make([]float64, 0)
|
||
|
||
// We use this to see if they ever said they have no general mental illness issues.
|
||
// Without this bool, we would be assuming that people who answered No to one illness do not suffer from any mental illnesses
|
||
// For example, someone could say they don't have autism but still be mentally ill
|
||
generallyHealthyAnswerProvided := false
|
||
|
||
getResponse1 := func()(bool, float64){
|
||
|
||
// Column Name: "Depression"
|
||
|
||
userDepressionRaw := userDataLineSlice[173]
|
||
|
||
switch userDepressionRaw{
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case "No":{
|
||
return true, 0
|
||
}
|
||
case "Yes at times":{
|
||
return true, 0.5
|
||
}
|
||
case "Situational Depression",
|
||
"Situational depression":{
|
||
return true, 0.6
|
||
}
|
||
case "Yes",
|
||
"Diagnosed.":{
|
||
return true, 1
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
response1Exists, response1 := getResponse1()
|
||
if (response1Exists == true){
|
||
|
||
if (response1 == 1){
|
||
return true, 1
|
||
}
|
||
|
||
responsesList = append(responsesList, response1)
|
||
}
|
||
|
||
/*
|
||
//TODO: Replace this with a different column
|
||
// Currently, it provides no useful information in our calculation
|
||
getResponse2 := func()(bool, float64){
|
||
|
||
// Column Name == "Episodic Major Depression"
|
||
|
||
userDepressionRaw := userDataLineSlice[586]
|
||
|
||
switch userDepressionRaw{
|
||
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case "No":{
|
||
return true, 0
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
response2Exists, response2 := getResponse2()
|
||
if (response2Exists == true){
|
||
responsesList = append(responsesList, response2)
|
||
}
|
||
*/
|
||
|
||
getResponse3 := func()(bool, float64){
|
||
|
||
// Column Name == "Suicidality"
|
||
|
||
userSuicidalityRaw := userDataLineSlice[541]
|
||
|
||
switch userSuicidalityRaw{
|
||
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case "Never even thought about suicide",
|
||
"No",
|
||
"never even thought about Suicide":{
|
||
return true, 0
|
||
}
|
||
case "Anxitey, ptsd, major depression without suicidal ideation",
|
||
"Anxitey, PTSD, Major Depression without suicidal ideation",
|
||
"Sometimes think about it but never want to actually kill myself",
|
||
"sometimes think about it but never want to actually kill myself":{
|
||
return true, 0.8
|
||
}
|
||
case "Regular ideation",
|
||
"Several attempts, and/or depression",
|
||
"Multiple attempts, first thought about it at age 9, diagnosed with major depressive disorder and PTSD. Have had passive suicidal ideation for most of my life.":{
|
||
return true, 1
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
response3Exists, response3 := getResponse3()
|
||
if (response3Exists == true){
|
||
|
||
if (response3 == 1){
|
||
return true, 1
|
||
}
|
||
|
||
responsesList = append(responsesList, response3)
|
||
}
|
||
|
||
getResponse4 := func()(bool, float64){
|
||
|
||
// Column Name == "Mental Disease"
|
||
|
||
userMentalDiseaseRaw := userDataLineSlice[165]
|
||
|
||
switch userMentalDiseaseRaw{
|
||
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case "None",
|
||
"none":{
|
||
return true, 0
|
||
}
|
||
case "Major Depressive Disorder, Generalized Anxiety, Binge Eating Disorder",
|
||
"anxiety, ocd, agoraphobia, depression",
|
||
"Anxiety and Depression",
|
||
"Anxiety and depression",
|
||
"Depression",
|
||
"major depressive disorder, PTSD, generalized anxiety, panic disorder, ADD, OCD",
|
||
"Paranoid Schizophrenia",
|
||
"Paranoid schizophrenia",
|
||
"Anxiety (esp. social), depression, ocd, autistic tendencies, maladaptive daydreaming",
|
||
"Anorexia nervosa, anxiety, depression",
|
||
"Adhd, anxiety, depression, adjustment disorder",
|
||
"ADHD, Anxiety, Depression, Adjustment Disorder",
|
||
"Major depressive disorder, dysthymia, asd, social anxiety disorder, ocd, adhd, unspecified dissociative disorder, developmental speech/language disorder",
|
||
"Major depressive disorder, generalized anxiety, binge eating disorder",
|
||
"Major depressive disorder, ptsd, generalized anxiety, panic disorder, add, ocd",
|
||
"Multiple diagnosed",
|
||
"multiple diagnosed",
|
||
"Borderline Personality Disorder ",
|
||
"Ptsd and results of it(dissociative disorder, depression, anxiety), maladaptive daydreaming, and autistic tendencies",
|
||
"Bipolar",
|
||
"Prob a few of them",
|
||
"Asperger's Syndrome, ADHD, schizoaffective bipolar, and Agoraphobia",
|
||
"Bipolar 2, ADHD, PTSD",
|
||
"Bipolar 2, adhd, ptsd",
|
||
"Hypomania/OCD/Anxiety",
|
||
"Panic disorder agoraphobia",
|
||
"panic disorder agoraphobia",
|
||
"SAD depression",
|
||
"Sad depression",
|
||
"Asperger's disorder",
|
||
"PDD-NOS and ADHD",
|
||
"Panic disorder",
|
||
"panic disorder",
|
||
"Schizoid":{
|
||
return true, 1
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
response4Exists, response4 := getResponse4()
|
||
if (response4Exists == true){
|
||
|
||
if (response4 == 1){
|
||
return true, 1
|
||
}
|
||
|
||
responsesList = append(responsesList, response4)
|
||
|
||
if (response4 == 0){
|
||
generallyHealthyAnswerProvided = true
|
||
}
|
||
}
|
||
|
||
getResponse5 := func()(bool, float64){
|
||
|
||
// Column Name == "Personality Disorder test - top result"
|
||
|
||
userPersonalityDisorderRaw := userDataLineSlice[193]
|
||
|
||
switch userPersonalityDisorderRaw{
|
||
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case "None",
|
||
"none":{
|
||
return true, 0
|
||
}
|
||
case "Antisocial and cold",
|
||
"Antisocial",
|
||
"Avoidant",
|
||
"Avoidant+":{
|
||
return true, 0.5
|
||
}
|
||
case "Anxiety",
|
||
"anxiety",
|
||
"Aspergers",
|
||
"Ocd",
|
||
"Obsessive-Compulsive+",
|
||
"Obsessive-Compulsive",
|
||
"Ocd add asd",
|
||
"OCD ADD ASD":{
|
||
return true, 0.7
|
||
}
|
||
case "Depression",
|
||
"Anxiety and depression",
|
||
"Multiple anxiety disorders, depression, chronic insomnia",
|
||
"Depression add aspergers panic disorder",
|
||
"Prob 3 or more of them",
|
||
"Anxiety (esp. social), depression, OCD, autistic tendencies, maladaptive daydreaming",
|
||
"depression",
|
||
"depression add aspergers panic disorder",
|
||
"Borderline",
|
||
"Schizotypal",
|
||
"Anxiety, ocd, bipolar 1 wo psychosis",
|
||
"Paranoid +",
|
||
"Passive aggressive, Paranoid ",
|
||
"-Paranoid (I'm not, but I am schizoid (2nd result)":{
|
||
return true, 1
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
response5Exists, response5 := getResponse5()
|
||
if (response5Exists == true){
|
||
|
||
if (response5 == 1){
|
||
return true, 1
|
||
}
|
||
|
||
responsesList = append(responsesList, response5)
|
||
|
||
if (response5 == 0){
|
||
generallyHealthyAnswerProvided = true
|
||
}
|
||
}
|
||
|
||
getResponse6 := func()(bool, float64){
|
||
|
||
// Column Name: "Anxiety"
|
||
|
||
userAnxietyRaw := userDataLineSlice[318]
|
||
|
||
switch userAnxietyRaw{
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case "No anxiety problems ":{
|
||
return true, 0
|
||
}
|
||
case "Mild, not diagnosed",
|
||
"mild, not diagnosed":{
|
||
return true, 0.35
|
||
}
|
||
case "Ptsd-related",
|
||
"PTSD-related":{
|
||
return true, 0.6
|
||
}
|
||
case "Diagnosed with anxiety",
|
||
"Diagnosed.",
|
||
"Generalized Anxiety Disorder",
|
||
"Generalized anxiety disorder",
|
||
"Yes",
|
||
"PDD-NOS related anxiety ":{
|
||
return true, 0.65
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
response6Exists, response6 := getResponse6()
|
||
if (response6Exists == true){
|
||
|
||
responsesList = append(responsesList, response6)
|
||
|
||
if (response6 == 0){
|
||
generallyHealthyAnswerProvided = true
|
||
}
|
||
}
|
||
|
||
getResponse7 := func()(bool, float64){
|
||
|
||
// Column Name == "generalized anxiety disorder"
|
||
|
||
userAnxietyDisorderRaw := userDataLineSlice[573]
|
||
|
||
switch userAnxietyDisorderRaw{
|
||
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case "Nope",
|
||
"No":{
|
||
return true, 0
|
||
}
|
||
case "Generalized anxiety disorder",
|
||
"generalized anxiety disorder":{
|
||
return true, 0.65
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
response7Exists, response7 := getResponse7()
|
||
if (response7Exists == true){
|
||
responsesList = append(responsesList, response7)
|
||
}
|
||
|
||
getResponse8 := func()(bool, float64){
|
||
|
||
// Column Name == "Panic Disorder"
|
||
|
||
userPanicDisorderRaw := userDataLineSlice[115]
|
||
|
||
switch userPanicDisorderRaw{
|
||
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case "No":{
|
||
return true, 0
|
||
}
|
||
case "I have minor Panic Disorder, its in remission and almost gone I was in my 20s",
|
||
"I have minor panic disorder, its in remission and almost gone i was in my 20s":{
|
||
return true, 0.25
|
||
}
|
||
case "Slight",
|
||
"Yes, when extremely stressed":{
|
||
return true, 0.3
|
||
}
|
||
case "Undiagnosed but sometimes severe, other times in remission":{
|
||
return true, 0.6
|
||
}
|
||
case "Yes, since early childhood.",
|
||
"Yes",
|
||
"Yes, age 15",
|
||
"Yes, age 17",
|
||
"Yes, age 20",
|
||
"Yes, age 22",
|
||
"Yes, age 30",
|
||
"Yes, age 37 controlled with medication":{
|
||
return true, 0.8
|
||
}
|
||
case "Severe panic and anxiety ":{
|
||
return true, 1
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
response8Exists, response8 := getResponse8()
|
||
if (response8Exists == true){
|
||
|
||
if (response8 == 1){
|
||
return true, 1
|
||
}
|
||
|
||
responsesList = append(responsesList, response8)
|
||
}
|
||
|
||
getResponse9 := func()(bool, float64){
|
||
|
||
// Column Name == "Schizophrenia"
|
||
|
||
userSchizophreniaRaw := userDataLineSlice[668]
|
||
|
||
switch userSchizophreniaRaw{
|
||
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case "No":{
|
||
return true, 0
|
||
}
|
||
case "Diagnosed Schizoaffective bipolar subtype":{
|
||
return true, 1
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
response9Exists, response9 := getResponse9()
|
||
if (response9Exists == true){
|
||
|
||
if (response9 == 1){
|
||
return true, 1
|
||
}
|
||
|
||
responsesList = append(responsesList, response9)
|
||
}
|
||
|
||
getResponse10 := func()(bool, float64){
|
||
|
||
// Column Name == "Squizophrenia"
|
||
|
||
userSchizophreniaRaw := userDataLineSlice[225]
|
||
|
||
switch userSchizophreniaRaw{
|
||
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case "No", "no":{
|
||
return true, 0
|
||
}
|
||
case "Yes":{
|
||
return true, 1
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
response10Exists, response10 := getResponse10()
|
||
if (response10Exists == true){
|
||
|
||
if (response10 == 1){
|
||
return true, 1
|
||
}
|
||
|
||
responsesList = append(responsesList, response10)
|
||
}
|
||
|
||
getResponse11 := func()(bool, float64){
|
||
|
||
// Column Name == "Mood disorders"
|
||
|
||
userMoodDisorderRaw := userDataLineSlice[719]
|
||
|
||
switch userMoodDisorderRaw{
|
||
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case "Bipolar II disorder, Substance/medication-induced bipolar disorder":{
|
||
return true, 1
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
response11Exists, response11 := getResponse11()
|
||
if (response11Exists == true){
|
||
|
||
if (response11 == 1){
|
||
return true, 1
|
||
}
|
||
|
||
responsesList = append(responsesList, response11)
|
||
}
|
||
|
||
getResponse12 := func()(bool, float64){
|
||
|
||
// Column Name: "Autism"
|
||
|
||
userAutismRaw := userDataLineSlice[151]
|
||
|
||
switch userAutismRaw{
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case "No",
|
||
"No, but have autistic daughter",
|
||
"No, though there are tendencies":{
|
||
return true, 0
|
||
}
|
||
case "Very High Functioning Asperger's",
|
||
"Very high functioning asperger's",
|
||
"Unofficial high functioning autism",
|
||
"Unofficial High Functioning Autism",
|
||
"High-functioning autism",
|
||
"High-Functioning Autism",
|
||
"Asperger traits":{
|
||
|
||
return true, 0.7
|
||
}
|
||
case "Yes",
|
||
"Autism spectrum disorder",
|
||
"Aspie",
|
||
"Yes. Autistic. ",
|
||
"Yes. autistic. ",
|
||
"classical autism",
|
||
"my snps say carry the genes and i think so myself",
|
||
"My snps say carry the genes and i think so myself",
|
||
"Aspergers",
|
||
"Asperger",
|
||
"Asperger unofficial diagnosis",
|
||
"Regressive autism":{
|
||
|
||
return true, 0.8
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
response12Exists, response12 := getResponse12()
|
||
if (response12Exists == true){
|
||
responsesList = append(responsesList, response12)
|
||
}
|
||
|
||
getResponse13 := func()(bool, float64){
|
||
|
||
// Column Name: "Bipolar disorder"
|
||
|
||
userBipolarDisorderRaw := userDataLineSlice[476]
|
||
|
||
switch userBipolarDisorderRaw{
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case "No",
|
||
"Don't have it",
|
||
"don't have it":{
|
||
|
||
return true, 0
|
||
}
|
||
case "Schizoaffective Bipolar Sybtype",
|
||
"Type i",
|
||
"Bipolar II",
|
||
"Bipolar affective disorder",
|
||
"Bipolar i",
|
||
"Bipolar ii":{
|
||
|
||
return true, 1
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
response13Exists, response13 := getResponse13()
|
||
if (response13Exists == true){
|
||
|
||
if (response13 == 1){
|
||
return true, 1
|
||
}
|
||
|
||
responsesList = append(responsesList, response13)
|
||
}
|
||
|
||
getResponse14 := func()(bool, float64){
|
||
|
||
// Column Name == "autism"
|
||
|
||
userAutismRaw := userDataLineSlice[327]
|
||
|
||
switch userAutismRaw{
|
||
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case "No",
|
||
"no",
|
||
"No but have genetic markers and an autistic son.":{
|
||
return true, 0
|
||
}
|
||
case "Borderline":{
|
||
return true, 0.6
|
||
}
|
||
case "Spectrum",
|
||
"spectrum":{
|
||
return true, 0.8
|
||
}
|
||
case "asperger's syndrome",
|
||
"Asperger's syndrome":{
|
||
return true, 0.9
|
||
}
|
||
case "Diagnosed as PDD-NOS & then ASD",
|
||
"Diagnosed as pdd-nos & then asd":{
|
||
return true, 1
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
response14Exists, response14 := getResponse14()
|
||
if (response14Exists == true){
|
||
|
||
if (response14 == 1){
|
||
return true, 1
|
||
}
|
||
|
||
responsesList = append(responsesList, response14)
|
||
}
|
||
|
||
getResponse15 := func()(bool, float64){
|
||
|
||
// Column Name == "OCD - Obsessive-Compulsive Disorder"
|
||
|
||
userOCDRaw := userDataLineSlice[488]
|
||
|
||
switch userOCDRaw{
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case "No",
|
||
"no":{
|
||
return true, 0
|
||
}
|
||
case "OCD tendencies",
|
||
"Ocd tendencies":{
|
||
return true, 0.5
|
||
}
|
||
case "Yes",
|
||
"Yes- medically diagnosed",
|
||
"Yes- Medically diagnosed":{
|
||
return true, 0.8
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
response15Exists, response15 := getResponse15()
|
||
if (response15Exists == true){
|
||
responsesList = append(responsesList, response15)
|
||
}
|
||
|
||
getResponse16 := func()(bool, float64){
|
||
|
||
// Column Name == "Alcoholism"
|
||
|
||
userAlcoholismRaw := userDataLineSlice[419]
|
||
|
||
switch userAlcoholismRaw{
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case "No",
|
||
"None",
|
||
"none":{
|
||
return true, 0
|
||
}
|
||
case "Father was full-blown alcoholic, struggle with overindulgence. Able to avoid for long periods of time but takes larger amounts of will power than is probably normal or ideal.":{
|
||
return true, 0.25
|
||
}
|
||
case "Yes":{
|
||
return true, 0.8
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
response16Exists, response16 := getResponse16()
|
||
if (response16Exists == true){
|
||
responsesList = append(responsesList, response16)
|
||
}
|
||
|
||
// Columns TODO:
|
||
// -"Alcohol Consumption (per week)"
|
||
// -"Alcoholism "
|
||
// -"Cocaine addiction"
|
||
// -"Heroin addiction"
|
||
// -"Post traumatic Stress Disorder or PTSD?"
|
||
// -"Bipolar Disorder (Immediate Family or Personal Diagnosis)"
|
||
// -"Ambition"
|
||
// -"Purposefulness"
|
||
// -"Nicotine dependence"
|
||
|
||
if (len(responsesList) == 0){
|
||
return false, 0
|
||
}
|
||
|
||
// We find the largest item in the slice
|
||
|
||
result := slices.Max(responsesList)
|
||
|
||
if (result == 0){
|
||
// We must make sure they answered 0 to at least 1 of the general mental illness questions.
|
||
// Without this bool, we would be assuming that people who answered No to one illness do not suffer from any mental illnesses
|
||
// For example, they answered No to Autism, but they never said they don't have a mental illness.
|
||
if (generallyHealthyAnswerProvided == true){
|
||
return true, 0
|
||
}
|
||
return false, 0
|
||
}
|
||
|
||
return true, result
|
||
}
|
||
|
||
userMentalIllnessIsKnown, userMentalIllness := getUserMentalIllness()
|
||
|
||
getUserHomosexualness := func()(bool, float64){
|
||
|
||
// Outputs:
|
||
// -bool: Raw sexuality is known
|
||
// -float64: Raw homosexualness
|
||
// - 0 == Heterosexual (No homosexual desires)
|
||
// - 0.5 == Bisexual desires
|
||
// - 1 == Homosexual (No heterosexual desires)
|
||
convertRawSexualityToHomosexualness := func(inputRawSexuality string)(bool, float64){
|
||
|
||
switch inputRawSexuality{
|
||
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
|
||
case "Hetero",
|
||
"Heterosexual",
|
||
"Opposite sex attraction",
|
||
"opposite sex attraction":{
|
||
return true, 0
|
||
}
|
||
case "Mostly opposite",
|
||
"Hetero with some extra variations":{
|
||
return true, 0.2
|
||
}
|
||
case "Opposite sex is somewhat more attractive":{
|
||
return true, 0.4
|
||
}
|
||
case "Bisexual",
|
||
"both",
|
||
"Both",
|
||
"Pansexual",
|
||
"Attracted to androgynes/hermaphrodites":{
|
||
return true, 0.5
|
||
}
|
||
case "Bisexual/lesbian in 11 year same sexunion":{
|
||
return true, 0.6
|
||
}
|
||
case "Homo-flexable":{
|
||
return true, 0.7
|
||
}
|
||
case "Mostly same-sex":{
|
||
return true, 0.8
|
||
}
|
||
case "Exclusively Homosexual",
|
||
"Exclusively homosexual",
|
||
"Same Sex Attraction",
|
||
"Same sex attraction",
|
||
"Gay",
|
||
"gay":{
|
||
return true, 1
|
||
}
|
||
case "Females only",
|
||
"Just my girl ❤️":{
|
||
// We have to figure out what sex these people are
|
||
|
||
// Column Name: "Sex"
|
||
|
||
userSexRaw := userDataLineSlice[52]
|
||
|
||
switch userSexRaw{
|
||
case "Male":{
|
||
return true, 0
|
||
}
|
||
case "Female":{
|
||
return true, 1
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
getResponse1 := func()(bool, float64){
|
||
|
||
// Column Name: "Sexuality"
|
||
|
||
userSexualityRaw := userDataLineSlice[251]
|
||
|
||
userHomosexualnessIsKnown, userHomosexualness := convertRawSexualityToHomosexualness(userSexualityRaw)
|
||
|
||
return userHomosexualnessIsKnown, userHomosexualness
|
||
}
|
||
|
||
response1Exists, response1 := getResponse1()
|
||
|
||
getResponse2 := func()(bool, float64){
|
||
|
||
// Column Name: "Sexual Preferences"
|
||
|
||
userSexualPreferencesRaw := userDataLineSlice[116]
|
||
|
||
userHomosexualnessIsKnown, userHomosexualness := convertRawSexualityToHomosexualness(userSexualPreferencesRaw)
|
||
|
||
return userHomosexualnessIsKnown, userHomosexualness
|
||
}
|
||
|
||
response2Exists, response2 := getResponse2()
|
||
|
||
if (response1Exists == true && response2Exists == true){
|
||
// We average both responses
|
||
|
||
result := (response1 + response2)/2
|
||
|
||
return true, result
|
||
}
|
||
if (response1Exists == true){
|
||
return true, response1
|
||
}
|
||
if (response2Exists == true){
|
||
return true, response2
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
userHomosexualnessIsKnown, userHomosexualness := getUserHomosexualness()
|
||
|
||
//Outputs:
|
||
// -bool: User Supernaturalism is known
|
||
// -float64: User Supernaturalism (0-1)
|
||
// -0 == No belief in the supernatural
|
||
// -1 == Extremely supernaturalistic
|
||
getUserSupernaturalism := func()(bool, float64){
|
||
|
||
// We sum all known responses and average them out
|
||
|
||
responsesSum := float64(0)
|
||
responsesCount := 0
|
||
|
||
getResponse1 := func()(bool, float64){
|
||
|
||
// Column Name: "Atheism"
|
||
|
||
userAtheismRaw := userDataLineSlice[65]
|
||
|
||
switch userAtheismRaw{
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case "Atheist",
|
||
"Science oriented ",
|
||
"science oriented ",
|
||
"Humanist",
|
||
"humanist":{
|
||
return true, 0
|
||
}
|
||
case "Atheist but pantheist/gnostic positive",
|
||
"atheist but pantheist/gnostic positive":{
|
||
return true, 0.1
|
||
}
|
||
case "Agnostic",
|
||
"Agnostic atheist":{
|
||
return true, 0.25
|
||
}
|
||
case "Atheist...but pagan curious",
|
||
"atheist...but pagan curious":{
|
||
return true, 0.3
|
||
}
|
||
case "Weakly believer",
|
||
"weakly believer",
|
||
"Agnostic Polytheist",
|
||
"Agnostic polytheist":{
|
||
return true, 0.4
|
||
}
|
||
case "I am a christian and I am science oriented. ",
|
||
"I am a christian and i am science oriented. ":{
|
||
return true, 0.75
|
||
}
|
||
case "Christian!",
|
||
"i believe in our inherent electrochemical energy ",
|
||
"I believe in our inherent electrochemical energy ",
|
||
"Consciousness is self referential, belief in perfected consciousness , group consciousness, self similarity, and reflected wish fulfillment ",
|
||
"No ",
|
||
"no ",
|
||
"No",
|
||
"I belive there is a god but i dont know what it looks like or where it is mother earth is a god in its self",
|
||
"Panentheist Theosophist Daoist WIccan w/Asatru & Native Am. Contributions",
|
||
"Panentheist theosophist daoist wiccan w/asatru & native am. contributions",
|
||
"Polytheist",
|
||
"Pantheist",
|
||
"pantheist",
|
||
"polytheist",
|
||
"Modern Paganism",
|
||
"Spiritual Humanist",
|
||
"Spiritual humanist",
|
||
"ancestor veneration/ indigenous beliefs":{
|
||
return true, 1
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
response1Exists, response1 := getResponse1()
|
||
if (response1Exists == true){
|
||
responsesSum += response1
|
||
responsesCount += 1
|
||
}
|
||
|
||
getResponse2 := func()(bool, float64){
|
||
|
||
// Column Name == "Interest in Spirituality and Mysticism"
|
||
|
||
userSpiritualityRaw := userDataLineSlice[32]
|
||
|
||
switch userSpiritualityRaw{
|
||
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case "None",
|
||
"none",
|
||
"No",
|
||
"Strong interest in childhood, then interested in philosophy, science & psychology as an adult":{
|
||
return true, 0
|
||
}
|
||
case "Slight":{
|
||
return true, 0.2
|
||
}
|
||
case "Medium",
|
||
"medium",
|
||
"agnostic but highly interested at times",
|
||
"Agnostic but highly interested at times":{
|
||
return true, 0.5
|
||
}
|
||
case "STRONG",
|
||
"Strong",
|
||
"Yes",
|
||
"I belive in the spirits and the other side":{
|
||
return true, 1
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
response2Exists, response2 := getResponse2()
|
||
if (response2Exists == true){
|
||
responsesSum += response2
|
||
responsesCount += 1
|
||
}
|
||
|
||
if (responsesCount == 0){
|
||
return false, 0
|
||
}
|
||
|
||
// We average out all responses
|
||
|
||
result := responsesSum/float64(responsesCount)
|
||
|
||
return true, result
|
||
}
|
||
|
||
userSupernaturalismIsKnown, userSupernaturalism := getUserSupernaturalism()
|
||
|
||
|
||
//Outputs:
|
||
// -bool: User obesity is known
|
||
// -float64: User Obesity (0-1)
|
||
// -0 == Skinny
|
||
// -1 == Extremely obese
|
||
getUserObesity := func()(bool, float64){
|
||
|
||
// We sum all known responses and average them out
|
||
|
||
responsesSum := float64(0)
|
||
responsesCount := 0
|
||
|
||
getResponse1 := func()(bool, float64){
|
||
|
||
//Outputs:
|
||
// -bool: Weight is known
|
||
// -float64: Weight (in kilograms)
|
||
getUserWeight := func()(bool, float64){
|
||
|
||
// Column Name: "Weight"
|
||
|
||
userWeightRaw := userDataLineSlice[130]
|
||
|
||
switch userWeightRaw{
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case "102lbs 46kg":{
|
||
return true, 46
|
||
}
|
||
case "74kg / 164lbs":{
|
||
return true, 74
|
||
}
|
||
case "108 - 114 lbs most of adult life":{
|
||
return true, 111
|
||
}
|
||
case "15 Stone":{
|
||
return true, 95.2544
|
||
}
|
||
case "108 lbs entire adult life (excluding predgnancy and 1 month post baby)":{
|
||
return true, 48.98798
|
||
}
|
||
|
||
// The rest of these responses have no units
|
||
// We are just assuming they are in pounds, but they actually could be kg.
|
||
case "120":{
|
||
return true, 54.43108
|
||
}
|
||
case "142":{
|
||
return true, 64.41012
|
||
}
|
||
case "162":{
|
||
return true, 73.48196
|
||
}
|
||
case "290":{
|
||
return true, 131.5418
|
||
}
|
||
case "50":{
|
||
// We assume this is Kilograms
|
||
return true, 50
|
||
}
|
||
}
|
||
|
||
// We try a few suffixes
|
||
|
||
kilogramSuffixesList := []string{"kg", " kg", " Kg", " kgs"}
|
||
|
||
for _, kilogramSuffix := range kilogramSuffixesList{
|
||
|
||
trimmedWeight, suffixExists := strings.CutSuffix(userWeightRaw, kilogramSuffix)
|
||
if (suffixExists == true){
|
||
trimmedWeightFloat64, err := helpers.ConvertStringToFloat64(trimmedWeight)
|
||
if (err == nil){
|
||
return true, trimmedWeightFloat64
|
||
}
|
||
}
|
||
}
|
||
|
||
poundSuffixesList := []string{" lbs.", " lbs", " Lbs", "lbs", " lb", "lbs", " pounds"}
|
||
|
||
for _, poundSuffix := range poundSuffixesList{
|
||
|
||
trimmedWeight, suffixExists := strings.CutSuffix(userWeightRaw, poundSuffix)
|
||
if (suffixExists == true){
|
||
trimmedWeightFloat64, err := helpers.ConvertStringToFloat64(trimmedWeight)
|
||
if (err == nil){
|
||
|
||
// We convert pounds to kilograms
|
||
|
||
weightInKilograms := trimmedWeightFloat64 * 0.4535924
|
||
|
||
return true, weightInKilograms
|
||
}
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
userWeightIsKnown, userWeight := getUserWeight()
|
||
if (userWeightIsKnown == false){
|
||
return false, 0
|
||
}
|
||
|
||
// We calculate Body Mass Index (BMI)
|
||
|
||
// This is the BMI Guide:
|
||
//-Very severely underweight
|
||
// -Less than 15
|
||
//-Severely underweight
|
||
// -15 - 15.9
|
||
//-Underweight
|
||
// -16 - 18.4
|
||
//-Normal (healthy)
|
||
// -18.5 - 24.9
|
||
//-Overweight
|
||
// -25 - 29.9
|
||
//-Moderately obese
|
||
// -30 - 34.9
|
||
//-Severely obese
|
||
// -35 - 39.9
|
||
//-Very severely obese
|
||
// -40+
|
||
|
||
// BMI (kg/m2) = Weight (kilograms) / height (in meters)^2
|
||
|
||
if (userHeightIsKnown == false){
|
||
return false, 0
|
||
}
|
||
|
||
userHeightInMeters := userHeight/100
|
||
|
||
bmi := userWeight / (userHeightInMeters * userHeightInMeters)
|
||
|
||
if (bmi < 20){
|
||
return true, 0
|
||
}
|
||
if (bmi < 25){
|
||
return true, 0.1
|
||
}
|
||
if (bmi < 30){
|
||
return true, 0.6
|
||
}
|
||
|
||
return true, 1
|
||
}
|
||
|
||
response1Exists, response1 := getResponse1()
|
||
if (response1Exists == true){
|
||
responsesSum += response1
|
||
responsesCount += 1
|
||
}
|
||
|
||
getResponse2 := func()(bool, float64){
|
||
|
||
// Column Name == "natural skinny"
|
||
|
||
userNaturalSkinnyRaw := userDataLineSlice[66]
|
||
|
||
switch userNaturalSkinnyRaw{
|
||
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case "Yes",
|
||
"yes",
|
||
"Not sickly-skinny but naturally slim",
|
||
"Unable to gain weight":{
|
||
return true, 0
|
||
}
|
||
case "Yes when young",
|
||
"Yes - especially as a kid (went into low-normal range as adult)",
|
||
"yes - especially as a kid (went into low-normal range as adult)",
|
||
"Yes-trouble maintaining weight until menopause, now overweight. ":{
|
||
return true, 0.1
|
||
}
|
||
case "Average",
|
||
"Very slim as child, now average. 6'0 180lbs":{
|
||
return true, 0.3
|
||
}
|
||
case "Was always very thin as kid and in twenties, couldn't gain weight, changed around age 30 and now am slightly overweight and can't lose it":{
|
||
return true, 0.4
|
||
}
|
||
case "Yes - as a kid":{
|
||
return true, 0.5
|
||
}
|
||
case "Heavy as a child, now thin":{
|
||
return true, 0.6
|
||
}
|
||
case "Overweight but can lose":{
|
||
return true, 0.8
|
||
}
|
||
case "No",
|
||
"no",
|
||
"Obese",
|
||
"obese",
|
||
"Very skinny as child, didnt gain weight but now, overweight, trouble losing it",
|
||
"very skinny as child, didnt gain weight but now, overweight, trouble losing it",
|
||
"overweight as a child, lost many times, now back to obese as an adult":{
|
||
return true, 1
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
response2Exists, response2 := getResponse2()
|
||
if (response2Exists == true){
|
||
responsesSum += response2
|
||
responsesCount += 1
|
||
}
|
||
|
||
if (responsesCount == 0){
|
||
return false, 0
|
||
}
|
||
|
||
// We average out all responses
|
||
|
||
result := responsesSum/float64(responsesCount)
|
||
|
||
return true, result
|
||
}
|
||
|
||
userObesityIsKnown, userObesity := getUserObesity()
|
||
|
||
//Outputs:
|
||
// -bool: User anxiety is known
|
||
// -float64: User Anxiety (0-1)
|
||
// -0 == Calm
|
||
// -1 == Extremely anxious
|
||
getUserAnxiety := func()(bool, float64){
|
||
|
||
// We create a list with all responses
|
||
// We will return the highest value in the list in the end
|
||
|
||
userResponsesList := make([]float64, 0)
|
||
|
||
getResponse1 := func()(bool, float64){
|
||
|
||
// Column Name: "Anxiety"
|
||
|
||
userAnxietyRaw := userDataLineSlice[318]
|
||
|
||
switch userAnxietyRaw{
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case "No anxiety problems ":{
|
||
|
||
return true, 0
|
||
}
|
||
case "Mild, not diagnosed",
|
||
"mild, not diagnosed":{
|
||
|
||
return true, 0.5
|
||
}
|
||
case "Ptsd-related",
|
||
"PTSD-related":{
|
||
|
||
return true, 0.8
|
||
}
|
||
case "Diagnosed with anxiety",
|
||
"Diagnosed.",
|
||
"Generalized Anxiety Disorder",
|
||
"Generalized anxiety disorder",
|
||
"Yes",
|
||
"PDD-NOS related anxiety ":{
|
||
|
||
return true, 1
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
response1Exists, response1 := getResponse1()
|
||
if (response1Exists == true){
|
||
|
||
if (response1 == 1){
|
||
return true, 1
|
||
}
|
||
|
||
userResponsesList = append(userResponsesList, response1)
|
||
}
|
||
|
||
getResponse2 := func()(bool, float64){
|
||
|
||
// Column Name == "generalized anxiety disorder"
|
||
|
||
userAnxietyDisorderRaw := userDataLineSlice[573]
|
||
|
||
switch userAnxietyDisorderRaw{
|
||
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case "Nope",
|
||
"No":{
|
||
|
||
return true, 0
|
||
}
|
||
case "Generalized anxiety disorder",
|
||
"generalized anxiety disorder":{
|
||
|
||
return true, 1
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
response2Exists, response2 := getResponse2()
|
||
if (response2Exists == true){
|
||
|
||
if (response2 == 1){
|
||
return true, 1
|
||
}
|
||
|
||
userResponsesList = append(userResponsesList, response2)
|
||
}
|
||
|
||
getResponse3 := func()(bool, float64){
|
||
|
||
// Column Name == "Mood disorders"
|
||
|
||
userMoodDisorderRaw := userDataLineSlice[719]
|
||
|
||
switch userMoodDisorderRaw{
|
||
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case "Bipolar II disorder, Substance/medication-induced bipolar disorder":{
|
||
return true, 0.8
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
response3Exists, response3 := getResponse3()
|
||
if (response3Exists == true){
|
||
|
||
if (response3 == 1){
|
||
return true, 1
|
||
}
|
||
|
||
userResponsesList = append(userResponsesList, response3)
|
||
}
|
||
|
||
getResponse4 := func()(bool, float64){
|
||
|
||
// Column Name == "Personality Disorder test - top result"
|
||
|
||
userPersonalityDisorderRaw := userDataLineSlice[193]
|
||
|
||
switch userPersonalityDisorderRaw{
|
||
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case "None",
|
||
"none":{
|
||
|
||
return true, 0
|
||
}
|
||
case "Aspergers":{
|
||
|
||
return true, 0.2
|
||
}
|
||
case "Depression",
|
||
"depression":{
|
||
|
||
return true, 0.3
|
||
}
|
||
case "Antisocial and cold",
|
||
"Antisocial",
|
||
"Avoidant",
|
||
"Avoidant+":{
|
||
|
||
return true, 0.5
|
||
}
|
||
case "Borderline":{
|
||
|
||
return true, 0.8
|
||
}
|
||
case "Anxiety",
|
||
"Schizotypal",
|
||
"anxiety",
|
||
"Ocd",
|
||
"Obsessive-Compulsive+",
|
||
"Obsessive-Compulsive",
|
||
"Ocd add asd",
|
||
"OCD ADD ASD",
|
||
"-Paranoid (I'm not, but I am schizoid (2nd result)",
|
||
"Anxiety (esp. social), depression, OCD, autistic tendencies, maladaptive daydreaming",
|
||
"Anxiety and depression",
|
||
"Multiple anxiety disorders, depression, chronic insomnia",
|
||
"Anxiety, ocd, bipolar 1 wo psychosis",
|
||
"depression add aspergers panic disorder",
|
||
"Paranoid +",
|
||
"Passive aggressive, Paranoid ",
|
||
"Depression add aspergers panic disorder",
|
||
"Prob 3 or more of them":{
|
||
|
||
return true, 1
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
response4Exists, response4 := getResponse4()
|
||
if (response4Exists == true){
|
||
|
||
if (response4 == 1){
|
||
return true, 1
|
||
}
|
||
|
||
userResponsesList = append(userResponsesList, response4)
|
||
}
|
||
|
||
getResponse5 := func()(bool, float64){
|
||
|
||
// Column Name == "Panic Disorder"
|
||
|
||
userPanicDisorderRaw := userDataLineSlice[115]
|
||
|
||
switch userPanicDisorderRaw{
|
||
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case "No":{
|
||
return true, 0
|
||
}
|
||
case "I have minor Panic Disorder, its in remission and almost gone I was in my 20s",
|
||
"I have minor panic disorder, its in remission and almost gone i was in my 20s":{
|
||
return true, 0.25
|
||
}
|
||
case "Slight",
|
||
"Yes, when extremely stressed":{
|
||
return true, 0.4
|
||
}
|
||
case "Undiagnosed but sometimes severe, other times in remission":{
|
||
return true, 0.6
|
||
}
|
||
case "Severe panic and anxiety ",
|
||
"Yes, since early childhood.",
|
||
"Yes",
|
||
"Yes, age 15",
|
||
"Yes, age 17",
|
||
"Yes, age 20",
|
||
"Yes, age 22",
|
||
"Yes, age 30",
|
||
"Yes, age 37 controlled with medication":{
|
||
return true, 1
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
response5Exists, response5 := getResponse5()
|
||
if (response5Exists == true){
|
||
|
||
if (response5 == 1){
|
||
return true, 1
|
||
}
|
||
|
||
userResponsesList = append(userResponsesList, response5)
|
||
}
|
||
|
||
getResponse6 := func()(bool, float64){
|
||
|
||
// Column Name == "Mental Disease"
|
||
|
||
userMentalDiseaseRaw := userDataLineSlice[165]
|
||
|
||
switch userMentalDiseaseRaw{
|
||
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case "None",
|
||
"none":{
|
||
return true, 0
|
||
}
|
||
case "Asperger's disorder":{
|
||
return true, 0.2
|
||
}
|
||
case "SAD depression",
|
||
"Sad depression":{
|
||
return true, 0.25
|
||
}
|
||
case "Depression":{
|
||
return true, 0.3
|
||
}
|
||
case "PDD-NOS and ADHD",
|
||
"Schizoid",
|
||
"Bipolar":{
|
||
return true, 0.7
|
||
}
|
||
case "Anxiety",
|
||
"Major depressive disorder, generalized anxiety, binge eating disorder",
|
||
"major depressive disorder, PTSD, generalized anxiety, panic disorder, ADD, OCD",
|
||
"Paranoid Schizophrenia",
|
||
"Paranoid schizophrenia",
|
||
"Anxiety (esp. social), depression, ocd, autistic tendencies, maladaptive daydreaming",
|
||
"Anorexia nervosa, anxiety, depression",
|
||
"Adhd, anxiety, depression, adjustment disorder",
|
||
"ADHD, Anxiety, Depression, Adjustment Disorder",
|
||
"Major depressive disorder, dysthymia, asd, social anxiety disorder, ocd, adhd, unspecified dissociative disorder, developmental speech/language disorder",
|
||
"Major Depressive Disorder, Generalized Anxiety, Binge Eating Disorder",
|
||
"anxiety, ocd, agoraphobia, depression",
|
||
"Anxiety and Depression",
|
||
"Anxiety and depression",
|
||
"Panic disorder",
|
||
"panic disorder",
|
||
"Asperger's Syndrome, ADHD, schizoaffective bipolar, and Agoraphobia",
|
||
"Panic disorder agoraphobia",
|
||
"panic disorder agoraphobia",
|
||
"Prob a few of them",
|
||
"Bipolar 2, ADHD, PTSD",
|
||
"Bipolar 2, adhd, ptsd",
|
||
"Hypomania/OCD/Anxiety",
|
||
"Borderline Personality Disorder ",
|
||
"Ptsd and results of it(dissociative disorder, depression, anxiety), maladaptive daydreaming, and autistic tendencies",
|
||
"Major depressive disorder, ptsd, generalized anxiety, panic disorder, add, ocd",
|
||
"Multiple diagnosed",
|
||
"multiple diagnosed":{
|
||
return true, 1
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
response6Exists, response6 := getResponse6()
|
||
if (response6Exists == true){
|
||
|
||
if (response6 == 1){
|
||
return true, 1
|
||
}
|
||
|
||
userResponsesList = append(userResponsesList, response6)
|
||
}
|
||
|
||
//Columns TODO:
|
||
// -"Bipolar disorder"
|
||
// -"Alcohol Consumption (per week)"
|
||
// -"Alcoholism"
|
||
// -"Cocaine addiction"
|
||
// -"Heroin addiction"
|
||
// -"Post traumatic Stress Disorder or PTSD?"
|
||
// -"Bipolar Disorder (Immediate Family or Personal Diagnosis)"
|
||
// -"Autistic Spectrum Disorder"
|
||
// -"Dissociative Identity Disorder"
|
||
// -"OCD - Obsessive-Compulsive Disorder"
|
||
// -"Schizophrenia"
|
||
// -"Squizophrenia"
|
||
// -"Ambition"
|
||
// -"Purposefulness"
|
||
// -"Nicotine dependence"
|
||
// -"Autism"
|
||
// -"autism"
|
||
// -"Suicidality"
|
||
|
||
if (len(userResponsesList) == 0){
|
||
return false, 0
|
||
}
|
||
|
||
// We return the largest value in the list
|
||
result := slices.Max(userResponsesList)
|
||
|
||
return true, result
|
||
}
|
||
|
||
userAnxietyIsKnown, userAnxiety := getUserAnxiety()
|
||
|
||
//Outputs:
|
||
// -bool: User autism is known
|
||
// -float64: User Anxiety (0-1)
|
||
// -0 == No autism
|
||
// -1 == Extremely autistic
|
||
getUserAutism := func()(bool, float64){
|
||
|
||
// We create a list with all responses
|
||
// We return the highest value in the list in the end
|
||
|
||
userResponsesList := make([]float64, 0)
|
||
|
||
getResponse1 := func()(bool, float64){
|
||
|
||
// Column Name: "Autism"
|
||
|
||
userAutismRaw := userDataLineSlice[151]
|
||
|
||
switch userAutismRaw{
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case "No",
|
||
"No, but have autistic daughter":{
|
||
|
||
return true, 0
|
||
}
|
||
case "No, though there are tendencies":{
|
||
|
||
return true, 0.1
|
||
}
|
||
case "Very High Functioning Asperger's",
|
||
"Very high functioning asperger's",
|
||
"Unofficial high functioning autism",
|
||
"Unofficial High Functioning Autism",
|
||
"High-functioning autism",
|
||
"High-Functioning Autism":{
|
||
|
||
return true, 0.7
|
||
}
|
||
case "Asperger traits":{
|
||
|
||
return true, 0.8
|
||
}
|
||
case "Yes",
|
||
"Autism spectrum disorder",
|
||
"Aspie",
|
||
"Yes. Autistic. ",
|
||
"Yes. autistic. ",
|
||
"classical autism",
|
||
"my snps say carry the genes and i think so myself",
|
||
"My snps say carry the genes and i think so myself",
|
||
"Aspergers",
|
||
"Asperger",
|
||
"Asperger unofficial diagnosis",
|
||
"Regressive autism":{
|
||
|
||
return true, 1
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
response1Exists, response1 := getResponse1()
|
||
if (response1Exists == true){
|
||
|
||
if (response1 == 1){
|
||
return true, 1
|
||
}
|
||
|
||
userResponsesList = append(userResponsesList, response1)
|
||
}
|
||
|
||
getResponse2 := func()(bool, float64){
|
||
|
||
// Column Name == "autism"
|
||
|
||
userAutismRaw := userDataLineSlice[327]
|
||
|
||
switch userAutismRaw{
|
||
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case "No",
|
||
"no",
|
||
"No but have genetic markers and an autistic son.":{
|
||
|
||
return true, 0
|
||
}
|
||
case "Borderline":{
|
||
|
||
return true, 0.6
|
||
}
|
||
case "Spectrum",
|
||
"spectrum":{
|
||
|
||
return true, 0.8
|
||
}
|
||
case "asperger's syndrome",
|
||
"Asperger's syndrome":{
|
||
|
||
return true, 0.9
|
||
}
|
||
case "Diagnosed as PDD-NOS & then ASD",
|
||
"Diagnosed as pdd-nos & then asd":{
|
||
|
||
return true, 1
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
response2Exists, response2 := getResponse2()
|
||
if (response2Exists == true){
|
||
|
||
if (response2 == 1){
|
||
return true, 1
|
||
}
|
||
|
||
userResponsesList = append(userResponsesList, response2)
|
||
}
|
||
|
||
getResponse3 := func()(bool, float64){
|
||
|
||
// Column Name == "Mental Disease"
|
||
|
||
userMentalDiseaseRaw := userDataLineSlice[165]
|
||
|
||
switch userMentalDiseaseRaw{
|
||
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case "None",
|
||
"none":{
|
||
|
||
return true, 0
|
||
}
|
||
case "Bipolar 2, ADHD, PTSD",
|
||
"Bipolar 2, adhd, ptsd",
|
||
"Hypomania/OCD/Anxiety",
|
||
"Panic disorder agoraphobia",
|
||
"panic disorder agoraphobia",
|
||
"SAD depression",
|
||
"Sad depression",
|
||
"Bipolar",
|
||
"Anxiety",
|
||
"Panic disorder",
|
||
"Depression",
|
||
"Major Depressive Disorder, Generalized Anxiety, Binge Eating Disorder",
|
||
"anxiety, ocd, agoraphobia, depression",
|
||
"Anxiety and Depression",
|
||
"Anxiety and depression",
|
||
"Anorexia nervosa, anxiety, depression",
|
||
"Adhd, anxiety, depression, adjustment disorder",
|
||
"ADHD, Anxiety, Depression, Adjustment Disorder",
|
||
"Major depressive disorder, dysthymia, asd, social anxiety disorder, ocd, adhd, unspecified dissociative disorder, developmental speech/language disorder",
|
||
"Major depressive disorder, generalized anxiety, binge eating disorder",
|
||
"Major depressive disorder, ptsd, generalized anxiety, panic disorder, add, ocd",
|
||
"major depressive disorder, PTSD, generalized anxiety, panic disorder, ADD, OCD",
|
||
"Borderline Personality Disorder ",
|
||
"panic disorder":{
|
||
|
||
return true, 0.2
|
||
}
|
||
case "PDD-NOS and ADHD":{
|
||
|
||
return true, 0.3
|
||
}
|
||
case "Paranoid Schizophrenia",
|
||
"Schizoid",
|
||
"Paranoid schizophrenia":{
|
||
|
||
return true, 0.5
|
||
}
|
||
case "Anxiety (esp. social), depression, ocd, autistic tendencies, maladaptive daydreaming",
|
||
"Ptsd and results of it(dissociative disorder, depression, anxiety), maladaptive daydreaming, and autistic tendencies":{
|
||
|
||
return true, 0.6
|
||
}
|
||
case "Asperger's disorder",
|
||
"Asperger's Syndrome, ADHD, schizoaffective bipolar, and Agoraphobia":{
|
||
|
||
return true, 0.9
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
response3Exists, response3 := getResponse3()
|
||
if (response3Exists == true){
|
||
|
||
if (response3 == 1){
|
||
return true, 1
|
||
}
|
||
|
||
userResponsesList = append(userResponsesList, response3)
|
||
}
|
||
|
||
getResponse4 := func()(bool, float64){
|
||
|
||
// Column Name == "Autistic Spectrum Disorder"
|
||
|
||
userAutismRaw := userDataLineSlice[666]
|
||
|
||
switch userAutismRaw{
|
||
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case "No":{
|
||
return true, 0
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
response4Exists, response4 := getResponse4()
|
||
if (response4Exists == true){
|
||
|
||
if (response4 == 1){
|
||
return true, 1
|
||
}
|
||
|
||
userResponsesList = append(userResponsesList, response4)
|
||
}
|
||
|
||
getResponse5 := func()(bool, float64){
|
||
|
||
// Column Name == "Personality Disorder test - top result"
|
||
|
||
userPersonalityDisorderRaw := userDataLineSlice[193]
|
||
|
||
switch userPersonalityDisorderRaw{
|
||
|
||
case "-":{
|
||
return false, 0
|
||
}
|
||
case "None",
|
||
"none":{
|
||
return true, 0
|
||
}
|
||
case "Depression",
|
||
"Anxiety and depression",
|
||
"Multiple anxiety disorders, depression, chronic insomnia",
|
||
"depression",
|
||
"Avoidant",
|
||
"Avoidant+",
|
||
"Anxiety",
|
||
"anxiety",
|
||
"Ocd",
|
||
"Obsessive-Compulsive+",
|
||
"Obsessive-Compulsive":{
|
||
|
||
return true, 0.1
|
||
}
|
||
case "Antisocial and cold",
|
||
"Antisocial",
|
||
"Borderline",
|
||
"Anxiety, ocd, bipolar 1 wo psychosis",
|
||
"Paranoid +",
|
||
"Passive aggressive, Paranoid ":{
|
||
|
||
return true, 0.2
|
||
}
|
||
case "Anxiety (esp. social), depression, OCD, autistic tendencies, maladaptive daydreaming":{
|
||
|
||
return true, 0.35
|
||
}
|
||
case "-Paranoid (I'm not, but I am schizoid (2nd result)",
|
||
"Schizotypal":{
|
||
|
||
return true, 0.5
|
||
}
|
||
case "Depression add aspergers panic disorder",
|
||
"depression add aspergers panic disorder",
|
||
"Aspergers":{
|
||
|
||
return true, 0.9
|
||
}
|
||
case "OCD ADD ASD",
|
||
"Ocd add asd":{
|
||
|
||
return true, 1
|
||
}
|
||
}
|
||
|
||
return false, 0
|
||
}
|
||
|
||
response5Exists, response5 := getResponse5()
|
||
if (response5Exists == true){
|
||
|
||
if (response5 == 1){
|
||
return true, 1
|
||
}
|
||
|
||
userResponsesList = append(userResponsesList, response5)
|
||
}
|
||
|
||
//Columns TODO:
|
||
// -"Bipolar disorder"
|
||
// -"Post traumatic Stress Disorder or PTSD?"
|
||
// -"Bipolar Disorder (Immediate Family or Personal Diagnosis)"
|
||
// -"Dissociative Identity Disorder"
|
||
// -"Mood disorders"
|
||
// -"Panic Disorder"
|
||
// -"OCD - Obsessive-Compulsive Disorder"
|
||
// -"Schizophrenia"
|
||
// -"Squizophrenia"
|
||
// -"Ambition"
|
||
// -"Purposefulness"
|
||
// -"Nicotine dependence"
|
||
// -"Suicidality"
|
||
|
||
if (len(userResponsesList) == 0){
|
||
return false, 0
|
||
}
|
||
|
||
result := slices.Max(userResponsesList)
|
||
|
||
return true, result
|
||
}
|
||
|
||
userAutismIsKnown, userAutism := getUserAutism()
|
||
|
||
userPhenotypeDataObject := PhenotypeData_OpenSNP{
|
||
UserID: userID,
|
||
EyeColorIsKnown: userEyeColorIsKnown,
|
||
EyeColor: userEyeColor,
|
||
LactoseToleranceIsKnown: userLactoseToleranceIsKnown,
|
||
LactoseTolerance: userLactoseTolerance,
|
||
HairColorIsKnown: userHairColorIsKnown,
|
||
HairColor: userHairColor,
|
||
HeightIsKnown: userHeightIsKnown,
|
||
Height: userHeight,
|
||
HappinessIsKnown: userHappinessIsKnown,
|
||
Happiness: userHappiness,
|
||
MentalIllnessIsKnown: userMentalIllnessIsKnown,
|
||
MentalIllness: userMentalIllness,
|
||
HomosexualnessIsKnown: userHomosexualnessIsKnown,
|
||
Homosexualness: userHomosexualness,
|
||
SupernaturalismIsKnown: userSupernaturalismIsKnown,
|
||
Supernaturalism: userSupernaturalism,
|
||
ObesityIsKnown: userObesityIsKnown,
|
||
Obesity: userObesity,
|
||
AnxietyIsKnown: userAnxietyIsKnown,
|
||
Anxiety: userAnxiety,
|
||
AutismIsKnown: userAutismIsKnown,
|
||
Autism: userAutism,
|
||
}
|
||
|
||
userPhenotypeDataMap[userID] = userPhenotypeDataObject
|
||
}
|
||
|
||
userPhenotypeDataList := helpers.GetListOfMapValues(userPhenotypeDataMap)
|
||
|
||
return true, userPhenotypeDataList
|
||
}
|
||
|
||
|
||
|