@mailwoman/tiger 1.0.0

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.
Files changed (103) hide show
  1. package/README.md +3 -0
  2. package/block-group.ts +151 -0
  3. package/class-code.ts +1026 -0
  4. package/constants.ts +252 -0
  5. package/county-subdivision.ts +154 -0
  6. package/county.ts +135 -0
  7. package/files.ts +251 -0
  8. package/functional-status.ts +64 -0
  9. package/geoid.ts +678 -0
  10. package/index.ts +18 -0
  11. package/legal-statistical-area.ts +222 -0
  12. package/out/block-group.d.ts +135 -0
  13. package/out/block-group.d.ts.map +1 -0
  14. package/out/block-group.js +7 -0
  15. package/out/block-group.js.map +1 -0
  16. package/out/class-code.d.ts +863 -0
  17. package/out/class-code.d.ts.map +1 -0
  18. package/out/class-code.js +864 -0
  19. package/out/class-code.js.map +1 -0
  20. package/out/constants.d.ts +220 -0
  21. package/out/constants.d.ts.map +1 -0
  22. package/out/constants.js +98 -0
  23. package/out/constants.js.map +1 -0
  24. package/out/county-subdivision.d.ts +139 -0
  25. package/out/county-subdivision.d.ts.map +1 -0
  26. package/out/county-subdivision.js +7 -0
  27. package/out/county-subdivision.js.map +1 -0
  28. package/out/county.d.ts +120 -0
  29. package/out/county.d.ts.map +1 -0
  30. package/out/county.js +9 -0
  31. package/out/county.js.map +1 -0
  32. package/out/files.d.ts +118 -0
  33. package/out/files.d.ts.map +1 -0
  34. package/out/files.js +142 -0
  35. package/out/files.js.map +1 -0
  36. package/out/functional-status.d.ts +64 -0
  37. package/out/functional-status.d.ts.map +1 -0
  38. package/out/functional-status.js +65 -0
  39. package/out/functional-status.js.map +1 -0
  40. package/out/geoid.d.ts +438 -0
  41. package/out/geoid.d.ts.map +1 -0
  42. package/out/geoid.js +255 -0
  43. package/out/geoid.js.map +1 -0
  44. package/out/index.d.ts +18 -0
  45. package/out/index.d.ts.map +1 -0
  46. package/out/index.js +18 -0
  47. package/out/index.js.map +1 -0
  48. package/out/legal-statistical-area.d.ts +222 -0
  49. package/out/legal-statistical-area.d.ts.map +1 -0
  50. package/out/legal-statistical-area.js +223 -0
  51. package/out/legal-statistical-area.js.map +1 -0
  52. package/out/sdk/fetch.d.ts.map +1 -0
  53. package/out/sdk/fetch.js.map +1 -0
  54. package/out/sdk/index.d.ts +7 -0
  55. package/out/sdk/index.d.ts.map +1 -0
  56. package/out/sdk/index.js +7 -0
  57. package/out/sdk/index.js.map +1 -0
  58. package/out/sdk/redistricting.d.ts.map +1 -0
  59. package/out/sdk/redistricting.js.map +1 -0
  60. package/out/sdk/schema.d.ts.map +1 -0
  61. package/out/sdk/schema.js.map +1 -0
  62. package/out/sdk/state/TIGERTabulatedBlockEntity.d.ts +13 -0
  63. package/out/sdk/state/TIGERTabulatedBlockEntity.d.ts.map +1 -0
  64. package/out/sdk/state/TIGERTabulatedBlockEntity.js +22 -0
  65. package/out/sdk/state/TIGERTabulatedBlockEntity.js.map +1 -0
  66. package/out/sdk/state/TIGERTractEntity.d.ts +31 -0
  67. package/out/sdk/state/TIGERTractEntity.d.ts.map +1 -0
  68. package/out/sdk/state/TIGERTractEntity.js +7 -0
  69. package/out/sdk/state/TIGERTractEntity.js.map +1 -0
  70. package/out/sdk/state/block-operations.d.ts +36 -0
  71. package/out/sdk/state/block-operations.d.ts.map +1 -0
  72. package/out/sdk/state/block-operations.js +37 -0
  73. package/out/sdk/state/block-operations.js.map +1 -0
  74. package/out/sdk/state/index.d.ts +9 -0
  75. package/out/sdk/state/index.d.ts.map +1 -0
  76. package/out/sdk/state/index.js +9 -0
  77. package/out/sdk/state/index.js.map +1 -0
  78. package/out/state.d.ts +595 -0
  79. package/out/state.d.ts.map +1 -0
  80. package/out/state.js +384 -0
  81. package/out/state.js.map +1 -0
  82. package/out/tabulation-block.d.ts +43 -0
  83. package/out/tabulation-block.d.ts.map +1 -0
  84. package/out/tabulation-block.js +9 -0
  85. package/out/tabulation-block.js.map +1 -0
  86. package/out/tract.d.ts +36 -0
  87. package/out/tract.d.ts.map +1 -0
  88. package/out/tract.js +8 -0
  89. package/out/tract.js.map +1 -0
  90. package/out/tsconfig.tsbuildinfo +1 -0
  91. package/package.json +41 -0
  92. package/sdk/data/nation/index.json +14642 -0
  93. package/sdk/index.ts +7 -0
  94. package/sdk/initialize.sql +161 -0
  95. package/sdk/state/TIGERTabulatedBlockEntity.ts +25 -0
  96. package/sdk/state/TIGERTractEntity.ts +34 -0
  97. package/sdk/state/block-operations.ts +69 -0
  98. package/sdk/state/index.ts +9 -0
  99. package/state.ts +553 -0
  100. package/tabulation-block.ts +68 -0
  101. package/tract.ts +52 -0
  102. package/tsconfig.json +16 -0
  103. package/typedoc.json +5 -0
