SmartCambridge / tfc_web

Web access to the TFC platform
MIT License
3 stars 2 forks source link

Replace /api/dataserver use in tfc_web/transport/views.py #180

Open jw35 opened 6 years ago

jw35 commented 6 years ago

There remain some references to /api/dataserver in tfc_web/transport/views.py. I'm having some problem following the dependancies. I think two of the references relate to probably obsolete /zones/ and /zone/ endpoints, and one to getting SIRI data at /transport/busdata.json, probably for /transport/map_old/? @abrahammartin can you confirm?

The zone stuff could be converted to the new API, but not the SIRI stuff since we don't have a new API for that and the right route is probably rt_monitor.

abrahammartin commented 6 years ago

All dependencies of dataserver can be found here: https://github.com/ijl20/tfc_web/search?q=API_ENDPOINT&unscoped_q=API_ENDPOINT

Also the transport API uses the siriVM file feed here (instead of the dataserver feed like the map_old): https://github.com/ijl20/tfc_web/blob/5f42ba6fc1c865763269b67aa7173d84ab9e2205/tfc_web/transport/api/views.py#L311

map_old could stop working as long as we implement the missing features that the current map do not have but the old one does.

The transport API siriVM_to_journey do not depend of dataserver and will only stop working if data_monitor stops working (/media/tfc/sirivm_json/data_monitor/). See: https://github.com/ijl20/tfc_web/blob/5f42ba6fc1c865763269b67aa7173d84ab9e2205/tfc_web/transport/api/views.py#L311 I think we need to maintain this API endpoint and make it private so only we can use it, as it is very likely that we will use it soon for other purposes.

jw35 commented 6 years ago

All dependencies of dataserver can be found here: https://github.com/ijl20/tfc_web/search?q=API_ENDPOINT&unscoped_q=API_ENDPOINT

As far as I can see this is searching 'master', which makes it hard to see what I've fixed in jw35-replace-dataserver. But I think the only remaining references are in tfc_web/transport/views.py

Also the transport API uses the siriVM file feed here (instead of the dataserver feed like the map_old):

tfc_web/tfc_web/transport/api/views.py

Line 311 in 5f42ba6

Path('/media/tfc/sirivm_json/data_monitor/' + listdir('/media/tfc/sirivm_json/data_monitor/')[0])

That's not an issue here.

map_old could stop working as long as we implement the missing features that the current map do not have but the old one does.

And we should - covered by #156

The transport API siriVM_to_journey do not depend of dataserver and will only stop working if data_monitor stops working (/media/tfc/sirivm_json/data_monitor/). See:

tfc_web/tfc_web/transport/api/views.py

Line 311 in 5f42ba6

Path('/media/tfc/sirivm_json/data_monitor/' + listdir('/media/tfc/sirivm_json/data_monitor/')[0])

I think we need to maintain this API endpoint and make it private so only we can use it, as it is very likely that we will use it soon for other purposes.

I'm not entirely convinced that a poling API endpoint is appropriate here - surely a pushed web sockets interface would be better for data changing with this frequency? In which case we could (in due course) drop this endpoint from the API. And in the mean time we could hide it. In any case /api/dataserver isn't involved so this isn't an issue here (but see #143).

jw35 commented 6 years ago

So I think we understand /transport/busdata.json

Anyone know anything about the /zones/ and /zone/ endpoints? They don't seem to work - with /zones/ giving

Reverse for 'zone' with arguments '('',)' not found. 1 pattern(s) tried: ['zone/(?P<zone_id>\\w+)/$']