# Requirements:
### Service (API) requirements:
1. Provide distance traveled by planes in the Italian airspace in the last: 1h, 6h, 24h.
2. Provide cumulative CO2 produced (estimated) by planes in the Italian airspace in the last: 1h, 6h, 24h.
3. Provide historic values of cumulative distance and cumulative CO2 emission statistics for a selectable interval of time, within the last 30 days. Historic values are daily/hourly values.
4. Provide a list of aircraft currently in the Italian airspace.
5. Provide a stream of coordinates of a specified aircraft in Italian airspace.
6. Provide a list of Italian airports:
- icao24,
- name (IATA)
7. Provide a stream of events filterable by (Italian) airport:
- takeoffs,
- landings.
8. Provide information regarding a specified aircraft in Italian airspace:
- registration country,
- operator,
- registration number,
- model
### Dashboard requirements:
1. Show cumulative distance traveled by planes in the Italian airspace in the last: 1h, 6h, 24h.
2. Show cumulative CO2 produced (estimated) by planes in the Italian airspace in the last: 1h, 6h, 24h.
3. Show historic values of cumulative distance and cumulative CO2 emission statistics for a selectable interval of time, within the last 30 days. Historic values are daily/hourly values.
4. Show a real-time list of events, filterable by Italian airport, regarding: departures, arrivals.
5. Show real-time position (as simple coordinates) of a user queried aircraft while inside the Italian airspace.
6. Show details regarding a user queried aircraft:
- registration country,
- operator,
- registration number,
- model.
### Optional requirements:
- Dashboard 30d history:
- Let user select different coarseness of sums (day, hour).
### Requirement issues:
# Exposed API
| Endpoint | Method | Parameters | Values | Data needed |
| -------- | -------- | ---------- | -------- | -- |
| /distance | GET | timeframe {1h, 6h, 24h} | cumulative_distance | past and current coordinates of same aircraft, for all aircraft (past might just be 15 seconds) |
| /distance/history | GET | start_timestamp, stop_timestamp | array of values | x minutes (e.g. 5) distance sums for each x minute increment.
| /co2 | GET | timeframe {1h, 6h, 24h} | cumulative_co2 | distance + potentially aircraft info for more accurate estimate |
| /co2/history | GET | start_timestamp, stop_timestamp | array of values | x minutes co2 sums for each x minute increment.
| /aircraft | GET | - | array of icao24 | list of aircraft in italian territory at the moment |
| /aircraft/{code}/position | GET/websocket | - | current_position | current position of queried aircraft |
| /airports | GET | - | array of <icao24, name(?)> | database (could be static, e.g. from wikipedia) of Italian airports|
| /airports/{code}/takeoffs | GET/websocket | - | array of <icao24, timestamp> | list of planes departed in the last x time (short as possible) from y airport |
| /airports/{code}/landings | GET/websocket | - | array of <icao24, timestamp> | list of planes arrived in the last x time (short as possible) to y airport |
| /aircraft/{code}/info | GET | - | registration country, model, operator, registration number of queried aircraft | |