Code Monkey home page Code Monkey logo

coches-net-dashboard's Introduction

coches-net-dashboard

Coches.net dashboard is an application made by @franloza and @Jorjatorz to visualize Spanish car and motorcycle market through the data obtained from the websites coches.net and motos.coches.net.

This project is composed of a data pipeline run with Dagster, which extract data from coches.net, apply some transformations using dbt, and stores the data in a DuckDB database. The data can be analyzed with a dashboard built with Dash.

This application should not be considered suitable for production, and it's intended to be used only locally for analytical purposes.

This project can also serve an example of how to structure an end-to-end data application, ready to be deployed with a single command using Docker.

Quickstart

To run the application simply run

docker-compose up -d

This will build the Docker images (both Dagster and Dash). The Dagster dashboard is then available on http://localhost:3000 and the Dash dashboard in http://localhost:80.

To download the data, go to the Dagster Dashboard, go to "Launchpad" tab and click "Launch Run". After all processes have been completed, go to the Dash Dashboard, add some filters and click "Search" to visualize the data.

The process to download the data can take a while to finish. If you want to limit the amount of data that is downloaded, you can add the following configuration in the Launchpad:

ops:
  download_coches:
    config:
      max_items: <maximum number of cars to download>
  download_motos:
    config:
      max_items: <maximum number of motorcycles to download>

Screenshots

DAG Dagster Launchpad Tasks successful Dashboard

Local Development (Without using Docker)

Pre-requirements

You will need to have pyenv installed. You can find the installation instructions here.

Orchestration and transformation

  1. Create a new Python environment and activate.
# You can use a different Python version
export PYTHON_VERSION=3.8.14
pyenv install -s $PYTHON_VERSION
pyenv local $PYTHON_VERSION
python -m venv venv
source venv/bin/activate
  1. Once you have activated your Python environment, install the orchestration repository as a Python package. By using the --editable flag, pip will install your repository in "editable mode" so that as you develop, local code changes will automatically apply.
pip install -r requirements.txt --editable orchestration 
  1. Set the DAGSTER_HOME environment variable. Dagster will store run history in this directory.
mkdir ~/dagster_home
export DAGSTER_HOME=~/dagster_home
cat <<EOT >> $DAGSTER_HOME/dagster.yaml
telemetry:
  enabled: false
EOT
  1. Start the Dagit process. This will start a Dagit web server that, by default, is served on http://localhost:3000.
dagit -w orchestration/workspace.yaml

In case you want to debug the ingestion jobs, you can use a helper module named main.py with an entrypoint to be run from IDEs like VSCode or Pycharm.

Visualization

  1. Create a new Python environment and activate.
cd visualization
deactivate >/dev/null 2>&1 || true
# You can use a different Python version
export PYTHON_VERSION=3.8.14
pyenv install -s $PYTHON_VERSION
pyenv local $PYTHON_VERSION
python -m venv venv
source venv/bin/activate
  1. Once you have activated your Python environment, install the dependencies using the requirements.txt file.
pip install -r requirements.txt

Start the Gunicorn process. This will start a Dash web application that will be served on http://localhost:80.

gunicorn -b 0.0.0.0:80 app:server

coches-net-dashboard's People

Contributors

franloza avatar jorjatorz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

coches-net-dashboard's Issues

Docker compose not working: dagster image not found

Getting an error when after docker-compose up -d :

Error response from daemon: pull access denied for dagster, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

Trying to figure it, it seems there's no image named dagster at DockerHub or defined at Dockerfile or docker-compose.yml but it is referenced:

dagster_dagit: image: dagster

How that was working previously?

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.