package/constants.ts ADDED
@@ -0,0 +1,252 @@
1
+ /**
2
+ * @copyright Sister Software.
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ */
6
+
7
+ import { TIGERClassCode } from "./class-code.js"
8
+ import { TIGERFunctionalStatus } from "./functional-status.js"
9
+ import {
10
+ type FIPSBlockCode,
11
+ type FIPSBlockGroupCode,
12
+ type FIPSCongressionalDistrictCode,
13
+ type FIPSCountyCode,
14
+ type FIPSCountySubDivisionCode,
15
+ type FIPSPlaceCode,
16
+ type FIPSTractCode,
17
+ GeoIDPart,
18
+ } from "./geoid.js"
19
+ import { LegalStatisticalAreaDescription } from "./legal-statistical-area.js"
20
+ import { FIPSStateCode } from "./state.js"
21
+
22
+ /**
23
+ * A code indicating the classification of the block, i.e. urban or rural.
24
+ *
25
+ * @title TIGER Geographic Classification
26
+ *
27
+ * @minLength 1
28
+ * @maxLength 1
29
+ */
30
+ export enum TIGERGeographicClassification {
31
+ Urban = "U",
32
+ Rural = "R",
33
+ }
34
+
35
+ /**
36
+ * @title Land/Water Block Type
37
+ *
38
+ * A code indicating the type of feature represented by the land/water block.
39
+ */
40
+ export enum LandWaterBlockType {
41
+ /**
42
+ * Block is land.
43
+ */
44
+ Land = "L",
45
+ /**
46
+ * Block is water.
47
+ */
48
+ Water = "W",
49
+ }
50
+
51
+ /**
52
+ * @title TIGER Property
53
+ */
54
+ export enum TIGERProperty {
55
+ /**
56
+ * @title Geographic Identifier
57
+ */
58
+ GeoID = "GEOID",
59
+ /**
60
+ * @title Display Name
61
+ */
62
+ DisplayName = "display_name",
63
+ /**
64
+ * @title Urban/Rural Code
65
+ */
66
+ UrbanRuralCode = "urban_rural_code",
67
+ /**
68
+ * @title Urban Area Code
69
+ */
70
+ UrbanizedAreaCode = "urbanized_area_code",
71
+ /**
72
+ * @title Land Area (square meters)
73
+ */
74
+ LandAreaSqm = "land_area_sqm",
75
+ /**
76
+ * @title Water Area (square meters)
77
+ */
78
+ WaterAreaSqm = "water_area_sqm",
79
+ /**
80
+ * @title Housing Unit Count
81
+ */
82
+ HousingUnitCount = "housing_unit_count",
83
+ /**
84
+ * @title Population Count
85
+ */
86
+ Population = "population",
87
+ /**
88
+ * @title Functional Status
89
+ */
90
+ FunctionalStatus = "functional_status",
91
+ /**
92
+ * @title Centroid Latitude
93
+ */
94
+ CentroidLatitude = "latitude",
95
+ /**
96
+ * @title Centroid Longitude
97
+ */
98
+ CentroidLongitude = "longitude",
99
+ /**
100
+ * @title Legal/Statistical Area Description
101
+ */
102
+ LegalStatisticalAreaDescription = "legal_statistical_area_description",
103
+ /**
104
+ * @title MAF/TIGER Feature Class Code
105
+ */
106
+ ClassCode = "class_code",
107
+ }
108
+
109
+ /**
110
+ * Properties common to all Census.
111
+ */
112
+ export interface TIGERPropertyRecord<GeoID extends string = string> {
113
+ /**
114
+ * @title Geographic Identifier
115
+ */
116
+ [TIGERProperty.GeoID]: GeoID
117
+
118
+ /**
119
+ * @title State FIPS Code.
120
+ */
121
+ [GeoIDPart.State]: FIPSStateCode
122
+
123
+ /**
124
+ * @title County
125
+ */
126
+ [GeoIDPart.County]: FIPSCountyCode
127
+
128
+ /**
129
+ * @title County Sub Division
130
+ */
131
+ [GeoIDPart.CountySubDivision]: FIPSCountySubDivisionCode
132
+
133
+ /**
134
+ * @title Tract
135
+ */
136
+ [GeoIDPart.Tract]: FIPSTractCode
137
+
138
+ /**
139
+ * @title Place
140
+ */
141
+ [GeoIDPart.Place]: FIPSPlaceCode
142
+
143
+ /**
144
+ * @title Congressional District
145
+ */
146
+ [GeoIDPart.CongressionalDistrict]: FIPSCongressionalDistrictCode
147
+
148
+ /**
149
+ * @title Block
150
+ */
151
+ [GeoIDPart.Block]: FIPSBlockCode
152
+
153
+ /**
154
+ * @title Block Group
155
+ */
156
+ [GeoIDPart.BlockGroup]: FIPSBlockGroupCode
157
+
158
+ /**
159
+ * Urban/Rural Code.
160
+ *
161
+ * @title Urban/Rural Code
162
+ *
163
+ * @minLength 1
164
+ * @maxLength 1
165
+ */
166
+ [TIGERProperty.UrbanRuralCode]: TIGERGeographicClassification
167
+
168
+ /**
169
+ * A code indicating a specific urban area, such as a specific city, or a specific region of
170
+ * cities.
171
+ *
172
+ * For example, 23824 references Detroit, MI. 63217 references the region of New York City, Jersey
173
+ * City, and Newark.
174
+ *
175
+ * @title Urban Area Code
176
+ * @minLength 5
177
+ * @maxLength 5
178
+ */
179
+ [TIGERProperty.UrbanizedAreaCode]: string
180
+
181
+ /**
182
+ * Land Area in square meters.
183
+ *
184
+ * @type {integer}
185
+ * @title Land Area
186
+ * @minimum 0
187
+ */
188
+ [TIGERProperty.LandAreaSqm]: number
189
+
190
+ /**
191
+ * Water Area in square meters.
192
+ *
193
+ * @type {integer}
194
+ * @title Water Area
195
+ * @minimum 0
196
+ */
197
+ [TIGERProperty.WaterAreaSqm]: number
198
+
199
+ /**
200
+ * The tabulated block's housing unit count.
201
+ *
202
+ * Note: This is the number of housing units in the block, not the number of people.
203
+ *
204
+ * @type {integer}
205
+ * @title Housing Units
206
+ * @minimum 0
207
+ */
208
+ [TIGERProperty.HousingUnitCount]: number
209
+
210
+ /**
211
+ * The tabulated block's population count.
212
+ *
213
+ * @type {integer}
214
+ * @title Population Count
215
+ * @minimum 0
216
+ */
217
+ [TIGERProperty.Population]: number
218
+
219
+ /**
220
+ * @title Legal/Statistical Area Description
221
+ */
222
+ [TIGERProperty.LegalStatisticalAreaDescription]: LegalStatisticalAreaDescription
223
+
224
+ /**
225
+ * @title MAF/TIGER Feature Class Code
226
+ */
227
+ [TIGERProperty.ClassCode]: TIGERClassCode
228
+
229
+ /**
230
+ * Functional Status.
231
+ *
232
+ * @title Functional Status
233
+ * @minLength 1
234
+ * @maxLength 1
235
+ * @pattern ^[A-Z]$
236
+ */
237
+ [TIGERProperty.FunctionalStatus]: TIGERFunctionalStatus
238
+
239
+ /**
240
+ * Longitude of the internal point.
241
+ *
242
+ * @title Centroid Longitude
243
+ */
244
+ [TIGERProperty.CentroidLongitude]: number
245
+
246
+ /**
247
+ * Latitude of the internal point.
248
+ *
249
+ * @title Centroid Latitude
250
+ */
251
+ [TIGERProperty.CentroidLatitude]: number
252
+ }
@@ -0,0 +1,154 @@
1
+ /**
2
+ * @copyright Sister Software.
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ */
6
+
7
+ import type { TIGERClassCode } from "./class-code.js"
8
+ import type { TIGERFunctionalStatus } from "./functional-status.js"
9
+ import type { LegalStatisticalAreaDescription } from "./legal-statistical-area.js"
10
+ import type { AdminLevel1Code } from "./state.js"
11
+
12
+ /**
13
+ * Census Geographic subdivision of a county.
14
+ *
15
+ * @title TIGER County Subdivision
16
+ * @public
17
+ */
18
+ export interface TIGERCountySubdivision {
19
+ /**
20
+ * @title State FIPS Code
21
+ */
22
+ STATEFP: AdminLevel1Code
23
+
24
+ /**
25
+ * @title County FIPS Code
26
+ * @minLength 3
27
+ * @maxLength 3
28
+ * @pattern ^\d{3}$
29
+ */
30
+ COUNTYFP: string
31
+
32
+ /**
33
+ * @title County Subdivision FIPS Code
34
+ *
35
+ * @minLength 5
36
+ * @maxLength 5
37
+ * @pattern ^\d{5}$
38
+ */
39
+ COUSUBFP: string
40
+
41
+ /**
42
+ * @see {@link https://www.usgs.gov/us-board-on-geographic-names/domestic-names | USGS: Domestic Names}
43
+ * @title County Subdivision GNIS Code
44
+ *
45
+ * @minLength 8
46
+ * @maxLength 8
47
+ * @pattern ^\d{8}$
48
+ */
49
+ COUSUBNS: string
50
+ /**
51
+ * Concatenation of current state FIPS code, county FIPS code, and county subdivision FIPS code.
52
+ *
53
+ * @see {@link https://www.census.gov/programs-surveys/geography/guidance/geo-identifiers.html | Census: GeoID}
54
+ * @title County Sub-division Identifier
55
+ * @minLength 10
56
+ * @maxLength 20
57
+ * @pattern ^\d{10,20}$
58
+ */
59
+ GEOID: string
60
+
61
+ /**
62
+ * Fully Qualified GEOID as used in CEDSCI and other systems.
63
+ *
64
+ * @title Fully Qualified Geographic Identifier
65
+ * @minLength 19
66
+ * @maxLength 29
67
+ * @pattern ^\d{19}$
68
+ */
69
+ GEOIDFQ: string
70
+
71
+ /**
72
+ * Current name and the translated legal/statistical area description code for county
73
+ * sub-division.
74
+ *
75
+ * @title Name/Legal Statistical Area Description
76
+ * @minLength 1
77
+ * @maxLength 100
78
+ */
79
+ NAMELSAD: string
80
+
81
+ /**
82
+ * Legal/Statistical Area Description.
83
+ *
84
+ * @title Legal/Statistical Area Description
85
+ */
86
+ LSAD: LegalStatisticalAreaDescription
87
+
88
+ /**
89
+ * Class Code.
90
+ *
91
+ * @title Class Code
92
+ */
93
+ CLASSFP: TIGERClassCode
94
+
95
+ /**
96
+ * MAF/TIGER Feature Class Code.
97
+ *
98
+ * @title MAF/TIGER Feature Class Code
99
+ *
100
+ * @minLength 5
101
+ * @maxLength 5
102
+ * @pattern ^[A-Z]\d{1}$
103
+ */
104
+ MTFCC: string
105
+
106
+ /**
107
+ * Functional Status.
108
+ *
109
+ * @title Functional Status
110
+ * @minLength 1
111
+ * @maxLength 1
112
+ * @pattern ^[A-Z]$
113
+ */
114
+ FUNCSTAT: TIGERFunctionalStatus
115
+
116
+ /**
117
+ * Land Area in square meters.
118
+ *
119
+ * @title Land Area
120
+ * @minimum 0
121
+ */
122
+ ALAND: number
123
+
124
+ /**
125
+ * Water Area in square meters.
126
+ *
127
+ * @title Water Area
128
+ * @minimum 0
129
+ */
130
+ AWATER: number
131
+
132
+ /**
133
+ * Latitude of the internal point.
134
+ *
135
+ * @title Internal Point Latitude
136
+ */
137
+ INTPTLAT: string
138
+
139
+ /**
140
+ * Longitude of the internal point.
141
+ *
142
+ * @title Internal Point Longitude
143
+ */
144
+ INTPTLON: string
145
+
146
+ /**
147
+ * Name of the county subdivision.
148
+ *
149
+ * @title Name
150
+ * @minLength 1
151
+ * @maxLength 100
152
+ */
153
+ NAME: string
154
+ }
package/county.ts ADDED
@@ -0,0 +1,135 @@
1
+ /**
2
+ * @copyright Sister Software.
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ */
6
+
7
+ import { TIGERClassCode } from "./class-code.js"
8
+ import { TIGERFunctionalStatus } from "./functional-status.js"
9
+ import type { LegalStatisticalAreaDescription } from "./legal-statistical-area.js"
10
+ import type { AdminLevel1Code } from "./state.js"
11
+
12
+ /**
13
+ * @title TIGER County
14
+ * @public
15
+ */
16
+ export interface TIGERCounty {
17
+ /**
18
+ * @title State FIPS Code
19
+ */
20
+ STATEFP: AdminLevel1Code
21
+
22
+ /**
23
+ * @title County FIPS Code
24
+ * @minLength 3
25
+ * @maxLength 3
26
+ * @pattern ^\d{3}$
27
+ */
28
+ COUNTYFP: string
29
+
30
+ /**
31
+ * @see {@link https://www.usgs.gov/us-board-on-geographic-names/domestic-names | USGS: Domestic Names}
32
+ * @title County GNIS Code
33
+ *
34
+ * @minLength 8
35
+ * @maxLength 8
36
+ * @pattern ^\d{8}$
37
+ */
38
+ GEOID: string
39
+
40
+ /**
41
+ * Fully Qualified GEOID as used in CEDSCI and other systems.
42
+ *
43
+ * @title Fully Qualified Geographic Identifier
44
+ * @minLength 19
45
+ * @maxLength 29
46
+ * @pattern ^\d{19}$
47
+ */
48
+ GEOIDFQ: string
49
+
50
+ /**
51
+ * Current name and the translated legal/statistical area description code for county
52
+ * sub-division.
53
+ *
54
+ * @title Name/Legal Statistical Area Description
55
+ * @minLength 1
56
+ * @maxLength 100
57
+ */
58
+ NAMELSAD: string
59
+
60
+ /**
61
+ * Legal/Statistical Area Description.
62
+ *
63
+ * @title Legal/Statistical Area Description
64
+ */
65
+ LSAD: LegalStatisticalAreaDescription
66
+
67
+ /**
68
+ * Class Code.
69
+ *
70
+ * @title Class Code
71
+ */
72
+ CLASSFP: TIGERClassCode
73
+
74
+ /**
75
+ * MAF/TIGER Feature Class Code.
76
+ *
77
+ * @title MAF/TIGER Feature Class Code
78
+ *
79
+ * @minLength 5
80
+ * @maxLength 5
81
+ * @pattern ^[A-Z]\d{1}$
82
+ */
83
+ MTFCC: string
84
+
85
+ /**
86
+ * Functional Status.
87
+ *
88
+ * @title Functional Status
89
+ * @minLength 1
90
+ * @maxLength 1
91
+ * @pattern ^[A-Z]$
92
+ */
93
+ FUNCSTAT: TIGERFunctionalStatus
94
+
95
+ /**
96
+ * Land Area in square meters.
97
+ *
98
+ * @title Land Area
99
+ * @minimum 0
100
+ */
101
+ ALAND: number
102
+
103
+ /**
104
+ * Water Area in square meters.
105
+ *
106
+ * @title Water Area
107
+ * @minimum 0
108
+ */
109
+ AWATER: number
110
+
111
+ /**
112
+ * Latitude of the internal point.
113
+ *
114
+ * @title Internal Point Latitude
115
+ */
116
+ INTPTLAT: string
117
+
118
+ /**
119
+ * Longitude of the internal point.
120
+ *
121
+ * @title Internal Point Longitude
122
+ */
123
+ INTPTLON: string
124
+
125
+ /**
126
+ * Name of the county.
127
+ *
128
+ * @title Name
129
+ * @minLength 1
130
+ * @maxLength 100
131
+ */
132
+ NAME: string
133
+ }
134
+
135
+ export const TIGERCountySymbol = Symbol.for("TIGERCounty")