Spaces:
Sleeping
Sleeping
File size: 3,312 Bytes
e9e5ca3 | 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 | /**
* TypeScript type definitions for Paper Trail API responses
* Updated for new Supabase database schema with snake_case columns and text IDs
*/
export interface Politician {
canonical_id: string;
first_name: string;
last_name: string;
full_name: string;
party: string;
state: string;
seat: string | null;
is_active: boolean;
icpsr_id?: number;
bioguide_id?: string;
fec_candidate_id?: string;
nominate_dim1?: number;
nominate_dim2?: number;
first_elected_year?: number;
last_elected_year?: number;
}
export interface Donor {
donor_id: string; // Changed from number to string
name: string;
donor_type: string;
employer: string | null;
occupation?: string | null; // New field
state: string | null;
total_contributions_count?: number; // New field
total_amount?: number; // New field
}
export interface Donation {
transaction_id: string;
amount: number;
transaction_date: string;
industry: string | null;
election_cycle: number | null;
// Politician info (from JOIN with canonical_politician)
canonical_id: string;
first_name: string;
last_name: string;
full_name: string;
party: string;
state: string;
}
export interface DonationSummary {
industry: string;
contribution_count: number; // New field
total_amount: number;
avg_amount: number; // New field
}
export interface FilteredDonationSummaryResponse {
data: DonationSummary[];
metadata: {
topic: string;
industries_included: string[];
topic_coverage_warning: string;
};
}
interface BillTopic {
label: string;
source: 'CBP' | 'DIME' | 'CongressGov';
weight: number | null;
is_primary: boolean;
}
export interface Vote {
canonical_id: string;
vote_id: number;
vote_value: 'Yea' | 'Nay' | 'Present' | 'Not Voting';
// Rollcall info (from JOIN)
rollcall_id: number;
congress: number;
chamber: 'House' | 'Senate';
rollnumber: number;
bill_number: string | null;
bill_description: string | null;
vote_date: string;
vote_result: string | null;
has_topics: boolean;
topics: BillTopic[];
}
interface VotePagination {
currentPage: number;
totalPages: number;
totalVotes: number;
}
export interface VoteResponse {
pagination: VotePagination;
votes: Vote[];
metadata: {
topic_coverage: string;
};
}
/** Valid vote values for filtering */
export type VoteValue = 'Yea' | 'Nay' | 'Present' | 'Not Voting';
export interface VoteParams {
page?: number;
sort?: 'ASC' | 'DESC';
type?: string | string[];
subject?: string | string[];
date_from?: string; // ISO date string YYYY-MM-DD
date_to?: string; // ISO date string YYYY-MM-DD
vote_value?: VoteValue[];
search?: string; // Search bill number, description, subjects
}
interface CongressSession {
congress: number;
start: string; // ISO date string
end: string; // ISO date string
}
export interface VoteDateRangeResponse {
earliest_vote: string | null;
latest_vote: string | null;
congress_sessions: CongressSession[];
}
export interface BillSubjectsResponse {
subjects: string[];
total_subjects: number;
by_source: {
[source: string]: Array<{ subject: string; count: number }>;
};
metadata: {
coverage: string;
sources: {
CBP: string;
DIME: string;
CongressGov: string;
};
};
}
|