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

Any command / set of steps to be able to test new changes to the API *.ts files? #893

Closed
lerlands opened this issue Nov 30, 2021 · 2 comments

Comments

@lerlands
Copy link

lerlands commented Nov 30, 2021

I have spent time looking for ways to extend the idealpostcodes repository and API service. There are shape files available from official sources for OA, LSOA, MSOA, parish, wards, counties, constituencies and others. These can be converted into postgis files/commands that can be loaded as POLYGON data in the database, and searched for by lat/lon coordinates. I have done this, and it is working well. Happy to share...

I have developed new API controllers and models to access the shape data. I have spent aaages looking for ways to extend the API docker container to also accept the new 'ts' files. Complete failure. I have also tried to make subtle variations on existing controllers and model files to find a way for the docker container to accept the new changes, and make use of them. And I have failed. Again.

  • Is there a set of steps to copy the api src directories into the containers, and re-compute the node server?
  • Could the api src files maybe be set up as mounted directories in the container, rather than 'COPY' commands in the Dockerfile?
  • Could the Makefile be extended with a target to allow typing 'make api' or something similar?
  • Any clues to how I can help to develop this myself, and submit a pull request?

Thanks,
Lars Erlandsen.

@cblanc
Copy link
Member

cblanc commented Dec 1, 2021

Hi Lars

Thats sounds like a great deal of work already. Perhaps you can push up your existing PR however rough.

How to expose and query this data is almost a separate problem with lots of difficult tradeoffs in terms of performance and ergonomics

Our colleague @mfilip made a start a while back in this branch here, https://github.com/ideal-postcodes/postcodes.io/compare/boudaries, but we've been quite distracted lately so not much progress. Not sure what state this is in, but could be some help.

Wrt the docker image, it should be relatively straightforward to rebuild the API container. A docker build on the main Dockerfile will suffice - this should incorporate your new ts files. The hard part is adding the data. This is built with Dockerfile.pg which pulls down a compressed pg_dump. Of course, your work will not contain the new datasets so you would have to locally rebuild, and inject the updated pg_dump into the container.

  • Any clues to how I can help to develop this myself, and submit a pull request?

Feel free to submit a draft/rough PR

@lerlands
Copy link
Author

lerlands commented Dec 2, 2021

Hi, Christopher.

Thanks for speedy reply. Just the shot in the arm that I needed. Will try the hints, and report back.

Will get back with a rough pull request a little later. There is sooooo much good data available from official HM websites. And 'shp2pgsql' takes 98% of the work out of geometry calculations and projections...

The API provided makes it easy to interface with one of the leaflet.js search libraries 'leaflet-search' (https://opengeo.tech/maps/leaflet-search/). I wrote one in a very brief space of time. I haven't submitted any pull requests to them for fear of loading your API with many additional requests. It works a dream in my docker container.

@cblanc cblanc closed this as completed Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants