diff --git a/README.md b/README.md index e8151a9..e1db403 100644 --- a/README.md +++ b/README.md @@ -1117,6 +1117,135 @@ The nearest grocery of SFU is Nesters Market. It is 1.234 miles far, and It is e +#### [GeoDB Cities](./geodb) -- Collect country, region, city information + +
+ Which cities have names that start with "Van" and have a population larger than 200000? + +```python +from dataprep.connector import connect + +# You can get ”token" for geodb at +# https://rapidapi.com/wirefreethought/api/geodb-cities/details +dc = connect('geodb', _auth={'access_token':token}) +df = await dc.query('city', namePrefix='Van', minPopulation="200000", limit="10") +df +``` + +| | id | wiki data id | name | type | country | region | latitude | longitude | population | +| ---- | ------- | ------------ | --------- | ---- | ------- | ---------------- | --------- | ----------- | ---------- | +| 0 | 10841 | Q24639 | Vancouver | CITY | Canada | British Columbia | 49.260833 | -123.113889 | 631486 | +| 1 | 34611 | Q127623 | Vantaa | CITY | Finland | Åland Islands | 60.300000 | 25.033333 | 223027 | +| 2 | 3453047 | Q83061 | Van | CITY | Turkey | Van Province | 38.501944 | 43.416667 | 353419 | + +
+ +
+ Which countries have names that start with "F" and use Euro as their currency? + +```python +from dataprep.connector import connect + +# You can get ”token" for geodb at +# https://rapidapi.com/wirefreethought/api/geodb-cities/details +dc = connect('geodb', _auth={'access_token':token}) +df = await dc.query('country', currencyCode='EUR', namePrefix='F', limit='10') +df +``` + +| | wiki data id | name | code | currency codes | +| ---- | ------------ | ------- | ---- | -------------- | +| 0 | Q33 | Finland | FI | [EUR] | +| 1 | Q142 | France | FR | [EUR] | + +
+ +
+ What's the detail information of New York CIty? + + ```python +from dataprep.connector import connect + +# You can get ”token" for geodb at +# https://rapidapi.com/wirefreethought/api/geodb-cities/details +dc = connect('geodb', _auth={'access_token':token}) +df = await dc.query('city_detail', cityid='Q60') +df + ``` + +| | id | wiki data id | type | name | country | country code | region | region code | latitude | longitude | population | elevation meters | timezone | +| ---- | ------ | ------------ | ---- | ------------- | ------------------------ | ------------ | -------- | ----------- | -------- | --------- | ---------- | ---------------- | ----------------- | +| 0 | 123214 | Q60 | CITY | New York City | United States of America | US | New York | NY | 40.67 | -73.94 | 8398748 | 10.0 | America__New_York | + +
+ +
+ Get all regions with name start with "C" in a United States + + ```python +from dataprep.connector import connect + +# You can get ”token" for geodb at +# https://rapidapi.com/wirefreethought/api/geodb-cities/details +dc = connect('geodb', _auth={'access_token':token}) +df = await dc.query('country_region', countryid='US', namePrefix='C', limit='10') +df + ``` + +| | wiki data id | name | country code | fips code | iso code | +| ---- | ------------ | ----------- | ------------ | --------- | -------- | +| 0 | Q99 | California | US | 06 | CA | +| 1 | Q1261 | Colorado | US | 08 | CO | +| 2 | Q779 | Connecticut | US | 09 | CT | + +
+ +
+ Get all cities with population larger than 2000000 in New York, US + + ```python +from dataprep.connector import connect + +# You can get ”token" for geodb at +# https://rapidapi.com/wirefreethought/api/geodb-cities/details +dc = connect('geodb', _auth={'access_token':token}) +df = await dc.query('country_region_city', countryid='US', regioncode='NY', minPopulation='2000000',limit='10') +df + ``` + +| | id | wiki data id | name | latitude | longitude | population | +| ---- | ------- | ------------ | ------------- | --------- | ---------- | ---------- | +| 0 | 122111 | Q18419 | Brooklyn | 40.692778 | -73.990278 | 2636735 | +| 1 | 3101789 | Q11980692 | Kings County | 40.634390 | -73.950270 | 2504700 | +| 2 | 123214 | Q60 | New York City | 40.670000 | -73.940000 | 839874 | +| 3 | 123716 | Q18424 | Queens | 40.704167 | -73.917778 | 2339150 | +| 4 | 3100451 | Q5142559 | Queens County | 40.611744 | -74.061505 | 2230722 | + +
+ +
+ What are the cities within 3 kilometers around New York? + + ```python +from dataprep.connector import connect + +# You can get ”token" for geodb at +# https://rapidapi.com/wirefreethought/api/geodb-cities/details +dc = connect('geodb', _auth={'access_token':token}) +df = await dc.query('city_near_city', cityid='Q60', radius='3', distanceUnit='KM', limit='10') +df[['id', 'wiki data id', 'name', 'type', 'population', 'distance']] + ``` + +| | id | wiki data id | name | type | population | distance | +| ---- | ------ | ------------ | ------------- | ---- | ---------- | -------- | +| 0 | 122855 | Q2354222 | Crown Heights | CITY | 143000 | 0.46 | +| 1 | 122205 | Q991279 | Brownsville | CITY | 55043 | 1.95 | +| 2 | 123982 | Q840381 | Flatbush | CITY | 105804 | 2.56 | + +
+ + + ### Jobs #### [The Muse](./themuse) -- Collect Job Ads, Company Information diff --git a/api-connectors/geodb/_meta.json b/api-connectors/geodb/_meta.json new file mode 100644 index 0000000..be07de9 --- /dev/null +++ b/api-connectors/geodb/_meta.json @@ -0,0 +1,10 @@ +{ + "tables": [ + "city", + "country", + "city_detail", + "country_region", + "country_region_city", + "city_near_city" + ] +} diff --git a/api-connectors/geodb/city.json b/api-connectors/geodb/city.json new file mode 100644 index 0000000..98f5dd9 --- /dev/null +++ b/api-connectors/geodb/city.json @@ -0,0 +1,65 @@ +{ + "version": 1, + "request": { + "url": "https://wft-geo-db.p.rapidapi.com/v1/geo/cities", + "method": "GET", + "authorization": { + "type": "Header", + "keyName": "X-RapidAPI-Key" + }, + "params": { + "limit": false, + "countryIds": false, + "excludedCountryIds": false, + "minPopulation": false, + "namePrefix": false, + "timeZoneIds": false, + "location": false, + "radius": false, + "distanceUnit": false + } + }, + "response": { + "ctype": "application/json", + "tablePath": "$.data[*]", + "schema": { + "id": { + "target": "$.id", + "type": "int" + }, + "wiki data id": { + "target": "$.wikiDataId", + "type": "string" + }, + "name": { + "target": "$.name", + "type": "string" + }, + "type": { + "target": "$.type", + "type": "string" + }, + "country": { + "target": "$.country", + "type": "string" + }, + "region": { + "target": "$.region", + "type": "string" + }, + "latitude": { + "target": "$.latitude", + "type": "float" + }, + "longitude": { + "target": "$.longitude", + "type": "float" + }, + "population": { + "target": "$.population", + "type": "int" + } + }, + "orient": "records" + } +} diff --git a/api-connectors/geodb/city_detail.json b/api-connectors/geodb/city_detail.json new file mode 100644 index 0000000..8ebb36f --- /dev/null +++ b/api-connectors/geodb/city_detail.json @@ -0,0 +1,76 @@ +{ + "version": 1, + "request": { + "url": "https://wft-geo-db.p.rapidapi.com/v1/geo/cities/{cityid}", + "method": "GET", + "authorization": { + "type": "Header", + "keyName": "X-RapidAPI-Key" + }, + "params": { + "cityid": true + } + }, + "examples": { + "cityid": "'Q60'" + }, + "response": { + "ctype": "application/json", + "tablePath": "$.data[*]", + "schema": { + "id": { + "target": "$.id", + "type": "int" + }, + "wiki data id": { + "target": "$.wikiDataId", + "type": "string" + }, + "type": { + "target": "$.type", + "type": "string" + }, + "name": { + "target": "$.name", + "type": "string" + }, + "country": { + "target": "$.country", + "type": "string" + }, + "country code": { + "target": "$.countryCode", + "type": "string" + }, + "region": { + "target": "$.region", + "type": "string" + }, + "region code": { + "target": "$.regionCode", + "type": "string" + }, + "latitude": { + "target": "$.latitude", + "type": "float" + }, + "longitude": { + "target": "$.longitude", + "type": "float" + }, + "population": { + "target": "$.population", + "type": "int" + }, + "elevation meters": { + "target": "$.elevationMeters", + "type": "float" + }, + "timezone": { + "target": "$.timezone", + "type": "string" + } + }, + "orient": "records" + } +} diff --git a/api-connectors/geodb/city_near_city.json b/api-connectors/geodb/city_near_city.json new file mode 100644 index 0000000..ae5c1a1 --- /dev/null +++ b/api-connectors/geodb/city_near_city.json @@ -0,0 +1,73 @@ +{ + "version": 1, + "request": { + "url": "https://wft-geo-db.p.rapidapi.com/v1/geo/cities/{cityid}/nearbyCities", + "method": "GET", + "authorization": { + "type": "Header", + "keyName": "X-RapidAPI-Key" + }, + "params": { + "cityid": true, + "radius": true, + "limit": false, + "countryIds": false, + "excludedCountryIds": false, + "minPopulation": false, + "namePrefix": false, + "timeZoneIds": false, + "distanceUnit": false + } + }, + "examples": { + "cityid": "'Q60'", + "radius": "'3'" + }, + "response": { + "ctype": "application/json", + "tablePath": "$.data[*]", + "schema": { + "id": { + "target": "$.id", + "type": "int" + }, + "wiki data id": { + "target": "$.wikiDataId", + "type": "string" + }, + "name": { + "target": "$.name", + "type": "string" + }, + "type": { + "target": "$.type", + "type": "string" + }, + "country": { + "target": "$.country", + "type": "string" + }, + "region": { + "target": "$.region", + "type": "string" + }, + "latitude": { + "target": "$.latitude", + "type": "float" + }, + "longitude": { + "target": "$.longitude", + "type": "float" + }, + "population": { + "target": "$.population", + "type": "int" + }, + "distance": { + "target": "$.distance", + "type": "float" + } + }, + "orient": "records" + } +} diff --git a/api-connectors/geodb/country.json b/api-connectors/geodb/country.json new file mode 100644 index 0000000..489fa62 --- /dev/null +++ b/api-connectors/geodb/country.json @@ -0,0 +1,39 @@ +{ + "version": 1, + "request": { + "url": "https://wft-geo-db.p.rapidapi.com/v1/geo/countries", + "method": "GET", + "authorization": { + "type": "Header", + "keyName": "X-RapidAPI-Key" + }, + "params": { + "limit": false, + "currencyCode": false, + "namePrefix": false + } + }, + "response": { + "ctype": "application/json", + "tablePath": "$.data[*]", + "schema": { + "wiki data id": { + "target": "$.wikiDataId", + "type": "string" + }, + "name": { + "target": "$.name", + "type": "string" + }, + "code": { + "target": "$.code", + "type": "string" + }, + "currency codes": { + "target": "$.currencyCodes", + "type": "list" + } + }, + "orient": "records" + } +} diff --git a/api-connectors/geodb/country_region.json b/api-connectors/geodb/country_region.json new file mode 100644 index 0000000..a939a40 --- /dev/null +++ b/api-connectors/geodb/country_region.json @@ -0,0 +1,46 @@ +{ + "version": 1, + "request": { + "url": "https://wft-geo-db.p.rapidapi.com/v1/geo/countries/{countryid}/regions", + "method": "GET", + "authorization": { + "type": "Header", + "keyName": "X-RapidAPI-Key" + }, + "params": { + "countryid": true, + "limit": false, + "namePrefix": false + } + }, + "examples": { + "countryid": "'US'" + }, + "response": { + "ctype": "application/json", + "tablePath": "$.data[*]", + "schema": { + "wiki data id": { + "target": "$.wikiDataId", + "type": "string" + }, + "name": { + "target": "$.name", + "type": "string" + }, + "country code": { + "target": "$.countryCode", + "type": "string" + }, + "fips code": { + "target": "$.fipsCode", + "type": "string" + }, + "iso code": { + "target": "$.isoCode", + "type": "string" + } + }, + "orient": "records" + } +} diff --git a/api-connectors/geodb/country_region_city.json b/api-connectors/geodb/country_region_city.json new file mode 100644 index 0000000..2da7a00 --- /dev/null +++ b/api-connectors/geodb/country_region_city.json @@ -0,0 +1,54 @@ +{ + "version": 1, + "request": { + "url": "https://wft-geo-db.p.rapidapi.com/v1/geo/countries/{countryid}/regions/{regioncode}/cities", + "method": "GET", + "authorization": { + "type": "Header", + "keyName": "X-RapidAPI-Key" + }, + "params": { + "countryid": true, + "regioncode": true, + "limit": false, + "namePrefix": false, + "timeZoneIds": false, + "minPopulation": false + } + }, + "examples": { + "countryid": "'US'", + "regioncode": "'NY'" + }, + "response": { + "ctype": "application/json", + "tablePath": "$.data[*]", + "schema": { + "id": { + "target": "$.id", + "type": "int" + }, + "wiki data id": { + "target": "$.wikiDataId", + "type": "string" + }, + "name": { + "target": "$.name", + "type": "string" + }, + "latitude": { + "target": "$.latitude", + "type": "float" + }, + "longitude": { + "target": "$.longitude", + "type": "float" + }, + "population": { + "target": "$.population", + "type": "int" + } + }, + "orient": "records" + } +} diff --git a/api-connectors/geodb/tests/tests.py b/api-connectors/geodb/tests/tests.py new file mode 100644 index 0000000..5a1b6c8 --- /dev/null +++ b/api-connectors/geodb/tests/tests.py @@ -0,0 +1,5 @@ +from dataprep.connector import Connector + + +def test_sanity(): + Connector("./geodb")