type-coffee

module
v0.0.0-...-e3b2a5e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 31, 2023 License: Apache-2.0

README

logo
The Best Type of Coffee

ci Go Report Card codecov

Get your right type of coffee ☕

Go application that provides information on the best type of coffee based on user input characteristics. It uses two data sources: the ChatGPT API and a database populated by ETL from a dataset, not required if you only want the ChatGPT data source for the best type coffee options. This dataset was gathered from Kaggle (kudos for the author), see there for further details.

Usage

To run the application, you need to have:

  • Go installed
  • Chat GPT API key, you can create one here
  • Postgres URL (optional)
    • You can run a local docker instance by running the command $ make pg-up or pointing for a Cloud instance

The application has tree command entry points:

ETL

This entrypoint has the responsibility to get the Coffee CSV dataset, convert the rows and then insert them into the Postgres database.

It will create and populate the second data source to retrieve the best type of coffee for you, which you can get using the other 2 commands, API and CLI.

This is optimal if only want the ChatGPT, so skip it.

You can run the ETL by the command:

go run cmd/etl/main.go --DATABASE_URL <database_url>

API

Set up your local .env file using the file .env.example. Then you can start the HTTP API, run the following command:

make run

This will start the API server on port 3000. You can then find the full OpenAPI/Swagger spec definition here, or you can send a request to the following endpoint:

GET /v1/best-coffees: Returns the best type of coffee based on user given characteristics.

CLI

To start the command line interface, run the following command:

go run cmd/cli/main.go --CHAT_GPT_KEY <your_chat_gpt_key> --DATABASE_URL <database_url>

This will run the CLI interface, which will output the best coffees for you from the selected characteristics.

Data Sources

It uses two data sources:

ChatGPT API

The ChatGPT API is used to generate responses to user feedback. The application sends user feedback to the API and receives a response based on the user's input.

Database

The application also uses a database that is populated by ETL (Extract, Transform, Load) dataset data.

License

The Best Type of Coffee is released under the Apache License. See LICENSE for details.

Directories

Path Synopsis
cmd
api
cli
etl
Package coffee provides primitives to interact with the openapi HTTP API.
Package coffee provides primitives to interact with the openapi HTTP API.
infra

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL