remulasce / metroapp

Realtime arrival notification utility for LA Metro
2 stars 0 forks source link

Use scraper-generated data to generate autocomplete suggestions #236

Closed remulasce closed 9 years ago

remulasce commented 9 years ago

See #228

Using the scraper standardizes the static data between iOS and Android, and allows us to generate mappings for any NexTrip-served agency, instead of relying on gtfs-middleman files.

remulasce commented 9 years ago

This doesn't actually have any prerequisites, since the table format should be identical.

We just lose out on either bus / rail until we implement #237.

remulasce commented 9 years ago

238 depends upon this task.

remulasce commented 9 years ago

Oh hey.

@nighelles already did this.

And he made a joined table for all of lametro which allows us to use it without losing either bus / rail.

Testing now.

remulasce commented 9 years ago

2 issues: Issue 1: It doesn't seem to be working immediately off the new database. I think it's because of the preload library. I'm going to try upping the database version to see if we can force a redeploy of the db file.

Issue 2: Looking at the merged lametro database with sqlitebrowser (3rd party app), some of the entries have null uniqueids.

It seems to be the last half of the rail stops. I don't know why. Maybe something to do with the db merge?

remulasce commented 9 years ago

Ok. I had to up the database version number in the preloaded database helper. Then I had to set the helper to overwrite the database with the new one, instead of trying to migrate everything the old database had.

Now it is actually using the new database, and we can remove the string check.

remulasce commented 9 years ago

Time savings: old 146 162 145

new 36 3 3

... Yeah.

These times in ms across just the inner "add entry" portion of sqlpreloadedstopsreader. With / WO the comments over the string match.

        long t2 = Tracking.startTime();
        for (SQLEntry entry : matchingEntries) {
            // Each station entrance in Metro has its own stopID.
            // Duplicates have letters at the end; originals are straight digits.
            // Only add the originals

// if (entry.stopID.matches("\d+$")) { // Try to only put stuff in once if (!tmp.containsKey(entry.stopName)) { OmniAutoCompleteEntry newEntry = new OmniAutoCompleteEntry(entry.stopName, 1); Stop newStop = new Stop(entry.stopID); newStop.setLocation(new BasicLocation(entry.latitude, entry.longitude)); newEntry.setStop(newStop); newStop.setAgency(new Agency(LaMetroUtil.getAgencyFromRoute(null, newStop))); tmp.put(entry.stopName, newEntry); } // } else { // Log.w(TAG, "Found a stop we shouldn't have in the database!"); // } } Log.d(TAG, "Autocomplete search time with string check: "+Tracking.timeSpent(t2));