Skip to content

Latest commit

 

History

History
238 lines (183 loc) · 7.64 KB

README.md

File metadata and controls

238 lines (183 loc) · 7.64 KB

DistrictBuilder command-line interface

Note: the majority of this README is auto-generated by running:

docker-compose run --rm manage ./node_modules/.bin/oclif-dev readme

If there are any changes to the commands/arguments/parameters, run that command to regenerate this file. The auto-generated README assumes that this CLI will be packaged up and put on NPM. This may be the case in the future, but until then, commands may be run using ./scripts/manage rather than using the binary manage. For example, to see help on the process-geojson, run: ./scripts/manage process-geojson --help.

Usage

$ npm install -g manage
$ manage COMMAND
running command...
$ manage (-v|--version|version)
manage/0.1.0 linux-x64 node-v12.22.8
$ manage --help [COMMAND]
USAGE
  $ manage COMMAND
...

Commands

manage bulk-reprocess-regions CONFIGFILE

use a configuration file to process and update many regions

USAGE
  $ manage bulk-reprocess-regions CONFIGFILE

ARGUMENTS
  CONFIGFILE
      Path to a configuration file containing information on how each region should be processed.

      The configuration file should be a JSON file with the following format:
      {
         "US": {
           "DE": {
             "geojsonFile": "data/input/de.geojson",
             "updateS3Dir": "s3://path/to/timestamped/data/files/like/US/DE/2021-09-23T18:43:42.300Z/",
             "processGeojsonFlags": [
               "-n",
               "12,4,4",
               "-x",
               "12,12,12",
               "-d",
               "population,white,black,asian,hispanic,native:nativeAmerican,pacific:pacificIslander"
             ]
           }
         }
      }

      Within each state, the parameters are as follows:
      - geojsonFile: Behaves identically to the equivalent parameter to the process-geojson command
      - updateS3Dir: Behaves identically to the equivalent parameter to the update-region command, and is also used as the 
      --inputS3Dir to process-geojson.
      - processGeojsonFlags: All flags that could be passed to the process-geojson command are valid EXCEPT --inputS3Dir; 
      flags should be entered as an array of strings.

OPTIONS
  --dryRun  Dry run; only prints actions that would be taken.

manage create-random-projects NUMBER [REGION]

creates randomly generated projects for development testing

USAGE
  $ manage create-random-projects NUMBER [REGION]

ARGUMENTS
  NUMBER  Number of projects to create
  REGION  [default: all] Region code to create projects for, or 'all'. Defaults to 'all'

manage help [COMMAND]

display help for manage

USAGE
  $ manage help [COMMAND]

ARGUMENTS
  COMMAND  command to show help for

OPTIONS
  --all  see all commands in CLI

See code: @oclif/plugin-help

manage process-geojson FILE

process GeoJSON into desired output files

USAGE
  $ manage process-geojson FILE

OPTIONS
  -b, --big
      Use this for big GeoJSON files (~1GB+) that need to be streamed

  -d, --demographics=demographics
      [default: population,white,black,asian,hispanic,other] Comma-separated group of census demographics to select and 
      aggregate
             To use a different name for the property from the GeoJSON property, separate values by ':'
             e.g. -d pop:population,wht:white,blk:black

             The first value in the group will be used as population, and the remaining values will be displayed
             as a percentage of that population.

             To create multiple groups, use the -d option once per group.
             e.g. -d population,white,black,asian,hispanic,other -d "VAP,VAP White, VAP Black, VAP Asian, VAP Hispanic, 
      VAP Other"

  -f, --filterPrefix=filterPrefix
      Filter to only base geounits containing the specified prefix

  -l, --levels=levels
      [default: block,blockgroup,county] Comma-separated geolevel hierarchy: smallest to largest
             To use a different name for the layer ID from the GeoJSON property, separate values by ':'
             e.g. -l geoid:block,blockgroupuuid:blockgroup,county

  -n, --levelMinZoom=levelMinZoom
      [default: 8,0,0] Comma-separated minimum zoom level per geolevel, must match # of levels

  -o, --outputDir=outputDir
      [default: ./] Directory to output files

  -q, --quantization=quantization
      [default: 1e5] Topojson quantization transform, 0 to skip

  -s, --simplification=simplification
      [default: 0.0000000025] Topojson simplification amount (minWeight)

  -u, --inputS3Dir=inputS3Dir
      S3 directory for the previous run if we will be updating in-place

  -v, --voting=voting
      Comma-separated election data to select and aggregate
             To use a different name for the layer property from the GeoJSON property, separate values by ':'
             e.g. -v voterep:republican,votedem:democrat,voteoth:other

  -x, --levelMaxZoom=levelMaxZoom
      [default: g,g,g] Comma-separated maximum zoom level per geolevel, must match # of levels

DESCRIPTION
  Note: this can be a very memory-intensive operation,
  depending on the size of the GeoJSON. If you receive
  an error related to memory usage, you can increase
  the Node.js memory limit by setting the following
  environment variable (as large as needed):

  NODE_OPTIONS="--max-old-space-size=14336"

  Relatedly, set the -b flag for very large GeoJSON files
  that need to be streamed. This is slower, so only use
  it when necessary (file sizes ~1GB+).

manage publish-region STATICDATADIR COUNTRYCODE REGIONCODE REGIONNAME

upload processed region files to S3

USAGE
  $ manage publish-region STATICDATADIR COUNTRYCODE REGIONCODE REGIONNAME

ARGUMENTS
  STATICDATADIR  Directory of the region's static data (the output of `process-geojson`)
  COUNTRYCODE    Country code, e.g. US
  REGIONCODE     Region code, e.g. PA
  REGIONNAME     Name of the region, e.g. Pennsylvania

OPTIONS
  -b, --bucketName=bucketName  [default: global-districtbuilder-dev-us-east-1] Bucket to upload the files to

manage serialize-topojson

reprocess topojson files into binary format

USAGE
  $ manage serialize-topojson

DESCRIPTION
  Pass a list of s3_uri paths to reprocess, e.g.
     serialize-topojson s3://bucket-name/regions/US/PA s3://other-bucket-name/regions/US/DE

manage update-organization CONFIG

update or create organization information from a YAML configuration

USAGE
  $ manage update-organization CONFIG

ARGUMENTS
  CONFIG  Path to YAML configuration file with organization details

manage update-region STATICDATADIR UPDATES3DIR

update processed region files in-place on S3

USAGE
  $ manage update-region STATICDATADIR UPDATES3DIR

ARGUMENTS
  STATICDATADIR  Directory of the region's static data (the output of `process-geojson`)
  UPDATES3DIR    S3 directory to update in-place