{% extends "base.html" %} {% block title %}Zielony Okręg Przemysłowy Kaszubia - Norda Biznes Partner{% endblock %} {% block extra_css %} {% endblock %} {% block content %}

Zielony Okręg Przemysłowy Kaszubia

Strategiczna inicjatywa rozwoju regionu Pomorza - energetyka odnawialna, przemysł obronny, technologie przyszłości. Baza wiedzy o projektach transformacji gospodarczej Kaszub.

{% if current_user.is_authenticated and current_user.is_admin %} ⚙️ Panel ZOPK → {% endif %}
{{ stats.total_projects }}
Projekty
{{ stats.total_stakeholders }}
Interesariusze
{{ stats.total_news }}
Aktualności
{{ stats.total_resources }}
Materiały
{% if current_user.is_authenticated and current_user.is_admin and knowledge_data %}

Wiedza o regionie (baza wiedzy AI)

✏️ Zarządzaj
{{ knowledge_data.total_facts }}
Wyekstrahowane fakty
{{ knowledge_data.total_entities }}
Rozpoznane encje
{{ knowledge_data.total_chunks }}
Chunki z embeddingami
{% if knowledge_data.fact_types %} {% set total_ft = knowledge_data.fact_types|sum(attribute='1') %} {% if total_ft > 0 %}
{% for ft_name, ft_count in knowledge_data.fact_types %}
{% if ft_count * 100 / total_ft > 8 %}{{ ft_count }}{% endif %}
{% endfor %}
{% for ft_name, ft_count in knowledge_data.fact_types %} {{ ft_name or 'inne' }} ({{ ft_count }}) {% endfor %}
{% endif %} {% endif %}

Najczęściej wymieniane encje

    {% for entity in knowledge_data.top_entities %}
  • {{ entity.entity_type or '?' }} {{ entity.canonical_name or entity.name }} {{ entity.mentions_count }}x
  • {% endfor %}

Kluczowe dane liczbowe

{% for fact in knowledge_data.key_investments %}
{% if fact.numeric_value >= 1000000000 %} {{ "%.1f"|format(fact.numeric_value / 1000000000) }} mld {{ fact.numeric_unit or '' }} {% elif fact.numeric_value >= 1000000 %} {{ "%.1f"|format(fact.numeric_value / 1000000) }} mln {{ fact.numeric_unit or '' }} {% elif fact.numeric_value >= 1000 %} {{ "%.0f"|format(fact.numeric_value / 1000) }} tys. {{ fact.numeric_unit or '' }} {% else %} {{ "%.0f"|format(fact.numeric_value) }} {{ fact.numeric_unit or '' }} {% endif %}
{{ fact.full_text[:200] }}
{% endfor %}
{% if knowledge_data.dated_facts %}

Oś czasu faktów

✏️ Zarządzaj
{% for fact in knowledge_data.dated_facts %}
{{ fact.date_value.strftime('%d.%m.%Y') }}
{% if fact.fact_type == 'investment' %}Inwestycja {% elif fact.fact_type == 'event' %}Wydarzenie {% elif fact.fact_type == 'decision' %}Decyzja {% elif fact.fact_type == 'milestone' %}Kamień milowy {% else %}{{ fact.fact_type or 'Fakt' }} {% endif %}

{{ fact.full_text[:300] }}

{% if fact.source_news %} {% endif %}
{% endfor %}
{% endif %} {% endif %}

Projekty strategiczne

{% if current_user.is_authenticated and current_user.is_admin %} ✏️ Zarządzaj {% endif %}
{% if projects %}
{% for project in projects %}
{% if project.icon == 'wind' %} {% elif project.icon == 'atom' %} {% elif project.icon == 'server' %} {% elif project.icon == 'flask' %} {% elif project.icon == 'shield' %} {% else %} {% endif %}

{{ project.name }}

{{ project.description[:150] }}{% if project.description|length > 150 %}...{% endif %}

