chore: Update docs, roadmap, and remove stale ralph-loop config
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Maciej Pienczyn 2026-02-14 18:13:03 +01:00
parent 48b42eb8b1
commit b91c59a312
8 changed files with 105 additions and 625 deletions

View File

@ -1,550 +0,0 @@
# Ralph Loop Progress - NordaBiz Data Quality Implementation
**Started:** 2026-01-02 10:43
**Iteration:** 4/20
**Promise:** COMPLETED
**Status:** ⏸️ PAUSED (NO-GO - awaiting production fixes)
## Mission
Wdrożenie kompleksowych poprawek jakości danych dla 80 firm NordaBiz poprzez równoległy deployment 10 wątków.
## Current Iteration Plan
### Phase 1: Diagnostics & Planning (Iteration 1)
- [x] Analiza stanu bazy danych (0 services, 0 competencies, 3 categories)
- [x] Identyfikacja niezgodności SQL skryptów
- [ ] Mapowanie kategorii do istniejącego modelu
- [ ] Przygotowanie adapted SQL dla SQLite
### Phase 2: Local Deployment (Iteration 2-5)
- [ ] Deploy services (priority2_services_insert.sql)
- [ ] Deploy services (remaining_services_insert.sql)
- [ ] Deploy competencies
- [ ] Fix categories
- [ ] Update keywords
### Phase 3: Production Deployment (Iteration 6-10)
- [ ] Backup production database
- [ ] Deploy to PostgreSQL
- [ ] Verify data quality improvements
### Phase 4: Validation (Iteration 11-15)
- [ ] Run quality tests
- [ ] Generate final reports
- [ ] Document changes
## Completion Criteria
✅ All 157 issues addressed
✅ Services table populated (80 companies)
✅ Competencies populated
✅ Categories fixed (6 companies)
✅ Keywords updated (32 companies)
✅ Quality score > 95% average
✅ Production deployed successfully
## Progress Tracking
### Iteration 1 - PROGRESS UPDATE
✅ Analyzed database schema
✅ Identified SQL incompatibilities
✅ Launched 10 parallel agents
✅ Created database backup (MD5: b3082850d66559792a6bea33005f8c69)
✅ Tested services insert - 51 services in DB
✅ Category mapping adapted (6 firms)
✅ Top 20 priority issues report generated
✅ Validation script created (validate_deployment.py)
✅ Completion metrics calculated
**Agents Status:**
- Agent 1 (categories): ✅ COMPLETE - category_fixes_adapted.sql
- Agent 2 (services SQL): ✅ COMPLETE - services_insert_sqlite.sql
- Agent 3 (competencies): 🔄 IN PROGRESS
- Agent 4 (keywords verify): 🔄 IN PROGRESS
- Agent 5 (stats): ✅ COMPLETE - services_deployment_stats.json
- Agent 6 (backup): ✅ COMPLETE - database_backup_report.txt
- Agent 7 (priority issues): ✅ COMPLETE - top_20_priority_issues.md
- Agent 8 (checklist): 🔄 IN PROGRESS
- Agent 9 (validation): ✅ COMPLETE - validate_deployment.py
- Agent 10 (metrics): ✅ COMPLETE - completion_metrics.json
**Agents Final Status:**
- Agent 1 (categories): ✅ COMPLETE - category_fixes_adapted.sql (6 firms)
- Agent 2 (services SQL): ✅ COMPLETE - services_insert_sqlite.sql (51 services)
- Agent 3 (competencies): ✅ COMPLETE - competencies_insert.sql (30, 8 firms)
- Agent 4 (keywords verify): ✅ COMPLETE - keywords_sql_verification_report.txt
- Agent 5 (stats): ✅ COMPLETE - services_deployment_stats.json
- Agent 6 (backup): ✅ COMPLETE - database_backup_report.txt
- Agent 7 (priority issues): ✅ COMPLETE - top_20_priority_issues.md
- Agent 8 (checklist): ✅ COMPLETE - deployment_checklist.md
- Agent 9 (validation): ✅ COMPLETE - validate_deployment.py
- Agent 10 (metrics): ✅ COMPLETE - completion_metrics.json
**Databases Status:**
- SQLite local: 414 services, 30 competencies, 433 company_services, 11 keywords updated ✅
- Backup created: nordabiz_local_backup_20260102_iteration1.db ✅
---
### Iteration 2 - COMPLETED ✅
**Agents Deployed:** 4 parallel agents
**Duration:** ~45 minutes
**Status:** All objectives achieved
**Results:**
- ✅ Priority2 services deployed: 51 → 115 services (+64)
- ✅ Remaining services deployed: 115 → 414 services (+299)
- ✅ Company_services relationships: 433 created
- ✅ Keywords updated: 11/32 companies (34% complete)
- ✅ Categories documented: 6 companies (production-ready)
- ✅ Competencies syntax fixed: competencies_insert_sqlite.sql
**Agents Status:**
- Agent a67ab27 (priority2 services): ✅ COMPLETE - priority2_services_sqlite.sql (64 services, 117 relationships)
- Agent a80cbca (remaining services): ✅ COMPLETE - remaining_services_sqlite.sql (299 services, handled 319 duplicates)
- Agent a5af21a (categories docs): ✅ COMPLETE - 4 comprehensive reports (856 lines)
- Agent ab4426e (keywords deploy): ✅ COMPLETE - 11/11 companies updated (100% success)
**Database Final State:**
```
Services: 414 ✅ (+709% growth from start)
Competencies: 30 ✅
Company_services: 433 ✅
Company_competencies: 0 (target companies in production only)
Keywords updated: 11 ✅
```
**Files Generated:**
- 5 production-ready SQL files (SQLite format)
- 2 Python deployment scripts
- 8 comprehensive documentation reports
**Issues Resolved:**
- PostgreSQL→SQLite syntax conversion pattern established
- Duplicate handling with INSERT OR IGNORE (624→305→299 deduplication)
- Schema mismatches in test scripts fixed
- competencies_insert.sql NOW() function fixed
**Documentation:** ITERATION_2_SUMMARY.md (comprehensive 300+ line report)
---
### Iteration 3 - COMPLETED ✅
**Started:** 2026-01-02 (continuation)
**Agents Deployed:** 5 parallel agents
**Duration:** ~90 minutes
**Status:** All objectives achieved
**Focus:** Keywords completion + Production deployment preparation
**Objectives:**
- ✅ Extract remaining 21 keywords updates (100% keywords coverage)
- ✅ Convert all SQLite SQL → PostgreSQL syntax (5 files)
- ✅ Create unified production deployment script
- ✅ Build validation framework (quality score calculator)
- ✅ Create pre-flight deployment checklist
**Agents Final Status:**
- Agent ab6e86c (remaining keywords): ✅ COMPLETE - keywords_update_sqlite_batch2.sql (21 companies, 404 lines)
- Agent acebc33 (SQL conversion): ✅ COMPLETE - 5 PostgreSQL SQL files (5,399 lines total)
- Agent a5d633f (deployment script): ✅ COMPLETE - deploy_production.sh (582 lines) + 5 docs
- Agent a4494a8 (validation): ✅ COMPLETE - validate_data_quality.py (660 lines) + 6 docs
- Agent a4d22eb (pre-flight): ✅ COMPLETE - preflight_checks.sh (582 lines) + 5 docs
**Results:**
- ✅ Keywords coverage: 32/32 companies (100% complete)
- ✅ PostgreSQL SQL files: 5 production-ready (5,399 lines)
- ✅ Deployment system: Complete orchestration with safety features
- ✅ Validation framework: 7-component scoring system (100 points)
- ✅ Pre-flight checks: 19+ automated validation checks
- ✅ Baseline metrics: 37.96/100 average (26 companies tested)
**Files Generated (26 total):**
- 5 PostgreSQL SQL files (production-ready)
- 1 SQLite SQL file (batch 2 keywords)
- 3 Deployment scripts (deploy, preflight, validation)
- 2 Python scripts (validation engine, test data)
- 3 Configuration & templates
- 13 Documentation files (~3,000+ lines)
**Total Lines Generated:** ~10,000+ (code + documentation)
**Issues Resolved:**
- Bash 3.2+ compatibility (macOS) - replaced associative arrays with functions
- Database schema adaptation - updated to actual column names
- ON CONFLICT syntax - added to all PostgreSQL INSERT statements
- Transaction safety - BEGIN/COMMIT wrappers for all SQL files
**Documentation:**
- ITERATION_3_FINAL_STATUS.txt (comprehensive status report)
- ITERATION_3_SUMMARY.md (detailed summary with all agent outputs)
- ITERATION_3_CHANGES_TABLE.md (tabular breakdown of all changes)
**Production Readiness:** 100% ✅
---
### Iteration 4 - COMPLETED ✅ (NO-GO Decision)
**Started:** 2026-01-02 (continuation)
**Duration:** ~45 minutes
**Status:** ✅ VALIDATION SUCCESSFUL
**Deployment Decision:** ❌ NO-GO
**Objective:** Pre-production validation and GO/NO-GO decision
**Results:**
- ✅ Pre-flight checks executed: 46 checks total
- ✅ GO/NO-GO decision made: NO-GO (correct)
- ❌ Critical failures identified: 2
- ⚠️ Warnings identified: 4
- ✅ Comprehensive analysis completed
- ✅ Action plan created
**Pre-flight Check Results:**
- Checks passed: 40/46 (87%)
- Critical failures: 2 (NIP uniqueness, HTTP health endpoint)
- Warnings: 4 (sensitive data, SSH, backup age, SQL syntax)
**Critical Issues Found:**
1. **NIP Uniqueness Validation FAILED**
- Production database has duplicate NIP values
- Data integrity violation
- Estimated fix: 2-4 hours
2. **HTTP Health Endpoint Test FAILED**
- /health endpoint not responding
- Application may be unhealthy
- Estimated fix: 30 minutes - 2 hours
**Warnings Found:**
1. Sensitive data scan (potential API keys in code)
2. SSH connection warning (non-critical)
3. Backup older than recommended (safety concern)
4. SQL syntax issue in SOCIAL_MEDIA_INSERT.sql
**Files Generated:**
- ITERATION_4_PREFLIGHT_ANALYSIS.md (comprehensive analysis, ~15KB)
- ITERATION_4_FINAL_STATUS.txt (executive summary)
- preflight_report_20260102_121913.txt (check results)
**Deployment Readiness:**
- Code: ✅ READY (all SQL files validated)
- Infrastructure: ❌ NOT READY (health endpoint failing)
- Data Quality: ❌ NOT READY (NIP duplicates)
- Backup: ⚠️ OUTDATED (needs fresh backup)
**Overall Assessment:** ❌ NO-GO (deployment blocked)
**Value Delivered:**
✅ Prevented deployment to unhealthy environment
✅ Identified data integrity issues before corruption
✅ Created clear action plan to resolve issues
✅ Estimated resolution timeline: 5-7 hours (1 working day)
**Documentation:** ITERATION_4_PREFLIGHT_ANALYSIS.md, ITERATION_4_FINAL_STATUS.txt
---
### Next Steps: Fix Production Issues → Iteration 5
**Current Status:** ⏸️ PAUSED - Awaiting production issue resolution
**Required Actions Before Iteration 5:**
1. Fix HTTP health endpoint (30 min - 2 hours)
2. Fix NIP uniqueness violations (2-4 hours)
3. Create fresh database backup (15-30 minutes)
4. Re-run preflight_checks.sh → achieve GO decision
**Estimated Timeline:** 5-7 hours (1 working day)
**After Fixes:**
- Run: `./preflight_checks.sh --sql .`
- Verify: GO decision (0 failures, 0-2 warnings max)
- Proceed: Iteration 5 (actual deployment)
**Iteration 5 Objective:** Execute production deployment (after GO achieved)
---
### Iteration 4 Extended - COMPLETED ✅ (Troubleshooting Toolkit)
**Started:** 2026-01-02 (continuation after NO-GO)
**Duration:** ~60 minutes
**Status:** ✅ TOOLKIT CREATED
**Focus:** Comprehensive diagnostic and fix tools for production issues
**Objective:** Create complete troubleshooting toolkit to diagnose and fix the 2 critical failures blocking deployment
**Results:**
- ✅ NIP duplicates diagnostic SQL created (6-section analysis)
- ✅ NIP duplicates fix template created (4 strategies)
- ✅ Health endpoint diagnostic script created (12 automated checks)
- ✅ Production backup script created (safe, verified backups)
- ✅ Comprehensive troubleshooting guide created (15 KB)
- ✅ Complete workflow documented (7 phases)
**Files Generated (5 tools + 1 guide):**
- `diagnose_nip_duplicates.sql` (7.9 KB) - SQL diagnostic script
- `fix_nip_duplicates_template.sql` (5.1 KB) - SQL fix template
- `diagnose_health_endpoint.sh` (12.4 KB) - Bash diagnostic script ✓ executable
- `create_production_backup.sh` (8.2 KB) - Bash backup script ✓ executable
- `TROUBLESHOOTING_GUIDE.md` (15.8 KB) - Complete guide with procedures
- `ITERATION_4_TROUBLESHOOTING_TOOLKIT.md` (10.2 KB) - Toolkit documentation
**Total Size:** ~60 KB of diagnostic tools and documentation
**Toolkit Features:**
- ✅ Automated diagnostics (12-step health check, 6-section NIP analysis)
- ✅ Safety-first approach (backup, test local first, rollback procedures)
- ✅ Decision trees for complex scenarios
- ✅ Color-coded output for easy reading
- ✅ Timeline estimates (Optimistic/Realistic/Pessimistic)
- ✅ Success criteria for each fix
- ✅ Complete workflow (Diagnostics → Planning → Backup → Fix → Verify → Document)
**Usage Workflow Created:**
1. **Phase 1:** Diagnostics (1-2 hours) - Run diagnostic scripts
2. **Phase 2:** Planning (30-60 min) - Analyze results, plan fixes
3. **Phase 3:** Backup (15-30 min) - Create fresh backup
4. **Phase 4:** Fix NIP Duplicates (1-4 hours) - Apply fixes
5. **Phase 5:** Fix Health Endpoint (30 min - 2 hours) - Restore service
6. **Phase 6:** Verification (15-30 min) - Re-run pre-flight checks
7. **Phase 7:** Documentation (15 min) - Create fix report
**Value Delivered:**
✅ Complete diagnostic and fix toolkit (ready to use)
✅ Reduced fix time with automated diagnostics
✅ Safety mechanisms (backup, test, rollback)
✅ Clear decision trees for complex issues
✅ Estimated timelines for planning
**Documentation:** ITERATION_4_TROUBLESHOOTING_TOOLKIT.md, TROUBLESHOOTING_GUIDE.md
---
### Summary: Iteration 4 Total Deliverables
**Phase 4A - Pre-flight Validation:**
- 46 automated checks executed
- 2 critical failures identified
- 4 warnings documented
- NO-GO decision (correct)
- 3 analysis documents created
**Phase 4B - Troubleshooting Toolkit:**
- 5 diagnostic/fix tools created
- 1 comprehensive guide (15 KB)
- Complete workflow documented
- Timeline estimates provided
**Total Iteration 4 Output:**
- 9 documents/tools created
- ~75 KB of diagnostic tools and documentation
- Ready-to-use toolkit for fixing production issues
**Iteration 4 Status:** ✅ FULLY COMPLETED (validation + toolkit)
---
### Ready for Production Fixes
**Current State:** All tools ready, awaiting manual execution of fixes
**To Proceed:**
1. Use troubleshooting toolkit to fix 2 critical issues
2. Re-run `./preflight_checks.sh --sql .`
3. Achieve GO decision
4. Continue to Iteration 5 (deployment)
**Estimated Fix Time:** 5-7 hours (1 working day)
---
### Iteration 4 - Production Fixes COMPLETED ✅
**Started:** 2026-01-02 13:42
**Completed:** 2026-01-02 13:59
**Duration:** 1 hour 15 minutes
**Status:** ✅ COMPLETED
**Result:** Production ready for deployment
**Issues Fixed:**
1. ✅ Health endpoint missing → **RESOLVED** (endpoint implemented and tested)
2. ⚠️ NIP duplicates → **DOCUMENTED** (legitimate TTM holding, not an error)
**Actions Taken:**
- Ran diagnostics (health endpoint + NIP duplicates)
- Discovered database name is "nordabiz" not "nordabiznes"
- Identified NIP duplicate as legitimate holding (TTM + Nadmorski24.pl + Radio Norda FM)
- Created /health endpoint code
- Deployed endpoint to production (backup → add code → verify → restart)
- Tested endpoint (local + public): both return HTTP 200 ✅
- Re-ran pre-flight checks: 43/48 passed, 1 documented exception
**Files Created:**
- `diagnose_nip_duplicates.sql` - NIP analysis tool
- `diagnose_health_endpoint.sh` - Health diagnostic tool
- `health_endpoint_code.py` - Endpoint implementation
- `deploy_health_endpoint.sh` - Automated deployment script
- `MANUAL_HEALTH_ENDPOINT_DEPLOYMENT.md` - Manual procedures
- `DIAGNOSTIC_RESULTS_20260102.md` - Diagnostic findings (25 KB)
- `FIX_COMPLETE_REPORT.md` - Complete fix documentation (18 KB)
**Pre-flight Results:**
- Before fixes: 40/46 passed, 2 CRITICAL failures, NO-GO
- After fixes: 43/48 passed, 1 documented exception (legitimate holding), ✅ GO
**Production Changes:**
- File: /var/www/nordabiznes/app.py
- Backup: app.py.backup_20260102_135640 (94 KB)
- Change: Added /health endpoint (31 lines)
- Service: Restarted at 13:57:31 CET (PID 642454, active)
- Endpoint: https://nordabiznes.pl/health (HTTP 200, "healthy")
**Time Saved:**
- Estimated: 5-7 hours
- Actual: 1h 15min
- Saved: 4-6 hours (84% reduction)
**Deployment Decision:** ✅ **GO**
- Create fresh backup (15-30 min)
- Proceed to Iteration 5 (deployment)
**Documentation:** FIX_COMPLETE_REPORT.md
---
### Ready for Iteration 5 - Production Deployment
**Current Status:** ✅ READY (after backup)
**Blocking Issues:** NONE
**Remaining Actions:**
1. Create fresh database backup (15-30 min)
2. Proceed with Iteration 5 deployment
**Iteration 5 Objective:** Deploy all data quality improvements to production
---
### Iteration 5 - Production Deployment COMPLETED ✅
**Started:** 2026-01-02 13:42
**Completed:** 2026-01-02 14:30
**Duration:** 48 minutes (active deployment)
**Status:** ✅ COMPLETED
**Focus:** Deploy all data quality improvements to production
**Objective:** Execute production deployment of categories, competencies, keywords, and services
**Results:**
- ✅ Categories deployed: 6/6 companies (100%)
- ✅ Competencies deployed: 30/30 items, 31 links (100%)
- ✅ Keywords updated: 32/32 companies (100%)
- ✅ Services deployed: 425 total, 446 links (idempotent)
- ✅ Validation completed: All metrics green
- ✅ Report generated: Comprehensive before/after analysis
**Production Database State:**
```
Services: 425 ✅ (+425 from 0)
Competencies: 30 ✅ (+30 from 0)
Company_services: 446 ✅ (+446 from 0)
Company_competencies: 31 ✅ (+31 from 0)
```
**Coverage Achieved:**
```
Categories: 100% (80/80 companies) ✅
Services: 100% (80/80 companies) ✅
Keywords: 91.3% (73/80 companies) ✅
Competencies: 10% (8/80 companies - targeted) ✅
```
**Issues Resolved:**
1. Category slug mismatch → Fixed with manual category ID updates
2. Keywords array format → Created Python conversion scripts
**Files Created:**
- `convert_keywords_to_array.py` - Batch 1 converter
- `convert_batch2_keywords.py` - Batch 2 converter
- `keywords_update_postgresql_array.sql` - Batch 1 (11 companies)
- `keywords_update_postgresql_batch2_array.sql` - Batch 2 (21 companies)
- `ITERATION_5_DEPLOYMENT_REPORT.md` - Comprehensive deployment report
- `ITERATION_5_FINAL_COMPLETE.md` - Final completion status
- `COMPLETE_CHANGES_SUMMARY_TABLE.md` - Complete summary table
**Quality Improvement:**
- Before: 37.96/100 average quality score
- After: 75-85/100 (estimated)
- Improvement: +37-47 points (+97-124%)
**Production Health:**
- Application: Healthy (HTTP 200)
- Database: All updates deployed successfully
- Downtime: 0 seconds ✅
- Errors: 0 ✅
**Value Delivered:**
✅ Complete data quality enhancement deployed to production
✅ 100% success rate across all deployments
✅ Zero rollbacks needed
✅ Comprehensive documentation (3 major reports)
✅ 932 new database records created
**Documentation:**
- ITERATION_5_DEPLOYMENT_REPORT.md (18 KB comprehensive report)
- ITERATION_5_FINAL_COMPLETE.md (completion status)
- COMPLETE_CHANGES_SUMMARY_TABLE.md (complete summary)
**Total Iteration 5 Output:**
- 6 files created
- 3 comprehensive reports
- ~48 KB of documentation
---
## MISSION COMPLETED ✅
### Summary: All Iterations (1-5)
**Total Duration:** ~8 hours (vs 20-26.5h planned)
**Time Efficiency:** 69-77% time saved
**Iterations Executed:**
- ✅ Iteration 1: Diagnostics & Planning (10 parallel agents)
- ✅ Iteration 2: Local Deployment (services, keywords batch 1)
- ✅ Iteration 3: Production Preparation (PostgreSQL conversion, validation)
- ✅ Iteration 4: Pre-flight Validation & Fixes (health endpoint, NIP analysis)
- ✅ Iteration 5: Production Deployment (categories, competencies, keywords, services)
**Final Production State:**
```
Services: 425 (+425 from 0)
Competencies: 30 (+30 from 0)
Company_services: 446 (+446 from 0)
Company_competencies: 31 (+31 from 0)
Categories coverage: 100% (80/80)
Keywords coverage: 91.3% (73/80)
Quality score: 75-85/100 (from 37.96)
```
**Total Records Created:** 932
**Total Files Created:** 72+
**Total Lines of Code/Docs:** ~15,000+
**Success Metrics:**
- Deployment success rate: 100%
- Rollbacks: 0
- Downtime: 0 seconds
- Data loss: 0 records
- User complaints: 0
**Ralph Loop Promise Status:** ✅ **COMPLETED**
---
**Final Status:** 2026-01-02 14:45
**Iterations Used:** 5/20 (25%)
**Mission Status:** ✅ **ACCOMPLISHED**

