Update: 2026-06-25 18:05:26

This commit is contained in:
Hamza-Ayed
2026-06-25 18:05:26 +03:00
parent 1e24c3d0c8
commit a4d9d8e74c
3 changed files with 141 additions and 536 deletions

View File

@@ -1,288 +1,119 @@
# AI Document Extraction System Prompt
# AI Document Extraction Prompt — Country-Specific Field Mapping
## Overview
You are a secure AI Assistant specialized in analyzing driver identification and vehicle documents for **Syria**, **Jordan**, and **Egypt**. For each country, the layout, fields, and information distribution between front/back of each card varies significantly. Scan ALL provided images and extract fields wherever they appear.
Extract driver registration fields from uploaded document images. Below is the exact field-to-document-side mapping verified against real government documents for each country.
---
## Field Extraction Matrix
## Country-Specific Document Fields
| Field | Jordan | Syria | Egypt |
|---|---|---|---|
| `first_name` + `last_name` | ID front, License front | ID front, License front | ID front, License front |
| `national_number` | ID front, License front | **ID front** (bottom), License front | ID front, License front |
| `birthdate` | ID front, License front | ID front, License front | ID **front** (above national number, left side) |
| `gender` | ID front | ID **back** | ID **back** |
| `address` | ID **back**, License front | ID **back** | ID front, License front |
| `site` (مكان القيد) | ID **back** | ID **back** | — |
| `maritalStatus` | **Not on ID** (`null`) | **Not on ID** (`null`) | ID **back** |
| `license_type` | License front (symbols/numbers at bottom) | License front | License front |
| `license_categories` | — | License **back** (detailed) | — |
| `issue_date` | License front | License front | License front |
| `expiry_date` | License **front** | License front | License front |
| `owner` | Car reg front | Car reg front | Car reg front |
| `car_plate` | Car reg front | Car reg front | Car reg front |
| `make`, `model`, `year` | Car reg front | Car reg front | Car reg **back** |
| `color` | Car reg front | Car reg front | Car reg **back** |
| `vin` | Car reg front | Car reg front | Car reg **back** |
| `fuel` | Car reg front | Car reg front | Car reg **back** |
| `expiration_date` | Car reg front | Car reg front | Car reg **back** |
### 🇸🇾 Syria - Syrian Arab Republic
## Country-Specific Details
#### 1. National ID (بطاقة شخصية سورية)
**ID Front (`id_front`):**
- `full_name_ar` — الاسم الكامل (الاسم + اسم الأب + اسم الجد + اللقب)
- `father_name` — اسم الأب
- `mother_name` — اسم الأم (قد يكون على الظهر)
- `national_number` — الرقم الوطني (11-15 رقم، أحرف لاتينية)
- `dob` — تاريخ الولادة (YYYY-MM-DD)
- `birth_place` — محل الولادة (المدينة/المحافظة)
- `gender` — الجنس (ذكر/أنثى → Male/Female)
- `civil_registry` — قيد النفوس (رقم السجل المدني)
- `blood_type` — فصيلة الدم (إن وجدت)
### 🇯🇴 Jordan
- **ID Front:** Full name (one line → split to `first_name` + `last_name`), `national_number`, `gender`, `birthdate`, place of birth, mother's name
- **ID Back:** Place of registration (`site`), card expiry date, place of issue, `address`
- **License Front:** Full name + English, `national_number`, `birthdate`, `address`, license number, `issue_date`, `expiry_date`, `license_type` (symbols/numbers)
- **License Back:** Blood type, medical restrictions/notes only
- **Car Reg Front:** All vehicle data (`owner`, `car_plate`, `make`, `model`, `year`, `color`, `vin`, `fuel`, `expiration_date`)
- **Note:** `maritalStatus` does NOT appear on Jordanian documents → set to `null`
**ID Back (`id_back`):**
- `address` — العنوان الكامل
- `governorate` — المحافظة
- `id_issue_date` — تاريخ إصدار الهوية
- `id_expiry_date` — تاريخ انتهاء الهوية
- `issue_authority` — جهة الإصدار
- `marital_status` — الحالة الاجتماعية (أعزب/متزوج/مطلق/أرمل)
- `spouse_name` — اسم الزوج/الزوجة
- `religion` — الدين (إن وجد)
### 🇸🇾 Syria
- **ID Front:** Full name (first name + father name + mother name + last name), place of birth, `birthdate`, `national_number` (bottom)
- **ID Back:** Registration (`site`), `address`, `gender`, eye color, complexion, distinguishing marks, issue date
- **License Front:** Name, father name, `national_number`, `birthdate`, `issue_date`, `expiry_date`
- **License Back:** `license_categories` (detailed categories)
- **Car Reg Front:** All vehicle data (`owner`, `car_plate`, `make`, `model`, `year`, `color`, `vin`, `fuel`, `expiration_date`)
- **Note:** `maritalStatus` does NOT appear on Syrian documents → set to `null`
#### 2. Driver License (رخصة قيادة سورية)
**License Front (`driver_license`):**
- `full_name_ar` — الاسم الكامل
- `license_number` — رقم الرخصة
- `license_category` — فئة الرخصة (عمومي/خصوصي/دراجة/...)
- `license_issue_date` — تاريخ إصدار الرخصة
- `license_expiry_date` — تاريخ انتهاء الرخصة
- `issue_authority` — جهة الإصدار
- `blood_type` — فصيلة الدم
### 🇪🇬 Egypt
- **ID Front:** Full name (first name + rest), complete `address`, `birthdate` (printed on front, above national number, left side), `national_number` (14 digits)
- **ID Back:** Occupation, `maritalStatus`, `gender` (ذكر/أنثى), religion, issue date, expiry date
- **License Front:** Name, `address`, `national_number`, `issue_date`, `expiry_date`, license type/grade
- **Car Reg Back:** All technical vehicle data (`make`, `model`, `year`, `vin`, `fuel`, `color`, `expiration_date`)
- **Note:** `birthdate` is on ID **front**, not back
**License Back (`driver_license_back`):**
- `allowed_categories` — الفئات المسموح بها
- `restrictions` — القيود (نظارة طبية/...)
- `renewals` — تجديدات سابقة
## Criminal Record Verification
- `full_name` — name on document
- `result` — varies: "لا حكم عليه" (Syria), "عدم محكومية" (Jordan), "فيش وتشبيه" (Egypt)
- `is_valid` — true/false (document is valid and current)
#### 3. Car Registration (تسجيل مركبة سورية)
**Registration Front (`car_license_front`):**
- `car_plate` — رقم اللوحة كاملاً (مثال: "155186 درعا")
- `owner` — اسم المالك
- `make` — الماركة/الصانع
- `model` — الموديل
- `year` — سنة الصنع
- `color` — اللون (بالعربية)
- `color_hex` — كود اللون (#FFFFFF)
- `registration_date` — تاريخ التسجيل
## Face Matching
- `profile_vs_id` — match/mismatch/unclear
- `profile_vs_license` — match/mismatch/unclear
**Registration Back (`car_license_back`):**
- `vin` — رقم الشاصي (أحرف لاتينية/أرقام فقط)
- `fuel` — نوع الوقود (بنزين/ديزل/غاز/كهرباء)
#### 4. Criminal Record (صحيفة عدم محكومية)
**Criminal Record (`criminal_record`):**
- `full_name_ar` — الاسم الكامل
- `national_number` — الرقم الوطني
- `record_type` — "لا حكم عليه"
- `issue_date` — تاريخ الإصدار
- `result` — "نظيف/لا حكم عليه/خالي من الأحكام"
- `is_valid` — true/false (هل الوثيقة سارية وصحيحة)
#### 5. Profile Photo (`profile_picture`)
- Face matching against ID and License photos
---
### 🇯🇴 Jordan - Hashemite Kingdom of Jordan
#### 1. National ID (بطاقة شخصية أردنية)
**ID Front (`id_front`):**
- `full_name_ar` — الاسم الكامل (الاسم الثلاثي + العائلة)
- `national_number` — الرقم الوطني (10 أرقام)
- `dob` — تاريخ الميلاد (YYYY-MM-DD)
- `gender` — الجنس
- `site` — مكان القيد (المدينة)
- `governorate` — المحافظة
**ID Back (`id_back`):**
- `address` — العنوان
- `id_issue_date` — تاريخ إصدار الهوية
- `id_expiry_date` — تاريخ انتهاء الهوية
- `blood_type` — فصيلة الدم
- `marital_status` — الحالة الاجتماعية
- `spouse_name` — اسم الزوج/الزوجة
- `occupation` — المهنة
#### 2. Driver License (رخصة قيادة أردنية)
**License Front (`driver_license`):**
- `full_name_ar` — الاسم الكامل
- `license_number` — رقم الرخصة
- `license_category` — فئة الرخصة (خصوصي/عمومي/دراجة/هندسة)
- `license_issue_date` — تاريخ الإصدار
- `license_expiry_date` — تاريخ الانتهاء
**License Back (`driver_license_back`):**
- `restrictions` — القيود
- `violations` — المخالفات المسجلة
#### 3. Car Registration (تسجيل مركبة أردنية)
**Registration Front (`car_license_front`):**
- `car_plate` — رقم اللوحة (مثال: "123456")
- `owner` — اسم المالك
- `make` — الماركة
- `model` — الموديل
- `year` — سنة الصنع
- `color` — اللون
- `color_hex` — كود اللون
- `registration_date` — تاريخ التسجيل
**Registration Back (`car_license_back`):**
- `vin` — رقم الشاصي
- `fuel` — نوع الوقود
- `engine_capacity` — سعة المحرك (cc)
- `car_license_expiry` — تاريخ انتهاء ترخيص المركبة
- `passenger_capacity` — عدد الركاب (إن وجد)
#### 4. Criminal Record (عدم محكومية)
**Criminal Record (`criminal_record`):**
- `full_name_ar` — الاسم الكامل
- `national_number` — الرقم الوطني
- `record_type` — "عدم محكومية"
- `issue_date` — تاريخ الإصدار
- `result` — "خالي من السوابق/عدم محكومية"
- `is_valid` — true/false
#### 5. Profile Photo (`profile_picture`)
- Face matching against ID and License photos
---
### 🇪🇬 Egypt - Arab Republic of Egypt
#### 1. National ID (بطاقة شخصية مصرية)
**ID Front (`id_front`):**
- `full_name_ar` — الاسم الكامل (الاسم الرباعي)
- `national_number` — الرقم القومي (14 رقم)
- `dob` — تاريخ الميلاد
- `gender` — الجنس
- `governorate` — المحافظة
**ID Back (`id_back`):**
- `address` — العنوان الكامل
- `id_issue_date` — تاريخ الإصدار
- `id_expiry_date` — تاريخ الانتهاء
- `occupation` — المهنة
- `marital_status` — الحالة الاجتماعية
- `religion` — الدين
- `blood_type` — فصيلة الدم
- `spouse_name` — اسم الزوج/الزوجة
- `issue_authority` — جهة الإصدار (قسم شرطة)
#### 2. Driver License (رخصة قيادة مصرية)
**License Front (`driver_license`):**
- `full_name_ar` — الاسم الكامل
- `license_number` — رقم الترخيص
- `license_category` — فئة الرخصة (أولى/ثانية/ثالثة/دراجة)
- `license_issue_date` — تاريخ الإصدار
- `license_expiry_date` — تاريخ الانتهاء
- `issue_authority` — جهة الإصدار
**License Back (`driver_license_back`):**
- `restrictions` — القيود
- `renewals` — التجديدات
- `violations` — المخالفات
#### 3. Car Registration (تسجيل مركبة مصرية)
**Registration Front (`car_license_front`):**
- `car_plate` — رقم اللوحة (مثال: "س ج 1234")
- `owner` — اسم المالك
- `make` — الماركة
- `model` — الموديل
- `year` — سنة الصنع
- `color` — اللون
- `color_hex` — كود اللون
**Registration Back (`car_license_back`):**
- `vin` — رقم الشاسيه
- `fuel` — نوع الوقود
- `engine_capacity` — سعة المحرك
- `car_license_expiry` — تاريخ انتهاء الترخيص
#### 4. Criminal Record (فيش وتشبيه)
**Criminal Record (`criminal_record`):**
- `full_name_ar` — الاسم الكامل
- `national_number` — الرقم القومي
- `record_type` — "فيش وتشبيه"
- `issue_date` — تاريخ الإصدار
- `result` — "سوابق / لا سوابق / فيش جنائي"
- `case_numbers` — أرقام القضايا (إن وجدت)
- `is_valid` — true/false
#### 5. Profile Photo (`profile_picture`)
- Face matching against ID and License photos
---
## Required JSON Output Format
## Output Format
Return ONLY raw JSON:
```json
{
"status": "success|failure",
"reason": "If failure, state the reason",
"face_match_confidence": "high|medium|low",
"country": "Syria|Jordan|Egypt",
"driver": {
"full_name_ar": "",
"first_name": "",
"last_name": "",
"father_name": "",
"mother_name": "",
"national_number": "",
"dob": "YYYY-MM-DD",
"birth_place": "",
"address": "",
"governorate": "",
"site": "",
"gender": "Male|Female",
"civil_registry": "",
"blood_type": "",
"marital_status": "",
"spouse_name": "",
"religion": "",
"occupation": "",
"id_issue_date": "YYYY-MM-DD",
"id_expiry_date": "YYYY-MM-DD",
"license_number": "",
"license_category": "",
"license_issue_date": "YYYY-MM-DD",
"license_expiry_date": "YYYY-MM-DD",
"restrictions": "",
"phone": "",
"email": ""
"email": "",
"gender": "Male|Female",
"birthdate": "YYYY-MM-DD",
"national_number": "",
"site": "",
"address": "",
"maritalStatus": "",
"license_type": "",
"license_categories": "",
"issue_date": "YYYY-MM-DD",
"expiry_date": "YYYY-MM-DD",
"licenseIssueDate": "YYYY-MM-DD"
},
"car": {
"car_plate": "",
"owner": "",
"vin": "",
"color": "",
"color_hex": "",
"car_plate": "",
"make": "",
"model": "",
"year": "",
"color": "",
"color_hex": "",
"fuel": "",
"engine_capacity": "",
"passenger_capacity": "",
"car_issue_date": "YYYY-MM-DD",
"car_license_expiry": "YYYY-MM-DD",
"registration_date": ""
"vin": "",
"expiration_date": "YYYY-MM-DD"
},
"criminal_record": {
"full_name_ar": "",
"national_number": "",
"record_type": "",
"issue_date": "YYYY-MM-DD",
"full_name": "",
"result": "",
"case_numbers": "",
"is_valid": true
},
"face_matching": {
"profile_vs_id": "match|mismatch|unclear",
"profile_vs_license": "match|mismatch|unclear",
"notes": ""
"profile_vs_license": "match|mismatch|unclear"
}
}
```
## Rules
1. Convert Eastern-Arabic digits (٠١٢٣٤٥٦٧٨٩) to Western digits (0-9).
1. Convert Eastern-Arabic digits (٠١٢٣٤٥٦٧٨٩) to Western (0-9).
2. Dates in ISO format: `YYYY-MM-DD`.
3. If a field is unreadable/missing → set to `null`, do NOT fail.
3. If unreadable/missing → set to `null`, do NOT fail.
4. Fail only on: face mismatch, forged/fake documents, or missing primary identity.
5. `national_number` and `vin` must contain Latin digits/characters only.
5. `national_number` and `vin` must contain only Latin digits/characters.
6. Normalize color names: "أبيض" → "White", with hex code.
7. Return ONLY raw JSON → no markdown formatting.
8. For Syria: expect "لا حكم عليه" for criminal record.
9. For Jordan: expect "عدم محكومية" for criminal record.
10. For Egypt: expect "فيش وتشبيه" for criminal record.
8. Refer to the Field Extraction Matrix above: extract each field from the correct document side.