Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up internal dashboard to run based on open data #133

Open
radumas opened this issue May 4, 2019 · 4 comments
Open

Set up internal dashboard to run based on open data #133

radumas opened this issue May 4, 2019 · 4 comments

Comments

@radumas
Copy link
Member

radumas commented May 4, 2019

In order for the community to fork and improve the code, they should be able to run the dashboard based on the data from open data
I would recommend trying to build off of the internal_dash_open_data branch, which has fewer features, but also means that the data transformations are fewer to make
https://github.com/CityofToronto/bdit_king_pilot_dashboard/tree/internal_dash_open_data

@radumas
Copy link
Member Author

radumas commented May 4, 2019

Relevant SQL for views which needs to be transformed to be based on OpenData

The below table definition should match the detailed bluetooth data.

CREATE TABLE bluetooth_data (
result_id TEXT,     
        datetime_bin timestamp without time zone,
        day_type text, 
        category text,
        period_name text,
        tt integer,
        obs integer

)

@Fullchee
Copy link

Fullchee commented May 4, 2019

Here's my incomplete instructions to try to get python app.py working

Setup

Database Setup

  1. Setup PostgreSQL and have an instance running.
  2. In the project root directory, create a file called db.cfg with the following content
[DBSETTINGS]
database={{user name}}
user={{user name}}

The user name should your PostgreSQL username
3. In the data_pipeline branch, in the bluetooth/sql folder, it has all of the SQL commands to create the tables, functions and views that you need.
4. ????

Python Setup

  1. pip install pipenv
  2. pipenv install

@radumas
Copy link
Member Author

radumas commented May 13, 2019

To clarify the aggregations that are happening from the 5-min data:

  1. Travel times are averaged per 30-minute bin for each bluetooth segment.
  2. Travel times are averaged per time period, date, and bluetooth segment
  3. Travel times are summed by corridor. At this point the data is in dash_daily, which gets pulled by the Dash app
  4. Baseline Only: Travel times are averaged by day type, and time period over the baseline period.

In order to aggregate by street and direction, need to join 5-min data with the bluetooth segments GIS layer. I'm working on converting this GIS layer to a csv so it will be easier to import into PostgreSQL

@radumas
Copy link
Member Author

radumas commented May 14, 2019

I've attached a zipped csv of the segments.

CREATE TABLE bluetooth_gis
(
    segment_name text,
    street text ,
    direction text ,
    from_intersection text ,
    to_intersection text ,
    length bigint
)

bluetooth_geom.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants