bhelx / nola-transit

iOS and Android Mobile application for New Orleans public transportation
MIT License
0 stars 0 forks source link

Admin Panel (and database distribution platform) #48

Open bhelx opened 6 years ago

bhelx commented 6 years ago

We need to start a backend and admin panel. From the admin panel we need to be able to upload new sqlite databases (as they come from NORTA) which get distributed to the users.

bhelx commented 6 years ago

I'm gonna think about the easiest way to do this. I think we may be able to get away with making this a jekyll site hosted on CDN. The harder part will be having the phone properly switching out the database at the right time.

bhelx commented 6 years ago

Works something like this maybe, you have one file called something like https://cdn.example.com/migrations.json:

{
  "migrations": [
    {
      "uploaded_at": "2018-01-01T08:00:00Z",
      "starts_at":  "2018-01-05T08:00:00Z",
      "url": "https://cdn.example.com/databases/2018-01-05T08:00:00Z.sqlite"
    },
  ]
}

uploaded_at is when the file was uploaded. starts_at is when the GTFS becomes valid (when the app needs to switch to this database). url tell the app where to get this database.

The mobile app can poll this every once in a while (maybe once a day or whenever opened). It all happens asynchronously and in the background.

bhelx commented 6 years ago

This is now live here and can be managed from git here: https://github.com/bhelx/where-ya-ride-site The migrations file can be reached here: https://bhelx.github.io/where-ya-ride-site/mobile/migrations.json You then use the urls to get a database like this: https://bhelx.github.io/where-ya-ride-site/mobile/databases/GTFS-2018-01-15T00:00:00Z.sqlite