Skip to content

Upload Traffic Files

Interacting with the API

It is possible to upload a traffic file by directly interacting with the API. Each row of a traffic file corresponds to a single event that is part of that traffic. The endpoint below is used for that effect, where the project ID is given by project_id.

POST /p-{project_id}/traffic/upload

Besides the project ID, this endpoint also requires the following path parameter:

Element Type Presence Unit Description Observations
name string Optional - Name commonly used to identify the traffic. It can be set to any string Any name accepted, but must be unique amongst all traffics of a project

Expected columns in file

The columns below should be included in the .csv file you upload to create your traffic. If at least one of the mandatory columns is missing, Echo will return a validation error and will let you know which columns are missing.

Column Type Presence Unit Description Observations
track_name string Mandatory - Name of the track Refers to the track used by each event. Tracks referenced here must be added to the project beforehand
profile_name string Mandatory - Name of the profile Refers to the profile used by each event. Profiles referenced here must be added to the project beforehand
event_count float Mandatory - Count for each event -
period float Optional - Period of the day when the event takes place Can be D (day), E (evening) and N (night)
correction float Optional - Correction applied to the event Needed for NAx (Number Above Level x) calculations
bank boolean Optional - Defines whether the bank angle is considered (True) or ignored (False) -
humidity float Optional - Humidity registered during event Ranges from 0% and 100%
pressure float Optional Pressure registered during event -
temperature float Optional Temperature registered during event -
threshold float Optional Threshold displacement applied on take-off/landing for the event -

Type of traffic files accepted

Currently, only .csv files are accepted for traffics. Files compressed as .zip are also accepted. In these cases, Echo will fetch the first file in the zipped upload and process it, ignorning other files that may be inside.

Below is an example of how you can upload a traffic file to your project.

from typing import Union
import requests
from pathlib import Path


def upload_traffic_file(base_url: str, project_id: int, headers: dict, file_path: Union[str, Path]):
    # Prepare file
    file = {"file": open(file_path, "rb")}

    # Traffic name
    name = "My Traffic"

    # Upload file
    traffic_response = requests.post(
      f"{base_url}/p-{project_id}/traffic/upload" + f"?name={name}",
      files=file,
      headers=headers
    )

    # Extract response after uploading traffic. The response will let you know if the upload was received
    traffic = traffic_response.json()

Traffic status

After having uploaded the traffic file, Echo will validate its content and will generate error logs if anything goes wrong. The traffic can only be used after it has been validated and has been accepted by Echo.

Using the Website

DOCUMENTATION TO BE ADDED SOON

The documentation for this section has not been completed yet.