Skip to content

LucasVmigotto/fiap-pos-ml-eng-techchallenge-1

Repository files navigation

Tech Challenge #1

Você foi contratado(a) para uma consultoria e seu trabalho envolve analisar os dados de vitivinicultura da Embrapa, os quais estão disponíveis aqui.

A ideia do projeto é a criação de uma API pública de consulta nos dados do site nas respectivas abas:

  • Produção
  • Processamento
  • Comercialização
  • Importação
  • Exportação

A API vai servir para alimentar uma base de dados que futuramente será usada para um modelo de Machine Learning.

Seus objetivos incluem:

  • Criar uma Rest API em Python que faça a consulta no site da Embrapa.
  • Sua API deve estar documentada.
  • É recomendável (não obrigatório) a escolha de um método de autenticação (JWT, por exemplo).
  • Criar um plano para fazer o deploy da API, desenhando a arquitetura do projeto desde a ingestão até a alimentação do modelo (aqui não é necessário elaborar um modelo de ML, mas é preciso que vocês escolham um cenário interessante em que a API possa ser utilizada).
  • Fazer um MVP realizando o deploy com um link compartilhável e um repositório no GitHub.

Requirements

Mandatory

Optional/Recommended

Development

  1. Clone the repository

    • With HTTP

      # With HTTPS
      git clone https://github.com/LucasVmigotto/fiap-pos-ml-eng-techchallenge-1.git
    • With SSH

      git clone git@github.com:LucasVmigotto/fiap-pos-ml-eng-techchallenge-1.git
  2. Open the project with Visual Studio Code:

    code <project folder>

    If the project not already open inside a container, use CTRL + Shift + P and run the Dev Containers: Rebuild Container Without Cache command

  3. Happy coding :)

Running the application

Inside the Visual Studio Code Container

  • Run inside the Visual Studio Code terminal

    poetry run python -m uvicorn --host 0.0.0.0 --port 8000 --reload

Inside a separate container (with Docker Compose)

  • Run the following command:

    docker compose up api

    You can use docker compose -d up api to run in detached mode. Although, to be able to see any server logs, you will need to run docker compose logs -f api

    Once successfully started, the service will be available in localhost:8001

    The Docker Compose container use the port 8001 to not get conflicted with the Visual Studio Code that use the port 8000 - Uvicorn default's door

Deployment

Build the Production Docker image

  • Run the following command in the first level of the project's folder:

    docker build \
        -f Dockerfile
        --tag fiap-pos-techchallenge \
        --no-cache \
        .

    If necessary, add the --progress plain to see all build output

    • You can test the builded container with:

      docker run \
          --publish 8001:80 \
          --rm \
          fiap-pos-techchallenge

      Give it a try in localhost:8001

References