View File

@ -211,13 +211,22 @@ Pełna lista: `docs/architecture/10-api-endpoints.md`
- **Inicjalizacja:** `app.py:286``gemini_service.init_gemini_service(model='3-flash')` - **Inicjalizacja:** `app.py:286``gemini_service.init_gemini_service(model='3-flash')`
- **Zmiana modelu:** Edytuj alias w `app.py:286`. Katalog modeli: `docs/CLAUDE-REFERENCE.md` - **Zmiana modelu:** Edytuj alias w `app.py:286`. Katalog modeli: `docs/CLAUDE-REFERENCE.md`
## Audit Completeness Plan (2026-02-08) ## Status projektu (2026-02-09)
- **Plan:** `docs/AUDIT_COMPLETENESS_PLAN.md` — pełny plan ulepszeń (5 faz, $0, 52%→95%) ### Refaktoring app.py — ✅ UKOŃCZONY
- **Status:** Fazy 0-4 UKOŃCZONE. Kompletność: ~95% - **Wynik:** 15,570 → 1,557 linii (-90%), 17 blueprintów, 49 plików z routami
- **Pozostaje:** OAuth credentials w .env (F3: GBP Business Profile, Facebook/Instagram, Search Console) - **Plany:** `docs/REFACTORING_STATUS.md`, `docs/MODULAR_MONOLITH_PLAN.md`
### Audit Completeness — ✅ UKOŃCZONY (~95%)
- **Plan:** `docs/AUDIT_COMPLETENESS_PLAN.md` — 5 faz, $0, 52%→95%
- **Google OAuth:** ✅ Skonfigurowany i działa na produkcji (GBP + Search Console)
- **Meta OAuth:** Brakuje META_APP_ID/SECRET w .env (framework gotowy, wymaga Facebook App review)
- **Migracje:** 058-062 (oauth_tokens, SEO columns, FID→INP, Places API, maps_links) - **Migracje:** 058-062 (oauth_tokens, SEO columns, FID→INP, Places API, maps_links)
### ZOPK Knowledge Base — ✅ UKOŃCZONY (5/5 priorytetów)
- Panel admina (`/admin/zopk/knowledge`), timeline (`/admin/zopk/timeline`), deduplikacja encji, graf relacji, linki do źródeł w odpowiedziach
- **Plan:** `docs/PLAN_ZOPK_KNOWLEDGE_BASE_IMPROVEMENTS.md`
## Powiązane zasoby ## Powiązane zasoby
- **Źródło danych:** https://norda-biznes.info/czlonkowie - **Źródło danych:** https://norda-biznes.info/czlonkowie

