API untuk ekstraksi data otomatis dari Kartu Keluarga (KK) Indonesia menggunakan teknologi AI
API ini memungkinkan Anda untuk menganalisis gambar Kartu Keluarga Indonesia dan mengekstrak data terstruktur seperti informasi kepala keluarga, anggota keluarga, dan detail administratif lainnya secara otomatis.
- ๐ค AI-Powered: Menggunakan Gemini AI untuk analisis dokumen
- ๐ Auto Storage: Penyimpanan otomatis ke Google Sheets
- ๐พ File Backup: Backup gambar ke Google Drive
- โ Document Validation: Validasi otomatis dokumen KK
- ๐ Structured Output: Output data terstruktur dalam JSON
- ๐ Real-time Processing: Pemrosesan real-time tanpa antrian
- ๐ Comprehensive Logging: Log aktivitas lengkap
- ๐ก๏ธ Error Handling: Penanganan error yang robust
Live API Endpoint:
https://script.google.com/macros/s/YOUR_SCRIPT_ID/exec
Contoh Request:
curl -X POST "https://script.google.com/macros/s/YOUR_SCRIPT_ID/exec" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "action=process-kk&fileData=iVBORw0KGgo...&fileName=kk.jpg&mimeType=image/jpeg"- Google Account dengan akses ke:
- Google Apps Script
- Google Drive
- Google Sheets
- Gemini AI API Key
- Kartu Keluarga Indonesia (untuk testing)
git clone https://github.com/classyid/kk-extractor-api.git
cd kk-extractor-api- Buka Google Apps Script
- Buat project baru
- Copy-paste kode dari
src/main.js
Edit bagian konfigurasi di file:
const GEMINI_API_KEY = 'your-gemini-api-key';
const SPREADSHEET_ID = 'your-spreadsheet-id';
const FOLDER_ID = 'your-drive-folder-id';- Klik "Deploy" > "New deployment"
- Pilih "Web app"
- Set execute as "Me" dan access to "Anyone"
- Copy deployment URL
GET /POST /
Content-Type: application/x-www-form-urlencoded
action=process-kk
fileData=base64_encoded_image
fileName=kk.jpg
mimeType=image/jpegPOST /
Content-Type: application/x-www-form-urlencoded
action=docs{
"status": "success",
"code": 200,
"data": {
"original": {
"fileUrl": "https://drive.google.com/file/d/...",
"fileName": "kk.jpg",
"mimeType": "image/jpeg"
},
"analysis": {
"raw": "...",
"parsed": {
"status": "success",
"nomor_kk": "45410215111004546",
"kepala_keluarga": { ... },
"anggota_keluarga": [ ... ]
}
}
}
}async function processKK(file) {
const formData = new FormData();
formData.append('action', 'process-kk');
formData.append('fileName', file.name);
formData.append('mimeType', file.type);
const base64 = await fileToBase64(file);
formData.append('fileData', base64);
const response = await fetch('YOUR_API_URL', {
method: 'POST',
body: formData
});
return await response.json();
}import base64
import requests
def process_kk(file_path):
with open(file_path, 'rb') as f:
file_data = base64.b64encode(f.read()).decode()
payload = {
'action': 'process-kk',
'fileData': file_data,
'fileName': 'kk.jpg',
'mimeType': 'image/jpeg'
}
response = requests.post('YOUR_API_URL', data=payload)
return response.json()kk-extractor-api/
โโโ kode.js
โโโ README.md
โโโ API_DOCUMENTATION.md
API akan membuat 4 sheet otomatis:
- log - Activity logs
- metadata - File metadata
- data_kk - Main KK data
- anggota_keluarga - Family members details
https://www.googleapis.com/auth/spreadsheetshttps://www.googleapis.com/auth/drivehttps://www.googleapis.com/auth/script.external_request
- Digitalisasi Arsip: Konversi arsip KK fisik ke digital
- Aplikasi Pendaftaran: Otomasi input data dari KK
- Sistem Administrasi: Integrasi dengan sistem pemerintahan
- Research & Analytics: Analisis data demografi
- Document Management: Sistem manajemen dokumen
- Ukuran file maksimal: 50MB
- Rate limit: 100 requests/hour/user
- Format: JPG, PNG, GIF, BMP, WEBP
- Khusus format KK Indonesia
Kontribusi sangat welcome! Silakan:
- Fork repository
- Buat feature branch (
git checkout -b feature/AmazingFeature) - Commit changes (
git commit -m 'Add AmazingFeature') - Push ke branch (
git push origin feature/AmazingFeature) - Buat Pull Request
- Initial release
- Basic KK data extraction
- Google Sheets integration
- API documentation
Distributed under the MIT License. See LICENSE for more information.
- Google Gemini AI - AI processing
- Google Apps Script - Backend platform
- Google Workspace - Storage & database
Jika Anda mengalami masalah atau memiliki pertanyaan:
- ๐ง Email: kontak@classy.id