bdit_data-sources
bdit_data-sources copied to clipboard
Update/Modernize Bluetooth Detector Tables
Ideally, we should have tables with the following schemas:
reader_locations: this is a table of all locations at which Bliptrack readers have ever been installedreader_id: unique ID for a unique reader/detector name from theroute_pointscolumn inall_analyses, this should not be theroute_point_id, which is unique for each point of each route.name: e.g. QN_SP (two characters for E/W street, two characters for N/S street)geomint_id: centreline intersection id, for closest intersection. Preferred over px because highway detectors won't be near a signalized intersection, but there could be a logical location that would be an intersection... nodedate_active: first date at which there was data at this locationdate_inactive: NULL unlessdate_last_receivedis not the most recent datedate_last_received: updated daily if the reader is still producing data (if thereader_historyassociated with that location has beenuninstalled)project_name
reader_history: table of detectors which have been installed at eachreader_locationreader_history_id: unique ID for the tablereader_id: foreign key toreader_locations(location_id)serial_no_bluetooth: device id for bluetoothserial_no_wifidate_installeddate_uninstalled
routes: unique segments on which data is collectedanalysis_id: analysis id from theall_analysestablenamestart_street_namestart_cross_streetstart_reader_id: correspondingreader_idfrom thereader_locationstableend_street_nameend_cross_streetend_reader_id: correspondingreader_idfrom thereader_locationstablegeomdate_activedate_inactive
bluetooth.reader_status_history: what detectors were active on which datereader_id int, --unique id from reader_locationsdt DATE,active BOOLEAN
- ~
analyses: some kind of crossover from what's on Blip and what's in our database~- ~
analysis_id~ - ~
route_id~
- ~
There should also be documentation in the Update README on how to update the above tables https://github.com/CityofToronto/bdit_data-sources/blob/master/bluetooth/update/README.md for
Created the two tables with the above listed columns.
What rows are supposed to go in them?
I'll Slack you the file that will inform what goes into those tables
Is the bluetooth_id same as Bluetooth Unit # in the xlsx file?
(and similarly wifi_id is WIFI Unit # ?)
Yes it is
@aharpalaniTO ready for your review. The two tables are under my schema.
Both tables created in python notebooks and pushed to EC2 using an sqlalchemy_mate engine, as documented here:
https://github.com/CityofToronto/bdit_team_wiki/wiki/Python#Creating-a-new-table-with-geometry-to-push-to-database
Does this supersede #175 ?
Can we also tag the PX or int_id to the bluetooth tables?
Some weird stuff in the source data - 7 detectors seem to be active with the same Blip ID. I'll need to check with Quin.
PX added to cnangini.detectors from gis.traffic_signals by string matching street names.
18 detectors do not have a matching intersection in the gis table:
| detector_name | street1 | street2 |
|---|---|---|
| QU_RO | Queen/King | Roncesvalles |
| A | Gardiner | Wickham |
| B | Gardiner | Grand |
| B1 | Gardiner | Roncesvalles |
| C | Gardiner | Dufferin |
| D | Gardiner | Spadina |
| E | Gardiner | Parliament |
| F | DVP | Dundas |
| G | DVP | Bayview |
| H | DVP | Don Mills |
| J | DVP | Lawrence |
| LB | Harbour EB | Bay |
| Z2 | Lakeshore | Dufferin |
| Islington | Gardiner | Islington |
| Spanbridge | DVP | Spanbridge |
| Beechwood | DVP | Beechwood |
| Lytton | Yonge | Lytton/Blythwood |
| Royal York | Gardiner | Royal York |
Found some discrepancy of street names between the detector table and bluetooth.segments.
For example, analysis_id 1453197 in bluetooth.segments: street = college and start_crossstreet = parliament, but in cnangini.detectors: street1 is carlton and start_crossstreet = parliament.
These analysis_id in bluetooth.segments do not have the same street name as the detectors table:
| analysis_id | street | start_crossstreet | street1 | street2 | end_street | end_crossstreet | street1 | street2 | det_start | det_end |
|---|---|---|---|---|---|---|---|---|---|---|
| 1453197 | College | Parliament | College | University | College | University | 5414 | |||
| 1412913 | College | Parliament | College | University | College | University | 5414 | |||
| 1453535 | Queen | Roncesvalles | Queen | Dufferin | Queen | Dufferin | 5412 | |||
| 1454127 | King | Roncesvalles | King | Dufferin | King | Dufferin | 9002 | |||
| 1454311 | King | Broadview | King | Parliament | King | Parliament | 5790 | |||
| 1454782 | Fort York | York | Bremner | Spadina | Bremner | Spadina | 9029 | |||
| 1454747 | Fort York | Spadina | Bremner | York | Bremner | York | 5417 | |||
| 1427965 | Adelaide | Duncan | Adelaide | Sherbourne | Adelaide | Sherbourne | 5330 | |||
| 116749 | Gardiner | Wickman | Gardiner | Grand | Gardiner | Grand | 5815 | |||
| 116858 | DVP | Bayview Ramp | DVP | Dundas | DVP | Dundas | 5007 | |||
| 116804 | DVP | Bayview Ramp | DVP | Don Mills | DVP | Don Mills | 5808 | |||
| 1428284 | Yonge | Yonge | Lawrence | Jedburgh | Lawrence | Jedburgh | 5805 | |||
| 1428295 | Yonge | Castlefield | Lawrence | Jedburgh | Lawrence | Jedburgh | 5805 | |||
| 1448931 | Yonge | Yonge | Yonge | Chatsworth | Yonge | Chatsworth | 5615 | |||
| 1461616 | Yonge | Castlefield | Yonge | Chatsworth | Yonge | Chatsworth | 5615 | |||
| 1448413 | Glengrove | Duplex | Yonge | Chatsworth | Yonge | Chatsworth | 5615 | |||
| 1448866 | Yonge | Lytton | Yonge | Glengrove | Yonge | Glengrove | 5619 | |||
| 1448418 | Glengrove | Duplex | Yonge | Glengrove | Yonge | Glengrove | 5619 | |||
| 1448368 | Blythwood | Blythwood | Yonge | Glengrove | Yonge | Glengrove | 5619 | |||
| 1448881 | Yonge | Castlefield | Yonge | Briar Hill | Yonge | Briar Hill | 5613 | |||
| 1448921 | Yonge | Lytton | Yonge | Briar Hill | Yonge | Briar Hill | 5613 | |||
| 1448363 | Blythwood | Blythwood | Yonge | Briar Hill | Yonge | Briar Hill | 5613 | |||
| 1460834 | Sheppard | Sheppard | Sheppard | Neilson | Sheppard | Neilson | 5614 | |||
| 1448557 | Morningside | Morningside | Sheppard | Neilson | Sheppard | Neilson | 5614 | |||
| 1448745 | Sheppard | Sheppard | Sheppard | Murison | Sheppard | Murison | 5626 | |||
| 1448552 | Morningside | Morningside | Sheppard | Murison | Sheppard | Murison | 5626 | |||
| 1448378 | Brenyon | Brenyon | Sheppard | Murison | Sheppard | Murison | 5626 | |||
| 1448740 | Sheppard | Sheppard | Sheppard | Meadowvale | Sheppard | Meadowvale | 5621 | |||
| 1448542 | Morningside | Morningside | Sheppard | Meadowvale | Sheppard | Meadowvale | 5621 | |||
| 1448650 | Morningside | Sheppard | Morningside | McLevin | Morningside | McLevin | 5625 | |||
| 1448536 | Morningside | Morningside | Morningside | McLevin | Morningside | McLevin | 5625 | |||
| 1448567 | Morningside | Sheppard | Morningside | 401 | Morningside | 401 | 5611 | |||
| 1448452 | Milner | Milner | Morningside | 401 | Morningside | 401 | 5611 | |||
| 1448531 | Morningside | Morningside | Morningside | 401 | Morningside | 401 | 5611 | |||
| 1448655 | Morningside | Sheppard | Milner | Murison | Milner | Murison | 5617 | |||
| 1448547 | Morningside | Morningside | Milner | Murison | Milner | Murison | 5617 | |||
| 1458787 | Sheppard | Sheppard | Sheppard | Rouge River | Sheppard | Rouge River | 5619 | |||
| 1428129 | Sheppard | Herons Hill Way | Victoria Park | Clydesdale | Victoria Park | Clydesdale | 5271 | |||
| 1428134 | Sheppard | Herons Hill Way | Victoria Park | 401 | Victoria Park | 401 | 5270 | |||
| 1428103 | Sheppard | Herons Hill Way | Sheppard | Pharmacy | Sheppard | Pharmacy | 4037 | |||
| 1448799 | Sheppard | Sheppard | Sheppard | Pharmacy | Sheppard | Pharmacy | 4037 | |||
| 1448760 | Sheppard | Herons Hill Way | Sheppard | Settlers | Sheppard | Settlers | 5609 | |||
| 1448805 | Sheppard | Sheppard | Sheppard | Settlers | Sheppard | Settlers | 5609 | |||
| 1448750 | Sheppard | Herons Hill Way | Consumers | IBM | Consumers | IBM | 5612 | |||
| 1455692 | Parliament | Dundas | Parliament | Carlton | ||||||
| 1413237 | Bathurst | College | Bathurst | Queen | ||||||
| 1455061 | Bathurst | King | Bathurst | Queen | ||||||
| 1454965 | Bathurst | Dundas | Bathurst | Queen | ||||||
| 1448437 | Glengrove | Glengrove | Glengrove | Duplex | ||||||
| 1448926 | Yonge | Lytton | Glengrove | Duplex | ||||||
| 1448887 | Yonge | Chatsworth | Yonge | Chatsworth | Glengrove | Duplex | 5615 | |||
| 1448432 | Glengrove | Duplex | Yonge | Lytton | ||||||
| 1448373 | Blythwood | Blythwood | Yonge | Lytton | ||||||
| 1448856 | Yonge | Briar Hill | Yonge | Briar Hill | Yonge | Lytton | 5613 | |||
| 1448916 | Yonge | Glengrove | Yonge | Glengrove | Yonge | Lytton | 5619 | |||
| 1454952 | Bathurst | College | Bathurst | Dundas | ||||||
| 1455076 | Bathurst | Queen | Bathurst | Dundas | ||||||
| 1455710 | Broadview | Queen | Broadview | Eastern | ||||||
| 1455045 | Bathurst | Front | Bathurst | King | ||||||
| 1454980 | Bathurst | Queen | Bathurst | King | ||||||
| 1455443 | Yonge | King | Yonge | Front | ||||||
| 1455724 | Broadview | Eastern | Broadview | Queen | ||||||
| 1455088 | Bathurst | Dundas | Bathurst | College | ||||||
| 1413206 | Bathurst | Queen | Bathurst | College | ||||||
| 1448660 | Morningside | Sheppard | Morningside | Morningside | ||||||
| 1448457 | Milner | Milner | Morningside | Morningside | ||||||
| 1448484 | Morningside | 401 | Morningside | 401 | Morningside | Morningside | 5611 | |||
| 1448509 | Morningside | McLevin | Morningside | McLevin | Morningside | Morningside | 5625 | |||
| 1448675 | Sheppard | Meadowvale | Sheppard | Meadowvale | Morningside | Morningside | 5621 | |||
| 1448700 | Sheppard | Murison | Sheppard | Murison | Morningside | Morningside | 5626 | |||
| 1448730 | Sheppard | Neilson | Sheppard | Neilson | Morningside | Morningside | 5614 | |||
| 1455310 | York | Front | York | Bremner | ||||||
| 1455538 | Jarvis | Front | Jarvis | King | ||||||
| 1455510 | Jarvis | Queen | Jarvis | King | ||||||
| 1455493 | Jarvis | Dundas | Jarvis | Queen | ||||||
| 1455555 | Jarvis | King | Jarvis | Queen | ||||||
| 1412908 | College | University | College | University | College | Parliament | 5414 | |||
| 1453170 | College | University | College | University | College | Parliament | 5414 | |||
| 1455570 | Jarvis | Queen | Jarvis | Dundas | ||||||
| 1455213 | Spadina | King | Spadina | Queen | ||||||
| 1455105 | Spadina | Dundas | Spadina | Queen | ||||||
| 1455327 | York | Bremner | York | Front | ||||||
| 1455641 | Parliament | Front | Parliament | King | ||||||
| 1455616 | Parliament | Queen | Parliament | King | ||||||
| 1428279 | Yonge | Yonge | Lawrence | Mount Pleasant | ||||||
| 1428290 | Yonge | Castlefield | Lawrence | Mount Pleasant | ||||||
| 1448901 | Yonge | Chatsworth | Yonge | Chatsworth | Lawrence | Mount Pleasant | 5615 | |||
| 1428314 | Lawrence | Jedburgh | Lawrence | Jedburgh | Lawrence | Mount Pleasant | 5805 | |||
| 1455296 | University | King | University | Front | ||||||
| 1455231 | Spadina | Queen | Spadina | Dundas | ||||||
| 116852 | DVP | Don Mills | DVP | Don Mills | DVP | Bayview Ramp | 5808 | |||
| 116796 | DVP | Dundas | DVP | Dundas | DVP | Bayview Ramp | 5007 | |||
| 1455195 | Spadina | Front | Spadina | King | ||||||
| 1448358 | Blythwood | Lytton | Blythwood | Mount Pleasant | ||||||
| 1455124 | Spadina | Queen | Spadina | King | ||||||
| 1448871 | Yonge | Briar Hill | Yonge | Briar Hill | Blythwood | Mount Pleasant | 5613 | |||
| 1448911 | Yonge | Glengrove | Yonge | Glengrove | Blythwood | Mount Pleasant | 5619 | |||
| 1455676 | Parliament | Queen | Parliament | Dundas | ||||||
| 1455585 | Parliament | College | Parliament | Dundas | ||||||
| 1455603 | Parliament | Dundas | Parliament | Queen | ||||||
| 1455658 | Parliament | King | Parliament | Queen | ||||||
| 1454293 | King | Parliament | King | Parliament | King | Broadview | 5790 | |||
| 1453806 | Queen | Dufferin | Queen | Dufferin | Queen | Roncesvalles | 5412 | |||
| 1454853 | Roncesvalles | Queen | Roncesvalles | Dundas | ||||||
| 1413812 | Dovercourt | College | Dovercourt | Dundas | ||||||
| 1454832 | Roncesvalles | Dundas | Roncesvalles | Queen | ||||||
| 1413817 | Dovercourt | Dundas | Dovercourt | College | ||||||
| 1428267 | Yonge | Yonge | Yonge | Castlefield | ||||||
| 1448876 | Yonge | Briar Hill | Yonge | Briar Hill | Yonge | Castlefield | 5613 | |||
| 1460798 | Yonge | Chatsworth | Yonge | Chatsworth | Yonge | Castlefield | 5615 | |||
| 1428309 | Lawrence | Mt Pleasant | Lawrence | Mt Pleasant | Yonge | Castlefield | 5331 | |||
| 1428324 | Lawrence | Jedburgh | Lawrence | Jedburgh | Yonge | Castlefield | 5805 | |||
| 1454449 | King | Dufferin | King | Dufferin | King | Roncesvalles | 9002 | |||
| 1455427 | Yonge | Queen | Yonge | King | ||||||
| 1455456 | Yonge | Front | Yonge | King | ||||||
| 1455028 | Bathurst | Fort York | Bathurst | Front | ||||||
| 1454997 | Bathurst | King | Bathurst | Front | ||||||
| 1454508 | Wellington | University | Wellington | University | Wellington | Blue Jays | 9031 | |||
| 1455412 | Yonge | Dundas | Yonge | Queen | ||||||
| 1455468 | Yonge | King | Yonge | Queen | ||||||
| 1448463 | Milner | Milner | Sheppard | Sheppard | ||||||
| 1448562 | Morningside | Morningside | Sheppard | Sheppard | ||||||
| 1448385 | Brenyon | Brenyon | Sheppard | Sheppard | ||||||
| 1448408 | Consumers | IBM | Consumers | IBM | Sheppard | Sheppard | 5612 | |||
| 1448794 | Sheppard | Settlers | Sheppard | Settlers | Sheppard | Sheppard | 5609 | |||
| 1448768 | Sheppard | Pharmacy | Sheppard | Pharmacy | Sheppard | Sheppard | 4037 | |||
| 1448836 | Victoria Park | 401 | Victoria Park | 401 | Sheppard | Sheppard | 5270 | |||
| 1448815 | Victoria Park | Clydesdale | Victoria Park | Clydesdale | Sheppard | Sheppard | 5271 | |||
| 1458797 | Sheppard | Rouge River | Sheppard | Rouge River | Sheppard | Sheppard | 5619 | |||
| 1448494 | Morningside | 401 | Morningside | 401 | Sheppard | Sheppard | 5611 | |||
| 1448526 | Morningside | McLevin | Morningside | McLevin | Sheppard | Sheppard | 5625 | |||
| 1448685 | Sheppard | Meadowvale | Sheppard | Meadowvale | Sheppard | Sheppard | 5621 | |||
| 1448710 | Sheppard | Murison | Sheppard | Murison | Sheppard | Sheppard | 5626 | |||
| 1461700 | Sheppard | Neilson | Sheppard | Neilson | Sheppard | Sheppard | 5614 | |||
| 1455480 | Yonge | Queen | Yonge | Dundas | ||||||
| 1455158 | Spadina | Front | Spadina | Bremner | ||||||
| 1455012 | Bathurst | Front | Bathurst | Fort York | ||||||
| 1428274 | Yonge | Castlefield | Yonge | Yonge | ||||||
| 1448906 | Yonge | Chatsworth | Yonge | Chatsworth | Yonge | Yonge | 5615 | |||
| 1428304 | Lawrence | Mt Pleasant | Lawrence | Mt Pleasant | Yonge | Yonge | 5331 | |||
| 1428319 | Lawrence | Jedburgh | Lawrence | Jedburgh | Yonge | Yonge | 5805 | |||
| 1455525 | Jarvis | King | Jarvis | Front | ||||||
| 1448391 | Consumers | IBM | Consumers | IBM | Sheppard | Herons Hill Way | 5612 | |||
| 1448783 | Sheppard | Settlers | Sheppard | Settlers | Sheppard | Herons Hill Way | 5609 | |||
| 1428120 | Sheppard | Pharmacy | Sheppard | Pharmacy | Sheppard | Herons Hill Way | 4037 | |||
| 1427564 | Victoria Park | 401 | Victoria Park | 401 | Sheppard | Herons Hill Way | 5270 | |||
| 1428097 | Victoria Park | Clydesdale | Victoria Park | Clydesdale | Sheppard | Herons Hill Way | 5271 | |||
| 1454808 | Fort York | Spadina | Bremner | Bathurst | ||||||
| 1455243 | University | College | University | Dundas | ||||||
| 1455385 | University | Queen | University | Dundas | ||||||
| 1454907 | Dufferin | Queen | Dufferin | Dundas | ||||||
| 1454937 | Strachan | King | Strachan | Queen | ||||||
| 1455175 | Spadina | Bremner | Spadina | Front | ||||||
| 1455142 | Spadina | King | Spadina | Front | ||||||
| 1455369 | University | King | University | Queen | ||||||
| 1455256 | University | Dundas | University | Queen | ||||||
| 1454891 | Dufferin | King | Dufferin | Queen | ||||||
| 1454867 | Dufferin | Dundas | Dufferin | Queen | ||||||
| 1454923 | Strachan | Queen | Strachan | King | ||||||
| 1396053 | Lakeshore | Strachan | Lakeshore | Strachan | Lakeshore | Bay | 5060 | |||
| 1393437 | Lakeshore | Dufferin | Lakeshore | Dufferin | Lakeshore | Bay | 5015 | |||
| 1455275 | University | Queen | University | King | ||||||
| 1455351 | University | Front | University | King | ||||||
| 116894 | Gardiner | Grand | Gardiner | Grand | Gardiner | Wickman | 5815 | |||
| 1454879 | Dufferin | Queen | Dufferin | King | ||||||
| 1455628 | Parliament | King | Parliament | Front | ||||||
| 1455400 | University | Dundas | University | College |
with tempa as (select analysis_id, geom, street, start_crossstreet, det1.street1 as det1_st1, det1.street2 as det1_st2, end_street, end_crossstreet, det2.street1 as det2_st1, det2.street2 as det2_st2, det1.bluetooth_id as start_detector, det2.bluetooth_id as end_detector from bluetooth_fixthat2
left join cnangini.detectors det1 on street= det1.street1 and det1.street2 = start_crossstreet
left join cnangini.detectors det2 on end_street = det2.street1 and det2.street2 = end_crossstreet)
select analysis_id, street, start_crossstreet, det1_st1, det1_st2, end_street, end_crossstreet, det2_st1, det2_st2, start_detector, end_detector from tempa where det1_st1 is null or det2_st2 is null
PXadded tocnangini.detectorsfromgis.traffic_signalsby string matching street names. 18 detectors do not have a matching intersection in the gis table:detector_name street1 street2 QU_RO Queen/King Roncesvalles A Gardiner Wickham B Gardiner Grand B1 Gardiner Roncesvalles C Gardiner Dufferin D Gardiner Spadina E Gardiner Parliament F DVP Dundas G DVP Bayview H DVP Don Mills J DVP Lawrence LB Harbour EB Bay Z2 Lakeshore Dufferin Islington Gardiner Islington Spanbridge DVP Spanbridge Beechwood DVP Beechwood Lytton Yonge Lytton/Blythwood Royal York Gardiner Royal York
I was looking at joining detector id and analysis_id together for bluetooth highway and I think this is why the text didnt match for these segments:
For A: typo for wickham, it should be wickman
For G: Bayview is Bayview ramp in segments assuming its 'Bayview Ramp' in gis.traffic.signals too
For LB: Harbour EB is Lakeshore in bluetooth.segments
I think it would be the same for other unmatched intersections. Is it possible the change the street names in detectors so it would be the same as bluetooth.segments or gis.traffic_signals?
@KatiRG - can you check the updated list we just received and identify the following, based on our list of active readers:
a. readers that are currently tagged to the wrong location b. readers that we currently aren't capturing
Thanks!
@KatiRG - can you check the updated list we just received and identify the following, based on our list of active readers:
a. readers that are currently tagged to the wrong location b. readers that we currently aren't capturing
Thanks!
So far, I have found that 7 of our detectors have the same BT Unit # but there is no date_removed specified. Of these, 3 can be resolved by matching with the spreadsheet from Jakob.
Will continue to find other discrepancies. More later...
Regarding Richmond sensors:
-
sensor RM_YO at Richmond and Yonge is currently listed at 43.6519, -79.379295 but should be updated to 43.651478, -79.37895: same intersection but across the street and about 53m away.
-
sensor BR2 at Richmond and Sherbourne currently does not have any coordinates in our table, but we now have it from JJ's table: 43.72617, -79.39692. BR2 is marked in our table as having been removed on 2018-08-31 but since it is in JJ's table that means it is active
There are two sensors with BT Unit # 5272 in our table:
- 5272 at Castlefield and Yonge: matches location of sensor 5799 in JJ's table within ~35 m
- 5272 at College and Ossington: matches location of sensor 5272 in JJ's table within 10 m
We also have a sensor 5799 but with unknown name, unknown intersection, unknown coordinates, but a known IP address that matches the IP address of sensor 5799 of JJ's table.
Therefore, the Duplicate Status column for the Castlefield and Yonge sensor states the following:
This duplicate should now be Unit # 5799.
There are two sensors with BT Unit #5619, located at:
Intersection= "Sheppard and Rouge River": this one matches JJ's tableIntersection= "Yonge and Glengrove": this one does not match JJ's table BUT is not listed as having adate_removed. Therefore, theDuplicate Statusfor this sensor is marked asUNRESOLVEDin the final table
@aharpalaniTO Sensor DU_BV at Dundas and Broadview (BT Unit # 5620) is listed in JJ's table with coordinates 57.06506, 10.132702, which locates to a building in Vester Hassing, Denmark.
Are we to assume that in this case JJ's table is wrong and that DU_BV is in fact at Dundas and Broadview?
Same is true of sensor 5617 at Milner and Murison, therefore kept original coordinates until otherwise advised!
Ready for review by @aharpalaniTO (see email)
Updated the 1st comment based on output from the Blue Tooth Blue Sky meeting
Per discussion with Mohan, think we can skip creating the crossover table between routes and analysis
Per @webgisgeek's investigation, it seems route_point_id pulled from all_analyses aren't actually unique for each detector, so we can't use the values from that table as unique identifiers for our detector-installations (which make up a route).
I've updated the table structure above accordingly.
There should also be documentation in the Update README on how to update the above tables when installing/uninstalling detectors https://github.com/CityofToronto/bdit_data-sources/blob/master/bluetooth/update/README.md for
The start_route_point_id is not unique to a detector. Neither is the end_route_point_id. They are unique for a particular route instead.
| analysis_id | report_id | route_id | route_name | start_route_point_id | start_detector | end_route_point_id | end_detector |
|---|---|---|---|---|---|---|---|
| 1455351 | 1455352 | 1455330 | DT-0115. University-NB_Front-to-King | 1455348 | KN_UN | 1455331 | FR_UN |
| 1455296 | 1455297 | 1455278 | DT-0112. University-SB_King-to-Front | 1455279 | KN_UN | 1455293 | FR_UN |
| 1454366 | 1454367 | 1454355 | DT-0062. King-WB_University-to-Spadina | 1454356 | KN_UN | 1454363 | KN_SP |
| 1454196 | 1454197 | 1454185 | DT-0053. King-EB_Spadina-to-University | 1454193 | KN_UN | 1454186 | KN_SP |
| 1454352 | 1454353 | 1454343 | DT-0061. King-WB_Yonge-to-University | 1454349 | KN_UN | 1454344 | KN_YO |
| 1455443 | 1455444 | 1455430 | DT-0121. Yonge-SB_King-to-Front | 1455431 | KN_YO | 1455440 | FR_YO |
| 1454224 | 1454225 | 1454213 | DT-0055. King-EB_Yonge-to-Jarvis | 1454214 | KN_YO | 1454221 | KN_JA |
| 1454340 | 1454341 | 1454329 | DT-0060. King-WB_Jarvis-to-Yonge | 1454337 | KN_YO | 1454330 | KN_JA |
| 1454209 | 1454210 | 1454200 | DT-0054. King-EB_University-to-Yonge | 1454206 | KN_YO | 1454201 | KN_UN |
| 1455427 | 1455428 | 1455415 | DT-0120. Yonge-SB_Queen-to-King | 1455424 | KN_YO | 1455416 | QU_YO |
| 1455468 | 1455469 | 1455459 | DT-0123. Yonge-NB_King-to-Queen | 1455460 | KN_YO | 1455465 | QU_YO |
Suggestions:
reader_locations: this is a table of all locations at which Bliptrack readers have been installed and are currently deployedlocation_id: unique ID for a unique reader/detector name from theroute_pointscolumn inall_analyses, this should not be theroute_point_id, which is unique for each point of each route.name: e.g. QN_SP (two characters for E/W street, two characters for N/S street)geomint_id: centreline intersection id, for closest intersection. Preferred over px because highway detectors won't be near a signalized intersection, but there could be a logical location that would be an intersection... nodedate_active: first date at which there was data at this locationdate_inactive: NULL unlessdate_last_receivedis not the most recent datedate_last_received: updated daily if the reader is still producing data (if thereader_historyassociated with that location has beenuninstalled)project_namestatus:onlineorofflineonly
reader_location_history: table of detectors which have been installed at eachreader_locationat any given point.reader_history_id: unique ID for the tablelocation_id: foreign key toreader_locationsbt_id: device id for bluetoothwifi_iddate_installeddate_uninstalled
routes: unique segments on which data is collectedanalysis_id: analysis id from theall_analysestablenamestart_street_namestart_cross_streetstart_location_id: correspondinglocation_idfrom thereader_locationstableend_street_nameend_cross_streetend_location_id: correspondinglocation_idfrom thereader_locationstablegeomdate_activedate_inactive
reader_gaps: gaps of which "we think" detector has no datalocation_idint, --unique id from reader_locationsstart_datetime-- start of gapend_datetime-- end of gap
Renaming reader_id to location_id to be more clear, and shrinking the reader_status_history table to reader_gaps table to include dates where it doesn't work instead of the other way around.