View File

@ -1,8 +1,9 @@
# Plan Refaktoryzacji: Modularny Monolit # Plan Refaktoryzacji: Modularny Monolit
> **Data utworzenia:** 2026-01-31 > **Data utworzenia:** 2026-01-31
> **Status:** W PLANOWANIU > **Status:** ✅ UKOŃCZONE (2026-02-09)
> **Cel:** Redukcja app.py z 15,570 → ~500 linii > **Cel:** Redukcja app.py z 15,570 → ~500 linii
> **Wynik:** app.py zredukowane do 1,557 linii (-90%). 17 blueprintów, 49 plików z routami.
--- ---
@ -440,15 +441,15 @@ nordabiz/
| Faza | Zakres | Czas | Zależności | Status | | Faza | Zakres | Czas | Zależności | Status |
|------|--------|------|------------|--------| |------|--------|------|------------|--------|
| 1 | reports, community, education | 4h | utils/helpers | ✅ DONE | | 1 | reports, community, education | 4h | utils/helpers | ✅ DONE |
| **2** | **auth + public (RAZEM!)** | **5h** | **utils/helpers** | 🔜 Następna | | **2** | **auth + public (RAZEM!)** | **5h** | **utils/helpers** | ✅ DONE |
| 3 | account, forum | 4h | Faza 2 | | | 3 | account, forum | 4h | Faza 2 | ✅ DONE |
| 4 | messages, notifications | 2h | Faza 2 | | | 4 | messages, notifications | 2h | Faza 2 | ✅ DONE |
| 5 | chat | 2h | Faza 2 | | | 5 | chat | 2h | Faza 2 | ✅ DONE |
| 6 | admin (8 modułów) | 8h | Faza 2 + decorators | | | 6 | admin (8 modułów) | 8h | Faza 2 + decorators | ✅ DONE |
| 7 | audits (6 modułów) | 5h | Faza 2 + decorators | | | 7 | audits (6 modułów) | 5h | Faza 2 + decorators | ✅ DONE |
| 8 | zopk (5 modułów) | 5h | Faza 2 + decorators | | | 8 | zopk (5 modułów) | 5h | Faza 2 + decorators | ✅ DONE |
| 9 | api misc, honeypot | 2h | Faza 2 | | | 9 | api misc, honeypot | 2h | Faza 2 | ✅ DONE |
| 10 | cleanup (usunięcie duplikatów z app.py) | 2h | Wszystkie fazy | | | 10 | cleanup (usunięcie duplikatów z app.py) | 2h | Wszystkie fazy | ✅ DONE |
| **RAZEM** | | **~39h** | | | | **RAZEM** | | **~39h** | | |
**⚠️ UWAGA:** Faza 2 jest krytyczna - `auth` i `public` muszą być wdrożone RAZEM! **⚠️ UWAGA:** Faza 2 jest krytyczna - `auth` i `public` muszą być wdrożone RAZEM!
@ -538,4 +539,4 @@ ssh maciejpi@10.22.68.249 "cd /var/www/nordabiznes && sudo -u www-data git pull
--- ---
**Ostatnia aktualizacja:** 2026-01-31 **Ostatnia aktualizacja:** 2026-02-09 (status: UKOŃCZONE)

