How nachetyson/mario_examen2 works
Project Type and Purpose
• This is a full-stack web application whose goal is to predict European flight durations using real-time meteorological data.
• Frontend: single-page interactive map (Leaflet.js + Tailwind CSS + JavaScript).
• Backend: Flask (Python) serving HTML and JSON APIs, performing data retrieval (OurAirports CSV via pandas), weather lookups (Open-Meteo API via requests), Haversine distance and flight-time calculations.
File Structure Analysis
• Top-level Python scripts:
• AirportsEurope_FTbyAircraft.py – likely contains logic for flight time calculation by aircraft type.
• AirportsEurope_FlightTime.py – likely contains distance & weather-adjusted duration logic.
• README.md – project description, instructions, architecture overview.
• requirement.txt – lists flask, pandas, requests.
• FlighWithMe.jfif – logo or UI placeholder.
• No separate “frontend” or “templates” folder: the HTML/JS is embedded in the Flask script (app.py or equivalent).
Architecture Insights from README
• Client-Server pattern: SPA served by Flask.
• API Endpoints:
/ → serves the single HTML_TEMPLATE
/api/airports → returns JSON list of 50 top European airports
/api/weather/<iata> → returns real-time weather for one airport
/api/calculate → computes distance + weather + aircraft type → returns flight duration
• Data Sources:
• OurAirports CSV on GitHub (download_airport_data())
• Open-Meteo API for current wind and temperature
a. Main Components
• Browser/Client UI
• Flask Web Server
• Flight-time Logic Modules (distance, aircraft adjustments)
• Airport Data Loader (pandas + CSV)
• Weather API Adapter (requests + Open-Meteo)
• External Services: GitHub CSV, Open-Meteo API
b. Relationships and Interactions
1. User interacts with UI (selects airports, aircraft type).
2. UI sends fetch requests to Flask API endpoints.
3. Flask invokes:
– Airport Data Loader for /api/airports.
– Weather API Adapter for /api/weather.
– Flight-time Logic Modules for /api/calculate.
4. Logic modules combine distance (Haversine) and weather to compute duration.
5. Flask returns JSON responses to client.
6. UI renders results on the map and result card.
c. Architectural Patterns and Principles
– Client-Server separation.
– Single-Page Application (SPA) pattern: one HTML template, asynchronous fetch calls.
– Modular backend: separate functions for data retrieval and business logic.
– Externalization: using external data sources instead of local DB.
d. Relevant Technologies and Frameworks
– Frontend: HTML, Tailwind CSS, JavaScript (ES6), Leaflet.js
– Backend: Python, Flask, pandas, requests
– External APIs: OurAirports (CSV), Open-Meteo (weather)