tsdataclinic / trec Goto Github PK
View Code? Open in Web Editor NEWTransit Resilience for Essential Commuting (TREC)
Home Page: https://trec.tsdataclinic.com/
License: Other
Transit Resilience for Essential Commuting (TREC)
Home Page: https://trec.tsdataclinic.com/
License: Other
Route list associated with each stop is currently a string. Change it to an array and test how we can write it to the DB.
TREC is difficult to use on mobile, since the UI components hide the map.
A first pass to fixing this would be moving the sidebar and filter UIs off to the side until the user opts to see them.
Add a table to the database with
Adding incremental datasets currently requires a new file + a rebuild.
The way to change that for this project will be to add a spatial database (PostGIS) . Other approaches considered were going direct to vector tiles (but that wouldn't change the one file per city requirement). Spatialite and GeoPackage were considered but the planned complexity of this data will be better suited with a more traditional RDBMS.
This issue does not include work to create an API layer for data access. That will be conducted in a future issue.
This does not preclude further extensions to vector tileset formats, but those will be addressed separately.
This issue will involve setting up a PostGIS database on an EC2 server. To start, we can pull the Docker image.
There are several data files that TREC UI loads.
To cover the POI cases, there should be two tables: transit_stops
and hospitals
. This will involve reading the current GeoJSON files and translating the properties
object into DB columns.
To maintain parity, the transit_stop
table should have at least the following columns (derived from here):
"stop_name",
"city",
"route_type",
"routes_serviced",
"flood_risk_category",
"flood_risk_value",
"job_access_category",
"job_count",
"worker_vulnerability_category",
"worker_vulnerability_score"
"access_to_hospital_category",
"distance_to_hospital",
"geometry"
In addition, to make the table work across multiple cities there will also be:
city
country
(ISO-3166-1? add subdivisions with ISO-3166-2?)geometry
(a direct port of the GeoJSON's geometry
obj)For hospitals
, there is a similar process:
FEATURE_NAME
, FEATURE_CLASS
)city
, country
, and geometry
columns as with transit_stops
tableFor flood layers, we currently have polygons for NYC and Hampton Roads so we could go with a table with the same city
and country
keys and a geometry
column which contains the polygons.
For other cities, where we might not have city specific data, we could fall back on using NOAA SLR scenario layer or Floodplain layer which are national datasets. To fit this into the same table structure, we could write out subsets of these as individual rows for each city and include this write operation in the data pipeline.
For many cities, it might be easier to search rather than select from a picker
#30 will create a database of POIs/polygons. This issue will create an API layer for the UI to access those things as needed.
The API layer will serve two kinds of data:
As part of this ticket, we can stick to FastAPI and use PostGIS functions directly for vector tile rendering: https://medium.com/nyc-planning-digital/using-the-new-mvt-function-in-postgis-75f8addc1d68
rough sketch of API endpoints needed:
How will the API be used?
Convert About page to look like this one: covidinafrica.tsdataclinic.com/about
/about
route handler to the app here: https://github.com/tsdataclinic/TREC/blob/main/app/src/App.tsxTo show route level summaries, need to write additional calculation based on the geojson data passed into the app.
Create a hook that, for each route, create an object that contains:
Scripts to get the following datasets:
Add a dismissible modal on page load to describe TREC
Is your feature request related to a problem? Please describe.
San Francisco is the only city in our current list that does not have a hi-res Flood layer displayed.
Describe the solution you'd like
Display either the FEMA flood layer or relevant data from Cal-Adapt
For a given polygon(s), return the census variables by merging and interpolating the raw data
Inputs:
Outputs:
When selecting a Route to view its summary in the RouteSidebar
component, the loading state view is pretty ugly.
Problems:
Acceptance:
NaN
Optional:
Currently the route summary sidebar appears from clicking on a route in the tooltip. We'd want to make it possible to view summary based on route selection from the filter as well. The Filter though allows for multiple selections, so we'd have to figure out what to display when multiple routes are selected.
Due to disconnected components in the walk graph, the transit walksheds for some stops are not polygons creating issues down the line.
Is your feature request related to a problem? Please describe.
Transit Land data for bay are doesn't include all the agencies here. Data from agencies south of Palo Alto isn't included.
Describe the solution you'd like
Include these additional sources in the pipeline and re-run.
Currently the climate risk tertiles (High/Med/Low) are based on the national distribution of the risk scores. This is relevant in some circumstances such as understanding if the city has significant risk from a particular type of disaster, but perhaps in the context of prioritization within a city, one might be interested in understanding where the highest climate risks are within the city.
Tasks:
A function that calculates the walk-shed around a station.
Inputs:
osmnx
libraryOutputs:
run_pipeline
to accept multiple citiesThe improvements are to make it easier to add multiple cities at once to the config and re-run the pipeline optimally without having to regenerate existing data.
As we expand the data being displayed on the front end, the distance to the nearest hospital from a stop could be useful. Add this calculation to the add_hospital_access
in features/build_stop_features
Right now, features on the sidebar always show up.
This change will make those features appear based on which city is being displayed.
Describe the bug
The Route filter for a city currently shows Rail and Ferry as options (for NYC and HR respectively) but those stops are not included in the stops view.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Rail and Ferry shouldn't be shown as options in the filter
Is your feature request related to a problem? Please describe.
As we include more cities, we need to be able to present filters (i.e. transit lines and flood layer) only relevant to that city.
Describe the solution you'd like
Currently we display all the toggles. But we would like to hide the toggles for other cities and only display the ones for the selected city.
For example: when NYC is selected up-top,
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.