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

Add map data endpoints #123

Merged
merged 2 commits into from
Jan 28, 2024
Merged

Add map data endpoints #123

merged 2 commits into from
Jan 28, 2024

Conversation

Andrew-Dickinson
Copy link
Member

Adds endpoints that are compatible with the data format used on the website map.

The data is not strictly equal, since there is some data loss during our import process this is mostly due to NN/install number shenanigans (status fields being another example). However, these new map endpoints are in the format expected by the map, and spot checks confirm that the data is isomorphic.

Due to the lack of pagination, these endpoints are quite slow (10+ seconds in some cases), but this should hopefully ease integration on the other side. This latency is fine because the data is packaged into JS code asynchronously, users get a pre-computed artifact.

We still need to make changes on the map backend in order to get this JSON data packaged up into the Javascript code, but hopefully that is essentially trivial with the format I'm providing here.

Also adds unit tests to cover most cases of the logic in new endpoints

@andybaumgar
Copy link
Collaborator

I wonder why they are slow.

@andybaumgar
Copy link
Collaborator

Outside this scope, but we could also host our own map pretty easily.

@Andrew-Dickinson
Copy link
Member Author

I wonder why they are slow

I think it’s the serialization. DB scans are pretty fast, but to generate 1.7 MB of JSON is actually quite a bit of string parsing / manipulation

Outside this scope, but we could also host our own map pretty easily.

Agreed, but one thing at a time

Copy link
Collaborator

@WillNilges WillNilges left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

src/meshapi/serializers.py Outdated Show resolved Hide resolved
@Andrew-Dickinson Andrew-Dickinson merged commit 1a95586 into main Jan 28, 2024
4 checks passed
@Andrew-Dickinson Andrew-Dickinson deleted the map-endpoint branch July 27, 2024 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants