@dra2020/dra-types 1.8.124 → 1.8.126
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/datasets.d.ts +7 -0
- package/dist/dra-types.js +7 -1
- package/dist/dra-types.js.map +1 -1
- package/lib/datasets.ts +12 -3
- package/package.json +1 -1
package/lib/datasets.ts
CHANGED
|
@@ -65,12 +65,14 @@ export interface DatasetMeta
|
|
|
65
65
|
type: string, // demographic | election | pvi | other
|
|
66
66
|
year: number, // 4 digit year
|
|
67
67
|
title: string, // title displayed in UI
|
|
68
|
+
builtin?: string, // builtin key for builtin datasets
|
|
68
69
|
description?: string, // longer description
|
|
69
|
-
office?: string, // pres | comp | sc | sen | con | tre | sos | ltgov | gov | ag
|
|
70
|
+
office?: string, // pres | comp | sc | sen | con | tre | sos | ltgov | gov | ag and more
|
|
70
71
|
subtype?: string, // always general?
|
|
71
|
-
votingAge?: boolean, //
|
|
72
|
-
nhAlone?: boolean, //
|
|
72
|
+
votingAge?: boolean, // true => VAP or CVAP; false => Total population (from Census or ACS or Adjusted)
|
|
73
|
+
nhAlone?: boolean, // Non-Hispanic Alone demographic variant
|
|
73
74
|
privateKey?: string, // Old-style semi-private datasets
|
|
75
|
+
restrict?: { [key: string]: boolean }, // export, display, duplicate (true => function is not allowed)
|
|
74
76
|
members?: { [key: number]: string }, // For composites, specifies
|
|
75
77
|
fields?: DatasetFields,
|
|
76
78
|
colors?: DatasetColors, // Optional colorby expressions
|
|
@@ -106,5 +108,12 @@ export interface Dataset
|
|
|
106
108
|
labels?: string[],
|
|
107
109
|
}
|
|
108
110
|
|
|
111
|
+
export function datasetRestrict(ds: Dataset): { [key: string]: boolean }
|
|
112
|
+
{
|
|
113
|
+
if (ds && ds.id && ds.meta && ds.meta[ds.id] && ds.meta[ds.id].restrict)
|
|
114
|
+
return ds.meta[ds.id].restrict;
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
|
|
109
118
|
// Index of database records
|
|
110
119
|
export type DatasetIndex = { [id: string]: Dataset };
|