Commit Graph

66 Commits

Author SHA1 Message Date
a57187e05f test: Add comprehensive testing infrastructure
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
- pytest framework with fixtures for auth (auth_client, admin_client)
- Unit tests for SearchService
- Integration tests for auth flow
- Security tests (OWASP Top 10: SQL injection, XSS, CSRF)
- Smoke tests for production health and backup monitoring
- E2E tests with Playwright (basic structure)
- DR tests for backup/restore procedures
- GitHub Actions CI/CD workflow (.github/workflows/test.yml)
- Coverage configuration (.coveragerc) with 80% minimum
- DR documentation and restore script

Staging environment: VM 248, staging.nordabiznes.pl

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 07:52:34 +01:00
ebc3dd63d3 fix: Redirect loop in membership apply + add registry lookup for admin + action legends 2026-02-01 14:05:41 +01:00
9b8d68348e feat: Enhanced website extraction - no limits, more categories
- Removed limits on services (was 10) and keywords (was 8)
- Added new extraction categories:
  - products: physical/digital products
  - brands: partners, certifications (VMware, Veeam, etc.)
  - specializations: specific competencies
  - target_customers: customer types (SMB, enterprise, etc.)
  - regions: geographic coverage
- Merged all data into services_extracted and main_keywords
- Increased content limit to 20000 chars for AI

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 08:50:15 +01:00
83a33f49ff fix: Load .env file in website content updater
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 08:43:06 +01:00
d96cd78c47 feat: Add automatic website content updater with Gemini 3 Flash
- New script: scripts/website_content_updater.py
- Uses Gemini 3 Flash (free tier) for AI extraction
- Extracts: services_extracted, main_keywords, content_summary
- Supports: single company, batch, stale-days filtering, dry-run
- Rate limiting: 2s between API calls
- Documented cron setup in CLAUDE.md

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 08:42:04 +01:00
52061fa949 feat: Display ALL KRS data in company profile
- Add krs_raw_data, krs_fetched_at, krs_registration_date,
  krs_representation, krs_activities columns to Company model
- Save complete KRS API response for full data access
- Display in company profile:
  - Board members (zarząd) with functions and avatars
  - Shareholders (wspólnicy) with share amounts
  - Representation method (sposób reprezentacji)
  - Business activities (PKD codes)
  - Registration date with years active
  - KRS address with region info
  - OPP (public benefit) status
  - Metadata (stan_z_dnia, data_odpisu)
- Add migration 037_krs_extended_data.sql

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 07:44:33 +01:00
7bfbfa6279 feat: Auto-switch between CEIDG and KRS APIs for company enrichment
- Add enrich_companies_from_registries() that tries KRS first for companies
  with KRS number, then falls back to CEIDG
- Add update_company_from_krs() to save KRS data to Company model
- Fix CEIDG search to use 'nip' parameter directly
- Keep enrich_companies_from_ceidg() as alias for compatibility

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 07:27:50 +01:00
448937dabd fix: Rename pkd_codes column to ceidg_pkd_list to avoid backref conflict
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 07:22:32 +01:00
9f2b261df2 feat: Extend CEIDG data storage and enrichment
- Add new Company fields: ceidg_id, ceidg_status, pkd_codes (JSONB),
  correspondence address, owner_citizenships, ceidg_raw_data
