Repository navigation
Conversation
Added a pipeline that pulls every addressed building in Ann Arbor and Ypsilanti (including Hadley and WV) from OpenStreetMap and merges it with the campus building data, so app search can find any building. It runs weekly on Sundays at 3 AM (America/New_York) and /getBuildingLocations now serves the merged file. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
f3449e9 to
3038397
Compare
jumpy-cat
left a comment
There was a problem hiding this comment.
Merge from dev into your branch so that you can resolve the merge conflicts (github has a ui for this, or you can do it locally). Other than that there are a few small nits about unused code and would want you to make the urls used configurable so I can setup a proxy/cache similar to how bustime requests are handled right now.
Also note that squashing will happen at PR merge time, no need to do it yourself. If anything I'd prefer to have the commit history available.
| * | ||
| * Bounding box format: (south, west, north, east) | ||
| */ | ||
| export async function fetchLocationsByBoundingBox( |
There was a problem hiding this comment.
I notice this function doesn't seem to be used, perhaps add a note?
| async function reverseGeocode(lat: number, lon: number): Promise<LocationAddress> { | ||
| const url = `https://nominatim.openstreetmap.org/reverse?lat=${lat}&lon=${lon}&format=json&addressdetails=1`; | ||
| const response = await axios.get(url, { | ||
| headers: { 'User-Agent': 'mbus-backend/1.0' } |
There was a problem hiding this comment.
Nice following of the nominatim usage policy. Lets also make the url configurable so that duplicate requests from the different backend deployments don't cause any issues. See how MBUS_URL and RIDE_URL affect the mbus and ride services for an example.
| }); | ||
|
|
||
| // API endpoints for OSM data | ||
| const box4Url = 'https://api.openstreetmap.org/api/0.6/map?bbox=-83.758000,42.281000,-83.748000,42.288000'; |
There was a problem hiding this comment.
Also make this url configurable (see nominatim comment)
| const box4Url = 'https://api.openstreetmap.org/api/0.6/map?bbox=-83.758000,42.281000,-83.748000,42.288000'; | |
| const osmUrl = process.env.OSM_URL ?? 'https://api.openstreetmap.org'; | |
| const box4Url = `${osmUrl}/api/0.6/map?bbox=-83.758000,42.281000,-83.748000,42.288000`; | |
| // ... |
| // Keep the process running | ||
| process.on('SIGINT', () => { | ||
| process.exit(0); | ||
| }); |
There was a problem hiding this comment.
this looks like it catches the interrupt to just exit anyway? probably remove
| // Keep the process running | |
| process.on('SIGINT', () => { | |
| process.exit(0); | |
| }); |
Description
Added an automated weekly pipeline that pulls every addressed building in Ann Arbor and Ypsilanti (including Hadley and WV) from OpenStreetMap and merges it with the campus building data, so app search can find any building.
Type of Change
feat)fix)Related Issues
Closes #XX
Changes Made
building_checker.ts: queries OSM (Overpass) per bounding box, drops entries without an address, reverse-geocodes entries missing lat/long, writes per-box*-complete.jsonfiles
merge_buildings.ts: merges all*-complete.jsonfiles with campus data, deduping by address (prefers entries with an abbreviation, then a name)jobs.ts: node-cron job runs both steps Sundays at 3 AM (America/New_York)api.ts:/getBuildingLocationsnow servesmerged-buildings.jsonbuilding_checker.test.ts,merge_buildings.test.ts) and pipeline docsnode-crondependencytsconfig.json: target/lib es2020, node types.gitignore: raw OSM downloads and local.jac/dbsrc/assets/buildings/Testing Done
Flutter:
N/A, backend-only change.
Screenshots / Demo (if UI or notification change)
N/A
Checklist
[type](scope): short descriptionmainand is our current working update branch (e.g.maizebus2.1)print()/debugPrint()/console.log()left in production code