Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Oscar-Rydh committed May 31, 2017
2 parents 18bfabf + c4f36b3 commit e803c9d
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -12,3 +12,4 @@ twitter-with-geonames.dump
twitter-with-preprocessed.dump
twitter-before-geoname-api-identification.dump
post_easter.dump
node_modules
44 changes: 44 additions & 0 deletions calc_holes_in_db_data.py
@@ -0,0 +1,44 @@
import psycopg2
import functools
import datetime

# Connect to the db
conn = psycopg2.connect("dbname=twitter-geo")


# Fetch stuff from db
cur = conn.cursor()
cur.execute('select distinct(created_at) from tweets;')
result = cur.fetchall()
cur.close()
# Get rid of tuples
result = list(map(lambda a: a[0], result))
# Work on a minute level
result = list(map(lambda a: a.replace(second=0, microsecond=0), result))
# Remove duplicates
result = set(result)
# Convert to list
result = list(result)
# Sort
result = sorted(result)

# Find non aligned values
for i in range(len(result)):
# Convert to seconds
if(i == 0):
continue

# Get the two values
start = result[i-1]
end = result[i]

# Convert to seconds
a = start.timestamp()
b = end.timestamp()

# Print non aligned values
if(b-a != 60):
print("FOUND HOLE")
print("Last insert time: {}".format(start))
print("First insert time: {}".format(end))
print("")
4 changes: 2 additions & 2 deletions maps-geocode.js
Expand Up @@ -105,7 +105,7 @@ const locations = [

const get_data_for_location = (location) => {

const base_url = "http://www.google.com/maps?q="
const base_url = "https://www.google.com/maps?q="
const request_url = base_url + location

superagent
Expand Down Expand Up @@ -171,4 +171,4 @@ const get_data_for_location = (location) => {

// })

get_data_for_location("Pennsylvania")
get_data_for_location("Pennsylvania")

0 comments on commit e803c9d

Please sign in to comment.