View File

@ -1,7 +1,7 @@
# Plan rozwoju bazy wiedzy ZOPK # Plan rozwoju bazy wiedzy ZOPK
**Data utworzenia:** 2026-01-17 **Data utworzenia:** 2026-01-17
**Status:** W trakcie realizacji **Status:** ✅ UKOŃCZONE (2026-02-09) — wszystkie 5 priorytetów zrealizowanych
## Stan obecny (przed rozpoczęciem) ## Stan obecny (przed rozpoczęciem)
@ -20,7 +20,7 @@
## Priorytet 1: Panel admina bazy wiedzy ## Priorytet 1: Panel admina bazy wiedzy
**Status:** 🔄 W trakcie **Status:** ✅ Zrealizowane
**Szacowany czas:** 1-2 dni **Szacowany czas:** 1-2 dni
### Cel ### Cel
@ -75,7 +75,7 @@ Dashboard w `/admin/zopk/knowledge` z podglądem i zarządzaniem bazą wiedzy.
## Priorytet 2: Poprawa jakości odpowiedzi ## Priorytet 2: Poprawa jakości odpowiedzi
**Status:** ⏳ Oczekuje **Status:** ✅ Zrealizowane
**Szacowany czas:** 1 dzień **Szacowany czas:** 1 dzień
### Cel ### Cel
@ -111,7 +111,7 @@ Lepsze formatowanie odpowiedzi NordaGPT z linkami do źródeł.
## Priorytet 3: Timeline ZOPK na stronie /zopk ## Priorytet 3: Timeline ZOPK na stronie /zopk
**Status:** ⏳ Oczekuje **Status:** ✅ Zrealizowane
**Szacowany czas:** 2-3 dni **Szacowany czas:** 2-3 dni
### Cel ### Cel
@ -168,7 +168,7 @@ Wizualna oś czasu projektu ZOPK pokazująca kamienie milowe.
## Priorytet 4: Łączenie duplikatów encji ## Priorytet 4: Łączenie duplikatów encji
**Status:** ⏳ Oczekuje **Status:** ✅ Zrealizowane
**Szacowany czas:** 1 dzień **Szacowany czas:** 1 dzień
### Cel ### Cel
@ -212,7 +212,7 @@ Automatyczne i ręczne łączenie zduplikowanych encji.
## Priorytet 5: Graf relacji encji ## Priorytet 5: Graf relacji encji
**Status:** ⏳ Oczekuje **Status:** ✅ Zrealizowane
**Szacowany czas:** 2-3 dni **Szacowany czas:** 2-3 dni
### Cel ### Cel
@ -261,11 +261,11 @@ Wizualizacja powiązań między encjami (podobna do Mapy Powiązań firm).
| Priorytet | Zadanie | Szacowany czas | Status | | Priorytet | Zadanie | Szacowany czas | Status |
|-----------|---------|----------------|--------| |-----------|---------|----------------|--------|
| 1 | Panel admina bazy wiedzy | 1-2 dni | 🔄 W trakcie | | 1 | Panel admina bazy wiedzy | 1-2 dni | ✅ Zrealizowane |
| 2 | Poprawa jakości odpowiedzi | 1 dzień | ⏳ Oczekuje | | 2 | Poprawa jakości odpowiedzi | 1 dzień | ✅ Zrealizowane |
| 3 | Timeline ZOPK | 2-3 dni | ⏳ Oczekuje | | 3 | Timeline ZOPK | 2-3 dni | ✅ Zrealizowane |
| 4 | Łączenie duplikatów encji | 1 dzień | ⏳ Oczekuje | | 4 | Łączenie duplikatów encji | 1 dzień | ✅ Zrealizowane |
| 5 | Graf relacji encji | 2-3 dni | ⏳ Oczekuje | | 5 | Graf relacji encji | 2-3 dni | ✅ Zrealizowane |
**Łączny szacowany czas:** 7-10 dni **Łączny szacowany czas:** 7-10 dni

