Giter Site home page Giter Site logo

servier-de's Introduction

Data Pipeline for Exploring the Drug Publication

This personal project serves as a Data Engineering technical test for Servier

1. Pipeline Overview

Here is a high-level overview of the steps followed by the 'servier_pipeline' Airflow DAG:

  1. Ingestion and Preliminary Preprocessing: Data is ingested from Minio (local S3), cleaned in .csv format, and then saved back in minio.
  2. Graph Calculation: Cleaned data are merged resulting in the drug_graph_final.json file that can be found in the Minio bucket (impor/minio/airflow).

Setup

Requirements

$ Ensure Docker is installed on your machine: 
$ brew install --cask docker

Clone project

$ git clone https://github.com/SmadjaPaul/servier-de

Start containers

Navigate to the project directory and run:

$ docker-compose up

To run in the background:

$ docker-compose up -d

Check Access:

Application URL Credentials
Airflow http://localhost:8080 User: airflow
Pass: airflow
MinIO http://localhost:9000 User: admin
Pass: minio-password

|

Review the Makefile for additional commands. Note: Commands were tested on Linux.

echo "Setting Airflow settings"
echo "AIRFLOW_UID=$(id -u)" > .env
echo "Please make sure the user id is correct in .env"
nano .env

echo "Starting everything"
echo "Please wait a while or run 'make ps' to see if things are 'ready' and the init containers have exited (finished)"
echo "Airflow: http://127.0.0.1:8080 (Username: 'airflow', Password: 'airflow')"
echo "Minio: http://127.0.0.1:9002 (Username: 'admin', Password: 'minio-password')"
echo "Ctrl+c to exit when ready"
make up
echo "Cleaning up / removing everything"
make stop

Test the Application:

If you want to run tests, use poetry after setting up a virtual environment and installing all dependencies. You can find the tests in test_func.py, including those related to the Bonus part.

$ poetry run pytest

How it works

  1. Creates a minio/minio (MinIO) container
  2. Use MC inside minio/mc (minio-init) to create a bucket and upload csv files
  3. The airflow-provision creates a connector in Airflow that allows Airflow to access MinIO.
  4. DAG to read files from MinIO, make data cleaning, and final calculation

How to improve this project?

  1. Adding functionality: The final JSON file could be loaded into a Neo4J database, allowing for beautiful visual representations and enhanced analytics capabilities from tools like Jupyter Notebooks.

  2. DevOps: Implement robust CI/CD and Infrastructure as Code (IaC) practices for a production environment.

  3. Alternative Workflow: Consider using tools beyond pandas in a production context. Loading data directly into a SQL table and managing transformations with dbt (ELT) or using PySpark (ETL) are alternatives.

  4. Dynamic variable: Transform all constants into environment variables and set up secrets for better credential management.

servier-de's People

Contributors

smadjapaul avatar

Watchers

 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.