{% if project.status == 'planned' %}Planowany{% elif project.status == 'in_progress' %}W realizacji{% else %}Zakończony{% endif %}
{% endfor %}
{% else %}

Brak projektów do wyświetlenia.

{% endif %}
{% if milestones %}

🗺️ Roadmapa ZOPK

{% if current_user.is_authenticated and current_user.is_admin %} ✏️ Zarządzaj {% endif %}
{% set ns = namespace(current_year=None) %} {% for milestone in milestones %} {# Year marker when year changes #} {% if milestone.target_date %} {% set milestone_year = milestone.target_date.year %} {% if milestone_year != ns.current_year %} {% set ns.current_year = milestone_year %}
{{ milestone_year }}
{% endif %} {% endif %}
{{ milestone.icon or '📌' }}
{% endfor %}
{% endif %}

Kluczowi interesariusze

{% if current_user.is_authenticated and current_user.is_admin %} ✏️ Zarządzaj {% endif %}
{% if stakeholders %}
{% for stakeholder in stakeholders %}
{{ stakeholder.name[0].upper() }}

{{ stakeholder.name }}

{{ stakeholder.role or stakeholder.organization }}

{% if stakeholder.category == 'government' %}Rząd{% elif stakeholder.category == 'local_authority' %}Samorząd{% elif stakeholder.category == 'business' %}Biznes{% else %}{{ stakeholder.category }}{% endif %}
{% endfor %}
{% else %}

Brak interesariuszy do wyświetlenia.

{% endif %}

Aktualności

{% if current_user.is_authenticated and current_user.is_admin %} ✏️ Zarządzaj {% endif %}
{% if news_stats %}
{{ news_stats.total }} łącznie
{{ news_stats.last_day }} ostatni dzień
{{ news_stats.last_week }} ostatni tydzień
{{ news_stats.last_month }} ostatni miesiąc
{% endif %} {% if news_items %}
{% for news in news_items %} {% if news.image_url %} {% else %}
{{ (news.source_domain or 'N')[0]|upper }}
{% endif %}

{{ news.title }}

{% if news.description %} {% set clean_desc = news.description|striptags %}

{{ clean_desc[:250] }}{% if clean_desc|length > 250 %}...{% endif %}

{% endif %}
{{ news.source_name or news.source_domain }} {{ news.published_at.strftime('%d.%m.%Y') if news.published_at else '-' }}
{% endfor %}
{% if news_stats and news_stats.total > 25 %}
Zobacz starsze aktualności ({{ news_stats.total - 25 }} więcej)
{% endif %} {% else %}

Brak aktualności. Wkrótce pojawią się nowe informacje.

{% endif %}
{% if resources %}

Materiały i dokumenty

{% if current_user.is_authenticated and current_user.is_admin %} ✏️ Zarządzaj {% endif %}
{% for resource in resources %}
{% if resource.resource_type == 'document' %} {% elif resource.resource_type == 'video' %} {% elif resource.resource_type == 'image' %} {% elif resource.resource_type == 'map' %} {% else %} {% endif %}

{{ resource.title }}

{{ resource.resource_type|capitalize }}
{% endfor %}
{% endif %} {% if current_user.is_authenticated and current_user.is_admin and knowledge_data %}

Graf współwystępowania encji

✏️ Zarządzaj
2
Ładowanie...
Firmy
Osoby
Miejsca
Organizacje
Projekty
{% endif %} {% endblock %} {% block extra_js %} {% if current_user.is_authenticated and current_user.is_admin and knowledge_data %} // Knowledge Graph — D3.js (function() { if (typeof d3 === 'undefined') { window.addEventListener('load', function() { if (typeof d3 !== 'undefined') initKG(); }); } else { initKG(); } var kgSim, kgSvg, kgG, kgZoom; function initKG() { kgSvg = d3.select('#kg-svg'); if (!kgSvg.node()) return; kgZoom = d3.zoom() .scaleExtent([0.1, 4]) .on('zoom', function(event) { kgG.attr('transform', event.transform); }); kgSvg.call(kgZoom); kgG = kgSvg.append('g'); kgG.append('g').attr('class', 'kg-links'); kgG.append('g').attr('class', 'kg-nodes'); loadKnowledgeGraph(); } window.loadKnowledgeGraph = async function() { var minC = document.getElementById('kgMinCooccur').value; try { var resp = await fetch('/admin/zopk-api/knowledge/graph/data?min_cooccurrence=' + minC + '&limit=150'); var data = await resp.json(); if (data.success) { renderKG(data.nodes, data.links, data.stats); } } catch(e) { console.error('KG load error:', e); } }; var typeColors = { company: '#3b82f6', person: '#ec4899', place: '#10b981', organization: '#f59e0b', Organizacja: '#f59e0b', project: '#8b5cf6', Projekt: '#8b5cf6', Lokalizacja: '#10b981', event: '#ef4444' }; function nodeColor(type) { return typeColors[type] || '#6b7280'; } function renderKG(nodes, links, stats) { var width = kgSvg.node().getBoundingClientRect().width; var height = 500; if (kgSim) kgSim.stop(); kgG.select('.kg-links').selectAll('*').remove(); kgG.select('.kg-nodes').selectAll('*').remove(); document.getElementById('kgStats').innerHTML = '' + stats.total_nodes + ' encji • ' + stats.total_links + ' połączeń'; var link = kgG.select('.kg-links').selectAll('line') .data(links).enter().append('line') .attr('class', 'kg-link') .attr('stroke-width', function(d) { return Math.sqrt(d.value); }); var node = kgG.select('.kg-nodes').selectAll('g') .data(nodes).enter().append('g') .attr('class', 'kg-node') .call(d3.drag() .on('start', function(ev, d) { if (!ev.active) kgSim.alphaTarget(0.3).restart(); d.fx = d.x; d.fy = d.y; }) .on('drag', function(ev, d) { d.fx = ev.x; d.fy = ev.y; }) .on('end', function(ev, d) { if (!ev.active) kgSim.alphaTarget(0); d.fx = null; d.fy = null; })) .on('mouseover', function(ev, d) { var tt = document.getElementById('kgTooltip'); tt.innerHTML = '' + d.name + '
Typ: ' + d.type + ' | Wzmianki: ' + d.mentions; tt.style.display = 'block'; tt.style.left = (ev.pageX + 10) + 'px'; tt.style.top = (ev.pageY + 10) + 'px'; }) .on('mouseout', function() { document.getElementById('kgTooltip').style.display = 'none'; }); node.append('circle') .attr('r', function(d) { return Math.max(6, Math.min(24, Math.sqrt(d.mentions) * 2)); }) .attr('fill', function(d) { return nodeColor(d.type); }); node.filter(function(d) { return d.mentions >= 8; }) .append('text') .attr('dy', function(d) { return Math.max(6, Math.min(24, Math.sqrt(d.mentions) * 2)) + 10; }) .text(function(d) { return d.name.length > 18 ? d.name.slice(0, 18) + '...' : d.name; }); kgSim = d3.forceSimulation(nodes) .force('link', d3.forceLink(links).id(function(d) { return d.id; }).distance(80).strength(function(d) { return Math.min(1, d.value / 10); })) .force('charge', d3.forceManyBody().strength(-150)) .force('center', d3.forceCenter(width / 2, height / 2)) .force('collision', d3.forceCollide().radius(function(d) { return Math.max(6, Math.sqrt(d.mentions) * 2) + 4; })) .on('tick', function() { link.attr('x1', function(d) { return d.source.x; }) .attr('y1', function(d) { return d.source.y; }) .attr('x2', function(d) { return d.target.x; }) .attr('y2', function(d) { return d.target.y; }); node.attr('transform', function(d) { return 'translate(' + d.x + ',' + d.y + ')'; }); }); } })(); {% endif %} {% endblock %}