{"id":33618017,"url":"https://github.com/sid-146/flight-data-ingest","last_synced_at":"2026-03-08T05:32:00.864Z","repository":{"id":315804590,"uuid":"1060753594","full_name":"sid-146/flight-data-ingest","owner":"sid-146","description":null,"archived":false,"fork":false,"pushed_at":"2025-10-28T17:27:14.000Z","size":756,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-28T19:24:00.168Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sid-146.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-20T14:21:54.000Z","updated_at":"2025-10-28T17:27:18.000Z","dependencies_parsed_at":"2025-09-20T21:25:39.907Z","dependency_job_id":"e6b821af-9a2e-41dd-8b33-34e7ec396fa0","html_url":"https://github.com/sid-146/flight-data-ingest","commit_stats":null,"previous_names":["sid-146/flight-data-ingest"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sid-146/flight-data-ingest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sid-146%2Fflight-data-ingest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sid-146%2Fflight-data-ingest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sid-146%2Fflight-data-ingest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sid-146%2Fflight-data-ingest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sid-146","download_url":"https://codeload.github.com/sid-146/flight-data-ingest/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sid-146%2Fflight-data-ingest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30246724,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-08T00:58:18.660Z","status":"online","status_checked_at":"2026-03-08T02:00:06.215Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-12-01T07:01:13.147Z","updated_at":"2026-03-08T05:32:00.853Z","avatar_url":"https://github.com/sid-146.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"```Note\n    - not able to connect to airflow, only delete airflow container and start again using compose up command\n```\n\n## **1. Environment Setup**\n\n### **Airflow Setup with Docker**\n\n-   [-] completed\n\n1. Install **Docker** and **Docker Compose** on your machine.\n2. Use the official `docker-compose.yaml` from the Airflow project to bring up the Airflow environment.\n\n    - Services to be included: `airflow-webserver`, `airflow-scheduler`, `airflow-worker`, `postgres` (for Airflow metadata), and possibly `redis` or `celery` if you want distributed execution.\n\n3. Configure volume mounts so that your DAGs and plugins can be synced from a local folder (e.g., `./dags:/opt/airflow/dags`).\n4. Start the Airflow cluster with `docker-compose up`.\n\n---\n\n## **2. Connect Airflow to GitHub Repository**\n\n-   [-] Pending Need to create a new repo.\n\n1. Create a GitHub repository where you’ll store DAGs, SQL scripts, and documentation.\n2. Configure your Airflow container to pull DAGs from GitHub:\n\n    - Use either a **git-sync sidecar container** or set up a CI/CD pipeline that deploys DAGs into the Airflow DAGs directory.\n    - This ensures changes in GitHub are reflected inside Airflow automatically.\n\n---\n\n## **3. PostgreSQL Database Setup**\n\n-   [-] Done\n\n1. Spin up a **PostgreSQL container** alongside Airflow or use a managed Postgres instance.\n2. Create a new database (e.g., `flights_db`).\n3. Define schema for storing flight data. Example logical design:\n\n    - **Raw Flights Table** (`flights_raw`): stores raw extracted data.\n\n        - `flight_id`, `callsign`, `origin`, `destination`, `latitude`, `longitude`, `altitude`, `speed`, `timestamp`\n\n    - **Reference Table** (`airports`): static info on airports for joins.\n\n        - `airport_id`, `name`, `country`, `latitude`, `longitude`\n\n    - **Clean Flights Table** (`flights_clean`): curated data after transformations.\n    - **Aggregated Tables**:\n\n        - `daily_flight_counts` → flights per day per origin/destination.\n        - `average_speed_by_airline` → mean speed grouped by airline.\n\n---\n\n## **4. DAG Design in Airflow**\n\nBreak the workflow into tasks that reflect **core Airflow concepts**:\n\n1. **Start DAG** → simple dummy operator as entry point.\n2. **Extract Flight Data**\n\n    - Use the **flightradar API/package** to pull data for flights in a specific region or globally.\n    - Store JSON/CSV temporarily in staging (local or S3).\n\n3. **Load Raw Data into Postgres**\n\n    - Insert extracted data into `flights_raw`.\n\n4. **Transform Data**\n\n    - Clean duplicates, filter out incomplete records.\n    - Enrich with airport info (joining `flights_raw` with `airports`).\n    - Load results into `flights_clean`.\n\n5. **Create Aggregates**\n\n    - Generate daily metrics such as flight counts and average speeds.\n    - Store them in `daily_flight_counts` and `average_speed_by_airline`.\n\n6. **Validation \u0026 Quality Checks**\n\n    - Ensure no NULL values in critical fields.\n    - Verify row counts are consistent between raw and clean tables.\n\n7. **End DAG** → log completion or send a notification.\n\n---\n\n## **5. Scheduling \u0026 Orchestration**\n\n-   Schedule the DAG to run **every 30 minutes** for near real-time flight tracking, or once a day if you want to aggregate historical data.\n-   Use **Airflow Variables** to store parameters like region of interest, or date ranges.\n-   Use **Airflow Connections** for Postgres credentials and any API keys.\n\n---\n\n## **6. Monitoring \u0026 Logging**\n\n-   Use Airflow’s built-in UI to track task success/failure.\n-   Enable logs inside tasks for debugging extraction or loading issues.\n-   Optionally, configure alerting (e.g., Slack or email operator) when a DAG fails.\n\n---\n\n## **7. Extension \u0026 Added Complexity**\n\n1. **Standard Tables**: Add dimension tables such as `airlines`, `countries`, `routes`.\n2. **Aggregates**:\n\n    - Top 10 busiest airports per day.\n    - Delay analysis if time-series data is available.\n\n3. **Historical Storage**: Partition `flights_clean` by date for efficient querying.\n4. **Dashboards**: Use a BI tool (e.g., Metabase, Superset, PowerBI) to connect to Postgres and visualize trends.\n\n---\n\nThis approach ensures you cover **core Airflow concepts**:\n\n-   DAG scheduling\n-   Task dependencies\n-   Connections to external services (Postgres, API)\n-   Data validation and transformations\n-   CI/CD integration with GitHub\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsid-146%2Fflight-data-ingest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsid-146%2Fflight-data-ingest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsid-146%2Fflight-data-ingest/lists"}