nhsx/nhs_time_of_travel

Flagging similar work using R in NHS Wales

stupidpupil opened this issue · 4 comments

Hello @mattia-ficarelli and @pauliecarroll, I don't if you'd be interested in some work I did Wales on trying to make travel-time-analysis more accessible.

The main product was a set of weekly-updating LSOA-to-LSOA matrices, covering driving and public transport for Wales and bordering regions, but this is built using tools in R that are more flexible. I gave a presentation at an NHS-R conference in November 2021 which gives a bit more detail on approach.

I note that this doesn't solve some of the more significant issues, like obtaining public per-way speed data (instead it falls back on UK-wide averages from 2017).

(Hope it's okay to communicate this as an 'issue'! Wasn't sure of a better approach.)

Hi @stupidpupil , thanks for getting in touch, and great to see some similar work in this space. We've recently picked up the work again, and are developing this to improve the functionality and add use cases into the repo, but are now storing the new repo here. https://github.com/nhs-pycom/nhs_time_of_travel.
I'd be very interested to look through your code for the tool you built, do you have a link to the repo/ github page? my email is paul.carroll9@nhs.net, very happy to continue this conversation.

Thanks Paul.

{parochial} is an R package that helps build OpenTripPlanner, Conveyal R5 and Open Source Routing Machine (OSRM) networks for bits of Great Britain, either locally or using GitHub Actions. It just wraps a bunch of other tools, in a slightly ropey manner.

https://github.com/stupidpupil/wales_ish_otp_graph/ is an example of using it to build those networks, weekly, for Wales and bordering bits of England.

The easiest way to get an idea of the work it does might be to look at a recent action run.

The presentation linked above is still mostly accurate (and links to GitHub repos throughout), although I've now split 'parochial' out from the work (that was originally more tied to Wales).

Those Wales-ish networks are now used to build a few products:

I see you're working in R, we're working in Python for this problem, but have come across some of the same type of issues with data storage and space.
I've now started using the Pyrosm package in python for creating network maps, last night I ran the pbf file for Wales, it still took 34 minutes, but it's a lot faster than the way I was previously creating networkx maps for regions or area, where it would have been hours if it had run at all. And you can cache the data file afterward. I ran on my own laptop, a 16gb ram, macbook, with 8gb ram it may crash your laptop. But this package is definitely worth checking out. https://pyrosm.readthedocs.io/en/latest/
I'll take a look through the links in your message today thank you.

Doing the analysis itself in Python - and the opportunities that affords you to more easily improve e.g. speeds on individual road segments - looks really interesting.

(A lot of what parochial does is wrap external tools like osmium, pfaedle etc. and avoids actually pulling stuff into R, which has its limitations.)