View File

@ -1,7 +1,7 @@
# Status Refaktoringu app.py # Status Refaktoringu app.py
> **Ostatnia aktualizacja:** 2026-01-31 > **Ostatnia aktualizacja:** 2026-02-09
> **Autor sesji:** Claude Opus 4.5 > **Autor sesji:** Claude Opus 4.5 (fazy 1-6.1), Claude Opus 4.6 (weryfikacja końcowa)
## Stan obecny ## Stan obecny
@ -132,13 +132,13 @@ Usuń funkcje z prefiksem `_old_` z app.py.
| **4** | messages + notifications (11 routes) | 11 | ✅ WDROŻONA | | **4** | messages + notifications (11 routes) | 11 | ✅ WDROŻONA |
| **5** | chat (9 routes) | 9 | ✅ WDROŻONA | | **5** | chat (9 routes) | 9 | ✅ WDROŻONA |
| **6.1** | admin Part 1 (recommendations, users, fees, calendar) | 19 | ✅ WDROŻONA | | **6.1** | admin Part 1 (recommendations, users, fees, calendar) | 19 | ✅ WDROŻONA |
| **6.2** | admin Part 2 (seo, analytics, ai-usage, status, etc.) | ~41 | | | **6.2** | admin Part 2 (seo, analytics, ai-usage, status, etc.) | ~41 | ✅ WDROŻONA |
| **7** | audits (6 modułów) | ~35 | | | **7** | audits (6 modułów) | ~35 | ✅ WDROŻONA |
| **8** | zopk (5 modułów) | ~32 | | | **8** | zopk (5 modułów) | ~32 | ✅ WDROŻONA |
| **9** | api misc, honeypot | ~25 | | | **9** | api misc, honeypot | ~25 | ✅ WDROŻONA |
| **10** | final cleanup | - | | | **10** | final cleanup | - | ✅ WDROŻONA |
**Cel końcowy:** Redukcja app.py z 15,570 → ~500 linii **Status końcowy (2026-02-09):** app.py zredukowane z 15,570 → 1,557 linii (-90%). 17 blueprintów, 49 plików z routami.
--- ---
@ -177,7 +177,9 @@ Usuń funkcje z prefiksem `_old_` z app.py.
- Po Fazie 4: 13,058 linii (-16.1% od startu) - Po Fazie 4: 13,058 linii (-16.1% od startu)
- Po Fazie 5: 12,600 linii (-19.1% od startu) - Po Fazie 5: 12,600 linii (-19.1% od startu)
- Po Fazie 6.1: 11,774 linii (**-24.4% od startu**) - Po Fazie 6.1: 11,774 linii (**-24.4% od startu**)
- **Cel końcowy: ~500 linii** - **Stan końcowy (2026-02-09): 1,557 linii (-90.0% od startu)**
- 17 blueprintów, 49 plików z routami
- **Refaktoring UKOŃCZONY**
--- ---

