def __update_aggregations__(self,additional_constraints=""):
        # get the current time stamp from the aggregator
        current_timestamp = self.aggregator.__get_timestamp__()
        print current_timestamp
        count, new_time = PanoptesAPI.__update_aggregations__(self," and created_at>\'" + str(current_timestamp) + "\'")
        self.aggregator.__set_timestamp__(new_time)

        return count,new_time
Beispiel #2
0
from postgres_aggregation import PanoptesAPI
#import panoptesPythonAPI
import os
import yaml
import urllib2
import requests
import json

if os.path.exists("/home/ggdhines"):
    base_directory = "/home/ggdhines"
else:
    base_directory = "/home/greg"

if __name__ == "__main__":
    site = os.getenv('SITE', "temp")
    stargazing = PanoptesAPI(0,0)
    a,count = stargazing.__get_stats__()
    print a,count
    #print count
    #environment = os.getenv('ENVIRONMENT', "staging")

    # try:
    #     panoptes_file = open("config/aggregation.yml","rb")
    # except IOError:
    #     panoptes_file = open(base_directory+"/Databases/aggregation.yml","rb")
    # api_details = yaml.load(panoptes_file)
    #
    # userid = api_details[environment]["name"]
    # password = api_details[environment]["password"]

Beispiel #3
0
conn = psycopg2.connect("dbname = 'supernova' host='localhost' user = '******' password='******'")

cur = conn.cursor()
try:
    cur.execute("DROP TABLE classifications")
except psycopg2.InternalError as e:
    print e
    print "I can't drop our test database!"

cur.execute("CREATE TABLE users (User_id INT PRIMARY KEY, User_name TEXT)")

#cur.execute("INSERT INTO Cars VALUES(1,'Audi',52642)")
#conn.commit()
# prepared_stmt = session.prepare("INSERT INTO classification_model (user_id,created_at,user_ip,annotations,subject_id, classification_id) VALUES (?, ?, ?, ?, ?, uuid())")
#
stargazing = PanoptesAPI()
stargazing.__cleanup__()

cur.execute("PREPARE myplan AS " "INSERT INTO users (User_id, User_name) values ($1,$2)")

for ii,t in enumerate(stargazing.__yield_classifications__()):
    # print t[3]
    # print t[3][0]
    # print type(t[3][0])
    # print type(t[3])
    # print json.loads(str(t[3]))
    #user_id,created_at,user_ip,annotations,subject_ids
    #print t[4]
    #print json.dumps(t[4])

    try:
 def __init__(self,http_update=False):
     PanoptesAPI.__init__(self,http_update,aggregator=IterativeAggregation)
Beispiel #5
0
from postgres_aggregation import PanoptesAPI
#import panoptesPythonAPI
import os
import yaml
import urllib2
import requests
import json

if os.path.exists("/home/ggdhines"):
    base_directory = "/home/ggdhines"
else:
    base_directory = "/home/greg"

if __name__ == "__main__":
    site = os.getenv('SITE', "temp")
    stargazing = PanoptesAPI(0, 0)
    a, count = stargazing.__get_stats__()
    print a, count
    #print count
    #environment = os.getenv('ENVIRONMENT', "staging")

    # try:
    #     panoptes_file = open("config/aggregation.yml","rb")
    # except IOError:
    #     panoptes_file = open(base_directory+"/Databases/aggregation.yml","rb")
    # api_details = yaml.load(panoptes_file)
    #
    # userid = api_details[environment]["name"]
    # password = api_details[environment]["password"]

    # https://panoptes-comments.firebaseio.com/stargazing2015-zooniverse-org/projects/1/volunteers-count%22