triangle-types 1.0.52 → 1.0.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/types/federal_congress/FederalCongressBill.d.ts +1 -1
- package/dist/src/types/federal_congress/FederalCongressBill.js +3 -3
- package/dist/src/types/federal_congress/FederalCongressBillDocument.d.ts +1 -1
- package/dist/src/types/federal_congress/FederalCongressBillDocument.js +3 -3
- package/dist/src/types/federal_congress/FederalCongressDistrict.d.ts +10 -0
- package/dist/src/types/federal_congress/FederalCongressDistrict.js +26 -0
- package/dist/src/types/prism/Prism.d.ts +3 -3
- package/dist/src/types/prism/Prism.js +9 -9
- package/dist/src/types/prism/Voter.d.ts +5 -4
- package/dist/src/types/prism/Voter.js +11 -10
- package/dist/src/types/prism/VoterTarget.d.ts +6 -1
- package/dist/src/types/prism/VoterTarget.js +17 -4
- package/dist/src/types/prism/VoterTurnout.d.ts +5 -1
- package/dist/src/types/prism/VoterTurnout.js +15 -4
- package/dist/src/types/state_legislature/StateLegislatureDistrict.d.ts +10 -0
- package/dist/src/types/state_legislature/StateLegislatureDistrict.js +26 -0
- package/package.json +1 -1
- package/src/types/federal_congress/FederalCongressBill.ts +3 -3
- package/src/types/federal_congress/FederalCongressBillDocument.ts +3 -3
- package/src/types/federal_congress/FederalCongressDistrict.ts +33 -0
- package/src/types/prism/Prism.ts +9 -9
- package/src/types/prism/Voter.ts +12 -11
- package/src/types/prism/VoterTarget.ts +18 -4
- package/src/types/prism/VoterTurnout.ts +17 -5
- package/src/types/state_legislature/StateLegislatureDistrict.ts +33 -0
|
@@ -3,7 +3,7 @@ export type FederalCongressBillTypeID = typeof federal_congress_bill_type_ids[nu
|
|
|
3
3
|
export declare function is_federal_congress_bill_type_id(federal_congress_bill_type_id: any): federal_congress_bill_type_id is FederalCongressBillTypeID;
|
|
4
4
|
export declare class FederalCongressBill {
|
|
5
5
|
readonly federal_congress_bill_id: string;
|
|
6
|
-
readonly
|
|
6
|
+
readonly federal_congress_id: number;
|
|
7
7
|
readonly bill_type_id: FederalCongressBillTypeID;
|
|
8
8
|
readonly number: number;
|
|
9
9
|
readonly bill_id: string;
|
|
@@ -4,7 +4,7 @@ export function is_federal_congress_bill_type_id(federal_congress_bill_type_id)
|
|
|
4
4
|
}
|
|
5
5
|
export class FederalCongressBill {
|
|
6
6
|
federal_congress_bill_id;
|
|
7
|
-
|
|
7
|
+
federal_congress_id;
|
|
8
8
|
bill_type_id;
|
|
9
9
|
number;
|
|
10
10
|
bill_id;
|
|
@@ -18,7 +18,7 @@ export class FederalCongressBill {
|
|
|
18
18
|
throw Error("Invalid input.");
|
|
19
19
|
}
|
|
20
20
|
this.federal_congress_bill_id = federal_congress_bill.federal_congress_bill_id;
|
|
21
|
-
this.
|
|
21
|
+
this.federal_congress_id = federal_congress_bill.federal_congress_id;
|
|
22
22
|
this.bill_type_id = federal_congress_bill.bill_type_id;
|
|
23
23
|
this.number = federal_congress_bill.number;
|
|
24
24
|
this.bill_id = federal_congress_bill.bill_id;
|
|
@@ -31,7 +31,7 @@ export class FederalCongressBill {
|
|
|
31
31
|
static is(federal_congress_bill) {
|
|
32
32
|
return (federal_congress_bill !== undefined &&
|
|
33
33
|
typeof federal_congress_bill.federal_congress_bill_id === "string" &&
|
|
34
|
-
typeof federal_congress_bill.
|
|
34
|
+
typeof federal_congress_bill.federal_congress_id === "number" &&
|
|
35
35
|
is_federal_congress_bill_type_id(federal_congress_bill.bill_type_id) &&
|
|
36
36
|
typeof federal_congress_bill.number === "number" &&
|
|
37
37
|
typeof federal_congress_bill.bill_id === "string" &&
|
|
@@ -6,7 +6,7 @@ export declare class FederalCongressBillDocument {
|
|
|
6
6
|
readonly federal_congress_bill_document_id: string;
|
|
7
7
|
readonly federal_congress_bill_id: string;
|
|
8
8
|
readonly document_id: string;
|
|
9
|
-
readonly
|
|
9
|
+
readonly federal_congress_id: number;
|
|
10
10
|
readonly bill_id: string;
|
|
11
11
|
readonly bill_type_id: FederalCongressBillTypeID;
|
|
12
12
|
readonly number: number;
|
|
@@ -8,7 +8,7 @@ export class FederalCongressBillDocument {
|
|
|
8
8
|
federal_congress_bill_document_id;
|
|
9
9
|
federal_congress_bill_id;
|
|
10
10
|
document_id;
|
|
11
|
-
|
|
11
|
+
federal_congress_id;
|
|
12
12
|
bill_id;
|
|
13
13
|
bill_type_id;
|
|
14
14
|
number;
|
|
@@ -22,7 +22,7 @@ export class FederalCongressBillDocument {
|
|
|
22
22
|
}
|
|
23
23
|
this.federal_congress_bill_document_id = federal_congress_bill_document.federal_congress_bill_document_id;
|
|
24
24
|
this.federal_congress_bill_id = federal_congress_bill_document.federal_congress_bill_id;
|
|
25
|
-
this.
|
|
25
|
+
this.federal_congress_id = federal_congress_bill_document.federal_congress_id;
|
|
26
26
|
this.bill_id = federal_congress_bill_document.bill_id;
|
|
27
27
|
this.bill_type_id = federal_congress_bill_document.bill_type_id;
|
|
28
28
|
this.number = federal_congress_bill_document.number;
|
|
@@ -36,7 +36,7 @@ export class FederalCongressBillDocument {
|
|
|
36
36
|
return (federal_congress_bill_document !== undefined &&
|
|
37
37
|
typeof federal_congress_bill_document.federal_congress_bill_document_id === "string" &&
|
|
38
38
|
typeof federal_congress_bill_document.federal_congress_bill_id === "string" &&
|
|
39
|
-
typeof federal_congress_bill_document.
|
|
39
|
+
typeof federal_congress_bill_document.federal_congress_id === "number" &&
|
|
40
40
|
typeof federal_congress_bill_document.bill_id === "string" &&
|
|
41
41
|
typeof federal_congress_bill_document.bill_type_id === "string" &&
|
|
42
42
|
typeof federal_congress_bill_document.number === "number" &&
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { StateID } from "../State.js";
|
|
2
|
+
export declare class FederalCongressDistrict {
|
|
3
|
+
readonly federal_congress_district_id: string;
|
|
4
|
+
readonly congress_id: number;
|
|
5
|
+
readonly chamber_id: string;
|
|
6
|
+
readonly state_id: StateID;
|
|
7
|
+
readonly district_id: number;
|
|
8
|
+
constructor(federal_congress_district: any);
|
|
9
|
+
static is(federal_congress_district: any): federal_congress_district is FederalCongressDistrict;
|
|
10
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { is_state_id } from "../State.js";
|
|
2
|
+
export class FederalCongressDistrict {
|
|
3
|
+
federal_congress_district_id;
|
|
4
|
+
congress_id;
|
|
5
|
+
chamber_id;
|
|
6
|
+
state_id;
|
|
7
|
+
district_id;
|
|
8
|
+
constructor(federal_congress_district) {
|
|
9
|
+
if (!FederalCongressDistrict.is(federal_congress_district)) {
|
|
10
|
+
throw Error("Invalid input.");
|
|
11
|
+
}
|
|
12
|
+
this.federal_congress_district_id = federal_congress_district.federal_congress_district_id;
|
|
13
|
+
this.congress_id = federal_congress_district.congress_id;
|
|
14
|
+
this.chamber_id = federal_congress_district.chamber_id;
|
|
15
|
+
this.state_id = federal_congress_district.state_id;
|
|
16
|
+
this.district_id = federal_congress_district.district_id;
|
|
17
|
+
}
|
|
18
|
+
static is(federal_congress_district) {
|
|
19
|
+
return (federal_congress_district !== undefined &&
|
|
20
|
+
typeof federal_congress_district.federal_congress_district_id === "string" &&
|
|
21
|
+
typeof federal_congress_district.congress_id === "string" &&
|
|
22
|
+
typeof federal_congress_district.chamber_id === "string" &&
|
|
23
|
+
is_state_id(federal_congress_district.state_id) &&
|
|
24
|
+
typeof federal_congress_district === "number");
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -2,9 +2,9 @@ import { StateID } from "../State.js";
|
|
|
2
2
|
export declare class Prism {
|
|
3
3
|
readonly prism_id: string;
|
|
4
4
|
readonly state_id: StateID;
|
|
5
|
-
readonly
|
|
6
|
-
readonly
|
|
7
|
-
readonly
|
|
5
|
+
readonly federal_congress_house_district_id?: string;
|
|
6
|
+
readonly state_legislature_house_district_id?: string;
|
|
7
|
+
readonly state_legislature_senate_district_id?: string;
|
|
8
8
|
constructor(prism: any);
|
|
9
9
|
static is(prism: any): prism is Prism;
|
|
10
10
|
}
|
|
@@ -2,26 +2,26 @@ import { is_state_id } from "../State.js";
|
|
|
2
2
|
export class Prism {
|
|
3
3
|
prism_id;
|
|
4
4
|
state_id;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
federal_congress_house_district_id;
|
|
6
|
+
state_legislature_house_district_id;
|
|
7
|
+
state_legislature_senate_district_id;
|
|
8
8
|
constructor(prism) {
|
|
9
9
|
if (!Prism.is(prism)) {
|
|
10
10
|
throw Error("Invalid input.");
|
|
11
11
|
}
|
|
12
12
|
this.prism_id = prism.prism_id;
|
|
13
13
|
this.state_id = prism.state_id;
|
|
14
|
-
this.
|
|
15
|
-
this.
|
|
16
|
-
this.
|
|
14
|
+
this.federal_congress_house_district_id = prism.federal_congress_house_district_id;
|
|
15
|
+
this.state_legislature_house_district_id = prism.state_legislature_house_district_id;
|
|
16
|
+
this.state_legislature_senate_district_id = prism.state_legislature_senate_district_id;
|
|
17
17
|
}
|
|
18
18
|
static is(prism) {
|
|
19
19
|
return (prism !== undefined &&
|
|
20
20
|
typeof prism.prism_id === "string" &&
|
|
21
21
|
is_state_id(prism.state_id) &&
|
|
22
|
-
(prism.
|
|
23
|
-
(prism.
|
|
24
|
-
(prism.
|
|
22
|
+
(prism.federal_congress_house_district_id === undefined || typeof prism.federal_congress_house_district_id === "string") &&
|
|
23
|
+
(prism.state_legislature_house_district_id === undefined || typeof prism.state_legislature_house_district_id === "string") &&
|
|
24
|
+
(prism.state_legislature_senate_district_id === undefined || typeof prism.state_legislature_senate_district_id === "string"));
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
// export class PrismAux extends Prism {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { StateID } from "../State.js";
|
|
1
2
|
import { VoterTarget } from "./VoterTarget.js";
|
|
2
3
|
import { VoterTurnout } from "./VoterTurnout.js";
|
|
3
4
|
export declare class Voter {
|
|
4
5
|
readonly voter_id: string;
|
|
5
|
-
readonly state_id:
|
|
6
|
+
readonly state_id: StateID;
|
|
6
7
|
readonly state_voter_id: string;
|
|
7
8
|
readonly name_first: string;
|
|
8
9
|
readonly name_middle?: string;
|
|
@@ -23,9 +24,9 @@ export declare class Voter {
|
|
|
23
24
|
readonly address_mail_city?: string;
|
|
24
25
|
readonly address_mail_state_id: string;
|
|
25
26
|
readonly address_mail_zip?: string;
|
|
26
|
-
readonly
|
|
27
|
-
readonly
|
|
28
|
-
readonly
|
|
27
|
+
readonly federal_congress_house_district_id: string;
|
|
28
|
+
readonly state_legislature_house_district_id: string;
|
|
29
|
+
readonly state_legislature_senate_district_id: string;
|
|
29
30
|
readonly occupation_group?: string;
|
|
30
31
|
readonly occupation_description?: string;
|
|
31
32
|
readonly phone_home?: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { is_state_id } from "../State.js";
|
|
1
2
|
import { VoterTarget } from "./VoterTarget.js";
|
|
2
3
|
import { VoterTurnout } from "./VoterTurnout.js";
|
|
3
4
|
export class Voter {
|
|
@@ -23,9 +24,9 @@ export class Voter {
|
|
|
23
24
|
address_mail_city;
|
|
24
25
|
address_mail_state_id;
|
|
25
26
|
address_mail_zip;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
federal_congress_house_district_id;
|
|
28
|
+
state_legislature_house_district_id;
|
|
29
|
+
state_legislature_senate_district_id;
|
|
29
30
|
occupation_group;
|
|
30
31
|
occupation_description;
|
|
31
32
|
phone_home;
|
|
@@ -64,9 +65,9 @@ export class Voter {
|
|
|
64
65
|
this.address_mail_city = voter.address_mail_city;
|
|
65
66
|
this.address_mail_state_id = voter.address_mail_state_id;
|
|
66
67
|
this.address_mail_zip = voter.address_mail_zip;
|
|
67
|
-
this.
|
|
68
|
-
this.
|
|
69
|
-
this.
|
|
68
|
+
this.federal_congress_house_district_id = voter.federal_congress_house_district_id;
|
|
69
|
+
this.state_legislature_house_district_id = voter.state_legislature_house_district_id;
|
|
70
|
+
this.state_legislature_senate_district_id = voter.state_legislature_senate_district_id;
|
|
70
71
|
this.occupation_group = voter.occupation_group;
|
|
71
72
|
this.occupation_description = voter.occupation_description;
|
|
72
73
|
this.phone_home = voter.phone_home;
|
|
@@ -83,7 +84,7 @@ export class Voter {
|
|
|
83
84
|
static is(voter) {
|
|
84
85
|
return (voter !== undefined &&
|
|
85
86
|
typeof voter.voter_id === "string" &&
|
|
86
|
-
|
|
87
|
+
is_state_id(voter.state_id) &&
|
|
87
88
|
typeof voter.state_voter_id === "string" &&
|
|
88
89
|
typeof voter.name_first === "string" &&
|
|
89
90
|
(voter.name_middle === undefined || typeof voter.name_middle === "string") &&
|
|
@@ -104,9 +105,9 @@ export class Voter {
|
|
|
104
105
|
(voter.address_mail_city === undefined || typeof voter.address_mail_city === "string") &&
|
|
105
106
|
typeof voter.address_mail_state_id === "string" &&
|
|
106
107
|
(voter.address_mail_zip === undefined || typeof voter.address_mail_zip === "string") &&
|
|
107
|
-
typeof voter.
|
|
108
|
-
typeof voter.
|
|
109
|
-
typeof voter.
|
|
108
|
+
typeof voter.federal_congress_house_district_id === "string" &&
|
|
109
|
+
typeof voter.state_legislature_house_district_id === "string" &&
|
|
110
|
+
typeof voter.state_legislature_senate_district_id === "string" &&
|
|
110
111
|
(voter.occupation_group === undefined || typeof voter.occupation_group === "string") &&
|
|
111
112
|
(voter.occupation_description === undefined || typeof voter.occupation_description === "string") &&
|
|
112
113
|
(voter.phone_home === undefined || typeof voter.phone_home === "string") &&
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import { StateID } from "../State.js";
|
|
1
2
|
export declare class VoterTarget {
|
|
2
3
|
readonly voter_target_id: string;
|
|
3
4
|
readonly voter_id: string;
|
|
4
|
-
readonly prism_id: string;
|
|
5
5
|
readonly target_id: string;
|
|
6
|
+
readonly value: number;
|
|
7
|
+
readonly state_id: StateID;
|
|
8
|
+
readonly federal_congress_house_district_id: string;
|
|
9
|
+
readonly state_legislature_house_district_id: string;
|
|
10
|
+
readonly state_legislature_senate_district_id: string;
|
|
6
11
|
constructor(voter_target: any);
|
|
7
12
|
static is(voter_target: any): voter_target is VoterTarget;
|
|
8
13
|
}
|
|
@@ -1,22 +1,35 @@
|
|
|
1
|
+
import { is_state_id } from "../State.js";
|
|
1
2
|
export class VoterTarget {
|
|
2
3
|
voter_target_id;
|
|
3
4
|
voter_id;
|
|
4
|
-
prism_id;
|
|
5
5
|
target_id;
|
|
6
|
+
value;
|
|
7
|
+
state_id;
|
|
8
|
+
federal_congress_house_district_id;
|
|
9
|
+
state_legislature_house_district_id;
|
|
10
|
+
state_legislature_senate_district_id;
|
|
6
11
|
constructor(voter_target) {
|
|
7
12
|
if (!VoterTarget.is(voter_target)) {
|
|
8
13
|
throw Error("Invalid input.");
|
|
9
14
|
}
|
|
10
15
|
this.voter_target_id = voter_target.voter_target_id;
|
|
11
16
|
this.voter_id = voter_target.voter_id;
|
|
12
|
-
this.prism_id = voter_target.prism_id;
|
|
13
17
|
this.target_id = voter_target.target_id;
|
|
18
|
+
this.value = voter_target.value;
|
|
19
|
+
this.state_id = voter_target.state_id;
|
|
20
|
+
this.federal_congress_house_district_id = voter_target.federal_congress_house_district_id;
|
|
21
|
+
this.state_legislature_house_district_id = voter_target.state_legislature_house_district_id;
|
|
22
|
+
this.state_legislature_senate_district_id = voter_target.state_legislature_senate_district_id;
|
|
14
23
|
}
|
|
15
24
|
static is(voter_target) {
|
|
16
25
|
return (voter_target !== undefined &&
|
|
17
26
|
typeof voter_target.voter_target_id === "string" &&
|
|
18
27
|
typeof voter_target.voter_id === "string" &&
|
|
19
|
-
typeof voter_target.
|
|
20
|
-
typeof voter_target.
|
|
28
|
+
typeof voter_target.target_id === "string" &&
|
|
29
|
+
typeof voter_target.value === "number" &&
|
|
30
|
+
is_state_id(voter_target.state_id) &&
|
|
31
|
+
typeof voter_target.federal_congress_house_district_id === "string" &&
|
|
32
|
+
typeof voter_target.state_legislature_house_district_id === "string" &&
|
|
33
|
+
typeof voter_target.state_legislature_senate_district_id === "string");
|
|
21
34
|
}
|
|
22
35
|
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
import { StateID } from "../State.js";
|
|
1
2
|
export declare class VoterTurnout {
|
|
2
3
|
readonly voter_turnout_id: string;
|
|
3
4
|
readonly voter_id: string;
|
|
4
5
|
readonly turnout_id: string;
|
|
5
6
|
readonly year: number;
|
|
6
|
-
readonly state_id: string;
|
|
7
7
|
readonly turnout_type_id: string;
|
|
8
8
|
readonly value: boolean;
|
|
9
|
+
readonly state_id: StateID;
|
|
10
|
+
readonly federal_congress_house_district_id: string;
|
|
11
|
+
readonly state_legislature_house_district_id: string;
|
|
12
|
+
readonly state_legislature_senate_district_id: string;
|
|
9
13
|
constructor(voter_turnout: any);
|
|
10
14
|
static is(voter_turnout: any): voter_turnout is VoterTurnout;
|
|
11
15
|
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
import { is_state_id } from "../State.js";
|
|
1
2
|
export class VoterTurnout {
|
|
2
3
|
voter_turnout_id;
|
|
3
4
|
voter_id;
|
|
4
5
|
turnout_id;
|
|
5
6
|
year;
|
|
6
|
-
state_id;
|
|
7
7
|
turnout_type_id;
|
|
8
8
|
value;
|
|
9
|
+
state_id;
|
|
10
|
+
federal_congress_house_district_id;
|
|
11
|
+
state_legislature_house_district_id;
|
|
12
|
+
state_legislature_senate_district_id;
|
|
9
13
|
constructor(voter_turnout) {
|
|
10
14
|
if (!VoterTurnout.is(voter_turnout)) {
|
|
11
15
|
throw Error("Invalid input.");
|
|
@@ -14,9 +18,13 @@ export class VoterTurnout {
|
|
|
14
18
|
this.voter_id = voter_turnout.voter_id;
|
|
15
19
|
this.turnout_id = voter_turnout.turnout_id;
|
|
16
20
|
this.year = voter_turnout.year;
|
|
17
|
-
this.state_id = voter_turnout.state_id;
|
|
18
21
|
this.turnout_type_id = voter_turnout.turnout_type_id;
|
|
19
22
|
this.value = voter_turnout.value;
|
|
23
|
+
this.state_id = voter_turnout.state_id;
|
|
24
|
+
this.state_id = voter_turnout.state_id;
|
|
25
|
+
this.federal_congress_house_district_id = voter_turnout.federal_congress_house_district_id;
|
|
26
|
+
this.state_legislature_house_district_id = voter_turnout.state_legislature_house_district_id;
|
|
27
|
+
this.state_legislature_senate_district_id = voter_turnout.state_legislature_senate_district_id;
|
|
20
28
|
}
|
|
21
29
|
static is(voter_turnout) {
|
|
22
30
|
return (voter_turnout !== undefined &&
|
|
@@ -24,8 +32,11 @@ export class VoterTurnout {
|
|
|
24
32
|
typeof voter_turnout.voter_id === "string" &&
|
|
25
33
|
typeof voter_turnout.turnout_id === "string" &&
|
|
26
34
|
typeof voter_turnout.year === "number" &&
|
|
27
|
-
typeof voter_turnout.state_id === "string" &&
|
|
28
35
|
typeof voter_turnout.turnout_type_id === "string" &&
|
|
29
|
-
typeof voter_turnout.value === "boolean"
|
|
36
|
+
typeof voter_turnout.value === "boolean" &&
|
|
37
|
+
is_state_id(voter_turnout.state_id) &&
|
|
38
|
+
typeof voter_turnout.federal_congress_house_district_id === "string" &&
|
|
39
|
+
typeof voter_turnout.state_legislature_house_district_id === "string" &&
|
|
40
|
+
typeof voter_turnout.state_legislature_senate_district_id === "string");
|
|
30
41
|
}
|
|
31
42
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { StateID } from "../State.js";
|
|
2
|
+
export declare class StateLegislatureDistrict {
|
|
3
|
+
readonly state_legislature_district_id: string;
|
|
4
|
+
readonly legislature_id: number;
|
|
5
|
+
readonly state_id: StateID;
|
|
6
|
+
readonly chamber_id: string;
|
|
7
|
+
readonly district_id: number;
|
|
8
|
+
constructor(state_legislature_district: any);
|
|
9
|
+
static is(state_legislature_district: any): state_legislature_district is StateLegislatureDistrict;
|
|
10
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { is_state_id } from "../State.js";
|
|
2
|
+
export class StateLegislatureDistrict {
|
|
3
|
+
state_legislature_district_id;
|
|
4
|
+
legislature_id;
|
|
5
|
+
state_id;
|
|
6
|
+
chamber_id;
|
|
7
|
+
district_id;
|
|
8
|
+
constructor(state_legislature_district) {
|
|
9
|
+
if (!StateLegislatureDistrict.is(state_legislature_district)) {
|
|
10
|
+
throw Error("Invalid input.");
|
|
11
|
+
}
|
|
12
|
+
this.state_legislature_district_id = state_legislature_district.state_legislature_district_id;
|
|
13
|
+
this.legislature_id = state_legislature_district.legislature_id;
|
|
14
|
+
this.state_id = state_legislature_district.state_id;
|
|
15
|
+
this.chamber_id = state_legislature_district.chamber_id;
|
|
16
|
+
this.district_id = state_legislature_district.district_id;
|
|
17
|
+
}
|
|
18
|
+
static is(state_legislature_district) {
|
|
19
|
+
return (state_legislature_district !== undefined &&
|
|
20
|
+
typeof state_legislature_district.state_legislature_district_id === "string" &&
|
|
21
|
+
typeof state_legislature_district.legislature_id === "string" &&
|
|
22
|
+
is_state_id(state_legislature_district.state_id) &&
|
|
23
|
+
typeof state_legislature_district.chamber_id === "string" &&
|
|
24
|
+
typeof state_legislature_district === "number");
|
|
25
|
+
}
|
|
26
|
+
}
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@ export function is_federal_congress_bill_type_id(federal_congress_bill_type_id :
|
|
|
8
8
|
|
|
9
9
|
export class FederalCongressBill {
|
|
10
10
|
readonly federal_congress_bill_id : string
|
|
11
|
-
readonly
|
|
11
|
+
readonly federal_congress_id : number
|
|
12
12
|
readonly bill_type_id : FederalCongressBillTypeID
|
|
13
13
|
readonly number : number
|
|
14
14
|
readonly bill_id : string
|
|
@@ -23,7 +23,7 @@ export class FederalCongressBill {
|
|
|
23
23
|
throw Error("Invalid input.")
|
|
24
24
|
}
|
|
25
25
|
this.federal_congress_bill_id = federal_congress_bill.federal_congress_bill_id
|
|
26
|
-
this.
|
|
26
|
+
this.federal_congress_id = federal_congress_bill.federal_congress_id
|
|
27
27
|
this.bill_type_id = federal_congress_bill.bill_type_id
|
|
28
28
|
this.number = federal_congress_bill.number
|
|
29
29
|
this.bill_id = federal_congress_bill.bill_id
|
|
@@ -38,7 +38,7 @@ export class FederalCongressBill {
|
|
|
38
38
|
return (
|
|
39
39
|
federal_congress_bill !== undefined &&
|
|
40
40
|
typeof federal_congress_bill.federal_congress_bill_id === "string" &&
|
|
41
|
-
typeof federal_congress_bill.
|
|
41
|
+
typeof federal_congress_bill.federal_congress_id === "number" &&
|
|
42
42
|
is_federal_congress_bill_type_id(federal_congress_bill.bill_type_id) &&
|
|
43
43
|
typeof federal_congress_bill.number === "number" &&
|
|
44
44
|
typeof federal_congress_bill.bill_id === "string" &&
|
|
@@ -14,7 +14,7 @@ export class FederalCongressBillDocument {
|
|
|
14
14
|
readonly federal_congress_bill_document_id : string
|
|
15
15
|
readonly federal_congress_bill_id : string
|
|
16
16
|
readonly document_id : string
|
|
17
|
-
readonly
|
|
17
|
+
readonly federal_congress_id : number
|
|
18
18
|
readonly bill_id : string
|
|
19
19
|
readonly bill_type_id : FederalCongressBillTypeID
|
|
20
20
|
readonly number : number
|
|
@@ -29,7 +29,7 @@ export class FederalCongressBillDocument {
|
|
|
29
29
|
}
|
|
30
30
|
this.federal_congress_bill_document_id = federal_congress_bill_document.federal_congress_bill_document_id
|
|
31
31
|
this.federal_congress_bill_id = federal_congress_bill_document.federal_congress_bill_id
|
|
32
|
-
this.
|
|
32
|
+
this.federal_congress_id = federal_congress_bill_document.federal_congress_id
|
|
33
33
|
this.bill_id = federal_congress_bill_document.bill_id
|
|
34
34
|
this.bill_type_id = federal_congress_bill_document.bill_type_id
|
|
35
35
|
this.number = federal_congress_bill_document.number
|
|
@@ -45,7 +45,7 @@ export class FederalCongressBillDocument {
|
|
|
45
45
|
federal_congress_bill_document !== undefined &&
|
|
46
46
|
typeof federal_congress_bill_document.federal_congress_bill_document_id === "string" &&
|
|
47
47
|
typeof federal_congress_bill_document.federal_congress_bill_id === "string" &&
|
|
48
|
-
typeof federal_congress_bill_document.
|
|
48
|
+
typeof federal_congress_bill_document.federal_congress_id === "number" &&
|
|
49
49
|
typeof federal_congress_bill_document.bill_id === "string" &&
|
|
50
50
|
typeof federal_congress_bill_document.bill_type_id === "string" &&
|
|
51
51
|
typeof federal_congress_bill_document.number === "number" &&
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { is_state_id, StateID } from "../State"
|
|
2
|
+
|
|
3
|
+
export class FederalCongressDistrict {
|
|
4
|
+
readonly federal_congress_district_id : string
|
|
5
|
+
readonly congress_id : number
|
|
6
|
+
readonly chamber_id : string
|
|
7
|
+
readonly state_id : StateID
|
|
8
|
+
readonly district_id : number
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
constructor(federal_congress_district : any) {
|
|
12
|
+
if (!FederalCongressDistrict.is(federal_congress_district)) {
|
|
13
|
+
throw Error("Invalid input.")
|
|
14
|
+
}
|
|
15
|
+
this.federal_congress_district_id = federal_congress_district.federal_congress_district_id
|
|
16
|
+
this.congress_id = federal_congress_district.congress_id
|
|
17
|
+
this.chamber_id = federal_congress_district.chamber_id
|
|
18
|
+
this.state_id = federal_congress_district.state_id
|
|
19
|
+
this.district_id = federal_congress_district.district_id
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static is(federal_congress_district : any) : federal_congress_district is FederalCongressDistrict {
|
|
23
|
+
return (
|
|
24
|
+
federal_congress_district !== undefined &&
|
|
25
|
+
typeof federal_congress_district.federal_congress_district_id === "string" &&
|
|
26
|
+
typeof federal_congress_district.congress_id === "string" &&
|
|
27
|
+
typeof federal_congress_district.chamber_id === "string" &&
|
|
28
|
+
is_state_id(federal_congress_district.state_id) &&
|
|
29
|
+
typeof federal_congress_district === "number"
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
}
|
package/src/types/prism/Prism.ts
CHANGED
|
@@ -3,9 +3,9 @@ import { is_state_id, StateID } from "../State"
|
|
|
3
3
|
export class Prism {
|
|
4
4
|
readonly prism_id : string
|
|
5
5
|
readonly state_id : StateID
|
|
6
|
-
readonly
|
|
7
|
-
readonly
|
|
8
|
-
readonly
|
|
6
|
+
readonly federal_congress_house_district_id? : string
|
|
7
|
+
readonly state_legislature_house_district_id? : string
|
|
8
|
+
readonly state_legislature_senate_district_id? : string
|
|
9
9
|
|
|
10
10
|
constructor(prism : any) {
|
|
11
11
|
if (!Prism.is(prism)) {
|
|
@@ -13,9 +13,9 @@ export class Prism {
|
|
|
13
13
|
}
|
|
14
14
|
this.prism_id = prism.prism_id
|
|
15
15
|
this.state_id = prism.state_id
|
|
16
|
-
this.
|
|
17
|
-
this.
|
|
18
|
-
this.
|
|
16
|
+
this.federal_congress_house_district_id = prism.federal_congress_house_district_id
|
|
17
|
+
this.state_legislature_house_district_id = prism.state_legislature_house_district_id
|
|
18
|
+
this.state_legislature_senate_district_id = prism.state_legislature_senate_district_id
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
static is(prism : any) : prism is Prism {
|
|
@@ -23,9 +23,9 @@ export class Prism {
|
|
|
23
23
|
prism !== undefined &&
|
|
24
24
|
typeof prism.prism_id === "string" &&
|
|
25
25
|
is_state_id(prism.state_id) &&
|
|
26
|
-
(prism.
|
|
27
|
-
(prism.
|
|
28
|
-
(prism.
|
|
26
|
+
(prism.federal_congress_house_district_id === undefined || typeof prism.federal_congress_house_district_id === "string") &&
|
|
27
|
+
(prism.state_legislature_house_district_id === undefined || typeof prism.state_legislature_house_district_id === "string") &&
|
|
28
|
+
(prism.state_legislature_senate_district_id === undefined || typeof prism.state_legislature_senate_district_id === "string")
|
|
29
29
|
)
|
|
30
30
|
}
|
|
31
31
|
}
|
package/src/types/prism/Voter.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { is_state_id, StateID } from "../State"
|
|
1
2
|
import { VoterTarget } from "./VoterTarget"
|
|
2
3
|
import { VoterTurnout } from "./VoterTurnout"
|
|
3
4
|
|
|
4
5
|
export class Voter {
|
|
5
6
|
readonly voter_id : string
|
|
6
|
-
readonly state_id :
|
|
7
|
+
readonly state_id : StateID
|
|
7
8
|
readonly state_voter_id : string
|
|
8
9
|
readonly name_first : string
|
|
9
10
|
readonly name_middle? : string
|
|
@@ -24,9 +25,9 @@ export class Voter {
|
|
|
24
25
|
readonly address_mail_city? : string
|
|
25
26
|
readonly address_mail_state_id : string
|
|
26
27
|
readonly address_mail_zip? : string
|
|
27
|
-
readonly
|
|
28
|
-
readonly
|
|
29
|
-
readonly
|
|
28
|
+
readonly federal_congress_house_district_id : string
|
|
29
|
+
readonly state_legislature_house_district_id : string
|
|
30
|
+
readonly state_legislature_senate_district_id : string
|
|
30
31
|
readonly occupation_group? : string
|
|
31
32
|
readonly occupation_description? : string
|
|
32
33
|
readonly phone_home? : string
|
|
@@ -67,9 +68,9 @@ export class Voter {
|
|
|
67
68
|
this.address_mail_city = voter.address_mail_city
|
|
68
69
|
this.address_mail_state_id = voter.address_mail_state_id
|
|
69
70
|
this.address_mail_zip = voter.address_mail_zip
|
|
70
|
-
this.
|
|
71
|
-
this.
|
|
72
|
-
this.
|
|
71
|
+
this.federal_congress_house_district_id = voter.federal_congress_house_district_id
|
|
72
|
+
this.state_legislature_house_district_id = voter.state_legislature_house_district_id
|
|
73
|
+
this.state_legislature_senate_district_id = voter.state_legislature_senate_district_id
|
|
73
74
|
this.occupation_group = voter.occupation_group
|
|
74
75
|
this.occupation_description = voter.occupation_description
|
|
75
76
|
this.phone_home = voter.phone_home
|
|
@@ -88,7 +89,7 @@ export class Voter {
|
|
|
88
89
|
return (
|
|
89
90
|
voter !== undefined &&
|
|
90
91
|
typeof voter.voter_id === "string" &&
|
|
91
|
-
|
|
92
|
+
is_state_id(voter.state_id) &&
|
|
92
93
|
typeof voter.state_voter_id === "string" &&
|
|
93
94
|
typeof voter.name_first === "string" &&
|
|
94
95
|
(voter.name_middle === undefined || typeof voter.name_middle === "string") &&
|
|
@@ -109,9 +110,9 @@ export class Voter {
|
|
|
109
110
|
(voter.address_mail_city === undefined || typeof voter.address_mail_city === "string") &&
|
|
110
111
|
typeof voter.address_mail_state_id === "string" &&
|
|
111
112
|
(voter.address_mail_zip === undefined || typeof voter.address_mail_zip === "string") &&
|
|
112
|
-
typeof voter.
|
|
113
|
-
typeof voter.
|
|
114
|
-
typeof voter.
|
|
113
|
+
typeof voter.federal_congress_house_district_id === "string" &&
|
|
114
|
+
typeof voter.state_legislature_house_district_id === "string" &&
|
|
115
|
+
typeof voter.state_legislature_senate_district_id === "string" &&
|
|
115
116
|
(voter.occupation_group === undefined || typeof voter.occupation_group === "string") &&
|
|
116
117
|
(voter.occupation_description === undefined || typeof voter.occupation_description === "string") &&
|
|
117
118
|
(voter.phone_home === undefined || typeof voter.phone_home === "string") &&
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
import { is_state_id, StateID } from "../State"
|
|
2
|
+
|
|
1
3
|
export class VoterTarget {
|
|
2
4
|
readonly voter_target_id : string
|
|
3
5
|
readonly voter_id : string
|
|
4
|
-
readonly prism_id : string
|
|
5
6
|
readonly target_id : string
|
|
7
|
+
readonly value : number
|
|
8
|
+
readonly state_id : StateID
|
|
9
|
+
readonly federal_congress_house_district_id : string
|
|
10
|
+
readonly state_legislature_house_district_id : string
|
|
11
|
+
readonly state_legislature_senate_district_id : string
|
|
6
12
|
|
|
7
13
|
constructor(voter_target : any) {
|
|
8
14
|
if (!VoterTarget.is(voter_target)) {
|
|
@@ -10,8 +16,12 @@ export class VoterTarget {
|
|
|
10
16
|
}
|
|
11
17
|
this.voter_target_id = voter_target.voter_target_id
|
|
12
18
|
this.voter_id = voter_target.voter_id
|
|
13
|
-
this.prism_id = voter_target.prism_id
|
|
14
19
|
this.target_id = voter_target.target_id
|
|
20
|
+
this.value = voter_target.value
|
|
21
|
+
this.state_id = voter_target.state_id
|
|
22
|
+
this.federal_congress_house_district_id = voter_target.federal_congress_house_district_id
|
|
23
|
+
this.state_legislature_house_district_id = voter_target.state_legislature_house_district_id
|
|
24
|
+
this.state_legislature_senate_district_id = voter_target.state_legislature_senate_district_id
|
|
15
25
|
}
|
|
16
26
|
|
|
17
27
|
static is(voter_target : any) : voter_target is VoterTarget {
|
|
@@ -19,8 +29,12 @@ export class VoterTarget {
|
|
|
19
29
|
voter_target !== undefined &&
|
|
20
30
|
typeof voter_target.voter_target_id === "string" &&
|
|
21
31
|
typeof voter_target.voter_id === "string" &&
|
|
22
|
-
typeof voter_target.
|
|
23
|
-
typeof voter_target.
|
|
32
|
+
typeof voter_target.target_id === "string" &&
|
|
33
|
+
typeof voter_target.value === "number" &&
|
|
34
|
+
is_state_id(voter_target.state_id) &&
|
|
35
|
+
typeof voter_target.federal_congress_house_district_id === "string" &&
|
|
36
|
+
typeof voter_target.state_legislature_house_district_id === "string" &&
|
|
37
|
+
typeof voter_target.state_legislature_senate_district_id === "string"
|
|
24
38
|
)
|
|
25
39
|
}
|
|
26
40
|
}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
+
import { is_state_id, StateID } from "../State"
|
|
2
|
+
|
|
1
3
|
export class VoterTurnout {
|
|
2
4
|
readonly voter_turnout_id : string
|
|
3
5
|
readonly voter_id : string
|
|
4
6
|
readonly turnout_id : string
|
|
5
7
|
readonly year : number
|
|
6
|
-
readonly state_id : string
|
|
7
8
|
readonly turnout_type_id : string
|
|
8
9
|
readonly value : boolean
|
|
10
|
+
readonly state_id : StateID
|
|
11
|
+
readonly federal_congress_house_district_id : string
|
|
12
|
+
readonly state_legislature_house_district_id : string
|
|
13
|
+
readonly state_legislature_senate_district_id : string
|
|
9
14
|
|
|
10
15
|
constructor(voter_turnout : any) {
|
|
11
16
|
if (!VoterTurnout.is(voter_turnout)) {
|
|
@@ -15,9 +20,13 @@ export class VoterTurnout {
|
|
|
15
20
|
this.voter_id = voter_turnout.voter_id
|
|
16
21
|
this.turnout_id = voter_turnout.turnout_id
|
|
17
22
|
this.year = voter_turnout.year
|
|
18
|
-
this.state_id = voter_turnout.state_id
|
|
19
23
|
this.turnout_type_id = voter_turnout.turnout_type_id
|
|
20
24
|
this.value = voter_turnout.value
|
|
25
|
+
this.state_id = voter_turnout.state_id
|
|
26
|
+
this.state_id = voter_turnout.state_id
|
|
27
|
+
this.federal_congress_house_district_id = voter_turnout.federal_congress_house_district_id
|
|
28
|
+
this.state_legislature_house_district_id = voter_turnout.state_legislature_house_district_id
|
|
29
|
+
this.state_legislature_senate_district_id = voter_turnout.state_legislature_senate_district_id
|
|
21
30
|
}
|
|
22
31
|
|
|
23
32
|
static is(voter_turnout : any) : voter_turnout is VoterTurnout {
|
|
@@ -26,10 +35,13 @@ export class VoterTurnout {
|
|
|
26
35
|
typeof voter_turnout.voter_turnout_id === "string" &&
|
|
27
36
|
typeof voter_turnout.voter_id === "string" &&
|
|
28
37
|
typeof voter_turnout.turnout_id === "string" &&
|
|
29
|
-
typeof voter_turnout.year === "number"
|
|
30
|
-
typeof voter_turnout.state_id === "string" &&
|
|
38
|
+
typeof voter_turnout.year === "number"&&
|
|
31
39
|
typeof voter_turnout.turnout_type_id === "string" &&
|
|
32
|
-
typeof voter_turnout.value === "boolean"
|
|
40
|
+
typeof voter_turnout.value === "boolean" &&
|
|
41
|
+
is_state_id(voter_turnout.state_id) &&
|
|
42
|
+
typeof voter_turnout.federal_congress_house_district_id === "string" &&
|
|
43
|
+
typeof voter_turnout.state_legislature_house_district_id === "string" &&
|
|
44
|
+
typeof voter_turnout.state_legislature_senate_district_id === "string"
|
|
33
45
|
)
|
|
34
46
|
}
|
|
35
47
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { is_state_id, StateID } from "../State"
|
|
2
|
+
|
|
3
|
+
export class StateLegislatureDistrict {
|
|
4
|
+
readonly state_legislature_district_id : string
|
|
5
|
+
readonly legislature_id : number
|
|
6
|
+
readonly state_id : StateID
|
|
7
|
+
readonly chamber_id : string
|
|
8
|
+
readonly district_id : number
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
constructor(state_legislature_district : any) {
|
|
12
|
+
if (!StateLegislatureDistrict.is(state_legislature_district)) {
|
|
13
|
+
throw Error("Invalid input.")
|
|
14
|
+
}
|
|
15
|
+
this.state_legislature_district_id = state_legislature_district.state_legislature_district_id
|
|
16
|
+
this.legislature_id = state_legislature_district.legislature_id
|
|
17
|
+
this.state_id = state_legislature_district.state_id
|
|
18
|
+
this.chamber_id = state_legislature_district.chamber_id
|
|
19
|
+
this.district_id = state_legislature_district.district_id
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static is(state_legislature_district : any) : state_legislature_district is StateLegislatureDistrict {
|
|
23
|
+
return (
|
|
24
|
+
state_legislature_district !== undefined &&
|
|
25
|
+
typeof state_legislature_district.state_legislature_district_id === "string" &&
|
|
26
|
+
typeof state_legislature_district.legislature_id === "string" &&
|
|
27
|
+
is_state_id(state_legislature_district.state_id) &&
|
|
28
|
+
typeof state_legislature_district.chamber_id === "string" &&
|
|
29
|
+
typeof state_legislature_district === "number"
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
}
|