All files / scripts/committees-dashboard types.ts

0% Statements 0/0
0% Branches 0/0
0% Functions 0/0
0% Lines 0/0

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                                                                                                                                                                                                                                                                               
/**
 * @module Analytics/CommitteeIntelligence/Types
 * @description TypeScript type and interface declarations for the Committee Intelligence Dashboard.
 * All interfaces used across the committee dashboard modules are defined here.
 *
 * @author Hack23 AB
 * @license Apache-2.0
 */
 
 
/// <reference lib="dom" />
 
import type { SimulationNodeDatum, SimulationLinkDatum } from 'd3';
 
// Chart.js and Papa Parse are loaded as browser globals via script tags
declare const Chart: any;
declare const Papa: {
  parse(input: string, config?: {
    header?: boolean;
    dynamicTyping?: boolean;
    skipEmptyLines?: boolean;
  }): { data: Record<string, any>[]; errors: { message: string }[] };
};
 
// ==============================================
// INTERFACES
// ==============================================
 
export interface CommitteeNameLocalized {
  sv: string;
  en: string;
}
 
export interface CommitteeDefinition {
  code: string;
  name: string;
  nameLocalized: CommitteeNameLocalized;
  color: string;
  domain: string;
}
 
export interface CacheConfig {
  enabled: boolean;
  ttl: number;
  prefix: string;
}
 
export interface DimensionSpec {
  width: number;
  height: number;
}
 
export interface DimensionsConfig {
  network: DimensionSpec;
  heatmap: DimensionSpec;
  chart: { aspectRatio: number };
}
 
export interface DataUrlsConfig {
  productivityMatrix: string[];
  committeeDecisions: string[];
  annualDocuments: string[];
  ballotSummary: string[];
  seasonalPatterns: string[];
}
 
export interface AppConfig {
  dataUrls: DataUrlsConfig;
  cache: CacheConfig;
  committees: CommitteeDefinition[];
  dimensions: DimensionsConfig;
}
 
export interface ProductivityMatrixRow {
  committee_code?: string;
  year?: string | number;
  productivity_level?: string;
  [key: string]: any;
}
 
export interface AnnualDocumentRow {
  committee?: string;
  year?: string | number;
  doc_count?: string | number;
  [key: string]: any;
}
 
export interface SeasonalPatternRow {
  year?: string | number;
  quarter?: string | number;
  median?: string | number;
  total_ballots?: string | number;
  value?: string | number;
  [key: string]: any;
}
 
export interface CommitteeData {
  productivityMatrix: ProductivityMatrixRow[];
  committeeDecisions: Record<string, any>[];
  annualDocuments: AnnualDocumentRow[];
  ballotSummary: Record<string, any>[];
  seasonalPatterns: SeasonalPatternRow[];
}
 
export interface NetworkNode extends SimulationNodeDatum {
  id: string;
  code: string;
  name: string;
  color: string;
  productivity: number;
  decisions: number;
  radius: number;
}
 
export interface NetworkLink extends SimulationLinkDatum<NetworkNode> {
  value: number;
}
 
export interface HeatMapCell {
  committee: string;
  year: string;
  value: number;
}
 
export interface HeatMapData {
  matrix: HeatMapCell[];
  years: string[];
  committees: string[];
}
 
export interface CacheEntry {
  data: Record<string, any>[];
  timestamp: number;
}