Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | 594x 192x 17x 125x 77x 101x 16x 21x 45x | /**
* @module data-transformers
* @description Barrel re-export preserving the original public API.
* All consumers that previously imported from `./data-transformers.js`
* continue to work without changes via this barrel file.
*
* The monolithic module has been decomposed into bounded-context modules:
* - **types** — shared interfaces (RawCalendarEvent, RawDocument, …)
* - **constants** — CONTENT_LABELS, COMMITTEE_NAMES, LOCALE_MAP
* - **helpers** — utility functions (sanitizeUrl, svSpan, L, date formatting, …)
* - **calendar** — transformCalendarToEventGrid, extractWatchPoints, extractTopics
* - **content-generators** — per-article-type HTML generators
* - **policy-analysis** — detectPolicyDomains, generatePolicySignificance, …
* - **document-analysis** — groupMotionsByProposition, renderMotionEntry, …
* - **metadata** — generateMetadata, calculateReadTime, generateContentTitle, …
*
* @author Hack23 AB
* @license Apache-2.0
*/
// ── Re-export types ────────────────────────────────────────────────────────
export type {
RawCalendarEvent,
RawDocument,
CIAContext,
WeekAheadData,
ArticleContentData,
MonthlyMetrics,
} from './types.js';
// ── Re-export constants ────────────────────────────────────────────────────
export { CONTENT_LABELS } from './constants.js';
// ── Re-export helpers ──────────────────────────────────────────────────────
export { L, isPersonProfileText, formatDocumentDate, filterFreshDocuments } from './helpers.js';
// ── Re-export calendar ─────────────────────────────────────────────────────
export { transformCalendarToEventGrid, extractTopics, extractWatchPoints } from './calendar.js';
// ── Re-export document analysis ────────────────────────────────────────────
export { groupMotionsByProposition, groupPropositionsByCommittee, calculateInfluenceScore } from './document-analysis.js';
// ── Re-export policy analysis (confidence levels & narrative framing) ──────
export type { ConfidenceLevel, NarrativeFrame } from './policy-analysis.js';
export { assessConfidenceLevel, detectNarrativeFrames } from './policy-analysis.js';
// ── Re-export risk analysis ────────────────────────────────────────────────
export type { RiskLevel, CoalitionRiskIndex, CoalitionRiskComponents, AnomalyFlag, TrendDirection, TrendDataPoint, TrendComparison } from './risk-analysis.js';
export { calculateCoalitionRiskIndex, detectAnomalousPatterns, generateTrendComparison } from './risk-analysis.js';
// ── Re-export SWOT & Dashboard section generators ─────────────────────────
export {
generateSwotSection,
generateDashboardSection,
generateStakeholderSwotSection,
generateEconomicDashboardSection,
findIndicatorsForDomains,
buildEconomicCharts,
buildEconomicTables,
scoreNewsworthiness,
generateMindmapSection,
generateSankeySection,
generateCiaOverviewSection,
buildAIMindmapAnalysis,
buildMindmapOptionsFromAnalysis,
generateInterpellationsContent,
} from './content-generators.js';
export type {
SwotSectionOptions,
DashboardSectionOptions,
StakeholderSwotSectionOptions,
StakeholderSwot,
EconomicDashboardOptions,
EconomicDataPoint,
NewsworthinessScore,
NewsworthinessDimension,
MindmapSectionOptions,
MindmapBranch,
MindmapBranchColor,
MindmapDimension,
AIMindmapItem,
AIMindmapItemWeight,
SubBranch,
MindmapConnection,
AIMindmapAnalysis,
SankeySectionOptions,
SankeyNode,
SankeyFlow,
SankeyNodeColor,
CiaOverviewSectionOptions,
} from './content-generators.js';
// ── Re-export metadata ─────────────────────────────────────────────────────
export {
generateMetadata,
calculateReadTime,
generateContentTitle,
generateSources,
} from './metadata.js';
// ── Re-export content generation (dispatcher) ──────────────────────────────
import type { Language } from '../types/language.js';
import type { ArticleType } from '../types/article.js';
import type { ArticleContentData, WeekAheadData } from './types.js';
import {
generateWeekAheadContent,
generateCommitteeContent,
generatePropositionsContent,
generateMotionsContent,
generateInterpellationsContent,
generateGenericContent,
generateMonthlyReviewContent,
generateMonthAheadContent,
} from './content-generators.js';
/**
* Generate article content from MCP data.
* Dispatches to the appropriate content generator based on article type.
*
* @param data - Structured data from MCP API calls
* @param type - Article type determining the rendering strategy
* @param lang - Target language (defaults to English)
* @returns Generated HTML content string
*/
export function generateArticleContent(
data: ArticleContentData,
type: ArticleType | string,
lang: Language = 'en',
): string {
switch (type) {
case 'week-ahead':
return generateWeekAheadContent(data as WeekAheadData, lang);
case 'month-ahead':
return generateMonthAheadContent(data, lang);
case 'committee-reports':
return generateCommitteeContent(data, lang);
case 'propositions':
return generatePropositionsContent(data, lang);
case 'motions':
return generateMotionsContent(data, lang);
case 'interpellations':
return generateInterpellationsContent(data, lang);
case 'monthly-review':
return generateMonthlyReviewContent(data, lang);
case 'weekly-review':
case 'breaking':
default:
return generateGenericContent(data, lang);
}
}
|