@mailwoman/tiger 11.0.0 → 11.2.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 (134) hide show
  1. package/lib/block-group.ts +2 -5
  2. package/lib/class-code.ts +9 -13
  3. package/lib/constants.ts +2 -5
  4. package/lib/county/subdivision.ts +2 -5
  5. package/lib/county.ts +2 -5
  6. package/lib/files.ts +4 -5
  7. package/lib/functional-status.ts +4 -7
  8. package/lib/geoid.ts +2 -5
  9. package/lib/index.ts +2 -5
  10. package/lib/legal-statistical-area.ts +2 -5
  11. package/lib/paths.ts +26 -0
  12. package/lib/schema.ts +3 -6
  13. package/lib/state.ts +2 -5
  14. package/lib/tabulation-block.ts +2 -5
  15. package/lib/tract.ts +2 -5
  16. package/out/block-group.d.ts +0 -5
  17. package/out/block-group.d.ts.map +1 -1
  18. package/out/block-group.js +2 -5
  19. package/out/block-group.js.map +1 -1
  20. package/out/class-code.d.ts +7 -13
  21. package/out/class-code.d.ts.map +1 -1
  22. package/out/class-code.js +9 -13
  23. package/out/class-code.js.map +1 -1
  24. package/out/constants.d.ts +0 -5
  25. package/out/constants.d.ts.map +1 -1
  26. package/out/constants.js +2 -5
  27. package/out/constants.js.map +1 -1
  28. package/out/county/subdivision.d.ts +0 -5
  29. package/out/county/subdivision.d.ts.map +1 -1
  30. package/out/county/subdivision.js +2 -5
  31. package/out/county/subdivision.js.map +1 -1
  32. package/out/county.d.ts +0 -5
  33. package/out/county.d.ts.map +1 -1
  34. package/out/county.js +2 -5
  35. package/out/county.js.map +1 -1
  36. package/out/files.d.ts +1 -5
  37. package/out/files.d.ts.map +1 -1
  38. package/out/files.js +3 -8
  39. package/out/files.js.map +1 -1
  40. package/out/functional-status.d.ts +2 -7
  41. package/out/functional-status.d.ts.map +1 -1
  42. package/out/functional-status.js +4 -7
  43. package/out/functional-status.js.map +1 -1
  44. package/out/geoid.d.ts +0 -5
  45. package/out/geoid.d.ts.map +1 -1
  46. package/out/geoid.js +2 -5
  47. package/out/geoid.js.map +1 -1
  48. package/out/index.d.ts +0 -5
  49. package/out/index.d.ts.map +1 -1
  50. package/out/index.js +2 -5
  51. package/out/index.js.map +1 -1
  52. package/out/legal-statistical-area.d.ts +0 -5
  53. package/out/legal-statistical-area.d.ts.map +1 -1
  54. package/out/legal-statistical-area.js +2 -5
  55. package/out/legal-statistical-area.js.map +1 -1
  56. package/out/paths.d.ts +12 -0
  57. package/out/paths.d.ts.map +1 -0
  58. package/out/paths.js +22 -0
  59. package/out/paths.js.map +1 -0
  60. package/out/schema.d.ts +1 -6
  61. package/out/schema.d.ts.map +1 -1
  62. package/out/schema.js +2 -5
  63. package/out/schema.js.map +1 -1
  64. package/out/sdk/download.d.ts +0 -8
  65. package/out/sdk/download.d.ts.map +1 -1
  66. package/out/sdk/download.js +4 -6
  67. package/out/sdk/download.js.map +1 -1
  68. package/out/sdk/fetch.d.ts +55 -6
  69. package/out/sdk/fetch.d.ts.map +1 -1
  70. package/out/sdk/fetch.js +58 -14
  71. package/out/sdk/fetch.js.map +1 -1
  72. package/out/sdk/gazetteer.d.ts +57 -0
  73. package/out/sdk/gazetteer.d.ts.map +1 -0
  74. package/out/sdk/gazetteer.js +82 -0
  75. package/out/sdk/gazetteer.js.map +1 -0
  76. package/out/sdk/redistricting.d.ts +2 -19
  77. package/out/sdk/redistricting.d.ts.map +1 -1
  78. package/out/sdk/redistricting.js +15 -13
  79. package/out/sdk/redistricting.js.map +1 -1
  80. package/out/sdk/state/TIGERTabulatedBlockEntity.d.ts +0 -5
  81. package/out/sdk/state/TIGERTabulatedBlockEntity.d.ts.map +1 -1
  82. package/out/sdk/state/TIGERTabulatedBlockEntity.js +2 -5
  83. package/out/sdk/state/TIGERTabulatedBlockEntity.js.map +1 -1
  84. package/out/sdk/state/TIGERTractEntity.d.ts +0 -5
  85. package/out/sdk/state/TIGERTractEntity.d.ts.map +1 -1
  86. package/out/sdk/state/TIGERTractEntity.js +2 -5
  87. package/out/sdk/state/TIGERTractEntity.js.map +1 -1
  88. package/out/sdk/state/block-operations.d.ts +0 -5
  89. package/out/sdk/state/block-operations.d.ts.map +1 -1
  90. package/out/sdk/state/block-operations.js +2 -5
  91. package/out/sdk/state/block-operations.js.map +1 -1
  92. package/out/sdk/state.d.ts +0 -5
  93. package/out/sdk/state.d.ts.map +1 -1
  94. package/out/sdk/state.js +2 -5
  95. package/out/sdk/state.js.map +1 -1
  96. package/out/sdk/tsconfig.tsbuildinfo +1 -1
  97. package/out/state.d.ts +0 -5
  98. package/out/state.d.ts.map +1 -1
  99. package/out/state.js +2 -5
  100. package/out/state.js.map +1 -1
  101. package/out/tabulation-block.d.ts +0 -5
  102. package/out/tabulation-block.d.ts.map +1 -1
  103. package/out/tabulation-block.js +2 -5
  104. package/out/tabulation-block.js.map +1 -1
  105. package/out/tools/race/dots/map.d.ts +0 -18
  106. package/out/tools/race/dots/map.d.ts.map +1 -1
  107. package/out/tools/race/dots/map.js +11 -11
  108. package/out/tools/race/dots/map.js.map +1 -1
  109. package/out/tools/race/dots.d.ts +0 -8
  110. package/out/tools/race/dots.d.ts.map +1 -1
  111. package/out/tools/race/dots.js +7 -8
  112. package/out/tools/race/dots.js.map +1 -1
  113. package/out/tools/serve-range.d.ts +6 -7
  114. package/out/tools/serve-range.d.ts.map +1 -1
  115. package/out/tools/serve-range.js +8 -7
  116. package/out/tools/serve-range.js.map +1 -1
  117. package/out/tools/tsconfig.tsbuildinfo +1 -1
  118. package/out/tract.d.ts +0 -5
  119. package/out/tract.d.ts.map +1 -1
  120. package/out/tract.js +2 -5
  121. package/out/tract.js.map +1 -1
  122. package/out/tsconfig.test.tsbuildinfo +1 -1
  123. package/package.json +5 -5
  124. package/sdk/download.ts +5 -6
  125. package/sdk/fetch.ts +116 -16
  126. package/sdk/gazetteer.ts +138 -0
  127. package/sdk/redistricting.ts +17 -14
  128. package/sdk/state/TIGERTabulatedBlockEntity.ts +2 -5
  129. package/sdk/state/TIGERTractEntity.ts +2 -5
  130. package/sdk/state/block-operations.ts +2 -5
  131. package/sdk/state.ts +2 -5
  132. package/tools/race/dots/map.ts +12 -11
  133. package/tools/race/dots.ts +8 -8
  134. 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";
