The scripts in this repository are made available for free under the ROA (Reask Open Analytics) offering to facilitate work with Reask’s hazard data for parametric insurance structuring and pricing. Any commercial use of Reask data requires a formal agreement with Reask. The use of these scripts is at your own risk, and Reask assumes no liability for any errors, inaccuracies, or potential issues that may arise from these scripts.
Note: You must have valid Reask API credentials to query the data. If you do not have credentials, please contact Reask for access. Be sure to enter your credentials in the
API_Authentication.rfile (or equivalent) before running the scripts.
Author: David Schmid, Global Head of Data Products at Reask
Email: [email protected]
This repository contains R scripts that retrieve location-level wind and track data via the Reask API, process the responses to extract event data and save the results in Excel, CSV and Parquet formats. The repository also contains an authentication file to be completed with your personal credentials, and a sample locations.csv file.
- Clone or download this repo.
- Install R and RStudio.
- Open the project file
.Rprojin RStudio. - Open the
API_Authentication.rscript and enter your personal credentials. - Open and run the script
API_Master.r.
- API_Master.r:
Master file to set the hazard parameters and run both the Metryc and DeepCyc queries. - API_metryc_tcwinds_events.r:
Retrieves historical data from the Reask API based on DeepCyc. - API_deepcyc_tcwinds_events.r:
Retrieves probabilistic data from the Reask API based on DeepCyc. - API_Authentication.r:
Authenticates with the Reask API using your credentials. - locations.csv:
A sample CSV file containing location data (id, lat, lon, and limit). Modify this file with your actual locations. lat and lon must be included, id and limit is not required. - Output Files:
The processed results and meta data are saved as Excel, CSV and Parquet files. - API.Rproj:
R project file to set your working directory.
- R (version 3.6 or later recommended)
- Recommended IDE: RStudio
- Git (if you plan to clone or pull updates from the repository)
Follow these steps to set up the project on your machine:
-
Navigate to the Parent Directory for Cloning:
-
Windows Users:
Open the Command Prompt and navigate to the folder where you want to store the repository. For example:cd "C:\Users\DavidSchmid\Documents\Reask\API"
-
Mac Users:
Open the Terminal and navigate to the folder where you want to store the repository. For example:cd "/Users/yourusername/Documents/Reask/API"
-
-
Clone or Download the Repository:
-
Clone:
Run the following command in your terminal:git clone https://github.com/reaskearth/parametrics.git
This creates a new folder
parametricscontaining the repository. -
Download:
Alternatively, click the "Download ZIP" button on the GitHub repository page, unzip the folder, and move it to your desired location.
-
-
Open the Project in RStudio:
The repository includes an
.Rprojfile. Open this file in RStudio, and it will automatically set your working directory to the repository root. This ensures that all relative paths work correctly. -
Project Structure:
Your repository should have a structure similar to:
repository-root/ ├── API_Master.r # Master file to run ├── API_Authentication.r # Authentication file ├── API_deepcyc_tcwinds_events.r # API query for DeepCyc ├── API_metryc_tcwinds_events.r # API query for DeepCyc ├── locations.csv # Sample locations file ├── API.Rproj # RStudio project file ├── README.md # This file ├── results # A folder will be created to save results -
Configure Your Environment:
-
Authentication:
OpenAPI_Authentication.Rand replace the placeholder"username"and"password"with your actual API credentials. -
Adjust Parameters:
Open API_Master.r and review the User Input Parameterisation section. Adjust parameters such as wind speed units, terrain correction, averaging period, threshold and location file.
-
-
Open the Project:
In RStudio, open the.Rprojfile from the repository root. This automatically sets the working directory. -
Run the Main Script:
Execute the API_Master.r script to process the data. The script will:- Load location data from
locations.csv - Authenticate with the API
- Retrieve historical and probabilstic data for each location
- Apply filtering and construct a pivot table
- Save outputs as Excel, CSV and Parquet files
- Load location data from
-
Further Process Output:
The processed files will be saved in theresultsfolder. Open them with your preferred software to process the results.
-
API Access:
To use the Reask API, you must have the appropriate access rights.
Refer to the API Swagger Documentation for a full list of parameters and further details.
If access is restricted, contact your administrator or follow the necessary steps to obtain API credentials. -
Authentication File (
API_Authentication.r):
This file sends a POST request to the Reask token endpoint, retrieves an access token, and sets up the necessary headers. Make sure to update this file with your actual credentials.
Feel free to fork the repository and submit pull requests if you have improvements or bug fixes. Please follow standard GitHub contribution guidelines. Important: Do not include your personal API credentials in your commits or pull requests. If you need to update the authentication file, use placeholder so that sensitive information is not exposed.
Include license information here if applicable.
By following these instructions, you should be able to run the code on your machine with minimal adjustments. The repository is organized to be generic - simply clone or download, update the credentials and parameters, and run the script.