- Add enrich_companies_from_ceidg() to fetch full CEIDG details
- Add fetch_full_ceidg_details() for detailed API calls
- Add update_company_from_ceidg() to save all CEIDG fields
- Add --enrich and --apply flags for batch enrichment
- Add migration 036_ceidg_extended_data.sql

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 07:21:21 +01:00
79a1a60621 feat: Add CEIDG API name search and --missing-nip option
- Add search_ceidg_by_name() for API v3 name-based queries
- Add search_missing_nip_companies() to find NIP for companies without NIP
- Add --missing-nip flag to search for all companies missing NIP
- Add --apply-nip flag to save found NIPs to database
- Fix API endpoint: /api/ceidg/v3/firmy (not /firma)
- Correctly extract NIP from wlasciciel object in response

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 07:16:22 +01:00
99f7a5a88a fix: Remove sticky sidebar on account pages + add Companies to admin menu
Changes:
- Remove position: sticky from konto sidebar (dane, prywatnosc, bezpieczenstwo, blokady)
- Add "Firmy" link to admin dropdown menu (before "Użytkownicy")
- Add scan_websites_for_nip.py script for data quality

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 07:03:55 +01:00
cebe52f303 refactor: Rebranding i aktualizacja modelu AI
- Zmiana nazwy: "Norda Biznes Hub" → "Norda Biznes Partner"
- Aktualizacja modelu AI: Gemini 2.0 Flash → Gemini 3 Flash
- Zachowano historyczne odniesienia w timeline i dokumentacji

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 14:08:39 +01:00
652a441a30 feat(admin): Add AI model comparison page
- New admin page /admin/model-comparison for comparing AI responses
- Side-by-side comparison: old model (2.5 Flash-Lite) vs new (3 Flash)
- Questions from real conversations (Artur Wiertel, Maciej Pienczyn)
- Run simulation button to generate new responses
- Added link in admin menu under "Porównanie modeli"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 08:45:33 +01:00
4b38f8953c feat(categories): Hierarchiczna struktura kategorii
- Dodanie parent_id do tabeli categories
- Model Category z relacją parent/subcategories
- 4 główne grupy: Usługi, Budownictwo, Handel, Produkcja
- Skrypt assign_category_parents.py do przypisania podkategorii
- Migracja 030_add_category_hierarchy.sql

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 20:51:15 +01:00
b6bbb32483 feat(ui): Norda Partner, Strefa Gościa, uproszczenie forum
- Landing page: przycisk "Norda Partner" + kontakt Izby (email, WhatsApp)
- Landing page: link "Strefa Gościa" → norda-biznes.info
- Menu "Więcej": dodano "Strefa Gościa (Izba)" dla zalogowanych
- Forum: ukryto filtry kategorii/statusów (uproszczenie UX)
- README: zmiana "AI Assistant" → "NordaGPT"
- Skrypt import firmy testowej "Kaszubia 2030"
- .gitignore: wykluczenie notatek ze spotkań (MEETING_*.md)

Zmiany na podstawie spotkania 2026-01-28 i uwag Artura Wiertla.
Wzór nawigacji: Vaillant.pl (Klienci indywidualni / Profesjonaliści)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 20:11:35 +01:00
ebbf75e7a0 fix(calendar): Poprawiono godzinę "Chwila dla Biznesu" z 18:00 na 19:00
Skrypt importu miał błędną godzinę 18:00. Faktyczne spotkania
"Chwila dla Biznesu" odbywają się o 19:00.

Zaktualizowano:
- Komentarz w linii 50
- Opis wydarzenia (description)
- time_start: time(19, 0)

Istniejące wydarzenia w bazie zostały zaktualizowane ręcznie (UPDATE SQL).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 21:56:55 +01:00
96fa0058c2 feat(zopk): Rozbudowa bazy wiedzy ZOPK
- Dodano skrypt cron do automatycznej ekstrakcji wiedzy (scripts/cron_extract_knowledge.py)
- Dodano panel deduplikacji faktów (/admin/zopk/knowledge/fact-duplicates)
- Dodano API i funkcje auto-weryfikacji encji i faktów
- Dodano panel Timeline ZOPK (/admin/zopk/timeline) z CRUD
- Rozszerzono dashboard bazy wiedzy o statystyki weryfikacji i przyciski auto-weryfikacji
- Dodano migrację 016_zopk_milestones.sql dla tabeli kamieni milowych
- Naprawiono duplikat modelu ZOPKMilestone w database.py

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 10:57:11 +01:00
6d1f75bce5 fix(admin): Naprawiono błędne nazwy endpointów w breadcrumbs
Zmieniono admin_dashboard i admin_zopk_dashboard na admin_zopk

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 09:03:01 +01:00
7cc5f033fe fix: Poprawiono nazwy kluczy w pipeline skrypcie
Zmieniono 'processed' -> 'success' i 'generated' -> 'success' aby
pasowały do wartości zwracanych przez batch_extract() i
generate_chunk_embeddings().

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 00:27:08 +01:00
cbd9c5cc4d feat(zopk): Skrypt pipeline do automatycznej ekstrakcji wiedzy
Uruchamia po kolei: scraping treści, ekstrakcję AI, generowanie embeddingów.
Do użycia w cron job co godzinę.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 23:39:49 +01:00
c13ad09e3a feat(zopk): Skrypt do naprawy źródeł newsów z Google News
Problem: Newsy z Google News RSS miały source_domain='news.google.com'
i favicon Google zamiast prawdziwego źródła.

Rozwiązanie: Nowy skrypt fix_google_news_sources.py który:
- Wyciąga nazwę źródła z tytułu (po " - ")
- Mapuje 59 źródeł na ich prawdziwe domeny
- Aktualizuje source_domain i image_url (favicon)

