Skip to content

Commit 398075c

Browse files
Copilotpethers
andcommitted
Fix PR review round 2: restore localized meta descriptions, remove duplicates, fix parsing
Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
1 parent ed422c3 commit 398075c

File tree

9 files changed

+37
-23
lines changed

9 files changed

+37
-23
lines changed

docs/CIA_STATS_INTEGRATION.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# CIA Production Statistics Integration - Quick Reference
22

33
**Document Classification:** 🟢 Public
4-
**Last Updated:** 2026-02-12
4+
**Last Updated:** Dynamic (see `cia-data/production-stats.json`)
55
**Owner:** Hack23 AB (Org.nr 5595347807)
66
**Version:** 1.0.0
77

@@ -29,7 +29,7 @@ Daily workflow at 03:00 CET: `.github/workflows/update-cia-stats.yml`
2929

3030
## Key Statistics
3131

32-
From CIA Production Database (2026-02-09):
32+
From CIA Production Database (example from 2026-02-09):
3333

3434
| Metric | Value |
3535
|--------|-------|
@@ -39,6 +39,8 @@ From CIA Production Database (2026-02-09):
3939
| **Total Documents** | 109,259 |
4040
| **Rule Violations** | 2,308 |
4141

42+
**Note**: For current statistics, check `cia-data/production-stats.json` metadata.last_updated.
43+
4244
**Source**: [extraction_summary_report.csv](https://github.com/Hack23/cia/blob/master/service.data.impl/sample-data/extraction_summary_report.csv)
4345

4446
## Implementation

index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,7 +1590,7 @@ <h3>Languages</h3>
15901590
const cellWidth = 15;
15911591
const cellHeight = 15;
15921592
const width = 45 * cellWidth + margin.left + margin.right;
1593-
const height = 349 * cellHeight + margin.top + margin.bottom; // Current MPs // Current MPs
1593+
const height = 349 * cellHeight + margin.top + margin.bottom; // Current MPs
15941594

15951595
// Create SVG
15961596
const svg = container.append('svg')
@@ -1624,7 +1624,7 @@ <h3>Languages</h3>
16241624

16251625
const yScale = d3.scaleBand()
16261626
.domain(politicians)
1627-
.range([0, 349 * cellHeight]) // Current MPs // Current MPs
1627+
.range([0, 349 * cellHeight]) // Current MPs
16281628
.padding(0.05);
16291629

16301630
// Create main group
@@ -1634,7 +1634,7 @@ <h3>Languages</h3>
16341634
// Add zoom behavior
16351635
const zoom = d3.zoom()
16361636
.scaleExtent([1, 10])
1637-
.translateExtent([[0, 0], [45 * cellWidth, 349 * cellHeight]]) // Current MPs // Current MPs
1637+
.translateExtent([[0, 0], [45 * cellWidth, 349 * cellHeight]]) // Current MPs
16381638
.on('zoom', (event) => {
16391639
g.attr('transform', `translate(${margin.left + event.transform.x},${margin.top + event.transform.y}) scale(${event.transform.k})`);
16401640
});

index_ar.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<!-- Open Graph / Social Media -->
1515
<meta property="og:title" content="الانتخابات السويدية 2026 | منصة الاستخبارات المباشرة">
16-
<meta property="og:description" content="Real-time monitoring · Coalition predictions · Systematic transparency. 45 risk rules tracking 349 MPs (2,494 historical politicians in database).">
16+
<meta property="og:description" content="المراقبة في الوقت الفعلي · توقعات التحالفات · الشفافية المنهجية. 45 قاعدة مخاطر لتتبع 349 عضو برلماني. برنامج تجريبي لوسائل الإعلام السويدية والعالمية.">
1717
<meta property="og:locale" content="ar_SA">
1818
<meta property="og:locale:alternate" content="da_DK">
1919
<meta property="og:locale:alternate" content="de_DE">
@@ -35,7 +35,7 @@
3535
<!-- Twitter Card -->
3636
<meta name="twitter:card" content="summary_large_image">
3737
<meta name="twitter:title" content="الانتخابات السويدية 2026 | منصة الاستخبارات المباشرة">
38-
<meta name="twitter:description" content="Real-time monitoring of 349 MPs across 8 parties · Coalition predictions with 45 risk rules · Election forecasting · Track Swedish politics 24/7 · 2,494 historical politicians tracked">
38+
<meta name="twitter:description" content="المراقبة في الوقت الفعلي لـ 349 عضو برلماني، توقعات التحالفات، 45 قاعدة مخاطر. برنامج تجريبي للمؤسسات الإعلامية.">
3939
<meta name="twitter:image" content="https://cia.sourceforge.io/cia-logo.png">
4040
<meta name="twitter:site" content="@hack23ab">
4141
<meta name="twitter:creator" content="@jamessorling">

index_he.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<!-- Open Graph / Social Media -->
1515
<meta property="og:title" content="בחירות שבדיה 2026 | פלטפורמת מודיעין חי">
16-
<meta property="og:description" content="Real-time monitoring · Coalition predictions · Systematic transparency. 45 risk rules tracking 349 MPs (2,494 historical politicians in database).">
16+
<meta property="og:description" content="ניטור בזמן אמת · תחזיות קואליציות · שקיפות שיטתית. 45 כללי סיכון עוקבים אחר 349 חברי פרלמנט. תוכנית פיילוט לתקשורת שבדית וגלובלית.">
1717
<meta property="og:locale" content="he_IL">
1818
<meta property="og:locale:alternate" content="ar_SA">
1919
<meta property="og:locale:alternate" content="da_DK">
@@ -34,7 +34,7 @@
3434
<meta property="og:site_name" content="Hack23 AB - סוכנות מודיעין אזרחי"><!-- Twitter Card -->
3535
<meta name="twitter:card" content="summary_large_image">
3636
<meta name="twitter:title" content="בחירות שבדיה 2026 | פלטפורמת מודיעין חי">
37-
<meta name="twitter:description" content="Real-time monitoring of 349 MPs across 8 parties · Coalition predictions with 45 risk rules · Election forecasting · Track Swedish politics 24/7 · 2,494 historical politicians tracked">
37+
<meta name="twitter:description" content="ניטור בזמן אמת של 349 חברי פרלמנט, תחזיות קואליציות, 45 כללי סיכון. תוכנית פיילוט לארגוני תקשורת.">
3838
<meta name="twitter:image" content="https://cia.sourceforge.io/cia-logo.png">
3939
<meta name="twitter:site" content="@hack23ab">
4040
<meta name="twitter:creator" content="@jamessorling">

index_ja.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<!-- Open Graph / Social Media -->
1515
<meta property="og:title" content="スウェーデン総選挙2026 | リアルタイム情報プラットフォーム">
16-
<meta property="og:description" content="Real-time monitoring · Coalition predictions · Systematic transparency. 45 risk rules tracking 349 MPs (2,494 historical politicians in database).">
16+
<meta property="og:description" content="リアルタイム監視 · 連立予測 · 体系的な透明性。349名の国会議員を追跡する45のリスクルール。スウェーデンおよびグローバルメディア向けパイロットプログラム。">
1717
<meta property="og:locale" content="ja_JP">
1818
<meta property="og:locale:alternate" content="ar_SA">
1919
<meta property="og:locale:alternate" content="da_DK">
@@ -36,7 +36,7 @@
3636
<!-- Twitter Card -->
3737
<meta name="twitter:card" content="summary_large_image">
3838
<meta name="twitter:title" content="スウェーデン総選挙2026 | リアルタイム情報プラットフォーム">
39-
<meta name="twitter:description" content="Real-time monitoring of 349 MPs across 8 parties · Coalition predictions with 45 risk rules · Election forecasting · Track Swedish politics 24/7 · 2,494 historical politicians tracked">
39+
<meta name="twitter:description" content="349名の国会議員のリアルタイム監視、連立予測、45のリスクルール。メディア組織向けパイロットプログラム。">
4040
<meta name="twitter:image" content="https://cia.sourceforge.io/cia-logo.png">
4141
<meta name="twitter:site" content="@hack23ab">
4242
<meta name="twitter:creator" content="@jamessorling">

index_ko.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<!-- Open Graph / Social Media -->
1515
<meta property="og:title" content="스웨덴 2026년 선거 | 실시간 인텔리전스 플랫폼">
16-
<meta property="og:description" content="Real-time monitoring · Coalition predictions · Systematic transparency. 45 risk rules tracking 349 MPs (2,494 historical politicians in database).">
16+
<meta property="og:description" content="실시간 모니터링 · 연정 예측 · 체계적 투명성. 45개 위험 규칙으로 349명 의원 추적. 스웨덴 및 글로벌 미디어 파일럿 프로그램.">
1717
<meta property="og:locale" content="ko_KR">
1818
<meta property="og:locale:alternate" content="ar_SA">
1919
<meta property="og:locale:alternate" content="da_DK">
@@ -35,7 +35,7 @@
3535
<!-- Twitter Card -->
3636
<meta name="twitter:card" content="summary_large_image">
3737
<meta name="twitter:title" content="스웨덴 2026년 선거 | 실시간 인텔리전스 플랫폼">
38-
<meta name="twitter:description" content="Real-time monitoring of 349 MPs across 8 parties · Coalition predictions with 45 risk rules · Election forecasting · Track Swedish politics 24/7 · 2,494 historical politicians tracked">
38+
<meta name="twitter:description" content="349명 의원 실시간 모니터링, 연정 예측, 45개 위험 규칙. 미디어 조직을 위한 파일럿 프로그램.">
3939
<meta name="twitter:image" content="https://cia.sourceforge.io/cia-logo.png">
4040
<meta name="twitter:site" content="@hack23ab">
4141
<meta name="twitter:creator" content="@jamessorling">

index_zh.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<!-- Open Graph / Social Media -->
1515
<meta property="og:title" content="瑞典2026年选举 | 实时情报平台">
16-
<meta property="og:description" content="Real-time monitoring · Coalition predictions · Systematic transparency. 45 risk rules tracking 349 MPs (2,494 historical politicians in database).">
16+
<meta property="og:description" content="实时监控 · 联盟预测 · 系统透明度。45条风险规则跟踪349名议员。面向瑞典和全球媒体的试点项目。">
1717
<meta property="og:locale" content="zh_CN">
1818
<meta property="og:locale:alternate" content="ar_SA">
1919
<meta property="og:locale:alternate" content="da_DK">
@@ -36,7 +36,7 @@
3636
<!-- Twitter Card -->
3737
<meta name="twitter:card" content="summary_large_image">
3838
<meta name="twitter:title" content="瑞典2026年选举 | 实时情报平台">
39-
<meta name="twitter:description" content="Real-time monitoring of 349 MPs across 8 parties · Coalition predictions with 45 risk rules · Election forecasting · Track Swedish politics 24/7 · 2,494 historical politicians tracked">
39+
<meta name="twitter:description" content="实时监控349名议员,联盟预测,45条风险规则。面向媒体组织的试点项目。">
4040
<meta name="twitter:image" content="https://cia.sourceforge.io/cia-logo.png">
4141
<meta name="twitter:site" content="@hack23ab">
4242
<meta name="twitter:creator" content="@jamessorling">

js/stats-loader.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,22 @@
117117
}
118118

