-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from mrcnc/develop
improving data import process
- Loading branch information
Showing
4 changed files
with
84 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
alter role nola311 set search_path to nola311, public; | ||
create extension if not exists postgis; | ||
|
||
create table nola311.calls as ( | ||
select id, | ||
ticket_id, | ||
issue_type, | ||
to_timestamp(ticket_created_date_time,'MM/DD/YYYY HH12:MI:SS AM') as ticket_created_date_time, | ||
to_timestamp(ticket_closed_date_time,'MM/DD/YYYY HH12:MI:SS AM') as ticket_closed_date_time, | ||
ticket_status, | ||
issue_description, | ||
street_address, | ||
neighborhood_district, | ||
council_district, | ||
city, | ||
state, | ||
zip_code, | ||
location, | ||
st_pointfromtext('POINT(' || longitude || ' ' || latitude || ')', 4326) as geom | ||
from nola311.calls_tmp | ||
); | ||
|
||
comment on table nola311.calls is 'This dataset represents calls to the City of New Orleans'' 311 Call Center'; | ||
|
||
grant all on schema nola311 to nola311; | ||
grant all on all tables in schema nola311 to nola311; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
create schema if not exists nola311; | ||
|
||
create table if not exists nola311.calls_tmp ( | ||
id serial primary key, | ||
ticket_id numeric, | ||
issue_type text, | ||
ticket_created_date_time text, | ||
ticket_closed_date_time text, | ||
ticket_status text, | ||
issue_description text, | ||
street_address text, | ||
neighborhood_district text, | ||
council_district text, | ||
city text, | ||
state text, | ||
zip_code numeric, | ||
location text, | ||
geom text, | ||
latitude numeric, | ||
longitude numeric | ||
); | ||
|
||
copy nola311.calls_tmp (ticket_id,issue_type,ticket_created_date_time,ticket_closed_date_time,ticket_status,issue_description,street_address,neighborhood_district,council_district,city,state,zip_code,location,geom,latitude,longitude) | ||
from program 'wget -q -O - "$@" "https://data.nola.gov/api/views/3iz8-nghx/rows.csv?accessType=DOWNLOAD"' | ||
with csv header NULL as ''; |