Beispiel #1
0
func GetTwitterRetweets(id string) (twitter []string) {

	twitter = []string{"0", "0", "0", "0"}
	valuesT := db.ReadValues("universum", "TwitterUserTimeline", id)

	count := -1
	// count is set to iterate until 4
	// for the latest 4 posts
	currentid := "0"
	for i := range valuesT {
		//fmt.Println("current id : " + currentid + "\n")
		split := strings.Split(valuesT[i], ",")
		split0 := strings.Split(split[0], "\"")
		readid := split0[3]
		if readid != currentid {
			count = count + 1
			currentid = readid

			if count < 4 {
				fmt.Println(currentid)
				split2 := strings.Split(split[1], "\"")
				twitter[i] = split2[3]
			}
			if count > 4 {
				break
			}
		}

	}
	return
}
Beispiel #2
0
func GetAttributes(name string, id string, since time.Time, until time.Time) (data []string, timestamp []string) {

	values := db.ReadValues("universum", "AttributesByCompanyId", id)

	//columns := db.ReadColumns("universum","AttributesByCompanyId",id)
	data, timestamp = GetMetricWindow(name, values, values, since, until)

	return

}
Beispiel #3
0
func GetFacebookPageComment(id string) (data []string) {

	data = []string{"0", "0", "0", "0"}
	values := db.ReadValues("universum", "FacebookStream", id)

	for i := range data {
		if i < len(values) {
			split := strings.Split(values[i], "\",\"")
			split1 := strings.Split(split[5], "\"")
			data[i] = split1[2]

		}
	}

	return
}
Beispiel #4
0
func GetLinkedinFollowers(id string) (linkedin []string) {

	linkedin = []string{"0", "0", "0", "0"}
	valuesL := db.ReadValues("universum", "LinkedinCompanies", id)
	for i := range linkedin {
		if i < len(valuesL) {
			split := strings.Split(valuesL[i], ",")
			split2 := strings.Split(split[2], "\"")
			linkedin[i] = split2[3]
			//fmt.Printf(split2[3])
			//split2 = strings.Split(split[1],"\"")
			//social[0] = split2[3]
		}
	}
	return

}
Beispiel #5
0
func GetRanking(name string) (Data []string, Trend []string) {

	Data = db.ReadValues("universum", "GlobalRankings", name)
	//OldData = db.ReadValues("universum", "GlobalRankings", name)

	for _ = range Data {
		i := rand.Int()

		if i%2 == 0 {
			Trend = append(Trend, "1")
		}
		if i%2 != 0 {
			Trend = append(Trend, "0")
		}
	}
	return

}
Beispiel #6
0
func HelperAggregate(keyspace string, columnfamily string, name string, id []string, since time.Time, until time.Time, resolution string) (Data []string, Tstamp []time.Time) {

	//Tstamp := []time.Time{}
	for i := range id {
		fmt.Println(id[i])
		fmt.Println(keyspace + " " + columnfamily + " " + id[i])
		values := db.ReadValues(keyspace, columnfamily, id[i])
		columns := db.ReadColumns(keyspace, columnfamily, id[i])
		data, tstamp := GetMetricWindowTIME(name, values, columns, since, until)
		if i == 0 {
			Data = data
			Tstamp = tstamp
		}
		if i >= 1 {
			Data, Tstamp = Aggregate(Data, Tstamp, data, tstamp)
		}
	}

	return

}