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.
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.
- Translate the dataset into English and Russian. ✅
- Create a Telegram bot to deliver this dataset to bot users. ✅
- Allow a user to configurate his preferences. (pending) ⏳
- Allow a user to search buildings per location. ✅
- ...
- Get your bot API key from @BotFather -
BOT_TOKEN
. - Create a new PostgreSQL database, install an
earthdistance
extension, get aDATABASE_URL
. - Populate the database with data (see "Prepare data" for details).
- Install Docker.
- Build a bot container:
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
- 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.
Open a project root directory in a console and install project dependencies:
go mod tidy
Apply database migrations:
DATABASE_URL=<DATABASE_URL> make migrate
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
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
Transfer the data from xlsx
files to the database:
go run main.go populate --dburl ${DatabaseURL} --sheet Lauttasaari fi.xlsx en.xlsx ru.xlsx
Run the project tests:
make test
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.
This project is licensed under the MIT License - see the LICENSE file for details.