Skip to content

Fix the formatting on the README #2

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

Merged
merged 1 commit into from
Nov 7, 2014
Merged

Conversation

shankari
Copy link
Contributor

@shankari shankari commented Nov 7, 2014

This should fix issue #1 and also gives me practice with the fork and pull workflow

shankari added a commit that referenced this pull request Nov 7, 2014
Fix the formatting on the README
@shankari shankari merged commit e67c1e4 into e-mission:master Nov 7, 2014
@shankari shankari deleted the ticket_1 branch November 7, 2014 08:37
@shankari shankari mentioned this pull request Feb 11, 2015
@shankari shankari mentioned this pull request Jun 2, 2015
tsekylekobie pushed a commit to tsekylekobie/e-mission-server that referenced this pull request Feb 16, 2018
shankari pushed a commit that referenced this pull request Apr 18, 2019
shankari pushed a commit that referenced this pull request Apr 26, 2019
merging changes into my fork
@shankari shankari mentioned this pull request May 6, 2019
shankari pushed a commit that referenced this pull request May 8, 2019
* update to current greentrip branch (#2)

* Deleted the changes.patch and applied the patch

* Made changes based on first pull-request comments and added suggestion_sys to API file

* Converted the original functions to use Nominatim, tested on data and works
Kept the old functions just in case the something horribly wrong happens to the current functions
Changed the API call to a call to Nominatim

* Deleted patch

* Suggestion System Debugged  (#619)

* Made changes to use nominatim.py reverse geocode for any lookup regarding nominatim. Suggestions should pop up now, debugged it and should work.

* Removed patch

* Resolved comments on pull request for nominatim json, googlemaps json is still being used so will need to restructure code

* Function using only Trip ID completed and should be working (#620)

* Made changes to use nominatim.py reverse geocode for any lookup regarding nominatim. Suggestions should pop up now, debugged it and should work.

* Removed patch

* Resolved comments on pull request for nominatim json, googlemaps json is still being used so will need to restructure code

* Debugged and finished the single trip function

* Got rid of the redundant googlemaps json calls and fixed the functions so that it works for the except case (that was why it was bugging on other trips)

* Responded to comments for uuid and uuid first before tripid

* Got rid of the edb lines

* Got rid of the import statement for edb

* Added more comments and addressed the pull-request comments in the code
Also changed the indexing to be directly indexing for the trip_id, not sure
if it got rid of taking extra space in memory by creating a copy

* Finished changing location to lat lon for inputs and switched to using abstract time series function

* Fixed all the nits

* Fixed suggestion bugs involving cities, towns, and zipcodes and edited the yelpfusion.json.sample to provide information

* made changes to json sample

* timeseries

* Fixed the routing for webapp and added more fields to the return statements for the phone

* Fixed nit from routing "overall" to "recent"

* Fixed single suggestion and recent suggestion, same as the server version

*  Changed to tripidstr instead of confusing variable names

* Fixed tripidstr and tripid discreption

* Improved performance of the main suggestion function, supporting the suggestions page, added trip id for Samantha to pull from the trip diary, fixed Sam and Bill's trips

* adding greentrip site

* created new branch and applied changes in regards to print statements

* got rid of double quotes on trip_id and resolved the trip_id = None

* changed tripids to what they were originally and fixed the nominatim files

* added link to previous work

* fixed zipcode api erroring

* moving around files to fit directory structure

* added client setup with qr code

* fixing client html was wonky

* added testing qr code video

* added shankari's changes

* adding new client change at bottom

* removing video

* Updated the suggestion functions to output the alias for Trevor's function (#649)

* made changes to the yelp-function, so trevor can retrieve the alias

* made changes to the single-trip to reflect the new yelp function changes

* tested

* reverted the timeseries sample

* website debugging, alternating javascript, learn more page changes (#650)

* now automatic link change for half control and half experimental

* alternating qr code image now in place

* minor fixes with shankari image and learn_more link

* secure jQuery link

* learn more page now has more limited information

* local changes complete and tested

* Committing last set of website changes for Sam

This is the final clean version of
#653
and
#651

* added parameters to make suggestions less wordy

* New client setup page. Added new image for page in www/img and also made client page more readable

* Removed the specs

* Add the additional keys required to the yelpfusion.json file

* Add the other fields required for the googlemaps json sample

* Merge two almost-identical copies of suggestion system generation

+ make it easier to test

In order to generate the merged version, I extracted the two separate versions
and used vimdiff to unify the changes. Even after unifying the largely cosmetic
changes, I found two fixes to the recent suggestion method that had not been
ported to the trip suggestion method.

After merging those, the only differences were to the inputs and the outputs,
which made the refactoring straightforward.

Testing done:
- Pick a location in a residential area (opposite Lincoln Elementary school in
  Daly City)
- Pick a location with lots of establishments (Cinema complex opposite Daly
  City BART station)
- Call the new method to generate a suggestion
    ```
    In [1]: import emission.core.wrapper.suggestion_sys as sugg
    Connecting to database URL localhost

    In [2]: import geojson as gj

    In [3]: start_loc = gj.Point((-122.4831506, 37.6764811))

    In [4]: end_loc = gj.Point((-122.4706021, 37.7019950))

    In [5]: sugg.calculate_yelp_server_suggestion_for_locations(start_loc, end_loc, 3000)
    Out[5]:
    {'businessid': None,
     'message': 'Your endpoint has either been a non-serviceable category or a closeby option.',
     'method': 'public transportation',
     'rating': None}
    ```
- Load test timeline data
- Run pipeline
- Call method to generate most recent suggestion
    ```
    In [6]: from uuid import UUID

    In [7]: test_uuid = UUID("29adc2d9-e157-4fe1-a700-4075619f1e30")

    In [8]: sugg.calculate_yelp_server_suggestion_nominatim(test_uuid)
    Out[8]:
    {'businessid': None,
     'message': 'Sorry, unable to retrieve datapoint because datapoint is a house or datapoint does not belong in service categories',
     'method': 'bike',
     'question': None,
     'rating': None,
     'suggested_loc': None,
     'tripid': ObjectId('5cba04fcf6858fcbf006239f')}
    ```
- Call method to generate suggestion for a particular trip

```
In [9]: import bson.objectid as boi

In [11]: sugg.calculate_yelp_server_suggestion_singletrip_nominatim(test_uuid, boi.Objec
    ...: tId("5cba04fcf6858fcbf006239f"))
Out[11]:
{'businessid': None,
 'message': 'Sorry, unable to retrieve datapoint because datapoint is a house or datapoint does not belong in service categories',
 'method': 'bike',
 'question': None,
 'rating': None,
 'suggested_loc': None}
```
None of these generated any relevant suggestions but also did not fail

* Refactor the destination business lookup to avoid repetition

For us to make relevant suggestions, we really need to be able to figure out
what the destination was. The current code munges the destination lookup and
the category lookup, which makes it hard to identify whether the destination
lookup was incorrect or only the category.

There are also other questions - do we even need to try to look up the
destination business, or is it enough to get a rough idea of the address and do
an address search...

All of these will be much easier to answer if the code is structured in a way
that makes sense and the individual components can be tested separately.

This change accomplishes that restructuring.
It still does not address the copy-pasting in the try/catch blocks in the
google code, but I don't want to make this harder to review than it already is

Testing done:
- Ran the two new functions + overarching suggestion call manually; there are no errors.
    - Note that the nominatim call failed because there was no 'city' in the
      response - it looks like the fixes to look for the town instead in
      `calculate_yelp_server_suggestion_for_locations` were not ported here. We fall
      through to the google API, which also fails because of the improperly formatted
      address. But this predates my change.

```
In [1]: import emission.core.wrapper.suggestion_sys as sugg
Connecting to database URL localhost

In [2]: sugg.find_destination_business("37.7019950", "-122.4706021")
Out[2]: (None, '1901G Junipero Serra Blvd', 'San Mateo County', True)

In [3]: import logging

In [4]: logging.getLogger().setLevel(logging.DEBUG)

In [5]: sugg.find_destination_business("37.7019950", "-122.4706021")
DEBUG:root:parsed_response = {'place_id': '525262', 'licence': 'Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright', 'osm_type': 'way', 'osm_id': '183198747', 'lat': '37.7008995', 'lon': '-122.4707415', 'display_name': 'Junipero Serra Boulevard, Westlake, Daly City, San Mateo County, 94014, United States of America', 'address': {'road': 'Junipero Serra Boulevard', 'neighbourhood': 'Westlake', 'town': 'Daly City', 'county': 'San Mateo County', 'postcode': '94014', 'country': 'United States of America', 'country_code': 'us'}}
DEBUG:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): maps.googleapis.com
DEBUG:requests.packages.urllib3.connectionpool:https://maps.googleapis.com:443 "GET /maps/api/geocode/json?latlng=37.7019950,-122.4706021& HTTP/1.1" 200 1450
DEBUG:root:Components from address lookup = [{'long_name': '1901G', 'short_name': '1901G', 'types': ['street_number']}, {'long_name': 'Junipero Serra Boulevard', 'short_name': 'Junipero Serra Blvd', 'types': ['route']}, {'long_name': 'Daly City', 'short_name': 'Daly City', 'types': ['locality', 'political']}, {'long_name': 'San Mateo County', 'short_name': 'San Mateo County', 'types': ['administrative_area_level_2', 'political']}, {'long_name': 'California', 'short_name': 'CA', 'types': ['administrative_area_level_1', 'political']}, {'long_name': 'United States', 'short_name': 'US', 'types': ['country', 'political']}, {'long_name': '94014', 'short_name': '94014', 'types': ['postal_code']}]
DEBUG:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): maps.googleapis.com
DEBUG:requests.packages.urllib3.connectionpool:https://maps.googleapis.com:443 "GET /maps/api/place/nearbysearch/json?location=37.7019950,-122.4706021&radius=10& HTTP/1.1" 200 1231
DEBUG:root:For amenity Daly City, comparing address 1901G Junipero Serra Boulevard, San Mateo County with nearby business Daly City
DEBUG:root:For amenity Tomo Sushi & Teriyaki, comparing address 1901G Junipero Serra Boulevard, San Mateo County with nearby business 1901 Junipero Serra Boulevard # G, Daly City
DEBUG:root:After checking = 1901G Junipero Serra Boulevard, San Mateo County, got business tuple (False, '')
DEBUG:root:Nominatim failed, Google found destination business (None, '1901G Junipero Serra Blvd', 'San Mateo County', True)
Out[5]: (None, '1901G Junipero Serra Blvd', 'San Mateo County', True)
```

```
In [4]: sugg.category_of_business_nominatim("37.7019950", "-122.4706021")
DEBUG:root:parsed_response = {'place_id': '525262', 'licence': 'Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright', 'osm_type': 'way', 'osm_id': '183198747', 'lat': '37.7008995', 'lon': '-122.4707415', 'display_name': 'Junipero Serra Boulevard, Westlake, Daly City, San Mateo County, 94014, United States of America', 'address': {'road': 'Junipero Serra Boulevard', 'neighbourhood': 'Westlake', 'town': 'Daly City', 'county': 'San Mateo County', 'postcode': '94014', 'country': 'United States of America', 'country_code': 'us'}}
DEBUG:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): maps.googleapis.com
DEBUG:requests.packages.urllib3.connectionpool:https://maps.googleapis.com:443 "GET /maps/api/geocode/json?latlng=37.7019950,-122.4706021& HTTP/1.1" 200 1450
DEBUG:root:Components from address lookup = [{'long_name': '1901G', 'short_name': '1901G', 'types': ['street_number']}, {'long_name': 'Junipero Serra Boulevard', 'short_name': 'Junipero Serra Blvd', 'types': ['route']}, {'long_name': 'Daly City', 'short_name': 'Daly City', 'types': ['locality', 'political']}, {'long_name': 'San Mateo County', 'short_name': 'San Mateo County', 'types': ['administrative_area_level_2', 'political']}, {'long_name': 'California', 'short_name': 'CA', 'types': ['administrative_area_level_1', 'political']}, {'long_name': 'United States', 'short_name': 'US', 'types': ['country', 'political']}, {'long_name': '94014', 'short_name': '94014', 'types': ['postal_code']}]
DEBUG:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): maps.googleapis.com
DEBUG:requests.packages.urllib3.connectionpool:https://maps.googleapis.com:443 "GET /maps/api/place/nearbysearch/json?location=37.7019950,-122.4706021&radius=10& HTTP/1.1" 200 1228
DEBUG:root:For amenity Daly City, comparing address 1901G Junipero Serra Boulevard, San Mateo County with nearby business Daly City
DEBUG:root:For amenity Tomo Sushi & Teriyaki, comparing address 1901G Junipero Serra Boulevard, San Mateo County with nearby business 1901 Junipero Serra Boulevard # G, Daly City
DEBUG:root:After checking = 1901G Junipero Serra Boulevard, San Mateo County, got business tuple (False, '')
DEBUG:root:Nominatim failed, Google found destination business (None, '1901G Junipero Serra Blvd', 'San Mateo County', True)
DEBUG:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.yelp.com
DEBUG:requests.packages.urllib3.connectionpool:https://api.yelp.com:443 "GET /v3/businesses/search?location=1901G%2BJunipero%2BSerra%2BBlvd HTTP/1.1" 200 None
Out[4]: ['grocery', 'korean', 'bbq']
```

```
In [5]: import geojson as gj

In [6]: start_loc = gj.Point((-122.4831506, 37.6764811))
   ...:

In [7]: end_loc = gj.Point((-122.4706021, 37.7019950))

In [8]: sugg.calculate_yelp_server_suggestion_for_locations(start_loc, end_loc, 3000)
DEBUG:root:parsed_response = {'place_id': '525262', 'licence': 'Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright', 'osm_type': 'way', 'osm_id': '183198747', 'lat': '37.7008995', 'lon': '-122.4707415', 'display_name': 'Junipero Serra Boulevard, Westlake, Daly City, San Mateo County, 94014, United States of America', 'address': {'road': 'Junipero Serra Boulevard', 'neighbourhood': 'Westlake', 'town': 'Daly City', 'county': 'San Mateo County', 'postcode': '94014', 'country': 'United States of America', 'country_code': 'us'}}
DEBUG:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): maps.googleapis.com
DEBUG:requests.packages.urllib3.connectionpool:https://maps.googleapis.com:443 "GET /maps/api/geocode/json?latlng=37.701995,-122.4706021& HTTP/1.1" 200 1450
DEBUG:root:Components from address lookup = [{'long_name': '1901G', 'short_name': '1901G', 'types': ['street_number']}, {'long_name': 'Junipero Serra Boulevard', 'short_name': 'Junipero Serra Blvd', 'types': ['route']}, {'long_name': 'Daly City', 'short_name': 'Daly City', 'types': ['locality', 'political']}, {'long_name': 'San Mateo County', 'short_name': 'San Mateo County', 'types': ['administrative_area_level_2', 'political']}, {'long_name': 'California', 'short_name': 'CA', 'types': ['administrative_area_level_1', 'political']}, {'long_name': 'United States', 'short_name': 'US', 'types': ['country', 'political']}, {'long_name': '94014', 'short_name': '94014', 'types': ['postal_code']}]
DEBUG:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): maps.googleapis.com
DEBUG:requests.packages.urllib3.connectionpool:https://maps.googleapis.com:443 "GET /maps/api/place/nearbysearch/json?location=37.701995,-122.4706021&radius=10& HTTP/1.1" 200 1233
DEBUG:root:For amenity Daly City, comparing address 1901G Junipero Serra Boulevard, San Mateo County with nearby business Daly City
DEBUG:root:For amenity Tomo Sushi & Teriyaki, comparing address 1901G Junipero Serra Boulevard, San Mateo County with nearby business 1901 Junipero Serra Boulevard # G, Daly City
DEBUG:root:After checking = 1901G Junipero Serra Boulevard, San Mateo County, got business tuple (False, '')
DEBUG:root:Nominatim failed, Google found destination business (None, '1901G Junipero Serra Blvd', 'San Mateo County', True)
DEBUG:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.yelp.com
DEBUG:requests.packages.urllib3.connectionpool:https://api.yelp.com:443 "GET /v3/businesses/search?location=1901G%2BJunipero%2BSerra%2BBlvd HTTP/1.1" 200 None
DEBUG:root:parsed_response = {'place_id': '269467', 'licence': 'Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright', 'osm_type': 'way', 'osm_id': '8933300', 'lat': '37.6739981', 'lon': '-122.4833696', 'display_name': 'Lakeshire Drive, Daly City, San Mateo County, 94015, United States of America', 'address': {'road': 'Lakeshire Drive', 'town': 'Daly City', 'county': 'San Mateo County', 'postcode': '94015', 'country': 'United States of America', 'country_code': 'us'}}
DEBUG:root:parsed_response = {'place_id': '525262', 'licence': 'Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright', 'osm_type': 'way', 'osm_id': '183198747', 'lat': '37.7008995', 'lon': '-122.4707415', 'display_name': 'Junipero Serra Boulevard, Westlake, Daly City, San Mateo County, 94014, United States of America', 'address': {'road': 'Junipero Serra Boulevard', 'neighbourhood': 'Westlake', 'town': 'Daly City', 'county': 'San Mateo County', 'postcode': '94014', 'country': 'United States of America', 'country_code': 'us'}}
DEBUG:root:parsed_response = {'place_id': '525262', 'licence': 'Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright', 'osm_type': 'way', 'osm_id': '183198747', 'lat': '37.7008995', 'lon': '-122.4707415', 'display_name': 'Junipero Serra Boulevard, Westlake, Daly City, San Mateo County, 94014, United States of America', 'address': {'road': 'Junipero Serra Boulevard', 'neighbourhood': 'Westlake', 'town': 'Daly City', 'county': 'San Mateo County', 'postcode': '94014', 'country': 'United States of America', 'country_code': 'us'}}
DEBUG:root:parsed_response = {'place_id': '525262', 'licence': 'Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright', 'osm_type': 'way', 'osm_id': '183198747', 'lat': '37.7008995', 'lon': '-122.4707415', 'display_name': 'Junipero Serra Boulevard, Westlake, Daly City, San Mateo County, 94014, United States of America', 'address': {'road': 'Junipero Serra Boulevard', 'neighbourhood': 'Westlake', 'town': 'Daly City', 'county': 'San Mateo County', 'postcode': '94014', 'country': 'United States of America', 'country_code': 'us'}}
DEBUG:root:parsed_response = {'place_id': '525262', 'licence': 'Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright', 'osm_type': 'way', 'osm_id': '183198747', 'lat': '37.7008995', 'lon': '-122.4707415', 'display_name': 'Junipero Serra Boulevard, Westlake, Daly City, San Mateo County, 94014, United States of America', 'address': {'road': 'Junipero Serra Boulevard', 'neighbourhood': 'Westlake', 'town': 'Daly City', 'county': 'San Mateo County', 'postcode': '94014', 'country': 'United States of America', 'country_code': 'us'}}
DEBUG:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.yelp.com
DEBUG:requests.packages.urllib3.connectionpool:https://api.yelp.com:443 "GET /v3/businesses/search?location=Junipero%2BSerra%2BBoulevard%2C%2BWestlake%2C%2BDaly%2BCity%2C%2BSan%2BMateo%2BCounty%2C%2B94014%2C%2BUnited%2BStates%2Bof%2BAmerica HTTP/1.1" 200 None
DEBUG:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.yelp.com
DEBUG:requests.packages.urllib3.connectionpool:https://api.yelp.com:443 "GET /v3/businesses/search?term=grocery&location=Daly%2BCity&limit=3 HTTP/1.1" 200 None
DEBUG:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.yelp.com
DEBUG:requests.packages.urllib3.connectionpool:https://api.yelp.com:443 "GET /v3/businesses/search?term=korean&location=Daly%2BCity&limit=3 HTTP/1.1" 200 None
DEBUG:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.yelp.com
DEBUG:requests.packages.urllib3.connectionpool:https://api.yelp.com:443 "GET /v3/businesses/search?term=bbq&location=Daly%2BCity&limit=3 HTTP/1.1" 200 None
Out[8]:
{'businessid': None,
 'message': 'Your endpoint has either been a non-serviceable category or a closeby option.',
 'method': 'public transportation',
 'rating': None}
```

* clearer for pc vs mobile version and fix button link

* Add integration tests to create an artificial dataset for the suggestion system components

- README with instructions on how to generate the test cases
- test harness with wrappers for the three main algorithms
- dataset files with one sample entry, corresponding to a trip from a suburban
  residential area to a suburban big box store, where there is a closer store available

Note that the destination is not currently detected correctly so the accuracy is 0%

Testing done

Arguments
---------

```
$ ./e-mission-py.bash -d emission/integrationTests/suggestionsys/algorithm_test_harness.py
Connecting to database URL localhost
usage: algorithm_test_harness.py [-h] [-f INFILE]
                                 {find_destination_business,category_of_business_nominatim,calculate_yelp_server_suggestion_for_locations}
algorithm_test_harness.py: error: the following arguments are required: algorithm
```

`find_destination_business`
---------

```
(emission) C02KT61MFFT0:e-mission-server shankari$ ./e-mission-py.bash -d emission/integrationTests/suggestionsys/algorithm_test_harness.py find_destination_business
Connecting to database URL localhost
INFO:root:Mapped algorithm find_destination_business -> <function test_find_destination_business at 0x109262bf8>
DEBUG:root:-----Mountain View Kohls------
DEBUG:root:parsed_response = {'place_id': '201857', 'licence': 'Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright', 'osm_type': 'way', 'osm_id': '5066896', 'lat': '37.4030262', 'lon': '-122.1102601', 'display_name': 'Pacchetti Way, Castro City, Mountain View, Santa Clara County, 94023, United States of America', 'address': {'road': 'Pacchetti Way', 'neighbourhood': 'Castro City', 'city': 'Mountain View', 'county': 'Santa Clara County', 'postcode': '94023', 'country': 'United States of America', 'country_code': 'us'}}
DEBUG:root:Nominatim found destination business ('Pacchetti Way', 'Pacchetti Way, Castro City, Mountain View, Santa Clara County, 94023, United States of America', 'Mountain View', False)
DEBUG:root:Test Mountain View Kohls failed, output = ['Pacchetti Way', 'Pacchetti Way, Castro City, Mountain View, Santa Clara County, 94023, United States of America', 'Mountain View', False], expected ["Kohl's", 'Showers Drive', 'Mountain View', True]
DEBUG:root:After instance Mountain View Kohls, successfulTests = 0, failedTests = 1
INFO:root:Test complete, overall accuracy = 0.0
```

`category_of_business_nominatim`
---------

```
$ ./e-mission-py.bash -d emission/integrationTests/suggestionsys/algorithm_test_harness.py category_of_business_nominatim
Connecting to database URL localhost
INFO:root:Mapped algorithm category_of_business_nominatim -> <function test_category_of_business_nominatim at 0x1135ec8c8>
DEBUG:root:-----Mountain View Kohls------
DEBUG:root:parsed_response = {'place_id': '201857', 'licence': 'Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright', 'osm_type': 'way', 'osm_id': '5066896', 'lat': '37.4030262', 'lon': '-122.1102601', 'display_name': 'Pacchetti Way, Castro City, Mountain View, Santa Clara County, 94023, United States of America', 'address': {'road': 'Pacchetti Way', 'neighbourhood': 'Castro City', 'city': 'Mountain View', 'county': 'Santa Clara County', 'postcode': '94023', 'country': 'United States of America', 'country_code': 'us'}}
DEBUG:root:Nominatim found destination business ('Pacchetti Way', 'Pacchetti Way, Castro City, Mountain View, Santa Clara County, 94023, United States of America', 'Mountain View', False)
DEBUG:root:Test Mountain View Kohls failed, output = [], expected ['deptstores', 'menscloth', 'womenscloth']
DEBUG:root:After instance Mountain View Kohls, successfulTests = 0, failedTests = 1
INFO:root:Test complete, overall accuracy = 0.0
```

`calculate_yelp_server_suggestion_for_locations`
.......................

```
$ ./e-mission-py.bash -d emission/integrationTests/suggestionsys/algorithm_test_harness.py calculate_yelp_server_suggestion_for_locations
Connecting to database URL localhost
INFO:root:Mapped algorithm calculate_yelp_server_suggestion_for_locations -> <function test_calculate_yelp_server_suggestion_for_locations at 0x11805f950>
DEBUG:root:-----Sunnyvale -> Mountain View Kohls------
DEBUG:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): www.mapquestapi.com
DEBUG:requests.packages.urllib3.connectionpool:http://www.mapquestapi.com:80 "GET /directions/v2/route?key=AuwuGlPC5f3Ru7PGahKAtGcs4WdvARem&from=37.3635335,-122.0154871&to=37.40355,-122.10783 HTTP/1.1" 200 None
DEBUG:root:distance in meters = 11695.106466185258
DEBUG:root:parsed_response = {'place_id': '201857', 'licence': 'Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright', 'osm_type': 'way', 'osm_id': '5066896', 'lat': '37.4030262', 'lon': '-122.1102601', 'display_name': 'Pacchetti Way, Castro City, Mountain View, Santa Clara County, 94023, United States of America', 'address': {'road': 'Pacchetti Way', 'neighbourhood': 'Castro City', 'city': 'Mountain View', 'county': 'Santa Clara County', 'postcode': '94023', 'country': 'United States of America', 'country_code': 'us'}}
DEBUG:root:Nominatim found destination business ('Pacchetti Way', 'Pacchetti Way, Castro City, Mountain View, Santa Clara County, 94023, United States of America', 'Mountain View', False)
DEBUG:root:parsed_response = {'place_id': '268772', 'licence': 'Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright', 'osm_type': 'way', 'osm_id': '8932529', 'lat': '37.3638317', 'lon': '-122.0170368', 'display_name': 'Gladiola Drive, Sunnyvale, Santa Clara County, 94086, United States of America', 'address': {'road': 'Gladiola Drive', 'city': 'Sunnyvale', 'county': 'Santa Clara County', 'postcode': '94086', 'country': 'United States of America', 'country_code': 'us'}}
DEBUG:root:parsed_response = {'place_id': '201857', 'licence': 'Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright', 'osm_type': 'way', 'osm_id': '5066896', 'lat': '37.4030262', 'lon': '-122.1102601', 'display_name': 'Pacchetti Way, Castro City, Mountain View, Santa Clara County, 94023, United States of America', 'address': {'road': 'Pacchetti Way', 'neighbourhood': 'Castro City', 'city': 'Mountain View', 'county': 'Santa Clara County', 'postcode': '94023', 'country': 'United States of America', 'country_code': 'us'}}
DEBUG:root:parsed_response = {'place_id': '201857', 'licence': 'Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright', 'osm_type': 'way', 'osm_id': '5066896', 'lat': '37.4030262', 'lon': '-122.1102601', 'display_name': 'Pacchetti Way, Castro City, Mountain View, Santa Clara County, 94023, United States of America', 'address': {'road': 'Pacchetti Way', 'neighbourhood': 'Castro City', 'city': 'Mountain View', 'county': 'Santa Clara County', 'postcode': '94023', 'country': 'United States of America', 'country_code': 'us'}}
DEBUG:root:parsed_response = {'place_id': '201857', 'licence': 'Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright', 'osm_type': 'way', 'osm_id': '5066896', 'lat': '37.4030262', 'lon': '-122.1102601', 'display_name': 'Pacchetti Way, Castro City, Mountain View, Santa Clara County, 94023, United States of America', 'address': {'road': 'Pacchetti Way', 'neighbourhood': 'Castro City', 'city': 'Mountain View', 'county': 'Santa Clara County', 'postcode': '94023', 'country': 'United States of America', 'country_code': 'us'}}
DEBUG:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.yelp.com
DEBUG:requests.packages.urllib3.connectionpool:https://api.yelp.com:443 "GET /v3/businesses/Pacchetti-Way-Mountain%20View HTTP/1.1" 400 186
DEBUG:root:parsed_response = {'place_id': '201857', 'licence': 'Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright', 'osm_type': 'way', 'osm_id': '5066896', 'lat': '37.4030262', 'lon': '-122.1102601', 'display_name': 'Pacchetti Way, Castro City, Mountain View, Santa Clara County, 94023, United States of America', 'address': {'road': 'Pacchetti Way', 'neighbourhood': 'Castro City', 'city': 'Mountain View', 'county': 'Santa Clara County', 'postcode': '94023', 'country': 'United States of America', 'country_code': 'us'}}
DEBUG:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.yelp.com
DEBUG:requests.packages.urllib3.connectionpool:https://api.yelp.com:443 "GET /v3/businesses/search?location=Pacchetti%2BWay%2C%2BCastro%2BCity%2C%2BMountain%2BView%2C%2BSanta%2BClara%2BCounty%2C%2B94023%2C%2BUnited%2BStates%2Bof%2BAmerica HTTP/1.1" 200 None
DEBUG:root:Test Sunnyvale -> Mountain View Kohls failed, output = None, expected target-sunnyvale-2
DEBUG:root:After instance Sunnyvale -> Mountain View Kohls, successfulTests = 0, failedTests = 1
INFO:root:Test complete, overall accuracy = 0.0
```

* Added some more documentation on how to get categories

To make people's lives easier

* Clarifying configuration required

* merged

* remove ipynb

* added new dataset to test only restaurants

* Revert "remove ipynb"

This reverts commit d31d8ef.

* Revert "Revert "remove ipynb""

This reverts commit 70add76.

* Revert "added new dataset to test only restaurants"

This reverts commit ef365d5.

* Revert "added new dataset to test only restaurants"

This reverts commit ef365d5.

* new dataset to test accuracy for certain establishments

* small edit to increase accuracy

* update

* Improvements to Yelp API and dataset
shankari referenced this pull request in shankari/e-mission-server May 10, 2019
- create a single `get_city_from_address` to replace the triply-nested
  try/catch block and simply it to not have try/catch blocks

+ bonus fix: remove unused functions `title_of_category` and `get_business_id`
+ bonux fix #2: remove urllib.quote since requests quotes internally
(https://stackoverflow.com/questions/42349000/python3-requests-use-quote-instead-of-quote-plus)
+ bonus fix #3: remove encoding to utf-8 since python3 uses utf-8 by default
jruzekowicz added a commit to jruzekowicz/e-mission-server that referenced this pull request Jun 24, 2021
jruzekowicz added a commit to jruzekowicz/e-mission-server that referenced this pull request Jun 30, 2021
Testing:
The pipeline has been tested for multiple data sources stored within the tests/data file.
By testing multiple files, we have demonstracted that it will update and store the data within a
given file. This file however is still being overwritten as it is based on the uuid (within the filename).
Changing of the filename will be next.
Keys included within the export data:
jruzekow-32318s:e-mission-server jruzekow$ zgrep "key" export_5d5fc80b-c031-4e43-8d64-52fb29aefc94.gz  | sort | uniq
            "key": "analysis/cleaned_place",
            "key": "analysis/cleaned_section",
            "key": "analysis/cleaned_stop",
            "key": "analysis/cleaned_trip",
            "key": "analysis/confirmed_trip",
            "key": "analysis/inferred_section",
            "key": "analysis/recreated_location",
            "key": "background/filtered_location",
            "key": "background/location",
            "key": "background/motion_activity",
            "key": "inference/prediction",
            "key": "segmentation/raw_place",
            "key": "segmentation/raw_section",
            "key": "segmentation/raw_stop",
            "key": "segmentation/raw_trip",
            "key": "statemachine/transition",
            "key": "stats/pipeline_error",
            "key": "stats/pipeline_time",

These keys now account for the raw data and all data put together within the pipeline states.
GabrielKS pushed a commit to GabrielKS/e-mission-server that referenced this pull request Aug 16, 2021
humbleOldSage pushed a commit to humbleOldSage/e-mission-server that referenced this pull request Dec 1, 2023
Percom analysis + adapt the notebook script to read config
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.

1 participant