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
See the Traffics upload specification for the full list of columns. 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.
When uploading a traffic file without a timestamp column, Echo requires values for temperature (°C), pressure (Pa), and humidity (%). These values can be provided in the upload or taken from the project’s meteorological defaults. For files without time references, Echo looks specifically for a season named "default" and uses that season’s values.
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.
Track and profile references
A traffic file references tracks and profiles by name. These references are validated when a calculation is requested — not at upload time. This means you can upload a traffic file before the referenced tracks and profiles exist in the project, and add them later. When you request a calculation, Echo will check that all referenced tracks and profiles exist and that each track and profile pair is compatible (same flight type and aircraft type). If any reference is missing or incompatible, the calculation request will be rejected with a descriptive error.
For NRM traffic, these same reference checks also run asynchronously right after upload — see below.
NRM traffic
NRM traffic files can only be uploaded to projects of type Besluit (NRM) or Handhaving (NRM). NRM traffic
is identified through the profile subtype referenced in the file — the traffic file format itself is unchanged,
and only track_name, profile_name, event_count, and one of timestamp/den are used; other columns are
ignored.
After upload, NRM traffic is validated asynchronously against the following checks:
track_nameandprofile_nameresolve to an existing track and profile in the project, and the referenced track and profile are compatible (same flight type and aircraft type) — same check as above, but for NRM traffic it runs right after upload rather than waiting until a calculation is requested.- The referenced profile must be of the NRM subtype, and must have passed NRM profile validation.
- The file must have exactly one of
timestamporden— not both, and not neither. Whichever column is present is mandatory (cannot be null for any row), unlike for other traffic types wheretimestampis optional.denmust be one of the following labels:
| Period | Label | Time |
|---|---|---|
| Day | D |
07:00 – 19:00 |
| Evening | E |
19:00 – 23:00 |
| Night | N |
23:00 – 07:00 |
Using the Website
DOCUMENTATION TO BE ADDED SOON
The documentation for this section has not been completed yet.