Upload CSV Data

Upload data through signed URL

Here we describe the process for uploading inspection data via CSV into the Raptor Maps system. In order to properly tie the data to your account, we require a signed URL for each upload. We have provided API to enable this as an integration or one-time upload.

Process

The basic process is to collate data into a proper CSV, use an API to retrieve an access token, then use the token to upload the CSV to Raptor Maps' system.

Creating the CSV

Save your data in a csv format with the following headers. Fields marked as required need to have a value supplied in the data. All headers must be present, even if the data in that column is optional, and columns must be in the same order as presented in the table.

HeaderData TypeRequired
farm_idstringtrue
farm_namestringtrue
timezonestringfalse
commissioning dateYYYY-MM-DD HH:MM:SSfalse
farm_latitudefloatfalse
farm_longitudefloatfalse
equipment_idstringtrue
equipment_namestringtrue
equipment_typeenum - see table belowfalse
sensor_idstringfalse
sensor_namestringfalse
sensor_typeenum - see table belowtrue
observation_timeYYYY-MM-DD HH:MM:SStrue
measured_valuefloattrue

Equipment Types

Sensor Type By Equipment

EquipmentSensor TypeUnitsInterval (minutes)Aggregation (Avg,Sum, etc)
Inverter
dc_voltageV15Average
dc_current_ampA15Average
ac_powerW15Average
dc_powerW15Average
Combiner
dc_voltageV15Average
dc_current_ampA15Average
ac_powerW15Average
dc_powerW15Average
Meter
production_meter_energyWh15Maximum
production_meter_powerW15Average
Weather Station/Pyranometer
irradiance_poaW/m^215Average
irradiance_ghiW/m^215Average

Requesting an Signed URL

After retrieving an API access token, use that token to make a request to the org integration endpoint documented below. The response will contain one or more objects that have an ID field.

  {
    "id": int,
    "org_id": int,
    "api_type": integration_name,
    "auth_info": {
      "username": user_name,
      "password": password
    },
    "query_interval_secs": integer,
    "settings": {},
    "enabled": boolean
  }

Use the ID to send a request to the GET Signed URL for Data Upload endpoint. That signed URL is the target of a PUT request we use to transport the CSV to Raptor Maps. The CSV in question can be no larger than 5GB. If it is larger than this it must be split up into multiple PUTs which will require multiple signed url requests.

Python Example

import requests
import os
import sys
FILE_TO_UPLOAD = sys.argv[1]
INTEGRATION_ID = <int>
# Authenticate with an API token provided to you by Raptor Maps
token = os.environ['RM_API_TOKEN']
# Specify API endpoint - RM Add Integration workflow will also provide this!
endpoint = f'https://api.raptormaps.com/insights/api/v1/integrations/org_integrations/{INTEGRATION_ID}/signed_url'
# Specify request headers
headers = {
  'content-type': 'application/json',
  'Authorization': f"Bearer {token}"
}
# Make HTTP GET request to get Upload URL
resp = requests.get(endpoint, headers=headers)
# Parse response
url = resp.json()
print(url)
# Upload file
headers = {
  'content-type': 'text/csv'
}
with open(FILE_TO_UPLOAD, 'rb') as f:
  resp = requests.put(url, data=f, headers=headers)
print('Upload Complete!')