Skip to content

feat(buildings): automated weekly building data pipeline - #91

Open
dotSol0 wants to merge 8 commits into
devfrom
automated-buildings-squash
Open

dotSol0 wants to merge 8 commits into
devfrom
automated-buildings-squash

Conversation

@dotSol0

@dotSol0 dotSol0 commented Sep 19, 2026 •

Copy link
Copy Markdown

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

  • New feature (feat)
  • Bug fix (fix)
  • Refactor / code improvement
  • Dependency / build update
  • Documentation
  • Other (explain)

Related Issues

Closes #XX

Changes Made

  • Flutter:
    • None
  • Backend (TypeScript):
    • building_checker.ts: queries OSM (Overpass) per bounding box, drops entries without an address, reverse-geocodes entries missing lat/long, writes per-box *-complete.json
      files
    • merge_buildings.ts: merges all *-complete.json files 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: /getBuildingLocations now serves merged-buildings.json
    • Added tests (building_checker.test.ts, merge_buildings.test.ts) and pipeline docs
  • Firebase / Shared:
    • Added node-cron dependency
    • tsconfig.json: target/lib es2020, node types
    • .gitignore: raw OSM downloads and local .jac/ db
    • Generated building data under src/assets/buildings/

Testing Done

Flutter:

  • Tested on:
    • iOS Simulator
    • Android Emulator
    • Physical device

N/A, backend-only change.

Screenshots / Demo (if UI or notification change)

N/A

Checklist

  • Commit messages follow Conventional Commits
  • PR title follows [type](scope): short description
  • PR target branch is not main and is our current working update branch (e.g. maizebus2.1)
  • No print() / debugPrint() / console.log() left in production code
  • Secrets / keys not committed

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>
@dotSol0
dotSol0 force-pushed the automated-buildings-squash branch from f3449e9 to 3038397 Compare September 19, 2026 03:11
@dotSol0
dotSol0 requested a review from jumpy-cat September 19, 2026 03:13
@jumpy-cat jumpy-cat added this to the maizebus 3 (the sequel) milestone Oct 5, 2026

@jumpy-cat jumpy-cat left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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' }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Comment thread src/services/building_checker.ts Outdated
});

// API endpoints for OSM data
const box4Url = 'https://api.openstreetmap.org/api/0.6/map?bbox=-83.758000,42.281000,-83.748000,42.288000';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also make this url configurable (see nominatim comment)

Suggested change
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`;
// ...

Comment thread src/services/building_checker.ts Outdated
Comment on lines +383 to +386
// Keep the process running
process.on('SIGINT', () => {
process.exit(0);
});

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this looks like it catches the interrupt to just exit anyway? probably remove

Suggested change
// Keep the process running
process.on('SIGINT', () => {
process.exit(0);
});

@mbusdev mbusdev deleted a comment from jumpy-cat Oct 27, 2026

This branch has not been deployed

No deployments
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.

2 participants