@@ -1 +1 @@
1
- {"version":3,"file":"tract.d.ts","sourceRoot":"","sources":["../lib/tract.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,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"}
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
- * @copyright Sister Software.
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;;;;GAIG"}
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/@googlemaps/google-maps-services-js/node_modules/axios/package.json","../../../node_modules/@googlemaps/google-maps-services-js/node_modules/retry-axios/package.json","../../../node_modules/@googlemaps/google-maps-services-js/package.json","../../../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/agentkeepalive/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/@googlemaps/google-maps-services-js/dist/geocode/package.json","../../../node_modules/@googlemaps/google-maps-services-js/dist/package.json","../../../node_modules/@googlemaps/google-maps-services-js/dist/places/package.json","../../../node_modules/@googlemaps/google-maps-services-js/dist/roads/package.json","../../../node_modules/@googlemaps/google-maps-services-js/node_modules/agentkeepalive/package.json","../../../node_modules/@googlemaps/google-maps-services-js/node_modules/retry-axios/dist/package.json","../../../node_modules/@googlemaps/google-maps-services-js/node_modules/retry-axios/dist/src/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"]}
1
+ {"version":"7.0.2","root":["../lib/files.test.ts","../sdk/gazetteer.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/path-ts/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","../../core/package.json","../../recognizer/package.json","../../registry/package.json","../../spatial/package.json","../package.json"],"missingPackageJsons":["../../../node_modules/@edge-runtime/vm/package.json","../../../node_modules/@mailwoman/core/fs/temporary/package.json","../../../node_modules/@mailwoman/core/fs/writers/package.json","../../../node_modules/@mailwoman/recognizer/coordinates.generated/package.json","../../../node_modules/@mailwoman/recognizer/identifiers.generated/package.json","../../../node_modules/@mailwoman/recognizer/spatial.generated/package.json","../../../node_modules/@mailwoman/recognizer/types/package.json","../../../node_modules/@mailwoman/registry/types/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-ts/out/lib/package.json","../../../node_modules/path-ts/out/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": "11.0.0",
3
+ "version": "11.2.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": "11.0.0",
136
- "@mailwoman/spatial": "11.0.0",
137
- "@mailwoman/sqlite": "11.0.0",
135
+ "@mailwoman/core": "11.2.0",
136
+ "@mailwoman/spatial": "11.2.0",
137
+ "@mailwoman/sqlite": "11.2.0",
138
138
  "@turf/boolean-contains": "^7.4.0",
139
139
  "kysely": "^0.29.7",
140
140
  "path-ts": "^2.5.0",
@@ -145,6 +145,6 @@
145
145
  "@protomaps/basemaps": "^5.7.2"
146
146
  },
147
147
  "engines": {
148
- "node": "^24.22.1 || >=26.12.1"
148
+ "node": "^24.22.3 || >=26.13.1"
149
149
  }
150
150
  }
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
- * @copyright Sister Software
3
- * @license AGPL-3.0
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
- * @copyright Sister Software.
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
 
@@ -173,6 +171,115 @@ function buildRow(level: TIGERFetchLevel, p: Record<string, unknown>, geometry:
173
171
  }
174
172
  }