Wynik: 143/143 newsów zaktualizowanych z poprawnymi źródłami.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 08:06:40 +01:00
8055589a08 fix: Usunięto Session z decode_google_news_url, dodano max_depth
- Zamieniono requests.Session() na bezpośredni requests.get()
- Dodano max_depth=3 jako zabezpieczenie przed nieskończoną rekurencją
- Jawne zamykanie response.close() po każdym request

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 07:45:02 +01:00
af4c0d157a fix: Naprawiono wyciek połączeń HTTP w fix_google_news_images.py
- Dodano context manager (with) dla sesji requests
- Jawne zamykanie odpowiedzi HTTP (response.close())
- Dodano flush=True do print dla natychmiastowego outputu
- Rozwiązuje problem 725+ otwartych połączeń

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 07:40:00 +01:00
637ec2fc75 feat: Skrypt do naprawy obrazków newsów z Google News 2026-01-15 06:19:53 +01:00
c2205b0815 fix: Poprawione dekodowanie URL Google News + użycie source_domain 2026-01-15 06:10:59 +01:00
8ead7798df fix: Ładowanie DATABASE_URL z .env w skrypcie obrazków 2026-01-15 06:08:59 +01:00
cf56fe7d8a feat(zopk): Skrypt do pobierania obrazków dla newsów
Strategia pobierania obrazków:
1. Rozwiń URL Google News do oryginalnego źródła
2. Pobierz og:image z meta tagów strony
3. Fallback: logo domeny (Clearbit API)
4. Fallback: favicon (Google Favicon API)