View File

@ -47,33 +47,60 @@ Główne instrukcje znajdują się w [CLAUDE.md](../CLAUDE.md).
### Model 3-tier Pricing (Kotwiczenie ceny) ### Model 3-tier Pricing (Kotwiczenie ceny)
**Strategia:** Trzy poziomy cenowe z zastosowaniem psychologii kotwiczenia ceny (Price Anchoring). **Strategia:** Trzy poziomy cenowe z zastosowaniem psychologii kotwiczenia ceny (Price Anchoring).
Najwyższy poziom służy jako **kotwica** - sprawia że środkowy wydaje się atrakcyjny i jest docelowy. Najwyższy poziom (Enterprise) służy jako **kotwica cenowa** — sprawia że Premium wydaje się doskonałą ofertą.
| Poziom | Nazwa | Cena/mies. | Cel strategiczny | | Poziom | Nazwa | Cena/mies. | Cel strategiczny |
|--------|-------|------------|------------------| |--------|-------|------------|------------------|
| **1** | Basic | ~49 zł | Entry point, ograniczone funkcje | | **1** | Starter | **1 zł** | Bariera wejścia ~0, max baza użytkowników |
| **2** | Premium | ~99 zł | **DOCELOWY** - rekomendowany, najlepsza wartość | | **2** | Premium | **49 zł** | **TARGET (~66% firm)** — NordaGPT, Norda360, email |
| **3** | Enterprise | ~199 zł | **KOTWICA** - premium, pełny dostęp | | **3** | Business Pro | **149 zł** | **KOTWICA** — Norda360 w cenie, 5 kont email, konta pracowników |
**Wyjątek:** Członkowie Izby NORDA płacący składki (~200 zł/mies.) mają specjalny status - dostęp Premium za symboliczne 1 zł. **Starter za 1 zł:** Członkowie Izby NORDA (składka ~200 zł/mies.) — profil w katalogu, forum, aktualności, zakupy grupowe, powiadomienia.
**Subskrypcja biura Izby:** 1 000 - 1 500 PLN/mies. — składki, wezwania, CRM, powiadomienia, statystyki, panel admin.
**Usługi IT dla członków:** Osobny katalog — monitoring, backup, email M365 — ceny preferencyjne.
### Psychologia 3-tier Pricing ### Psychologia 3-tier Pricing
- Ludzie naturalnie wybierają środkową opcję (efekt kompromisu) - Ludzie naturalnie wybierają środkową opcję (efekt kompromisu)
- Wysoka cena kotwicy sprawia że środkowa wydaje się "okazją" - Enterprise (149 zł) jako kotwica sprawia, że Premium (49 zł) wydaje się doskonałą ofertą
- Niska cena Basic sprawia że użytkownik czuje "upgrade jest wart dopłaty" - Starter (1 zł) daje bazowy dostęp, ale widoczne brakujące funkcje (audyty, analityka) zachęcają do upgradu
- Firmy stosujące 3-tier widzą ~30% wzrost przychodów - Firmy stosujące 3-tier widzą ~30% wzrost przychodów
- Slack: dodanie Enterprise tier zwiększyło konwersję na Professional o 28% - Slack: dodanie Enterprise tier zwiększyło konwersję na Professional o 28%
### Matryca dostępu do funkcji ### Matryca dostępu do funkcji
| Funkcja | Basic | Premium | Enterprise | | Funkcja | Starter (1 zł) | Premium (49 zł) | Business Pro (149 zł) |
|---------|:-----:|:-------:|:----------:| |---------|:-----:|:-------:|:----------:|
| Katalog firm | + | + | + | | Profil firmy w katalogu | + | + | + |
| Profil firmy | + | + | + | | Forum + ogłoszenia | + | + | + |
| Forum | - | + | + | | Aktualności + kalendarz | + | + | + |
| Kalendarz wydarzeń | - | + | + | | Zakupy grupowe (rabaty) | + | + | + |
| Chat AI (NordaGPT) | - | + | + | | Powiadomienia wielokanałowe | + | + | + |
| Eksport danych (CSV/PDF) | - | - | + | | NordaGPT — asystent AI | - | **+** | + |
| API dostęp | - | - | + | | Statystyki profilu firmy | - | **+** | + |
| Priorytetowe wsparcie | - | - | + | | Norda360 (SEO/GBP/Social) | - | **50% zniżki** | **w cenie** |
| Email @nordabiznes.pl | - | **+ (1 konto)** | **+ (5 kont)** |
| Projekt Kaszubia — dostęp | - | **+** | + |
| Konta pracowników z rolami | - | - | **+** |
### Roadmapa rozwoju (ze slajdu 9, prezentacja Rada 13.02.2026)
Funkcje planowane do wdrożenia, wspólnie decydowane z Radą NORDA:
| # | Funkcjonalność | Opis |
|---|---------------|------|
| 1 | NordaGPT 2.0 | Zaawansowany doradca AI — analiza rynku, rekomendacje biznesowe, automatyczne raporty |
| 2 | Platforma edukacyjna | Szkolenia online, webinary, materiały dla członków — rozwój kompetencji cyfrowych |
| 3 | Integracje komunikacyjne | WhatsApp Business, SMS — bezpośredni kontakt z firmami członkowskimi |
| 4 | Marketplace usług | Członkowie oferują usługi innym członkom — wewnętrzna giełda kompetencji |
| 5 | Raporty branżowe z AI | Automatyczna analiza trendów i szans rynkowych dla firm członkowskich |
### Norda360 — osobny produkt
| Element | Opis |
|---------|------|
| **Funkcje** | SEO audit + optymalizacja, GBP zarządzanie, Social media AI, Wywiadownia gospodarcza, Analityka online |
| **Integracja** | Premium: 50% zniżki; Business Pro: Norda360 w cenie |
| **Cel** | NORDA dostarcza początkowych klientów, produkt skaluje się poza Izby |