175
173
 
174
+ /**
175
+ * Downloads one TIGER/Line shapefile archive into `cacheDir` unless a valid copy is there, and extracts it.
176
+ *
177
+ * @param directory The product directory under `TIGER<vintage>/`, such as `PLACE`.
178
+ * @param product The product name in the file name, such as `place`.
179
+ * @param unit The state FIPS code, a state and county code, or `us` for a national file.
180
+ */
181
+ async function downloadTIGERLayer(
182
+ directory: string,
183
+ product: string,
184
+ unit: string,
185
+ vintage: number,
186
+ cacheDir: PathBuilder
187
+ ): Promise<{ layer: string; shpPath: PathBuilder; cached: boolean }> {
188
+ const layer = `tl_${vintage}_${unit}_${product}`
189
+ const zipPath = cacheDir(`${layer}.zip`)
190
+ const cached = await downloadIfNeeded(`${CENSUS_HOST}/geo/tiger/TIGER${vintage}/${directory}/${layer}.zip`, zipPath)
191
+
192
+ await extractZipEntries(zipPath, cacheDir)
193
+
194
+ return { layer, shpPath: cacheDir(`${layer}.shp`), cached }
195
+ }
196
+
197
+ /**
198
+ * A TIGER/Line boundary product that {@link readTIGERBoundaries} reads with its geometry.
199
+ */
200
+ export const TIGERBoundaryLevel = {
201
+ County: "county",
202
+ CountySubdivision: "cousub",
203
+ Place: "place",
204
+ } as const
205
+
206
+ export type TIGERBoundaryLevel = (typeof TIGERBoundaryLevel)[keyof typeof TIGERBoundaryLevel]
207
+
208
+ /**
209
+ * One boundary {@link readTIGERBoundaries} yields, in EPSG:4326.
210
+ */
211
+ export interface TIGERBoundary {
212
+ level: TIGERBoundaryLevel
213
+ geoid: string
214
+ /**
215
+ * The name with its legal/statistical area description (`NAMELSAD`), such as `Adjuntas Municipio`.
216
+ */
217
+ name: string
218
+ statefp: string
219
+ geometry: { type: string; coordinates: unknown }
220
+ }
221
+
222
+ /**
223
+ * Options for {@link readTIGERBoundaries}.
224
+ */
225
+ export interface ReadTIGERBoundariesOptions {
226
+ level: TIGERBoundaryLevel
227
+ /**
228
+ * The two-digit state or territory FIPS code, such as `"72"`.
229
+ */
230
+ stateFIPS: string
231
+ /**
232
+ * @defaultValue `2024`
233
+ */
234
+ vintage?: number
235
+ /**
236
+ * The root of the download cache.
237
+ *
238
+ * @defaultValue the Mailwoman data root.
239
+ */
240
+ dataRoot?: string
241
+ }
242
+
243
+ /**
244
+ * Downloads one state's or territory's TIGER/Line boundaries at `level` and yields each with its geometry.
245
+ *
246
+ * Counties come from the national file, filtered to the state.
247
+ * County subdivisions and places come from the state's own file.
248
+ *
249
+ * @throws When the Census Bureau serves no file for the state at `level`.
250
+ */
251
+ export async function* readTIGERBoundaries(options: ReadTIGERBoundariesOptions): AsyncGenerator<TIGERBoundary> {
252
+ const { level, stateFIPS } = options
253
+ const vintage = options.vintage ?? 2024
254
+ const unit = level === TIGERBoundaryLevel.County ? "us" : stateFIPS
255
+ const cacheDir = PathBuilder.from(options.dataRoot ?? DEFAULT_DATA_ROOT)("tiger", String(vintage), unit)
256
+
257
+ await makeDirectories(cacheDir)
258
+
259
+ const { layer, shpPath } = await downloadTIGERLayer(level.toUpperCase(), level, unit, vintage, cacheDir)
260
+
261
+ const sql = `SELECT GEOID AS geoid, NAMELSAD AS name, STATEFP AS statefp FROM "${layer}" WHERE STATEFP = '${stateFIPS}'`
262
+
263
+ for await (const feature of ogr2ogrGeoJSONSeq<{
264
+ properties?: { geoid?: string; name?: string; statefp?: string }
265
+ geometry?: TIGERBoundary["geometry"] | null
266
+ }>(["-f", "GeoJSONSeq", "-t_srs", "EPSG:4326", "-sql", sql, "/vsistdout/", shpPath], layer)) {
267
+ const { properties, geometry } = feature
268
+
269
+ if (!properties?.geoid || !geometry) {
270
+ throw new Error(`${layer}: a feature has no GEOID or no geometry`)
271
+ }
272
+
273
+ yield {
274
+ level,
275
+ geoid: properties.geoid,
276
+ name: properties.name ?? "",
277
+ statefp: properties.statefp ?? stateFIPS,
278
+ geometry,
279
+ }
280
+ }
281
+ }
282
+
176
283
  async function discoverCounties(state: string, vintage: number): Promise<string[]> {
177
284
  const html = await new APIClient({ displayName: "tiger-listing", retry: true })
178
285
  .fetch<string>({ url: `${CENSUS_HOST}/geo/tiger/TIGER${vintage}/ADDRFEAT/`, responseType: "text" })
@@ -204,7 +311,7 @@ export async function* fetchTIGER(options: FetchTIGEROptions): AsyncGenerator<Fe
204
311
 
205
312
  const cacheDir = dataRoot("tiger", String(vintage), state)
206
313
 
207
- const outPath = PathBuilder.from(options.outPath ?? dataRoot("tiger", "tiger.db"))
314
+ const outPath = PathBuilder.from(options.outPath ?? tigerDatabaseRoot(dataRoot)("tiger.db"))
208
315
  await makeDirectories(cacheDir)
209
316
  await makeDirectories(outPath.dirname())
210
317
 
@@ -259,16 +366,9 @@ export async function* fetchTIGER(options: FetchTIGEROptions): AsyncGenerator<Fe
259
366
 
260
367
  for (const geo of geoCodes) {
261
368
  const unit = level === "addrfeat" ? state + geo : state
262
- const zipName = `tl_${vintage}_${unit}_${level}.zip`
263
- const zipPath = cacheDir(zipName)
264
- const url = `${CENSUS_HOST}/geo/tiger/TIGER${vintage}/${LEVEL_DIR[level]}/${zipName}`
265
-
266
- const cached = await downloadIfNeeded(url, zipPath)
267
- yield { phase: "download", file: zipName, cached }
369
+ const { layer, shpPath, cached } = await downloadTIGERLayer(LEVEL_DIR[level], level, unit, vintage, cacheDir)
268
370
 
269
- await extractZipEntries(zipPath, cacheDir)
270
- const layer = `tl_${vintage}_${unit}_${level}`
271
- const shpPath = cacheDir(layer + ".shp")
371
+ yield { phase: "download", file: `${layer}.zip`, cached }
272
372
  yield { phase: "extract", file: layer + ".shp" }
273
373
 
274
374
  const args = [
@@ -0,0 +1,138 @@
1
+ // SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
2
+ // SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
3
+
4
+ /**
5
+ * @file The Census Bureau's national gazetteer files: one row per place or county subdivision, with its
6
+ * GEOID, its GNIS feature id (`ANSICODE`), its legal/statistical area description, its functional
7
+ * status and an interior point.
8
+ *
9
+ * The GNIS id ties a Census entity to the GNIS populated place of the same feature, and the GEOID ties
10
+ * it to a Who's On First record holding it as its `uscensus:geoid` concordance. A GNIS place whose
11
+ * Census entity a WOF record already holds is the same place, whatever either source calls it.
12
+ *
13
+ * A work of the United States Government, public domain under 17 U.S.C. § 105.
14
+ */
15
+
16
+ import { dataRootPath } from "@mailwoman/core/data-root"
17
+ import { readUnquotedTSV } from "@mailwoman/core/fs/delimited"
18
+ import { makeDirectories } from "@mailwoman/core/fs/writers"
19
+ import { extractZipEntries } from "@mailwoman/core/fs/zip"
20
+ import { PathBuilder, type PathBuilderLike } from "path-ts"
21
+
22
+ import { downloadIfNeeded } from "#sdk/download"
23
+
24
+ /**
25
+ * The gazetteer files {@link fetchCensusGazetteer} reads, by the name the Census Bureau files them under.
26
+ */
27
+ export const CensusGazetteerKind = {
28
+ Place: "place",
29
+ CountySubdivision: "cousubs",
30
+ } as const
31
+
32
+ export type CensusGazetteerKind = (typeof CensusGazetteerKind)[keyof typeof CensusGazetteerKind]
33
+
34
+ /**
35
+ * One row of a Census gazetteer file.
36
+ */
37
+ export interface CensusGazetteerEntry {
38
+ kind: CensusGazetteerKind
39
+ /**
40
+ * The USPS state code.
41
+ */
42
+ state: string
43
+ geoid: string
44
+ /**
45
+ * The GNIS feature id, from the zero-padded `ANSICODE`.
46
+ */
47
+ gnisID: number
48
+ name: string
49
+ /**
50
+ * The legal/statistical area description code (`LSAD`), or `null` in the county subdivision file.
51
+ * That file has no `LSAD` column.
52
+ */
53
+ lsad: string | null
54
+ /**
55
+ * The functional status code (`FUNCSTAT`), as `TIGERFunctionalStatus` defines it.
56
+ */
57
+ functionalStatus: string
58
+ latitude: number
59
+ longitude: number
60
+ }
61
+
62
+ /**
63
+ * The gazetteer vintage {@link fetchCensusGazetteer} reads unless told otherwise.
64
+ */
65
+ export const DEFAULT_CENSUS_GAZETTEER_VINTAGE = 2024
66
+
67
+ function gazetteerFileName(kind: CensusGazetteerKind, vintage: number): string {
68
+ return `${vintage}_Gaz_${kind}_national`
69
+ }
70
+
71
+ /**
72
+ * Downloads one national gazetteer file into `<dataRoot>/tiger/<vintage>/`
73
+ * unless a valid copy is there, and returns the path of its extracted text file.
74
+ */
75
+ export async function fetchCensusGazetteer(
76
+ kind: CensusGazetteerKind,
77
+ options: { vintage?: number; dataRoot?: PathBuilderLike } = {}
78
+ ): Promise<PathBuilder> {
79
+ const vintage = options.vintage ?? DEFAULT_CENSUS_GAZETTEER_VINTAGE
80
+ const directory = PathBuilder.from(options.dataRoot ?? dataRootPath())("tiger", String(vintage))
81
+ const name = gazetteerFileName(kind, vintage)
82
+ const zipPath = directory(`${name}.zip`)
83
+
84
+ await makeDirectories(directory)
85
+
86
+ await downloadIfNeeded(
87
+ `https://www2.census.gov/geo/docs/maps-data/data/gazetteer/${vintage}_Gazetteer/${name}.zip`,
88
+ zipPath
89
+ )
90
+
91
+ await extractZipEntries(zipPath, directory, { skipExisting: true })
92
+
93
+ return directory(`${name}.txt`)
94
+ }
95
+
96
+ /**
97
+ * Reads a national gazetteer text file.
98
+ *
99
+ * The files are tab-separated with a header row, and they pad the last column with trailing spaces.
100
+ *
101
+ * @throws When the header lacks a column the reader needs.
102
+ */
103
+ export async function* readCensusGazetteer(
104
+ path: PathBuilderLike,
105
+ kind: CensusGazetteerKind
106
+ ): AsyncGenerator<CensusGazetteerEntry> {
107
+ let header: string[] | null = null
108
+
109
+ const at = (column: string): number => {
110
+ const index = header!.indexOf(column)
111
+
112
+ if (index === -1) throw new Error(`${path}: the gazetteer header has no ${column} column`)
113
+
114
+ return index
115
+ }
116
+
117
+ for await (const fields of readUnquotedTSV(path)) {
118
+ const row = fields.map((field) => String(field ?? "").trim())
119
+
120
+ if (!header) {
121
+ header = row
122
+
123
+ continue
124
+ }
125
+
126
+ yield {
127
+ kind,
128
+ state: row[at("USPS")]!,
129
+ geoid: row[at("GEOID")]!,
130
+ gnisID: Number(row[at("ANSICODE")]),
131
+ name: row[at("NAME")]!,
132
+ lsad: header.includes("LSAD") ? row[at("LSAD")]! : null,
133
+ functionalStatus: row[at("FUNCSTAT")]!,
134
+ latitude: Number(row[at("INTPTLAT")]),
135
+ longitude: Number(row[at("INTPTLONG")]),
136
+ }
137
+ }
138
+ }
@@ -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
- * @copyright Sister Software.
3
- * @license AGPL-3.0
4
- * @author Teffen Ellis, et al.
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
- * Pull a state's Census 2020 P.L. 94-171 redistricting counts (table P2 — Hispanic-or-Latino by
7
- * race, per block) into the `pl_block` table of a tiger {@link DatabaseClient} DB, keyed on the
8
- * same 15-char block `geoid` as {@link fetchTIGER}'s `tabblock20`. Join the two for block-level
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
- * Keyless public data. The per-state ZIP holds a pipe-delimited geographic header
12
- * (`<st>geo<yr>.pl`) and three data segments. segment 1 (`<st>00001<yr>.pl`) contains P1 + P2. We
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 does not hold.
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", "tiger.db"))
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
- * @copyright Sister Software.
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
- * @copyright Sister Software.
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
- * @copyright Sister Software.
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
- * @copyright Sister Software.
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"
@@ -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
- * @copyright Sister Software
3
- * @license AGPL-3.0
4
- * @author Teffen Ellis, et al.
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
- * Render a race-by-dot-density PMTiles tileset (from `race-dots.ts` → tippecanoe) as a standalone
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 — a
12
- * representation rather than a record about any address. Serve over localhost (the house tile server
13
- * cors-restricts to localhost + the docs domains) — `mailwoman tiger race-dots-map --serve` wires
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`
@@ -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
- * @copyright Sister Software
3
- * @license AGPL-3.0
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 { dataRootPath, tempRootPath } from "@mailwoman/core/data-root"
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 || dataRootPath("tiger", "tiger-oc.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"