helsinki-guide

command module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2024 License: MIT Imports: 2 Imported by: 0

README

helsinki-guide

This repository contains the code for a Telegram bot designed to provide information about notable buildings in Helsinki. The bot is working at https://t.me/HelsinkiGuide_bot.

Motivation

Helsinki boasts many fascinating buildings, but finding information about them can be challenging. This project's primary goal is to make such information more easily accessible. The project relies on a dataset provided by the Helsinki City Museum.

Project Goals

  1. Translate the dataset into English and Russian. (pending)
  2. Create a Telegram bot to deliver this dataset to bot users. ✅
  3. Allow a user to configurate his preferences. (pending)
  4. Allow a user to search buildings per location. ✅
  5. ...

Getting Started

make USER=<dockerhub_username> TAG=anynewtag build
  • Apply database migrations:
DATABASE_URL=<DATABASE_URL> make migrate
  • Run the bot:
BOT_TOKEN=<BOT_TOKEN> DATABASE_URL=<DATABASE_URL> make run

Development

Prerequisites
  • Go v.1.21 or higher should be already installed.
  • A bot API token BOT_TOKEN provided by @BotFather.
  • Docker should be already installed.
  • An empty Postgresql database with an installed earthdistance extension.
  • An environment variable DATABASE_URL to connect to the PostgreSQL database.
  • A subscription to the Google Translate API is required to automatically translate the source dataset into other languages.
Installation

Open a project root directory in a console and install project dependencies:

go mod tidy

Apply database migrations:

DATABASE_URL=<DATABASE_URL> make migrate
Start

Run the bot:

DATABASE_URL=<DATABASE_URL> go run main.go bot --token <BOT_TOKEN>

Get more information about available commands and options:

go run main.go --help
Prepare Data
Translate the source dataset

This command will create a new file translated.xlsx where a Lauttasaari sheet will be partially translated into English.

go run main.go translate --api-key <your Google Translate API key> --sheet Lauttasaari input_dataset.xlsx translated.xlsx
Populate the database

Transfer the data from xlsx files to the database:

go run main.go populate --dburl ${DatabaseURL} --sheet Lauttasaari fi.xlsx en.xlsx ru.xlsx
Tests

Run the project tests:

make test

Acknowledgements

Source: History of buildings in Helsinki. The maintainer of the dataset is Helsingin kulttuurin ja vapaa-ajan toimiala / Kaupunginmuseo and the original author is Tmi Hilla Tarjanne. The dataset has been downloaded from Helsinki Region Infoshare service on 2023-10-22 18:00:08.977295 under the license Creative Commons Attribution 4.0.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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