ID — Bahasa Indonesia

Muhamad Irga

Purwokerto, Central Java

Updated

Bot OCR KK — Data Extraction via Telegram

A Telegram bot that extracts Kartu Keluarga photographs using Google Gemini, validates data and regional references, and saves the results to the SmartGov database.

See the service: Village Information Systems

Screenshots

Bot OCR KK conversation in Telegram returning extracted family-card data
Main application view · Open image for full resolution

Overview

What this system does.

Bot OCR KK helps village operators convert information from photographs of Kartu Keluarga (family cards) into structured data. Operators log in through bot commands, check their sessions, and send a family-card image; a Google Gemini-based OCR service reads the family’s identity and every listed member.

Extracted results undergo text cleaning, date parsing, field validation, population reference-data matching, and regional-code checks before storage. The data-creation service matches or creates family and resident entries in MySQL according to the SmartGov structure, while operators receive progress responses and error messages directly in Telegram.

The implementation uses Node.js with separate bot handlers, commands, and authentication, OCR, validation, reference, regional, and data-creation services. Sharp processes images before they are sent to the model, Winston records application logs, and evaluation-metric utilities measure extraction quality. The application is packaged with Docker and Docker Compose.

Feature inventory

Highlights

13 capabilities verified against the project source.

  • Bot commands for getting started, logging in, and checking sessions
  • Receipt of Kartu Keluarga photographs through Telegram
  • Family and member data extraction using Google Gemini
  • Image processing before submission to the OCR service
  • Text cleaning and date-format parsing
  • Validation of extracted fields
  • Population reference-data matching
  • Regional-code lookup and checks
  • Creation or matching of family and resident data
  • Results stored in MySQL following the SmartGov data structure
  • Evaluation-metric utilities to measure extraction quality
  • Progress responses and error messages for operators
  • Application logging and Docker Compose packaging

Tech stack

Built with 7 technologies.

  • Node.js
  • Telegram Bot API
  • Google Gemini
  • MySQL
  • Sharp
  • Winston
  • Docker

Common questions

What people usually ask.

Why Telegram rather than a web upload?

Because village operators already photograph documents with their phones. A bot removes the step of moving that photograph onto a computer and into a form; they send it where they already are.

What stops a bad OCR read reaching the database?

Extracted text passes through cleaning, date parsing, field validation, population reference matching, and regional-code checks before anything is written, and the operator sees errors in the chat rather than after the fact.

How is extraction quality measured?

Evaluation-metric utilities score extractions, so a change to the prompt or the image pre-processing can be judged against numbers rather than impressions.

Same field

Need something like this?

Send a short brief and I’ll come back with scope, approach, and an honest timeline.