@mailwoman/tiger 10.8.0 → 11.1.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.
- package/lib/block-group.ts +2 -5
- package/lib/class-code.ts +9 -13
- package/lib/constants.ts +2 -5
- package/lib/county/subdivision.ts +2 -5
- package/lib/county.ts +2 -5
- package/lib/files.ts +4 -5
- package/lib/functional-status.ts +4 -7
- package/lib/geoid.ts +2 -5
- package/lib/index.ts +2 -5
- package/lib/legal-statistical-area.ts +2 -5
- package/lib/paths.ts +26 -0
- package/lib/schema.ts +3 -6
- package/lib/state.ts +2 -5
- package/lib/tabulation-block.ts +2 -5
- package/lib/tract.ts +2 -5
- package/out/block-group.d.ts +0 -5
- package/out/block-group.d.ts.map +1 -1
- package/out/block-group.js +2 -5
- package/out/block-group.js.map +1 -1
- package/out/class-code.d.ts +7 -13
- package/out/class-code.d.ts.map +1 -1
- package/out/class-code.js +9 -13
- package/out/class-code.js.map +1 -1
- package/out/constants.d.ts +0 -5
- package/out/constants.d.ts.map +1 -1
- package/out/constants.js +2 -5
- package/out/constants.js.map +1 -1
- package/out/county/subdivision.d.ts +0 -5
- package/out/county/subdivision.d.ts.map +1 -1
- package/out/county/subdivision.js +2 -5
- package/out/county/subdivision.js.map +1 -1
- package/out/county.d.ts +0 -5
- package/out/county.d.ts.map +1 -1
- package/out/county.js +2 -5
- package/out/county.js.map +1 -1
- package/out/files.d.ts +1 -5
- package/out/files.d.ts.map +1 -1
- package/out/files.js +3 -8
- package/out/files.js.map +1 -1
- package/out/functional-status.d.ts +2 -7
- package/out/functional-status.d.ts.map +1 -1
- package/out/functional-status.js +4 -7
- package/out/functional-status.js.map +1 -1
- package/out/geoid.d.ts +0 -5
- package/out/geoid.d.ts.map +1 -1
- package/out/geoid.js +2 -5
- package/out/geoid.js.map +1 -1
- package/out/index.d.ts +0 -5
- package/out/index.d.ts.map +1 -1
- package/out/index.js +2 -5
- package/out/index.js.map +1 -1
- package/out/legal-statistical-area.d.ts +0 -5
- package/out/legal-statistical-area.d.ts.map +1 -1
- package/out/legal-statistical-area.js +2 -5
- package/out/legal-statistical-area.js.map +1 -1
- package/out/paths.d.ts +12 -0
- package/out/paths.d.ts.map +1 -0
- package/out/paths.js +22 -0
- package/out/paths.js.map +1 -0
- package/out/schema.d.ts +1 -6
- package/out/schema.d.ts.map +1 -1
- package/out/schema.js +2 -5
- package/out/schema.js.map +1 -1
- package/out/sdk/download.d.ts +0 -8
- package/out/sdk/download.d.ts.map +1 -1
- package/out/sdk/download.js +4 -6
- package/out/sdk/download.js.map +1 -1
- package/out/sdk/fetch.d.ts +1 -6
- package/out/sdk/fetch.d.ts.map +1 -1
- package/out/sdk/fetch.js +4 -6
- package/out/sdk/fetch.js.map +1 -1
- package/out/sdk/redistricting.d.ts +2 -19
- package/out/sdk/redistricting.d.ts.map +1 -1
- package/out/sdk/redistricting.js +15 -13
- package/out/sdk/redistricting.js.map +1 -1
- package/out/sdk/state/TIGERTabulatedBlockEntity.d.ts +0 -5
- package/out/sdk/state/TIGERTabulatedBlockEntity.d.ts.map +1 -1
- package/out/sdk/state/TIGERTabulatedBlockEntity.js +2 -5
- package/out/sdk/state/TIGERTabulatedBlockEntity.js.map +1 -1
- package/out/sdk/state/TIGERTractEntity.d.ts +0 -5
- package/out/sdk/state/TIGERTractEntity.d.ts.map +1 -1
- package/out/sdk/state/TIGERTractEntity.js +2 -5
- package/out/sdk/state/TIGERTractEntity.js.map +1 -1
- package/out/sdk/state/block-operations.d.ts +0 -5
- package/out/sdk/state/block-operations.d.ts.map +1 -1
- package/out/sdk/state/block-operations.js +2 -5
- package/out/sdk/state/block-operations.js.map +1 -1
- package/out/sdk/state.d.ts +0 -5
- package/out/sdk/state.d.ts.map +1 -1
- package/out/sdk/state.js +2 -5
- package/out/sdk/state.js.map +1 -1
- package/out/sdk/tsconfig.tsbuildinfo +1 -1
- package/out/state.d.ts +0 -5
- package/out/state.d.ts.map +1 -1
- package/out/state.js +2 -5
- package/out/state.js.map +1 -1
- package/out/tabulation-block.d.ts +0 -5
- package/out/tabulation-block.d.ts.map +1 -1
- package/out/tabulation-block.js +2 -5
- package/out/tabulation-block.js.map +1 -1
- package/out/tools/race/dots/map.d.ts +0 -18
- package/out/tools/race/dots/map.d.ts.map +1 -1
- package/out/tools/race/dots/map.js +11 -11
- package/out/tools/race/dots/map.js.map +1 -1
- package/out/tools/race/dots.d.ts +0 -8
- package/out/tools/race/dots.d.ts.map +1 -1
- package/out/tools/race/dots.js +7 -8
- package/out/tools/race/dots.js.map +1 -1
- package/out/tools/serve-range.d.ts +6 -7
- package/out/tools/serve-range.d.ts.map +1 -1
- package/out/tools/serve-range.js +8 -7
- package/out/tools/serve-range.js.map +1 -1
- package/out/tools/tsconfig.tsbuildinfo +1 -1
- package/out/tract.d.ts +0 -5
- package/out/tract.d.ts.map +1 -1
- package/out/tract.js +2 -5
- package/out/tract.js.map +1 -1
- package/out/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/sdk/download.ts +5 -6
- package/sdk/fetch.ts +5 -7
- package/sdk/redistricting.ts +17 -14
- package/sdk/state/TIGERTabulatedBlockEntity.ts +2 -5
- package/sdk/state/TIGERTractEntity.ts +2 -5
- package/sdk/state/block-operations.ts +2 -5
- package/sdk/state.ts +2 -5
- package/tools/race/dots/map.ts +12 -11
- package/tools/race/dots.ts +8 -8
- package/tools/serve-range.ts +9 -7
package/out/tract.d.ts
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @copyright Sister Software.
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*/
|
|
6
1
|
import type { GeoFeature, MultiPolygonLiteral } from "@mailwoman/spatial";
|
|
7
2
|
import type { TIGERProperty, TIGERPropertyRecord } from "#constants";
|
|
8
3
|
import type { FIPSTractGeoID, GeoIDPart, ParsedGeoIDTractLevel } from "#geoid";
|
package/out/tract.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tract.d.ts","sourceRoot":"","sources":["../lib/tract.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tract.d.ts","sourceRoot":"","sources":["../lib/tract.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAEzE,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAA;AAE9E;;;GAGG;AACH,MAAM,WAAW,UAAW,SAAQ,qBAAqB;IACxD;;;;OAIG;IACH,KAAK,EAAE,cAAc,CAAA;IAErB;;;;;OAKG;IACH,QAAQ,EAAE,mBAAmB,CAAA;CAC7B;AAED;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,IAAI,CACtC,mBAAmB,CAAC,cAAc,CAAC,EACjC,OAAO,aAAa,CAAC,KAAK,GAC1B,OAAO,SAAS,CAAC,KAAK,GACtB,OAAO,SAAS,CAAC,MAAM,GACvB,OAAO,SAAS,CAAC,KAAK,GACtB,OAAO,aAAa,CAAC,SAAS,GAC9B,OAAO,aAAa,CAAC,gBAAgB,GACrC,OAAO,aAAa,CAAC,WAAW,GAChC,OAAO,aAAa,CAAC,YAAY,GACjC,OAAO,aAAa,CAAC,iBAAiB,GACtC,OAAO,aAAa,CAAC,gBAAgB,CACvC,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,mBAAmB,EAAE,oBAAoB,CAAC,CAAA"}
|
package/out/tract.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*/
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
6
3
|
export {};
|
|
7
4
|
//# sourceMappingURL=tract.js.map
|
package/out/tract.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tract.js","sourceRoot":"","sources":["../lib/tract.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"tract.js","sourceRoot":"","sources":["../lib/tract.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,kEAAkE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"7.0.2","root":["../lib/files.test.ts","../sdk/redistricting.test.ts"],"packageJsons":["../../../node_modules/@
|
|
1
|
+
{"version":"7.0.2","root":["../lib/files.test.ts","../sdk/redistricting.test.ts"],"packageJsons":["../../../node_modules/@sister.software/h3/package.json","../../../node_modules/@types/chai/package.json","../../../node_modules/@types/deep-eql/package.json","../../../node_modules/@types/node/package.json","../../../node_modules/@vitest/browser-playwright/package.json","../../../node_modules/@vitest/coverage-v8/package.json","../../../node_modules/@vitest/mocker/package.json","../../../node_modules/@vitest/ui/package.json","../../../node_modules/assertion-error/package.json","../../../node_modules/buffer/package.json","../../../node_modules/chai/package.json","../../../node_modules/deep-eql/package.json","../../../node_modules/esbuild/package.json","../../../node_modules/events/package.json","../../../node_modules/expect-type/package.json","../../../node_modules/jiti/package.json","../../../node_modules/jsdom/package.json","../../../node_modules/punycode/package.json","../../../node_modules/string_decoder/package.json","../../../node_modules/tagged-tag/package.json","../../../node_modules/terser/package.json","../../../node_modules/tinybench/package.json","../../../node_modules/type-fest/package.json","../../../node_modules/undici-types/package.json","../../../node_modules/vite/package.json","../../../node_modules/vitest/package.json","../../../node_modules/yaml/package.json","../../annotations/package.json","../../spatial/package.json","../package.json"],"missingPackageJsons":["../../../node_modules/@edge-runtime/vm/package.json","../../../node_modules/@opentelemetry/api/package.json","../../../node_modules/@sister.software/h3/out/lib/api/package.json","../../../node_modules/@sister.software/h3/out/lib/package.json","../../../node_modules/@sister.software/h3/out/lib/runtime/package.json","../../../node_modules/@sister.software/h3/out/package.json","../../../node_modules/@types/assert/package.json","../../../node_modules/@types/assert/strict/package.json","../../../node_modules/@types/async_hooks/package.json","../../../node_modules/@types/child_process/package.json","../../../node_modules/@types/cluster/package.json","../../../node_modules/@types/console/package.json","../../../node_modules/@types/constants/package.json","../../../node_modules/@types/crypto/package.json","../../../node_modules/@types/dgram/package.json","../../../node_modules/@types/diagnostics_channel/package.json","../../../node_modules/@types/dns/package.json","../../../node_modules/@types/dns/promises/package.json","../../../node_modules/@types/domain/package.json","../../../node_modules/@types/events/package.json","../../../node_modules/@types/fs/package.json","../../../node_modules/@types/fs/promises/package.json","../../../node_modules/@types/http/package.json","../../../node_modules/@types/http2/package.json","../../../node_modules/@types/https/package.json","../../../node_modules/@types/inspector/package.json","../../../node_modules/@types/inspector/promises/package.json","../../../node_modules/@types/module/package.json","../../../node_modules/@types/net/package.json","../../../node_modules/@types/node/assert/package.json","../../../node_modules/@types/node/dns/package.json","../../../node_modules/@types/node/fs/package.json","../../../node_modules/@types/node/inspector/package.json","../../../node_modules/@types/node/path/package.json","../../../node_modules/@types/node/readline/package.json","../../../node_modules/@types/node/stream/package.json","../../../node_modules/@types/node/test/package.json","../../../node_modules/@types/node/timers/package.json","../../../node_modules/@types/node/util/package.json","../../../node_modules/@types/node/web-globals/package.json","../../../node_modules/@types/node/zlib/package.json","../../../node_modules/@types/os/package.json","../../../node_modules/@types/path/package.json","../../../node_modules/@types/path/posix/package.json","../../../node_modules/@types/path/win32/package.json","../../../node_modules/@types/perf_hooks/package.json","../../../node_modules/@types/process/package.json","../../../node_modules/@types/punycode/package.json","../../../node_modules/@types/querystring/package.json","../../../node_modules/@types/readline/package.json","../../../node_modules/@types/readline/promises/package.json","../../../node_modules/@types/repl/package.json","../../../node_modules/@types/stream/consumers/package.json","../../../node_modules/@types/stream/iter/package.json","../../../node_modules/@types/stream/package.json","../../../node_modules/@types/stream/promises/package.json","../../../node_modules/@types/stream/web/package.json","../../../node_modules/@types/string_decoder/package.json","../../../node_modules/@types/timers/package.json","../../../node_modules/@types/timers/promises/package.json","../../../node_modules/@types/tls/package.json","../../../node_modules/@types/trace_events/package.json","../../../node_modules/@types/tty/package.json","../../../node_modules/@types/url/package.json","../../../node_modules/@types/util/package.json","../../../node_modules/@types/util/types/package.json","../../../node_modules/@types/v8/package.json","../../../node_modules/@types/vm/package.json","../../../node_modules/@types/wasi/package.json","../../../node_modules/@types/worker_threads/package.json","../../../node_modules/@types/zlib/package.json","../../../node_modules/@vitejs/devtools/package.json","../../../node_modules/@vitest/browser-preview/package.json","../../../node_modules/@vitest/browser-webdriverio/package.json","../../../node_modules/@vitest/coverage-istanbul/package.json","../../../node_modules/@vitest/mocker/dist/package.json","../../../node_modules/assert/package.json","../../../node_modules/assert/strict/package.json","../../../node_modules/async_hooks/package.json","../../../node_modules/child_process/package.json","../../../node_modules/cluster/package.json","../../../node_modules/console/package.json","../../../node_modules/constants/package.json","../../../node_modules/crypto/package.json","../../../node_modules/dgram/package.json","../../../node_modules/diagnostics_channel/package.json","../../../node_modules/dns/package.json","../../../node_modules/dns/promises/package.json","../../../node_modules/domain/package.json","../../../node_modules/expect-type/dist/package.json","../../../node_modules/fs/package.json","../../../node_modules/fs/promises/package.json","../../../node_modules/happy-dom/package.json","../../../node_modules/http/package.json","../../../node_modules/http2/package.json","../../../node_modules/https/package.json","../../../node_modules/inspector/package.json","../../../node_modules/inspector/promises/package.json","../../../node_modules/less/package.json","../../../node_modules/module/package.json","../../../node_modules/msw/package.json","../../../node_modules/net/package.json","../../../node_modules/os/package.json","../../../node_modules/path/package.json","../../../node_modules/path/posix/package.json","../../../node_modules/path/win32/package.json","../../../node_modules/perf_hooks/package.json","../../../node_modules/process/package.json","../../../node_modules/querystring/package.json","../../../node_modules/readline/package.json","../../../node_modules/readline/promises/package.json","../../../node_modules/repl/package.json","../../../node_modules/sass-embedded/package.json","../../../node_modules/sass/package.json","../../../node_modules/stream/consumers/package.json","../../../node_modules/stream/iter/package.json","../../../node_modules/stream/package.json","../../../node_modules/stream/promises/package.json","../../../node_modules/stream/web/package.json","../../../node_modules/stylus/package.json","../../../node_modules/sugarss/package.json","../../../node_modules/timers/package.json","../../../node_modules/timers/promises/package.json","../../../node_modules/tinybench/dist/package.json","../../../node_modules/tls/package.json","../../../node_modules/trace_events/package.json","../../../node_modules/tsx/package.json","../../../node_modules/tty/package.json","../../../node_modules/type-fest/source/internal/package.json","../../../node_modules/type-fest/source/package.json","../../../node_modules/url/package.json","../../../node_modules/util/package.json","../../../node_modules/util/types/package.json","../../../node_modules/v8/package.json","../../../node_modules/vite/dist/node/chunks/package.json","../../../node_modules/vite/dist/node/package.json","../../../node_modules/vite/dist/package.json","../../../node_modules/vite/module-runner/package.json","../../../node_modules/vite/types/package.json","../../../node_modules/vitest/dist/chunks/package.json","../../../node_modules/vitest/dist/package.json","../../../node_modules/vm/package.json","../../../node_modules/wasi/package.json","../../../node_modules/worker_threads/package.json","../../../node_modules/zlib/package.json"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mailwoman/tiger",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.1.0",
|
|
4
4
|
"description": "US Census TIGER/Line data processing and analysis.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"census",
|
|
@@ -132,9 +132,9 @@
|
|
|
132
132
|
"test": "node ./out/sdk/TIGERService.test.js"
|
|
133
133
|
},
|
|
134
134
|
"dependencies": {
|
|
135
|
-
"@mailwoman/core": "
|
|
136
|
-
"@mailwoman/spatial": "
|
|
137
|
-
"@mailwoman/sqlite": "
|
|
135
|
+
"@mailwoman/core": "11.1.0",
|
|
136
|
+
"@mailwoman/spatial": "11.1.0",
|
|
137
|
+
"@mailwoman/sqlite": "11.1.0",
|
|
138
138
|
"@turf/boolean-contains": "^7.4.0",
|
|
139
139
|
"kysely": "^0.29.7",
|
|
140
140
|
"path-ts": "^2.5.0",
|
package/sdk/download.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* Raw `fetch` is deliberate for a multi-gigabyte streamed transfer: `APIClient`'s response caching
|
|
7
|
-
* and pacing do not apply.
|
|
5
|
+
* Raw `fetch` is deliberate for a multi-gigabyte streamed transfer:
|
|
6
|
+
* `APIClient`'s response caching and pacing do not apply.
|
|
8
7
|
*/
|
|
9
8
|
|
|
10
9
|
import { pathExists } from "@mailwoman/core/fs/readers/stat"
|
package/sdk/fetch.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*/
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
6
3
|
|
|
7
4
|
import { APIClient, pluckResponseData } from "@mailwoman/core/api"
|
|
8
5
|
import { dataRootPath } from "@mailwoman/core/data-root"
|
|
@@ -13,6 +10,7 @@ import { ogr2ogrGeoJSONSeq } from "@mailwoman/spatial/tools/ogr/stream"
|
|
|
13
10
|
import { DatabaseClient } from "@mailwoman/sqlite/client"
|
|
14
11
|
import { PathBuilder } from "path-ts"
|
|
15
12
|
|
|
13
|
+
import { tigerDatabaseRoot } from "#paths"
|
|
16
14
|
import type { TIGERBlockTable, TIGERDatabase, TIGERPlaceTable, TIGERStreetTable } from "#schema"
|
|
17
15
|
import { initializeTIGERSchema, TIGER_PRAGMAS } from "#schema"
|
|
18
16
|
import { downloadIfNeeded } from "#sdk/download"
|
|
@@ -66,7 +64,7 @@ export interface FetchTIGEROptions {
|
|
|
66
64
|
/**
|
|
67
65
|
* The output SQLite path.
|
|
68
66
|
*
|
|
69
|
-
* @defaultValue `<dataRoot>/tiger/tiger.db`, which the corpus `tiger` adapter reads.
|
|
67
|
+
* @defaultValue `<dataRoot>/db/tiger/tiger.db`, which the corpus `tiger` adapter reads.
|
|
70
68
|
*/
|
|
71
69
|
outPath?: string
|
|
72
70
|
|
|
@@ -204,7 +202,7 @@ export async function* fetchTIGER(options: FetchTIGEROptions): AsyncGenerator<Fe
|
|
|
204
202
|
|
|
205
203
|
const cacheDir = dataRoot("tiger", String(vintage), state)
|
|
206
204
|
|
|
207
|
-
const outPath = PathBuilder.from(options.outPath ?? dataRoot("tiger
|
|
205
|
+
const outPath = PathBuilder.from(options.outPath ?? tigerDatabaseRoot(dataRoot)("tiger.db"))
|
|
208
206
|
await makeDirectories(cacheDir)
|
|
209
207
|
await makeDirectories(outPath.dirname())
|
|
210
208
|
|
package/sdk/redistricting.ts
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
*
|
|
3
|
-
* @
|
|
4
|
-
*
|
|
5
|
+
* Pull a state's Census 2020 P.L. 94-171 redistricting counts (table P2 — Hispanic-or-Latino
|
|
6
|
+
* by race, per block) into the `pl_block` table of a tiger {@link DatabaseClient} DB,
|
|
7
|
+
* keyed on the same 15-char block `geoid` as {@link fetchTIGER}'s `tabblock20`.
|
|
8
|
+
*
|
|
9
|
+
* Join the two for block-level race + geometry (e.g. a dot-density map).
|
|
5
10
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* race + geometry (e.g. a dot-density map).
|
|
11
|
+
* Keyless public data.
|
|
12
|
+
* The per-state ZIP holds a pipe-delimited geographic header (`<st>geo<yr>.pl`)
|
|
13
|
+
* and three data segments. segment 1 (`<st>00001<yr>.pl`) contains P1 + P2.
|
|
10
14
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* join the header (filtered to sumlev 750 = block) to segment 1 by logrecno. Field offsets are
|
|
14
|
-
* fixed by the 2020 P.L. layout (verified against the real files).
|
|
15
|
+
* We join the header (filtered to sumlev 750 = block) to segment 1 by logrecno.
|
|
16
|
+
* Field offsets are fixed by the 2020 P.L. layout (verified against the real files).
|
|
15
17
|
*
|
|
16
18
|
* https://www2.census.gov/programs-surveys/decennial/2020/data/01-Redistricting_File--PL_94-171/
|
|
17
19
|
*/
|
|
@@ -23,6 +25,7 @@ import { DatabaseClient } from "@mailwoman/sqlite/client"
|
|
|
23
25
|
import { PathBuilder } from "path-ts"
|
|
24
26
|
import { TextSpliterator } from "spliterator"
|
|
25
27
|
|
|
28
|
+
import { tigerDatabaseRoot } from "#paths"
|
|
26
29
|
import { initializeTIGERSchema, TIGER_PRAGMAS, type PLBlockTable, type TIGERDatabase } from "#schema"
|
|
27
30
|
import { downloadIfNeeded } from "#sdk/download"
|
|
28
31
|
import { AdminLevel1CodeToAbbreviation, StateName, type AdminLevel1Code } from "#state"
|
|
@@ -53,7 +56,7 @@ const P2 = (fieldNo: number) => 76 + (fieldNo - 1)
|
|
|
53
56
|
* / 916,517, the published CA 2020 figures.
|
|
54
57
|
*
|
|
55
58
|
* `occupied + vacant === housing_units` is the invariant that distinguishes a correct
|
|
56
|
-
* offset from a plausible one. {@link parseH1} refuses a row when it
|
|
59
|
+
* offset from a plausible one. {@link parseH1} refuses a row when it doesn't hold.
|
|
57
60
|
*/
|
|
58
61
|
export const SEG2_FIELD_COUNT = 152
|
|
59
62
|
/**
|
|
@@ -135,7 +138,7 @@ export interface FetchRedistrictingOptions {
|
|
|
135
138
|
/**
|
|
136
139
|
* Output SQLite path.
|
|
137
140
|
*
|
|
138
|
-
* @defaultValue `<dataRoot>/tiger/tiger.db` (same DB as `fetchTIGER`).
|
|
141
|
+
* @defaultValue `<dataRoot>/db/tiger/tiger.db` (same DB as `fetchTIGER`).
|
|
139
142
|
*/
|
|
140
143
|
outPath?: string
|
|
141
144
|
/**
|
|
@@ -202,7 +205,7 @@ export async function* fetchRedistricting(
|
|
|
202
205
|
|
|
203
206
|
const cacheDir = dataRoot("census", "redistricting", String(vintage), state)
|
|
204
207
|
// Same stable `tiger.db` default as fetchTIGER — pl_block lives alongside tabblock20 in one DB.
|
|
205
|
-
const outPath = PathBuilder.from(options.outPath ?? dataRoot("tiger
|
|
208
|
+
const outPath = PathBuilder.from(options.outPath ?? tigerDatabaseRoot(dataRoot)("tiger.db"))
|
|
206
209
|
await makeDirectories(cacheDir)
|
|
207
210
|
await makeDirectories(outPath.dirname())
|
|
208
211
|
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*/
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
6
3
|
|
|
7
4
|
import { smartSnakeCase } from "spliterator"
|
|
8
5
|
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*/
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
6
3
|
|
|
7
4
|
import type { AdminLevel1Code, FIPSCountyCode, FIPSTractCode } from "#index"
|
|
8
5
|
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*/
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
6
3
|
|
|
7
4
|
import type { GeometryLiteral, MultiPolygonLiteral } from "@mailwoman/spatial"
|
|
8
5
|
import { wellKnownGeometryToGeoJSON } from "@mailwoman/spatial/well-known-text"
|
package/sdk/state.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*/
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
6
3
|
|
|
7
4
|
export * from "#sdk/state/block-operations"
|
|
8
5
|
export * from "#sdk/state/TIGERTabulatedBlockEntity"
|
package/tools/race/dots/map.ts
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
+
* Render a race-by-dot-density PMTiles tileset (from `race-dots.ts` → tippecanoe)
|
|
6
|
+
* as a standalone MapLibre page on the house stack: the Protomaps `basemap-v4`
|
|
7
|
+
* vector basemap (layers generated + inlined here, à la `registry/map-html.ts`)
|
|
8
|
+
* under a circle layer of the dots, colored by race category.
|
|
5
9
|
*
|
|
6
|
-
*
|
|
7
|
-
* MapLibre page on the house stack: the Protomaps `basemap-v4` vector basemap (layers generated +
|
|
8
|
-
* inlined here, à la `registry/map-html.ts`) under a circle layer of the dots, colored by race
|
|
9
|
-
* category. The dots PMTiles is read client-side via the `pmtiles` protocol.
|
|
10
|
+
* The dots PMTiles is read client-side via the `pmtiles` protocol.
|
|
10
11
|
*
|
|
11
|
-
* Each dot is one of `per` people of a category, placed at random inside its Census block —
|
|
12
|
-
* representation rather than a record about any address.
|
|
13
|
-
* cors-restricts to localhost + the docs domains) —
|
|
14
|
-
* {@linkcode serveWithRangeSupport} for exactly this.
|
|
12
|
+
* Each dot is one of `per` people of a category, placed at random inside its Census block —
|
|
13
|
+
* a representation rather than a record about any address.
|
|
14
|
+
* Serve over localhost (the house tile server cors-restricts to localhost + the docs domains) —
|
|
15
|
+
* `mailwoman tiger race-dots-map --serve` wires {@linkcode serveWithRangeSupport} for exactly this.
|
|
15
16
|
*
|
|
16
17
|
* Run: `mailwoman tiger race-dots-map --pmtiles-url
|
|
17
18
|
* http://localhost:8899/race-dots-oc.pmtiles --out /tmp/race-dots-oc.html`
|
package/tools/race/dots.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* A dot is a representation rather than a record: a random position inside the block it belongs to,
|
|
7
|
-
* making no statement about any individual address.
|
|
5
|
+
* A dot is a representation rather than a record: a random position inside the block
|
|
6
|
+
* it belongs to, making no statement about any individual address.
|
|
8
7
|
*/
|
|
9
8
|
|
|
10
|
-
import {
|
|
9
|
+
import { tempRootPath } from "@mailwoman/core/data-root"
|
|
11
10
|
import { openWriteStream } from "@mailwoman/core/fs/streams"
|
|
12
11
|
import { tryParsingJSON, stringifyJSON } from "@mailwoman/core/json"
|
|
13
12
|
import { DatabaseClient } from "@mailwoman/sqlite/client"
|
|
14
13
|
|
|
14
|
+
import { tigerDatabasePath } from "#paths"
|
|
15
15
|
import type { TIGERDatabase } from "#schema"
|
|
16
16
|
|
|
17
17
|
const MAX_PLACEMENT_TRIES = 60
|
|
@@ -95,7 +95,7 @@ export async function raceDots(
|
|
|
95
95
|
options: RaceDotsOptions = {},
|
|
96
96
|
report?: (line: string) => void
|
|
97
97
|
): Promise<RaceDotsResult> {
|
|
98
|
-
const DB = options.db ||
|
|
98
|
+
const DB = options.db || tigerDatabasePath("tiger-oc.db")
|
|
99
99
|
const OUT = options.out || tempRootPath("race-dots.ndjson")
|
|
100
100
|
const PER = options.per ?? 10
|
|
101
101
|
const LAYER = options.layer || "dots"
|
package/tools/serve-range.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
+
* Minimal static file server that honors http Range requests (206) — Python's `http.server` doesn't .
|
|
6
|
+
*
|
|
7
|
+
* PMTiles reads via Range, so this server cannot serve it.
|
|
8
|
+
* Used to preview/render a local `.pmtiles` tileset
|
|
9
|
+
* (e.g. the race-dot map, via `mailwoman tiger race-dots-map --serve`).
|
|
5
10
|
*
|
|
6
|
-
*
|
|
7
|
-
* not. PMTiles reads via Range, so this server cannot serve it. Used to preview/render a local
|
|
8
|
-
* `.pmtiles` tileset (e.g. the race-dot map, via `mailwoman tiger race-dots-map --serve`). Not for
|
|
9
|
-
* production. the deployed tiles go through the tile worker.
|
|
11
|
+
* Not for production. the deployed tiles go through the tile worker.
|
|
10
12
|
*
|
|
11
13
|
* Internal helper module — no standalone command.
|
|
12
14
|
*/
|