Użycie: python scripts/fetch_news_images.py [--dry-run] [--limit N]

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 06:08:10 +01:00
22e73e4f80 feat: Email DKIM/SPF/DMARC config + year_established data fill
- Added release notes v1.19.0 with today's changes
- Email: DKIM, SPF, DMARC configured for nordabiznes.pl
- Data: year_established filled for 71/111 companies (64%)
- Script: fix_year_established.py for KRS date migration

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 15:01:01 +01:00
c8075e0872 feat: Add email test script for manual testing
Script sends welcome emails to specified addresses for testing
DKIM/SPF/DMARC configuration.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 14:09:17 +01:00
3221740502 feat: Dodanie daty przystąpienia do Izby NORDA na profilu firmy
- Nowa kolumna member_since w tabeli companies
- Karta "Członek Izby NORDA od" na profilu firmy (niebieski kolor #3b82f6)
- Wyświetlanie liczby lat w Izbie
- Import 57 dat przystąpienia z pliku Excel od Artura
- Skrypt import_member_since.py do importu dat

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 06:57:00 +01:00
59c50e0267 fix: Handle None values in SEO audit result extraction
Bug: When page fetch fails (SSL error), result['onpage'] is None.
Using dict.get('key', {}) returns None when key exists with None value.

Fix: Use 'or {}' pattern to handle both missing keys and None values.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 18:20:19 +01:00
abe1cd38a1 feat: Add PKD codes and CEIDG owner data to company profiles
- Add pkd_code, pkd_description columns for business activity classification
- Add business_start_date column from CEIDG
- Add owner_first_name, owner_last_name for JDG companies
- Create import script scripts/import_ceidg_to_db.py
- Add PKD card display in company profile template
- Add owner section for JDG companies without KRS
- Track SQL migrations in git (database/migrations/*.sql)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 16:07:03 +01:00
f174f4d4da feat: Link Users to Persons (KRS data)
- Add person_id column to users table
- Template shows person profile link when person_id exists
- Add script to match and link users to persons by name

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 15:07:02 +01:00
ffc6d8219f feat: Add toggle button to hide/show test items on B2B board
- Add is_test field to Classified model
- Add test-item styling (opacity + gray border + badge)
- Add yellow toggle button with localStorage persistence
- Add script to mark existing classifieds as test
2026-01-13 13:08:11 +01:00
08d6c0b069 feat: Add 'test' category for forum topics to separate test content
- Add 'test' to ForumTopic.CATEGORIES with Polish label 'Testowy'
- Add gray styling for test topics (badge + card opacity)
- Add scripts to list and mark test topics
2026-01-13 11:48:08 +01:00
9eae623d3e feat: Add source tracking to events + import scripts
- Add source and source_note fields to NordaEvent model
- Create import_calendar_2026.py for NORDA calendar events
- Create import_excel_members_2026_01_13.py for new members
- Add .private/ to .gitignore (confidential materials)

Imported 26 events from Kalendarz Izby NORDA 2026 (Artur Wiertel)
Imported 31 new member companies from Excel

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 10:22:24 +01:00
986360f7d5 feat: Add URL normalization and inline audit sections
- Add normalize_social_url() function to database.py to prevent
  www vs non-www duplicates in social media records
- Update update_social_media.py to normalize URLs before insert
- Update social_media_audit.py to normalize URLs before insert
- Add inline GBP Audit section to company profile
- Add inline Social Media Audit section to company profile
- Add inline IT Audit section to company profile

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 23:07:03 +01:00
3f9273cff6 feat: Add company logos to search results, hide events section
- Add company logo display in search results cards
- Make logo clickable (links to company profile)
- Temporarily hide "Aktualności i wydarzenia" section on company profiles
- Add scripts for KRS PDF download/parsing and CEIDG API

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 15:32:53 +01:00
f29987f635 auto-claude: 2.6 - Remove hardcoded password from docstring usage example 2026-01-10 12:55:34 +01:00
c228716c0f auto-claude: 2.6 - Replace hardcoded password in scripts/test_collaboration_matching.py with safe fallback 2026-01-10 12:54:39 +01:00
914dac410e auto-claude: 2.5 - Replace hardcoded password in scripts/seo_audit.py with safe fallback 2026-01-10 12:53:29 +01:00
90f9401530 auto-claude: 2.4 - Replace hardcoded password in scripts/seo_report_generator.py with safe fallback 2026-01-10 12:52:01 +01:00
b4dcca6d55 auto-claude: 2.3 - Replace hardcoded password in scripts/social_media_audit.py with safe fallback 2026-01-10 12:50:39 +01:00
fa45b4b793 auto-claude: subtask-7-2 - Test collaboration matching
Created comprehensive test suite for IT audit collaboration matching:

1. Unit tests (tests/test_it_audit_collaboration.py):
   - 12 tests verifying all 6 match types
   - Backup replication, shared licensing, Teams federation
   - Shared monitoring, collective purchasing, knowledge sharing
   - Edge cases for size parsing and similarity

2. Integration test script (scripts/test_collaboration_matching.py):
   - Creates test audits with matching criteria
   - Runs collaboration matching algorithm
   - Verifies matches saved to database

All unit tests pass (12/12).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 09:24:45 +01:00
39cd257f4e Fix YouTube detection overwriting valid matches
- Add 'channel', 'c', 'user', '@' etc. to YouTube exclusion list
- Add 'bold_themes', 'boldthemes' to Twitter/Facebook exclusions (theme creators)
- Fix pattern matching loop to stop after first valid match per platform
- Prevents fallback pattern from overwriting correct channel ID with 'channel'

Fixes issue where youtube.com/channel/ID was being overwritten with
youtube.com/channel/channel by the second fallback pattern.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 05:36:06 +01:00
c319777d58 Social Media audit: progress bar improvements
- Add detailed logging to SocialMediaAuditor (website scan, Brave search, results)
- Slow down progress bar animation (400ms instead of 200ms) for better readability
- Bold "ZNALEZIONO" text for found platforms
- Display Google rating and review count in progress
- Increase wait time before modal close (4 seconds)
- Add console.log for debugging audit response

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 05:29:17 +01:00
8fed190303 fix(social-audit): Convert opening_hours dict to JSON for JSONB column
Fixes: psycopg2.ProgrammingError: can't adapt type 'dict'

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 05:14:01 +01:00
5ed97ac1dd auto-claude: subtask-5-1 - Fix opening_hours and photos data passing in audit_company
Fixed a bug where google_opening_hours and google_photos_count were being
fetched from the Google Places API but not passed through to the result
dictionary correctly:

- Changed 'opening_hours' key to 'google_opening_hours' to match what
  save_audit_result() expects
- Added 'google_photos_count' to the result dictionary

Verified with dry-run: INPI company now shows opening hours schedule
and 10 photos count from Google Business Profile.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 23:08:19 +01:00
aacf2cf54b auto-claude: subtask-2-3 - Update save_audit_result() to store google_opening_hours and google_photos_count
- Added google_opening_hours and google_photos_count to INSERT column list
- Added corresponding placeholders to VALUES list
- Added to ON CONFLICT UPDATE SET clause
- Added to parameter dictionary reading from google_reviews result

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 23:00:22 +01:00
5f2cfa06fd auto-claude: subtask-2-2 - Update get_place_details() to return photos count
- Add google_photos_count to result dictionary initialization
- Extract photos count from API response using len(place['photos'])
- Update logging to include photos count in output

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 22:59:04 +01:00