DOI: 10.5281/zenodo.15855966
title: Context Trails data

description: Context Trails

Repository containing the data used in the paper:Context Trails: A dataset to study contextual and route recommendation

📝 Instructions



Since Foursquare does not grant explicit permission to redistribute the original data, you must run the download_process_poi_info.sh script located in the data directory to retrieve it. Before doing so, ensure that your Foursquare Developer API key is correctly set in the request_foursquare_API.py file. After executing the script, your repository should match the structure described below.



💻 Prerequisites



Python 3.8 or higher is required.

Install the required dependencies using the following command:




pip install -r requirements.txt




📂 Repository Structure



online_appendix.pdf: file with extended figures from those shown in the paper, depicting different characteristics of the data (route size, weather conditions, and so on).

NewYorkCity.zip: data corresponding to New York City.

PetalingJaya.zip: data corresponding to Petaling Jaya (Kuala Lumpur district).

Tokyo.zip: data corresponding to the city of Tokyo.

download_process_poi_info.sh: script for processing the data and download the Foursquare data.

request_foursquare_API.py: code that uses Foursquare API to donwload the information regarding the POIs into a JSON file.

generate_poi_data.py: code to create a CSV file from the previous JSON file.

map_categories.py: code to extend the previous CSV into a file containing the level 1 categories.



The structure of the data contained in each city (ZIP files) is as follows:



POIS_<city>.csv: file containing the Foursquare ids on which we were able to retrieve their data from the API in November 2024.

ALL_POIS_<city>.csv: file containing all the Foursquare ids of that city.

POIS_INFO_<WikidataID>_<city>_lvl1_categories.csv (note that this file will be obtained through the Foursquare API): it is a CSV containing the following information obtained from the Foursquare API:



fsq_id: original Foursquare id.

latitude.

longitude.

category (each POI might contain more than one category). Each category separated by "-".

price.

rating.

total_ratings.

total_tips.

a set of booleans denoting if the POI is open in that interval (1 open, 0 closed) in both weekdays (monday to friday) and weekends (Saturdays and Sundays).



EarlyMorning is between 00:00 to 06:00.

Morning is between 06:00 to 12:00.

Afternoon is between 12:00 to 18:00.

Night is between 18:00 to 24:00.

the category of level 1 from Foursquare.



<WikidataID>_<city>_trails_weather.zip: zip directory containing a CSV separated by ; containing the following information:



trail_id: the id of the trail.

user_id: the id of the user.

venue_id: original Foursquare id.

timestamp: date following the ISO 8601 format.

temp: temperature in Cº at the moment of the check-in.

precip: value of the precipitation at the moment of the check-in.

windspeed: wind speed at the moment of the check-in.

preciptype: type of the precipitation at the moment of the check-in.

conditions: sky condition at the moment of the check-in.



<WikidataID>_<city>_trails_weather_aggregated.zip: ZIP file containing 3 different files:



<WikidataID>_<city>_trails_weather_aggregated.csv: CSV file separated by ";" containing the aggregated check-ins of each user (hence, all the trails are removed). It contains an additional column denoted as number_of_visits that contains the number of visits that that user have visited the specific POI. The timestamp represents the last time that the user visited that venue.

<WikidataID>_<city>_trails_weather_aggregated_Temp80train.csv: CSV containing the check-ins of the users used to train the recommenders (80% of the most ancient ratings were used for training).

<WikidataID>_<city>_trails_weather_aggregated_Temp20test.csv: CSV containing the check-ins of the users used to test the recommenders (20% of the most recent ratings were used for test).



<WikidataID>_<city>_trails_routes_2_minroutes_4_minPois_training_test.zip: ZIP file containing the training and test set used for the route recommendation task. For every user with at least 2 different routes, if the last route contains at least 4 POIs, then is sent to test, else, it is sent to the training file. It contains 2 different files:



<WikidataID>_<city>_trails_routes_2_minroutes_4_minPOIS_TestRouteTraining.csv: training file used for the route recommendation problem.

<WikidataID>_<city>_trails_routes_2_minroutes_4_minPOIS_TestRouteTest.csv: test file used for the route recommendation problem.





NOTE: the repository including code from the experiments conducted in the paper can be found here




👥Authors



Pablo Sánchez - Universidad Pontificia Comillas

Alejandro Bellogín - Universidad Autónoma de Madrid

José Luis Jorro Aragoneses - Universidad Autónoma de Madrid





📬 Contact



Pablo Sánchez - psperez@icai.comillas.edu





🙏 Acknowledgments



This work was supported by grant PID2022-139131NB-I00 funded by MCIN/AEI/10.13039/501100011033 and by ''ERDF A way of making Europe''.

Partially supported by Spanish Thematic Network on Recommender Systems (Action RED2022-134302-T funded by MCIN/AEI/10.13039/501100011033).

We would like to thank Foursquare for providing access to their API, which enabled us to download and utilize valuable data for this project.

We also acknowledge Visual Crossing Weather for granting access to their weather data services. This project made use of historical weather data from the years 2017 and 2018 for the cities of New York (USA), Petaling Jaya (Malaysia), and Tokyo (Japan). Visual Crossing Corporation. Visual Crossing Weather. (2017-2018). https://www.visualcrossing.com/