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.
Screenshots
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
Related projects.
SmartGovt — Village Administration & Services
Village government platform with resident and household records, document services, GIS, regional statistics, RT/RW administration, a citizen portal, and Desa Anti Korupsi (Anti-Corruption Village programme) evaluations.
Laravel 12 · PHP 8.2 · Blade · Alpine.js · +15
Mekar Cilacap — BUMDes/KMP Portal & Marketplace
A digitisation platform for Cilacap Regency’s BUMDes: a Next.js 16 frontend with a separate Laravel API for entity directories, a product marketplace, cash records and monthly reports, accountability reports, work programmes, and profit sharing.
Next.js 16 · React 19 · TypeScript · Tailwind CSS 4 · +10
Web Builder — Village Website SaaS
A multi-tenant SaaS platform for village websites: a GrapesJS visual editor, custom domains with on-demand TLS, WordPress imports, SEO analysis, and SmartGovt data integration.
Next.js 15 · React 19 · TypeScript · Laravel 13 · +12