Skip to content

Commit

Permalink
Merge pull request #1 from taw/master
Browse files Browse the repository at this point in the history
Moved things around so they work again
  • Loading branch information
Violin1208 committed Jan 17, 2017
2 parents 6655bac + 609ad87 commit 7a7399c
Show file tree
Hide file tree
Showing 14 changed files with 14 additions and 73 deletions.
3 changes: 2 additions & 1 deletion .gitignore
@@ -1,4 +1,5 @@
.idea
.DS_Store
*.pyc
Full Text
Full Text
Fulltext.zip
6 changes: 0 additions & 6 deletions NLTK_textmine/.ipynb_checkpoints/Untitled-checkpoint.ipynb

This file was deleted.

53 changes: 0 additions & 53 deletions NLTK_textmine/Untitled.ipynb

This file was deleted.

Binary file removed NLTK_textmine/database
Binary file not shown.
2 changes: 1 addition & 1 deletion NLTK_textmine/smell_datamine_multiprocessing.py
Expand Up @@ -89,7 +89,7 @@ def __init__(self):

def save_to_database(self, results):
# create table
db = dataset.connect('sqlite:///database')
db = dataset.connect('sqlite:///../database/smells.sqlite')
table = db['smells']
for result in results:
try:
Expand Down
Binary file removed NLTK_textmine/sqlite3
Binary file not shown.
Binary file removed data/database_out
Binary file not shown.
Binary file removed database backup
Binary file not shown.
Empty file added database/.keep
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed visualisation/leaflet/database_out
Binary file not shown.
23 changes: 11 additions & 12 deletions visualisation/leaflet/generate_leaflet_data.py
@@ -1,6 +1,6 @@
#!/usr/bin/python3

#This script generates the data file required to be used with the leaflet software which is used to display the data on a map.
#This script generates the data file required to be used with the leaflet software which is used to display the data on a map.

import sys
import os
Expand All @@ -16,8 +16,8 @@
def main():

# Set up for copying the database.
database_in = os.path.join("..", "..", "database")
database_out = os.path.join("database_out")
database_in = os.path.join("..", "..", "database", "smells.sqlite")
database_out = os.path.join("..", "..", "database", "leaflet.sqlite")

# Copy original database (so that more data can be added).
sqlite_utilities.copy_sqlite_file(database_in, database_out)
Expand All @@ -26,14 +26,14 @@ def main():
conn, cur = sqlite_utilities.connect_to_sqlite_db(database_out)

# Read JSON file.
json_file = os.path.join("london_districts_latlong_with_centroids.json")
json_file = os.path.join("js", "london_districts_latlong_with_centroids.json")
json_data = json_utilities.read_json_file(json_file)

# Creates a table to add the JSON file data to copied database.
create_table_sql = """create table if not exists locations
create_table_sql = """create table if not exists locations
( location_name text PRIMARY KEY,
centroid_lat numeric,
centroid_lon numeric,
centroid_lat numeric,
centroid_lon numeric,
polygon_coordinates text)"""

sqlite_utilities.execute_sql(conn, cur, create_table_sql)
Expand All @@ -47,9 +47,9 @@ def main():
centroid_lat = feature["properties"]["lat_centre"]
centroid_lon = feature["properties"]["long_centr"]
polygon_coordinates = str(feature["geometry"]["coordinates"])

print(feature["properties"]["name"], feature["properties"]["lat_centre"], feature["properties"]["long_centr"], feature["geometry"]["coordinates"])

cur.execute("insert into locations values (?, ?, ?, ?)", (location_name, centroid_lat, centroid_lon, polygon_coordinates))

conn.commit()
Expand All @@ -58,7 +58,7 @@ def main():
#### Generate data.####

# TEST 1 - all data from 1858 with only totals of smells (to get markers on map and change size of marker).

# Get data from database: group by borough and year for 1858 (test for visualisation).
conn, cur = sqlite_utilities.connect_to_sqlite_db(database_out)

Expand All @@ -70,7 +70,7 @@ def main():
csv_file = os.path.join("smells_data_1858_summary.csv")
header = ["location_name", "year", "centroid_lat", "centroid_lon", "no_smells"]
csv_utilities.list_of_tuples_to_csv(data_list, csv_file, header)

# TEST 2 - all data from 1858 with smells in categories (to create piecharts with categories and change radius with total number of smells)

# Get data from database: group by borough, year and category and test firstly with 1858.
Expand Down Expand Up @@ -101,4 +101,3 @@ def main():

if __name__ == "__main__":
main()

0 comments on commit 7a7399c

Please sign in to comment.