Commands - MyFriendBen/benefits-api GitHub Wiki

Commands

This document lists frequently used commands to assist developers. Additional commands can be found under the Validations page.

add_config

The add_config command updates or creates configuration data for one or more white labels in the database.

Usage:

python manage.py add_config <[--all] | [white_label ...]>

Examples:

  • Update all white labels:

    python manage.py add_config --all

  • Update specific white labels:

    python manage.py add_config co

    python manage.py add_config nc

    python manage.py add_config co nc

Flags:

  • -a or --all: Update configurations for all white labels.

  • [white_label ...]: Specify one or more white labels to update (e.g., co, nc).


pull_screen

The pull_screen command allows you to fetch screen input from another environment into your development environment.

Usage:

python manage.py pull_screen <domain_of_environment> <uuid>

  • domain_of_environment: The domain of the Django admin for the environment you want to pull from. Do not include a trailing slash.

  • uuid: The unique identifier from the URL.

Example:

python manage.py pull_screen https://example.com 12341234-1234-1234-1234-123412341234

API Key:

  • If the DEV_API_KEY field is not set in your .env file, you will be prompted to enter an API key manually.

  • The API key must have access to the screen endpoint in the target environment.

  • To avoid entering the API key repeatedly, add DEV_API_KEY to your .env file.

Flags:

  • --no-bypass: Do not use the environment variable for the API key; prompt for it instead. Use this flag when pulling from a different environment without changing the DEV_API_KEY value.

Example with Flag:

python manage.py pull_screen https://example.com 12341234-1234-1234-1234-123412341234 --no-bypass


transfer

The transfer command copies programs and their translations from one white label (state) to another.

Usage:

python manage.py transfer <target_state> <name_abbreviated> [additional_name_abbreviated...]

  • target_state: The target state code (white label) to transfer programs to.

  • name_abbreviated: The abbreviated name of the program to copy.

  • [additional_name_abbreviated...]: (Optional) Additional program names to copy.

Example:

  • Transfer a single program:

    python manage.py transfer ma ssi

    • ma: Target white label (Massachusetts).
    • ssi: Supplemental Security Income program.
  • Transfer multiple programs:

    python manage.py transfer ma ssi ctc

    • ma: Target white label (Massachusetts).
    • ssi: Supplemental Security Income program.
    • ctc: Child Tax Credit program.

Notes:

  • This command ensures that all associated translations for the programs are included in the transfer.
  • The programs in the source and target white labels share the same abbreviated names.

Readability Check:

We use a readability check tool to ensure translation content is accessible to users with varying reading levels. The tool analyzes text using industry-standard metrics:

  • English: Flesch-Kincaid Grade Level (target: 8th grade or below)
  • Spanish: Fernández-Huerta score (target: 60+ for good readability)
  • Check all English translations

python manage.py check_readability --language en-us

  • Check English for specific white-label (Colorado)

python manage.py check_readability --language en --whitelabel co

  • Check Spanish translations

python manage.py check_readability --language es --whitelabel co

  • With custom threshold (6th grade level)

python manage.py check_readability --language en --whitelabel co --threshold 6

  • Show detailed scores for each translation

python manage.py check_readability --language en --whitelabel co --detailed

  • CI/CD mode - exit with error code if failures found

python manage.py check_readability --language en --whitelabel co --fail-on-error

  • Also show passing translations

python manage.py check_readability --language en --whitelabel co --show-passing

⚠️ **GitHub.com Fallback** ⚠️