View File

@ -131,13 +131,12 @@ Infrastructure topology, critical configurations, and security model.
| [09-security-architecture.md](09-security-architecture.md) | Security model - zones, threats, controls, compliance | 60KB | 5 trust zones, STRIDE analysis, RBAC, OWASP Top 10 | | [09-security-architecture.md](09-security-architecture.md) | Security model - zones, threats, controls, compliance | 60KB | 5 trust zones, STRIDE analysis, RBAC, OWASP Top 10 |
### Reference Documentation ### Reference Documentation
*Note: These documents are planned but not yet created.*
| Document | Description | Status | | Document | Description | Status |
|----------|-------------|--------| |----------|-------------|--------|
| 10-api-endpoints.md | Complete API reference with examples | 📋 Planned | | [10-api-endpoints.md](10-api-endpoints.md) | Complete API reference with examples | ✅ Complete |
| 11-troubleshooting-guide.md | Common issues and solutions | 📋 Planned | | [11-troubleshooting-guide.md](11-troubleshooting-guide.md) | Common issues and solutions | ✅ Complete |
| MAINTENANCE.md | Documentation maintenance procedures | 📋 Planned | | [MAINTENANCE.md](MAINTENANCE.md) | Documentation maintenance procedures | ✅ Complete |
## Architecture at a Glance ## Architecture at a Glance
@ -551,19 +550,19 @@ A: See [Critical Configurations](08-critical-configurations.md#backup-and-recove
**Network & Security** (3/3) **Network & Security** (3/3)
- Network Topology, Critical Configurations, Security Architecture - Network Topology, Critical Configurations, Security Architecture
### Planned Documentation (3 documents) ### Reference Documentation (3 documents)
📋 **Reference Documentation** (0/3) **Reference Documentation** (3/3)
- API Endpoints Reference - API Endpoints Reference
- Troubleshooting Guide - Troubleshooting Guide
- Maintenance Procedures - Maintenance Procedures
### Documentation Metrics ### Documentation Metrics
- **Total Documents:** 9 completed, 3 planned - **Total Documents:** 12 completed
- **Total Size:** ~480KB of documentation - **Total Size:** ~480KB of documentation
- **Diagrams:** 30+ Mermaid diagrams - **Diagrams:** 30+ Mermaid diagrams
- **Coverage:** ~75% complete - **Coverage:** ~95% complete
## Quick Reference Card ## Quick Reference Card
@ -640,7 +639,7 @@ When updating the codebase, please maintain architecture documentation:
- Update system context for new external integrations - Update system context for new external integrations
- Add new routes to Flask components documentation - Add new routes to Flask components documentation
See [MAINTENANCE.md](./MAINTENANCE.md) *(planned)* for detailed procedures. See [MAINTENANCE.md](./MAINTENANCE.md) for detailed procedures.
## Maintenance ## Maintenance
@ -653,16 +652,16 @@ This documentation is a living resource that must evolve with the codebase.
- **Infrastructure:** Update when servers/networks change - **Infrastructure:** Update when servers/networks change
### Maintenance Checklist ### Maintenance Checklist
See [MAINTENANCE.md](./MAINTENANCE.md) *(planned)* for complete maintenance guidelines. See [MAINTENANCE.md](./MAINTENANCE.md) for complete maintenance guidelines.
--- ---
## Document Status ## Document Status
**Version:** 1.0.0 **Version:** 1.0.0
**Last Updated:** 2026-01-10 **Last Updated:** 2026-02-09
**Status:** ✅ Core documentation complete (9/12 documents) **Status:** ✅ All documentation complete (12/12 documents)
**Coverage:** High-level architecture, components, flows, network, security **Coverage:** High-level architecture, components, flows, network, security, reference
**Completion Status:** **Completion Status:**
- ✅ Phase 1: Research and Analysis (100%) - ✅ Phase 1: Research and Analysis (100%)
@ -671,16 +670,8 @@ See [MAINTENANCE.md](./MAINTENANCE.md) *(planned)* for complete maintenance guid
- ✅ Phase 4: Component Architecture Diagrams (100%) - ✅ Phase 4: Component Architecture Diagrams (100%)
- ✅ Phase 5: Data Flow Documentation (100%) - ✅ Phase 5: Data Flow Documentation (100%)
- ✅ Phase 6: Network and Security Documentation (100%) - ✅ Phase 6: Network and Security Documentation (100%)
- 🔄 Phase 7: Integration and Reference Documentation (25% - master overview complete) - ✅ Phase 7: Integration and Reference Documentation (100%)
- 📋 Phase 8: Review and Validation (pending) - ✅ Phase 8: Review and Validation (100%)
**Next Steps:**
1. Create API Endpoints Reference (10-api-endpoints.md)
2. Create Troubleshooting Guide (11-troubleshooting-guide.md)
3. Create Maintenance Guide (MAINTENANCE.md)
4. Update CLAUDE.md with architecture doc references
5. Validate all diagrams render correctly
6. Cross-check documentation against code
--- ---

View File

@ -57,7 +57,7 @@
<div class="container"> <div class="container">
<div class="logo-wrap"> <div class="logo-wrap">
<!-- Norda Biznes logo - top part (N+orda text + compass) in white --> <!-- Norda Biznes logo - top part (N+orda text + compass) in white -->
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 50 1060 250" fill="white"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 15 1060 330" fill="white">
<path d="M184.801 335.112H145.6L35.326 89.571v245.541H0V33.136h55.993l93.054 214.963V33.136H184.8v301.976"/> <path d="M184.801 335.112H145.6L35.326 89.571v245.541H0V33.136h55.993l93.054 214.963V33.136H184.8v301.976"/>
<path d="M447.551 300.621c21.183-21.182 34.287-50.45 34.287-82.78 0-32.329-13.104-61.598-34.288-82.782-21.184-21.186-50.452-34.288-82.78-34.288-32.333 0-61.605 13.104-82.79 34.288-21.187 21.184-34.291 50.453-34.291 82.782 0 32.33 13.104 61.598 34.29 82.782 21.186 21.184 50.458 34.286 82.791 34.286 32.328 0 61.596-13.102 82.782-34.288zm39.525-82.78c0 33.774-13.691 64.351-35.823 86.483-22.132 22.132-52.71 35.823-86.483 35.823-33.777 0-64.358-13.69-86.493-35.823-22.135-22.132-35.825-52.71-35.825-86.483s13.69-64.352 35.826-86.485c22.134-22.132 52.715-35.823 86.492-35.823 33.772 0 64.351 13.691 86.483 35.824 22.132 22.132 35.823 52.711 35.823 86.484"/> <path d="M447.551 300.621c21.183-21.182 34.287-50.45 34.287-82.78 0-32.329-13.104-61.598-34.288-82.782-21.184-21.186-50.452-34.288-82.78-34.288-32.333 0-61.605 13.104-82.79 34.288-21.187 21.184-34.291 50.453-34.291 82.782 0 32.33 13.104 61.598 34.29 82.782 21.186 21.184 50.458 34.286 82.791 34.286 32.328 0 61.596-13.102 82.782-34.288zm39.525-82.78c0 33.774-13.691 64.351-35.823 86.483-22.132 22.132-52.71 35.823-86.483 35.823-33.777 0-64.358-13.69-86.493-35.823-22.135-22.132-35.825-52.71-35.825-86.483s13.69-64.352 35.826-86.485c22.134-22.132 52.715-35.823 86.492-35.823 33.772 0 64.351 13.691 86.483 35.824 22.132 22.132 35.823 52.711 35.823 86.484"/>
<path d="M530.868 169.264c0-13.197.937-24.47 2.804-33.81 1.868-9.34 5.305-16.942 10.337-22.833 5.014-5.878 11.694-10.117 20.031-12.71 8.317-2.582 18.944-3.88 31.875-3.88h44.809v25.853h-29.293c-7.758.012-14.008.583-18.744 1.725-4.747 1.156-8.406 3.375-10.988 6.672-2.582 3.306-4.386 7.974-5.383 13.996-1.013 6.034-1.505 13.79-1.505 23.263v167.572h-43.943V169.264z"/> <path d="M530.868 169.264c0-13.197.937-24.47 2.804-33.81 1.868-9.34 5.305-16.942 10.337-22.833 5.014-5.878 11.694-10.117 20.031-12.71 8.317-2.582 18.944-3.88 31.875-3.88h44.809v25.853h-29.293c-7.758.012-14.008.583-18.744 1.725-4.747 1.156-8.406 3.375-10.988 6.672-2.582 3.306-4.386 7.974-5.383 13.996-1.013 6.034-1.505 13.79-1.505 23.263v167.572h-43.943V169.264z"/>