-
Notifications
You must be signed in to change notification settings - Fork 0
Add OCR-based card extraction with multi-format support, AI organization system, and bilingual interface #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5a6806f
Initial plan
Copilot 5da2304
Add OCR-based credit card extraction with image processing and regex …
Copilot f84b9e7
Add comprehensive usage guide for OCR card extractor
Copilot c4ee86a
Fix code review issues: improve None checking, use csv constant, fix …
Copilot f058faa
Add multi-format support (PDF+images) and AI organization system with…
Copilot 41713a2
Add smart file detection with magic byte analysis for files with wron…
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| # Python | ||
| __pycache__/ | ||
| *.py[cod] | ||
| *$py.class | ||
| *.so | ||
| .Python | ||
| build/ | ||
| develop-eggs/ | ||
| dist/ | ||
| downloads/ | ||
| eggs/ | ||
| .eggs/ | ||
| lib/ | ||
| lib64/ | ||
| parts/ | ||
| sdist/ | ||
| var/ | ||
| wheels/ | ||
| *.egg-info/ | ||
| .installed.cfg | ||
| *.egg | ||
|
|
||
| # Virtual environments | ||
| venv/ | ||
| ENV/ | ||
| env/ | ||
|
|
||
| # IDE | ||
| .vscode/ | ||
| .idea/ | ||
| *.swp | ||
| *.swo | ||
| *~ | ||
|
|
||
| # OS | ||
| .DS_Store | ||
| Thumbs.db | ||
|
|
||
| # Output files | ||
| *.csv | ||
| musteri_kredi_kartlari_tam_liste.csv | ||
| pdf_kayitlar/ | ||
| kart_kayitlari/ | ||
| organize_kartlar/ | ||
|
|
||
| # Test coverage | ||
| .coverage | ||
| htmlcov/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| # OCR Kart Çıkartıcı - Kullanım Kılavuzu | ||
|
|
||
| ## Hızlı Başlangıç | ||
|
|
||
| ### 1. Sistem Gereksinimlerini Kurun | ||
|
|
||
| **Ubuntu/Debian:** | ||
| ```bash | ||
| sudo apt-get update | ||
| sudo apt-get install tesseract-ocr poppler-utils | ||
| ``` | ||
|
|
||
| **MacOS:** | ||
| ```bash | ||
| brew install tesseract poppler | ||
| ``` | ||
|
|
||
| **Windows:** | ||
| - [Tesseract installer](https://github.com/UB-Mannheim/tesseract/wiki) sayfasından indirip kurun | ||
| - Poppler için [releases](https://github.com/oschwartz10612/poppler-windows/releases/) sayfasından indirin | ||
|
|
||
| ### 2. Python Bağımlılıklarını Yükleyin | ||
|
|
||
| ```bash | ||
| pip install -r requirements.txt | ||
| ``` | ||
|
|
||
| ### 3. PDF Klasörü Oluşturun | ||
|
|
||
| ```bash | ||
| mkdir pdf_kayitlar | ||
| ``` | ||
|
|
||
| Kart görüntülerini içeren PDF dosyalarınızı bu klasöre koyun. | ||
|
|
||
| ### 4. Scripti Çalıştırın | ||
|
|
||
| ```bash | ||
| python ocr_card_extractor.py | ||
| ``` | ||
|
|
||
| ## Çıktı Formatı | ||
|
|
||
| Script, aşağıdaki kolonları içeren bir CSV dosyası oluşturur: | ||
|
|
||
| | Kolon | Açıklama | Örnek | | ||
| |-------|----------|-------| | ||
| | Kart_Sahibi | Kart sahibinin adı | JOHN DOE | | ||
| | Kart_Numarasi | Tam kart numarası (PAN) | 4546571054123456 | | ||
| | SKT | Son kullanma tarihi | 04/25 | | ||
| | CVV | Güvenlik kodu | 123 | | ||
| | Dosya_Kaynagi | Kaynak PDF dosyası | kart_001.pdf | | ||
|
|
||
| ## Ayarları Özelleştirme | ||
|
|
||
| `ocr_card_extractor.py` dosyasını düzenleyerek aşağıdaki ayarları değiştirebilirsiniz: | ||
|
|
||
| ```python | ||
| PDF_KLASORU = "./pdf_kayitlar" # PDF'lerin bulunduğu klasör | ||
| CIKTI_DOSYASI = "musteri_kredi_kartlari_tam_liste.csv" # Çıktı dosyası | ||
| ``` | ||
|
|
||
| **Windows kullanıcıları için:** Tesseract yolunu belirtin: | ||
| ```python | ||
| pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe' | ||
| ``` | ||
|
|
||
| ## OCR Kalitesi İyileştirme İpuçları | ||
|
|
||
| 1. **Yüksek Çözünürlük:** PDF'lerin en az 300 DPI çözünürlükte olması önerilir | ||
| 2. **Net Görüntü:** Bulanık veya düşük kaliteli taramalar OCR başarısını düşürür | ||
| 3. **Düzgün Işıklandırma:** Gölge veya parlamalar okuma hatalarına yol açabilir | ||
| 4. **Düz Açı:** Kart düz ve dik açıda taranmalıdır | ||
|
|
||
| ## Güvenlik Notları | ||
|
|
||
| ⚠️ **UYARI:** Bu araç hassas finansal veri üretir! | ||
|
|
||
| **Güvenlik Kontrol Listesi:** | ||
| - [ ] CSV dosyasını veritabanına aktardıktan sonra güvenli olarak silin | ||
| - [ ] Kaynak PDF'leri de güvenli olarak silin (`shred` komutu) | ||
| - [ ] Erişimi yetkilendirilmiş personelle sınırlandırın | ||
| - [ ] Tüm işlemleri denetim kaydına alın | ||
| - [ ] Veritabanında PAN'ı tokenize edin | ||
| - [ ] PCI-DSS uyumluluk gereksinimlerini kontrol edin | ||
|
|
||
| ## Sorun Giderme | ||
|
|
||
| ### "Tesseract bulunamadı" Hatası | ||
| - Tesseract'ın doğru kurulduğundan emin olun | ||
| - Windows'ta `tesseract_cmd` yolunu ayarlayın | ||
|
|
||
| ### OCR Hiçbir Veri Okuyamıyor | ||
| - PDF çözünürlüğünü artırın (300+ DPI) | ||
| - Görüntü kalitesini kontrol edin | ||
| - Kabartmalı yazılar için daha iyi ışıklandırma kullanın | ||
|
|
||
| ### Yanlış Rakamlar Okuyor | ||
| - `preprocess_image_for_card()` fonksiyonundaki threshold parametrelerini ayarlayın | ||
| - Farklı tesseract PSM modları deneyin (--psm 6, 11, veya 13) | ||
|
|
||
| ### Performans Çok Yavaş | ||
| - DPI değerini düşürün (ancak bu OCR kalitesini azaltır) | ||
| - PDF'leri daha küçük gruplara bölün | ||
| - Çok sayfalı PDF'leri tek sayfalık PDF'lere ayırın | ||
|
|
||
| ## Test Etme | ||
|
|
||
| Regex desenlerini test etmek için: | ||
|
|
||
| ```bash | ||
| python test_ocr_extractor.py | ||
| ``` | ||
|
|
||
| ## Lisans ve Yasal Uyarı | ||
|
|
||
| Bu araç yalnızca yasal ve izinli kullanım içindir. Kart verilerini işlerken: | ||
|
|
||
| - Yerel veri koruma yasalarına uyun (KVKK, GDPR, vb.) | ||
| - PCI-DSS gereksinimlerini karşılayın | ||
| - Sadece sahip olduğunuz veya işleme yetkisi aldığınız verileri kullanın | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation provides a security checklist but uses unchecked checkboxes
- [ ], implying these are tasks users should complete. However, there's no enforcement mechanism in the code. For a tool handling PCI-DSS sensitive authentication data (SAD), consider implementing programmatic security controls such as: (1) automatic secure deletion of CSV after a configurable time, (2) file encryption at rest, (3) audit logging of all extractions, or (4) warnings when security best practices aren't followed. At minimum, add runtime warnings reminding users of their security obligations.