KW_DB & Maangement of KW
This commit is contained in:
89
backend/scripts/IMPORT_STATUS.md
Normal file
89
backend/scripts/IMPORT_STATUS.md
Normal file
@@ -0,0 +1,89 @@
|
||||
# Seed Keywords Import - Quick Reference
|
||||
|
||||
## ✅ Single File Import (COMPLETED)
|
||||
|
||||
Successfully imported **23 keywords** from `google_us_muscle-stimulator_matching-terms_2025-12-19_04-25-32.csv`
|
||||
|
||||
- Industry: **HealthCare Medical**
|
||||
- Sector: **Physiotherapy Rehabilitation**
|
||||
- Status: ✅ **COMPLETED**
|
||||
|
||||
## 📊 Full Import Preview (Dry-Run)
|
||||
|
||||
Total files discovered: **11 CSV files**
|
||||
Total keywords to import: **4,347 keywords**
|
||||
|
||||
### Files breakdown:
|
||||
1. `google_us_physical-therapy_matching-terms_2025-12-19_04-25-15.csv` - **2,500 keywords**
|
||||
2. `google_us_knee-brace_matching-terms_2025-12-19_04-25-58.csv` - **490 keywords**
|
||||
3. `google_us_knee-brace_matching-terms_2025-12-19_04-26-08.csv` - **490 keywords**
|
||||
4. `google_us_heating-pad_matching-terms_2025-12-19_04-25-43.csv` - **268 keywords**
|
||||
5. `google_us_tens-unit_matching-terms_2025-12-19_04-25-37.csv` - **249 keywords**
|
||||
6. `google_us_back-brace_matching-terms_2025-12-19_04-26-43.csv` - **199 keywords**
|
||||
7. `google_us_physiotherapy_related-terms_2025-12-19_04-25-01.csv` - **72 keywords**
|
||||
8. `google_us_posture-corrector_matching-terms_2025-12-19_04-25-50.csv` - **30 keywords**
|
||||
9. `google_us_muscle-stimulator_matching-terms_2025-12-19_04-25-32.csv` - **23 keywords** ✅ (already imported)
|
||||
10. `google_us_therapy-equipment_matching-terms_2025-12-19_04-25-26.csv` - **22 keywords**
|
||||
11. `google_us_rehab-equipment_matching-terms_2025-12-19_04-25-22.csv` - **4 keywords**
|
||||
|
||||
## 🚀 Next Steps
|
||||
|
||||
### Run Full Import
|
||||
|
||||
Since the test was successful, you can now run the full import:
|
||||
|
||||
```bash
|
||||
docker compose -f docker-compose.app.yml exec igny8_backend \
|
||||
python3 /app/scripts/import_all_seed_keywords.py \
|
||||
--base-path /data/app/igny8/KW_DB
|
||||
```
|
||||
|
||||
**Note:** This will skip the 23 keywords already imported from the muscle-stimulator file (duplicate check: keyword + country).
|
||||
|
||||
Expected results:
|
||||
- **4,347 rows processed**
|
||||
- **~4,324 keywords imported** (4,347 - 23 already imported)
|
||||
- **~23 duplicates skipped** (from muscle-stimulator file)
|
||||
- **0 errors** (if all goes well)
|
||||
|
||||
## 📍 Files Location
|
||||
|
||||
All import scripts are in: `/data/app/igny8/backend/scripts/`
|
||||
|
||||
- `import_seed_keywords_single.py` - Import single CSV file
|
||||
- `import_all_seed_keywords.py` - Import all CSV files from folder structure
|
||||
- `README.md` - Full documentation
|
||||
|
||||
## 🔍 Verification Commands
|
||||
|
||||
After full import, verify the data:
|
||||
|
||||
```bash
|
||||
# Check total keywords
|
||||
docker compose -f docker-compose.app.yml exec igny8_backend python3 manage.py shell -c "from igny8_core.auth.models import SeedKeyword; print(f'Total keywords: {SeedKeyword.objects.count()}')"
|
||||
|
||||
# Check by industry
|
||||
docker compose -f docker-compose.app.yml exec igny8_backend python3 manage.py shell -c "from igny8_core.auth.models import SeedKeyword; print(f'HealthCare Medical: {SeedKeyword.objects.filter(industry__slug=\"healthcare-medical\").count()}')"
|
||||
|
||||
# Check by sector
|
||||
docker compose -f docker-compose.app.yml exec igny8_backend python3 manage.py shell -c "from igny8_core.auth.models import SeedKeyword; print(f'Physiotherapy: {SeedKeyword.objects.filter(sector__slug=\"physiotherapy-rehabilitation\").count()}')"
|
||||
```
|
||||
|
||||
Or check in Django admin:
|
||||
- Keywords: `/admin/auth/seedkeyword/`
|
||||
- Industries: `/admin/auth/industry/`
|
||||
- Sectors: `/admin/auth/industrysector/`
|
||||
|
||||
## 🎯 Key Features
|
||||
|
||||
✅ **Automatic Industry/Sector Creation** - Creates from folder names
|
||||
✅ **Duplicate Detection** - keyword + country (case-insensitive)
|
||||
✅ **Transaction Safety** - All imports in transactions
|
||||
✅ **Dry-Run Mode** - Preview before import
|
||||
✅ **Detailed Statistics** - Import counts and errors
|
||||
✅ **Error Handling** - Skips invalid rows gracefully
|
||||
✅ **Verbose Logging** - Optional detailed progress
|
||||
|
||||
## 📚 Documentation
|
||||
|
||||
Full documentation: `/data/app/igny8/backend/scripts/README.md`
|
||||
Reference in New Issue
Block a user