Git Product home page Git Product logo

dec_project_1's Introduction

DEC - project 1

OpenSky Network API

opensky_title

This project consisting of implementation ETL process for getting live airflights data.

β€œThe API lets you retrieve live airspace information for research and non-commerical purposes.”


Author GitHub profile
Pawel Dymek pdymek
Cristian Ivanoff cristianivanoff
Alexa Berard alexaberard

The solutions is done with help of:

API Limitations

Limitations 30 days of data. Only 7 days of data per call.


Business Questions

Objective was to extract flight data to answer these questions

  • Average amount of flights by months.
  • Flight time delay - estimated time vs arrival time
  • Flight time statistics - max, min, spread within routes
  • Route statistics - how often they are used
  • Time intervals between preceeding flights on same route

Architecture

etl_graph

Extraction

  • Two airports: Krakow and Warsaw
  • If database is empty set first date to current date - 30 days
    • else: set first date to latest extraction date - select max(extractionDate) from flightdata
  • Create a loop to extract 7 days per call
    • Loop and extract
  • Remember that timestamps are stored in UTC

Transform

Sample sql query from etl/sql/transform/

select f.*, 
	min(f."timeInterval") over (partition by f."estDepartureAirport", f."estArrivalAirport") as "minIntervalByRoute",
	max(f."timeInterval") over (partition by f."estDepartureAirport", f."estArrivalAirport") as "maxIntervalByRoute"
from (
	select f.*
		, f."lastSeen" - f."firstSeen" as "timeInterval"
	from flightdata as f
	where f."flightDataType" = 'arrival'
		and f."estDepartureAirport" is not null
		and f."estArrivalAirport" is not null
) f

Output tables as precalculated reports from SQL jinja templates.

output_tables

Project run instruction

For running ETL process the cd should be set as DEC_PROJECT_1.

The .env file should be located in main folder, with listed paramters:

USERNAME_API_OPENSKY=""
PASSWORD_API_OPENSKY=""
SERVER_NAME=""
DATABASE_NAME=""
DATABASE_DWH_NAME=""
DB_USERNAME="postgres"
DB_PASSWORD=""      

The unit test function is :

pytest etl_test

Output: sample_test_output

ETL execution:

python -m etl.pipelines.opensky

Output:

sample_etl_run

dec_project_1's People

Contributors

pdymek avatar currambero avatar cristianivanoff avatar alexaberard avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.