Skip to content

Commit 07203e6

Browse files
authored
Merge branch 'main' into main-3064a16c0a557b21
2 parents e90f115 + b9158c2 commit 07203e6

12 files changed

Lines changed: 1657 additions & 26 deletions

File tree

.github/workflows/news-evening-analysis.md

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -283,18 +283,28 @@ const results = rawResults.filter(item => {
283283
});
284284
```
285285

286-
**Date calculation pattern** (day-granularity — `.split('T')[0]` truncates to YYYY-MM-DD):
286+
**Date calculation pattern** (day-granularity — `.toISOString().slice(0, 10)` truncates to YYYY-MM-DD):
287287
```javascript
288-
const today = new Date().toISOString().split('T')[0];
289-
const dayOfWeek = new Date().getUTCDay(); // 0=Sunday, 6=Saturday
290-
const lookbackDays = dayOfWeek === 6 ? 5 : Math.ceil(12 / 24); // Saturday=5 days, else ceil(hours/24)
291-
const fromDate = new Date(Date.now() - lookbackDays * 86400000).toISOString().split('T')[0];
288+
const now = new Date();
289+
const lookback_hours = 12; // default; override via workflow input
290+
const lookbackHours = Number(lookback_hours);
291+
if (!Number.isFinite(lookbackHours) || !Number.isInteger(lookbackHours) || lookbackHours <= 0) {
292+
throw new Error('Invalid lookback_hours');
293+
}
294+
const lookbackMs = lookbackHours * 3600000; // 3600000 ms per hour
295+
const fromDate = new Date(now.getTime() - lookbackMs).toISOString().slice(0, 10);
296+
// For weekly review (Saturday): 5 * 86400000 ms = 5 days
297+
const weekStart = new Date(now.getTime() - 5 * 86400000).toISOString().slice(0, 10);
298+
const today = now.toISOString().slice(0, 10);
292299
```
293300

294301
**Post-query filtering example:**
295302
```javascript
296303
const results = await get_betankanden({ rm: currentRm, limit: 50 });
297-
const recent = results.filter(b => (b.publicerad || '').slice(0, 10) >= fromDate);
304+
const recent = results.filter(item => {
305+
const itemDate = (item.datum || item.publicerad || item.inlämnad || '').slice(0, 10);
306+
return itemDate >= fromDate;
307+
});
298308
```
299309

300310
**Date calculation example:**
@@ -317,6 +327,29 @@ const todayVotes = votes.filter(v => v.datum?.slice(0, 10) >= fromDate);
317327
318328
Cross-reference related data sources for richer analysis. Filter all results by date to `>= fromDate`.
319329
330+
#### Example 1: Committee Report Deep Dive
331+
```
332+
// 1. Fetch committee reports for the period
333+
// 2. For each report, look up related voting records via search_voteringar(bet: reportId)
334+
// 3. Cross-reference with any motions that reference the same bet
335+
```
336+
337+
#### Example 2: Government Activity Analysis
338+
```
339+
// 1. Get government propositions (get_propositioner)
340+
// 2. Search for committee reports (get_betankanden) that reference each proposition
341+
// 3. Look up debate speeches (search_anforanden) on the same topic
342+
```
343+
344+
#### Example 3: Party Behavior Analysis
345+
```
346+
// 1. Get voting records grouped by party (search_voteringar with groupBy: parti)
347+
// 2. Cross-reference with motions filed by each party
348+
// 3. Identify where parties voted against their own motions
349+
```
350+
351+
### Detailed Code Examples
352+
320353
**Example 1: Committee Report Deep Dive**
321354
```javascript
322355
// Setup: riksmöte + date threshold (ISO-string comparison — timezone-safe)

news/metadata/quality-metrics.schema.json

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,59 @@
7171
"hasAllPillars": {
7272
"type": "boolean",
7373
"description": "Whether all 5 Editorial Pillars are present (evening-analysis only)"
74+
},
75+
"dimensions": {
76+
"type": "object",
77+
"description": "6-dimension quality scores from multi-pass assessment (0–100 each)",
78+
"properties": {
79+
"factualAccuracy": {
80+
"type": "number",
81+
"minimum": 0,
82+
"maximum": 100,
83+
"description": "Factual accuracy score (25% weight)"
84+
},
85+
"stakeholderCoverage": {
86+
"type": "number",
87+
"minimum": 0,
88+
"maximum": 100,
89+
"description": "Stakeholder coverage score (20% weight)"
90+
},
91+
"analyticalDepth": {
92+
"type": "number",
93+
"minimum": 0,
94+
"maximum": 100,
95+
"description": "Analytical depth score (20% weight)"
96+
},
97+
"editorialConsistency": {
98+
"type": "number",
99+
"minimum": 0,
100+
"maximum": 100,
101+
"description": "Editorial consistency score (15% weight)"
102+
},
103+
"evidenceQuality": {
104+
"type": "number",
105+
"minimum": 0,
106+
"maximum": 100,
107+
"description": "Evidence quality score (10% weight)"
108+
},
109+
"languageQuality": {
110+
"type": "number",
111+
"minimum": 0,
112+
"maximum": 100,
113+
"description": "Language quality score (10% weight)"
114+
}
115+
}
116+
},
117+
"multidimensionalOverallScore": {
118+
"type": "number",
119+
"minimum": 0,
120+
"maximum": 100,
121+
"description": "Weighted overall score from multi-dimensional assessment"
122+
},
123+
"assessmentPasses": {
124+
"type": "integer",
125+
"minimum": 2,
126+
"description": "Number of quality assessment passes performed (always ≥ 2)"
74127
}
75128
},
76129
"required": ["qualityScore", "analyticalDepth", "wordCount"]

news/metadata/quality-scores.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

0 commit comments

Comments
 (0)