119119
if (el && value !== null && value !== undefined) {
120-
// Format numbers with locale separators if it's a number
121-
const displayValue = (typeof value === 'number' || !isNaN(parseInt(value)))
122-
? parseInt(value).toLocaleString()
123-
: value;
120+
// Format numbers with locale separators
121+
let displayValue = value;
122+
123+
if (typeof value === 'number') {
124+
displayValue = value.toLocaleString();
125+
} else if (typeof value === 'string') {
126+
// Normalize common grouping separators (commas, dots, spaces) before parsing
127+
const normalized = value.replace(/[,.\s]/g, '');
128+
// Only treat as numeric if the normalized value is digits-only
129+
if (/^[0-9]+$/.test(normalized)) {
130+
const numericValue = Number(normalized);
131+
displayValue = numericValue.toLocaleString();
132+
}
133+
// Otherwise keep the original string value
134+
}
135+
124136
el.textContent = displayValue;
125137
}
126138
}

scripts/update-stats-from-cia.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,9 @@ function updateHTMLFile(filePath, stats) {
146146
}
147147

148148
// Update dashboard description
149-
const dashboardDescPattern = /Comprehensive intelligence analysis using 45 risk rules across \d+ MPs with statistical anomaly detection \(P90\/P99 thresholds\)/;
150-
if (dashboardDescPattern.test(content) && desc.dashboardDescription) {
151-
content = content.replace(dashboardDescPattern, 'Comprehensive intelligence analysis using 45 risk rules across 349 MPs with statistical anomaly detection (P90/P99 thresholds). Historical analysis includes 2,494 politicians (1971-2024)');
149+
const dashboardDescPattern = /Comprehensive intelligence analysis using 45 risk rules(?: \(detecting <span[^>]*>\d+<\/span> violations\))? across \d+ MPs with statistical anomaly detection \(P90\/P99 thresholds\)(?:[^<]*)?(?:<span[^>]*>\d+<\/span>[^.]*)?/;
150+
if (dashboardDescPattern.test(content) && desc && desc.dashboardDescription) {
151+
content = content.replace(dashboardDescPattern, desc.dashboardDescription);
152152
changeCount++;
153153
}
154154

@@ -260,7 +260,7 @@ function updateHTMLFile(filePath, stats) {
260260
const comment = `<!-- Statistics Section -->
261261
<!-- CIA Production Database Stats (as of ${stats.metadata.last_updated}):
262262
- Current MPs: ${currentMPs}
263-
- Historical Politicians: ${historicalPoliticians.toLocaleString()} (1971-2024)
263+
- Historical Politicians: ${historicalPoliticians} (1971-2024)
264264
- Total Votes: ${totalVotes}
265265
- Total Documents: ${totalDocuments}
266266
- Rule Violations: ${ruleViolations}

0 commit comments

Comments
 (0)