From dc5a35fd57a57b198e24281f5642be90114fdc99 Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 7 May 2024 15:33:10 -0600 Subject: [PATCH 1/9] add black formatter --- .github/workflows/format.yaml | 18 ++++++++++++++++++ Makefile | 2 ++ 2 files changed, 20 insertions(+) create mode 100644 .github/workflows/format.yaml create mode 100644 Makefile diff --git a/.github/workflows/format.yaml b/.github/workflows/format.yaml new file mode 100644 index 00000000..41aabeca --- /dev/null +++ b/.github/workflows/format.yaml @@ -0,0 +1,18 @@ +name: black-action +on: [push, pull_request] +jobs: + linter_name: + name: runner / black + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Check files using the black formatter + uses: rickstaa/action-black@v1 + id: action_black + with: + black_args: ". -l 120" + - name: Annotate diff changes using reviewdog + if: steps.action_black.outputs.is_formatted == 'true' + uses: reviewdog/action-suggester@v1 + with: + tool_name: blackfmt diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..1a102f57 --- /dev/null +++ b/Makefile @@ -0,0 +1,2 @@ +format: + python -m black . -l 120 From d6b222238ef8b5ff169b4d35cb0a771f5ac1a1e3 Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 7 May 2024 15:43:22 -0600 Subject: [PATCH 2/9] update try a different gh action --- .github/workflows/format.yaml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/format.yaml b/.github/workflows/format.yaml index 41aabeca..e419a2b2 100644 --- a/.github/workflows/format.yaml +++ b/.github/workflows/format.yaml @@ -10,9 +10,16 @@ jobs: uses: rickstaa/action-black@v1 id: action_black with: - black_args: ". -l 120" - - name: Annotate diff changes using reviewdog + black_args: "." + - name: Create Pull Request if: steps.action_black.outputs.is_formatted == 'true' - uses: reviewdog/action-suggester@v1 + uses: peter-evans/create-pull-request@v6 with: - tool_name: blackfmt + token: ${{ secrets.GITHUB_TOKEN }} + title: "Format Python code with psf/black push" + commit-message: ":art: Format Python code with psf/black" + body: | + There appear to be some python formatting errors in ${{ github.sha }}. This pull request + uses the [psf/black](https://github.com/psf/black) formatter to fix these issues. + base: ${{ github.head_ref }} # Creates pull request onto pull request or commit branch + branch: actions/black From dd6b13a2cd02a72d5238999ddb892ee90261a9a0 Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 7 May 2024 15:57:36 -0600 Subject: [PATCH 3/9] use basic formatting gh action --- .github/workflows/format.yaml | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/.github/workflows/format.yaml b/.github/workflows/format.yaml index e419a2b2..5eeed422 100644 --- a/.github/workflows/format.yaml +++ b/.github/workflows/format.yaml @@ -2,24 +2,10 @@ name: black-action on: [push, pull_request] jobs: linter_name: - name: runner / black + name: runner / black formatter runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Check files using the black formatter - uses: rickstaa/action-black@v1 - id: action_black + - uses: rickstaa/action-black@v1 with: - black_args: "." - - name: Create Pull Request - if: steps.action_black.outputs.is_formatted == 'true' - uses: peter-evans/create-pull-request@v6 - with: - token: ${{ secrets.GITHUB_TOKEN }} - title: "Format Python code with psf/black push" - commit-message: ":art: Format Python code with psf/black" - body: | - There appear to be some python formatting errors in ${{ github.sha }}. This pull request - uses the [psf/black](https://github.com/psf/black) formatter to fix these issues. - base: ${{ github.head_ref }} # Creates pull request onto pull request or commit branch - branch: actions/black + black_args: ". --check" From 034a8172d0669da00eabd269d2012bb9a89ae4c0 Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 7 May 2024 15:59:30 -0600 Subject: [PATCH 4/9] format --- authentication/admin.py | 23 +- authentication/apps.py | 4 +- authentication/migrations/0001_initial.py | 90 +- ...e_user_cell_user_email_or_cell_and_more.py | 27 +- authentication/migrations/0003_user_screen.py | 17 +- .../migrations/0004_user_tcpa_consent.py | 7 +- ...cell_alter_user_email_alter_user_screen.py | 23 +- .../migrations/0006_remove_user_screen.py | 7 +- .../0007_alter_user_cell_alter_user_email.py | 17 +- ...0008_user_send_offers_user_send_updates.py | 11 +- ...er_user_first_name_alter_user_last_name.py | 11 +- .../migrations/0010_user_language_code.py | 7 +- .../migrations/0011_alter_user_managers.py | 8 +- .../migrations/0012_user_external_id.py | 7 +- authentication/models.py | 20 +- authentication/serializers.py | 50 +- authentication/urls.py | 6 +- authentication/views.py | 19 +- benefits/asgi.py | 2 +- benefits/settings.py | 198 +- benefits/urls.py | 36 +- benefits/views.py | 10 +- benefits/wsgi.py | 2 +- configuration/admin.py | 6 +- .../management/commands/add_config.py | 2587 ++++++++++++++++- configuration/models.py | 5 +- configuration/serializers.py | 3 +- configuration/urls.py | 4 +- configuration/views.py | 4 +- integrations/apps.py | 2 +- .../management/commands/hubspotsync.py | 50 +- .../services/communications/__init__.py | 1 - .../services/communications/message.py | 20 +- .../services/google_translate/integration.py | 28 +- integrations/services/hubspot/integration.py | 63 +- integrations/services/sheets/sheets.py | 31 +- integrations/util/cache.py | 4 +- manage.py | 4 +- programs/admin.py | 26 +- programs/apps.py | 4 +- programs/co_county_zips.py | 4 +- programs/management/commands/add_history.py | 65 +- programs/management/commands/diff_history.py | 32 +- programs/management/commands/quick_start.py | 198 +- .../management/commands/rm_latest_history.py | 10 +- programs/migrations/0001_initial.py | 27 +- .../0002_program_programnameshort.py | 9 +- ...link_program_apply_button_link_and_more.py | 57 +- ...gram_snapshot_program_description_short.py | 9 +- .../0005_rename_program_name_program_name.py | 9 +- ...escription_program_description_and_more.py | 15 +- ...7_alter_program_estimated_delivery_time.py | 7 +- ...008_alter_program_legal_status_required.py | 7 +- .../migrations/0009_program_value_type.py | 9 +- ...ink_program__apply_button_link_and_more.py | 63 +- .../migrations/0011_add_translation_model.py | 52 +- .../0012_migrate_translatable_fields.py | 30 +- ...ove_program__apply_button_link_and_more.py | 43 +- ...mtranslation_estimated_application_time.py | 7 +- .../0015_programtranslation_active.py | 7 +- .../0016_alter_programtranslation_active.py | 7 +- .../0017_navigator_navigatortranslation.py | 53 +- .../0018_alter_navigatortranslation_cell.py | 7 +- ...igatortranslation_phone_number_and_more.py | 15 +- ...020_remove_navigatortranslation_program.py | 7 +- .../0021_navigatortranslation_program.py | 9 +- ...tortranslation_assistance_link_and_more.py | 35 +- .../0023_navigator_assistance_link.py | 7 +- ...move_navigator_assistance_link_and_more.py | 29 +- ...igatortranslation_phone_number_and_more.py | 11 +- ..._remove_navigator_phone_number_and_more.py | 11 +- ...igatortranslation_phone_number_and_more.py | 11 +- .../0028_alter_navigator_phone_number.py | 7 +- .../0029_programtranslation_catagory.py | 9 +- ...me_catagory_programtranslation_category.py | 9 +- .../0031_urgentneed_urgentneedtranslation.py | 55 +- ...urgentneedfunction_urgentneed_functions.py | 15 +- .../0033_alter_urgentneed_functions.py | 9 +- .../0034_alter_urgentneedtranslation_link.py | 7 +- .../migrations/0035_federalpoverylimit.py | 25 +- ...ederalpoverylimit_has_2_people_and_more.py | 45 +- .../0037_alter_federalpoverylimit_year.py | 7 +- programs/migrations/0038_program_fpl.py | 15 +- ...okfunction_referrer_referrertranslation.py | 68 +- ...alter_referrer_white_label_css_and_more.py | 31 +- ...emove_referrer_white_label_css_and_more.py | 117 +- .../migrations/0042_auto_20230905_1620.py | 54 +- .../migrations/0043_auto_20230906_0938.py | 35 +- ...rogram_legal_status_required_1_and_more.py | 11 +- .../migrations/0045_auto_20230906_0951.py | 17 +- .../0046_delete_programtranslation.py | 5 +- .../0047_alter_program_active_1_and_more.py | 99 +- ...rename_active_1_program_active_and_more.py | 75 +- ...link_1_navigator_description_1_and_more.py | 189 +- .../migrations/0050_auto_20230906_1427.py | 53 +- ...eedtranslation_unique_together_and_more.py | 13 +- ...er_navigator_assistance_link_1_and_more.py | 85 +- ...nk_1_navigator_assistance_link_and_more.py | 51 +- ...nal_name_program_external_name_and_more.py | 15 +- ..._alter_navigator_external_name_and_more.py | 15 +- ...y_remove_urgentneed_type_short_and_more.py | 19 +- ...ter_urgentneedcategory_options_and_more.py | 34 +- .../0058_program_legal_status_required.py | 9 +- ...059_alter_program_legal_status_required.py | 9 +- .../0060_alter_navigator_program.py | 4 +- .../0061_referrer_remove_programs.py | 4 +- .../0062_document_program_documents.py | 4 +- ...62_navigatorcounties_navigator_counties.py | 4 +- ...ounty_delete_navigatorcounties_and_more.py | 4 +- .../migrations/0066_auto_20240130_1146.py | 12 +- programs/models.py | 213 +- programs/programs/__init__.py | 5 +- programs/programs/calc.py | 38 +- programs/programs/co/__init__.py | 55 +- .../co/basic_cash_assistance/calculator.py | 4 +- programs/programs/co/cash_back/calculator.py | 2 +- .../co/child_care_assistance/calculator.py | 45 +- .../co/connect_for_health/calculator.py | 27 +- .../programs/co/connect_for_health/tests.py | 12 +- .../dental_health_care_seniors/calculator.py | 15 +- .../co/dental_health_care_seniors/tests.py | 14 +- .../co/denver_preschool_program/calculator.py | 8 +- .../co/denver_preschool_program/tests.py | 9 +- .../emergency_rental_assistance/calculator.py | 11 +- .../co/energy_assistance/calculator.py | 19 +- .../co/energy_resource_center/calculator.py | 16 +- .../co/energy_resource_center/tests.py | 13 +- .../programs/co/every_day_eats/calculator.py | 4 +- programs/programs/co/every_day_eats/tests.py | 12 +- .../co/low_wage_covid_relief/calculator.py | 10 +- .../adult_with_disability/calculator.py | 41 +- .../child_with_disability/calculator.py | 35 +- .../co/medicaid/emergency/calculator.py | 13 +- .../family_planning_services/calculator.py | 17 +- .../family_planning_services/tests.py | 19 +- programs/programs/co/my_spark/calculator.py | 12 +- programs/programs/co/mydenver/calculator.py | 10 +- programs/programs/co/nfp/calculator.py | 21 +- programs/programs/co/omnisalud/calculator.py | 4 +- programs/programs/co/omnisalud/tests.py | 14 +- programs/programs/co/pe/__init__.py | 13 +- programs/programs/co/pe/member.py | 8 +- programs/programs/co/pe/tax.py | 16 +- .../co/property_credit_rebate/calculator.py | 20 +- .../co/property_credit_rebate/tests.py | 16 +- .../co/rental_assistance_grant/calculator.py | 9 +- .../co/reproductive_health_care/calculator.py | 6 +- .../co/reproductive_health_care/tests.py | 8 +- programs/programs/co/rtdlive/calculator.py | 20 +- programs/programs/co/tabor/calculator.py | 6 +- programs/programs/co/trua/calculator.py | 6 +- .../co/universal_preschool/calculator.py | 25 +- .../co/utility_bill_pay/calculator.py | 6 +- .../weatherization_assistance/calculator.py | 6 +- programs/programs/federal/__init__.py | 6 +- .../programs/federal/head_start/calculator.py | 14 +- .../federal/head_start/eligible_zipcodes.py | 76 +- programs/programs/federal/head_start/tests.py | 18 +- .../federal/medicare_savings/calculator.py | 30 +- programs/programs/federal/pe/__init__.py | 21 +- programs/programs/federal/pe/member.py | 27 +- programs/programs/federal/pe/spm.py | 12 +- programs/programs/federal/pe/tax.py | 7 +- programs/programs/federal/ssdi/calculator.py | 9 +- programs/programs/messages.py | 110 +- programs/programs/nc/pe/__init__.py | 3 +- programs/programs/nc/pe/member.py | 7 +- .../policyengine/calculators/__init__.py | 14 +- .../programs/policyengine/calculators/base.py | 30 +- .../policyengine/calculators/constants.py | 6 +- .../calculators/dependencies/base.py | 42 +- .../calculators/dependencies/member.py | 112 +- .../calculators/dependencies/spm.py | 112 +- .../calculators/dependencies/tax.py | 16 +- .../programs/policyengine/policy_engine.py | 42 +- .../urgent_needs/urgent_need_functions.py | 213 +- programs/serializers.py | 6 +- programs/urls.py | 10 +- programs/views.py | 12 +- screener/admin.py | 3 +- screener/apps.py | 4 +- .../management/commands/batch_snapshots.py | 34 +- .../management/commands/email_new_benefits.py | 22 +- screener/migrations/0001_initial.py | 58 +- .../0002_screen_housing_situation_expense.py | 21 +- .../0003_rename_type_incomestream_name.py | 9 +- .../0004_remove_incomestream_label.py | 7 +- .../0005_alter_incomestream_screen.py | 11 +- .../0006_rename_name_expense_type_and_more.py | 23 +- .../0007_rename_applicant_age_screen_age.py | 9 +- screener/migrations/0008_householdmember.py | 44 +- .../0009_remove_householdmember_zipcode.py | 7 +- ...ove_screen_disability_medicaid_and_more.py | 55 +- .../0011_expense_household_member_and_more.py | 25 +- ...2_alter_householdmember_screen_and_more.py | 29 +- .../0013_householdmember_relationship.py | 9 +- .../0014_screen_cell_screen_email.py | 11 +- .../migrations/0015_remove_screen_cell.py | 7 +- .../migrations/0016_remove_screen_email.py | 7 +- .../0017_screen_last_email_request_date.py | 7 +- screener/migrations/0018_screen_user.py | 15 +- screener/migrations/0019_screen_start_date.py | 7 +- screener/migrations/0020_screen_is_test.py | 7 +- screener/migrations/0021_messages.py | 30 +- .../0022_rename_messages_message.py | 7 +- ...me_message_message_content_message_type.py | 15 +- ..._alter_message_cell_alter_message_email.py | 13 +- .../migrations/0025_screen_external_id.py | 7 +- .../migrations/0026_screen_filed_taxes.py | 7 +- .../0027_remove_screen_filed_taxes.py | 7 +- .../0028_screen_last_tax_filing_year.py | 7 +- .../0029_alter_screen_housing_situation.py | 7 +- ...creen_has_ccb_screen_has_cccap_and_more.py | 63 +- ...holdmember_disability_medicaid_and_more.py | 11 +- screener/migrations/0032_message_uid.py | 7 +- .../migrations/0033_screen_referral_source.py | 7 +- .../0034_alter_screen_household_assets.py | 7 +- screener/migrations/0035_screen_county.py | 7 +- .../0036_screen_request_language_code.py | 7 +- ...litysnapshot_programeligibilitysnapshot.py | 51 +- ...hot_estimated_application_time_and_more.py | 23 +- screener/migrations/0039_screen_has_ssi.py | 7 +- ..._chp_hi_screen_has_employer_hi_and_more.py | 23 +- .../migrations/0041_screen_referrer_code.py | 7 +- ...042_screen_needs_baby_supplies_and_more.py | 27 +- .../migrations/0043_screen_has_medicare_hi.py | 7 +- .../migrations/0044_screen_is_verified.py | 7 +- screener/migrations/0045_screen_uuid.py | 7 +- screener/migrations/0046_alter_screen_uuid.py | 7 +- .../0047_incomestream_hours_worked.py | 7 +- .../0048_screen_needs_family_planning_help.py | 7 +- .../0049_eligibilitysnapshot_batch.py | 7 +- ...name_batch_eligibilitysnapshot_is_batch.py | 9 +- .../0051_programeligibilitysnapshot_new.py | 7 +- .../0052_alter_expense_household_member.py | 14 +- ...r_householdmember_has_expenses_and_more.py | 11 +- ...amount_alter_expense_frequency_and_more.py | 95 +- ..._has_andcs_screen_has_benefits_and_more.py | 45 +- screener/migrations/0056_screen_completed.py | 7 +- .../0057_screen_has_coctc_screen_has_upk.py | 11 +- ...kfunctions_webhooks_webhookstranslation.py | 50 +- ...ookfunction_webhooktranslation_and_more.py | 68 +- .../migrations/0060_screen_is_test_data.py | 7 +- .../0061_alter_screen_is_test_data.py | 7 +- .../0062_alter_screen_is_test_data.py | 7 +- ...ooktranslation_unique_together_and_more.py | 15 +- ..._screen_needs_dental_care_help_and_more.py | 15 +- ...ntal_care_help_screen_needs_dental_care.py | 9 +- .../migrations/0066_screen_is_13_or_older.py | 7 +- ...ense_household_member_alter_screen_user.py | 26 +- .../0068_householdmember_insurance.py | 23 +- ...i_alter_screen_has_employer_hi_and_more.py | 27 +- ...igibilitysnapshot_legal_status_required.py | 7 +- .../0074_alter_screen_household_assets.py | 4 +- .../0075_alter_screen_household_assets.py | 4 +- screener/models.py | 243 +- screener/one_time_scripts.py | 220 +- screener/serializers.py | 232 +- screener/tests.py | 20 +- screener/urls.py | 13 +- screener/views.py | 138 +- screener/webhooks.py | 12 +- translations/admin.py | 2 +- translations/apps.py | 4 +- translations/bulk_import_translations.py | 34 +- .../management/commands/bulk_export.py | 6 +- .../management/commands/bulk_import.py | 15 +- .../management/commands/bulk_translate.py | 16 +- translations/migrations/0001_initial.py | 45 +- .../migrations/0002_translation_active.py | 7 +- .../0003_alter_translation_managers.py | 7 +- .../migrations/0004_translation_no_auto.py | 7 +- translations/models.py | 31 +- translations/urls.py | 46 +- translations/views.py | 308 +- 275 files changed, 6376 insertions(+), 3715 deletions(-) diff --git a/authentication/admin.py b/authentication/admin.py index 28ede927..57ce4997 100644 --- a/authentication/admin.py +++ b/authentication/admin.py @@ -4,23 +4,26 @@ class CustomUserAdmin(UserAdmin): - ordering = ('email_or_cell', 'email') + ordering = ("email_or_cell", "email") - list_display = ('email_or_cell', 'is_staff') - list_filter = ('is_staff',) + list_display = ("email_or_cell", "is_staff") + list_filter = ("is_staff",) fieldsets = ( - (None, {'fields': ('email_or_cell', 'password')}), - ('Personal info', {'fields': ('email', 'cell')}), - ('Permissions', {'fields': ('is_staff', 'tcpa_consent', 'groups')}), + (None, {"fields": ("email_or_cell", "password")}), + ("Personal info", {"fields": ("email", "cell")}), + ("Permissions", {"fields": ("is_staff", "tcpa_consent", "groups")}), ) # add_fieldsets is not a standard ModelAdmin attribute. UserAdmin # overrides get_fieldsets to use this attribute when creating a user. add_fieldsets = ( - (None, { - 'classes': ('wide',), - 'fields': ('email_or_cell', 'password1', 'password2', 'email', 'cell', 'tcpa_consent', 'is_staff'), - }), + ( + None, + { + "classes": ("wide",), + "fields": ("email_or_cell", "password1", "password2", "email", "cell", "tcpa_consent", "is_staff"), + }, + ), ) diff --git a/authentication/apps.py b/authentication/apps.py index ead97686..7b90ca12 100644 --- a/authentication/apps.py +++ b/authentication/apps.py @@ -2,5 +2,5 @@ class AuthConfig(AppConfig): - default_auto_field = 'django.db.models.BigAutoField' - name = 'authentication' + default_auto_field = "django.db.models.BigAutoField" + name = "authentication" diff --git a/authentication/migrations/0001_initial.py b/authentication/migrations/0001_initial.py index dc1b18f1..8b950326 100644 --- a/authentication/migrations/0001_initial.py +++ b/authentication/migrations/0001_initial.py @@ -7,38 +7,88 @@ class Migration(migrations.Migration): - initial = True dependencies = [ - ('auth', '0012_alter_user_first_name_max_length'), + ("auth", "0012_alter_user_first_name_max_length"), ] operations = [ migrations.CreateModel( - name='User', + name="User", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('password', models.CharField(max_length=128, verbose_name='password')), - ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')), - ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')), - ('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')), - ('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')), - ('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')), - ('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')), - ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')), - ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')), - ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')), - ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.group', verbose_name='groups')), - ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.permission', verbose_name='user permissions')), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("password", models.CharField(max_length=128, verbose_name="password")), + ("last_login", models.DateTimeField(blank=True, null=True, verbose_name="last login")), + ( + "is_superuser", + models.BooleanField( + default=False, + help_text="Designates that this user has all permissions without explicitly assigning them.", + verbose_name="superuser status", + ), + ), + ( + "username", + models.CharField( + error_messages={"unique": "A user with that username already exists."}, + help_text="Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.", + max_length=150, + unique=True, + validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], + verbose_name="username", + ), + ), + ("first_name", models.CharField(blank=True, max_length=150, verbose_name="first name")), + ("last_name", models.CharField(blank=True, max_length=150, verbose_name="last name")), + ("email", models.EmailField(blank=True, max_length=254, verbose_name="email address")), + ( + "is_staff", + models.BooleanField( + default=False, + help_text="Designates whether the user can log into this admin site.", + verbose_name="staff status", + ), + ), + ( + "is_active", + models.BooleanField( + default=True, + help_text="Designates whether this user should be treated as active. Unselect this instead of deleting accounts.", + verbose_name="active", + ), + ), + ("date_joined", models.DateTimeField(default=django.utils.timezone.now, verbose_name="date joined")), + ( + "groups", + models.ManyToManyField( + blank=True, + help_text="The groups this user belongs to. A user will get all permissions granted to each of their groups.", + related_name="user_set", + related_query_name="user", + to="auth.group", + verbose_name="groups", + ), + ), + ( + "user_permissions", + models.ManyToManyField( + blank=True, + help_text="Specific permissions for this user.", + related_name="user_set", + related_query_name="user", + to="auth.permission", + verbose_name="user permissions", + ), + ), ], options={ - 'verbose_name': 'user', - 'verbose_name_plural': 'users', - 'abstract': False, + "verbose_name": "user", + "verbose_name_plural": "users", + "abstract": False, }, managers=[ - ('objects', django.contrib.auth.models.UserManager()), + ("objects", django.contrib.auth.models.UserManager()), ], ), ] diff --git a/authentication/migrations/0002_remove_user_username_user_cell_user_email_or_cell_and_more.py b/authentication/migrations/0002_remove_user_username_user_cell_user_email_or_cell_and_more.py index 3de50bff..aaef7d13 100644 --- a/authentication/migrations/0002_remove_user_username_user_cell_user_email_or_cell_and_more.py +++ b/authentication/migrations/0002_remove_user_username_user_cell_user_email_or_cell_and_more.py @@ -5,31 +5,32 @@ class Migration(migrations.Migration): - dependencies = [ - ('authentication', '0001_initial'), + ("authentication", "0001_initial"), ] operations = [ migrations.RemoveField( - model_name='user', - name='username', + model_name="user", + name="username", ), migrations.AddField( - model_name='user', - name='cell', - field=phonenumber_field.modelfields.PhoneNumberField(default='+17202373591', max_length=128, region=None, unique=True), + model_name="user", + name="cell", + field=phonenumber_field.modelfields.PhoneNumberField( + default="+17202373591", max_length=128, region=None, unique=True + ), preserve_default=False, ), migrations.AddField( - model_name='user', - name='email_or_cell', - field=models.CharField(default='bhiatt@garycommunity.org', max_length=320, unique=True), + model_name="user", + name="email_or_cell", + field=models.CharField(default="bhiatt@garycommunity.org", max_length=320, unique=True), preserve_default=False, ), migrations.AlterField( - model_name='user', - name='email', - field=models.EmailField(max_length=254, unique=True, verbose_name='email address'), + model_name="user", + name="email", + field=models.EmailField(max_length=254, unique=True, verbose_name="email address"), ), ] diff --git a/authentication/migrations/0003_user_screen.py b/authentication/migrations/0003_user_screen.py index 07047841..85a6e3bf 100644 --- a/authentication/migrations/0003_user_screen.py +++ b/authentication/migrations/0003_user_screen.py @@ -5,17 +5,22 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0016_remove_screen_email'), - ('authentication', '0002_remove_user_username_user_cell_user_email_or_cell_and_more'), + ("screener", "0016_remove_screen_email"), + ("authentication", "0002_remove_user_username_user_cell_user_email_or_cell_and_more"), ] operations = [ migrations.AddField( - model_name='user', - name='screen', - field=models.ForeignKey(blank=True, default=1, on_delete=django.db.models.deletion.CASCADE, related_name='screen', to='screener.screen'), + model_name="user", + name="screen", + field=models.ForeignKey( + blank=True, + default=1, + on_delete=django.db.models.deletion.CASCADE, + related_name="screen", + to="screener.screen", + ), preserve_default=False, ), ] diff --git a/authentication/migrations/0004_user_tcpa_consent.py b/authentication/migrations/0004_user_tcpa_consent.py index c4cbf267..0558880e 100644 --- a/authentication/migrations/0004_user_tcpa_consent.py +++ b/authentication/migrations/0004_user_tcpa_consent.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('authentication', '0003_user_screen'), + ("authentication", "0003_user_screen"), ] operations = [ migrations.AddField( - model_name='user', - name='tcpa_consent', + model_name="user", + name="tcpa_consent", field=models.BooleanField(default=False), preserve_default=False, ), diff --git a/authentication/migrations/0005_alter_user_cell_alter_user_email_alter_user_screen.py b/authentication/migrations/0005_alter_user_cell_alter_user_email_alter_user_screen.py index 85b1efa5..c75960cb 100644 --- a/authentication/migrations/0005_alter_user_cell_alter_user_email_alter_user_screen.py +++ b/authentication/migrations/0005_alter_user_cell_alter_user_email_alter_user_screen.py @@ -6,26 +6,27 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0017_screen_last_email_request_date'), - ('authentication', '0004_user_tcpa_consent'), + ("screener", "0017_screen_last_email_request_date"), + ("authentication", "0004_user_tcpa_consent"), ] operations = [ migrations.AlterField( - model_name='user', - name='cell', + model_name="user", + name="cell", field=phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, region=None, unique=True), ), migrations.AlterField( - model_name='user', - name='email', - field=models.EmailField(blank=True, max_length=254, unique=True, verbose_name='email address'), + model_name="user", + name="email", + field=models.EmailField(blank=True, max_length=254, unique=True, verbose_name="email address"), ), migrations.AlterField( - model_name='user', - name='screen', - field=models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, related_name='users', to='screener.screen'), + model_name="user", + name="screen", + field=models.ForeignKey( + blank=True, on_delete=django.db.models.deletion.CASCADE, related_name="users", to="screener.screen" + ), ), ] diff --git a/authentication/migrations/0006_remove_user_screen.py b/authentication/migrations/0006_remove_user_screen.py index 9f9d471e..0cde4425 100644 --- a/authentication/migrations/0006_remove_user_screen.py +++ b/authentication/migrations/0006_remove_user_screen.py @@ -4,14 +4,13 @@ class Migration(migrations.Migration): - dependencies = [ - ('authentication', '0005_alter_user_cell_alter_user_email_alter_user_screen'), + ("authentication", "0005_alter_user_cell_alter_user_email_alter_user_screen"), ] operations = [ migrations.RemoveField( - model_name='user', - name='screen', + model_name="user", + name="screen", ), ] diff --git a/authentication/migrations/0007_alter_user_cell_alter_user_email.py b/authentication/migrations/0007_alter_user_cell_alter_user_email.py index 62269fb8..23e4f715 100644 --- a/authentication/migrations/0007_alter_user_cell_alter_user_email.py +++ b/authentication/migrations/0007_alter_user_cell_alter_user_email.py @@ -5,20 +5,21 @@ class Migration(migrations.Migration): - dependencies = [ - ('authentication', '0006_remove_user_screen'), + ("authentication", "0006_remove_user_screen"), ] operations = [ migrations.AlterField( - model_name='user', - name='cell', - field=phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, null=True, region=None, unique=True), + model_name="user", + name="cell", + field=phonenumber_field.modelfields.PhoneNumberField( + blank=True, max_length=128, null=True, region=None, unique=True + ), ), migrations.AlterField( - model_name='user', - name='email', - field=models.EmailField(blank=True, max_length=254, null=True, unique=True, verbose_name='email address'), + model_name="user", + name="email", + field=models.EmailField(blank=True, max_length=254, null=True, unique=True, verbose_name="email address"), ), ] diff --git a/authentication/migrations/0008_user_send_offers_user_send_updates.py b/authentication/migrations/0008_user_send_offers_user_send_updates.py index 139f8ed8..00018186 100644 --- a/authentication/migrations/0008_user_send_offers_user_send_updates.py +++ b/authentication/migrations/0008_user_send_offers_user_send_updates.py @@ -4,20 +4,19 @@ class Migration(migrations.Migration): - dependencies = [ - ('authentication', '0007_alter_user_cell_alter_user_email'), + ("authentication", "0007_alter_user_cell_alter_user_email"), ] operations = [ migrations.AddField( - model_name='user', - name='send_offers', + model_name="user", + name="send_offers", field=models.BooleanField(default=False), ), migrations.AddField( - model_name='user', - name='send_updates', + model_name="user", + name="send_updates", field=models.BooleanField(default=False), ), ] diff --git a/authentication/migrations/0009_alter_user_first_name_alter_user_last_name.py b/authentication/migrations/0009_alter_user_first_name_alter_user_last_name.py index 6766c753..1a19ce8f 100644 --- a/authentication/migrations/0009_alter_user_first_name_alter_user_last_name.py +++ b/authentication/migrations/0009_alter_user_first_name_alter_user_last_name.py @@ -4,20 +4,19 @@ class Migration(migrations.Migration): - dependencies = [ - ('authentication', '0008_user_send_offers_user_send_updates'), + ("authentication", "0008_user_send_offers_user_send_updates"), ] operations = [ migrations.AlterField( - model_name='user', - name='first_name', + model_name="user", + name="first_name", field=models.CharField(blank=True, max_length=320, null=True), ), migrations.AlterField( - model_name='user', - name='last_name', + model_name="user", + name="last_name", field=models.CharField(blank=True, max_length=320, null=True), ), ] diff --git a/authentication/migrations/0010_user_language_code.py b/authentication/migrations/0010_user_language_code.py index 369c56a5..6522d847 100644 --- a/authentication/migrations/0010_user_language_code.py +++ b/authentication/migrations/0010_user_language_code.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('authentication', '0009_alter_user_first_name_alter_user_last_name'), + ("authentication", "0009_alter_user_first_name_alter_user_last_name"), ] operations = [ migrations.AddField( - model_name='user', - name='language_code', + model_name="user", + name="language_code", field=models.CharField(blank=True, max_length=12, null=True), ), ] diff --git a/authentication/migrations/0011_alter_user_managers.py b/authentication/migrations/0011_alter_user_managers.py index 5371c3ef..db9c6959 100644 --- a/authentication/migrations/0011_alter_user_managers.py +++ b/authentication/migrations/0011_alter_user_managers.py @@ -4,15 +4,13 @@ class Migration(migrations.Migration): - dependencies = [ - ('authentication', '0010_user_language_code'), + ("authentication", "0010_user_language_code"), ] operations = [ migrations.AlterModelManagers( - name='user', - managers=[ - ], + name="user", + managers=[], ), ] diff --git a/authentication/migrations/0012_user_external_id.py b/authentication/migrations/0012_user_external_id.py index 9713bd33..90a0380f 100644 --- a/authentication/migrations/0012_user_external_id.py +++ b/authentication/migrations/0012_user_external_id.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('authentication', '0011_alter_user_managers'), + ("authentication", "0011_alter_user_managers"), ] operations = [ migrations.AddField( - model_name='user', - name='external_id', + model_name="user", + name="external_id", field=models.CharField(blank=True, max_length=320, null=True), ), ] diff --git a/authentication/models.py b/authentication/models.py index fb734b6e..4facb483 100644 --- a/authentication/models.py +++ b/authentication/models.py @@ -10,12 +10,9 @@ def create_user(self, email_or_cell, tcpa_consent, password=None): Creates and saves a User with the given email or cell and password. """ if not email_or_cell: - raise ValueError('Users must have an email address or cell phone number') + raise ValueError("Users must have an email address or cell phone number") - user = self.model( - email_or_cell=email_or_cell, - tcpa_consent=tcpa_consent - ) + user = self.model(email_or_cell=email_or_cell, tcpa_consent=tcpa_consent) user.set_password(password) user.save(using=self._db) @@ -26,17 +23,14 @@ def create_superuser(self, email_or_cell, tcpa_consent, password=None): Creates and saves a superuser with the given email, date of birth and password. """ - user = self.create_user( - email_or_cell=email_or_cell, - password=password, - tcpa_consent=tcpa_consent - ) + user = self.create_user(email_or_cell=email_or_cell, password=password, tcpa_consent=tcpa_consent) user.is_admin = True user.is_superuser = True user.is_staff = True user.save(using=self._db) return user + # Users are created by the screener when someone signs up to provide feedback # or be notified of future benefits that are available to them. The unique id # can be either a cell phone number or email address. @@ -44,7 +38,7 @@ class User(AbstractUser): username = None email_or_cell = models.CharField(max_length=320, unique=True) cell = PhoneNumberField(unique=True, blank=True, null=True) - email = models.EmailField(_('email address'), unique=True, blank=True, null=True) + email = models.EmailField(_("email address"), unique=True, blank=True, null=True) first_name = models.CharField(max_length=320, blank=True, null=True) last_name = models.CharField(max_length=320, blank=True, null=True) language_code = models.CharField(max_length=12, blank=True, null=True) @@ -55,8 +49,8 @@ class User(AbstractUser): objects = UserManager() - USERNAME_FIELD = 'email_or_cell' - REQUIRED_FIELDS = ['tcpa_consent'] + USERNAME_FIELD = "email_or_cell" + REQUIRED_FIELDS = ["tcpa_consent"] def save(self, **kwargs): self.cell = self.cell or None diff --git a/authentication/serializers.py b/authentication/serializers.py index 13c1d838..6c9c143b 100644 --- a/authentication/serializers.py +++ b/authentication/serializers.py @@ -8,30 +8,30 @@ class UserSerializer(serializers.ModelSerializer): class Meta: model = User fields = ( - 'id', - 'date_joined', - 'last_login', - 'cell', - 'email', - 'first_name', - 'last_name', - 'email_or_cell', - 'language_code', - 'tcpa_consent', - 'send_offers', - 'send_updates' + "id", + "date_joined", + "last_login", + "cell", + "email", + "first_name", + "last_name", + "email_or_cell", + "language_code", + "tcpa_consent", + "send_offers", + "send_updates", ) create_only_fields = ( - 'id', - 'date_joined', - 'last_login', - 'cell', - 'email', - 'first_name', - 'last_name', - 'email_or_cell', - 'language_code', - 'tcpa_consent', + "id", + "date_joined", + "last_login", + "cell", + "email", + "first_name", + "last_name", + "email_or_cell", + "language_code", + "tcpa_consent", ) @@ -40,8 +40,4 @@ class UserOffersSerializer(serializers.ModelSerializer): class Meta: model = User - fields = ( - 'id', - 'send_offers', - 'send_updates' - ) + fields = ("id", "send_offers", "send_updates") diff --git a/authentication/urls.py b/authentication/urls.py index ca03f0d0..ebab708d 100644 --- a/authentication/urls.py +++ b/authentication/urls.py @@ -3,10 +3,8 @@ from . import views router = routers.DefaultRouter() -router.register(r'users', views.UserViewSet) +router.register(r"users", views.UserViewSet) # Wire up our API using automatic URL routing. # Additionally, we include login URLs for the browsable API. -urlpatterns = [ - path('', include(router.urls)) -] +urlpatterns = [path("", include(router.urls))] diff --git a/authentication/views.py b/authentication/views.py index f9fefbb3..9251599a 100644 --- a/authentication/views.py +++ b/authentication/views.py @@ -10,18 +10,18 @@ import uuid -class UserViewSet(mixins.UpdateModelMixin, - viewsets.GenericViewSet): +class UserViewSet(mixins.UpdateModelMixin, viewsets.GenericViewSet): """ API endpoint that allows users to be viewed or edited. """ - queryset = User.objects.all().order_by('-email_or_cell') + + queryset = User.objects.all().order_by("-email_or_cell") serializer_class = UserSerializer permission_classes = [permissions.DjangoModelPermissions] def update(self, request, pk=None): if pk is None: - return Response('Must have an associated screen', status=400) + return Response("Must have an associated screen", status=400) screen = Screen.objects.get(uuid=pk) user = screen.user if user: @@ -45,8 +45,8 @@ def update(self, request, pk=None): upsert_user_to_hubspot(screen, screen.user) except Exception: capture_message( - 'HubSpot upsert failed', - level='warning', + "HubSpot upsert failed", + level="warning", ) return Response("Invalid Email", status=400) @@ -65,14 +65,13 @@ def upsert_user_to_hubspot(screen, user): hubspot_id = upsert_user_hubspot(user, screen=screen) if hubspot_id: - random_id = str(uuid.uuid4()).replace('-', '') + random_id = str(uuid.uuid4()).replace("-", "") user.external_id = hubspot_id - user.email_or_cell = f'{hubspot_id}+{random_id}@myfriendben.org' + user.email_or_cell = f"{hubspot_id}+{random_id}@myfriendben.org" user.first_name = None user.last_name = None user.cell = None user.email = None user.save() else: - raise Exception('Failed to upsert user') - + raise Exception("Failed to upsert user") diff --git a/benefits/asgi.py b/benefits/asgi.py index 9c3d038c..9d278da0 100644 --- a/benefits/asgi.py +++ b/benefits/asgi.py @@ -11,6 +11,6 @@ from django.core.asgi import get_asgi_application -os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'benefits.settings') +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "benefits.settings") application = get_asgi_application() diff --git a/benefits/settings.py b/benefits/settings.py index 058f6a11..774061c1 100644 --- a/benefits/settings.py +++ b/benefits/settings.py @@ -22,25 +22,25 @@ # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent -MEDIA_ROOT = os.path.join(BASE_DIR, 'media') -MEDIA_URL = '/media/' +MEDIA_ROOT = os.path.join(BASE_DIR, "media") +MEDIA_URL = "/media/" LOCALE_PATHS = [ - os.path.join(BASE_DIR, 'locale'), + os.path.join(BASE_DIR, "locale"), ] # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = config('SECRET_KEY') +SECRET_KEY = config("SECRET_KEY") # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = config('DJANGO_DEBUG', 'False') == 'True' +DEBUG = config("DJANGO_DEBUG", "False") == "True" -ALLOWED_HOSTS = ['*'] +ALLOWED_HOSTS = ["*"] -AUTH_USER_MODEL = 'authentication.User' +AUTH_USER_MODEL = "authentication.User" AUTHENTICATION_BACKENDS = [ "django.contrib.auth.backends.ModelBackend", @@ -48,13 +48,13 @@ ] REST_FRAMEWORK = { - 'DEFAULT_FILTER_BACKENDS': ['django_filters.rest_framework.DjangoFilterBackend'], - 'DEFAULT_AUTHENTICATION_CLASSES': [ - 'rest_framework.authentication.SessionAuthentication', - 'rest_framework.authentication.TokenAuthentication', + "DEFAULT_FILTER_BACKENDS": ["django_filters.rest_framework.DjangoFilterBackend"], + "DEFAULT_AUTHENTICATION_CLASSES": [ + "rest_framework.authentication.SessionAuthentication", + "rest_framework.authentication.TokenAuthentication", ], - 'DEFAULT_PERMISSION_CLASSES': ['rest_framework.permissions.IsAuthenticated'], - 'EXCEPTION_HANDLER': 'benefits.views.drf_exception_handler', + "DEFAULT_PERMISSION_CLASSES": ["rest_framework.permissions.IsAuthenticated"], + "EXCEPTION_HANDLER": "benefits.views.drf_exception_handler", } CORS_ALLOW_ALL_ORIGINS = True @@ -62,71 +62,71 @@ # Application definition INSTALLED_APPS = [ - 'authentication.apps.AuthConfig', - 'corsheaders', - 'screener.apps.ScreenerConfig', - 'programs.apps.ProgramsConfig', - 'configuration.apps.ConfigurationConfig', - 'integrations.apps.IntegrationsConfig', - 'translations.apps.TranslationsConfig', - 'rest_framework', - 'rest_framework.authtoken', - 'phonenumber_field', - 'parler', - 'django_filters', - 'django.contrib.admin', - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.sessions', - 'django.contrib.messages', - 'django.contrib.staticfiles', - 'drf_yasg', + "authentication.apps.AuthConfig", + "corsheaders", + "screener.apps.ScreenerConfig", + "programs.apps.ProgramsConfig", + "configuration.apps.ConfigurationConfig", + "integrations.apps.IntegrationsConfig", + "translations.apps.TranslationsConfig", + "rest_framework", + "rest_framework.authtoken", + "phonenumber_field", + "parler", + "django_filters", + "django.contrib.admin", + "django.contrib.auth", + "django.contrib.contenttypes", + "django.contrib.sessions", + "django.contrib.messages", + "django.contrib.staticfiles", + "drf_yasg", ] MIDDLEWARE = [ - 'django.middleware.security.SecurityMiddleware', - 'whitenoise.middleware.WhiteNoiseMiddleware', - 'django.contrib.sessions.middleware.SessionMiddleware', - 'corsheaders.middleware.CorsMiddleware', - 'django.middleware.common.CommonMiddleware', - 'django.middleware.csrf.CsrfViewMiddleware', - 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.contrib.messages.middleware.MessageMiddleware', - 'django.middleware.clickjacking.XFrameOptionsMiddleware', - 'django.middleware.locale.LocaleMiddleware', + "django.middleware.security.SecurityMiddleware", + "whitenoise.middleware.WhiteNoiseMiddleware", + "django.contrib.sessions.middleware.SessionMiddleware", + "corsheaders.middleware.CorsMiddleware", + "django.middleware.common.CommonMiddleware", + "django.middleware.csrf.CsrfViewMiddleware", + "django.contrib.auth.middleware.AuthenticationMiddleware", + "django.contrib.messages.middleware.MessageMiddleware", + "django.middleware.clickjacking.XFrameOptionsMiddleware", + "django.middleware.locale.LocaleMiddleware", ] -ROOT_URLCONF = 'benefits.urls' +ROOT_URLCONF = "benefits.urls" TEMPLATES = [ { - 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [os.path.join(BASE_DIR, 'templates')], - 'APP_DIRS': True, - 'OPTIONS': { - 'context_processors': [ - 'django.template.context_processors.debug', - 'django.template.context_processors.request', - 'django.contrib.auth.context_processors.auth', - 'django.contrib.messages.context_processors.messages', + "BACKEND": "django.template.backends.django.DjangoTemplates", + "DIRS": [os.path.join(BASE_DIR, "templates")], + "APP_DIRS": True, + "OPTIONS": { + "context_processors": [ + "django.template.context_processors.debug", + "django.template.context_processors.request", + "django.contrib.auth.context_processors.auth", + "django.contrib.messages.context_processors.messages", ], }, }, ] -WSGI_APPLICATION = 'benefits.wsgi.application' +WSGI_APPLICATION = "benefits.wsgi.application" # Database # https://docs.djangoproject.com/en/3.2/ref/settings/#databases DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.postgresql', - 'NAME': config('DB_NAME'), - 'USER': config('DB_USER'), - 'PASSWORD': config('DB_PASS'), - 'HOST': config('DB_HOST', 'localhost'), + "default": { + "ENGINE": "django.db.backends.postgresql", + "NAME": config("DB_NAME"), + "USER": config("DB_USER"), + "PASSWORD": config("DB_PASS"), + "HOST": config("DB_HOST", "localhost"), } } @@ -136,16 +136,16 @@ AUTH_PASSWORD_VALIDATORS = [ { - 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator", }, { - 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator", }, { - 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator", }, { - 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator", }, ] @@ -153,23 +153,23 @@ # Internationalization # https://docs.djangoproject.com/en/3.2/topics/i18n/ -LANGUAGE_CODE = 'en-us' +LANGUAGE_CODE = "en-us" LANGUAGES = ( - ('en-us', _("US English")), - ('es', _('Spanish')), - ('vi', _('Vietnamese')), - ('fr', _('French')), - ('am', _('Amharic')), - ('so', _('Somali')), - ('ru', _('Russian')), - ('ne', _('Nepali')), - ('my', _('Burmese')), - ('zh', _('Chinese')), - ('ar', _('Arabic')), + ("en-us", _("US English")), + ("es", _("Spanish")), + ("vi", _("Vietnamese")), + ("fr", _("French")), + ("am", _("Amharic")), + ("so", _("Somali")), + ("ru", _("Russian")), + ("ne", _("Nepali")), + ("my", _("Burmese")), + ("zh", _("Chinese")), + ("ar", _("Arabic")), ) -TIME_ZONE = 'UTC' +TIME_ZONE = "UTC" USE_I18N = True @@ -179,45 +179,45 @@ PARLER_DEFAULT_ACTIVATE = True PARLER_LANGUAGES = { None: ( - {'code': 'en-us'}, - {'code': 'es'}, - {'code': 'vi'}, - {'code': 'fr'}, - {'code': 'am'}, - {'code': 'so'}, - {'code': 'ru'}, - {'code': 'ne'}, - {'code': 'my'}, - {'code': 'zh'}, - {'code': 'ar'}, + {"code": "en-us"}, + {"code": "es"}, + {"code": "vi"}, + {"code": "fr"}, + {"code": "am"}, + {"code": "so"}, + {"code": "ru"}, + {"code": "ne"}, + {"code": "my"}, + {"code": "zh"}, + {"code": "ar"}, ), - 'default': { - 'fallbacks': ['en-us'], # defaults to PARLER_DEFAULT_LANGUAGE_CODE - 'hide_untranslated': True, # the default; let .active_translations() return fallbacks too. + "default": { + "fallbacks": ["en-us"], # defaults to PARLER_DEFAULT_LANGUAGE_CODE + "hide_untranslated": True, # the default; let .active_translations() return fallbacks too. }, } # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/3.2/howto/static-files/ -STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') -STATIC_URL = '/static/' -STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' +STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles") +STATIC_URL = "/static/" +STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage" # Default primary key field type # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field -DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' -CSRF_FAILURE_VIEW = 'benefits.views.catch_403_view' +DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" +CSRF_FAILURE_VIEW = "benefits.views.catch_403_view" -SWAGGER_SETTINGS = {'SUPPORTED_SUBMIT_METHODS': ('get',)} +SWAGGER_SETTINGS = {"SUPPORTED_SUBMIT_METHODS": ("get",)} # Enable logging with Sentry if it is enabled -if config('SENTRY_DSN', None) is not None: +if config("SENTRY_DSN", None) is not None: sentry_sdk.init( - dsn=config('SENTRY_DSN'), + dsn=config("SENTRY_DSN"), integrations=[DjangoIntegration()], - environment='dev' if DEBUG else 'production', + environment="dev" if DEBUG else "production", ) django_heroku.settings(locals()) diff --git a/benefits/urls.py b/benefits/urls.py index 0cf296a6..0caf97f5 100644 --- a/benefits/urls.py +++ b/benefits/urls.py @@ -1,4 +1,4 @@ -'''benefits URL Configuration +"""benefits URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.2/topics/http/urls/ @@ -12,22 +12,22 @@ Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) -''' +""" from django.contrib import admin from django.urls import include, path from sesame.views import LoginView from drf_yasg.views import get_schema_view from drf_yasg import openapi -handler403 = 'benefits.views.catch_403_view' -handler400 = 'benefits.views.catch_400_view' +handler403 = "benefits.views.catch_403_view" +handler400 = "benefits.views.catch_400_view" schema_view = get_schema_view( openapi.Info( - default_version='v1', - title='Colorado Open Benefits API', - description='API calculates eligibility across over 40 benefit programs in Colorado', - version='0.0.1', + default_version="v1", + title="Colorado Open Benefits API", + description="API calculates eligibility across over 40 benefit programs in Colorado", + version="0.0.1", ), public=True, permission_classes=[], @@ -35,16 +35,16 @@ ) urlpatterns = [ - path('api/', include('configuration.urls')), - path('api/', include('screener.urls')), - path('api/', include('programs.urls')), - path('api/', include('authentication.urls')), - path('api/translations/', include('translations.urls')), - path('admin/', admin.site.urls), - path('sesame/login/', LoginView.as_view(), name='sesame-login'), + path("api/", include("configuration.urls")), + path("api/", include("screener.urls")), + path("api/", include("programs.urls")), + path("api/", include("authentication.urls")), + path("api/translations/", include("translations.urls")), + path("admin/", admin.site.urls), + path("sesame/login/", LoginView.as_view(), name="sesame-login"), path( - 'api/documentation/', - schema_view.with_ui('swagger', cache_timeout=0), - name='schema-swagger-ui', + "api/documentation/", + schema_view.with_ui("swagger", cache_timeout=0), + name="schema-swagger-ui", ), ] diff --git a/benefits/views.py b/benefits/views.py index 4be4d2c6..f0321de6 100644 --- a/benefits/views.py +++ b/benefits/views.py @@ -4,15 +4,15 @@ def catch_403_view(*args, **kwargs): - capture_message('Unauthorized', level='warning') + capture_message("Unauthorized", level="warning") - return HttpResponseForbidden('Forbidden') + return HttpResponseForbidden("Forbidden") def catch_400_view(*args, **kwargs): - capture_message('Bad Request', level='warning') + capture_message("Bad Request", level="warning") - return HttpResponseBadRequest('Bad Request') + return HttpResponseBadRequest("Bad Request") def drf_exception_handler(exc, context): @@ -23,7 +23,7 @@ def drf_exception_handler(exc, context): capture_message( response.reason_phrase, - level='warning', + level="warning", ) return response diff --git a/benefits/wsgi.py b/benefits/wsgi.py index f5d67b28..3ef70567 100644 --- a/benefits/wsgi.py +++ b/benefits/wsgi.py @@ -11,6 +11,6 @@ from django.core.wsgi import get_wsgi_application -os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'benefits.settings') +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "benefits.settings") application = get_wsgi_application() diff --git a/configuration/admin.py b/configuration/admin.py index 8374284d..49835f65 100644 --- a/configuration/admin.py +++ b/configuration/admin.py @@ -1,7 +1,9 @@ from django.contrib import admin from .models import Configuration + class ConfigurationAdmin(admin.ModelAdmin): - search_fields = ('name',) + search_fields = ("name",) + -admin.site.register(Configuration, ConfigurationAdmin) \ No newline at end of file +admin.site.register(Configuration, ConfigurationAdmin) diff --git a/configuration/management/commands/add_config.py b/configuration/management/commands/add_config.py index 92900bdc..8e12c15a 100644 --- a/configuration/management/commands/add_config.py +++ b/configuration/management/commands/add_config.py @@ -1,41 +1,2588 @@ from django.core.management.base import BaseCommand from configuration.models import ( - Configuration, + Configuration, ) class Command(BaseCommand): - help = ( - 'Create and add config data to database' - ) + help = "Create and add config data to database" - acute_condition_options = {"food": {"icon": {"_name": "Food", "_classname": "option-card-icon"}, "_label": "acuteConditionOptions.food", "_default_message": "Food or groceries"}, "housing": {"icon": {"_name": "Housing", "_classname": "option-card-icon"}, "_label": "acuteConditionOptions.housing", "_default_message": "Help with managing your mortgage, rent, or utilities"}, "support": {"icon": {"_name": "Support", "_classname": "option-card-icon"}, "_label": "acuteConditionOptions.support", "_default_message": "A challenge you or your child would like to talk about"}, "dentalCare": {"icon": {"_name": "Dental_care", "_classname": "option-card-icon"}, "_label": "acuteConditionOptions.dentalCare", "_default_message": "Low-cost dental care"}, "babySupplies": {"icon": {"_name": "Baby_supplies", "_classname": "option-card-icon"}, "_label": "acuteConditionOptions.babySupplies", "_default_message": "Diapers and other baby supplies"}, "jobResources": {"icon": {"_name": "Job_resources", "_classname": "option-card-icon"}, "_label": "acuteConditionOptions.jobResources", "_default_message": "Finding a job"}, "legalServices": {"icon": {"_name": "Legal_services", "_classname": "option-card-icon"}, "_label": "acuteConditionOptions.legalServices", "_default_message": "Free or low-cost help with civil legal needs"}, "familyPlanning": {"icon": {"_name": "Family_planning", "_classname": "option-card-icon"}, "_label": "acuteConditionOptions.familyPlanning", "_default_message": "Family planning or birth control"}, "childDevelopment": {"icon": {"_name": "Child_development", "_classname": "option-card-icon"}, "_label": "acuteConditionOptions.childDevelopment", "_default_message": "Concern about your baby or toddler's development"}} + acute_condition_options = { + "food": { + "icon": {"_name": "Food", "_classname": "option-card-icon"}, + "_label": "acuteConditionOptions.food", + "_default_message": "Food or groceries", + }, + "housing": { + "icon": {"_name": "Housing", "_classname": "option-card-icon"}, + "_label": "acuteConditionOptions.housing", + "_default_message": "Help with managing your mortgage, rent, or utilities", + }, + "support": { + "icon": {"_name": "Support", "_classname": "option-card-icon"}, + "_label": "acuteConditionOptions.support", + "_default_message": "A challenge you or your child would like to talk about", + }, + "dentalCare": { + "icon": {"_name": "Dental_care", "_classname": "option-card-icon"}, + "_label": "acuteConditionOptions.dentalCare", + "_default_message": "Low-cost dental care", + }, + "babySupplies": { + "icon": {"_name": "Baby_supplies", "_classname": "option-card-icon"}, + "_label": "acuteConditionOptions.babySupplies", + "_default_message": "Diapers and other baby supplies", + }, + "jobResources": { + "icon": {"_name": "Job_resources", "_classname": "option-card-icon"}, + "_label": "acuteConditionOptions.jobResources", + "_default_message": "Finding a job", + }, + "legalServices": { + "icon": {"_name": "Legal_services", "_classname": "option-card-icon"}, + "_label": "acuteConditionOptions.legalServices", + "_default_message": "Free or low-cost help with civil legal needs", + }, + "familyPlanning": { + "icon": {"_name": "Family_planning", "_classname": "option-card-icon"}, + "_label": "acuteConditionOptions.familyPlanning", + "_default_message": "Family planning or birth control", + }, + "childDevelopment": { + "icon": {"_name": "Child_development", "_classname": "option-card-icon"}, + "_label": "acuteConditionOptions.childDevelopment", + "_default_message": "Concern about your baby or toddler's development", + }, + } - sign_up_options = {"sendOffers": {"_label": "signUpOptions.sendOffers", "_default_message": "Please notify me when there are paid opportunities to provide feedback on MyFriendBen."}, "sendUpdates": {"_label": "signUpOptions.sendUpdates", "_default_message": "Please notify me when new benefits become available to me that I am likely eligible for based on the information I have provided."}} + sign_up_options = { + "sendOffers": { + "_label": "signUpOptions.sendOffers", + "_default_message": "Please notify me when there are paid opportunities to provide feedback on MyFriendBen.", + }, + "sendUpdates": { + "_label": "signUpOptions.sendUpdates", + "_default_message": "Please notify me when new benefits become available to me that I am likely eligible for based on the information I have provided.", + }, + } - relationship_options = {"child": {"_label": "relationshipOptions.child", "_default_message": "Child"}, "parent": {"_label": "relationshipOptions.parent", "_default_message": "Parent"}, "spouse": {"_label": "relationshipOptions.spouse", "_default_message": "Spouse"}, "stepChild": {"_label": "relationshipOptions.stepChild", "_default_message": "Step-child"}, "unrelated": {"_label": "relationshipOptions.unrelated", "_default_message": "Unrelated"}, "grandChild": {"_label": "relationshipOptions.grandChild", "_default_message": "Grandchild"}, "stepParent": {"_label": "relationshipOptions.stepParent", "_default_message": "Step-parent"}, "fosterChild": {"_label": "relationshipOptions.fosterChildOrKinshipChild", "_default_message": "Foster Child / Kinship Care"}, "grandParent": {"_label": "relationshipOptions.grandParent", "_default_message": "Grandparent"}, "fosterParent": {"_label": "relationshipOptions.fosterParent", "_default_message": "Foster Parent"}, "relatedOther": {"_label": "relationshipOptions.relatedOther", "_default_message": "Related in some other way"}, "domesticPartner": {"_label": "relationshipOptions.domesticPartner", "_default_message": "Domestic Partner"}, "sisterOrBrother": {"_label": "relationshipOptions.sisterOrBrother", "_default_message": "Sister/Brother"}, "stepSisterOrBrother": {"_label": "relationshipOptions.stepSisterOrBrother", "_default_message": "Step-sister/Step-brother"}, "boyfriendOrGirlfriend": {"_label": "relationshipOptions.boyfriendOrGirlfriend", "_default_message": "Boyfriend/Girlfriend"}} + relationship_options = { + "child": {"_label": "relationshipOptions.child", "_default_message": "Child"}, + "parent": {"_label": "relationshipOptions.parent", "_default_message": "Parent"}, + "spouse": {"_label": "relationshipOptions.spouse", "_default_message": "Spouse"}, + "stepChild": {"_label": "relationshipOptions.stepChild", "_default_message": "Step-child"}, + "unrelated": {"_label": "relationshipOptions.unrelated", "_default_message": "Unrelated"}, + "grandChild": {"_label": "relationshipOptions.grandChild", "_default_message": "Grandchild"}, + "stepParent": {"_label": "relationshipOptions.stepParent", "_default_message": "Step-parent"}, + "fosterChild": { + "_label": "relationshipOptions.fosterChildOrKinshipChild", + "_default_message": "Foster Child / Kinship Care", + }, + "grandParent": {"_label": "relationshipOptions.grandParent", "_default_message": "Grandparent"}, + "fosterParent": {"_label": "relationshipOptions.fosterParent", "_default_message": "Foster Parent"}, + "relatedOther": {"_label": "relationshipOptions.relatedOther", "_default_message": "Related in some other way"}, + "domesticPartner": {"_label": "relationshipOptions.domesticPartner", "_default_message": "Domestic Partner"}, + "sisterOrBrother": {"_label": "relationshipOptions.sisterOrBrother", "_default_message": "Sister/Brother"}, + "stepSisterOrBrother": { + "_label": "relationshipOptions.stepSisterOrBrother", + "_default_message": "Step-sister/Step-brother", + }, + "boyfriendOrGirlfriend": { + "_label": "relationshipOptions.boyfriendOrGirlfriend", + "_default_message": "Boyfriend/Girlfriend", + }, + } - referral_options = {"bia": "Benefits in Action", "cch": "Colorado Coalition for the Homeless", "gac": "Get Ahead Colorado", "lgs": "Let's Get Set", "cedp": "Community Economic Defense Project (CEDP)", "frca": "Family Resource Center Association", "211co": "2-1-1 Colorado", "other": {"_label": "referralOptions.other", "_default_message": "Other"}, "jeffcoHS": "Jeffco Human Services", "socialMedia": {"_label": "referralOptions.socialMedia", "_default_message": "Social Media"}, "searchEngine": {"_label": "referralOptions.searchEngine", "_default_message": "Google or other search engine"}, "testOrProspect": {"_label": "referralOptions.testOrProspect", "_default_message": "Test / Prospective Partner"}, "villageExchange": "Village Exchange", "taxAssistanceSite": {"_label": "referralOptions.taxAssistanceSite", "_default_message": "Tax Assistance Site (VITA/Tax Help Colorado)"}} + referral_options = { + "bia": "Benefits in Action", + "cch": "Colorado Coalition for the Homeless", + "gac": "Get Ahead Colorado", + "lgs": "Let's Get Set", + "cedp": "Community Economic Defense Project (CEDP)", + "frca": "Family Resource Center Association", + "211co": "2-1-1 Colorado", + "other": {"_label": "referralOptions.other", "_default_message": "Other"}, + "jeffcoHS": "Jeffco Human Services", + "socialMedia": {"_label": "referralOptions.socialMedia", "_default_message": "Social Media"}, + "searchEngine": {"_label": "referralOptions.searchEngine", "_default_message": "Google or other search engine"}, + "testOrProspect": { + "_label": "referralOptions.testOrProspect", + "_default_message": "Test / Prospective Partner", + }, + "villageExchange": "Village Exchange", + "taxAssistanceSite": { + "_label": "referralOptions.taxAssistanceSite", + "_default_message": "Tax Assistance Site (VITA/Tax Help Colorado)", + }, + } - language_options = {"am": "አማርኛ", "es": "Español", "fr": "Français", "my": "မြန်မာဘာသာစကား", "ne": "नेपाली", "ru": "Русский", "so": "Soomaali", "vi": "Tiếng Việt", "zh": "汉语", "en-us": "English"} + language_options = { + "am": "አማርኛ", + "es": "Español", + "fr": "Français", + "my": "မြန်မာဘာသာစကား", + "ne": "नेपाली", + "ru": "Русский", + "so": "Soomaali", + "vi": "Tiếng Việt", + "zh": "汉语", + "en-us": "English", + } - income_options = {"sSI": {"_label": "incomeOptions.sSI", "_default_message": "Supplemental Security Income (SSI)"}, "gifts": {"_label": "incomeOptions.gifts", "_default_message": "Gifts/Contributions (Received)"}, "wages": {"_label": "incomeOptions.wages", "_default_message": "Wages, salaries, tips"}, "rental": {"_label": "incomeOptions.rental", "_default_message": "Rental Income"}, "alimony": {"_label": "incomeOptions.alimony", "_default_message": "Alimony (Received)"}, "boarder": {"_label": "incomeOptions.boarder", "_default_message": "Boarder or Lodger"}, "pension": {"_label": "incomeOptions.pension", "_default_message": "Military, Government, or Private Pension"}, "veteran": {"_label": "incomeOptions.veteran", "_default_message": "Veteran's Pension or Benefits"}, "investment": {"_label": "incomeOptions.investment", "_default_message": "Investment Income (interest, dividends, and profit from selling stocks)"}, "sSSurvivor": {"_label": "incomeOptions.sSSurvivor", "_default_message": "Social Security Survivor's Benefits (Widow/Widower)"}, "sSDependent": {"_label": "incomeOptions.sSDependent", "_default_message": "Social Security Dependent Benefits (retirement, disability, or survivors)"}, "workersComp": {"_label": "incomeOptions.workersComp", "_default_message": "Worker's Compensation"}, "childSupport": {"_label": "incomeOptions.childSupport", "_default_message": "Child Support (Received)"}, "deferredComp": {"_label": "incomeOptions.deferredComp", "_default_message": "Withdrawals from Deferred Compensation (IRA, Keogh, etc.)"}, "sSDisability": {"_label": "incomeOptions.sSDisability", "_default_message": "Social Security Disability Benefits"}, "sSRetirement": {"_label": "incomeOptions.sSRetirement", "_default_message": "Social Security Retirement Benefits"}, "unemployment": {"_label": "incomeOptions.unemployment", "_default_message": "Unemployment Benefits"}, "cOSDisability": {"_label": "incomeOptions.cOSDisability", "_default_message": "Colorado State Disability Benefits"}, "cashAssistance": {"_label": "incomeOptions.cashAssistance", "_default_message": "Cash Assistance Grant"}, "selfEmployment": {"_label": "incomeOptions.selfEmployment", "_default_message": "Income from freelance, independent contractor, or self-employment work"}} + income_options = { + "sSI": {"_label": "incomeOptions.sSI", "_default_message": "Supplemental Security Income (SSI)"}, + "gifts": {"_label": "incomeOptions.gifts", "_default_message": "Gifts/Contributions (Received)"}, + "wages": {"_label": "incomeOptions.wages", "_default_message": "Wages, salaries, tips"}, + "rental": {"_label": "incomeOptions.rental", "_default_message": "Rental Income"}, + "alimony": {"_label": "incomeOptions.alimony", "_default_message": "Alimony (Received)"}, + "boarder": {"_label": "incomeOptions.boarder", "_default_message": "Boarder or Lodger"}, + "pension": {"_label": "incomeOptions.pension", "_default_message": "Military, Government, or Private Pension"}, + "veteran": {"_label": "incomeOptions.veteran", "_default_message": "Veteran's Pension or Benefits"}, + "investment": { + "_label": "incomeOptions.investment", + "_default_message": "Investment Income (interest, dividends, and profit from selling stocks)", + }, + "sSSurvivor": { + "_label": "incomeOptions.sSSurvivor", + "_default_message": "Social Security Survivor's Benefits (Widow/Widower)", + }, + "sSDependent": { + "_label": "incomeOptions.sSDependent", + "_default_message": "Social Security Dependent Benefits (retirement, disability, or survivors)", + }, + "workersComp": {"_label": "incomeOptions.workersComp", "_default_message": "Worker's Compensation"}, + "childSupport": {"_label": "incomeOptions.childSupport", "_default_message": "Child Support (Received)"}, + "deferredComp": { + "_label": "incomeOptions.deferredComp", + "_default_message": "Withdrawals from Deferred Compensation (IRA, Keogh, etc.)", + }, + "sSDisability": { + "_label": "incomeOptions.sSDisability", + "_default_message": "Social Security Disability Benefits", + }, + "sSRetirement": { + "_label": "incomeOptions.sSRetirement", + "_default_message": "Social Security Retirement Benefits", + }, + "unemployment": {"_label": "incomeOptions.unemployment", "_default_message": "Unemployment Benefits"}, + "cOSDisability": { + "_label": "incomeOptions.cOSDisability", + "_default_message": "Colorado State Disability Benefits", + }, + "cashAssistance": {"_label": "incomeOptions.cashAssistance", "_default_message": "Cash Assistance Grant"}, + "selfEmployment": { + "_label": "incomeOptions.selfEmployment", + "_default_message": "Income from freelance, independent contractor, or self-employment work", + }, + } - health_insurance_options = {"you": {"chp": {"icon": {"_name": "Chp", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.chp", "_default_message": "Child Health Plan Plus (CHP+)"}, "none": {"icon": {"_name": "None", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.none-I", "_default_message": "I do not have health insurance"}, "private": {"icon": {"_name": "PrivateInsurance", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.private", "_default_message": "Private (non-employer) health insurance"}, "employer": {"icon": {"_name": "Employer", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.employer", "_default_message": "Employer-provided health insurance"}, "medicaid": {"icon": {"_name": "Medicaid", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.medicaid", "_default_message": "Health First Colorado (Full Medicaid)"}, "medicare": {"icon": {"_name": "Medicare", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.medicare", "_default_message": "Medicare"}, "dont_know": {"icon": {"_name": "Dont_know", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.dont_know", "_default_message": "Don't Know"}, "family_planning": {"icon": {"_name": "Family_planning", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.family_planning", "_default_message": "Family Planning Limited Medicaid"}, "emergency_medicaid": {"icon": {"_name": "Emergency_medicaid", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.emergency_medicaid", "_default_message": "Emergency Medicaid / Reproductive Health"}}, "them": {"chp": {"icon": {"_name": "Chp", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.chp", "_default_message": "Child Health Plan Plus (CHP+)"}, "none": {"icon": {"_name": "None", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.none-they", "_default_message": "They do not have health insurance"}, "private": {"icon": {"_name": "PrivateInsurance", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.private", "_default_message": "Private (non-employer) health insurance"}, "employer": {"icon": {"_name": "Employer", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.employer", "_default_message": "Employer-provided health insurance"}, "medicaid": {"icon": {"_name": "Medicaid", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.medicaid", "_default_message": "Health First Colorado (Full Medicaid)"}, "medicare": {"icon": {"_name": "Medicare", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.medicare", "_default_message": "Medicare"}, "dont_know": {"icon": {"_name": "Dont_know", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.dont_know", "_default_message": "Don't Know"}, "family_planning": {"icon": {"_name": "Family_planning", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.family_planning", "_default_message": "Family Planning Limited Medicaid"}, "emergency_medicaid": {"icon": {"_name": "Emergency_medicaid", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.emergency_medicaid", "_default_message": "Emergency Medicaid / Reproductive Health"}}} + health_insurance_options = { + "you": { + "chp": { + "icon": {"_name": "Chp", "_classname": "option-card-icon"}, + "_label": "healthInsuranceOptions.chp", + "_default_message": "Child Health Plan Plus (CHP+)", + }, + "none": { + "icon": {"_name": "None", "_classname": "option-card-icon"}, + "_label": "healthInsuranceOptions.none-I", + "_default_message": "I do not have health insurance", + }, + "private": { + "icon": {"_name": "PrivateInsurance", "_classname": "option-card-icon"}, + "_label": "healthInsuranceOptions.private", + "_default_message": "Private (non-employer) health insurance", + }, + "employer": { + "icon": {"_name": "Employer", "_classname": "option-card-icon"}, + "_label": "healthInsuranceOptions.employer", + "_default_message": "Employer-provided health insurance", + }, + "medicaid": { + "icon": {"_name": "Medicaid", "_classname": "option-card-icon"}, + "_label": "healthInsuranceOptions.medicaid", + "_default_message": "Health First Colorado (Full Medicaid)", + }, + "medicare": { + "icon": {"_name": "Medicare", "_classname": "option-card-icon"}, + "_label": "healthInsuranceOptions.medicare", + "_default_message": "Medicare", + }, + "dont_know": { + "icon": {"_name": "Dont_know", "_classname": "option-card-icon"}, + "_label": "healthInsuranceOptions.dont_know", + "_default_message": "Don't Know", + }, + "family_planning": { + "icon": {"_name": "Family_planning", "_classname": "option-card-icon"}, + "_label": "healthInsuranceOptions.family_planning", + "_default_message": "Family Planning Limited Medicaid", + }, + "emergency_medicaid": { + "icon": {"_name": "Emergency_medicaid", "_classname": "option-card-icon"}, + "_label": "healthInsuranceOptions.emergency_medicaid", + "_default_message": "Emergency Medicaid / Reproductive Health", + }, + }, + "them": { + "chp": { + "icon": {"_name": "Chp", "_classname": "option-card-icon"}, + "_label": "healthInsuranceOptions.chp", + "_default_message": "Child Health Plan Plus (CHP+)", + }, + "none": { + "icon": {"_name": "None", "_classname": "option-card-icon"}, + "_label": "healthInsuranceOptions.none-they", + "_default_message": "They do not have health insurance", + }, + "private": { + "icon": {"_name": "PrivateInsurance", "_classname": "option-card-icon"}, + "_label": "healthInsuranceOptions.private", + "_default_message": "Private (non-employer) health insurance", + }, + "employer": { + "icon": {"_name": "Employer", "_classname": "option-card-icon"}, + "_label": "healthInsuranceOptions.employer", + "_default_message": "Employer-provided health insurance", + }, + "medicaid": { + "icon": {"_name": "Medicaid", "_classname": "option-card-icon"}, + "_label": "healthInsuranceOptions.medicaid", + "_default_message": "Health First Colorado (Full Medicaid)", + }, + "medicare": { + "icon": {"_name": "Medicare", "_classname": "option-card-icon"}, + "_label": "healthInsuranceOptions.medicare", + "_default_message": "Medicare", + }, + "dont_know": { + "icon": {"_name": "Dont_know", "_classname": "option-card-icon"}, + "_label": "healthInsuranceOptions.dont_know", + "_default_message": "Don't Know", + }, + "family_planning": { + "icon": {"_name": "Family_planning", "_classname": "option-card-icon"}, + "_label": "healthInsuranceOptions.family_planning", + "_default_message": "Family Planning Limited Medicaid", + }, + "emergency_medicaid": { + "icon": {"_name": "Emergency_medicaid", "_classname": "option-card-icon"}, + "_label": "healthInsuranceOptions.emergency_medicaid", + "_default_message": "Emergency Medicaid / Reproductive Health", + }, + }, + } - housing_options = {"hotel": {"_label": "housingOptions.hotel", "_default_message": "In a hotel"}, "owner": {"_label": "housingOptions.owner", "_default_message": "You or a household member owns the home or apartment"}, "renting": {"_label": "housingOptions.renting", "_default_message": "Renting"}, "shelter": {"_label": "housingOptions.shelter", "_default_message": "In a shelter or homeless"}, "preferNotToSay": {"_label": "housingOptions.preferNotToSay", "_default_message": "Prefer not to say"}, "stayingWithFriend": {"_label": "housingOptions.stayingWithFriend", "_default_message": "Staying with friend"}} + housing_options = { + "hotel": {"_label": "housingOptions.hotel", "_default_message": "In a hotel"}, + "owner": { + "_label": "housingOptions.owner", + "_default_message": "You or a household member owns the home or apartment", + }, + "renting": {"_label": "housingOptions.renting", "_default_message": "Renting"}, + "shelter": {"_label": "housingOptions.shelter", "_default_message": "In a shelter or homeless"}, + "preferNotToSay": {"_label": "housingOptions.preferNotToSay", "_default_message": "Prefer not to say"}, + "stayingWithFriend": {"_label": "housingOptions.stayingWithFriend", "_default_message": "Staying with friend"}, + } - frequency_options = {"hourly": {"_label": "frequencyOptions.hourly", "_default_message": "hourly"}, "weekly": {"_label": "frequencyOptions.weekly", "_default_message": "every week"}, "monthly": {"_label": "frequencyOptions.monthly", "_default_message": "every month"}, "biweekly": {"_label": "frequencyOptions.biweekly", "_default_message": "every 2 weeks"}} + frequency_options = { + "hourly": {"_label": "frequencyOptions.hourly", "_default_message": "hourly"}, + "weekly": {"_label": "frequencyOptions.weekly", "_default_message": "every week"}, + "monthly": {"_label": "frequencyOptions.monthly", "_default_message": "every month"}, + "biweekly": {"_label": "frequencyOptions.biweekly", "_default_message": "every 2 weeks"}, + } - expense_options = {"auto": {"_label": "expenseOptions.auto", "_default_message": "Auto Insurance Premium &/or Payment"}, "rent": {"_label": "expenseOptions.rent", "_default_message": "Rent"}, "cooling": {"_label": "expenseOptions.cooling", "_default_message": "Cooling"}, "heating": {"_label": "expenseOptions.heating", "_default_message": "Heating"}, "medical": {"_label": "expenseOptions.medical", "_default_message": "Medical Insurance Premium &/or Bills"}, "internet": {"_label": "expenseOptions.internet", "_default_message": "Internet"}, "mortgage": {"_label": "expenseOptions.mortgage", "_default_message": "Mortgage"}, "childCare": {"_label": "expenseOptions.childCare", "_default_message": "Child Care"}, "telephone": {"_label": "expenseOptions.telephone", "_default_message": "Telephone"}, "creditCard": {"_label": "expenseOptions.creditCard", "_default_message": "Credit Card Debt"}, "childSupport": {"_label": "expenseOptions.childSupport", "_default_message": "Child Support (Paid)"}, "personalLoan": {"_label": "expenseOptions.personalLoan", "_default_message": "Personal Loan"}, "studentLoans": {"_label": "expenseOptions.studentLoans", "_default_message": "Student Loans"}, "dependentCare": {"_label": "expenseOptions.dependentCare", "_default_message": "Dependent Care"}, "otherUtilities": {"_label": "expenseOptions.otherUtilities", "_default_message": "Other Utilities"}} + expense_options = { + "auto": {"_label": "expenseOptions.auto", "_default_message": "Auto Insurance Premium &/or Payment"}, + "rent": {"_label": "expenseOptions.rent", "_default_message": "Rent"}, + "cooling": {"_label": "expenseOptions.cooling", "_default_message": "Cooling"}, + "heating": {"_label": "expenseOptions.heating", "_default_message": "Heating"}, + "medical": {"_label": "expenseOptions.medical", "_default_message": "Medical Insurance Premium &/or Bills"}, + "internet": {"_label": "expenseOptions.internet", "_default_message": "Internet"}, + "mortgage": {"_label": "expenseOptions.mortgage", "_default_message": "Mortgage"}, + "childCare": {"_label": "expenseOptions.childCare", "_default_message": "Child Care"}, + "telephone": {"_label": "expenseOptions.telephone", "_default_message": "Telephone"}, + "creditCard": {"_label": "expenseOptions.creditCard", "_default_message": "Credit Card Debt"}, + "childSupport": {"_label": "expenseOptions.childSupport", "_default_message": "Child Support (Paid)"}, + "personalLoan": {"_label": "expenseOptions.personalLoan", "_default_message": "Personal Loan"}, + "studentLoans": {"_label": "expenseOptions.studentLoans", "_default_message": "Student Loans"}, + "dependentCare": {"_label": "expenseOptions.dependentCare", "_default_message": "Dependent Care"}, + "otherUtilities": {"_label": "expenseOptions.otherUtilities", "_default_message": "Other Utilities"}, + } - condition_options = {"you": {"student": {"icon": {"_name": "Student", "_classname": "option-card-icon"}, "_label": "conditionOptions.student", "_default_message": "Student at a college, university, or other post-secondary institution like a job-training program"}, "disabled": {"icon": {"_name": "Disabled", "_classname": "option-card-icon"}, "_label": "conditionOptions.disabled", "_default_message": "Have any disabilities that make you unable to work now or in the future"}, "pregnant": {"icon": {"_name": "Pregnant", "_classname": "option-card-icon"}, "_label": "conditionOptions.pregnant", "_default_message": "Pregnant"}, "longTermDisability": {"icon": {"_name": "LongTermDisability", "_classname": "option-card-icon"}, "_label": "conditionOptions.longTermDisability", "_default_message": "Any medical or developmental condition that has lasted, or is expected to last, more than 12 months"}, "blindOrVisuallyImpaired": {"icon": {"_name": "BlindOrVisuallyImpaired", "_classname": "option-card-icon"}, "_label": "conditionOptions.blindOrVisuallyImpaired", "_default_message": "Blind or visually impaired"}}, "them": {"student": {"icon": {"_name": "Student", "_classname": "option-card-icon"}, "_label": "conditionOptions.student", "_default_message": "Student at a college, university, or other post-secondary institution like a job-training program"}, "disabled": {"icon": {"_name": "Disabled", "_classname": "option-card-icon"}, "_label": "conditionOptions.disabled-them", "_default_message": "Have any disabilities that make them unable to work now or in the future"}, "pregnant": {"icon": {"_name": "Pregnant", "_classname": "option-card-icon"}, "_label": "conditionOptions.pregnant", "_default_message": "Pregnant"}, "longTermDisability": {"icon": {"_name": "LongTermDisability", "_classname": "option-card-icon"}, "_label": "conditionOptions.longTermDisability", "_default_message": "Any medical or developmental condition that has lasted, or is expected to last, more than 12 months"}, "blindOrVisuallyImpaired": {"icon": {"_name": "BlindOrVisuallyImpaired", "_classname": "option-card-icon"}, "_label": "conditionOptions.blindOrVisuallyImpaired", "_default_message": "Blind or visually impaired"}}} + condition_options = { + "you": { + "student": { + "icon": {"_name": "Student", "_classname": "option-card-icon"}, + "_label": "conditionOptions.student", + "_default_message": "Student at a college, university, or other post-secondary institution like a job-training program", + }, + "disabled": { + "icon": {"_name": "Disabled", "_classname": "option-card-icon"}, + "_label": "conditionOptions.disabled", + "_default_message": "Have any disabilities that make you unable to work now or in the future", + }, + "pregnant": { + "icon": {"_name": "Pregnant", "_classname": "option-card-icon"}, + "_label": "conditionOptions.pregnant", + "_default_message": "Pregnant", + }, + "longTermDisability": { + "icon": {"_name": "LongTermDisability", "_classname": "option-card-icon"}, + "_label": "conditionOptions.longTermDisability", + "_default_message": "Any medical or developmental condition that has lasted, or is expected to last, more than 12 months", + }, + "blindOrVisuallyImpaired": { + "icon": {"_name": "BlindOrVisuallyImpaired", "_classname": "option-card-icon"}, + "_label": "conditionOptions.blindOrVisuallyImpaired", + "_default_message": "Blind or visually impaired", + }, + }, + "them": { + "student": { + "icon": {"_name": "Student", "_classname": "option-card-icon"}, + "_label": "conditionOptions.student", + "_default_message": "Student at a college, university, or other post-secondary institution like a job-training program", + }, + "disabled": { + "icon": {"_name": "Disabled", "_classname": "option-card-icon"}, + "_label": "conditionOptions.disabled-them", + "_default_message": "Have any disabilities that make them unable to work now or in the future", + }, + "pregnant": { + "icon": {"_name": "Pregnant", "_classname": "option-card-icon"}, + "_label": "conditionOptions.pregnant", + "_default_message": "Pregnant", + }, + "longTermDisability": { + "icon": {"_name": "LongTermDisability", "_classname": "option-card-icon"}, + "_label": "conditionOptions.longTermDisability", + "_default_message": "Any medical or developmental condition that has lasted, or is expected to last, more than 12 months", + }, + "blindOrVisuallyImpaired": { + "icon": {"_name": "BlindOrVisuallyImpaired", "_classname": "option-card-icon"}, + "_label": "conditionOptions.blindOrVisuallyImpaired", + "_default_message": "Blind or visually impaired", + }, + }, + } - co_zipcodes = {"80001": "80001", "80002": "80002", "80003": "80003", "80004": "80004", "80005": "80005", "80006": "80006", "80007": "80007", "80010": "80010", "80011": "80011", "80012": "80012", "80013": "80013", "80014": "80014", "80015": "80015", "80016": "80016", "80017": "80017", "80018": "80018", "80019": "80019", "80020": "80020", "80021": "80021", "80022": "80022", "80023": "80023", "80024": "80024", "80025": "80025", "80026": "80026", "80027": "80027", "80028": "80028", "80030": "80030", "80031": "80031", "80033": "80033", "80034": "80034", "80035": "80035", "80036": "80036", "80037": "80037", "80038": "80038", "80040": "80040", "80041": "80041", "80042": "80042", "80044": "80044", "80045": "80045", "80046": "80046", "80047": "80047", "80101": "80101", "80102": "80102", "80103": "80103", "80104": "80104", "80105": "80105", "80106": "80106", "80107": "80107", "80108": "80108", "80109": "80109", "80110": "80110", "80111": "80111", "80112": "80112", "80113": "80113", "80116": "80116", "80117": "80117", "80118": "80118", "80120": "80120", "80121": "80121", "80122": "80122", "80123": "80123", "80124": "80124", "80125": "80125", "80126": "80126", "80127": "80127", "80128": "80128", "80129": "80129", "80130": "80130", "80131": "80131", "80132": "80132", "80133": "80133", "80134": "80134", "80135": "80135", "80136": "80136", "80137": "80137", "80138": "80138", "80150": "80150", "80151": "80151", "80155": "80155", "80160": "80160", "80161": "80161", "80162": "80162", "80163": "80163", "80165": "80165", "80166": "80166", "80201": "80201", "80202": "80202", "80203": "80203", "80204": "80204", "80205": "80205", "80206": "80206", "80207": "80207", "80208": "80208", "80209": "80209", "80210": "80210", "80211": "80211", "80212": "80212", "80214": "80214", "80215": "80215", "80216": "80216", "80217": "80217", "80218": "80218", "80219": "80219", "80220": "80220", "80221": "80221", "80222": "80222", "80223": "80223", "80224": "80224", "80225": "80225", "80226": "80226", "80227": "80227", "80228": "80228", "80229": "80229", "80230": "80230", "80231": "80231", "80232": "80232", "80233": "80233", "80234": "80234", "80235": "80235", "80236": "80236", "80237": "80237", "80238": "80238", "80239": "80239", "80241": "80241", "80243": "80243", "80244": "80244", "80246": "80246", "80247": "80247", "80248": "80248", "80249": "80249", "80250": "80250", "80251": "80251", "80252": "80252", "80256": "80256", "80257": "80257", "80259": "80259", "80260": "80260", "80261": "80261", "80262": "80262", "80263": "80263", "80264": "80264", "80265": "80265", "80266": "80266", "80271": "80271", "80273": "80273", "80274": "80274", "80279": "80279", "80280": "80280", "80281": "80281", "80290": "80290", "80291": "80291", "80293": "80293", "80294": "80294", "80295": "80295", "80299": "80299", "80301": "80301", "80302": "80302", "80303": "80303", "80304": "80304", "80305": "80305", "80306": "80306", "80307": "80307", "80308": "80308", "80309": "80309", "80310": "80310", "80314": "80314", "80321": "80321", "80322": "80322", "80323": "80323", "80328": "80328", "80329": "80329", "80401": "80401", "80402": "80402", "80403": "80403", "80419": "80419", "80420": "80420", "80421": "80421", "80422": "80422", "80423": "80423", "80424": "80424", "80425": "80425", "80426": "80426", "80427": "80427", "80428": "80428", "80429": "80429", "80430": "80430", "80432": "80432", "80433": "80433", "80434": "80434", "80435": "80435", "80436": "80436", "80437": "80437", "80438": "80438", "80439": "80439", "80440": "80440", "80442": "80442", "80443": "80443", "80444": "80444", "80446": "80446", "80447": "80447", "80448": "80448", "80449": "80449", "80451": "80451", "80452": "80452", "80453": "80453", "80454": "80454", "80455": "80455", "80456": "80456", "80457": "80457", "80459": "80459", "80461": "80461", "80463": "80463", "80465": "80465", "80466": "80466", "80467": "80467", "80468": "80468", "80469": "80469", "80470": "80470", "80471": "80471", "80473": "80473", "80474": "80474", "80475": "80475", "80476": "80476", "80477": "80477", "80478": "80478", "80479": "80479", "80480": "80480", "80481": "80481", "80482": "80482", "80483": "80483", "80487": "80487", "80488": "80488", "80497": "80497", "80498": "80498", "80501": "80501", "80502": "80502", "80503": "80503", "80504": "80504", "80510": "80510", "80511": "80511", "80512": "80512", "80513": "80513", "80514": "80514", "80515": "80515", "80516": "80516", "80517": "80517", "80520": "80520", "80521": "80521", "80522": "80522", "80523": "80523", "80524": "80524", "80525": "80525", "80526": "80526", "80527": "80527", "80528": "80528", "80530": "80530", "80532": "80532", "80533": "80533", "80534": "80534", "80535": "80535", "80536": "80536", "80537": "80537", "80538": "80538", "80539": "80539", "80540": "80540", "80541": "80541", "80542": "80542", "80543": "80543", "80544": "80544", "80545": "80545", "80546": "80546", "80547": "80547", "80549": "80549", "80550": "80550", "80551": "80551", "80553": "80553", "80601": "80601", "80602": "80602", "80603": "80603", "80610": "80610", "80611": "80611", "80612": "80612", "80614": "80614", "80615": "80615", "80620": "80620", "80621": "80621", "80622": "80622", "80623": "80623", "80624": "80624", "80631": "80631", "80632": "80632", "80633": "80633", "80634": "80634", "80638": "80638", "80639": "80639", "80640": "80640", "80642": "80642", "80643": "80643", "80644": "80644", "80645": "80645", "80646": "80646", "80648": "80648", "80649": "80649", "80650": "80650", "80651": "80651", "80652": "80652", "80653": "80653", "80654": "80654", "80701": "80701", "80705": "80705", "80720": "80720", "80721": "80721", "80722": "80722", "80723": "80723", "80726": "80726", "80727": "80727", "80728": "80728", "80729": "80729", "80731": "80731", "80732": "80732", "80733": "80733", "80734": "80734", "80735": "80735", "80736": "80736", "80737": "80737", "80740": "80740", "80741": "80741", "80742": "80742", "80743": "80743", "80744": "80744", "80745": "80745", "80746": "80746", "80747": "80747", "80749": "80749", "80750": "80750", "80751": "80751", "80754": "80754", "80755": "80755", "80757": "80757", "80758": "80758", "80759": "80759", "80801": "80801", "80802": "80802", "80804": "80804", "80805": "80805", "80807": "80807", "80808": "80808", "80809": "80809", "80810": "80810", "80812": "80812", "80813": "80813", "80814": "80814", "80815": "80815", "80816": "80816", "80817": "80817", "80818": "80818", "80819": "80819", "80820": "80820", "80821": "80821", "80822": "80822", "80823": "80823", "80824": "80824", "80825": "80825", "80826": "80826", "80827": "80827", "80828": "80828", "80829": "80829", "80830": "80830", "80831": "80831", "80832": "80832", "80833": "80833", "80834": "80834", "80835": "80835", "80836": "80836", "80840": "80840", "80841": "80841", "80860": "80860", "80861": "80861", "80862": "80862", "80863": "80863", "80864": "80864", "80866": "80866", "80901": "80901", "80902": "80902", "80903": "80903", "80904": "80904", "80905": "80905", "80906": "80906", "80907": "80907", "80908": "80908", "80909": "80909", "80910": "80910", "80911": "80911", "80912": "80912", "80913": "80913", "80914": "80914", "80915": "80915", "80916": "80916", "80917": "80917", "80918": "80918", "80919": "80919", "80920": "80920", "80921": "80921", "80922": "80922", "80923": "80923", "80924": "80924", "80925": "80925", "80926": "80926", "80927": "80927", "80928": "80928", "80929": "80929", "80930": "80930", "80931": "80931", "80932": "80932", "80933": "80933", "80934": "80934", "80935": "80935", "80936": "80936", "80937": "80937", "80938": "80938", "80939": "80939", "80940": "80940", "80941": "80941", "80942": "80942", "80943": "80943", "80944": "80944", "80945": "80945", "80946": "80946", "80947": "80947", "80949": "80949", "80950": "80950", "80951": "80951", "80960": "80960", "80962": "80962", "80970": "80970", "80977": "80977", "80995": "80995", "80997": "80997", "81001": "81001", "81002": "81002", "81003": "81003", "81004": "81004", "81005": "81005", "81006": "81006", "81007": "81007", "81008": "81008", "81009": "81009", "81010": "81010", "81011": "81011", "81012": "81012", "81019": "81019", "81020": "81020", "81021": "81021", "81022": "81022", "81023": "81023", "81024": "81024", "81025": "81025", "81027": "81027", "81029": "81029", "81030": "81030", "81033": "81033", "81034": "81034", "81036": "81036", "81038": "81038", "81039": "81039", "81040": "81040", "81041": "81041", "81043": "81043", "81044": "81044", "81045": "81045", "81046": "81046", "81047": "81047", "81049": "81049", "81050": "81050", "81052": "81052", "81054": "81054", "81055": "81055", "81057": "81057", "81058": "81058", "81059": "81059", "81062": "81062", "81063": "81063", "81064": "81064", "81067": "81067", "81069": "81069", "81071": "81071", "81073": "81073", "81075": "81075", "81076": "81076", "81077": "81077", "81081": "81081", "81082": "81082", "81084": "81084", "81087": "81087", "81089": "81089", "81090": "81090", "81091": "81091", "81092": "81092", "81101": "81101", "81102": "81102", "81120": "81120", "81121": "81121", "81122": "81122", "81123": "81123", "81124": "81124", "81125": "81125", "81126": "81126", "81127": "81127", "81128": "81128", "81129": "81129", "81130": "81130", "81131": "81131", "81132": "81132", "81133": "81133", "81134": "81134", "81135": "81135", "81136": "81136", "81137": "81137", "81138": "81138", "81140": "81140", "81141": "81141", "81143": "81143", "81144": "81144", "81146": "81146", "81147": "81147", "81148": "81148", "81149": "81149", "81151": "81151", "81152": "81152", "81153": "81153", "81154": "81154", "81155": "81155", "81157": "81157", "81201": "81201", "81210": "81210", "81211": "81211", "81212": "81212", "81215": "81215", "81220": "81220", "81221": "81221", "81222": "81222", "81223": "81223", "81224": "81224", "81225": "81225", "81226": "81226", "81227": "81227", "81228": "81228", "81230": "81230", "81231": "81231", "81232": "81232", "81233": "81233", "81235": "81235", "81236": "81236", "81237": "81237", "81239": "81239", "81240": "81240", "81241": "81241", "81242": "81242", "81243": "81243", "81244": "81244", "81247": "81247", "81248": "81248", "81251": "81251", "81252": "81252", "81253": "81253", "81290": "81290", "81301": "81301", "81302": "81302", "81303": "81303", "81320": "81320", "81321": "81321", "81323": "81323", "81324": "81324", "81325": "81325", "81326": "81326", "81327": "81327", "81328": "81328", "81329": "81329", "81330": "81330", "81331": "81331", "81332": "81332", "81334": "81334", "81335": "81335", "81401": "81401", "81402": "81402", "81403": "81403", "81410": "81410", "81411": "81411", "81413": "81413", "81414": "81414", "81415": "81415", "81416": "81416", "81418": "81418", "81419": "81419", "81420": "81420", "81422": "81422", "81423": "81423", "81424": "81424", "81425": "81425", "81426": "81426", "81427": "81427", "81428": "81428", "81429": "81429", "81430": "81430", "81431": "81431", "81432": "81432", "81433": "81433", "81434": "81434", "81435": "81435", "81501": "81501", "81502": "81502", "81503": "81503", "81504": "81504", "81505": "81505", "81506": "81506", "81507": "81507", "81520": "81520", "81521": "81521", "81522": "81522", "81523": "81523", "81524": "81524", "81525": "81525", "81526": "81526", "81527": "81527", "81601": "81601", "81602": "81602", "81610": "81610", "81611": "81611", "81612": "81612", "81615": "81615", "81620": "81620", "81621": "81621", "81623": "81623", "81624": "81624", "81625": "81625", "81626": "81626", "81630": "81630", "81631": "81631", "81632": "81632", "81633": "81633", "81635": "81635", "81636": "81636", "81637": "81637", "81638": "81638", "81639": "81639", "81640": "81640", "81641": "81641", "81642": "81642", "81643": "81643", "81645": "81645", "81646": "81646", "81647": "81647", "81648": "81648", "81649": "81649", "81650": "81650", "81652": "81652", "81653": "81653", "81654": "81654", "81655": "81655", "81656": "81656", "81657": "81657", "81658": "81658"} - - counties_by_zipcode = {"80002": {"Adams County": "Adams County", "Denver County": "Denver County", "Jefferson County": "Jefferson County"}, "80003": {"Adams County": "Adams County", "Jefferson County": "Jefferson County"}, "80004": {"Jefferson County": "Jefferson County"}, "80005": {"Jefferson County": "Jefferson County", "Broomfield County": "Broomfield County"}, "80007": {"Boulder County": "Boulder County", "Jefferson County": "Jefferson County", "Broomfield County": "Broomfield County"}, "80010": {"Adams County": "Adams County", "Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80011": {"Adams County": "Adams County", "Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80012": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80013": {"Arapahoe County": "Arapahoe County"}, "80014": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80015": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80016": {"Denver County": "Denver County", "Elbert County": "Elbert County", "Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, "80017": {"Arapahoe County": "Arapahoe County"}, "80018": {"Adams County": "Adams County", "Arapahoe County": "Arapahoe County"}, "80019": {"Adams County": "Adams County", "Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80020": {"Adams County": "Adams County", "Boulder County": "Boulder County", "Jefferson County": "Jefferson County", "Broomfield County": "Broomfield County"}, "80021": {"Boulder County": "Boulder County", "Jefferson County": "Jefferson County", "Broomfield County": "Broomfield County"}, "80022": {"Adams County": "Adams County", "Denver County": "Denver County"}, "80023": {"Weld County": "Weld County", "Adams County": "Adams County", "Boulder County": "Boulder County", "Broomfield County": "Broomfield County"}, "80024": {"Adams County": "Adams County"}, "80025": {"Boulder County": "Boulder County", "Jefferson County": "Jefferson County"}, "80026": {"Weld County": "Weld County", "Boulder County": "Boulder County", "Broomfield County": "Broomfield County"}, "80027": {"Boulder County": "Boulder County", "Jefferson County": "Jefferson County", "Broomfield County": "Broomfield County"}, "80030": {"Adams County": "Adams County", "Jefferson County": "Jefferson County"}, "80031": {"Adams County": "Adams County", "Jefferson County": "Jefferson County", "Broomfield County": "Broomfield County"}, "80033": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, "80045": {"Adams County": "Adams County", "Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80101": {"Elbert County": "Elbert County", "Arapahoe County": "Arapahoe County"}, "80102": {"Weld County": "Weld County", "Adams County": "Adams County", "Elbert County": "Elbert County", "Arapahoe County": "Arapahoe County"}, "80103": {"Adams County": "Adams County", "Elbert County": "Elbert County", "Morgan County": "Morgan County", "Arapahoe County": "Arapahoe County"}, "80104": {"Douglas County": "Douglas County"}, "80105": {"Adams County": "Adams County", "Elbert County": "Elbert County", "Lincoln County": "Lincoln County", "Arapahoe County": "Arapahoe County", "Washington County": "Washington County"}, "80106": {"Elbert County": "Elbert County", "Douglas County": "Douglas County", "El Paso County": "El Paso County"}, "80107": {"Elbert County": "Elbert County", "Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, "80108": {"Douglas County": "Douglas County"}, "80109": {"Douglas County": "Douglas County"}, "80110": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80111": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80112": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, "80113": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80116": {"Elbert County": "Elbert County", "Douglas County": "Douglas County"}, "80117": {"Elbert County": "Elbert County"}, "80118": {"Elbert County": "Elbert County", "Douglas County": "Douglas County", "El Paso County": "El Paso County"}, "80120": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, "80121": {"Arapahoe County": "Arapahoe County"}, "80122": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, "80123": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County", "Jefferson County": "Jefferson County"}, "80124": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, "80125": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County", "Jefferson County": "Jefferson County"}, "80126": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, "80127": {"Denver County": "Denver County", "Douglas County": "Douglas County", "Jefferson County": "Jefferson County"}, "80128": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County", "Jefferson County": "Jefferson County"}, "80129": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, "80130": {"Douglas County": "Douglas County"}, "80131": {"Douglas County": "Douglas County"}, "80132": {"Douglas County": "Douglas County", "El Paso County": "El Paso County"}, "80133": {"Teller County": "Teller County", "Douglas County": "Douglas County", "El Paso County": "El Paso County"}, "80134": {"Elbert County": "Elbert County", "Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, "80135": {"Park County": "Park County", "Teller County": "Teller County", "Douglas County": "Douglas County", "El Paso County": "El Paso County", "Jefferson County": "Jefferson County"}, "80136": {"Weld County": "Weld County", "Adams County": "Adams County", "Elbert County": "Elbert County", "Arapahoe County": "Arapahoe County"}, "80137": {"Adams County": "Adams County", "Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80138": {"Elbert County": "Elbert County", "Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, "80202": {"Denver County": "Denver County"}, "80203": {"Denver County": "Denver County"}, "80204": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, "80205": {"Denver County": "Denver County"}, "80206": {"Denver County": "Denver County"}, "80207": {"Denver County": "Denver County"}, "80209": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80210": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80211": {"Denver County": "Denver County"}, "80212": {"Adams County": "Adams County", "Denver County": "Denver County", "Jefferson County": "Jefferson County"}, "80214": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, "80215": {"Jefferson County": "Jefferson County"}, "80216": {"Adams County": "Adams County", "Denver County": "Denver County"}, "80218": {"Denver County": "Denver County"}, "80219": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County", "Jefferson County": "Jefferson County"}, "80220": {"Adams County": "Adams County", "Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80221": {"Adams County": "Adams County", "Denver County": "Denver County"}, "80222": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80223": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80224": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80226": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, "80227": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, "80228": {"Jefferson County": "Jefferson County"}, "80229": {"Adams County": "Adams County"}, "80230": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80231": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80232": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, "80233": {"Adams County": "Adams County"}, "80234": {"Adams County": "Adams County", "Broomfield County": "Broomfield County"}, "80235": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, "80236": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County", "Jefferson County": "Jefferson County"}, "80237": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80238": {"Adams County": "Adams County", "Denver County": "Denver County"}, "80239": {"Adams County": "Adams County", "Denver County": "Denver County"}, "80241": {"Adams County": "Adams County"}, "80246": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80247": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80249": {"Adams County": "Adams County", "Denver County": "Denver County"}, "80260": {"Adams County": "Adams County"}, "80264": {"Denver County": "Denver County"}, "80290": {"Denver County": "Denver County"}, "80293": {"Denver County": "Denver County"}, "80294": {"Denver County": "Denver County"}, "80301": {"Boulder County": "Boulder County"}, "80302": {"Boulder County": "Boulder County"}, "80303": {"Boulder County": "Boulder County", "Jefferson County": "Jefferson County"}, "80304": {"Boulder County": "Boulder County"}, "80305": {"Boulder County": "Boulder County"}, "80310": {"Boulder County": "Boulder County"}, "80401": {"Jefferson County": "Jefferson County"}, "80403": {"Gilpin County": "Gilpin County", "Boulder County": "Boulder County", "Jefferson County": "Jefferson County", "Clear Creek County": "Clear Creek County"}, "80419": {"Jefferson County": "Jefferson County"}, "80420": {"Lake County": "Lake County", "Park County": "Park County", "Summit County": "Summit County"}, "80421": {"Park County": "Park County", "Jefferson County": "Jefferson County", "Clear Creek County": "Clear Creek County"}, "80422": {"Grand County": "Grand County", "Gilpin County": "Gilpin County", "Boulder County": "Boulder County", "Jefferson County": "Jefferson County", "Clear Creek County": "Clear Creek County"}, "80423": {"Eagle County": "Eagle County", "Grand County": "Grand County", "Routt County": "Routt County", "Summit County": "Summit County"}, "80424": {"Lake County": "Lake County", "Park County": "Park County", "Summit County": "Summit County"}, "80425": {"Douglas County": "Douglas County", "Jefferson County": "Jefferson County"}, "80426": {"Eagle County": "Eagle County", "Routt County": "Routt County", "Garfield County": "Garfield County"}, "80427": {"Gilpin County": "Gilpin County", "Jefferson County": "Jefferson County", "Clear Creek County": "Clear Creek County"}, "80428": {"Routt County": "Routt County", "Jackson County": "Jackson County"}, "80432": {"Park County": "Park County"}, "80433": {"Park County": "Park County", "Douglas County": "Douglas County", "Jefferson County": "Jefferson County"}, "80434": {"Jackson County": "Jackson County"}, "80435": {"Park County": "Park County", "Summit County": "Summit County", "Clear Creek County": "Clear Creek County"}, "80436": {"Grand County": "Grand County", "Clear Creek County": "Clear Creek County"}, "80438": {"Grand County": "Grand County", "Clear Creek County": "Clear Creek County"}, "80439": {"Park County": "Park County", "Gilpin County": "Gilpin County", "Jefferson County": "Jefferson County", "Clear Creek County": "Clear Creek County"}, "80440": {"Lake County": "Lake County", "Park County": "Park County", "Summit County": "Summit County"}, "80442": {"Grand County": "Grand County"}, "80443": {"Lake County": "Lake County", "Park County": "Park County", "Eagle County": "Eagle County", "Summit County": "Summit County"}, "80444": {"Park County": "Park County", "Summit County": "Summit County", "Clear Creek County": "Clear Creek County"}, "80446": {"Grand County": "Grand County", "Boulder County": "Boulder County", "Jackson County": "Jackson County"}, "80447": {"Grand County": "Grand County", "Boulder County": "Boulder County", "Jackson County": "Jackson County", "Larimer County": "Larimer County"}, "80448": {"Park County": "Park County", "Summit County": "Summit County", "Jefferson County": "Jefferson County", "Clear Creek County": "Clear Creek County"}, "80449": {"Lake County": "Lake County", "Park County": "Park County", "Chaffee County": "Chaffee County", "Fremont County": "Fremont County"}, "80451": {"Grand County": "Grand County"}, "80452": {"Park County": "Park County", "Grand County": "Grand County", "Gilpin County": "Gilpin County", "Clear Creek County": "Clear Creek County"}, "80453": {"Jefferson County": "Jefferson County"}, "80454": {"Jefferson County": "Jefferson County"}, "80455": {"Boulder County": "Boulder County"}, "80456": {"Park County": "Park County", "Summit County": "Summit County", "Jefferson County": "Jefferson County"}, "80457": {"Jefferson County": "Jefferson County"}, "80459": {"Eagle County": "Eagle County", "Grand County": "Grand County", "Routt County": "Routt County", "Summit County": "Summit County", "Jackson County": "Jackson County"}, "80461": {"Lake County": "Lake County", "Park County": "Park County", "Eagle County": "Eagle County", "Pitkin County": "Pitkin County", "Summit County": "Summit County", "Chaffee County": "Chaffee County"}, "80463": {"Eagle County": "Eagle County", "Grand County": "Grand County", "Routt County": "Routt County"}, "80465": {"Jefferson County": "Jefferson County"}, "80466": {"Grand County": "Grand County", "Gilpin County": "Gilpin County", "Boulder County": "Boulder County"}, "80467": {"Grand County": "Grand County", "Routt County": "Routt County", "Rio Blanco County": "Rio Blanco County"}, "80468": {"Grand County": "Grand County", "Summit County": "Summit County", "Clear Creek County": "Clear Creek County"}, "80469": {"Routt County": "Routt County", "Rio Blanco County": "Rio Blanco County"}, "80470": {"Park County": "Park County", "Jefferson County": "Jefferson County", "Clear Creek County": "Clear Creek County"}, "80471": {"Gilpin County": "Gilpin County", "Boulder County": "Boulder County"}, "80473": {"Grand County": "Grand County", "Jackson County": "Jackson County"}, "80475": {"Park County": "Park County"}, "80476": {"Grand County": "Grand County", "Summit County": "Summit County", "Clear Creek County": "Clear Creek County"}, "80477": {"Routt County": "Routt County"}, "80478": {"Grand County": "Grand County"}, "80479": {"Eagle County": "Eagle County", "Routt County": "Routt County"}, "80480": {"Grand County": "Grand County", "Routt County": "Routt County", "Jackson County": "Jackson County", "Larimer County": "Larimer County"}, "80481": {"Grand County": "Grand County", "Boulder County": "Boulder County"}, "80482": {"Grand County": "Grand County", "Gilpin County": "Gilpin County", "Boulder County": "Boulder County", "Clear Creek County": "Clear Creek County"}, "80483": {"Routt County": "Routt County", "Garfield County": "Garfield County", "Rio Blanco County": "Rio Blanco County"}, "80487": {"Grand County": "Grand County", "Routt County": "Routt County", "Jackson County": "Jackson County"}, "80488": {"Routt County": "Routt County"}, "80497": {"Grand County": "Grand County", "Summit County": "Summit County", "Clear Creek County": "Clear Creek County"}, "80498": {"Eagle County": "Eagle County", "Grand County": "Grand County", "Summit County": "Summit County"}, "80501": {"Weld County": "Weld County", "Boulder County": "Boulder County"}, "80503": {"Boulder County": "Boulder County", "Larimer County": "Larimer County"}, "80504": {"Weld County": "Weld County", "Boulder County": "Boulder County", "Larimer County": "Larimer County"}, "80510": {"Grand County": "Grand County", "Boulder County": "Boulder County", "Larimer County": "Larimer County"}, "80511": {"Larimer County": "Larimer County"}, "80512": {"Grand County": "Grand County", "Jackson County": "Jackson County", "Larimer County": "Larimer County"}, "80513": {"Weld County": "Weld County", "Boulder County": "Boulder County", "Larimer County": "Larimer County"}, "80514": {"Weld County": "Weld County", "Broomfield County": "Broomfield County"}, "80515": {"Larimer County": "Larimer County"}, "80516": {"Weld County": "Weld County", "Adams County": "Adams County", "Boulder County": "Boulder County", "Broomfield County": "Broomfield County"}, "80517": {"Grand County": "Grand County", "Boulder County": "Boulder County", "Larimer County": "Larimer County"}, "80520": {"Weld County": "Weld County"}, "80521": {"Larimer County": "Larimer County"}, "80524": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, "80525": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, "80526": {"Larimer County": "Larimer County"}, "80528": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, "80530": {"Weld County": "Weld County"}, "80532": {"Larimer County": "Larimer County"}, "80534": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, "80535": {"Larimer County": "Larimer County"}, "80536": {"Larimer County": "Larimer County"}, "80537": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, "80538": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, "80540": {"Boulder County": "Boulder County", "Larimer County": "Larimer County"}, "80542": {"Weld County": "Weld County"}, "80543": {"Weld County": "Weld County"}, "80544": {"Boulder County": "Boulder County"}, "80545": {"Larimer County": "Larimer County"}, "80546": {"Weld County": "Weld County"}, "80547": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, "80549": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, "80550": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, "80601": {"Weld County": "Weld County", "Adams County": "Adams County"}, "80602": {"Weld County": "Weld County", "Adams County": "Adams County", "Broomfield County": "Broomfield County"}, "80603": {"Weld County": "Weld County", "Adams County": "Adams County", "Denver County": "Denver County", "Broomfield County": "Broomfield County"}, "80610": {"Weld County": "Weld County"}, "80611": {"Weld County": "Weld County", "Morgan County": "Morgan County"}, "80612": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, "80615": {"Weld County": "Weld County"}, "80620": {"Weld County": "Weld County"}, "80621": {"Weld County": "Weld County"}, "80622": {"Weld County": "Weld County"}, "80623": {"Weld County": "Weld County"}, "80624": {"Weld County": "Weld County"}, "80631": {"Weld County": "Weld County"}, "80634": {"Weld County": "Weld County"}, "80640": {"Adams County": "Adams County"}, "80642": {"Weld County": "Weld County", "Adams County": "Adams County", "Denver County": "Denver County"}, "80643": {"Weld County": "Weld County", "Adams County": "Adams County"}, "80644": {"Weld County": "Weld County"}, "80645": {"Weld County": "Weld County"}, "80648": {"Weld County": "Weld County"}, "80649": {"Weld County": "Weld County", "Morgan County": "Morgan County"}, "80650": {"Weld County": "Weld County"}, "80651": {"Weld County": "Weld County"}, "80652": {"Weld County": "Weld County", "Adams County": "Adams County", "Morgan County": "Morgan County"}, "80653": {"Morgan County": "Morgan County"}, "80654": {"Weld County": "Weld County", "Adams County": "Adams County", "Morgan County": "Morgan County"}, "80701": {"Weld County": "Weld County", "Adams County": "Adams County", "Morgan County": "Morgan County", "Washington County": "Washington County"}, "80705": {"Morgan County": "Morgan County"}, "80720": {"Yuma County": "Yuma County", "Logan County": "Logan County", "Morgan County": "Morgan County", "Washington County": "Washington County"}, "80721": {"Phillips County": "Phillips County", "Sedgwick County": "Sedgwick County"}, "80722": {"Logan County": "Logan County", "Washington County": "Washington County"}, "80723": {"Morgan County": "Morgan County", "Washington County": "Washington County"}, "80726": {"Logan County": "Logan County", "Sedgwick County": "Sedgwick County"}, "80727": {"Yuma County": "Yuma County"}, "80728": {"Logan County": "Logan County", "Sedgwick County": "Sedgwick County", "Washington County": "Washington County"}, "80729": {"Weld County": "Weld County"}, "80731": {"Yuma County": "Yuma County", "Logan County": "Logan County", "Phillips County": "Phillips County", "Sedgwick County": "Sedgwick County", "Washington County": "Washington County"}, "80733": {"Logan County": "Logan County", "Morgan County": "Morgan County", "Washington County": "Washington County"}, "80734": {"Yuma County": "Yuma County", "Phillips County": "Phillips County", "Sedgwick County": "Sedgwick County"}, "80735": {"Yuma County": "Yuma County", "Kit Carson County": "Kit Carson County"}, "80736": {"Logan County": "Logan County"}, "80737": {"Phillips County": "Phillips County", "Sedgwick County": "Sedgwick County"}, "80740": {"Lincoln County": "Lincoln County", "Washington County": "Washington County"}, "80741": {"Weld County": "Weld County", "Logan County": "Logan County", "Morgan County": "Morgan County", "Washington County": "Washington County"}, "80742": {"Weld County": "Weld County", "Logan County": "Logan County", "Morgan County": "Morgan County"}, "80743": {"Yuma County": "Yuma County", "Logan County": "Logan County", "Washington County": "Washington County"}, "80744": {"Phillips County": "Phillips County", "Sedgwick County": "Sedgwick County"}, "80745": {"Weld County": "Weld County", "Logan County": "Logan County"}, "80746": {"Phillips County": "Phillips County"}, "80747": {"Logan County": "Logan County"}, "80749": {"Logan County": "Logan County", "Phillips County": "Phillips County", "Sedgwick County": "Sedgwick County"}, "80750": {"Weld County": "Weld County", "Logan County": "Logan County", "Morgan County": "Morgan County", "Washington County": "Washington County"}, "80751": {"Logan County": "Logan County", "Washington County": "Washington County"}, "80754": {"Weld County": "Weld County", "Logan County": "Logan County", "Morgan County": "Morgan County"}, "80755": {"Yuma County": "Yuma County"}, "80757": {"Adams County": "Adams County", "Morgan County": "Morgan County", "Lincoln County": "Lincoln County", "Arapahoe County": "Arapahoe County", "Washington County": "Washington County"}, "80758": {"Yuma County": "Yuma County", "Phillips County": "Phillips County"}, "80759": {"Yuma County": "Yuma County", "Logan County": "Logan County", "Phillips County": "Phillips County", "Washington County": "Washington County"}, "80801": {"Washington County": "Washington County"}, "80802": {"Kiowa County": "Kiowa County", "Cheyenne County": "Cheyenne County", "Kit Carson County": "Kit Carson County"}, "80804": {"Lincoln County": "Lincoln County", "Kit Carson County": "Kit Carson County", "Washington County": "Washington County"}, "80805": {"Yuma County": "Yuma County", "Cheyenne County": "Cheyenne County", "Kit Carson County": "Kit Carson County"}, "80807": {"Yuma County": "Yuma County", "Cheyenne County": "Cheyenne County", "Kit Carson County": "Kit Carson County"}, "80808": {"Elbert County": "Elbert County", "El Paso County": "El Paso County"}, "80809": {"Teller County": "Teller County", "El Paso County": "El Paso County"}, "80810": {"Kiowa County": "Kiowa County", "Cheyenne County": "Cheyenne County", "Kit Carson County": "Kit Carson County"}, "80812": {"Yuma County": "Yuma County", "Kit Carson County": "Kit Carson County", "Washington County": "Washington County"}, "80813": {"Teller County": "Teller County", "El Paso County": "El Paso County", "Fremont County": "Fremont County"}, "80814": {"Teller County": "Teller County"}, "80815": {"Lincoln County": "Lincoln County", "Cheyenne County": "Cheyenne County", "Kit Carson County": "Kit Carson County", "Washington County": "Washington County"}, "80816": {"Park County": "Park County", "Teller County": "Teller County", "Fremont County": "Fremont County"}, "80817": {"Pueblo County": "Pueblo County", "El Paso County": "El Paso County"}, "80818": {"Lincoln County": "Lincoln County", "Washington County": "Washington County"}, "80819": {"Teller County": "Teller County", "El Paso County": "El Paso County"}, "80820": {"Park County": "Park County", "Teller County": "Teller County", "Fremont County": "Fremont County"}, "80821": {"Elbert County": "Elbert County", "Lincoln County": "Lincoln County", "Cheyenne County": "Cheyenne County", "Kit Carson County": "Kit Carson County"}, "80822": {"Yuma County": "Yuma County", "Kit Carson County": "Kit Carson County", "Washington County": "Washington County"}, "80823": {"Kiowa County": "Kiowa County", "Crowley County": "Crowley County", "Lincoln County": "Lincoln County", "Cheyenne County": "Cheyenne County"}, "80824": {"Yuma County": "Yuma County", "Kit Carson County": "Kit Carson County"}, "80825": {"Kiowa County": "Kiowa County", "Lincoln County": "Lincoln County", "Cheyenne County": "Cheyenne County", "Kit Carson County": "Kit Carson County"}, "80827": {"Park County": "Park County", "Teller County": "Teller County", "Douglas County": "Douglas County", "Jefferson County": "Jefferson County"}, "80828": {"Elbert County": "Elbert County", "Lincoln County": "Lincoln County", "Arapahoe County": "Arapahoe County", "Washington County": "Washington County"}, "80829": {"Teller County": "Teller County", "El Paso County": "El Paso County"}, "80830": {"Elbert County": "Elbert County", "El Paso County": "El Paso County", "Lincoln County": "Lincoln County"}, "80831": {"Elbert County": "Elbert County", "El Paso County": "El Paso County"}, "80832": {"Elbert County": "Elbert County", "El Paso County": "El Paso County", "Lincoln County": "Lincoln County"}, "80833": {"Elbert County": "Elbert County", "Pueblo County": "Pueblo County", "Crowley County": "Crowley County", "El Paso County": "El Paso County", "Lincoln County": "Lincoln County"}, "80834": {"Cheyenne County": "Cheyenne County", "Kit Carson County": "Kit Carson County", "Washington County": "Washington County"}, "80835": {"Elbert County": "Elbert County", "El Paso County": "El Paso County"}, "80836": {"Yuma County": "Yuma County", "Cheyenne County": "Cheyenne County", "Kit Carson County": "Kit Carson County"}, "80840": {"El Paso County": "El Paso County"}, "80860": {"Teller County": "Teller County", "El Paso County": "El Paso County", "Fremont County": "Fremont County"}, "80861": {"Yuma County": "Yuma County", "Cheyenne County": "Cheyenne County", "Kit Carson County": "Kit Carson County", "Washington County": "Washington County"}, "80862": {"Lincoln County": "Lincoln County", "Cheyenne County": "Cheyenne County", "Kit Carson County": "Kit Carson County"}, "80863": {"Teller County": "Teller County", "Douglas County": "Douglas County", "El Paso County": "El Paso County"}, "80864": {"Pueblo County": "Pueblo County", "Crowley County": "Crowley County", "El Paso County": "El Paso County", "Lincoln County": "Lincoln County"}, "80902": {"El Paso County": "El Paso County"}, "80903": {"El Paso County": "El Paso County"}, "80904": {"El Paso County": "El Paso County"}, "80905": {"El Paso County": "El Paso County"}, "80906": {"Teller County": "Teller County", "El Paso County": "El Paso County"}, "80907": {"El Paso County": "El Paso County"}, "80908": {"Elbert County": "Elbert County", "Douglas County": "Douglas County", "El Paso County": "El Paso County"}, "80909": {"El Paso County": "El Paso County"}, "80910": {"El Paso County": "El Paso County"}, "80911": {"El Paso County": "El Paso County"}, "80913": {"El Paso County": "El Paso County"}, "80914": {"El Paso County": "El Paso County"}, "80915": {"El Paso County": "El Paso County"}, "80916": {"El Paso County": "El Paso County"}, "80917": {"El Paso County": "El Paso County"}, "80918": {"El Paso County": "El Paso County"}, "80919": {"El Paso County": "El Paso County"}, "80920": {"El Paso County": "El Paso County"}, "80921": {"Teller County": "Teller County", "El Paso County": "El Paso County"}, "80922": {"El Paso County": "El Paso County"}, "80923": {"El Paso County": "El Paso County"}, "80924": {"El Paso County": "El Paso County"}, "80925": {"El Paso County": "El Paso County"}, "80926": {"Teller County": "Teller County", "El Paso County": "El Paso County", "Fremont County": "Fremont County"}, "80927": {"El Paso County": "El Paso County"}, "80928": {"Pueblo County": "Pueblo County", "El Paso County": "El Paso County"}, "80929": {"El Paso County": "El Paso County"}, "80930": {"El Paso County": "El Paso County"}, "80938": {"El Paso County": "El Paso County"}, "80939": {"El Paso County": "El Paso County"}, "80951": {"El Paso County": "El Paso County"}, "81001": {"Pueblo County": "Pueblo County"}, "81003": {"Pueblo County": "Pueblo County"}, "81004": {"Pueblo County": "Pueblo County"}, "81005": {"Custer County": "Custer County", "Pueblo County": "Pueblo County", "Fremont County": "Fremont County"}, "81006": {"Pueblo County": "Pueblo County"}, "81007": {"Pueblo County": "Pueblo County", "Fremont County": "Fremont County"}, "81008": {"Pueblo County": "Pueblo County", "El Paso County": "El Paso County"}, "81019": {"Pueblo County": "Pueblo County"}, "81020": {"Pueblo County": "Pueblo County", "Huerfano County": "Huerfano County", "Las Animas County": "Las Animas County"}, "81021": {"Bent County": "Bent County", "Kiowa County": "Kiowa County", "Otero County": "Otero County", "Crowley County": "Crowley County", "Lincoln County": "Lincoln County"}, "81022": {"Pueblo County": "Pueblo County", "Huerfano County": "Huerfano County"}, "81023": {"Custer County": "Custer County", "Pueblo County": "Pueblo County"}, "81024": {"Las Animas County": "Las Animas County"}, "81025": {"Pueblo County": "Pueblo County", "Crowley County": "Crowley County", "El Paso County": "El Paso County", "Lincoln County": "Lincoln County"}, "81027": {"Las Animas County": "Las Animas County"}, "81029": {"Baca County": "Baca County"}, "81030": {"Otero County": "Otero County"}, "81033": {"Crowley County": "Crowley County"}, "81036": {"Bent County": "Bent County", "Kiowa County": "Kiowa County", "Prowers County": "Prowers County", "Cheyenne County": "Cheyenne County"}, "81038": {"Bent County": "Bent County"}, "81039": {"Otero County": "Otero County", "Pueblo County": "Pueblo County", "Crowley County": "Crowley County", "Huerfano County": "Huerfano County", "Las Animas County": "Las Animas County"}, "81040": {"Custer County": "Custer County", "Pueblo County": "Pueblo County", "Alamosa County": "Alamosa County", "Costilla County": "Costilla County", "Huerfano County": "Huerfano County", "Saguache County": "Saguache County"}, "81041": {"Baca County": "Baca County", "Prowers County": "Prowers County"}, "81043": {"Prowers County": "Prowers County"}, "81044": {"Baca County": "Baca County", "Bent County": "Bent County"}, "81045": {"Kiowa County": "Kiowa County", "Lincoln County": "Lincoln County", "Cheyenne County": "Cheyenne County"}, "81047": {"Baca County": "Baca County", "Kiowa County": "Kiowa County", "Prowers County": "Prowers County"}, "81049": {"Baca County": "Baca County", "Bent County": "Bent County", "Otero County": "Otero County", "Las Animas County": "Las Animas County"}, "81050": {"Bent County": "Bent County", "Kiowa County": "Kiowa County", "Otero County": "Otero County", "Crowley County": "Crowley County", "Las Animas County": "Las Animas County"}, "81052": {"Baca County": "Baca County", "Bent County": "Bent County", "Kiowa County": "Kiowa County", "Prowers County": "Prowers County"}, "81054": {"Baca County": "Baca County", "Bent County": "Bent County", "Kiowa County": "Kiowa County", "Otero County": "Otero County", "Las Animas County": "Las Animas County"}, "81055": {"Costilla County": "Costilla County", "Huerfano County": "Huerfano County", "Las Animas County": "Las Animas County"}, "81057": {"Bent County": "Bent County"}, "81058": {"Otero County": "Otero County", "Crowley County": "Crowley County"}, "81059": {"Otero County": "Otero County", "Pueblo County": "Pueblo County", "Las Animas County": "Las Animas County"}, "81062": {"Otero County": "Otero County", "Pueblo County": "Pueblo County", "Crowley County": "Crowley County", "El Paso County": "El Paso County", "Lincoln County": "Lincoln County"}, "81063": {"Otero County": "Otero County", "Crowley County": "Crowley County", "Lincoln County": "Lincoln County"}, "81064": {"Baca County": "Baca County", "Las Animas County": "Las Animas County"}, "81067": {"Otero County": "Otero County", "Pueblo County": "Pueblo County", "Crowley County": "Crowley County", "Las Animas County": "Las Animas County"}, "81069": {"Custer County": "Custer County", "Pueblo County": "Pueblo County", "Huerfano County": "Huerfano County"}, "81071": {"Kiowa County": "Kiowa County", "Prowers County": "Prowers County", "Cheyenne County": "Cheyenne County"}, "81073": {"Baca County": "Baca County", "Bent County": "Bent County", "Prowers County": "Prowers County", "Las Animas County": "Las Animas County"}, "81076": {"Kiowa County": "Kiowa County", "Otero County": "Otero County", "Crowley County": "Crowley County", "Lincoln County": "Lincoln County"}, "81077": {"Otero County": "Otero County"}, "81081": {"Las Animas County": "Las Animas County"}, "81082": {"Las Animas County": "Las Animas County"}, "81084": {"Baca County": "Baca County", "Prowers County": "Prowers County"}, "81087": {"Baca County": "Baca County"}, "81089": {"Pueblo County": "Pueblo County", "Huerfano County": "Huerfano County", "Las Animas County": "Las Animas County"}, "81090": {"Baca County": "Baca County", "Prowers County": "Prowers County"}, "81091": {"Costilla County": "Costilla County", "Huerfano County": "Huerfano County", "Las Animas County": "Las Animas County"}, "81092": {"Bent County": "Bent County", "Kiowa County": "Kiowa County", "Prowers County": "Prowers County"}, "81101": {"Alamosa County": "Alamosa County", "Conejos County": "Conejos County", "Costilla County": "Costilla County", "Rio Grande County": "Rio Grande County"}, "81120": {"Conejos County": "Conejos County", "Costilla County": "Costilla County", "Archuleta County": "Archuleta County", "Rio Grande County": "Rio Grande County"}, "81121": {"La Plata County": "La Plata County", "Archuleta County": "Archuleta County"}, "81122": {"Hinsdale County": "Hinsdale County", "La Plata County": "La Plata County", "San Juan County": "San Juan County", "Archuleta County": "Archuleta County"}, "81123": {"Alamosa County": "Alamosa County", "Conejos County": "Conejos County", "Costilla County": "Costilla County", "Huerfano County": "Huerfano County"}, "81124": {"Conejos County": "Conejos County"}, "81125": {"Alamosa County": "Alamosa County", "Saguache County": "Saguache County", "Rio Grande County": "Rio Grande County"}, "81126": {"Costilla County": "Costilla County"}, "81128": {"Conejos County": "Conejos County", "Archuleta County": "Archuleta County"}, "81129": {"Conejos County": "Conejos County"}, "81130": {"Mineral County": "Mineral County", "Hinsdale County": "Hinsdale County", "Saguache County": "Saguache County", "San Juan County": "San Juan County", "Archuleta County": "Archuleta County", "Rio Grande County": "Rio Grande County"}, "81131": {"Custer County": "Custer County", "Alamosa County": "Alamosa County", "Huerfano County": "Huerfano County", "Saguache County": "Saguache County"}, "81132": {"Conejos County": "Conejos County", "Mineral County": "Mineral County", "Saguache County": "Saguache County", "Rio Grande County": "Rio Grande County"}, "81133": {"Costilla County": "Costilla County", "Huerfano County": "Huerfano County"}, "81136": {"Alamosa County": "Alamosa County", "Saguache County": "Saguache County"}, "81137": {"La Plata County": "La Plata County", "Archuleta County": "Archuleta County"}, "81138": {"Costilla County": "Costilla County"}, "81140": {"Alamosa County": "Alamosa County", "Conejos County": "Conejos County", "Rio Grande County": "Rio Grande County"}, "81141": {"Conejos County": "Conejos County", "Costilla County": "Costilla County"}, "81143": {"Custer County": "Custer County", "Saguache County": "Saguache County"}, "81144": {"Alamosa County": "Alamosa County", "Conejos County": "Conejos County", "Rio Grande County": "Rio Grande County"}, "81146": {"Alamosa County": "Alamosa County", "Costilla County": "Costilla County", "Huerfano County": "Huerfano County", "Saguache County": "Saguache County"}, "81147": {"Conejos County": "Conejos County", "Mineral County": "Mineral County", "Hinsdale County": "Hinsdale County", "La Plata County": "La Plata County", "San Juan County": "San Juan County", "Archuleta County": "Archuleta County", "Rio Grande County": "Rio Grande County"}, "81148": {"Conejos County": "Conejos County"}, "81149": {"Mineral County": "Mineral County", "Saguache County": "Saguache County"}, "81151": {"Alamosa County": "Alamosa County", "Conejos County": "Conejos County", "Costilla County": "Costilla County"}, "81152": {"Conejos County": "Conejos County", "Costilla County": "Costilla County", "Huerfano County": "Huerfano County", "Las Animas County": "Las Animas County"}, "81154": {"Conejos County": "Conejos County", "Mineral County": "Mineral County", "Archuleta County": "Archuleta County", "Rio Grande County": "Rio Grande County"}, "81155": {"Custer County": "Custer County", "Chaffee County": "Chaffee County", "Fremont County": "Fremont County", "Saguache County": "Saguache County"}, "81201": {"Park County": "Park County", "Chaffee County": "Chaffee County", "Fremont County": "Fremont County", "Gunnison County": "Gunnison County", "Saguache County": "Saguache County"}, "81210": {"Pitkin County": "Pitkin County", "Chaffee County": "Chaffee County", "Gunnison County": "Gunnison County"}, "81211": {"Lake County": "Lake County", "Park County": "Park County", "Pitkin County": "Pitkin County", "Chaffee County": "Chaffee County", "Gunnison County": "Gunnison County"}, "81212": {"Park County": "Park County", "Custer County": "Custer County", "Teller County": "Teller County", "Fremont County": "Fremont County"}, "81220": {"Ouray County": "Ouray County", "Gunnison County": "Gunnison County", "Hinsdale County": "Hinsdale County", "Montrose County": "Montrose County"}, "81221": {"Fremont County": "Fremont County"}, "81222": {"Fremont County": "Fremont County", "Saguache County": "Saguache County"}, "81223": {"Custer County": "Custer County", "Fremont County": "Fremont County", "Saguache County": "Saguache County"}, "81224": {"Pitkin County": "Pitkin County", "Gunnison County": "Gunnison County"}, "81225": {"Pitkin County": "Pitkin County", "Gunnison County": "Gunnison County"}, "81226": {"Custer County": "Custer County", "Fremont County": "Fremont County"}, "81227": {"Chaffee County": "Chaffee County"}, "81230": {"Delta County": "Delta County", "Mineral County": "Mineral County", "Gunnison County": "Gunnison County", "Hinsdale County": "Hinsdale County", "Montrose County": "Montrose County", "Saguache County": "Saguache County"}, "81231": {"Gunnison County": "Gunnison County"}, "81232": {"Custer County": "Custer County", "Fremont County": "Fremont County"}, "81233": {"Fremont County": "Fremont County", "Saguache County": "Saguache County"}, "81235": {"Ouray County": "Ouray County", "Mineral County": "Mineral County", "Gunnison County": "Gunnison County", "Hinsdale County": "Hinsdale County", "Saguache County": "Saguache County", "San Juan County": "San Juan County"}, "81236": {"Chaffee County": "Chaffee County", "Gunnison County": "Gunnison County"}, "81237": {"Gunnison County": "Gunnison County"}, "81239": {"Gunnison County": "Gunnison County", "Saguache County": "Saguache County"}, "81240": {"Pueblo County": "Pueblo County", "Teller County": "Teller County", "El Paso County": "El Paso County", "Fremont County": "Fremont County"}, "81241": {"Gunnison County": "Gunnison County"}, "81242": {"Chaffee County": "Chaffee County"}, "81243": {"Gunnison County": "Gunnison County", "Hinsdale County": "Hinsdale County", "Saguache County": "Saguache County"}, "81244": {"Fremont County": "Fremont County"}, "81248": {"Chaffee County": "Chaffee County", "Gunnison County": "Gunnison County", "Saguache County": "Saguache County"}, "81251": {"Lake County": "Lake County", "Pitkin County": "Pitkin County", "Chaffee County": "Chaffee County"}, "81252": {"Custer County": "Custer County", "Fremont County": "Fremont County", "Huerfano County": "Huerfano County", "Saguache County": "Saguache County"}, "81253": {"Custer County": "Custer County", "Pueblo County": "Pueblo County", "Fremont County": "Fremont County"}, "81301": {"Dolores County": "Dolores County", "La Plata County": "La Plata County", "San Juan County": "San Juan County", "Montezuma County": "Montezuma County", "San Miguel County": "San Miguel County"}, "81303": {"La Plata County": "La Plata County"}, "81320": {"Dolores County": "Dolores County", "Montezuma County": "Montezuma County", "San Miguel County": "San Miguel County"}, "81321": {"Montezuma County": "Montezuma County"}, "81323": {"Dolores County": "Dolores County", "La Plata County": "La Plata County", "San Juan County": "San Juan County", "Montezuma County": "Montezuma County", "San Miguel County": "San Miguel County"}, "81324": {"Dolores County": "Dolores County", "Montezuma County": "Montezuma County", "San Miguel County": "San Miguel County"}, "81325": {"Dolores County": "Dolores County", "Montrose County": "Montrose County", "Montezuma County": "Montezuma County", "San Miguel County": "San Miguel County"}, "81326": {"La Plata County": "La Plata County", "Montezuma County": "Montezuma County"}, "81327": {"Montezuma County": "Montezuma County"}, "81328": {"La Plata County": "La Plata County", "Montezuma County": "Montezuma County"}, "81330": {"Montezuma County": "Montezuma County"}, "81331": {"Dolores County": "Dolores County", "Montezuma County": "Montezuma County"}, "81332": {"Dolores County": "Dolores County", "La Plata County": "La Plata County", "San Juan County": "San Juan County", "Montezuma County": "Montezuma County", "San Miguel County": "San Miguel County"}, "81334": {"La Plata County": "La Plata County", "Montezuma County": "Montezuma County"}, "81335": {"Montezuma County": "Montezuma County"}, "81401": {"Delta County": "Delta County", "Ouray County": "Ouray County", "Gunnison County": "Gunnison County", "Montrose County": "Montrose County"}, "81403": {"Ouray County": "Ouray County", "Gunnison County": "Gunnison County", "Montrose County": "Montrose County", "San Miguel County": "San Miguel County"}, "81410": {"Delta County": "Delta County"}, "81411": {"Montrose County": "Montrose County", "San Miguel County": "San Miguel County"}, "81413": {"Mesa County": "Mesa County", "Delta County": "Delta County"}, "81415": {"Delta County": "Delta County", "Gunnison County": "Gunnison County", "Montrose County": "Montrose County"}, "81416": {"Mesa County": "Mesa County", "Delta County": "Delta County", "Montrose County": "Montrose County"}, "81418": {"Delta County": "Delta County"}, "81419": {"Mesa County": "Mesa County", "Delta County": "Delta County"}, "81422": {"Mesa County": "Mesa County", "Montrose County": "Montrose County", "San Miguel County": "San Miguel County"}, "81423": {"Dolores County": "Dolores County", "Montrose County": "Montrose County", "San Miguel County": "San Miguel County"}, "81424": {"Montrose County": "Montrose County"}, "81425": {"Mesa County": "Mesa County", "Delta County": "Delta County", "Montrose County": "Montrose County"}, "81426": {"Dolores County": "Dolores County", "San Juan County": "San Juan County", "San Miguel County": "San Miguel County"}, "81427": {"Ouray County": "Ouray County", "Hinsdale County": "Hinsdale County", "San Juan County": "San Juan County", "San Miguel County": "San Miguel County"}, "81428": {"Mesa County": "Mesa County", "Delta County": "Delta County", "Gunnison County": "Gunnison County"}, "81429": {"Montrose County": "Montrose County", "San Miguel County": "San Miguel County"}, "81430": {"Ouray County": "Ouray County", "Dolores County": "Dolores County", "Montrose County": "Montrose County", "San Miguel County": "San Miguel County"}, "81431": {"Montrose County": "Montrose County", "San Miguel County": "San Miguel County"}, "81432": {"Ouray County": "Ouray County", "Gunnison County": "Gunnison County", "Hinsdale County": "Hinsdale County", "Montrose County": "Montrose County", "San Miguel County": "San Miguel County"}, "81433": {"Ouray County": "Ouray County", "Hinsdale County": "Hinsdale County", "La Plata County": "La Plata County", "San Juan County": "San Juan County", "San Miguel County": "San Miguel County"}, "81434": {"Mesa County": "Mesa County", "Delta County": "Delta County", "Pitkin County": "Pitkin County", "Gunnison County": "Gunnison County"}, "81435": {"Ouray County": "Ouray County", "Dolores County": "Dolores County", "San Juan County": "San Juan County", "San Miguel County": "San Miguel County"}, "81501": {"Mesa County": "Mesa County"}, "81503": {"Mesa County": "Mesa County"}, "81504": {"Mesa County": "Mesa County"}, "81505": {"Mesa County": "Mesa County"}, "81506": {"Mesa County": "Mesa County"}, "81507": {"Mesa County": "Mesa County"}, "81520": {"Mesa County": "Mesa County"}, "81521": {"Mesa County": "Mesa County"}, "81522": {"Mesa County": "Mesa County", "Montrose County": "Montrose County"}, "81523": {"Mesa County": "Mesa County"}, "81524": {"Mesa County": "Mesa County", "Garfield County": "Garfield County"}, "81525": {"Mesa County": "Mesa County", "Garfield County": "Garfield County"}, "81526": {"Mesa County": "Mesa County"}, "81527": {"Mesa County": "Mesa County", "Delta County": "Delta County", "Montrose County": "Montrose County"}, "81601": {"Eagle County": "Eagle County", "Pitkin County": "Pitkin County", "Garfield County": "Garfield County"}, "81610": {"Moffat County": "Moffat County", "Rio Blanco County": "Rio Blanco County"}, "81611": {"Lake County": "Lake County", "Pitkin County": "Pitkin County", "Chaffee County": "Chaffee County", "Gunnison County": "Gunnison County"}, "81612": {"Pitkin County": "Pitkin County"}, "81615": {"Pitkin County": "Pitkin County"}, "81620": {"Eagle County": "Eagle County"}, "81621": {"Eagle County": "Eagle County", "Pitkin County": "Pitkin County", "Garfield County": "Garfield County"}, "81623": {"Mesa County": "Mesa County", "Eagle County": "Eagle County", "Pitkin County": "Pitkin County", "Garfield County": "Garfield County", "Gunnison County": "Gunnison County"}, "81624": {"Mesa County": "Mesa County", "Delta County": "Delta County", "Pitkin County": "Pitkin County", "Garfield County": "Garfield County", "Gunnison County": "Gunnison County"}, "81625": {"Routt County": "Routt County", "Moffat County": "Moffat County"}, "81630": {"Mesa County": "Mesa County", "Garfield County": "Garfield County", "Rio Blanco County": "Rio Blanco County"}, "81631": {"Eagle County": "Eagle County"}, "81632": {"Eagle County": "Eagle County"}, "81633": {"Moffat County": "Moffat County", "Rio Blanco County": "Rio Blanco County"}, "81635": {"Mesa County": "Mesa County", "Garfield County": "Garfield County", "Rio Blanco County": "Rio Blanco County"}, "81637": {"Eagle County": "Eagle County", "Routt County": "Routt County", "Garfield County": "Garfield County", "Rio Blanco County": "Rio Blanco County"}, "81638": {"Routt County": "Routt County", "Moffat County": "Moffat County", "Rio Blanco County": "Rio Blanco County"}, "81639": {"Routt County": "Routt County", "Moffat County": "Moffat County", "Rio Blanco County": "Rio Blanco County"}, "81640": {"Moffat County": "Moffat County", "Rio Blanco County": "Rio Blanco County"}, "81641": {"Routt County": "Routt County", "Moffat County": "Moffat County", "Garfield County": "Garfield County", "Rio Blanco County": "Rio Blanco County"}, "81642": {"Lake County": "Lake County", "Eagle County": "Eagle County", "Pitkin County": "Pitkin County"}, "81643": {"Mesa County": "Mesa County", "Delta County": "Delta County"}, "81645": {"Lake County": "Lake County", "Eagle County": "Eagle County", "Pitkin County": "Pitkin County", "Summit County": "Summit County"}, "81646": {"Mesa County": "Mesa County", "Delta County": "Delta County"}, "81647": {"Mesa County": "Mesa County", "Pitkin County": "Pitkin County", "Garfield County": "Garfield County", "Rio Blanco County": "Rio Blanco County"}, "81648": {"Moffat County": "Moffat County", "Garfield County": "Garfield County", "Rio Blanco County": "Rio Blanco County"}, "81649": {"Eagle County": "Eagle County", "Summit County": "Summit County"}, "81650": {"Mesa County": "Mesa County", "Garfield County": "Garfield County", "Rio Blanco County": "Rio Blanco County"}, "81652": {"Mesa County": "Mesa County", "Garfield County": "Garfield County"}, "81653": {"Routt County": "Routt County", "Moffat County": "Moffat County"}, "81654": {"Pitkin County": "Pitkin County", "Gunnison County": "Gunnison County"}, "81655": {"Eagle County": "Eagle County", "Summit County": "Summit County"}, "81656": {"Pitkin County": "Pitkin County"}, "81657": {"Eagle County": "Eagle County", "Summit County": "Summit County"}, "82063": {"Jackson County": "Jackson County", "Larimer County": "Larimer County"}} + co_zipcodes = { + "80001": "80001", + "80002": "80002", + "80003": "80003", + "80004": "80004", + "80005": "80005", + "80006": "80006", + "80007": "80007", + "80010": "80010", + "80011": "80011", + "80012": "80012", + "80013": "80013", + "80014": "80014", + "80015": "80015", + "80016": "80016", + "80017": "80017", + "80018": "80018", + "80019": "80019", + "80020": "80020", + "80021": "80021", + "80022": "80022", + "80023": "80023", + "80024": "80024", + "80025": "80025", + "80026": "80026", + "80027": "80027", + "80028": "80028", + "80030": "80030", + "80031": "80031", + "80033": "80033", + "80034": "80034", + "80035": "80035", + "80036": "80036", + "80037": "80037", + "80038": "80038", + "80040": "80040", + "80041": "80041", + "80042": "80042", + "80044": "80044", + "80045": "80045", + "80046": "80046", + "80047": "80047", + "80101": "80101", + "80102": "80102", + "80103": "80103", + "80104": "80104", + "80105": "80105", + "80106": "80106", + "80107": "80107", + "80108": "80108", + "80109": "80109", + "80110": "80110", + "80111": "80111", + "80112": "80112", + "80113": "80113", + "80116": "80116", + "80117": "80117", + "80118": "80118", + "80120": "80120", + "80121": "80121", + "80122": "80122", + "80123": "80123", + "80124": "80124", + "80125": "80125", + "80126": "80126", + "80127": "80127", + "80128": "80128", + "80129": "80129", + "80130": "80130", + "80131": "80131", + "80132": "80132", + "80133": "80133", + "80134": "80134", + "80135": "80135", + "80136": "80136", + "80137": "80137", + "80138": "80138", + "80150": "80150", + "80151": "80151", + "80155": "80155", + "80160": "80160", + "80161": "80161", + "80162": "80162", + "80163": "80163", + "80165": "80165", + "80166": "80166", + "80201": "80201", + "80202": "80202", + "80203": "80203", + "80204": "80204", + "80205": "80205", + "80206": "80206", + "80207": "80207", + "80208": "80208", + "80209": "80209", + "80210": "80210", + "80211": "80211", + "80212": "80212", + "80214": "80214", + "80215": "80215", + "80216": "80216", + "80217": "80217", + "80218": "80218", + "80219": "80219", + "80220": "80220", + "80221": "80221", + "80222": "80222", + "80223": "80223", + "80224": "80224", + "80225": "80225", + "80226": "80226", + "80227": "80227", + "80228": "80228", + "80229": "80229", + "80230": "80230", + "80231": "80231", + "80232": "80232", + "80233": "80233", + "80234": "80234", + "80235": "80235", + "80236": "80236", + "80237": "80237", + "80238": "80238", + "80239": "80239", + "80241": "80241", + "80243": "80243", + "80244": "80244", + "80246": "80246", + "80247": "80247", + "80248": "80248", + "80249": "80249", + "80250": "80250", + "80251": "80251", + "80252": "80252", + "80256": "80256", + "80257": "80257", + "80259": "80259", + "80260": "80260", + "80261": "80261", + "80262": "80262", + "80263": "80263", + "80264": "80264", + "80265": "80265", + "80266": "80266", + "80271": "80271", + "80273": "80273", + "80274": "80274", + "80279": "80279", + "80280": "80280", + "80281": "80281", + "80290": "80290", + "80291": "80291", + "80293": "80293", + "80294": "80294", + "80295": "80295", + "80299": "80299", + "80301": "80301", + "80302": "80302", + "80303": "80303", + "80304": "80304", + "80305": "80305", + "80306": "80306", + "80307": "80307", + "80308": "80308", + "80309": "80309", + "80310": "80310", + "80314": "80314", + "80321": "80321", + "80322": "80322", + "80323": "80323", + "80328": "80328", + "80329": "80329", + "80401": "80401", + "80402": "80402", + "80403": "80403", + "80419": "80419", + "80420": "80420", + "80421": "80421", + "80422": "80422", + "80423": "80423", + "80424": "80424", + "80425": "80425", + "80426": "80426", + "80427": "80427", + "80428": "80428", + "80429": "80429", + "80430": "80430", + "80432": "80432", + "80433": "80433", + "80434": "80434", + "80435": "80435", + "80436": "80436", + "80437": "80437", + "80438": "80438", + "80439": "80439", + "80440": "80440", + "80442": "80442", + "80443": "80443", + "80444": "80444", + "80446": "80446", + "80447": "80447", + "80448": "80448", + "80449": "80449", + "80451": "80451", + "80452": "80452", + "80453": "80453", + "80454": "80454", + "80455": "80455", + "80456": "80456", + "80457": "80457", + "80459": "80459", + "80461": "80461", + "80463": "80463", + "80465": "80465", + "80466": "80466", + "80467": "80467", + "80468": "80468", + "80469": "80469", + "80470": "80470", + "80471": "80471", + "80473": "80473", + "80474": "80474", + "80475": "80475", + "80476": "80476", + "80477": "80477", + "80478": "80478", + "80479": "80479", + "80480": "80480", + "80481": "80481", + "80482": "80482", + "80483": "80483", + "80487": "80487", + "80488": "80488", + "80497": "80497", + "80498": "80498", + "80501": "80501", + "80502": "80502", + "80503": "80503", + "80504": "80504", + "80510": "80510", + "80511": "80511", + "80512": "80512", + "80513": "80513", + "80514": "80514", + "80515": "80515", + "80516": "80516", + "80517": "80517", + "80520": "80520", + "80521": "80521", + "80522": "80522", + "80523": "80523", + "80524": "80524", + "80525": "80525", + "80526": "80526", + "80527": "80527", + "80528": "80528", + "80530": "80530", + "80532": "80532", + "80533": "80533", + "80534": "80534", + "80535": "80535", + "80536": "80536", + "80537": "80537", + "80538": "80538", + "80539": "80539", + "80540": "80540", + "80541": "80541", + "80542": "80542", + "80543": "80543", + "80544": "80544", + "80545": "80545", + "80546": "80546", + "80547": "80547", + "80549": "80549", + "80550": "80550", + "80551": "80551", + "80553": "80553", + "80601": "80601", + "80602": "80602", + "80603": "80603", + "80610": "80610", + "80611": "80611", + "80612": "80612", + "80614": "80614", + "80615": "80615", + "80620": "80620", + "80621": "80621", + "80622": "80622", + "80623": "80623", + "80624": "80624", + "80631": "80631", + "80632": "80632", + "80633": "80633", + "80634": "80634", + "80638": "80638", + "80639": "80639", + "80640": "80640", + "80642": "80642", + "80643": "80643", + "80644": "80644", + "80645": "80645", + "80646": "80646", + "80648": "80648", + "80649": "80649", + "80650": "80650", + "80651": "80651", + "80652": "80652", + "80653": "80653", + "80654": "80654", + "80701": "80701", + "80705": "80705", + "80720": "80720", + "80721": "80721", + "80722": "80722", + "80723": "80723", + "80726": "80726", + "80727": "80727", + "80728": "80728", + "80729": "80729", + "80731": "80731", + "80732": "80732", + "80733": "80733", + "80734": "80734", + "80735": "80735", + "80736": "80736", + "80737": "80737", + "80740": "80740", + "80741": "80741", + "80742": "80742", + "80743": "80743", + "80744": "80744", + "80745": "80745", + "80746": "80746", + "80747": "80747", + "80749": "80749", + "80750": "80750", + "80751": "80751", + "80754": "80754", + "80755": "80755", + "80757": "80757", + "80758": "80758", + "80759": "80759", + "80801": "80801", + "80802": "80802", + "80804": "80804", + "80805": "80805", + "80807": "80807", + "80808": "80808", + "80809": "80809", + "80810": "80810", + "80812": "80812", + "80813": "80813", + "80814": "80814", + "80815": "80815", + "80816": "80816", + "80817": "80817", + "80818": "80818", + "80819": "80819", + "80820": "80820", + "80821": "80821", + "80822": "80822", + "80823": "80823", + "80824": "80824", + "80825": "80825", + "80826": "80826", + "80827": "80827", + "80828": "80828", + "80829": "80829", + "80830": "80830", + "80831": "80831", + "80832": "80832", + "80833": "80833", + "80834": "80834", + "80835": "80835", + "80836": "80836", + "80840": "80840", + "80841": "80841", + "80860": "80860", + "80861": "80861", + "80862": "80862", + "80863": "80863", + "80864": "80864", + "80866": "80866", + "80901": "80901", + "80902": "80902", + "80903": "80903", + "80904": "80904", + "80905": "80905", + "80906": "80906", + "80907": "80907", + "80908": "80908", + "80909": "80909", + "80910": "80910", + "80911": "80911", + "80912": "80912", + "80913": "80913", + "80914": "80914", + "80915": "80915", + "80916": "80916", + "80917": "80917", + "80918": "80918", + "80919": "80919", + "80920": "80920", + "80921": "80921", + "80922": "80922", + "80923": "80923", + "80924": "80924", + "80925": "80925", + "80926": "80926", + "80927": "80927", + "80928": "80928", + "80929": "80929", + "80930": "80930", + "80931": "80931", + "80932": "80932", + "80933": "80933", + "80934": "80934", + "80935": "80935", + "80936": "80936", + "80937": "80937", + "80938": "80938", + "80939": "80939", + "80940": "80940", + "80941": "80941", + "80942": "80942", + "80943": "80943", + "80944": "80944", + "80945": "80945", + "80946": "80946", + "80947": "80947", + "80949": "80949", + "80950": "80950", + "80951": "80951", + "80960": "80960", + "80962": "80962", + "80970": "80970", + "80977": "80977", + "80995": "80995", + "80997": "80997", + "81001": "81001", + "81002": "81002", + "81003": "81003", + "81004": "81004", + "81005": "81005", + "81006": "81006", + "81007": "81007", + "81008": "81008", + "81009": "81009", + "81010": "81010", + "81011": "81011", + "81012": "81012", + "81019": "81019", + "81020": "81020", + "81021": "81021", + "81022": "81022", + "81023": "81023", + "81024": "81024", + "81025": "81025", + "81027": "81027", + "81029": "81029", + "81030": "81030", + "81033": "81033", + "81034": "81034", + "81036": "81036", + "81038": "81038", + "81039": "81039", + "81040": "81040", + "81041": "81041", + "81043": "81043", + "81044": "81044", + "81045": "81045", + "81046": "81046", + "81047": "81047", + "81049": "81049", + "81050": "81050", + "81052": "81052", + "81054": "81054", + "81055": "81055", + "81057": "81057", + "81058": "81058", + "81059": "81059", + "81062": "81062", + "81063": "81063", + "81064": "81064", + "81067": "81067", + "81069": "81069", + "81071": "81071", + "81073": "81073", + "81075": "81075", + "81076": "81076", + "81077": "81077", + "81081": "81081", + "81082": "81082", + "81084": "81084", + "81087": "81087", + "81089": "81089", + "81090": "81090", + "81091": "81091", + "81092": "81092", + "81101": "81101", + "81102": "81102", + "81120": "81120", + "81121": "81121", + "81122": "81122", + "81123": "81123", + "81124": "81124", + "81125": "81125", + "81126": "81126", + "81127": "81127", + "81128": "81128", + "81129": "81129", + "81130": "81130", + "81131": "81131", + "81132": "81132", + "81133": "81133", + "81134": "81134", + "81135": "81135", + "81136": "81136", + "81137": "81137", + "81138": "81138", + "81140": "81140", + "81141": "81141", + "81143": "81143", + "81144": "81144", + "81146": "81146", + "81147": "81147", + "81148": "81148", + "81149": "81149", + "81151": "81151", + "81152": "81152", + "81153": "81153", + "81154": "81154", + "81155": "81155", + "81157": "81157", + "81201": "81201", + "81210": "81210", + "81211": "81211", + "81212": "81212", + "81215": "81215", + "81220": "81220", + "81221": "81221", + "81222": "81222", + "81223": "81223", + "81224": "81224", + "81225": "81225", + "81226": "81226", + "81227": "81227", + "81228": "81228", + "81230": "81230", + "81231": "81231", + "81232": "81232", + "81233": "81233", + "81235": "81235", + "81236": "81236", + "81237": "81237", + "81239": "81239", + "81240": "81240", + "81241": "81241", + "81242": "81242", + "81243": "81243", + "81244": "81244", + "81247": "81247", + "81248": "81248", + "81251": "81251", + "81252": "81252", + "81253": "81253", + "81290": "81290", + "81301": "81301", + "81302": "81302", + "81303": "81303", + "81320": "81320", + "81321": "81321", + "81323": "81323", + "81324": "81324", + "81325": "81325", + "81326": "81326", + "81327": "81327", + "81328": "81328", + "81329": "81329", + "81330": "81330", + "81331": "81331", + "81332": "81332", + "81334": "81334", + "81335": "81335", + "81401": "81401", + "81402": "81402", + "81403": "81403", + "81410": "81410", + "81411": "81411", + "81413": "81413", + "81414": "81414", + "81415": "81415", + "81416": "81416", + "81418": "81418", + "81419": "81419", + "81420": "81420", + "81422": "81422", + "81423": "81423", + "81424": "81424", + "81425": "81425", + "81426": "81426", + "81427": "81427", + "81428": "81428", + "81429": "81429", + "81430": "81430", + "81431": "81431", + "81432": "81432", + "81433": "81433", + "81434": "81434", + "81435": "81435", + "81501": "81501", + "81502": "81502", + "81503": "81503", + "81504": "81504", + "81505": "81505", + "81506": "81506", + "81507": "81507", + "81520": "81520", + "81521": "81521", + "81522": "81522", + "81523": "81523", + "81524": "81524", + "81525": "81525", + "81526": "81526", + "81527": "81527", + "81601": "81601", + "81602": "81602", + "81610": "81610", + "81611": "81611", + "81612": "81612", + "81615": "81615", + "81620": "81620", + "81621": "81621", + "81623": "81623", + "81624": "81624", + "81625": "81625", + "81626": "81626", + "81630": "81630", + "81631": "81631", + "81632": "81632", + "81633": "81633", + "81635": "81635", + "81636": "81636", + "81637": "81637", + "81638": "81638", + "81639": "81639", + "81640": "81640", + "81641": "81641", + "81642": "81642", + "81643": "81643", + "81645": "81645", + "81646": "81646", + "81647": "81647", + "81648": "81648", + "81649": "81649", + "81650": "81650", + "81652": "81652", + "81653": "81653", + "81654": "81654", + "81655": "81655", + "81656": "81656", + "81657": "81657", + "81658": "81658", + } - category_benefits = {"cash": {"benefits": {"oap": {"_label": "cashAssistanceBenefits.oap", "_default_message": "State cash assistance for individuals 60 years of age or older (Old Age Pension/OAP)"}, "ssi": {"_label": "cashAssistanceBenefits.ssi", "_default_message": "Federal cash assistance for individuals who are disabled, blind, or 65 years of age or older (Supplemental Security Income/SSI)"}, "ssdi": {"_label": "cashAssistanceBenefits.ssdi", "_default_message": "Social security benefit for people with disabilities (Social Security Disability Insurance/SSDI)"}, "tanf": {"_label": "cashAssistanceBenefits.tanf", "_default_message": "Cash assistance and work support (Temporary Assistance for Needy Families (TANF/Colorado Works))"}, "andcs": {"_label": "cashAssistanceBenefits.andcs", "_default_message": "State cash assistance for individuals who are disabled and receiving SSI (Aid to the Needy Disabled - Colorado Supplement/AND-CS)"}}, "category_name": "Cash Assistance"}, "childCare": {"benefits": {"upk": {"_label": "childCareBenefits.univpresc", "_default_message": "Free preschool (Universal Preschool Colorado)"}, "pell": {"_label": "childCareBenefits.pell", "_default_message": "Federal grant to finance college costs (Pell Grant)"}, "cccap": {"_label": "childCareBenefits.cccap", "_default_message": "Help with child care costs (Colorado Child Care Assistance Program/CCCAP)"}, "mydenver": {"_label": "childCareBenefits.mydenver", "_default_message": "Reduced-cost youth programs (MY Denver Card)"}, "coheadstart": {"_label": "childCareBenefits.coheadstart", "_default_message": "Free early child care and preschool (Colorado Head Start)"}, "denverpresc": {"_label": "childCareBenefits.denverpresc", "_default_message": "Tuition credits for Denver preschoolers (Denver Preschool Program)"}}, "category_name": "Child Care, Youth, and Education"}, "healthCare": {"benefits": {"dentallowincseniors": {"_label": "healthCareBenefits.dentallowincseniors", "_default_message": "Low-cost dental care for people 60 years of age or older (Colorado Dental Health Program for Low-Income Seniors)"}}, "category_name": "Health Care"}, "taxCredits": {"benefits": {"ctc": {"_label": "taxCreditBenefits.ctc", "_default_message": "Federal tax credit: child tax credit (Child Tax Credit)"}, "eitc": {"_label": "taxCreditBenefits.eitc", "_default_message": "Federal tax credit: earned income (Earned Income Tax Credit)"}, "coctc": {"_label": "taxCreditBenefits.coctc", "_default_message": "State tax credit: Colorado child tax credit"}, "coeitc": {"_label": "taxCreditBenefits.coeitc", "_default_message": "State tax credit: earned income (Colorado Earned Income Tax Credit/Expanded Earned Income Tax Credit)"}}, "category_name": "Tax Credits"}, "transportation": {"benefits": {"rtdlive": {"_label": "transportationBenefits.rtdlive", "_default_message": "Discounted RTD fares (RTD LiVE)"}}, "category_name": "Transportation"}, "foodAndNutrition": {"benefits": {"ede": {"_label": "foodAndNutritionBenefits.ede", "_default_message": "Food support for people 60 years of age or older (Everyday Eats)"}, "wic": {"_label": "foodAndNutritionBenefits.wic", "_default_message": "Food and breastfeeding assistance (Special Supplemental Nutrition Program for Women, Infants, and Children/WIC)"}, "nslp": {"_label": "foodAndNutritionBenefits.nslp", "_default_message": "Free school meals (National School Lunch Program)"}, "snap": {"_label": "foodAndNutritionBenefits.snap", "_default_message": "Food assistance (Supplemental Nutrition Assistance Program/SNAP)"}}, "category_name": "Food and Nutrition"}, "housingAndUtilities": {"benefits": {"acp": {"_label": "housingAndUtilities.acp", "_default_message": "Home internet discount (Affordable Connectivity Program)"}, "ubp": {"_label": "housingAndUtilities.ubp", "_default_message": "Help paying utility bills (Colorado Utility Bill Help Program)"}, "leap": {"_label": "housingAndUtilities.leap", "_default_message": "Help with winter heating bills (Low-Income Energy Assistance Program/LEAP)"}, "cowap": {"_label": "housingAndUtilities.cowap", "_default_message": "Free home energy upgrades (Weatherization Assistance Program)"}, "lifeline": {"_label": "housingAndUtilities.lifeline", "_default_message": "Phone or internet discount (Lifeline Phone/Internet Service)"}, "coPropTaxRentHeatCreditRebate": {"_label": "cashAssistanceBenefits.coPropTaxRentHeatCreditRebate", "_default_message": "Cash to pay property tax, rent, and heat bills (Colorado Property Tax/Rent/Heat Credit Rebate)"}}, "category_name": "Housing and Utilities"}} + counties_by_zipcode = { + "80002": { + "Adams County": "Adams County", + "Denver County": "Denver County", + "Jefferson County": "Jefferson County", + }, + "80003": {"Adams County": "Adams County", "Jefferson County": "Jefferson County"}, + "80004": {"Jefferson County": "Jefferson County"}, + "80005": {"Jefferson County": "Jefferson County", "Broomfield County": "Broomfield County"}, + "80007": { + "Boulder County": "Boulder County", + "Jefferson County": "Jefferson County", + "Broomfield County": "Broomfield County", + }, + "80010": { + "Adams County": "Adams County", + "Denver County": "Denver County", + "Arapahoe County": "Arapahoe County", + }, + "80011": { + "Adams County": "Adams County", + "Denver County": "Denver County", + "Arapahoe County": "Arapahoe County", + }, + "80012": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, + "80013": {"Arapahoe County": "Arapahoe County"}, + "80014": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, + "80015": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, + "80016": { + "Denver County": "Denver County", + "Elbert County": "Elbert County", + "Douglas County": "Douglas County", + "Arapahoe County": "Arapahoe County", + }, + "80017": {"Arapahoe County": "Arapahoe County"}, + "80018": {"Adams County": "Adams County", "Arapahoe County": "Arapahoe County"}, + "80019": { + "Adams County": "Adams County", + "Denver County": "Denver County", + "Arapahoe County": "Arapahoe County", + }, + "80020": { + "Adams County": "Adams County", + "Boulder County": "Boulder County", + "Jefferson County": "Jefferson County", + "Broomfield County": "Broomfield County", + }, + "80021": { + "Boulder County": "Boulder County", + "Jefferson County": "Jefferson County", + "Broomfield County": "Broomfield County", + }, + "80022": {"Adams County": "Adams County", "Denver County": "Denver County"}, + "80023": { + "Weld County": "Weld County", + "Adams County": "Adams County", + "Boulder County": "Boulder County", + "Broomfield County": "Broomfield County", + }, + "80024": {"Adams County": "Adams County"}, + "80025": {"Boulder County": "Boulder County", "Jefferson County": "Jefferson County"}, + "80026": { + "Weld County": "Weld County", + "Boulder County": "Boulder County", + "Broomfield County": "Broomfield County", + }, + "80027": { + "Boulder County": "Boulder County", + "Jefferson County": "Jefferson County", + "Broomfield County": "Broomfield County", + }, + "80030": {"Adams County": "Adams County", "Jefferson County": "Jefferson County"}, + "80031": { + "Adams County": "Adams County", + "Jefferson County": "Jefferson County", + "Broomfield County": "Broomfield County", + }, + "80033": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, + "80045": { + "Adams County": "Adams County", + "Denver County": "Denver County", + "Arapahoe County": "Arapahoe County", + }, + "80101": {"Elbert County": "Elbert County", "Arapahoe County": "Arapahoe County"}, + "80102": { + "Weld County": "Weld County", + "Adams County": "Adams County", + "Elbert County": "Elbert County", + "Arapahoe County": "Arapahoe County", + }, + "80103": { + "Adams County": "Adams County", + "Elbert County": "Elbert County", + "Morgan County": "Morgan County", + "Arapahoe County": "Arapahoe County", + }, + "80104": {"Douglas County": "Douglas County"}, + "80105": { + "Adams County": "Adams County", + "Elbert County": "Elbert County", + "Lincoln County": "Lincoln County", + "Arapahoe County": "Arapahoe County", + "Washington County": "Washington County", + }, + "80106": { + "Elbert County": "Elbert County", + "Douglas County": "Douglas County", + "El Paso County": "El Paso County", + }, + "80107": { + "Elbert County": "Elbert County", + "Douglas County": "Douglas County", + "Arapahoe County": "Arapahoe County", + }, + "80108": {"Douglas County": "Douglas County"}, + "80109": {"Douglas County": "Douglas County"}, + "80110": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, + "80111": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, + "80112": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, + "80113": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, + "80116": {"Elbert County": "Elbert County", "Douglas County": "Douglas County"}, + "80117": {"Elbert County": "Elbert County"}, + "80118": { + "Elbert County": "Elbert County", + "Douglas County": "Douglas County", + "El Paso County": "El Paso County", + }, + "80120": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, + "80121": {"Arapahoe County": "Arapahoe County"}, + "80122": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, + "80123": { + "Denver County": "Denver County", + "Arapahoe County": "Arapahoe County", + "Jefferson County": "Jefferson County", + }, + "80124": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, + "80125": { + "Douglas County": "Douglas County", + "Arapahoe County": "Arapahoe County", + "Jefferson County": "Jefferson County", + }, + "80126": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, + "80127": { + "Denver County": "Denver County", + "Douglas County": "Douglas County", + "Jefferson County": "Jefferson County", + }, + "80128": { + "Douglas County": "Douglas County", + "Arapahoe County": "Arapahoe County", + "Jefferson County": "Jefferson County", + }, + "80129": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, + "80130": {"Douglas County": "Douglas County"}, + "80131": {"Douglas County": "Douglas County"}, + "80132": {"Douglas County": "Douglas County", "El Paso County": "El Paso County"}, + "80133": { + "Teller County": "Teller County", + "Douglas County": "Douglas County", + "El Paso County": "El Paso County", + }, + "80134": { + "Elbert County": "Elbert County", + "Douglas County": "Douglas County", + "Arapahoe County": "Arapahoe County", + }, + "80135": { + "Park County": "Park County", + "Teller County": "Teller County", + "Douglas County": "Douglas County", + "El Paso County": "El Paso County", + "Jefferson County": "Jefferson County", + }, + "80136": { + "Weld County": "Weld County", + "Adams County": "Adams County", + "Elbert County": "Elbert County", + "Arapahoe County": "Arapahoe County", + }, + "80137": { + "Adams County": "Adams County", + "Denver County": "Denver County", + "Arapahoe County": "Arapahoe County", + }, + "80138": { + "Elbert County": "Elbert County", + "Douglas County": "Douglas County", + "Arapahoe County": "Arapahoe County", + }, + "80202": {"Denver County": "Denver County"}, + "80203": {"Denver County": "Denver County"}, + "80204": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, + "80205": {"Denver County": "Denver County"}, + "80206": {"Denver County": "Denver County"}, + "80207": {"Denver County": "Denver County"}, + "80209": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, + "80210": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, + "80211": {"Denver County": "Denver County"}, + "80212": { + "Adams County": "Adams County", + "Denver County": "Denver County", + "Jefferson County": "Jefferson County", + }, + "80214": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, + "80215": {"Jefferson County": "Jefferson County"}, + "80216": {"Adams County": "Adams County", "Denver County": "Denver County"}, + "80218": {"Denver County": "Denver County"}, + "80219": { + "Denver County": "Denver County", + "Arapahoe County": "Arapahoe County", + "Jefferson County": "Jefferson County", + }, + "80220": { + "Adams County": "Adams County", + "Denver County": "Denver County", + "Arapahoe County": "Arapahoe County", + }, + "80221": {"Adams County": "Adams County", "Denver County": "Denver County"}, + "80222": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, + "80223": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, + "80224": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, + "80226": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, + "80227": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, + "80228": {"Jefferson County": "Jefferson County"}, + "80229": {"Adams County": "Adams County"}, + "80230": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, + "80231": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, + "80232": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, + "80233": {"Adams County": "Adams County"}, + "80234": {"Adams County": "Adams County", "Broomfield County": "Broomfield County"}, + "80235": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, + "80236": { + "Denver County": "Denver County", + "Arapahoe County": "Arapahoe County", + "Jefferson County": "Jefferson County", + }, + "80237": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, + "80238": {"Adams County": "Adams County", "Denver County": "Denver County"}, + "80239": {"Adams County": "Adams County", "Denver County": "Denver County"}, + "80241": {"Adams County": "Adams County"}, + "80246": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, + "80247": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, + "80249": {"Adams County": "Adams County", "Denver County": "Denver County"}, + "80260": {"Adams County": "Adams County"}, + "80264": {"Denver County": "Denver County"}, + "80290": {"Denver County": "Denver County"}, + "80293": {"Denver County": "Denver County"}, + "80294": {"Denver County": "Denver County"}, + "80301": {"Boulder County": "Boulder County"}, + "80302": {"Boulder County": "Boulder County"}, + "80303": {"Boulder County": "Boulder County", "Jefferson County": "Jefferson County"}, + "80304": {"Boulder County": "Boulder County"}, + "80305": {"Boulder County": "Boulder County"}, + "80310": {"Boulder County": "Boulder County"}, + "80401": {"Jefferson County": "Jefferson County"}, + "80403": { + "Gilpin County": "Gilpin County", + "Boulder County": "Boulder County", + "Jefferson County": "Jefferson County", + "Clear Creek County": "Clear Creek County", + }, + "80419": {"Jefferson County": "Jefferson County"}, + "80420": {"Lake County": "Lake County", "Park County": "Park County", "Summit County": "Summit County"}, + "80421": { + "Park County": "Park County", + "Jefferson County": "Jefferson County", + "Clear Creek County": "Clear Creek County", + }, + "80422": { + "Grand County": "Grand County", + "Gilpin County": "Gilpin County", + "Boulder County": "Boulder County", + "Jefferson County": "Jefferson County", + "Clear Creek County": "Clear Creek County", + }, + "80423": { + "Eagle County": "Eagle County", + "Grand County": "Grand County", + "Routt County": "Routt County", + "Summit County": "Summit County", + }, + "80424": {"Lake County": "Lake County", "Park County": "Park County", "Summit County": "Summit County"}, + "80425": {"Douglas County": "Douglas County", "Jefferson County": "Jefferson County"}, + "80426": {"Eagle County": "Eagle County", "Routt County": "Routt County", "Garfield County": "Garfield County"}, + "80427": { + "Gilpin County": "Gilpin County", + "Jefferson County": "Jefferson County", + "Clear Creek County": "Clear Creek County", + }, + "80428": {"Routt County": "Routt County", "Jackson County": "Jackson County"}, + "80432": {"Park County": "Park County"}, + "80433": { + "Park County": "Park County", + "Douglas County": "Douglas County", + "Jefferson County": "Jefferson County", + }, + "80434": {"Jackson County": "Jackson County"}, + "80435": { + "Park County": "Park County", + "Summit County": "Summit County", + "Clear Creek County": "Clear Creek County", + }, + "80436": {"Grand County": "Grand County", "Clear Creek County": "Clear Creek County"}, + "80438": {"Grand County": "Grand County", "Clear Creek County": "Clear Creek County"}, + "80439": { + "Park County": "Park County", + "Gilpin County": "Gilpin County", + "Jefferson County": "Jefferson County", + "Clear Creek County": "Clear Creek County", + }, + "80440": {"Lake County": "Lake County", "Park County": "Park County", "Summit County": "Summit County"}, + "80442": {"Grand County": "Grand County"}, + "80443": { + "Lake County": "Lake County", + "Park County": "Park County", + "Eagle County": "Eagle County", + "Summit County": "Summit County", + }, + "80444": { + "Park County": "Park County", + "Summit County": "Summit County", + "Clear Creek County": "Clear Creek County", + }, + "80446": { + "Grand County": "Grand County", + "Boulder County": "Boulder County", + "Jackson County": "Jackson County", + }, + "80447": { + "Grand County": "Grand County", + "Boulder County": "Boulder County", + "Jackson County": "Jackson County", + "Larimer County": "Larimer County", + }, + "80448": { + "Park County": "Park County", + "Summit County": "Summit County", + "Jefferson County": "Jefferson County", + "Clear Creek County": "Clear Creek County", + }, + "80449": { + "Lake County": "Lake County", + "Park County": "Park County", + "Chaffee County": "Chaffee County", + "Fremont County": "Fremont County", + }, + "80451": {"Grand County": "Grand County"}, + "80452": { + "Park County": "Park County", + "Grand County": "Grand County", + "Gilpin County": "Gilpin County", + "Clear Creek County": "Clear Creek County", + }, + "80453": {"Jefferson County": "Jefferson County"}, + "80454": {"Jefferson County": "Jefferson County"}, + "80455": {"Boulder County": "Boulder County"}, + "80456": { + "Park County": "Park County", + "Summit County": "Summit County", + "Jefferson County": "Jefferson County", + }, + "80457": {"Jefferson County": "Jefferson County"}, + "80459": { + "Eagle County": "Eagle County", + "Grand County": "Grand County", + "Routt County": "Routt County", + "Summit County": "Summit County", + "Jackson County": "Jackson County", + }, + "80461": { + "Lake County": "Lake County", + "Park County": "Park County", + "Eagle County": "Eagle County", + "Pitkin County": "Pitkin County", + "Summit County": "Summit County", + "Chaffee County": "Chaffee County", + }, + "80463": {"Eagle County": "Eagle County", "Grand County": "Grand County", "Routt County": "Routt County"}, + "80465": {"Jefferson County": "Jefferson County"}, + "80466": {"Grand County": "Grand County", "Gilpin County": "Gilpin County", "Boulder County": "Boulder County"}, + "80467": { + "Grand County": "Grand County", + "Routt County": "Routt County", + "Rio Blanco County": "Rio Blanco County", + }, + "80468": { + "Grand County": "Grand County", + "Summit County": "Summit County", + "Clear Creek County": "Clear Creek County", + }, + "80469": {"Routt County": "Routt County", "Rio Blanco County": "Rio Blanco County"}, + "80470": { + "Park County": "Park County", + "Jefferson County": "Jefferson County", + "Clear Creek County": "Clear Creek County", + }, + "80471": {"Gilpin County": "Gilpin County", "Boulder County": "Boulder County"}, + "80473": {"Grand County": "Grand County", "Jackson County": "Jackson County"}, + "80475": {"Park County": "Park County"}, + "80476": { + "Grand County": "Grand County", + "Summit County": "Summit County", + "Clear Creek County": "Clear Creek County", + }, + "80477": {"Routt County": "Routt County"}, + "80478": {"Grand County": "Grand County"}, + "80479": {"Eagle County": "Eagle County", "Routt County": "Routt County"}, + "80480": { + "Grand County": "Grand County", + "Routt County": "Routt County", + "Jackson County": "Jackson County", + "Larimer County": "Larimer County", + }, + "80481": {"Grand County": "Grand County", "Boulder County": "Boulder County"}, + "80482": { + "Grand County": "Grand County", + "Gilpin County": "Gilpin County", + "Boulder County": "Boulder County", + "Clear Creek County": "Clear Creek County", + }, + "80483": { + "Routt County": "Routt County", + "Garfield County": "Garfield County", + "Rio Blanco County": "Rio Blanco County", + }, + "80487": {"Grand County": "Grand County", "Routt County": "Routt County", "Jackson County": "Jackson County"}, + "80488": {"Routt County": "Routt County"}, + "80497": { + "Grand County": "Grand County", + "Summit County": "Summit County", + "Clear Creek County": "Clear Creek County", + }, + "80498": {"Eagle County": "Eagle County", "Grand County": "Grand County", "Summit County": "Summit County"}, + "80501": {"Weld County": "Weld County", "Boulder County": "Boulder County"}, + "80503": {"Boulder County": "Boulder County", "Larimer County": "Larimer County"}, + "80504": {"Weld County": "Weld County", "Boulder County": "Boulder County", "Larimer County": "Larimer County"}, + "80510": { + "Grand County": "Grand County", + "Boulder County": "Boulder County", + "Larimer County": "Larimer County", + }, + "80511": {"Larimer County": "Larimer County"}, + "80512": { + "Grand County": "Grand County", + "Jackson County": "Jackson County", + "Larimer County": "Larimer County", + }, + "80513": {"Weld County": "Weld County", "Boulder County": "Boulder County", "Larimer County": "Larimer County"}, + "80514": {"Weld County": "Weld County", "Broomfield County": "Broomfield County"}, + "80515": {"Larimer County": "Larimer County"}, + "80516": { + "Weld County": "Weld County", + "Adams County": "Adams County", + "Boulder County": "Boulder County", + "Broomfield County": "Broomfield County", + }, + "80517": { + "Grand County": "Grand County", + "Boulder County": "Boulder County", + "Larimer County": "Larimer County", + }, + "80520": {"Weld County": "Weld County"}, + "80521": {"Larimer County": "Larimer County"}, + "80524": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, + "80525": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, + "80526": {"Larimer County": "Larimer County"}, + "80528": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, + "80530": {"Weld County": "Weld County"}, + "80532": {"Larimer County": "Larimer County"}, + "80534": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, + "80535": {"Larimer County": "Larimer County"}, + "80536": {"Larimer County": "Larimer County"}, + "80537": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, + "80538": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, + "80540": {"Boulder County": "Boulder County", "Larimer County": "Larimer County"}, + "80542": {"Weld County": "Weld County"}, + "80543": {"Weld County": "Weld County"}, + "80544": {"Boulder County": "Boulder County"}, + "80545": {"Larimer County": "Larimer County"}, + "80546": {"Weld County": "Weld County"}, + "80547": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, + "80549": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, + "80550": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, + "80601": {"Weld County": "Weld County", "Adams County": "Adams County"}, + "80602": { + "Weld County": "Weld County", + "Adams County": "Adams County", + "Broomfield County": "Broomfield County", + }, + "80603": { + "Weld County": "Weld County", + "Adams County": "Adams County", + "Denver County": "Denver County", + "Broomfield County": "Broomfield County", + }, + "80610": {"Weld County": "Weld County"}, + "80611": {"Weld County": "Weld County", "Morgan County": "Morgan County"}, + "80612": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, + "80615": {"Weld County": "Weld County"}, + "80620": {"Weld County": "Weld County"}, + "80621": {"Weld County": "Weld County"}, + "80622": {"Weld County": "Weld County"}, + "80623": {"Weld County": "Weld County"}, + "80624": {"Weld County": "Weld County"}, + "80631": {"Weld County": "Weld County"}, + "80634": {"Weld County": "Weld County"}, + "80640": {"Adams County": "Adams County"}, + "80642": {"Weld County": "Weld County", "Adams County": "Adams County", "Denver County": "Denver County"}, + "80643": {"Weld County": "Weld County", "Adams County": "Adams County"}, + "80644": {"Weld County": "Weld County"}, + "80645": {"Weld County": "Weld County"}, + "80648": {"Weld County": "Weld County"}, + "80649": {"Weld County": "Weld County", "Morgan County": "Morgan County"}, + "80650": {"Weld County": "Weld County"}, + "80651": {"Weld County": "Weld County"}, + "80652": {"Weld County": "Weld County", "Adams County": "Adams County", "Morgan County": "Morgan County"}, + "80653": {"Morgan County": "Morgan County"}, + "80654": {"Weld County": "Weld County", "Adams County": "Adams County", "Morgan County": "Morgan County"}, + "80701": { + "Weld County": "Weld County", + "Adams County": "Adams County", + "Morgan County": "Morgan County", + "Washington County": "Washington County", + }, + "80705": {"Morgan County": "Morgan County"}, + "80720": { + "Yuma County": "Yuma County", + "Logan County": "Logan County", + "Morgan County": "Morgan County", + "Washington County": "Washington County", + }, + "80721": {"Phillips County": "Phillips County", "Sedgwick County": "Sedgwick County"}, + "80722": {"Logan County": "Logan County", "Washington County": "Washington County"}, + "80723": {"Morgan County": "Morgan County", "Washington County": "Washington County"}, + "80726": {"Logan County": "Logan County", "Sedgwick County": "Sedgwick County"}, + "80727": {"Yuma County": "Yuma County"}, + "80728": { + "Logan County": "Logan County", + "Sedgwick County": "Sedgwick County", + "Washington County": "Washington County", + }, + "80729": {"Weld County": "Weld County"}, + "80731": { + "Yuma County": "Yuma County", + "Logan County": "Logan County", + "Phillips County": "Phillips County", + "Sedgwick County": "Sedgwick County", + "Washington County": "Washington County", + }, + "80733": { + "Logan County": "Logan County", + "Morgan County": "Morgan County", + "Washington County": "Washington County", + }, + "80734": { + "Yuma County": "Yuma County", + "Phillips County": "Phillips County", + "Sedgwick County": "Sedgwick County", + }, + "80735": {"Yuma County": "Yuma County", "Kit Carson County": "Kit Carson County"}, + "80736": {"Logan County": "Logan County"}, + "80737": {"Phillips County": "Phillips County", "Sedgwick County": "Sedgwick County"}, + "80740": {"Lincoln County": "Lincoln County", "Washington County": "Washington County"}, + "80741": { + "Weld County": "Weld County", + "Logan County": "Logan County", + "Morgan County": "Morgan County", + "Washington County": "Washington County", + }, + "80742": {"Weld County": "Weld County", "Logan County": "Logan County", "Morgan County": "Morgan County"}, + "80743": { + "Yuma County": "Yuma County", + "Logan County": "Logan County", + "Washington County": "Washington County", + }, + "80744": {"Phillips County": "Phillips County", "Sedgwick County": "Sedgwick County"}, + "80745": {"Weld County": "Weld County", "Logan County": "Logan County"}, + "80746": {"Phillips County": "Phillips County"}, + "80747": {"Logan County": "Logan County"}, + "80749": { + "Logan County": "Logan County", + "Phillips County": "Phillips County", + "Sedgwick County": "Sedgwick County", + }, + "80750": { + "Weld County": "Weld County", + "Logan County": "Logan County", + "Morgan County": "Morgan County", + "Washington County": "Washington County", + }, + "80751": {"Logan County": "Logan County", "Washington County": "Washington County"}, + "80754": {"Weld County": "Weld County", "Logan County": "Logan County", "Morgan County": "Morgan County"}, + "80755": {"Yuma County": "Yuma County"}, + "80757": { + "Adams County": "Adams County", + "Morgan County": "Morgan County", + "Lincoln County": "Lincoln County", + "Arapahoe County": "Arapahoe County", + "Washington County": "Washington County", + }, + "80758": {"Yuma County": "Yuma County", "Phillips County": "Phillips County"}, + "80759": { + "Yuma County": "Yuma County", + "Logan County": "Logan County", + "Phillips County": "Phillips County", + "Washington County": "Washington County", + }, + "80801": {"Washington County": "Washington County"}, + "80802": { + "Kiowa County": "Kiowa County", + "Cheyenne County": "Cheyenne County", + "Kit Carson County": "Kit Carson County", + }, + "80804": { + "Lincoln County": "Lincoln County", + "Kit Carson County": "Kit Carson County", + "Washington County": "Washington County", + }, + "80805": { + "Yuma County": "Yuma County", + "Cheyenne County": "Cheyenne County", + "Kit Carson County": "Kit Carson County", + }, + "80807": { + "Yuma County": "Yuma County", + "Cheyenne County": "Cheyenne County", + "Kit Carson County": "Kit Carson County", + }, + "80808": {"Elbert County": "Elbert County", "El Paso County": "El Paso County"}, + "80809": {"Teller County": "Teller County", "El Paso County": "El Paso County"}, + "80810": { + "Kiowa County": "Kiowa County", + "Cheyenne County": "Cheyenne County", + "Kit Carson County": "Kit Carson County", + }, + "80812": { + "Yuma County": "Yuma County", + "Kit Carson County": "Kit Carson County", + "Washington County": "Washington County", + }, + "80813": { + "Teller County": "Teller County", + "El Paso County": "El Paso County", + "Fremont County": "Fremont County", + }, + "80814": {"Teller County": "Teller County"}, + "80815": { + "Lincoln County": "Lincoln County", + "Cheyenne County": "Cheyenne County", + "Kit Carson County": "Kit Carson County", + "Washington County": "Washington County", + }, + "80816": {"Park County": "Park County", "Teller County": "Teller County", "Fremont County": "Fremont County"}, + "80817": {"Pueblo County": "Pueblo County", "El Paso County": "El Paso County"}, + "80818": {"Lincoln County": "Lincoln County", "Washington County": "Washington County"}, + "80819": {"Teller County": "Teller County", "El Paso County": "El Paso County"}, + "80820": {"Park County": "Park County", "Teller County": "Teller County", "Fremont County": "Fremont County"}, + "80821": { + "Elbert County": "Elbert County", + "Lincoln County": "Lincoln County", + "Cheyenne County": "Cheyenne County", + "Kit Carson County": "Kit Carson County", + }, + "80822": { + "Yuma County": "Yuma County", + "Kit Carson County": "Kit Carson County", + "Washington County": "Washington County", + }, + "80823": { + "Kiowa County": "Kiowa County", + "Crowley County": "Crowley County", + "Lincoln County": "Lincoln County", + "Cheyenne County": "Cheyenne County", + }, + "80824": {"Yuma County": "Yuma County", "Kit Carson County": "Kit Carson County"}, + "80825": { + "Kiowa County": "Kiowa County", + "Lincoln County": "Lincoln County", + "Cheyenne County": "Cheyenne County", + "Kit Carson County": "Kit Carson County", + }, + "80827": { + "Park County": "Park County", + "Teller County": "Teller County", + "Douglas County": "Douglas County", + "Jefferson County": "Jefferson County", + }, + "80828": { + "Elbert County": "Elbert County", + "Lincoln County": "Lincoln County", + "Arapahoe County": "Arapahoe County", + "Washington County": "Washington County", + }, + "80829": {"Teller County": "Teller County", "El Paso County": "El Paso County"}, + "80830": { + "Elbert County": "Elbert County", + "El Paso County": "El Paso County", + "Lincoln County": "Lincoln County", + }, + "80831": {"Elbert County": "Elbert County", "El Paso County": "El Paso County"}, + "80832": { + "Elbert County": "Elbert County", + "El Paso County": "El Paso County", + "Lincoln County": "Lincoln County", + }, + "80833": { + "Elbert County": "Elbert County", + "Pueblo County": "Pueblo County", + "Crowley County": "Crowley County", + "El Paso County": "El Paso County", + "Lincoln County": "Lincoln County", + }, + "80834": { + "Cheyenne County": "Cheyenne County", + "Kit Carson County": "Kit Carson County", + "Washington County": "Washington County", + }, + "80835": {"Elbert County": "Elbert County", "El Paso County": "El Paso County"}, + "80836": { + "Yuma County": "Yuma County", + "Cheyenne County": "Cheyenne County", + "Kit Carson County": "Kit Carson County", + }, + "80840": {"El Paso County": "El Paso County"}, + "80860": { + "Teller County": "Teller County", + "El Paso County": "El Paso County", + "Fremont County": "Fremont County", + }, + "80861": { + "Yuma County": "Yuma County", + "Cheyenne County": "Cheyenne County", + "Kit Carson County": "Kit Carson County", + "Washington County": "Washington County", + }, + "80862": { + "Lincoln County": "Lincoln County", + "Cheyenne County": "Cheyenne County", + "Kit Carson County": "Kit Carson County", + }, + "80863": { + "Teller County": "Teller County", + "Douglas County": "Douglas County", + "El Paso County": "El Paso County", + }, + "80864": { + "Pueblo County": "Pueblo County", + "Crowley County": "Crowley County", + "El Paso County": "El Paso County", + "Lincoln County": "Lincoln County", + }, + "80902": {"El Paso County": "El Paso County"}, + "80903": {"El Paso County": "El Paso County"}, + "80904": {"El Paso County": "El Paso County"}, + "80905": {"El Paso County": "El Paso County"}, + "80906": {"Teller County": "Teller County", "El Paso County": "El Paso County"}, + "80907": {"El Paso County": "El Paso County"}, + "80908": { + "Elbert County": "Elbert County", + "Douglas County": "Douglas County", + "El Paso County": "El Paso County", + }, + "80909": {"El Paso County": "El Paso County"}, + "80910": {"El Paso County": "El Paso County"}, + "80911": {"El Paso County": "El Paso County"}, + "80913": {"El Paso County": "El Paso County"}, + "80914": {"El Paso County": "El Paso County"}, + "80915": {"El Paso County": "El Paso County"}, + "80916": {"El Paso County": "El Paso County"}, + "80917": {"El Paso County": "El Paso County"}, + "80918": {"El Paso County": "El Paso County"}, + "80919": {"El Paso County": "El Paso County"}, + "80920": {"El Paso County": "El Paso County"}, + "80921": {"Teller County": "Teller County", "El Paso County": "El Paso County"}, + "80922": {"El Paso County": "El Paso County"}, + "80923": {"El Paso County": "El Paso County"}, + "80924": {"El Paso County": "El Paso County"}, + "80925": {"El Paso County": "El Paso County"}, + "80926": { + "Teller County": "Teller County", + "El Paso County": "El Paso County", + "Fremont County": "Fremont County", + }, + "80927": {"El Paso County": "El Paso County"}, + "80928": {"Pueblo County": "Pueblo County", "El Paso County": "El Paso County"}, + "80929": {"El Paso County": "El Paso County"}, + "80930": {"El Paso County": "El Paso County"}, + "80938": {"El Paso County": "El Paso County"}, + "80939": {"El Paso County": "El Paso County"}, + "80951": {"El Paso County": "El Paso County"}, + "81001": {"Pueblo County": "Pueblo County"}, + "81003": {"Pueblo County": "Pueblo County"}, + "81004": {"Pueblo County": "Pueblo County"}, + "81005": { + "Custer County": "Custer County", + "Pueblo County": "Pueblo County", + "Fremont County": "Fremont County", + }, + "81006": {"Pueblo County": "Pueblo County"}, + "81007": {"Pueblo County": "Pueblo County", "Fremont County": "Fremont County"}, + "81008": {"Pueblo County": "Pueblo County", "El Paso County": "El Paso County"}, + "81019": {"Pueblo County": "Pueblo County"}, + "81020": { + "Pueblo County": "Pueblo County", + "Huerfano County": "Huerfano County", + "Las Animas County": "Las Animas County", + }, + "81021": { + "Bent County": "Bent County", + "Kiowa County": "Kiowa County", + "Otero County": "Otero County", + "Crowley County": "Crowley County", + "Lincoln County": "Lincoln County", + }, + "81022": {"Pueblo County": "Pueblo County", "Huerfano County": "Huerfano County"}, + "81023": {"Custer County": "Custer County", "Pueblo County": "Pueblo County"}, + "81024": {"Las Animas County": "Las Animas County"}, + "81025": { + "Pueblo County": "Pueblo County", + "Crowley County": "Crowley County", + "El Paso County": "El Paso County", + "Lincoln County": "Lincoln County", + }, + "81027": {"Las Animas County": "Las Animas County"}, + "81029": {"Baca County": "Baca County"}, + "81030": {"Otero County": "Otero County"}, + "81033": {"Crowley County": "Crowley County"}, + "81036": { + "Bent County": "Bent County", + "Kiowa County": "Kiowa County", + "Prowers County": "Prowers County", + "Cheyenne County": "Cheyenne County", + }, + "81038": {"Bent County": "Bent County"}, + "81039": { + "Otero County": "Otero County", + "Pueblo County": "Pueblo County", + "Crowley County": "Crowley County", + "Huerfano County": "Huerfano County", + "Las Animas County": "Las Animas County", + }, + "81040": { + "Custer County": "Custer County", + "Pueblo County": "Pueblo County", + "Alamosa County": "Alamosa County", + "Costilla County": "Costilla County", + "Huerfano County": "Huerfano County", + "Saguache County": "Saguache County", + }, + "81041": {"Baca County": "Baca County", "Prowers County": "Prowers County"}, + "81043": {"Prowers County": "Prowers County"}, + "81044": {"Baca County": "Baca County", "Bent County": "Bent County"}, + "81045": { + "Kiowa County": "Kiowa County", + "Lincoln County": "Lincoln County", + "Cheyenne County": "Cheyenne County", + }, + "81047": {"Baca County": "Baca County", "Kiowa County": "Kiowa County", "Prowers County": "Prowers County"}, + "81049": { + "Baca County": "Baca County", + "Bent County": "Bent County", + "Otero County": "Otero County", + "Las Animas County": "Las Animas County", + }, + "81050": { + "Bent County": "Bent County", + "Kiowa County": "Kiowa County", + "Otero County": "Otero County", + "Crowley County": "Crowley County", + "Las Animas County": "Las Animas County", + }, + "81052": { + "Baca County": "Baca County", + "Bent County": "Bent County", + "Kiowa County": "Kiowa County", + "Prowers County": "Prowers County", + }, + "81054": { + "Baca County": "Baca County", + "Bent County": "Bent County", + "Kiowa County": "Kiowa County", + "Otero County": "Otero County", + "Las Animas County": "Las Animas County", + }, + "81055": { + "Costilla County": "Costilla County", + "Huerfano County": "Huerfano County", + "Las Animas County": "Las Animas County", + }, + "81057": {"Bent County": "Bent County"}, + "81058": {"Otero County": "Otero County", "Crowley County": "Crowley County"}, + "81059": { + "Otero County": "Otero County", + "Pueblo County": "Pueblo County", + "Las Animas County": "Las Animas County", + }, + "81062": { + "Otero County": "Otero County", + "Pueblo County": "Pueblo County", + "Crowley County": "Crowley County", + "El Paso County": "El Paso County", + "Lincoln County": "Lincoln County", + }, + "81063": { + "Otero County": "Otero County", + "Crowley County": "Crowley County", + "Lincoln County": "Lincoln County", + }, + "81064": {"Baca County": "Baca County", "Las Animas County": "Las Animas County"}, + "81067": { + "Otero County": "Otero County", + "Pueblo County": "Pueblo County", + "Crowley County": "Crowley County", + "Las Animas County": "Las Animas County", + }, + "81069": { + "Custer County": "Custer County", + "Pueblo County": "Pueblo County", + "Huerfano County": "Huerfano County", + }, + "81071": { + "Kiowa County": "Kiowa County", + "Prowers County": "Prowers County", + "Cheyenne County": "Cheyenne County", + }, + "81073": { + "Baca County": "Baca County", + "Bent County": "Bent County", + "Prowers County": "Prowers County", + "Las Animas County": "Las Animas County", + }, + "81076": { + "Kiowa County": "Kiowa County", + "Otero County": "Otero County", + "Crowley County": "Crowley County", + "Lincoln County": "Lincoln County", + }, + "81077": {"Otero County": "Otero County"}, + "81081": {"Las Animas County": "Las Animas County"}, + "81082": {"Las Animas County": "Las Animas County"}, + "81084": {"Baca County": "Baca County", "Prowers County": "Prowers County"}, + "81087": {"Baca County": "Baca County"}, + "81089": { + "Pueblo County": "Pueblo County", + "Huerfano County": "Huerfano County", + "Las Animas County": "Las Animas County", + }, + "81090": {"Baca County": "Baca County", "Prowers County": "Prowers County"}, + "81091": { + "Costilla County": "Costilla County", + "Huerfano County": "Huerfano County", + "Las Animas County": "Las Animas County", + }, + "81092": {"Bent County": "Bent County", "Kiowa County": "Kiowa County", "Prowers County": "Prowers County"}, + "81101": { + "Alamosa County": "Alamosa County", + "Conejos County": "Conejos County", + "Costilla County": "Costilla County", + "Rio Grande County": "Rio Grande County", + }, + "81120": { + "Conejos County": "Conejos County", + "Costilla County": "Costilla County", + "Archuleta County": "Archuleta County", + "Rio Grande County": "Rio Grande County", + }, + "81121": {"La Plata County": "La Plata County", "Archuleta County": "Archuleta County"}, + "81122": { + "Hinsdale County": "Hinsdale County", + "La Plata County": "La Plata County", + "San Juan County": "San Juan County", + "Archuleta County": "Archuleta County", + }, + "81123": { + "Alamosa County": "Alamosa County", + "Conejos County": "Conejos County", + "Costilla County": "Costilla County", + "Huerfano County": "Huerfano County", + }, + "81124": {"Conejos County": "Conejos County"}, + "81125": { + "Alamosa County": "Alamosa County", + "Saguache County": "Saguache County", + "Rio Grande County": "Rio Grande County", + }, + "81126": {"Costilla County": "Costilla County"}, + "81128": {"Conejos County": "Conejos County", "Archuleta County": "Archuleta County"}, + "81129": {"Conejos County": "Conejos County"}, + "81130": { + "Mineral County": "Mineral County", + "Hinsdale County": "Hinsdale County", + "Saguache County": "Saguache County", + "San Juan County": "San Juan County", + "Archuleta County": "Archuleta County", + "Rio Grande County": "Rio Grande County", + }, + "81131": { + "Custer County": "Custer County", + "Alamosa County": "Alamosa County", + "Huerfano County": "Huerfano County", + "Saguache County": "Saguache County", + }, + "81132": { + "Conejos County": "Conejos County", + "Mineral County": "Mineral County", + "Saguache County": "Saguache County", + "Rio Grande County": "Rio Grande County", + }, + "81133": {"Costilla County": "Costilla County", "Huerfano County": "Huerfano County"}, + "81136": {"Alamosa County": "Alamosa County", "Saguache County": "Saguache County"}, + "81137": {"La Plata County": "La Plata County", "Archuleta County": "Archuleta County"}, + "81138": {"Costilla County": "Costilla County"}, + "81140": { + "Alamosa County": "Alamosa County", + "Conejos County": "Conejos County", + "Rio Grande County": "Rio Grande County", + }, + "81141": {"Conejos County": "Conejos County", "Costilla County": "Costilla County"}, + "81143": {"Custer County": "Custer County", "Saguache County": "Saguache County"}, + "81144": { + "Alamosa County": "Alamosa County", + "Conejos County": "Conejos County", + "Rio Grande County": "Rio Grande County", + }, + "81146": { + "Alamosa County": "Alamosa County", + "Costilla County": "Costilla County", + "Huerfano County": "Huerfano County", + "Saguache County": "Saguache County", + }, + "81147": { + "Conejos County": "Conejos County", + "Mineral County": "Mineral County", + "Hinsdale County": "Hinsdale County", + "La Plata County": "La Plata County", + "San Juan County": "San Juan County", + "Archuleta County": "Archuleta County", + "Rio Grande County": "Rio Grande County", + }, + "81148": {"Conejos County": "Conejos County"}, + "81149": {"Mineral County": "Mineral County", "Saguache County": "Saguache County"}, + "81151": { + "Alamosa County": "Alamosa County", + "Conejos County": "Conejos County", + "Costilla County": "Costilla County", + }, + "81152": { + "Conejos County": "Conejos County", + "Costilla County": "Costilla County", + "Huerfano County": "Huerfano County", + "Las Animas County": "Las Animas County", + }, + "81154": { + "Conejos County": "Conejos County", + "Mineral County": "Mineral County", + "Archuleta County": "Archuleta County", + "Rio Grande County": "Rio Grande County", + }, + "81155": { + "Custer County": "Custer County", + "Chaffee County": "Chaffee County", + "Fremont County": "Fremont County", + "Saguache County": "Saguache County", + }, + "81201": { + "Park County": "Park County", + "Chaffee County": "Chaffee County", + "Fremont County": "Fremont County", + "Gunnison County": "Gunnison County", + "Saguache County": "Saguache County", + }, + "81210": { + "Pitkin County": "Pitkin County", + "Chaffee County": "Chaffee County", + "Gunnison County": "Gunnison County", + }, + "81211": { + "Lake County": "Lake County", + "Park County": "Park County", + "Pitkin County": "Pitkin County", + "Chaffee County": "Chaffee County", + "Gunnison County": "Gunnison County", + }, + "81212": { + "Park County": "Park County", + "Custer County": "Custer County", + "Teller County": "Teller County", + "Fremont County": "Fremont County", + }, + "81220": { + "Ouray County": "Ouray County", + "Gunnison County": "Gunnison County", + "Hinsdale County": "Hinsdale County", + "Montrose County": "Montrose County", + }, + "81221": {"Fremont County": "Fremont County"}, + "81222": {"Fremont County": "Fremont County", "Saguache County": "Saguache County"}, + "81223": { + "Custer County": "Custer County", + "Fremont County": "Fremont County", + "Saguache County": "Saguache County", + }, + "81224": {"Pitkin County": "Pitkin County", "Gunnison County": "Gunnison County"}, + "81225": {"Pitkin County": "Pitkin County", "Gunnison County": "Gunnison County"}, + "81226": {"Custer County": "Custer County", "Fremont County": "Fremont County"}, + "81227": {"Chaffee County": "Chaffee County"}, + "81230": { + "Delta County": "Delta County", + "Mineral County": "Mineral County", + "Gunnison County": "Gunnison County", + "Hinsdale County": "Hinsdale County", + "Montrose County": "Montrose County", + "Saguache County": "Saguache County", + }, + "81231": {"Gunnison County": "Gunnison County"}, + "81232": {"Custer County": "Custer County", "Fremont County": "Fremont County"}, + "81233": {"Fremont County": "Fremont County", "Saguache County": "Saguache County"}, + "81235": { + "Ouray County": "Ouray County", + "Mineral County": "Mineral County", + "Gunnison County": "Gunnison County", + "Hinsdale County": "Hinsdale County", + "Saguache County": "Saguache County", + "San Juan County": "San Juan County", + }, + "81236": {"Chaffee County": "Chaffee County", "Gunnison County": "Gunnison County"}, + "81237": {"Gunnison County": "Gunnison County"}, + "81239": {"Gunnison County": "Gunnison County", "Saguache County": "Saguache County"}, + "81240": { + "Pueblo County": "Pueblo County", + "Teller County": "Teller County", + "El Paso County": "El Paso County", + "Fremont County": "Fremont County", + }, + "81241": {"Gunnison County": "Gunnison County"}, + "81242": {"Chaffee County": "Chaffee County"}, + "81243": { + "Gunnison County": "Gunnison County", + "Hinsdale County": "Hinsdale County", + "Saguache County": "Saguache County", + }, + "81244": {"Fremont County": "Fremont County"}, + "81248": { + "Chaffee County": "Chaffee County", + "Gunnison County": "Gunnison County", + "Saguache County": "Saguache County", + }, + "81251": {"Lake County": "Lake County", "Pitkin County": "Pitkin County", "Chaffee County": "Chaffee County"}, + "81252": { + "Custer County": "Custer County", + "Fremont County": "Fremont County", + "Huerfano County": "Huerfano County", + "Saguache County": "Saguache County", + }, + "81253": { + "Custer County": "Custer County", + "Pueblo County": "Pueblo County", + "Fremont County": "Fremont County", + }, + "81301": { + "Dolores County": "Dolores County", + "La Plata County": "La Plata County", + "San Juan County": "San Juan County", + "Montezuma County": "Montezuma County", + "San Miguel County": "San Miguel County", + }, + "81303": {"La Plata County": "La Plata County"}, + "81320": { + "Dolores County": "Dolores County", + "Montezuma County": "Montezuma County", + "San Miguel County": "San Miguel County", + }, + "81321": {"Montezuma County": "Montezuma County"}, + "81323": { + "Dolores County": "Dolores County", + "La Plata County": "La Plata County", + "San Juan County": "San Juan County", + "Montezuma County": "Montezuma County", + "San Miguel County": "San Miguel County", + }, + "81324": { + "Dolores County": "Dolores County", + "Montezuma County": "Montezuma County", + "San Miguel County": "San Miguel County", + }, + "81325": { + "Dolores County": "Dolores County", + "Montrose County": "Montrose County", + "Montezuma County": "Montezuma County", + "San Miguel County": "San Miguel County", + }, + "81326": {"La Plata County": "La Plata County", "Montezuma County": "Montezuma County"}, + "81327": {"Montezuma County": "Montezuma County"}, + "81328": {"La Plata County": "La Plata County", "Montezuma County": "Montezuma County"}, + "81330": {"Montezuma County": "Montezuma County"}, + "81331": {"Dolores County": "Dolores County", "Montezuma County": "Montezuma County"}, + "81332": { + "Dolores County": "Dolores County", + "La Plata County": "La Plata County", + "San Juan County": "San Juan County", + "Montezuma County": "Montezuma County", + "San Miguel County": "San Miguel County", + }, + "81334": {"La Plata County": "La Plata County", "Montezuma County": "Montezuma County"}, + "81335": {"Montezuma County": "Montezuma County"}, + "81401": { + "Delta County": "Delta County", + "Ouray County": "Ouray County", + "Gunnison County": "Gunnison County", + "Montrose County": "Montrose County", + }, + "81403": { + "Ouray County": "Ouray County", + "Gunnison County": "Gunnison County", + "Montrose County": "Montrose County", + "San Miguel County": "San Miguel County", + }, + "81410": {"Delta County": "Delta County"}, + "81411": {"Montrose County": "Montrose County", "San Miguel County": "San Miguel County"}, + "81413": {"Mesa County": "Mesa County", "Delta County": "Delta County"}, + "81415": { + "Delta County": "Delta County", + "Gunnison County": "Gunnison County", + "Montrose County": "Montrose County", + }, + "81416": {"Mesa County": "Mesa County", "Delta County": "Delta County", "Montrose County": "Montrose County"}, + "81418": {"Delta County": "Delta County"}, + "81419": {"Mesa County": "Mesa County", "Delta County": "Delta County"}, + "81422": { + "Mesa County": "Mesa County", + "Montrose County": "Montrose County", + "San Miguel County": "San Miguel County", + }, + "81423": { + "Dolores County": "Dolores County", + "Montrose County": "Montrose County", + "San Miguel County": "San Miguel County", + }, + "81424": {"Montrose County": "Montrose County"}, + "81425": {"Mesa County": "Mesa County", "Delta County": "Delta County", "Montrose County": "Montrose County"}, + "81426": { + "Dolores County": "Dolores County", + "San Juan County": "San Juan County", + "San Miguel County": "San Miguel County", + }, + "81427": { + "Ouray County": "Ouray County", + "Hinsdale County": "Hinsdale County", + "San Juan County": "San Juan County", + "San Miguel County": "San Miguel County", + }, + "81428": {"Mesa County": "Mesa County", "Delta County": "Delta County", "Gunnison County": "Gunnison County"}, + "81429": {"Montrose County": "Montrose County", "San Miguel County": "San Miguel County"}, + "81430": { + "Ouray County": "Ouray County", + "Dolores County": "Dolores County", + "Montrose County": "Montrose County", + "San Miguel County": "San Miguel County", + }, + "81431": {"Montrose County": "Montrose County", "San Miguel County": "San Miguel County"}, + "81432": { + "Ouray County": "Ouray County", + "Gunnison County": "Gunnison County", + "Hinsdale County": "Hinsdale County", + "Montrose County": "Montrose County", + "San Miguel County": "San Miguel County", + }, + "81433": { + "Ouray County": "Ouray County", + "Hinsdale County": "Hinsdale County", + "La Plata County": "La Plata County", + "San Juan County": "San Juan County", + "San Miguel County": "San Miguel County", + }, + "81434": { + "Mesa County": "Mesa County", + "Delta County": "Delta County", + "Pitkin County": "Pitkin County", + "Gunnison County": "Gunnison County", + }, + "81435": { + "Ouray County": "Ouray County", + "Dolores County": "Dolores County", + "San Juan County": "San Juan County", + "San Miguel County": "San Miguel County", + }, + "81501": {"Mesa County": "Mesa County"}, + "81503": {"Mesa County": "Mesa County"}, + "81504": {"Mesa County": "Mesa County"}, + "81505": {"Mesa County": "Mesa County"}, + "81506": {"Mesa County": "Mesa County"}, + "81507": {"Mesa County": "Mesa County"}, + "81520": {"Mesa County": "Mesa County"}, + "81521": {"Mesa County": "Mesa County"}, + "81522": {"Mesa County": "Mesa County", "Montrose County": "Montrose County"}, + "81523": {"Mesa County": "Mesa County"}, + "81524": {"Mesa County": "Mesa County", "Garfield County": "Garfield County"}, + "81525": {"Mesa County": "Mesa County", "Garfield County": "Garfield County"}, + "81526": {"Mesa County": "Mesa County"}, + "81527": {"Mesa County": "Mesa County", "Delta County": "Delta County", "Montrose County": "Montrose County"}, + "81601": { + "Eagle County": "Eagle County", + "Pitkin County": "Pitkin County", + "Garfield County": "Garfield County", + }, + "81610": {"Moffat County": "Moffat County", "Rio Blanco County": "Rio Blanco County"}, + "81611": { + "Lake County": "Lake County", + "Pitkin County": "Pitkin County", + "Chaffee County": "Chaffee County", + "Gunnison County": "Gunnison County", + }, + "81612": {"Pitkin County": "Pitkin County"}, + "81615": {"Pitkin County": "Pitkin County"}, + "81620": {"Eagle County": "Eagle County"}, + "81621": { + "Eagle County": "Eagle County", + "Pitkin County": "Pitkin County", + "Garfield County": "Garfield County", + }, + "81623": { + "Mesa County": "Mesa County", + "Eagle County": "Eagle County", + "Pitkin County": "Pitkin County", + "Garfield County": "Garfield County", + "Gunnison County": "Gunnison County", + }, + "81624": { + "Mesa County": "Mesa County", + "Delta County": "Delta County", + "Pitkin County": "Pitkin County", + "Garfield County": "Garfield County", + "Gunnison County": "Gunnison County", + }, + "81625": {"Routt County": "Routt County", "Moffat County": "Moffat County"}, + "81630": { + "Mesa County": "Mesa County", + "Garfield County": "Garfield County", + "Rio Blanco County": "Rio Blanco County", + }, + "81631": {"Eagle County": "Eagle County"}, + "81632": {"Eagle County": "Eagle County"}, + "81633": {"Moffat County": "Moffat County", "Rio Blanco County": "Rio Blanco County"}, + "81635": { + "Mesa County": "Mesa County", + "Garfield County": "Garfield County", + "Rio Blanco County": "Rio Blanco County", + }, + "81637": { + "Eagle County": "Eagle County", + "Routt County": "Routt County", + "Garfield County": "Garfield County", + "Rio Blanco County": "Rio Blanco County", + }, + "81638": { + "Routt County": "Routt County", + "Moffat County": "Moffat County", + "Rio Blanco County": "Rio Blanco County", + }, + "81639": { + "Routt County": "Routt County", + "Moffat County": "Moffat County", + "Rio Blanco County": "Rio Blanco County", + }, + "81640": {"Moffat County": "Moffat County", "Rio Blanco County": "Rio Blanco County"}, + "81641": { + "Routt County": "Routt County", + "Moffat County": "Moffat County", + "Garfield County": "Garfield County", + "Rio Blanco County": "Rio Blanco County", + }, + "81642": {"Lake County": "Lake County", "Eagle County": "Eagle County", "Pitkin County": "Pitkin County"}, + "81643": {"Mesa County": "Mesa County", "Delta County": "Delta County"}, + "81645": { + "Lake County": "Lake County", + "Eagle County": "Eagle County", + "Pitkin County": "Pitkin County", + "Summit County": "Summit County", + }, + "81646": {"Mesa County": "Mesa County", "Delta County": "Delta County"}, + "81647": { + "Mesa County": "Mesa County", + "Pitkin County": "Pitkin County", + "Garfield County": "Garfield County", + "Rio Blanco County": "Rio Blanco County", + }, + "81648": { + "Moffat County": "Moffat County", + "Garfield County": "Garfield County", + "Rio Blanco County": "Rio Blanco County", + }, + "81649": {"Eagle County": "Eagle County", "Summit County": "Summit County"}, + "81650": { + "Mesa County": "Mesa County", + "Garfield County": "Garfield County", + "Rio Blanco County": "Rio Blanco County", + }, + "81652": {"Mesa County": "Mesa County", "Garfield County": "Garfield County"}, + "81653": {"Routt County": "Routt County", "Moffat County": "Moffat County"}, + "81654": {"Pitkin County": "Pitkin County", "Gunnison County": "Gunnison County"}, + "81655": {"Eagle County": "Eagle County", "Summit County": "Summit County"}, + "81656": {"Pitkin County": "Pitkin County"}, + "81657": {"Eagle County": "Eagle County", "Summit County": "Summit County"}, + "82063": {"Jackson County": "Jackson County", "Larimer County": "Larimer County"}, + } + + category_benefits = { + "cash": { + "benefits": { + "oap": { + "_label": "cashAssistanceBenefits.oap", + "_default_message": "State cash assistance for individuals 60 years of age or older (Old Age Pension/OAP)", + }, + "ssi": { + "_label": "cashAssistanceBenefits.ssi", + "_default_message": "Federal cash assistance for individuals who are disabled, blind, or 65 years of age or older (Supplemental Security Income/SSI)", + }, + "ssdi": { + "_label": "cashAssistanceBenefits.ssdi", + "_default_message": "Social security benefit for people with disabilities (Social Security Disability Insurance/SSDI)", + }, + "tanf": { + "_label": "cashAssistanceBenefits.tanf", + "_default_message": "Cash assistance and work support (Temporary Assistance for Needy Families (TANF/Colorado Works))", + }, + "andcs": { + "_label": "cashAssistanceBenefits.andcs", + "_default_message": "State cash assistance for individuals who are disabled and receiving SSI (Aid to the Needy Disabled - Colorado Supplement/AND-CS)", + }, + }, + "category_name": "Cash Assistance", + }, + "childCare": { + "benefits": { + "upk": { + "_label": "childCareBenefits.univpresc", + "_default_message": "Free preschool (Universal Preschool Colorado)", + }, + "pell": { + "_label": "childCareBenefits.pell", + "_default_message": "Federal grant to finance college costs (Pell Grant)", + }, + "cccap": { + "_label": "childCareBenefits.cccap", + "_default_message": "Help with child care costs (Colorado Child Care Assistance Program/CCCAP)", + }, + "mydenver": { + "_label": "childCareBenefits.mydenver", + "_default_message": "Reduced-cost youth programs (MY Denver Card)", + }, + "coheadstart": { + "_label": "childCareBenefits.coheadstart", + "_default_message": "Free early child care and preschool (Colorado Head Start)", + }, + "denverpresc": { + "_label": "childCareBenefits.denverpresc", + "_default_message": "Tuition credits for Denver preschoolers (Denver Preschool Program)", + }, + }, + "category_name": "Child Care, Youth, and Education", + }, + "healthCare": { + "benefits": { + "dentallowincseniors": { + "_label": "healthCareBenefits.dentallowincseniors", + "_default_message": "Low-cost dental care for people 60 years of age or older (Colorado Dental Health Program for Low-Income Seniors)", + } + }, + "category_name": "Health Care", + }, + "taxCredits": { + "benefits": { + "ctc": { + "_label": "taxCreditBenefits.ctc", + "_default_message": "Federal tax credit: child tax credit (Child Tax Credit)", + }, + "eitc": { + "_label": "taxCreditBenefits.eitc", + "_default_message": "Federal tax credit: earned income (Earned Income Tax Credit)", + }, + "coctc": { + "_label": "taxCreditBenefits.coctc", + "_default_message": "State tax credit: Colorado child tax credit", + }, + "coeitc": { + "_label": "taxCreditBenefits.coeitc", + "_default_message": "State tax credit: earned income (Colorado Earned Income Tax Credit/Expanded Earned Income Tax Credit)", + }, + }, + "category_name": "Tax Credits", + }, + "transportation": { + "benefits": { + "rtdlive": { + "_label": "transportationBenefits.rtdlive", + "_default_message": "Discounted RTD fares (RTD LiVE)", + } + }, + "category_name": "Transportation", + }, + "foodAndNutrition": { + "benefits": { + "ede": { + "_label": "foodAndNutritionBenefits.ede", + "_default_message": "Food support for people 60 years of age or older (Everyday Eats)", + }, + "wic": { + "_label": "foodAndNutritionBenefits.wic", + "_default_message": "Food and breastfeeding assistance (Special Supplemental Nutrition Program for Women, Infants, and Children/WIC)", + }, + "nslp": { + "_label": "foodAndNutritionBenefits.nslp", + "_default_message": "Free school meals (National School Lunch Program)", + }, + "snap": { + "_label": "foodAndNutritionBenefits.snap", + "_default_message": "Food assistance (Supplemental Nutrition Assistance Program/SNAP)", + }, + }, + "category_name": "Food and Nutrition", + }, + "housingAndUtilities": { + "benefits": { + "acp": { + "_label": "housingAndUtilities.acp", + "_default_message": "Home internet discount (Affordable Connectivity Program)", + }, + "ubp": { + "_label": "housingAndUtilities.ubp", + "_default_message": "Help paying utility bills (Colorado Utility Bill Help Program)", + }, + "leap": { + "_label": "housingAndUtilities.leap", + "_default_message": "Help with winter heating bills (Low-Income Energy Assistance Program/LEAP)", + }, + "cowap": { + "_label": "housingAndUtilities.cowap", + "_default_message": "Free home energy upgrades (Weatherization Assistance Program)", + }, + "lifeline": { + "_label": "housingAndUtilities.lifeline", + "_default_message": "Phone or internet discount (Lifeline Phone/Internet Service)", + }, + "coPropTaxRentHeatCreditRebate": { + "_label": "cashAssistanceBenefits.coPropTaxRentHeatCreditRebate", + "_default_message": "Cash to pay property tax, rent, and heat bills (Colorado Property Tax/Rent/Heat Credit Rebate)", + }, + }, + "category_name": "Housing and Utilities", + }, + } def handle(self, *args, **options): # Save acute_condition_options to database @@ -78,4 +2625,4 @@ def handle(self, *args, **options): Configuration.objects.create(name="counties_by_zipcode", data=self.counties_by_zipcode, active=True) # Save category_benefits to database - Configuration.objects.create(name="category_benefits", data=self.category_benefits, active=True) \ No newline at end of file + Configuration.objects.create(name="category_benefits", data=self.category_benefits, active=True) diff --git a/configuration/models.py b/configuration/models.py index 381fc791..9a78753f 100644 --- a/configuration/models.py +++ b/configuration/models.py @@ -1,9 +1,10 @@ from django.db import models + class Configuration(models.Model): name = models.CharField(max_length=320) data = models.JSONField(default=dict) active = models.BooleanField() - + def __str__(self): - return self.name \ No newline at end of file + return self.name diff --git a/configuration/serializers.py b/configuration/serializers.py index 8e767be6..6fedd161 100644 --- a/configuration/serializers.py +++ b/configuration/serializers.py @@ -1,9 +1,10 @@ from configuration.models import Configuration from rest_framework import serializers + class ConfigurationSerializer(serializers.ModelSerializer): id = serializers.ReadOnlyField() class Meta: model = Configuration - fields = '__all__' \ No newline at end of file + fields = "__all__" diff --git a/configuration/urls.py b/configuration/urls.py index 0e786d1a..b97f2c6a 100644 --- a/configuration/urls.py +++ b/configuration/urls.py @@ -3,8 +3,8 @@ from . import views router = routers.DefaultRouter() -router.register(r'configuration', views.ConfigurationView) +router.register(r"configuration", views.ConfigurationView) urlpatterns = [ - path('', include(router.urls)), + path("", include(router.urls)), ] diff --git a/configuration/views.py b/configuration/views.py index fcbed50e..9da1b1aa 100644 --- a/configuration/views.py +++ b/configuration/views.py @@ -10,13 +10,13 @@ class ConfigurationView(viewsets.ReadOnlyModelViewSet): """ API endpoint that allows configurations to be viewed. """ + queryset = Configuration.objects.filter(active=True) serializer_class = ConfigurationSerializer permission_classes = [permissions.DjangoModelPermissions] - def retrieve(self, request, pk=None): configuration = get_object_or_404(self.queryset, name=pk) serializer = ConfigurationSerializer(configuration) - return Response(serializer.data) \ No newline at end of file + return Response(serializer.data) diff --git a/integrations/apps.py b/integrations/apps.py index bb57e755..f50c67a6 100644 --- a/integrations/apps.py +++ b/integrations/apps.py @@ -2,4 +2,4 @@ class IntegrationsConfig(AppConfig): - name = 'integrations' + name = "integrations" diff --git a/integrations/management/commands/hubspotsync.py b/integrations/management/commands/hubspotsync.py index 0b408c44..7fb95061 100644 --- a/integrations/management/commands/hubspotsync.py +++ b/integrations/management/commands/hubspotsync.py @@ -8,26 +8,26 @@ class Command(BaseCommand): - help = 'Syncs new users to Hubspot and clears PII from local records' + help = "Syncs new users to Hubspot and clears PII from local records" def add_arguments(self, parser): - parser.add_argument('limit', nargs='?', default='1', type=int) + parser.add_argument("limit", nargs="?", default="1", type=int) def handle(self, *args, **options): - limit = options['limit'] + limit = options["limit"] status = self.sync_mfb_hubspot_users(limit) - if len(status['completed']) > 0: - self.stdout.write( - self.style.SUCCESS('Successfully synced %s users.' % len(status['completed']))) - for message in status['completed']: + if len(status["completed"]) > 0: + self.stdout.write(self.style.SUCCESS("Successfully synced %s users." % len(status["completed"]))) + for message in status["completed"]: self.stdout.write( - self.style.SUCCESS('Successfully synced user %s with contact %s.' % (message[0], message[1]))) - if len(status['failed']) > 0: - self.stdout.write( - self.style.WARNING('Failed to sync %s users.' % len(status['failed']))) - for message in status['failed']: + self.style.SUCCESS("Successfully synced user %s with contact %s." % (message[0], message[1])) + ) + if len(status["failed"]) > 0: + self.stdout.write(self.style.WARNING("Failed to sync %s users." % len(status["failed"]))) + for message in status["failed"]: self.stdout.write( - self.style.SUCCESS('Successfully synced user %s with contact %s.' % (message[0], message[1]))) + self.style.SUCCESS("Successfully synced user %s with contact %s." % (message[0], message[1])) + ) # MFB allows users to sign up to receive benefits updates or offers. If they do # so PII is temporarily stored against their user record. This cron function @@ -35,23 +35,21 @@ def handle(self, *args, **options): # hubspot, and then clears the PII on the user record in favor of storing the # external id. This separates PII from household demographic. def sync_mfb_hubspot_users(self, limit): - status = { - 'processed': 0, - 'completed': [], - 'failed': [] - } + status = {"processed": 0, "completed": [], "failed": []} screen = None processed = 0 # for now, we only sync users to hubspot who have signed up for offers or # updates and given TCPA consent - unsynced = User.objects.filter(Q(send_offers=True) | Q(send_updates=True))\ - .filter(external_id__isnull=True)\ + unsynced = ( + User.objects.filter(Q(send_offers=True) | Q(send_updates=True)) + .filter(external_id__isnull=True) .filter(tcpa_consent=True) + ) for user in unsynced: if processed < limit: - user_screens = Screen.objects.filter(user_id=user.id).order_by('-submission_date') + user_screens = Screen.objects.filter(user_id=user.id).order_by("-submission_date") if user_screens: screen = user_screens.first() else: @@ -59,19 +57,19 @@ def sync_mfb_hubspot_users(self, limit): hubspot_id = upsert_user_hubspot(user, screen) if hubspot_id: self.replace_pii_with_hubspot_id(hubspot_id, user) - status['completed'].append((user.id, hubspot_id)) + status["completed"].append((user.id, hubspot_id)) else: - status['failed'].append((user.id, hubspot_id)) + status["failed"].append((user.id, hubspot_id)) # Delay to prevent hitting rate limit of 100 req per 10 seconds - time.sleep(.2) + time.sleep(0.2) processed += 1 return status # stores an external id from hubspot and then clears all of the PII def replace_pii_with_hubspot_id(self, hubspot_id, user): - random_id = str(uuid.uuid4()).replace('-', '') + random_id = str(uuid.uuid4()).replace("-", "") user.external_id = hubspot_id - user.email_or_cell = f'{hubspot_id}+{random_id}@myfriendben.org' + user.email_or_cell = f"{hubspot_id}+{random_id}@myfriendben.org" user.first_name = None user.last_name = None user.cell = None diff --git a/integrations/services/communications/__init__.py b/integrations/services/communications/__init__.py index 18608ce6..10f4b18e 100644 --- a/integrations/services/communications/__init__.py +++ b/integrations/services/communications/__init__.py @@ -1,2 +1 @@ from .message import MessageUser - diff --git a/integrations/services/communications/message.py b/integrations/services/communications/message.py index c709261b..45a84103 100644 --- a/integrations/services/communications/message.py +++ b/integrations/services/communications/message.py @@ -16,8 +16,8 @@ class MessageUser: cell_auth_token = config("TWILIO_TOKEN") cell_from_phone_number = config("TWILIO_PHONE_NUMBER") - email_from = 'screener@myfriendben.org' - email_api_key = config('SENDGRID') + email_from = "screener@myfriendben.org" + email_api_key = config("SENDGRID") def __init__(self, screen: Screen, lang: str) -> None: self.screen = screen @@ -45,16 +45,16 @@ def email(self, email: str, send_tests=False): sg.client.mail.send.post(request_body=mail.get()) - self.log('emailScreen') + self.log("emailScreen") def _email_client(self): return sendgrid.SendGridAPIClient(api_key=self.email_api_key) def _email_subject(self): - return Translation.objects.get(label='sendResults.email-subject').get_lang(self.lang).text + return Translation.objects.get(label="sendResults.email-subject").get_lang(self.lang).text def _email_body(self): - words = Translation.objects.get(label='sendResults.email').get_lang(self.lang).text + words = Translation.objects.get(label="sendResults.email").get_lang(self.lang).text url = self._generate_link() return words + f' {url}' @@ -69,22 +69,21 @@ def text(self, cell: str, send_tests=False): to=cell, ) - self.log('textScreen') + self.log("textScreen") def _text_body(self): - words = Translation.objects.get(label='sendResults.email').get_lang(self.lang).text + words = Translation.objects.get(label="sendResults.email").get_lang(self.lang).text url = self._generate_link() - return f'{words} {url}' + return f"{words} {url}" def _cell_client(self): return Client(self.cell_account_sid, self.cell_auth_token) - def _generate_link(self): return f"{self.front_end_domain}/{self.screen.uuid}/results" - def log(self, type: Literal['emailScreen', 'textScreen']): + def log(self, type: Literal["emailScreen", "textScreen"]): self.screen.last_email_request_date = timezone.now() self.screen.save() @@ -92,4 +91,3 @@ def log(self, type: Literal['emailScreen', 'textScreen']): type=type, screen=self.screen, ) - diff --git a/integrations/services/google_translate/integration.py b/integrations/services/google_translate/integration.py index 7405f47c..29a1eb02 100644 --- a/integrations/services/google_translate/integration.py +++ b/integrations/services/google_translate/integration.py @@ -6,50 +6,50 @@ import html -class Translate(): +class Translate: main_language: str = settings.LANGUAGE_CODE languages: list[str] = [ - lang['code'] for lang in settings.PARLER_LANGUAGES[None] if lang['code'] != settings.LANGUAGE_CODE + lang["code"] for lang in settings.PARLER_LANGUAGES[None] if lang["code"] != settings.LANGUAGE_CODE ] def __init__(self): - info = json.loads(config('GOOGLE_APPLICATION_CREDENTIALS')) + info = json.loads(config("GOOGLE_APPLICATION_CREDENTIALS")) creds = service_account.Credentials.from_service_account_info(info) self.client = translate.Client(credentials=creds) def translate(self, lang: str, text: str): - ''' + """ Translates the text from the default language to the lang param language. - ''' + """ if lang not in Translate.languages: - raise Exception(f'{lang} is not configured in settings, or is the default language') + raise Exception(f"{lang} is not configured in settings, or is the default language") result = self.client.translate(text, target_language=lang, source_language=Translate.main_language) return self.format_text(result) def bulk_translate(self, langs: list[str], texts: list[str]): - ''' + """ Translates all of the texts to the target langs. Include __all__ in langs to tranlsate to all languages. - ''' - if '__all__' in langs: + """ + if "__all__" in langs: langs = Translate.languages translations = {text: {} for text in texts} for lang in langs: if lang not in Translate.languages: - raise Exception(f'{lang} is not configured in settings, or is the default language') + raise Exception(f"{lang} is not configured in settings, or is the default language") results = self.client.translate(texts, target_language=lang, source_language=Translate.main_language) for result in results: - translations[result['input']][lang] = self.format_text(result) + translations[result["input"]][lang] = self.format_text(result) return translations def format_text(self, result): - leading_spaces = len(result['input']) - len(result['input'].lstrip(' ')) - trailing_spaces = len(result['input']) - len(result['input'].rstrip(' ')) + leading_spaces = len(result["input"]) - len(result["input"].lstrip(" ")) + trailing_spaces = len(result["input"]) - len(result["input"].rstrip(" ")) - return ' ' * leading_spaces + html.unescape(result['translatedText']) + ' ' * trailing_spaces + return " " * leading_spaces + html.unescape(result["translatedText"]) + " " * trailing_spaces diff --git a/integrations/services/hubspot/integration.py b/integrations/services/hubspot/integration.py index 2f792d4d..6fdd5825 100644 --- a/integrations/services/hubspot/integration.py +++ b/integrations/services/hubspot/integration.py @@ -16,8 +16,8 @@ def upsert_user_hubspot(user, screen=None): def update_send_offers_hubspot(external_id, send_offers, send_updates): hubspot = Hubspot() contact = { - 'ab01___send_offers': send_offers, - 'ab01___send_updates': send_updates, + "ab01___send_offers": send_offers, + "ab01___send_updates": send_updates, } try: hubspot.update_contact(external_id, contact) @@ -25,9 +25,9 @@ def update_send_offers_hubspot(external_id, send_offers, send_updates): print(e) -class Hubspot(): +class Hubspot: def __init__(self): - self.api_client = HubSpot(access_token=config('HUBSPOT')) + self.api_client = HubSpot(access_token=config("HUBSPOT")) # Hubspot has no insert or update option in their latest API, so the code # below first attempts to create a contact. If there is already a contact @@ -40,7 +40,7 @@ def upsert_contact(self, contact): contact_id = api_response.id except ApiException as e: http_body = json.loads(e.body) - if http_body['category'] == 'CONFLICT': + if http_body["category"] == "CONFLICT": try: contact_id = self.get_conflict_contact_id(e) self.update_contact(contact_id, contact) @@ -52,21 +52,16 @@ def upsert_contact(self, contact): return contact_id def create_contact(self, user): - simple_public_object_input = SimplePublicObjectInput( - properties=user - ) + simple_public_object_input = SimplePublicObjectInput(properties=user) api_response = self.api_client.crm.contacts.basic_api.create( simple_public_object_input=simple_public_object_input ) return api_response def update_contact(self, contact_id, user): - simple_public_object_input = SimplePublicObjectInput( - properties=user - ) + simple_public_object_input = SimplePublicObjectInput(properties=user) api_response = self.api_client.crm.contacts.basic_api.update( - contact_id, - simple_public_object_input=simple_public_object_input + contact_id, simple_public_object_input=simple_public_object_input ) return api_response @@ -83,38 +78,38 @@ def get_conflict_contact_id(self, e): http_body = json.loads(e.body) # strip everything out of the error message except the contact id # https://community.hubspot.com/t5/APIs-Integrations/Contacts-v3-contact-exists-error/m-p/364629 - contact_id = re.sub('[^0-9]', '', http_body['message']) + contact_id = re.sub("[^0-9]", "", http_body["message"]) return contact_id def mfb_user_to_hubspot_contact(self, user, screen=None): contact = { - 'email': user.email, - 'firstname': user.first_name, - 'lastname': user.last_name, - 'phone': str(user.cell), - 'benefits_screener_id': user.id, - 'ab01___send_offers': user.send_offers, - 'ab01___send_updates': user.send_updates, - 'ab01___tcpa_consent_to_contact': user.tcpa_consent, - 'hs_language': user.language_code, - 'ab01___screener_id': None, - 'ab01___screener_uuid': None, - 'ab01___1st_mfb_completion_date': user.date_joined.date().isoformat(), - 'full_name': f'{user.first_name} {user.last_name}' + "email": user.email, + "firstname": user.first_name, + "lastname": user.last_name, + "phone": str(user.cell), + "benefits_screener_id": user.id, + "ab01___send_offers": user.send_offers, + "ab01___send_updates": user.send_updates, + "ab01___tcpa_consent_to_contact": user.tcpa_consent, + "hs_language": user.language_code, + "ab01___screener_id": None, + "ab01___screener_uuid": None, + "ab01___1st_mfb_completion_date": user.date_joined.date().isoformat(), + "full_name": f"{user.first_name} {user.last_name}", } if screen: - contact['ab01___screener_id'] = screen.id - contact['ab01___uuid'] = str(screen.uuid) + contact["ab01___screener_id"] = screen.id + contact["ab01___uuid"] = str(screen.uuid) return contact def format_email_new_benefit(self, user, num_benefits, value_benefits): contact = { - 'id': user.external_id, - 'properties': { - 'ab01___number_of_new_benefits': int(num_benefits), - 'ab01___new_benefit_total_value': int(value_benefits), - } + "id": user.external_id, + "properties": { + "ab01___number_of_new_benefits": int(num_benefits), + "ab01___new_benefit_total_value": int(value_benefits), + }, } return contact diff --git a/integrations/services/sheets/sheets.py b/integrations/services/sheets/sheets.py index 4f6dc1c8..a09e46a6 100644 --- a/integrations/services/sheets/sheets.py +++ b/integrations/services/sheets/sheets.py @@ -6,9 +6,9 @@ class GoogleSheets: - info = json.loads(config('GOOGLE_APPLICATION_CREDENTIALS')) + info = json.loads(config("GOOGLE_APPLICATION_CREDENTIALS")) creds = service_account.Credentials.from_service_account_info(info) - service = build('sheets', 'v4', credentials=creds) + service = build("sheets", "v4", credentials=creds) sheet = service.spreadsheets() class ColumnDoesNotExist(Exception): @@ -19,20 +19,18 @@ def __init__(self, spreadsheet_id: str, cell_range: str) -> None: self.cell_range = cell_range def data(self) -> list[list[any]]: - ''' + """ return a list of rows in the cell range - ''' - result = self.sheet.values().get( - spreadsheetId=self.spreadsheet_id, range=self.cell_range - ).execute() - values = result.get('values', []) + """ + result = self.sheet.values().get(spreadsheetId=self.spreadsheet_id, range=self.cell_range).execute() + values = result.get("values", []) return values def data_by_column(self, *column_names: str) -> list[dict[str, any]]: - ''' + """ return an array of dictionaries containing the column names and their values - ''' + """ data = self.data() raw_column_names = data[0] @@ -61,20 +59,20 @@ def data_by_column(self, *column_names: str) -> list[dict[str, any]]: return organized_data def print_raw_column_names(self): - ''' + """ print the column names of the spreadsheet WARN: this should only be used during development - ''' + """ raw_column_names = self.data()[0] for name in raw_column_names: print(repr(name)) def _raise_missing_columns(self, needed_columns: list[str], existing_columns: list[str]): - ''' + """ raise an exception with the column names from needed_columns that are not in existing_columns - ''' + """ missing_columns = [] for column in needed_columns: @@ -88,11 +86,10 @@ class GoogleSheetsCache(Cache): expire_time = 60 * 60 * 24 default = [] - sheet_id = '' - range_name = '' + sheet_id = "" + range_name = "" def update(self): sheet_values = GoogleSheets(self.sheet_id, self.range_name).data() return sheet_values - diff --git a/integrations/util/cache.py b/integrations/util/cache.py index a340fb3e..1c6d91f4 100644 --- a/integrations/util/cache.py +++ b/integrations/util/cache.py @@ -2,7 +2,7 @@ import datetime -class Cache(): +class Cache: expire_time = 0 default = 0 @@ -18,7 +18,7 @@ def _update_cache(self): self.data = self.update() self.last_update = datetime.datetime.now() except Exception: - capture_message(f'Failed to update {self.__class__.__name__}', level='warning') + capture_message(f"Failed to update {self.__class__.__name__}", level="warning") def should_update(self): return datetime.datetime.now() > self.last_update + datetime.timedelta(seconds=self.expire_time) diff --git a/manage.py b/manage.py index 2dd7eb2e..cec8e4c5 100755 --- a/manage.py +++ b/manage.py @@ -6,7 +6,7 @@ def main(): """Run administrative tasks.""" - os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'benefits.settings') + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "benefits.settings") try: from django.core.management import execute_from_command_line except ImportError as exc: @@ -18,5 +18,5 @@ def main(): execute_from_command_line(sys.argv) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/programs/admin.py b/programs/admin.py index 8fdf1b8a..e7627acb 100644 --- a/programs/admin.py +++ b/programs/admin.py @@ -15,49 +15,49 @@ class ProgramAdmin(admin.ModelAdmin): - search_fields = ('name_abbreviated',) + search_fields = ("name_abbreviated",) class LegalStatusAdmin(admin.ModelAdmin): - search_fields = ('status',) + search_fields = ("status",) class NavigatorCountiesAdmin(admin.ModelAdmin): - search_fields = ('name',) + search_fields = ("name",) class NavigatorAdmin(admin.ModelAdmin): - search_fields = ('translations__name',) + search_fields = ("translations__name",) class UrgentNeedAdmin(admin.ModelAdmin): - search_fields = ('translations__name',) + search_fields = ("translations__name",) class UrgentNeedCategoryAdmin(admin.ModelAdmin): - search_fields = ('name',) - fields = ('name',) + search_fields = ("name",) + fields = ("name",) class UrgentNeedFunctionAdmin(admin.ModelAdmin): - search_fields = ('name',) - fields = ('name',) + search_fields = ("name",) + fields = ("name",) class FederalPovertyLimitAdmin(admin.ModelAdmin): - search_fields = ('year',) + search_fields = ("year",) class DocumentAdmin(admin.ModelAdmin): - search_fields = ('name',) + search_fields = ("name",) class ReferrerAdmin(admin.ModelAdmin): - search_fields = ('referrer_code',) + search_fields = ("referrer_code",) class WebHookFunctionsAdmin(admin.ModelAdmin): - search_fields = ('name',) + search_fields = ("name",) admin.site.register(LegalStatus, LegalStatusAdmin) diff --git a/programs/apps.py b/programs/apps.py index 8d5355c3..34c4c1e7 100644 --- a/programs/apps.py +++ b/programs/apps.py @@ -2,5 +2,5 @@ class ProgramsConfig(AppConfig): - default_auto_field = 'django.db.models.BigAutoField' - name = 'programs' + default_auto_field = "django.db.models.BigAutoField" + name = "programs" diff --git a/programs/co_county_zips.py b/programs/co_county_zips.py index 78746a10..bcb3f762 100644 --- a/programs/co_county_zips.py +++ b/programs/co_county_zips.py @@ -1,4 +1,3 @@ - def counties_from_zip(lookup_zip): matches = [] @@ -911,8 +910,7 @@ def counties_from_zip(lookup_zip): "81416", "81521", ], - "Mineral County": [ - "81230", "81149", "81147", "81154", "81235", "81132", "81130"], + "Mineral County": ["81230", "81149", "81147", "81154", "81235", "81132", "81130"], "Moffat County": [ "81648", "81638", diff --git a/programs/management/commands/add_history.py b/programs/management/commands/add_history.py index 8edaeaae..5a1faa94 100644 --- a/programs/management/commands/add_history.py +++ b/programs/management/commands/add_history.py @@ -8,38 +8,33 @@ class Command(BaseCommand): - help = 'Adds a new program eligibility snapshot to the history yaml file for all screens' + help = "Adds a new program eligibility snapshot to the history yaml file for all screens" def create_screen(self, path): - with open(path, 'r') as file: + with open(path, "r") as file: screen_dict = yaml.safe_load(file) screen = Screen.objects.create( - **{key: value for key, value in screen_dict.items() if key != 'household_members'}, + **{key: value for key, value in screen_dict.items() if key != "household_members"}, agree_to_tos=True, completed=False, is_test=True - ) + ) members = [] incomes = [] expenses = [] - for member in screen_dict['household_members']: - has_income = len(member['incomes']) >= 1 - has_expense = len(member['expenses']) >= 1 - household_member = {key: value for key, value in member.items() if key not in ('incomes', 'expenses')} - member_model = HouseholdMember(**household_member, - has_income=has_income, - has_expenses=has_expense, - screen=screen) + for member in screen_dict["household_members"]: + has_income = len(member["incomes"]) >= 1 + has_expense = len(member["expenses"]) >= 1 + household_member = {key: value for key, value in member.items() if key not in ("incomes", "expenses")} + member_model = HouseholdMember( + **household_member, has_income=has_income, has_expenses=has_expense, screen=screen + ) members.append(member_model) - for income in member['incomes']: - incomes.append(IncomeStream(**income, - screen=screen, - household_member=member_model)) - for expense in member['expenses']: - expenses.append(Expense(**expense, - screen=screen, - household_member=member_model)) + for income in member["incomes"]: + incomes.append(IncomeStream(**income, screen=screen, household_member=member_model)) + for expense in member["expenses"]: + expenses.append(Expense(**expense, screen=screen, household_member=member_model)) HouseholdMember.objects.bulk_create(members) IncomeStream.objects.bulk_create(incomes) @@ -50,32 +45,32 @@ def create_screen(self, path): def eligibility(self, screen): eligibility = {} for benefit, calculator in calculators.items(): - raw_result = calculator(screen, [ - {'name_abbreviated': 'medicaid', 'eligible': False if benefit == 'cfhc' else True}, - {'name_abbreviated': 'tanf', 'eligible': False} - ]) - eligibility[benefit] = { - 'eligibility': raw_result['eligibility']['eligible'], - 'value': raw_result['value'] - } + raw_result = calculator( + screen, + [ + {"name_abbreviated": "medicaid", "eligible": False if benefit == "cfhc" else True}, + {"name_abbreviated": "tanf", "eligible": False}, + ], + ) + eligibility[benefit] = {"eligibility": raw_result["eligibility"]["eligible"], "value": raw_result["value"]} return eligibility def update_history(seld, eligibility, path, date): - with open(path, 'r') as file: + with open(path, "r") as file: history = yaml.safe_load(file) - with open(path, 'w') as file: + with open(path, "w") as file: if history is None: - yaml.dump([{'date': date, 'eligibility': eligibility}], file) + yaml.dump([{"date": date, "eligibility": eligibility}], file) else: - history.append({'date': date, 'eligibility': eligibility}) + history.append({"date": date, "eligibility": eligibility}) yaml.dump(history, file) def handle(self, *args, **options): - base_path = os.path.join(settings.BASE_DIR, 'programs', 'program_history') + base_path = os.path.join(settings.BASE_DIR, "programs", "program_history") date = datetime.now().strftime("%m/%d/%Y %H:%M:%S") for directory in os.listdir(base_path): print(directory) - screen = self.create_screen(os.path.join(base_path, directory, 'screen.yaml')) + screen = self.create_screen(os.path.join(base_path, directory, "screen.yaml")) eligibility = self.eligibility(screen) - self.update_history(eligibility, os.path.join(base_path, directory, 'history.yaml'), date) + self.update_history(eligibility, os.path.join(base_path, directory, "history.yaml"), date) diff --git a/programs/management/commands/diff_history.py b/programs/management/commands/diff_history.py index 9698fe98..3fd8006f 100644 --- a/programs/management/commands/diff_history.py +++ b/programs/management/commands/diff_history.py @@ -5,42 +5,42 @@ class Command(BaseCommand): - help = 'Checks history for changes' + help = "Checks history for changes" def compare(self, file): - with open(file, 'r') as file: + with open(file, "r") as file: history = yaml.safe_load(file) try: - latest = history[-1]['eligibility'] - second_latest = history[-2]['eligibility'] + latest = history[-1]["eligibility"] + second_latest = history[-2]["eligibility"] except IndexError: - print('nothing to compare') + print("nothing to compare") return for key in latest: try: - new_eligible = latest[key]['eligibility'] + new_eligible = latest[key]["eligibility"] except KeyError: - print(key, 'was deleted') + print(key, "was deleted") continue try: - old_eligible = second_latest[key]['eligibility'] + old_eligible = second_latest[key]["eligibility"] except KeyError: - print(key, 'was added') + print(key, "was added") continue if new_eligible != old_eligible: - print(f' {key}: {old_eligible} => {new_eligible}') + print(f" {key}: {old_eligible} => {new_eligible}") - new_value = latest[key]['value'] - old_value = second_latest[key]['value'] + new_value = latest[key]["value"] + old_value = second_latest[key]["value"] if new_value != old_value: - print(f' {key}: {old_value} => {new_value}') + print(f" {key}: {old_value} => {new_value}") def handle(self, *args, **options): - base_path = os.path.join(settings.BASE_DIR, 'programs', 'program_history') + base_path = os.path.join(settings.BASE_DIR, "programs", "program_history") for directory in os.listdir(base_path): - print(directory+':') - self.compare(os.path.join(base_path, directory, 'history.yaml')) + print(directory + ":") + self.compare(os.path.join(base_path, directory, "history.yaml")) diff --git a/programs/management/commands/quick_start.py b/programs/management/commands/quick_start.py index 3f89859f..7c2460f4 100644 --- a/programs/management/commands/quick_start.py +++ b/programs/management/commands/quick_start.py @@ -12,9 +12,7 @@ class Command(BaseCommand): - help = ( - 'create programs, navigators, urgent needs, and other starting database stuff' - ) + help = "create programs, navigators, urgent needs, and other starting database stuff" fpl = { 1: 13_590, @@ -27,116 +25,116 @@ class Command(BaseCommand): 8: 41_910, } legal_statuses = [ - 'gc_under18_no5', - 'gc_18plus_no5', - 'gc_5plus', - 'refugee', - 'green_card', - 'non_citizen', - 'citizen', - 'other', - 'otherHealthCarePregnant', - 'otherHealthCareUnder19', - 'otherWithWorkPermission', + "gc_under18_no5", + "gc_18plus_no5", + "gc_5plus", + "refugee", + "green_card", + "non_citizen", + "citizen", + "other", + "otherHealthCarePregnant", + "otherHealthCareUnder19", + "otherWithWorkPermission", ] urgent_need_categories = [ - 'legal services', - 'dental care', - 'job resources', - 'family planning', - 'funeral', - 'child dev', - 'mental health', - 'housing', - 'baby supplies', - 'food', + "legal services", + "dental care", + "job resources", + "family planning", + "funeral", + "child dev", + "mental health", + "housing", + "baby supplies", + "food", ] urgent_need_functions = [ - 'co_legal_services', - 'eoc', - 'trua', - 'bia_food_delivery', - 'child', - 'helpkitchen_zipcode', - 'denver', + "co_legal_services", + "eoc", + "trua", + "bia_food_delivery", + "child", + "helpkitchen_zipcode", + "denver", ] programs = [ - {'abbr': 'cwd_medicaid', 'external': 'cwd_medicaid'}, - {'abbr': 'awd_medicaid', 'external': 'awd_medivaid'}, - {'abbr': 'emergency_medicaid', 'external': 'emergency_medicaid'}, - {'abbr': 'medicare_savings', 'external': 'medicare_savings'}, - {'abbr': 'ssi', 'external': 'ssi'}, - {'abbr': 'trua', 'external': 'trua'}, - {'abbr': 'rhc', 'external': 'rhc'}, - {'abbr': 'wic', 'external': 'wic'}, - {'abbr': 'omnisalud', 'external': 'omnisalud'}, - {'abbr': 'dpp', 'external': 'dpp'}, - {'abbr': 'lwcr', 'external': 'lwcr'}, - {'abbr': 'lifeline', 'external': 'lifeline'}, - {'abbr': 'fps', 'external': 'fps'}, - {'abbr': 'leap', 'external': 'leap'}, - {'abbr': 'pell_grant', 'external': 'pell_grant'}, - {'abbr': 'mydenver', 'external': 'mydenver'}, - {'abbr': 'ede', 'external': 'ede'}, - {'abbr': 'cdhcs', 'external': 'cdhcs'}, - {'abbr': 'nslp', 'external': 'nslp'}, - {'abbr': 'erc', 'external': 'erc'}, - {'abbr': 'chs', 'external': 'chs'}, - {'abbr': 'cccap', 'external': 'cccap'}, - {'abbr': 'chp', 'external': 'chp'}, - {'abbr': 'coeitc', 'external': 'coexeitc'}, - {'abbr': 'acp', 'external': 'acp'}, - {'abbr': 'rtdlive', 'external': 'rtdlive'}, - {'abbr': 'coctc', 'external': 'coctc'}, - {'abbr': 'ssdi', 'external': 'ssdi'}, - {'abbr': 'tanf', 'external': 'tanf'}, - {'abbr': 'coeitc', 'external': 'coeitc'}, - {'abbr': 'cpcr', 'external': 'cpcr'}, - {'abbr': 'eitc', 'external': 'eitc'}, - {'abbr': 'cfhc', 'external': 'cfhc'}, - {'abbr': 'myspark', 'external': 'myspark'}, - {'abbr': 'snap', 'external': 'snap'}, - {'abbr': 'ctc', 'external': 'ctc'}, - {'abbr': 'medicaid', 'external': 'medicaid'}, - {'abbr': 'andcs', 'external': 'andcs'}, - {'abbr': 'oap', 'external': 'oap'}, - {'abbr': 'upk', 'external': 'upk'}, + {"abbr": "cwd_medicaid", "external": "cwd_medicaid"}, + {"abbr": "awd_medicaid", "external": "awd_medivaid"}, + {"abbr": "emergency_medicaid", "external": "emergency_medicaid"}, + {"abbr": "medicare_savings", "external": "medicare_savings"}, + {"abbr": "ssi", "external": "ssi"}, + {"abbr": "trua", "external": "trua"}, + {"abbr": "rhc", "external": "rhc"}, + {"abbr": "wic", "external": "wic"}, + {"abbr": "omnisalud", "external": "omnisalud"}, + {"abbr": "dpp", "external": "dpp"}, + {"abbr": "lwcr", "external": "lwcr"}, + {"abbr": "lifeline", "external": "lifeline"}, + {"abbr": "fps", "external": "fps"}, + {"abbr": "leap", "external": "leap"}, + {"abbr": "pell_grant", "external": "pell_grant"}, + {"abbr": "mydenver", "external": "mydenver"}, + {"abbr": "ede", "external": "ede"}, + {"abbr": "cdhcs", "external": "cdhcs"}, + {"abbr": "nslp", "external": "nslp"}, + {"abbr": "erc", "external": "erc"}, + {"abbr": "chs", "external": "chs"}, + {"abbr": "cccap", "external": "cccap"}, + {"abbr": "chp", "external": "chp"}, + {"abbr": "coeitc", "external": "coexeitc"}, + {"abbr": "acp", "external": "acp"}, + {"abbr": "rtdlive", "external": "rtdlive"}, + {"abbr": "coctc", "external": "coctc"}, + {"abbr": "ssdi", "external": "ssdi"}, + {"abbr": "tanf", "external": "tanf"}, + {"abbr": "coeitc", "external": "coeitc"}, + {"abbr": "cpcr", "external": "cpcr"}, + {"abbr": "eitc", "external": "eitc"}, + {"abbr": "cfhc", "external": "cfhc"}, + {"abbr": "myspark", "external": "myspark"}, + {"abbr": "snap", "external": "snap"}, + {"abbr": "ctc", "external": "ctc"}, + {"abbr": "medicaid", "external": "medicaid"}, + {"abbr": "andcs", "external": "andcs"}, + {"abbr": "oap", "external": "oap"}, + {"abbr": "upk", "external": "upk"}, ] urgent_needs = [ - 'bia_food', - 'coemap', - 'dbap', - 'plentiful', - 'eic', - 'ccs', - 'ndbn', - 'hfc', - 'rhc', - 'fps', - 'better_offer', - 'cedp', - 'chc', - 'cda', - 'eocbpa', - 'cls', - 'trua', - 'imatter', + "bia_food", + "coemap", + "dbap", + "plentiful", + "eic", + "ccs", + "ndbn", + "hfc", + "rhc", + "fps", + "better_offer", + "cedp", + "chc", + "cda", + "eocbpa", + "cls", + "trua", + "imatter", ] navigators = [ - 'gac', - 'bia', - 'bdt', - 'acc', - 'mhuw', - 'dpp', - 'uph', - 'cowicc', + "gac", + "bia", + "bdt", + "acc", + "mhuw", + "dpp", + "uph", + "cowicc", ] def handle(self, *args, **options): # create FPL fpl = FederalPoveryLimit.objects.create( - year='THIS YEAR', + year="THIS YEAR", has_1_person=self.fpl[1], has_2_people=self.fpl[2], has_3_people=self.fpl[3], @@ -164,8 +162,8 @@ def handle(self, *args, **options): # create programs programs = [] for program in self.programs: - new_program = Program.objects.new_program(program['abbr']) - new_program.external_name = program['external'] + new_program = Program.objects.new_program(program["abbr"]) + new_program.external_name = program["external"] new_program.fpl = fpl for status in statuses: # set all legal statuses for each program diff --git a/programs/management/commands/rm_latest_history.py b/programs/management/commands/rm_latest_history.py index c52b25bb..762a36dc 100644 --- a/programs/management/commands/rm_latest_history.py +++ b/programs/management/commands/rm_latest_history.py @@ -5,19 +5,19 @@ class Command(BaseCommand): - help = 'Checks history for changes' + help = "Checks history for changes" def remove_latest(self, path): - with open(path, 'r') as file: + with open(path, "r") as file: history = yaml.safe_load(file) history = history[:-1] - with open(path, 'w') as file: + with open(path, "w") as file: yaml.dump(history, file) def handle(self, *args, **options): - base_path = os.path.join(settings.BASE_DIR, 'programs', 'program_history') + base_path = os.path.join(settings.BASE_DIR, "programs", "program_history") for directory in os.listdir(base_path): print(directory) - self.remove_latest(os.path.join(base_path, directory, 'history.yaml')) + self.remove_latest(os.path.join(base_path, directory, "history.yaml")) diff --git a/programs/migrations/0001_initial.py b/programs/migrations/0001_initial.py index 94d27846..258f33b7 100644 --- a/programs/migrations/0001_initial.py +++ b/programs/migrations/0001_initial.py @@ -4,27 +4,26 @@ import parler.fields import parler.models -class Migration(migrations.Migration): +class Migration(migrations.Migration): initial = True - dependencies = [ - ] + dependencies = [] operations = [ migrations.CreateModel( - name='Program', + name="Program", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('programSnapshot', models.TextField()), - ('programName', models.CharField(max_length=120)), - ('programDescription', models.TextField()), - ('learnMoreLink', models.CharField(max_length=320)), - ('applyButtonLink', models.CharField(max_length=320)), - ('dollarValue', models.IntegerField()), - ('estimatedDeliveryTime', models.CharField(max_length=120)), - ('legalStatusRequired', models.BooleanField()), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("programSnapshot", models.TextField()), + ("programName", models.CharField(max_length=120)), + ("programDescription", models.TextField()), + ("learnMoreLink", models.CharField(max_length=320)), + ("applyButtonLink", models.CharField(max_length=320)), + ("dollarValue", models.IntegerField()), + ("estimatedDeliveryTime", models.CharField(max_length=120)), + ("legalStatusRequired", models.BooleanField()), ], - bases=(parler.models.TranslatableModelMixin, models.Model) + bases=(parler.models.TranslatableModelMixin, models.Model), ), ] diff --git a/programs/migrations/0002_program_programnameshort.py b/programs/migrations/0002_program_programnameshort.py index fa128a4a..056d7300 100644 --- a/programs/migrations/0002_program_programnameshort.py +++ b/programs/migrations/0002_program_programnameshort.py @@ -4,16 +4,15 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0001_initial'), + ("programs", "0001_initial"), ] operations = [ migrations.AddField( - model_name='program', - name='programNameShort', - field=models.CharField(default='snap', max_length=120), + model_name="program", + name="programNameShort", + field=models.CharField(default="snap", max_length=120), preserve_default=False, ), ] diff --git a/programs/migrations/0003_rename_applybuttonlink_program_apply_button_link_and_more.py b/programs/migrations/0003_rename_applybuttonlink_program_apply_button_link_and_more.py index 55be7831..ff041972 100644 --- a/programs/migrations/0003_rename_applybuttonlink_program_apply_button_link_and_more.py +++ b/programs/migrations/0003_rename_applybuttonlink_program_apply_button_link_and_more.py @@ -4,55 +4,54 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0002_program_programnameshort'), + ("programs", "0002_program_programnameshort"), ] operations = [ migrations.RenameField( - model_name='program', - old_name='applyButtonLink', - new_name='apply_button_link', + model_name="program", + old_name="applyButtonLink", + new_name="apply_button_link", ), migrations.RenameField( - model_name='program', - old_name='dollarValue', - new_name='dollar_value', + model_name="program", + old_name="dollarValue", + new_name="dollar_value", ), migrations.RenameField( - model_name='program', - old_name='estimatedDeliveryTime', - new_name='estimated_delivery_time', + model_name="program", + old_name="estimatedDeliveryTime", + new_name="estimated_delivery_time", ), migrations.RenameField( - model_name='program', - old_name='learnMoreLink', - new_name='learn_more_link', + model_name="program", + old_name="learnMoreLink", + new_name="learn_more_link", ), migrations.RenameField( - model_name='program', - old_name='legalStatusRequired', - new_name='legal_status_required', + model_name="program", + old_name="legalStatusRequired", + new_name="legal_status_required", ), migrations.RenameField( - model_name='program', - old_name='programDescription', - new_name='program_description', + model_name="program", + old_name="programDescription", + new_name="program_description", ), migrations.RenameField( - model_name='program', - old_name='programName', - new_name='program_name', + model_name="program", + old_name="programName", + new_name="program_name", ), migrations.RenameField( - model_name='program', - old_name='programNameShort', - new_name='program_name_short', + model_name="program", + old_name="programNameShort", + new_name="program_name_short", ), migrations.RenameField( - model_name='program', - old_name='programSnapshot', - new_name='program_snapshot', + model_name="program", + old_name="programSnapshot", + new_name="program_snapshot", ), ] diff --git a/programs/migrations/0004_rename_program_snapshot_program_description_short.py b/programs/migrations/0004_rename_program_snapshot_program_description_short.py index 290e77ac..0d9564e7 100644 --- a/programs/migrations/0004_rename_program_snapshot_program_description_short.py +++ b/programs/migrations/0004_rename_program_snapshot_program_description_short.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0003_rename_applybuttonlink_program_apply_button_link_and_more'), + ("programs", "0003_rename_applybuttonlink_program_apply_button_link_and_more"), ] operations = [ migrations.RenameField( - model_name='program', - old_name='program_snapshot', - new_name='description_short', + model_name="program", + old_name="program_snapshot", + new_name="description_short", ), ] diff --git a/programs/migrations/0005_rename_program_name_program_name.py b/programs/migrations/0005_rename_program_name_program_name.py index e45319c6..6a020db9 100644 --- a/programs/migrations/0005_rename_program_name_program_name.py +++ b/programs/migrations/0005_rename_program_name_program_name.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0004_rename_program_snapshot_program_description_short'), + ("programs", "0004_rename_program_snapshot_program_description_short"), ] operations = [ migrations.RenameField( - model_name='program', - old_name='program_name', - new_name='name', + model_name="program", + old_name="program_name", + new_name="name", ), ] diff --git a/programs/migrations/0006_rename_program_description_program_description_and_more.py b/programs/migrations/0006_rename_program_description_program_description_and_more.py index e6001367..1846cf8f 100644 --- a/programs/migrations/0006_rename_program_description_program_description_and_more.py +++ b/programs/migrations/0006_rename_program_description_program_description_and_more.py @@ -4,20 +4,19 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0005_rename_program_name_program_name'), + ("programs", "0005_rename_program_name_program_name"), ] operations = [ migrations.RenameField( - model_name='program', - old_name='program_description', - new_name='description', + model_name="program", + old_name="program_description", + new_name="description", ), migrations.RenameField( - model_name='program', - old_name='program_name_short', - new_name='name_abbreviated', + model_name="program", + old_name="program_name_short", + new_name="name_abbreviated", ), ] diff --git a/programs/migrations/0007_alter_program_estimated_delivery_time.py b/programs/migrations/0007_alter_program_estimated_delivery_time.py index c8b21efd..4a1a6bd8 100644 --- a/programs/migrations/0007_alter_program_estimated_delivery_time.py +++ b/programs/migrations/0007_alter_program_estimated_delivery_time.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0006_rename_program_description_program_description_and_more'), + ("programs", "0006_rename_program_description_program_description_and_more"), ] operations = [ migrations.AlterField( - model_name='program', - name='estimated_delivery_time', + model_name="program", + name="estimated_delivery_time", field=models.CharField(max_length=320), ), ] diff --git a/programs/migrations/0008_alter_program_legal_status_required.py b/programs/migrations/0008_alter_program_legal_status_required.py index 36454bce..bcdd2a87 100644 --- a/programs/migrations/0008_alter_program_legal_status_required.py +++ b/programs/migrations/0008_alter_program_legal_status_required.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0007_alter_program_estimated_delivery_time'), + ("programs", "0007_alter_program_estimated_delivery_time"), ] operations = [ migrations.AlterField( - model_name='program', - name='legal_status_required', + model_name="program", + name="legal_status_required", field=models.CharField(max_length=120), ), ] diff --git a/programs/migrations/0009_program_value_type.py b/programs/migrations/0009_program_value_type.py index 6d127a49..e2f61b6f 100644 --- a/programs/migrations/0009_program_value_type.py +++ b/programs/migrations/0009_program_value_type.py @@ -4,16 +4,15 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0008_alter_program_legal_status_required'), + ("programs", "0008_alter_program_legal_status_required"), ] operations = [ migrations.AddField( - model_name='program', - name='value_type', - field=models.CharField(default='non-discretionary', max_length=120), + model_name="program", + name="value_type", + field=models.CharField(default="non-discretionary", max_length=120), preserve_default=False, ), ] diff --git a/programs/migrations/0010_rename_apply_button_link_program__apply_button_link_and_more.py b/programs/migrations/0010_rename_apply_button_link_program__apply_button_link_and_more.py index 3f94cdbd..2a7ffbc2 100644 --- a/programs/migrations/0010_rename_apply_button_link_program__apply_button_link_and_more.py +++ b/programs/migrations/0010_rename_apply_button_link_program__apply_button_link_and_more.py @@ -4,60 +4,59 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0009_program_value_type'), + ("programs", "0009_program_value_type"), ] operations = [ migrations.RenameField( - model_name='program', - old_name='apply_button_link', - new_name='_apply_button_link', + model_name="program", + old_name="apply_button_link", + new_name="_apply_button_link", ), migrations.RenameField( - model_name='program', - old_name='description', - new_name='_description', + model_name="program", + old_name="description", + new_name="_description", ), migrations.RenameField( - model_name='program', - old_name='description_short', - new_name='_description_short', + model_name="program", + old_name="description_short", + new_name="_description_short", ), migrations.RenameField( - model_name='program', - old_name='dollar_value', - new_name='_dollar_value', + model_name="program", + old_name="dollar_value", + new_name="_dollar_value", ), migrations.RenameField( - model_name='program', - old_name='estimated_delivery_time', - new_name='_estimated_delivery_time', + model_name="program", + old_name="estimated_delivery_time", + new_name="_estimated_delivery_time", ), migrations.RenameField( - model_name='program', - old_name='learn_more_link', - new_name='_learn_more_link', + model_name="program", + old_name="learn_more_link", + new_name="_learn_more_link", ), migrations.RenameField( - model_name='program', - old_name='legal_status_required', - new_name='_legal_status_required', + model_name="program", + old_name="legal_status_required", + new_name="_legal_status_required", ), migrations.RenameField( - model_name='program', - old_name='name', - new_name='_name', + model_name="program", + old_name="name", + new_name="_name", ), migrations.RenameField( - model_name='program', - old_name='name_abbreviated', - new_name='_name_abbreviated', + model_name="program", + old_name="name_abbreviated", + new_name="_name_abbreviated", ), migrations.RenameField( - model_name='program', - old_name='value_type', - new_name='_value_type', + model_name="program", + old_name="value_type", + new_name="_value_type", ), ] diff --git a/programs/migrations/0011_add_translation_model.py b/programs/migrations/0011_add_translation_model.py index c7318de7..0a807c4e 100644 --- a/programs/migrations/0011_add_translation_model.py +++ b/programs/migrations/0011_add_translation_model.py @@ -7,36 +7,44 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0010_rename_apply_button_link_program__apply_button_link_and_more'), + ("programs", "0010_rename_apply_button_link_program__apply_button_link_and_more"), ] operations = [ migrations.CreateModel( - name='ProgramTranslation', + name="ProgramTranslation", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('language_code', models.CharField(db_index=True, max_length=15, verbose_name='Language')), - ('description_short', models.TextField()), - ('name', models.CharField(max_length=120)), - ('name_abbreviated', models.CharField(max_length=120)), - ('description', models.TextField()), - ('learn_more_link', models.CharField(max_length=320)), - ('apply_button_link', models.CharField(max_length=320)), - ('dollar_value', models.IntegerField()), - ('value_type', models.CharField(max_length=120)), - ('estimated_delivery_time', models.CharField(max_length=320)), - ('legal_status_required', models.CharField(max_length=120)), - ('master', parler.fields.TranslationsForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='programs.program')), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("language_code", models.CharField(db_index=True, max_length=15, verbose_name="Language")), + ("description_short", models.TextField()), + ("name", models.CharField(max_length=120)), + ("name_abbreviated", models.CharField(max_length=120)), + ("description", models.TextField()), + ("learn_more_link", models.CharField(max_length=320)), + ("apply_button_link", models.CharField(max_length=320)), + ("dollar_value", models.IntegerField()), + ("value_type", models.CharField(max_length=120)), + ("estimated_delivery_time", models.CharField(max_length=320)), + ("legal_status_required", models.CharField(max_length=120)), + ( + "master", + parler.fields.TranslationsForeignKey( + editable=False, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="translations", + to="programs.program", + ), + ), ], options={ - 'verbose_name': 'program Translation', - 'db_table': 'programs_program_translation', - 'db_tablespace': '', - 'managed': True, - 'default_permissions': (), - 'unique_together': {('language_code', 'master')}, + "verbose_name": "program Translation", + "db_table": "programs_program_translation", + "db_tablespace": "", + "managed": True, + "default_permissions": (), + "unique_together": {("language_code", "master")}, }, bases=(parler.models.TranslatedFieldsModelMixin, models.Model), ), diff --git a/programs/migrations/0012_migrate_translatable_fields.py b/programs/migrations/0012_migrate_translatable_fields.py index e34f5246..cde7cc50 100644 --- a/programs/migrations/0012_migrate_translatable_fields.py +++ b/programs/migrations/0012_migrate_translatable_fields.py @@ -4,31 +4,31 @@ def forwards_func(apps, schema_editor): - Program = apps.get_model('programs', 'Program') - ProgramTranslation = apps.get_model('programs', 'ProgramTranslation') + Program = apps.get_model("programs", "Program") + ProgramTranslation = apps.get_model("programs", "ProgramTranslation") for object in Program.objects.all(): ProgramTranslation.objects.create( master_id=object.pk, language_code=settings.LANGUAGE_CODE, - description_short = object._description_short, - name = object._name, - name_abbreviated = object._name_abbreviated, - description = object._description, - learn_more_link = object._learn_more_link, - apply_button_link = object._apply_button_link, - dollar_value = object._dollar_value, - value_type = object._value_type, - estimated_delivery_time = object._estimated_delivery_time, - legal_status_required = object._legal_status_required + description_short=object._description_short, + name=object._name, + name_abbreviated=object._name_abbreviated, + description=object._description, + learn_more_link=object._learn_more_link, + apply_button_link=object._apply_button_link, + dollar_value=object._dollar_value, + value_type=object._value_type, + estimated_delivery_time=object._estimated_delivery_time, + legal_status_required=object._legal_status_required, ) -class Migration(migrations.Migration): +class Migration(migrations.Migration): dependencies = [ - ('programs', '0011_add_translation_model'), + ("programs", "0011_add_translation_model"), ] operations = [ migrations.RunPython(forwards_func), - ] \ No newline at end of file + ] diff --git a/programs/migrations/0013_remove_program__apply_button_link_and_more.py b/programs/migrations/0013_remove_program__apply_button_link_and_more.py index 28dd2663..8af02cab 100644 --- a/programs/migrations/0013_remove_program__apply_button_link_and_more.py +++ b/programs/migrations/0013_remove_program__apply_button_link_and_more.py @@ -4,50 +4,49 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0012_migrate_translatable_fields'), + ("programs", "0012_migrate_translatable_fields"), ] operations = [ migrations.RemoveField( - model_name='program', - name='_apply_button_link', + model_name="program", + name="_apply_button_link", ), migrations.RemoveField( - model_name='program', - name='_description', + model_name="program", + name="_description", ), migrations.RemoveField( - model_name='program', - name='_description_short', + model_name="program", + name="_description_short", ), migrations.RemoveField( - model_name='program', - name='_dollar_value', + model_name="program", + name="_dollar_value", ), migrations.RemoveField( - model_name='program', - name='_estimated_delivery_time', + model_name="program", + name="_estimated_delivery_time", ), migrations.RemoveField( - model_name='program', - name='_learn_more_link', + model_name="program", + name="_learn_more_link", ), migrations.RemoveField( - model_name='program', - name='_legal_status_required', + model_name="program", + name="_legal_status_required", ), migrations.RemoveField( - model_name='program', - name='_name', + model_name="program", + name="_name", ), migrations.RemoveField( - model_name='program', - name='_name_abbreviated', + model_name="program", + name="_name_abbreviated", ), migrations.RemoveField( - model_name='program', - name='_value_type', + model_name="program", + name="_value_type", ), ] diff --git a/programs/migrations/0014_programtranslation_estimated_application_time.py b/programs/migrations/0014_programtranslation_estimated_application_time.py index 00125414..87bfbd17 100644 --- a/programs/migrations/0014_programtranslation_estimated_application_time.py +++ b/programs/migrations/0014_programtranslation_estimated_application_time.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0013_remove_program__apply_button_link_and_more'), + ("programs", "0013_remove_program__apply_button_link_and_more"), ] operations = [ migrations.AddField( - model_name='programtranslation', - name='estimated_application_time', + model_name="programtranslation", + name="estimated_application_time", field=models.CharField(blank=True, default=None, max_length=320, null=True), ), ] diff --git a/programs/migrations/0015_programtranslation_active.py b/programs/migrations/0015_programtranslation_active.py index c603b279..b2fa6244 100644 --- a/programs/migrations/0015_programtranslation_active.py +++ b/programs/migrations/0015_programtranslation_active.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0014_programtranslation_estimated_application_time'), + ("programs", "0014_programtranslation_estimated_application_time"), ] operations = [ migrations.AddField( - model_name='programtranslation', - name='active', + model_name="programtranslation", + name="active", field=models.BooleanField(blank=True, default=False), ), ] diff --git a/programs/migrations/0016_alter_programtranslation_active.py b/programs/migrations/0016_alter_programtranslation_active.py index dff7dddb..405e51a9 100644 --- a/programs/migrations/0016_alter_programtranslation_active.py +++ b/programs/migrations/0016_alter_programtranslation_active.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0015_programtranslation_active'), + ("programs", "0015_programtranslation_active"), ] operations = [ migrations.AlterField( - model_name='programtranslation', - name='active', + model_name="programtranslation", + name="active", field=models.BooleanField(blank=True, default=True), ), ] diff --git a/programs/migrations/0017_navigator_navigatortranslation.py b/programs/migrations/0017_navigator_navigatortranslation.py index 2b6bffcc..816a8dac 100644 --- a/programs/migrations/0017_navigator_navigatortranslation.py +++ b/programs/migrations/0017_navigator_navigatortranslation.py @@ -8,42 +8,53 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0016_alter_programtranslation_active'), + ("programs", "0016_alter_programtranslation_active"), ] operations = [ migrations.CreateModel( - name='Navigator', + name="Navigator", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), ], options={ - 'abstract': False, + "abstract": False, }, bases=(parler.models.TranslatableModelMixin, models.Model), ), migrations.CreateModel( - name='NavigatorTranslation', + name="NavigatorTranslation", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('language_code', models.CharField(db_index=True, max_length=15, verbose_name='Language')), - ('name', models.CharField(max_length=120)), - ('cell', phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, null=True, region=None)), - ('email', models.EmailField(blank=True, max_length=254, null=True, verbose_name='email address')), - ('assistance_link', models.CharField(blank=True, max_length=320)), - ('description', models.TextField()), - ('master', parler.fields.TranslationsForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='programs.navigator')), - ('program', models.ManyToManyField(to='programs.program')), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("language_code", models.CharField(db_index=True, max_length=15, verbose_name="Language")), + ("name", models.CharField(max_length=120)), + ( + "cell", + phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, null=True, region=None), + ), + ("email", models.EmailField(blank=True, max_length=254, null=True, verbose_name="email address")), + ("assistance_link", models.CharField(blank=True, max_length=320)), + ("description", models.TextField()), + ( + "master", + parler.fields.TranslationsForeignKey( + editable=False, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="translations", + to="programs.navigator", + ), + ), + ("program", models.ManyToManyField(to="programs.program")), ], options={ - 'verbose_name': 'navigator Translation', - 'db_table': 'programs_navigator_translation', - 'db_tablespace': '', - 'managed': True, - 'default_permissions': (), - 'unique_together': {('language_code', 'master')}, + "verbose_name": "navigator Translation", + "db_table": "programs_navigator_translation", + "db_tablespace": "", + "managed": True, + "default_permissions": (), + "unique_together": {("language_code", "master")}, }, bases=(parler.models.TranslatedFieldsModelMixin, models.Model), ), diff --git a/programs/migrations/0018_alter_navigatortranslation_cell.py b/programs/migrations/0018_alter_navigatortranslation_cell.py index 3eb7fa8c..e6e872bc 100644 --- a/programs/migrations/0018_alter_navigatortranslation_cell.py +++ b/programs/migrations/0018_alter_navigatortranslation_cell.py @@ -5,15 +5,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0017_navigator_navigatortranslation'), + ("programs", "0017_navigator_navigatortranslation"), ] operations = [ migrations.AlterField( - model_name='navigatortranslation', - name='cell', + model_name="navigatortranslation", + name="cell", field=phonenumber_field.modelfields.PhoneNumberField(max_length=128, region=None), ), ] diff --git a/programs/migrations/0019_rename_cell_navigatortranslation_phone_number_and_more.py b/programs/migrations/0019_rename_cell_navigatortranslation_phone_number_and_more.py index d4f3441e..b9fdb878 100644 --- a/programs/migrations/0019_rename_cell_navigatortranslation_phone_number_and_more.py +++ b/programs/migrations/0019_rename_cell_navigatortranslation_phone_number_and_more.py @@ -4,20 +4,19 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0018_alter_navigatortranslation_cell'), + ("programs", "0018_alter_navigatortranslation_cell"), ] operations = [ migrations.RenameField( - model_name='navigatortranslation', - old_name='cell', - new_name='phone_number', + model_name="navigatortranslation", + old_name="cell", + new_name="phone_number", ), migrations.AlterField( - model_name='navigatortranslation', - name='program', - field=models.ManyToManyField(related_name='navigator', to='programs.program'), + model_name="navigatortranslation", + name="program", + field=models.ManyToManyField(related_name="navigator", to="programs.program"), ), ] diff --git a/programs/migrations/0020_remove_navigatortranslation_program.py b/programs/migrations/0020_remove_navigatortranslation_program.py index b1207a4e..9f588613 100644 --- a/programs/migrations/0020_remove_navigatortranslation_program.py +++ b/programs/migrations/0020_remove_navigatortranslation_program.py @@ -4,14 +4,13 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0019_rename_cell_navigatortranslation_phone_number_and_more'), + ("programs", "0019_rename_cell_navigatortranslation_phone_number_and_more"), ] operations = [ migrations.RemoveField( - model_name='navigatortranslation', - name='program', + model_name="navigatortranslation", + name="program", ), ] diff --git a/programs/migrations/0021_navigatortranslation_program.py b/programs/migrations/0021_navigatortranslation_program.py index 5d221ac3..39d84b79 100644 --- a/programs/migrations/0021_navigatortranslation_program.py +++ b/programs/migrations/0021_navigatortranslation_program.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0020_remove_navigatortranslation_program'), + ("programs", "0020_remove_navigatortranslation_program"), ] operations = [ migrations.AddField( - model_name='navigatortranslation', - name='program', - field=models.ManyToManyField(related_name='navigator', to='programs.program'), + model_name="navigatortranslation", + name="program", + field=models.ManyToManyField(related_name="navigator", to="programs.program"), ), ] diff --git a/programs/migrations/0022_remove_navigatortranslation_assistance_link_and_more.py b/programs/migrations/0022_remove_navigatortranslation_assistance_link_and_more.py index 1f5f1573..00f47829 100644 --- a/programs/migrations/0022_remove_navigatortranslation_assistance_link_and_more.py +++ b/programs/migrations/0022_remove_navigatortranslation_assistance_link_and_more.py @@ -5,42 +5,41 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0021_navigatortranslation_program'), + ("programs", "0021_navigatortranslation_program"), ] operations = [ migrations.RemoveField( - model_name='navigatortranslation', - name='assistance_link', + model_name="navigatortranslation", + name="assistance_link", ), migrations.RemoveField( - model_name='navigatortranslation', - name='email', + model_name="navigatortranslation", + name="email", ), migrations.RemoveField( - model_name='navigatortranslation', - name='phone_number', + model_name="navigatortranslation", + name="phone_number", ), migrations.RemoveField( - model_name='navigatortranslation', - name='program', + model_name="navigatortranslation", + name="program", ), migrations.AddField( - model_name='navigator', - name='email', - field=models.EmailField(blank=True, max_length=254, null=True, verbose_name='email address'), + model_name="navigator", + name="email", + field=models.EmailField(blank=True, max_length=254, null=True, verbose_name="email address"), ), migrations.AddField( - model_name='navigator', - name='phone_number', + model_name="navigator", + name="phone_number", field=phonenumber_field.modelfields.PhoneNumberField(default=0, max_length=128, region=None), preserve_default=False, ), migrations.AddField( - model_name='navigator', - name='program', - field=models.ManyToManyField(related_name='navigator', to='programs.program'), + model_name="navigator", + name="program", + field=models.ManyToManyField(related_name="navigator", to="programs.program"), ), ] diff --git a/programs/migrations/0023_navigator_assistance_link.py b/programs/migrations/0023_navigator_assistance_link.py index 7d1cf337..df4d1479 100644 --- a/programs/migrations/0023_navigator_assistance_link.py +++ b/programs/migrations/0023_navigator_assistance_link.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0022_remove_navigatortranslation_assistance_link_and_more'), + ("programs", "0022_remove_navigatortranslation_assistance_link_and_more"), ] operations = [ migrations.AddField( - model_name='navigator', - name='assistance_link', + model_name="navigator", + name="assistance_link", field=models.CharField(blank=True, max_length=320), ), ] diff --git a/programs/migrations/0024_remove_navigator_assistance_link_and_more.py b/programs/migrations/0024_remove_navigator_assistance_link_and_more.py index 7bc05b95..7d151426 100644 --- a/programs/migrations/0024_remove_navigator_assistance_link_and_more.py +++ b/programs/migrations/0024_remove_navigator_assistance_link_and_more.py @@ -5,37 +5,36 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0023_navigator_assistance_link'), + ("programs", "0023_navigator_assistance_link"), ] operations = [ migrations.RemoveField( - model_name='navigator', - name='assistance_link', + model_name="navigator", + name="assistance_link", ), migrations.RemoveField( - model_name='navigator', - name='email', + model_name="navigator", + name="email", ), migrations.RemoveField( - model_name='navigator', - name='phone_number', + model_name="navigator", + name="phone_number", ), migrations.AddField( - model_name='navigatortranslation', - name='assistance_link', + model_name="navigatortranslation", + name="assistance_link", field=models.CharField(blank=True, max_length=320), ), migrations.AddField( - model_name='navigatortranslation', - name='email', - field=models.EmailField(blank=True, max_length=254, null=True, verbose_name='email address'), + model_name="navigatortranslation", + name="email", + field=models.EmailField(blank=True, max_length=254, null=True, verbose_name="email address"), ), migrations.AddField( - model_name='navigatortranslation', - name='phone_number', + model_name="navigatortranslation", + name="phone_number", field=phonenumber_field.modelfields.PhoneNumberField(default=0, max_length=128, region=None), preserve_default=False, ), diff --git a/programs/migrations/0025_remove_navigatortranslation_phone_number_and_more.py b/programs/migrations/0025_remove_navigatortranslation_phone_number_and_more.py index 2953c949..6fdcabe2 100644 --- a/programs/migrations/0025_remove_navigatortranslation_phone_number_and_more.py +++ b/programs/migrations/0025_remove_navigatortranslation_phone_number_and_more.py @@ -5,19 +5,18 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0024_remove_navigator_assistance_link_and_more'), + ("programs", "0024_remove_navigator_assistance_link_and_more"), ] operations = [ migrations.RemoveField( - model_name='navigatortranslation', - name='phone_number', + model_name="navigatortranslation", + name="phone_number", ), migrations.AddField( - model_name='navigator', - name='phone_number', + model_name="navigator", + name="phone_number", field=phonenumber_field.modelfields.PhoneNumberField(default=0, max_length=128, region=None), preserve_default=False, ), diff --git a/programs/migrations/0026_remove_navigator_phone_number_and_more.py b/programs/migrations/0026_remove_navigator_phone_number_and_more.py index 32797317..4e89bcb4 100644 --- a/programs/migrations/0026_remove_navigator_phone_number_and_more.py +++ b/programs/migrations/0026_remove_navigator_phone_number_and_more.py @@ -5,19 +5,18 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0025_remove_navigatortranslation_phone_number_and_more'), + ("programs", "0025_remove_navigatortranslation_phone_number_and_more"), ] operations = [ migrations.RemoveField( - model_name='navigator', - name='phone_number', + model_name="navigator", + name="phone_number", ), migrations.AddField( - model_name='navigatortranslation', - name='phone_number', + model_name="navigatortranslation", + name="phone_number", field=phonenumber_field.modelfields.PhoneNumberField(default=0, max_length=128, region=None), preserve_default=False, ), diff --git a/programs/migrations/0027_remove_navigatortranslation_phone_number_and_more.py b/programs/migrations/0027_remove_navigatortranslation_phone_number_and_more.py index 955e8e1e..a1bd4920 100644 --- a/programs/migrations/0027_remove_navigatortranslation_phone_number_and_more.py +++ b/programs/migrations/0027_remove_navigatortranslation_phone_number_and_more.py @@ -5,19 +5,18 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0026_remove_navigator_phone_number_and_more'), + ("programs", "0026_remove_navigator_phone_number_and_more"), ] operations = [ migrations.RemoveField( - model_name='navigatortranslation', - name='phone_number', + model_name="navigatortranslation", + name="phone_number", ), migrations.AddField( - model_name='navigator', - name='phone_number', + model_name="navigator", + name="phone_number", field=phonenumber_field.modelfields.PhoneNumberField(default=0, max_length=128, region=None), preserve_default=False, ), diff --git a/programs/migrations/0028_alter_navigator_phone_number.py b/programs/migrations/0028_alter_navigator_phone_number.py index 7b057179..193f4ab6 100644 --- a/programs/migrations/0028_alter_navigator_phone_number.py +++ b/programs/migrations/0028_alter_navigator_phone_number.py @@ -5,15 +5,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0027_remove_navigatortranslation_phone_number_and_more'), + ("programs", "0027_remove_navigatortranslation_phone_number_and_more"), ] operations = [ migrations.AlterField( - model_name='navigator', - name='phone_number', + model_name="navigator", + name="phone_number", field=phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, null=True, region=None), ), ] diff --git a/programs/migrations/0029_programtranslation_catagory.py b/programs/migrations/0029_programtranslation_catagory.py index fdfd2b8e..7a222abd 100644 --- a/programs/migrations/0029_programtranslation_catagory.py +++ b/programs/migrations/0029_programtranslation_catagory.py @@ -4,16 +4,15 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0028_alter_navigator_phone_number'), + ("programs", "0028_alter_navigator_phone_number"), ] operations = [ migrations.AddField( - model_name='programtranslation', - name='catagory', - field=models.CharField(default='no category', max_length=120), + model_name="programtranslation", + name="catagory", + field=models.CharField(default="no category", max_length=120), preserve_default=False, ), ] diff --git a/programs/migrations/0030_rename_catagory_programtranslation_category.py b/programs/migrations/0030_rename_catagory_programtranslation_category.py index a8209894..92ff0fc3 100644 --- a/programs/migrations/0030_rename_catagory_programtranslation_category.py +++ b/programs/migrations/0030_rename_catagory_programtranslation_category.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0029_programtranslation_catagory'), + ("programs", "0029_programtranslation_catagory"), ] operations = [ migrations.RenameField( - model_name='programtranslation', - old_name='catagory', - new_name='category', + model_name="programtranslation", + old_name="catagory", + new_name="category", ), ] diff --git a/programs/migrations/0031_urgentneed_urgentneedtranslation.py b/programs/migrations/0031_urgentneed_urgentneedtranslation.py index c60f6554..f73c9765 100644 --- a/programs/migrations/0031_urgentneed_urgentneedtranslation.py +++ b/programs/migrations/0031_urgentneed_urgentneedtranslation.py @@ -8,43 +8,54 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0030_rename_catagory_programtranslation_category'), + ("programs", "0030_rename_catagory_programtranslation_category"), ] operations = [ migrations.CreateModel( - name='UrgentNeed', + name="UrgentNeed", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('phone_number', phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, null=True, region=None)), - ('type_short', models.CharField(max_length=120)), - ('active', models.BooleanField(blank=True, default=True)), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ( + "phone_number", + phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, null=True, region=None), + ), + ("type_short", models.CharField(max_length=120)), + ("active", models.BooleanField(blank=True, default=True)), ], options={ - 'abstract': False, + "abstract": False, }, bases=(parler.models.TranslatableModelMixin, models.Model), ), migrations.CreateModel( - name='UrgentNeedTranslation', + name="UrgentNeedTranslation", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('language_code', models.CharField(db_index=True, max_length=15, verbose_name='Language')), - ('name', models.CharField(max_length=120)), - ('description', models.TextField()), - ('link', models.CharField(max_length=320)), - ('type', models.CharField(max_length=120)), - ('master', parler.fields.TranslationsForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='programs.urgentneed')), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("language_code", models.CharField(db_index=True, max_length=15, verbose_name="Language")), + ("name", models.CharField(max_length=120)), + ("description", models.TextField()), + ("link", models.CharField(max_length=320)), + ("type", models.CharField(max_length=120)), + ( + "master", + parler.fields.TranslationsForeignKey( + editable=False, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="translations", + to="programs.urgentneed", + ), + ), ], options={ - 'verbose_name': 'urgent need Translation', - 'db_table': 'programs_urgentneed_translation', - 'db_tablespace': '', - 'managed': True, - 'default_permissions': (), - 'unique_together': {('language_code', 'master')}, + "verbose_name": "urgent need Translation", + "db_table": "programs_urgentneed_translation", + "db_tablespace": "", + "managed": True, + "default_permissions": (), + "unique_together": {("language_code", "master")}, }, bases=(parler.models.TranslatedFieldsModelMixin, models.Model), ), diff --git a/programs/migrations/0032_urgentneedfunction_urgentneed_functions.py b/programs/migrations/0032_urgentneedfunction_urgentneed_functions.py index 93264c67..4716ef84 100644 --- a/programs/migrations/0032_urgentneedfunction_urgentneed_functions.py +++ b/programs/migrations/0032_urgentneedfunction_urgentneed_functions.py @@ -4,22 +4,21 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0031_urgentneed_urgentneedtranslation'), + ("programs", "0031_urgentneed_urgentneedtranslation"), ] operations = [ migrations.CreateModel( - name='UrgentNeedFunction', + name="UrgentNeedFunction", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=32)), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("name", models.CharField(max_length=32)), ], ), migrations.AddField( - model_name='urgentneed', - name='functions', - field=models.ManyToManyField(related_name='function', to='programs.urgentneedfunction'), + model_name="urgentneed", + name="functions", + field=models.ManyToManyField(related_name="function", to="programs.urgentneedfunction"), ), ] diff --git a/programs/migrations/0033_alter_urgentneed_functions.py b/programs/migrations/0033_alter_urgentneed_functions.py index 660b3551..529a8d9c 100644 --- a/programs/migrations/0033_alter_urgentneed_functions.py +++ b/programs/migrations/0033_alter_urgentneed_functions.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0032_urgentneedfunction_urgentneed_functions'), + ("programs", "0032_urgentneedfunction_urgentneed_functions"), ] operations = [ migrations.AlterField( - model_name='urgentneed', - name='functions', - field=models.ManyToManyField(blank=True, related_name='function', to='programs.urgentneedfunction'), + model_name="urgentneed", + name="functions", + field=models.ManyToManyField(blank=True, related_name="function", to="programs.urgentneedfunction"), ), ] diff --git a/programs/migrations/0034_alter_urgentneedtranslation_link.py b/programs/migrations/0034_alter_urgentneedtranslation_link.py index f4f4c6b2..a0e64eb4 100644 --- a/programs/migrations/0034_alter_urgentneedtranslation_link.py +++ b/programs/migrations/0034_alter_urgentneedtranslation_link.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0033_alter_urgentneed_functions'), + ("programs", "0033_alter_urgentneed_functions"), ] operations = [ migrations.AlterField( - model_name='urgentneedtranslation', - name='link', + model_name="urgentneedtranslation", + name="link", field=models.CharField(blank=True, max_length=320, null=True), ), ] diff --git a/programs/migrations/0035_federalpoverylimit.py b/programs/migrations/0035_federalpoverylimit.py index 3b2dd758..7e2ae4af 100644 --- a/programs/migrations/0035_federalpoverylimit.py +++ b/programs/migrations/0035_federalpoverylimit.py @@ -4,25 +4,24 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0034_alter_urgentneedtranslation_link'), + ("programs", "0034_alter_urgentneedtranslation_link"), ] operations = [ migrations.CreateModel( - name='FederalPoveryLimit', + name="FederalPoveryLimit", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('year', models.CharField(max_length=32)), - ('has_1_person', models.IntegerField()), - ('has_2_person', models.IntegerField()), - ('has_3_person', models.IntegerField()), - ('has_4_person', models.IntegerField()), - ('has_5_person', models.IntegerField()), - ('has_6_person', models.IntegerField()), - ('has_7_person', models.IntegerField()), - ('has_8_person', models.IntegerField()), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("year", models.CharField(max_length=32)), + ("has_1_person", models.IntegerField()), + ("has_2_person", models.IntegerField()), + ("has_3_person", models.IntegerField()), + ("has_4_person", models.IntegerField()), + ("has_5_person", models.IntegerField()), + ("has_6_person", models.IntegerField()), + ("has_7_person", models.IntegerField()), + ("has_8_person", models.IntegerField()), ], ), ] diff --git a/programs/migrations/0036_rename_has_2_person_federalpoverylimit_has_2_people_and_more.py b/programs/migrations/0036_rename_has_2_person_federalpoverylimit_has_2_people_and_more.py index 0e6ced24..4b797788 100644 --- a/programs/migrations/0036_rename_has_2_person_federalpoverylimit_has_2_people_and_more.py +++ b/programs/migrations/0036_rename_has_2_person_federalpoverylimit_has_2_people_and_more.py @@ -4,45 +4,44 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0035_federalpoverylimit'), + ("programs", "0035_federalpoverylimit"), ] operations = [ migrations.RenameField( - model_name='federalpoverylimit', - old_name='has_2_person', - new_name='has_2_people', + model_name="federalpoverylimit", + old_name="has_2_person", + new_name="has_2_people", ), migrations.RenameField( - model_name='federalpoverylimit', - old_name='has_3_person', - new_name='has_3_people', + model_name="federalpoverylimit", + old_name="has_3_person", + new_name="has_3_people", ), migrations.RenameField( - model_name='federalpoverylimit', - old_name='has_4_person', - new_name='has_4_people', + model_name="federalpoverylimit", + old_name="has_4_person", + new_name="has_4_people", ), migrations.RenameField( - model_name='federalpoverylimit', - old_name='has_5_person', - new_name='has_5_people', + model_name="federalpoverylimit", + old_name="has_5_person", + new_name="has_5_people", ), migrations.RenameField( - model_name='federalpoverylimit', - old_name='has_6_person', - new_name='has_6_people', + model_name="federalpoverylimit", + old_name="has_6_person", + new_name="has_6_people", ), migrations.RenameField( - model_name='federalpoverylimit', - old_name='has_7_person', - new_name='has_7_people', + model_name="federalpoverylimit", + old_name="has_7_person", + new_name="has_7_people", ), migrations.RenameField( - model_name='federalpoverylimit', - old_name='has_8_person', - new_name='has_8_people', + model_name="federalpoverylimit", + old_name="has_8_person", + new_name="has_8_people", ), ] diff --git a/programs/migrations/0037_alter_federalpoverylimit_year.py b/programs/migrations/0037_alter_federalpoverylimit_year.py index 6ea0c297..c1b848a8 100644 --- a/programs/migrations/0037_alter_federalpoverylimit_year.py +++ b/programs/migrations/0037_alter_federalpoverylimit_year.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0036_rename_has_2_person_federalpoverylimit_has_2_people_and_more'), + ("programs", "0036_rename_has_2_person_federalpoverylimit_has_2_people_and_more"), ] operations = [ migrations.AlterField( - model_name='federalpoverylimit', - name='year', + model_name="federalpoverylimit", + name="year", field=models.CharField(max_length=32, unique=True), ), ] diff --git a/programs/migrations/0038_program_fpl.py b/programs/migrations/0038_program_fpl.py index 41bc791c..d55276b2 100644 --- a/programs/migrations/0038_program_fpl.py +++ b/programs/migrations/0038_program_fpl.py @@ -5,15 +5,20 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0037_alter_federalpoverylimit_year'), + ("programs", "0037_alter_federalpoverylimit_year"), ] operations = [ migrations.AddField( - model_name='program', - name='fpl', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='fpl', to='programs.federalpoverylimit'), + model_name="program", + name="fpl", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name="fpl", + to="programs.federalpoverylimit", + ), ), ] diff --git a/programs/migrations/0039_webhookfunction_referrer_referrertranslation.py b/programs/migrations/0039_webhookfunction_referrer_referrertranslation.py index 22f38634..94de0c56 100644 --- a/programs/migrations/0039_webhookfunction_referrer_referrertranslation.py +++ b/programs/migrations/0039_webhookfunction_referrer_referrertranslation.py @@ -7,52 +7,66 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0038_program_fpl'), + ("programs", "0038_program_fpl"), ] operations = [ migrations.CreateModel( - name='WebHookFunction', + name="WebHookFunction", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=64)), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("name", models.CharField(max_length=64)), ], ), migrations.CreateModel( - name='Referrer', + name="Referrer", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('referrer_code', models.CharField(max_length=64, unique=True)), - ('webhook_url', models.CharField(blank=True, max_length=320, null=True)), - ('logo', models.ImageField(upload_to='')), - ('white_label_css', models.FileField(upload_to='')), - ('primary_navigators', models.ManyToManyField(blank=True, related_name='primary_navigators', to='programs.navigator')), - ('webhook_functions', models.ManyToManyField(blank=True, related_name='web_hook', to='programs.webhookfunction')), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("referrer_code", models.CharField(max_length=64, unique=True)), + ("webhook_url", models.CharField(blank=True, max_length=320, null=True)), + ("logo", models.ImageField(upload_to="")), + ("white_label_css", models.FileField(upload_to="")), + ( + "primary_navigators", + models.ManyToManyField(blank=True, related_name="primary_navigators", to="programs.navigator"), + ), + ( + "webhook_functions", + models.ManyToManyField(blank=True, related_name="web_hook", to="programs.webhookfunction"), + ), ], options={ - 'abstract': False, + "abstract": False, }, bases=(parler.models.TranslatableModelMixin, models.Model), ), migrations.CreateModel( - name='ReferrerTranslation', + name="ReferrerTranslation", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('language_code', models.CharField(db_index=True, max_length=15, verbose_name='Language')), - ('header_html', models.FileField(upload_to='')), - ('footer_html', models.FileField(upload_to='')), - ('consent_text', models.TextField()), - ('master', parler.fields.TranslationsForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='programs.referrer')), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("language_code", models.CharField(db_index=True, max_length=15, verbose_name="Language")), + ("header_html", models.FileField(upload_to="")), + ("footer_html", models.FileField(upload_to="")), + ("consent_text", models.TextField()), + ( + "master", + parler.fields.TranslationsForeignKey( + editable=False, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="translations", + to="programs.referrer", + ), + ), ], options={ - 'verbose_name': 'referrer Translation', - 'db_table': 'programs_referrer_translation', - 'db_tablespace': '', - 'managed': True, - 'default_permissions': (), - 'unique_together': {('language_code', 'master')}, + "verbose_name": "referrer Translation", + "db_table": "programs_referrer_translation", + "db_tablespace": "", + "managed": True, + "default_permissions": (), + "unique_together": {("language_code", "master")}, }, bases=(parler.models.TranslatedFieldsModelMixin, models.Model), ), diff --git a/programs/migrations/0040_alter_referrer_logo_alter_referrer_white_label_css_and_more.py b/programs/migrations/0040_alter_referrer_logo_alter_referrer_white_label_css_and_more.py index 2994a8ab..2042297b 100644 --- a/programs/migrations/0040_alter_referrer_logo_alter_referrer_white_label_css_and_more.py +++ b/programs/migrations/0040_alter_referrer_logo_alter_referrer_white_label_css_and_more.py @@ -4,35 +4,34 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0039_webhookfunction_referrer_referrertranslation'), + ("programs", "0039_webhookfunction_referrer_referrertranslation"), ] operations = [ migrations.AlterField( - model_name='referrer', - name='logo', - field=models.ImageField(blank=True, null=True, upload_to=''), + model_name="referrer", + name="logo", + field=models.ImageField(blank=True, null=True, upload_to=""), ), migrations.AlterField( - model_name='referrer', - name='white_label_css', - field=models.FileField(blank=True, null=True, upload_to=''), + model_name="referrer", + name="white_label_css", + field=models.FileField(blank=True, null=True, upload_to=""), ), migrations.AlterField( - model_name='referrertranslation', - name='consent_text', + model_name="referrertranslation", + name="consent_text", field=models.TextField(blank=True, null=True), ), migrations.AlterField( - model_name='referrertranslation', - name='footer_html', - field=models.FileField(blank=True, null=True, upload_to=''), + model_name="referrertranslation", + name="footer_html", + field=models.FileField(blank=True, null=True, upload_to=""), ), migrations.AlterField( - model_name='referrertranslation', - name='header_html', - field=models.FileField(blank=True, null=True, upload_to=''), + model_name="referrertranslation", + name="header_html", + field=models.FileField(blank=True, null=True, upload_to=""), ), ] diff --git a/programs/migrations/0041_remove_referrer_logo_remove_referrer_white_label_css_and_more.py b/programs/migrations/0041_remove_referrer_logo_remove_referrer_white_label_css_and_more.py index 430d2054..5790c472 100644 --- a/programs/migrations/0041_remove_referrer_logo_remove_referrer_white_label_css_and_more.py +++ b/programs/migrations/0041_remove_referrer_logo_remove_referrer_white_label_css_and_more.py @@ -6,70 +6,115 @@ class Migration(migrations.Migration): dependencies = [ - ('translations', '0002_translation_active'), - ('programs', '0040_alter_referrer_logo_alter_referrer_white_label_css_and_more'), + ("translations", "0002_translation_active"), + ("programs", "0040_alter_referrer_logo_alter_referrer_white_label_css_and_more"), ] operations = [ migrations.RemoveField( - model_name='referrer', - name='logo', + model_name="referrer", + name="logo", ), migrations.RemoveField( - model_name='referrer', - name='white_label_css', + model_name="referrer", + name="white_label_css", ), migrations.AddField( - model_name='program', - name='active_1', + model_name="program", + name="active_1", field=models.BooleanField(blank=True, default=True, null=True), ), migrations.AddField( - model_name='program', - name='apply_button_link_1', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='apply_button_link', to='translations.translation'), + model_name="program", + name="apply_button_link_1", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="apply_button_link", + to="translations.translation", + ), ), migrations.AddField( - model_name='program', - name='category_1', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='category', to='translations.translation'), + model_name="program", + name="category_1", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="category", + to="translations.translation", + ), ), migrations.AddField( - model_name='program', - name='description_1', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='description', to='translations.translation'), + model_name="program", + name="description_1", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="description", + to="translations.translation", + ), ), migrations.AddField( - model_name='program', - name='description_short_1', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='description_short', to='translations.translation'), + model_name="program", + name="description_short_1", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="description_short", + to="translations.translation", + ), ), migrations.AddField( - model_name='program', - name='estimated_application_time_1', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='estimated_application_time', to='translations.translation'), + model_name="program", + name="estimated_application_time_1", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="estimated_application_time", + to="translations.translation", + ), ), migrations.AddField( - model_name='program', - name='estimated_delivery_time_1', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='estimated_delivery_time', to='translations.translation'), + model_name="program", + name="estimated_delivery_time_1", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="estimated_delivery_time", + to="translations.translation", + ), ), migrations.AddField( - model_name='program', - name='learn_more_link_1', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='learn_more_link', to='translations.translation'), + model_name="program", + name="learn_more_link_1", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="learn_more_link", + to="translations.translation", + ), ), migrations.AddField( - model_name='program', - name='name_1', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='name', to='translations.translation'), + model_name="program", + name="name_1", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="name", + to="translations.translation", + ), ), migrations.AddField( - model_name='program', - name='value_type_1', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='value_type', to='translations.translation'), + model_name="program", + name="value_type_1", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="value_type", + to="translations.translation", + ), ), migrations.DeleteModel( - name='ReferrerTranslation', + name="ReferrerTranslation", ), ] diff --git a/programs/migrations/0042_auto_20230905_1620.py b/programs/migrations/0042_auto_20230905_1620.py index c18ce108..30638b97 100644 --- a/programs/migrations/0042_auto_20230905_1620.py +++ b/programs/migrations/0042_auto_20230905_1620.py @@ -5,44 +5,44 @@ def migrate_translations(apps, schema_editor): - Program = apps.get_model('programs', 'Program') - Translation = apps.get_model('translations', 'Translation') + Program = apps.get_model("programs", "Program") + Translation = apps.get_model("translations", "Translation") translated_fields = ( - 'description_short', - 'name', - 'description', - 'learn_more_link', - 'apply_button_link', - 'value_type', - 'estimated_delivery_time', - 'estimated_application_time', - 'category', - ) - non_translated_fields = ( - 'active', - 'legal_status_required', - 'name_abbreviated' + "description_short", + "name", + "description", + "learn_more_link", + "apply_button_link", + "value_type", + "estimated_delivery_time", + "estimated_application_time", + "category", ) + non_translated_fields = ("active", "legal_status_required", "name_abbreviated") for program in Program.objects.all(): for field in translated_fields: - translation = Translation.objects.add_translation(f'program.{program.name_abbreviated}_{program.id}-{field}', getattr(program, field)) - setattr(program, field + '_1', translation) + translation = Translation.objects.add_translation( + f"program.{program.name_abbreviated}_{program.id}-{field}", getattr(program, field) + ) + setattr(program, field + "_1", translation) for lang in settings.PARLER_LANGUAGES[None]: - program.set_current_language(lang['code']) - Translation.objects.edit_translation(f'program.{program.name_abbreviated}_{program.id}-{field}', lang['code'], getattr(program, field), True) + program.set_current_language(lang["code"]) + Translation.objects.edit_translation( + f"program.{program.name_abbreviated}_{program.id}-{field}", + lang["code"], + getattr(program, field), + True, + ) for field in non_translated_fields: - setattr(program, field + '_1', getattr(program, field)) + setattr(program, field + "_1", getattr(program, field)) program.save() class Migration(migrations.Migration): - dependencies = [ - ('programs', '0041_remove_referrer_logo_remove_referrer_white_label_css_and_more'), - ('translations', '0003_alter_translation_managers'), + ("programs", "0041_remove_referrer_logo_remove_referrer_white_label_css_and_more"), + ("translations", "0003_alter_translation_managers"), ] - operations = [ - migrations.RunPython(migrate_translations) - ] + operations = [migrations.RunPython(migrate_translations)] diff --git a/programs/migrations/0043_auto_20230906_0938.py b/programs/migrations/0043_auto_20230906_0938.py index 9360c94f..7d90d3d9 100644 --- a/programs/migrations/0043_auto_20230906_0938.py +++ b/programs/migrations/0043_auto_20230906_0938.py @@ -4,34 +4,31 @@ def connect_translations(apps, schema_editor): - Program = apps.get_model('programs', 'Program') - Translation = apps.get_model('translations', 'Translation') + Program = apps.get_model("programs", "Program") + Translation = apps.get_model("translations", "Translation") translated_fields = ( - 'description_short', - 'name', - 'description', - 'learn_more_link', - 'apply_button_link', - 'value_type', - 'estimated_delivery_time', - 'estimated_application_time', - 'category', + "description_short", + "name", + "description", + "learn_more_link", + "apply_button_link", + "value_type", + "estimated_delivery_time", + "estimated_application_time", + "category", ) for program in Program.objects.all(): for field in translated_fields: - translation = Translation.objects.get(label=f'program.{program.name_abbreviated}_{program.id}-{field}') - setattr(program, field + '_1', translation) + translation = Translation.objects.get(label=f"program.{program.name_abbreviated}_{program.id}-{field}") + setattr(program, field + "_1", translation) program.save() class Migration(migrations.Migration): - dependencies = [ - ('programs', '0042_auto_20230905_1620'), - ('translations', '0003_alter_translation_managers'), + ("programs", "0042_auto_20230905_1620"), + ("translations", "0003_alter_translation_managers"), ] - operations = [ - migrations.RunPython(connect_translations) - ] + operations = [migrations.RunPython(connect_translations)] diff --git a/programs/migrations/0044_program_legal_status_required_1_and_more.py b/programs/migrations/0044_program_legal_status_required_1_and_more.py index 962a0610..2a6dfc61 100644 --- a/programs/migrations/0044_program_legal_status_required_1_and_more.py +++ b/programs/migrations/0044_program_legal_status_required_1_and_more.py @@ -4,20 +4,19 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0043_auto_20230906_0938'), + ("programs", "0043_auto_20230906_0938"), ] operations = [ migrations.AddField( - model_name='program', - name='legal_status_required_1', + model_name="program", + name="legal_status_required_1", field=models.CharField(max_length=120, null=True), ), migrations.AddField( - model_name='program', - name='name_abbreviated_1', + model_name="program", + name="name_abbreviated_1", field=models.CharField(max_length=120, null=True), ), ] diff --git a/programs/migrations/0045_auto_20230906_0951.py b/programs/migrations/0045_auto_20230906_0951.py index 8fe3bc9a..7b670181 100644 --- a/programs/migrations/0045_auto_20230906_0951.py +++ b/programs/migrations/0045_auto_20230906_0951.py @@ -4,25 +4,18 @@ def other_data_migrations(apps, _): - Program = apps.get_model('programs', 'Program') + Program = apps.get_model("programs", "Program") - non_translated_fields = ( - 'active', - 'legal_status_required', - 'name_abbreviated' - ) + non_translated_fields = ("active", "legal_status_required", "name_abbreviated") for program in Program.objects.all(): for field in non_translated_fields: - setattr(program, field + '_1', getattr(program, field)) + setattr(program, field + "_1", getattr(program, field)) program.save() class Migration(migrations.Migration): - dependencies = [ - ('programs', '0044_program_legal_status_required_1_and_more'), + ("programs", "0044_program_legal_status_required_1_and_more"), ] - operations = [ - migrations.RunPython(other_data_migrations) - ] + operations = [migrations.RunPython(other_data_migrations)] diff --git a/programs/migrations/0046_delete_programtranslation.py b/programs/migrations/0046_delete_programtranslation.py index 7b925bd8..d72732d6 100644 --- a/programs/migrations/0046_delete_programtranslation.py +++ b/programs/migrations/0046_delete_programtranslation.py @@ -4,13 +4,12 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0045_auto_20230906_0951'), + ("programs", "0045_auto_20230906_0951"), ] operations = [ migrations.DeleteModel( - name='ProgramTranslation', + name="ProgramTranslation", ), ] diff --git a/programs/migrations/0047_alter_program_active_1_and_more.py b/programs/migrations/0047_alter_program_active_1_and_more.py index 2fc46273..c1312984 100644 --- a/programs/migrations/0047_alter_program_active_1_and_more.py +++ b/programs/migrations/0047_alter_program_active_1_and_more.py @@ -5,71 +5,98 @@ class Migration(migrations.Migration): - dependencies = [ - ('translations', '0003_alter_translation_managers'), - ('programs', '0046_delete_programtranslation'), + ("translations", "0003_alter_translation_managers"), + ("programs", "0046_delete_programtranslation"), ] operations = [ migrations.AlterField( - model_name='program', - name='active_1', + model_name="program", + name="active_1", field=models.BooleanField(blank=True, default=True), ), migrations.AlterField( - model_name='program', - name='apply_button_link_1', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='apply_button_link', to='translations.translation'), + model_name="program", + name="apply_button_link_1", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="apply_button_link", + to="translations.translation", + ), ), migrations.AlterField( - model_name='program', - name='category_1', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='category', to='translations.translation'), + model_name="program", + name="category_1", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, related_name="category", to="translations.translation" + ), ), migrations.AlterField( - model_name='program', - name='description_1', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='description', to='translations.translation'), + model_name="program", + name="description_1", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, related_name="description", to="translations.translation" + ), ), migrations.AlterField( - model_name='program', - name='description_short_1', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='description_short', to='translations.translation'), + model_name="program", + name="description_short_1", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="description_short", + to="translations.translation", + ), ), migrations.AlterField( - model_name='program', - name='estimated_application_time_1', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='estimated_application_time', to='translations.translation'), + model_name="program", + name="estimated_application_time_1", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="estimated_application_time", + to="translations.translation", + ), ), migrations.AlterField( - model_name='program', - name='estimated_delivery_time_1', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='estimated_delivery_time', to='translations.translation'), + model_name="program", + name="estimated_delivery_time_1", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="estimated_delivery_time", + to="translations.translation", + ), ), migrations.AlterField( - model_name='program', - name='learn_more_link_1', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='learn_more_link', to='translations.translation'), + model_name="program", + name="learn_more_link_1", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="learn_more_link", + to="translations.translation", + ), ), migrations.AlterField( - model_name='program', - name='legal_status_required_1', + model_name="program", + name="legal_status_required_1", field=models.CharField(max_length=120), ), migrations.AlterField( - model_name='program', - name='name_1', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='name', to='translations.translation'), + model_name="program", + name="name_1", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, related_name="name", to="translations.translation" + ), ), migrations.AlterField( - model_name='program', - name='name_abbreviated_1', + model_name="program", + name="name_abbreviated_1", field=models.CharField(max_length=120), ), migrations.AlterField( - model_name='program', - name='value_type_1', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='value_type', to='translations.translation'), + model_name="program", + name="value_type_1", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, related_name="value_type", to="translations.translation" + ), ), ] diff --git a/programs/migrations/0048_rename_active_1_program_active_and_more.py b/programs/migrations/0048_rename_active_1_program_active_and_more.py index 7bec3c84..fd66ea2b 100644 --- a/programs/migrations/0048_rename_active_1_program_active_and_more.py +++ b/programs/migrations/0048_rename_active_1_program_active_and_more.py @@ -4,70 +4,69 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0047_alter_program_active_1_and_more'), + ("programs", "0047_alter_program_active_1_and_more"), ] operations = [ migrations.RenameField( - model_name='program', - old_name='active_1', - new_name='active', + model_name="program", + old_name="active_1", + new_name="active", ), migrations.RenameField( - model_name='program', - old_name='apply_button_link_1', - new_name='apply_button_link', + model_name="program", + old_name="apply_button_link_1", + new_name="apply_button_link", ), migrations.RenameField( - model_name='program', - old_name='category_1', - new_name='category', + model_name="program", + old_name="category_1", + new_name="category", ), migrations.RenameField( - model_name='program', - old_name='description_1', - new_name='description', + model_name="program", + old_name="description_1", + new_name="description", ), migrations.RenameField( - model_name='program', - old_name='description_short_1', - new_name='description_short', + model_name="program", + old_name="description_short_1", + new_name="description_short", ), migrations.RenameField( - model_name='program', - old_name='estimated_application_time_1', - new_name='estimated_application_time', + model_name="program", + old_name="estimated_application_time_1", + new_name="estimated_application_time", ), migrations.RenameField( - model_name='program', - old_name='estimated_delivery_time_1', - new_name='estimated_delivery_time', + model_name="program", + old_name="estimated_delivery_time_1", + new_name="estimated_delivery_time", ), migrations.RenameField( - model_name='program', - old_name='learn_more_link_1', - new_name='learn_more_link', + model_name="program", + old_name="learn_more_link_1", + new_name="learn_more_link", ), migrations.RenameField( - model_name='program', - old_name='legal_status_required_1', - new_name='legal_status_required', + model_name="program", + old_name="legal_status_required_1", + new_name="legal_status_required", ), migrations.RenameField( - model_name='program', - old_name='name_1', - new_name='name', + model_name="program", + old_name="name_1", + new_name="name", ), migrations.RenameField( - model_name='program', - old_name='name_abbreviated_1', - new_name='name_abbreviated', + model_name="program", + old_name="name_abbreviated_1", + new_name="name_abbreviated", ), migrations.RenameField( - model_name='program', - old_name='value_type_1', - new_name='value_type', + model_name="program", + old_name="value_type_1", + new_name="value_type", ), ] diff --git a/programs/migrations/0049_navigator_assistance_link_1_navigator_description_1_and_more.py b/programs/migrations/0049_navigator_assistance_link_1_navigator_description_1_and_more.py index 206e9e9d..c6550838 100644 --- a/programs/migrations/0049_navigator_assistance_link_1_navigator_description_1_and_more.py +++ b/programs/migrations/0049_navigator_assistance_link_1_navigator_description_1_and_more.py @@ -5,96 +5,177 @@ class Migration(migrations.Migration): - dependencies = [ - ('translations', '0003_alter_translation_managers'), - ('programs', '0048_rename_active_1_program_active_and_more'), + ("translations", "0003_alter_translation_managers"), + ("programs", "0048_rename_active_1_program_active_and_more"), ] operations = [ migrations.AddField( - model_name='navigator', - name='assistance_link_1', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='navigator_assistance_link', to='translations.translation'), + model_name="navigator", + name="assistance_link_1", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="navigator_assistance_link", + to="translations.translation", + ), ), migrations.AddField( - model_name='navigator', - name='description_1', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='navigator_name_description', to='translations.translation'), + model_name="navigator", + name="description_1", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="navigator_name_description", + to="translations.translation", + ), ), migrations.AddField( - model_name='navigator', - name='email_1', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='navigator_email', to='translations.translation'), + model_name="navigator", + name="email_1", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="navigator_email", + to="translations.translation", + ), ), migrations.AddField( - model_name='navigator', - name='name_1', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='navigator_name', to='translations.translation'), + model_name="navigator", + name="name_1", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="navigator_name", + to="translations.translation", + ), ), migrations.AddField( - model_name='urgentneed', - name='description_1', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='urgent_need_description', to='translations.translation'), + model_name="urgentneed", + name="description_1", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="urgent_need_description", + to="translations.translation", + ), ), migrations.AddField( - model_name='urgentneed', - name='link_1', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='urgent_need_link', to='translations.translation'), + model_name="urgentneed", + name="link_1", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="urgent_need_link", + to="translations.translation", + ), ), migrations.AddField( - model_name='urgentneed', - name='name_1', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='urgent_need_name', to='translations.translation'), + model_name="urgentneed", + name="name_1", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="urgent_need_name", + to="translations.translation", + ), ), migrations.AddField( - model_name='urgentneed', - name='type_1', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='urgent_need_type', to='translations.translation'), + model_name="urgentneed", + name="type_1", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="urgent_need_type", + to="translations.translation", + ), ), migrations.AlterField( - model_name='program', - name='apply_button_link', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='program_apply_button_link', to='translations.translation'), + model_name="program", + name="apply_button_link", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="program_apply_button_link", + to="translations.translation", + ), ), migrations.AlterField( - model_name='program', - name='category', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='program_category', to='translations.translation'), + model_name="program", + name="category", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="program_category", + to="translations.translation", + ), ), migrations.AlterField( - model_name='program', - name='description', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='program_description', to='translations.translation'), + model_name="program", + name="description", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="program_description", + to="translations.translation", + ), ), migrations.AlterField( - model_name='program', - name='description_short', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='program_description_short', to='translations.translation'), + model_name="program", + name="description_short", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="program_description_short", + to="translations.translation", + ), ), migrations.AlterField( - model_name='program', - name='estimated_application_time', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='program_estimated_application_time', to='translations.translation'), + model_name="program", + name="estimated_application_time", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="program_estimated_application_time", + to="translations.translation", + ), ), migrations.AlterField( - model_name='program', - name='estimated_delivery_time', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='program_estimated_delivery_time', to='translations.translation'), + model_name="program", + name="estimated_delivery_time", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="program_estimated_delivery_time", + to="translations.translation", + ), ), migrations.AlterField( - model_name='program', - name='learn_more_link', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='program_learn_more_link', to='translations.translation'), + model_name="program", + name="learn_more_link", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="program_learn_more_link", + to="translations.translation", + ), ), migrations.AlterField( - model_name='program', - name='name', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='program_name', to='translations.translation'), + model_name="program", + name="name", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, related_name="program_name", to="translations.translation" + ), ), migrations.AlterField( - model_name='program', - name='value_type', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='program_value_type', to='translations.translation'), + model_name="program", + name="value_type", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="program_value_type", + to="translations.translation", + ), ), ] diff --git a/programs/migrations/0050_auto_20230906_1427.py b/programs/migrations/0050_auto_20230906_1427.py index 6a7e0494..f753e67e 100644 --- a/programs/migrations/0050_auto_20230906_1427.py +++ b/programs/migrations/0050_auto_20230906_1427.py @@ -5,52 +5,59 @@ def urgent_need_migrations(apps, _): - UrgentNeed = apps.get_model('programs', 'UrgentNeed') - Translation = apps.get_model('translations', 'Translation') + UrgentNeed = apps.get_model("programs", "UrgentNeed") + Translation = apps.get_model("translations", "Translation") translated_fields = ( - 'name', - 'description', - 'link', - 'type', + "name", + "description", + "link", + "type", ) for urgent_need in UrgentNeed.objects.all(): main_name = urgent_need.name for field in translated_fields: - translation = Translation.objects.add_translation(f'urgent_need.{main_name}_{urgent_need.id}-{field}', getattr(urgent_need, field)) - setattr(urgent_need, field + '_1', translation) + translation = Translation.objects.add_translation( + f"urgent_need.{main_name}_{urgent_need.id}-{field}", getattr(urgent_need, field) + ) + setattr(urgent_need, field + "_1", translation) for lang in settings.PARLER_LANGUAGES[None]: - urgent_need.set_current_language(lang['code']) - Translation.objects.edit_translation(f'urgent_need.{main_name}_{urgent_need.id}-{field}', lang['code'], getattr(urgent_need, field), True) + urgent_need.set_current_language(lang["code"]) + Translation.objects.edit_translation( + f"urgent_need.{main_name}_{urgent_need.id}-{field}", lang["code"], getattr(urgent_need, field), True + ) urgent_need.save() def navigator_migrations(apps, _): - Navigator = apps.get_model('programs', 'Navigator') - Translation = apps.get_model('translations', 'Translation') + Navigator = apps.get_model("programs", "Navigator") + Translation = apps.get_model("translations", "Translation") translated_fields = ( - 'name', - 'email', - 'assistance_link', - 'description', + "name", + "email", + "assistance_link", + "description", ) for navigator in Navigator.objects.all(): main_name = navigator.name for field in translated_fields: - translation = Translation.objects.add_translation(f'navigator.{main_name}_{navigator.id}-{field}', getattr(navigator, field)) - setattr(navigator, field + '_1', translation) + translation = Translation.objects.add_translation( + f"navigator.{main_name}_{navigator.id}-{field}", getattr(navigator, field) + ) + setattr(navigator, field + "_1", translation) for lang in settings.PARLER_LANGUAGES[None]: - navigator.set_current_language(lang['code']) - Translation.objects.edit_translation(f'navigator.{main_name}_{navigator.id}-{field}', lang['code'], getattr(navigator, field), True) + navigator.set_current_language(lang["code"]) + Translation.objects.edit_translation( + f"navigator.{main_name}_{navigator.id}-{field}", lang["code"], getattr(navigator, field), True + ) navigator.save() class Migration(migrations.Migration): - dependencies = [ - ('programs', '0049_navigator_assistance_link_1_navigator_description_1_and_more'), - ('translations', '0003_alter_translation_managers'), + ("programs", "0049_navigator_assistance_link_1_navigator_description_1_and_more"), + ("translations", "0003_alter_translation_managers"), ] operations = [ diff --git a/programs/migrations/0051_alter_urgentneedtranslation_unique_together_and_more.py b/programs/migrations/0051_alter_urgentneedtranslation_unique_together_and_more.py index c00907f1..bc62b8c7 100644 --- a/programs/migrations/0051_alter_urgentneedtranslation_unique_together_and_more.py +++ b/programs/migrations/0051_alter_urgentneedtranslation_unique_together_and_more.py @@ -4,24 +4,23 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0050_auto_20230906_1427'), + ("programs", "0050_auto_20230906_1427"), ] operations = [ migrations.AlterUniqueTogether( - name='urgentneedtranslation', + name="urgentneedtranslation", unique_together=None, ), migrations.RemoveField( - model_name='urgentneedtranslation', - name='master', + model_name="urgentneedtranslation", + name="master", ), migrations.DeleteModel( - name='NavigatorTranslation', + name="NavigatorTranslation", ), migrations.DeleteModel( - name='UrgentNeedTranslation', + name="UrgentNeedTranslation", ), ] diff --git a/programs/migrations/0052_alter_navigator_assistance_link_1_and_more.py b/programs/migrations/0052_alter_navigator_assistance_link_1_and_more.py index 865c43c9..73e8c3ee 100644 --- a/programs/migrations/0052_alter_navigator_assistance_link_1_and_more.py +++ b/programs/migrations/0052_alter_navigator_assistance_link_1_and_more.py @@ -5,51 +5,82 @@ class Migration(migrations.Migration): - dependencies = [ - ('translations', '0003_alter_translation_managers'), - ('programs', '0051_alter_urgentneedtranslation_unique_together_and_more'), + ("translations", "0003_alter_translation_managers"), + ("programs", "0051_alter_urgentneedtranslation_unique_together_and_more"), ] operations = [ migrations.AlterField( - model_name='navigator', - name='assistance_link_1', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='navigator_assistance_link', to='translations.translation'), + model_name="navigator", + name="assistance_link_1", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="navigator_assistance_link", + to="translations.translation", + ), ), migrations.AlterField( - model_name='navigator', - name='description_1', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='navigator_name_description', to='translations.translation'), + model_name="navigator", + name="description_1", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="navigator_name_description", + to="translations.translation", + ), ), migrations.AlterField( - model_name='navigator', - name='email_1', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='navigator_email', to='translations.translation'), + model_name="navigator", + name="email_1", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="navigator_email", + to="translations.translation", + ), ), migrations.AlterField( - model_name='navigator', - name='name_1', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='navigator_name', to='translations.translation'), + model_name="navigator", + name="name_1", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="navigator_name", + to="translations.translation", + ), ), migrations.AlterField( - model_name='urgentneed', - name='description_1', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='urgent_need_description', to='translations.translation'), + model_name="urgentneed", + name="description_1", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="urgent_need_description", + to="translations.translation", + ), ), migrations.AlterField( - model_name='urgentneed', - name='link_1', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='urgent_need_link', to='translations.translation'), + model_name="urgentneed", + name="link_1", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="urgent_need_link", + to="translations.translation", + ), ), migrations.AlterField( - model_name='urgentneed', - name='name_1', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='urgent_need_name', to='translations.translation'), + model_name="urgentneed", + name="name_1", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="urgent_need_name", + to="translations.translation", + ), ), migrations.AlterField( - model_name='urgentneed', - name='type_1', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='urgent_need_type', to='translations.translation'), + model_name="urgentneed", + name="type_1", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="urgent_need_type", + to="translations.translation", + ), ), ] diff --git a/programs/migrations/0053_rename_assistance_link_1_navigator_assistance_link_and_more.py b/programs/migrations/0053_rename_assistance_link_1_navigator_assistance_link_and_more.py index cb2bd7bc..3595687a 100644 --- a/programs/migrations/0053_rename_assistance_link_1_navigator_assistance_link_and_more.py +++ b/programs/migrations/0053_rename_assistance_link_1_navigator_assistance_link_and_more.py @@ -4,50 +4,49 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0052_alter_navigator_assistance_link_1_and_more'), + ("programs", "0052_alter_navigator_assistance_link_1_and_more"), ] operations = [ migrations.RenameField( - model_name='navigator', - old_name='assistance_link_1', - new_name='assistance_link', + model_name="navigator", + old_name="assistance_link_1", + new_name="assistance_link", ), migrations.RenameField( - model_name='navigator', - old_name='description_1', - new_name='description', + model_name="navigator", + old_name="description_1", + new_name="description", ), migrations.RenameField( - model_name='navigator', - old_name='email_1', - new_name='email', + model_name="navigator", + old_name="email_1", + new_name="email", ), migrations.RenameField( - model_name='navigator', - old_name='name_1', - new_name='name', + model_name="navigator", + old_name="name_1", + new_name="name", ), migrations.RenameField( - model_name='urgentneed', - old_name='description_1', - new_name='description', + model_name="urgentneed", + old_name="description_1", + new_name="description", ), migrations.RenameField( - model_name='urgentneed', - old_name='link_1', - new_name='link', + model_name="urgentneed", + old_name="link_1", + new_name="link", ), migrations.RenameField( - model_name='urgentneed', - old_name='name_1', - new_name='name', + model_name="urgentneed", + old_name="name_1", + new_name="name", ), migrations.RenameField( - model_name='urgentneed', - old_name='type_1', - new_name='type', + model_name="urgentneed", + old_name="type_1", + new_name="type", ), ] diff --git a/programs/migrations/0054_navigator_external_name_program_external_name_and_more.py b/programs/migrations/0054_navigator_external_name_program_external_name_and_more.py index a76fd8d9..2900d027 100644 --- a/programs/migrations/0054_navigator_external_name_program_external_name_and_more.py +++ b/programs/migrations/0054_navigator_external_name_program_external_name_and_more.py @@ -4,25 +4,24 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0053_rename_assistance_link_1_navigator_assistance_link_and_more'), + ("programs", "0053_rename_assistance_link_1_navigator_assistance_link_and_more"), ] operations = [ migrations.AddField( - model_name='navigator', - name='external_name', + model_name="navigator", + name="external_name", field=models.CharField(max_length=120, null=True, unique=True), ), migrations.AddField( - model_name='program', - name='external_name', + model_name="program", + name="external_name", field=models.CharField(max_length=120, null=True, unique=True), ), migrations.AddField( - model_name='urgentneed', - name='external_name', + model_name="urgentneed", + name="external_name", field=models.CharField(max_length=120, null=True, unique=True), ), ] diff --git a/programs/migrations/0055_alter_navigator_external_name_and_more.py b/programs/migrations/0055_alter_navigator_external_name_and_more.py index 941c9468..56bc4415 100644 --- a/programs/migrations/0055_alter_navigator_external_name_and_more.py +++ b/programs/migrations/0055_alter_navigator_external_name_and_more.py @@ -4,25 +4,24 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0054_navigator_external_name_program_external_name_and_more'), + ("programs", "0054_navigator_external_name_program_external_name_and_more"), ] operations = [ migrations.AlterField( - model_name='navigator', - name='external_name', + model_name="navigator", + name="external_name", field=models.CharField(blank=True, max_length=120, null=True, unique=True), ), migrations.AlterField( - model_name='program', - name='external_name', + model_name="program", + name="external_name", field=models.CharField(blank=True, max_length=120, null=True, unique=True), ), migrations.AlterField( - model_name='urgentneed', - name='external_name', + model_name="urgentneed", + name="external_name", field=models.CharField(blank=True, max_length=120, null=True, unique=True), ), ] diff --git a/programs/migrations/0056_urgentneedcategory_remove_urgentneed_type_short_and_more.py b/programs/migrations/0056_urgentneedcategory_remove_urgentneed_type_short_and_more.py index 9f7f540b..79f7af3d 100644 --- a/programs/migrations/0056_urgentneedcategory_remove_urgentneed_type_short_and_more.py +++ b/programs/migrations/0056_urgentneedcategory_remove_urgentneed_type_short_and_more.py @@ -4,26 +4,25 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0055_alter_navigator_external_name_and_more'), + ("programs", "0055_alter_navigator_external_name_and_more"), ] operations = [ migrations.CreateModel( - name='UrgentNeedCategory', + name="UrgentNeedCategory", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=120)), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("name", models.CharField(max_length=120)), ], ), migrations.RemoveField( - model_name='urgentneed', - name='type_short', + model_name="urgentneed", + name="type_short", ), migrations.AddField( - model_name='urgentneed', - name='type_short', - field=models.ManyToManyField(related_name='type_short', to='programs.urgentneedcategory'), + model_name="urgentneed", + name="type_short", + field=models.ManyToManyField(related_name="type_short", to="programs.urgentneedcategory"), ), ] diff --git a/programs/migrations/0057_alter_urgentneedcategory_options_and_more.py b/programs/migrations/0057_alter_urgentneedcategory_options_and_more.py index ce202af1..5dc54ad4 100644 --- a/programs/migrations/0057_alter_urgentneedcategory_options_and_more.py +++ b/programs/migrations/0057_alter_urgentneedcategory_options_and_more.py @@ -5,31 +5,39 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0056_urgentneedcategory_remove_urgentneed_type_short_and_more'), + ("programs", "0056_urgentneedcategory_remove_urgentneed_type_short_and_more"), ] operations = [ migrations.AlterModelOptions( - name='urgentneedcategory', - options={'verbose_name_plural': 'Urgent Need Categories'}, + name="urgentneedcategory", + options={"verbose_name_plural": "Urgent Need Categories"}, ), migrations.RemoveField( - model_name='program', - name='legal_status_required', + model_name="program", + name="legal_status_required", ), migrations.AlterField( - model_name='urgentneed', - name='type_short', - field=models.ManyToManyField(related_name='urgent_needs', to='programs.urgentneedcategory'), + model_name="urgentneed", + name="type_short", + field=models.ManyToManyField(related_name="urgent_needs", to="programs.urgentneedcategory"), ), migrations.CreateModel( - name='LegalStatus', + name="LegalStatus", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('status', models.CharField(max_length=256)), - ('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='children', to='programs.legalstatus')), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("status", models.CharField(max_length=256)), + ( + "parent", + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name="children", + to="programs.legalstatus", + ), + ), ], ), ] diff --git a/programs/migrations/0058_program_legal_status_required.py b/programs/migrations/0058_program_legal_status_required.py index 16b01d6b..5653cdbb 100644 --- a/programs/migrations/0058_program_legal_status_required.py +++ b/programs/migrations/0058_program_legal_status_required.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0057_alter_urgentneedcategory_options_and_more'), + ("programs", "0057_alter_urgentneedcategory_options_and_more"), ] operations = [ migrations.AddField( - model_name='program', - name='legal_status_required', - field=models.ManyToManyField(related_name='programs', to='programs.legalstatus'), + model_name="program", + name="legal_status_required", + field=models.ManyToManyField(related_name="programs", to="programs.legalstatus"), ), ] diff --git a/programs/migrations/0059_alter_program_legal_status_required.py b/programs/migrations/0059_alter_program_legal_status_required.py index 7513d4f5..81f1e4e1 100644 --- a/programs/migrations/0059_alter_program_legal_status_required.py +++ b/programs/migrations/0059_alter_program_legal_status_required.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0058_program_legal_status_required'), + ("programs", "0058_program_legal_status_required"), ] operations = [ migrations.AlterField( - model_name='program', - name='legal_status_required', - field=models.ManyToManyField(blank=True, related_name='programs', to='programs.legalstatus'), + model_name="program", + name="legal_status_required", + field=models.ManyToManyField(blank=True, related_name="programs", to="programs.legalstatus"), ), ] diff --git a/programs/migrations/0060_alter_navigator_program.py b/programs/migrations/0060_alter_navigator_program.py index bf16d611..d2790a19 100644 --- a/programs/migrations/0060_alter_navigator_program.py +++ b/programs/migrations/0060_alter_navigator_program.py @@ -12,8 +12,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name="navigator", name="program", - field=models.ManyToManyField( - blank=True, related_name="navigator", to="programs.program" - ), + field=models.ManyToManyField(blank=True, related_name="navigator", to="programs.program"), ), ] diff --git a/programs/migrations/0061_referrer_remove_programs.py b/programs/migrations/0061_referrer_remove_programs.py index fd76f695..8fd80118 100644 --- a/programs/migrations/0061_referrer_remove_programs.py +++ b/programs/migrations/0061_referrer_remove_programs.py @@ -12,8 +12,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name="referrer", name="remove_programs", - field=models.ManyToManyField( - blank=True, related_name="removed_programs", to="programs.program" - ), + field=models.ManyToManyField(blank=True, related_name="removed_programs", to="programs.program"), ), ] diff --git a/programs/migrations/0062_document_program_documents.py b/programs/migrations/0062_document_program_documents.py index f62a9659..217a5457 100644 --- a/programs/migrations/0062_document_program_documents.py +++ b/programs/migrations/0062_document_program_documents.py @@ -37,8 +37,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name="program", name="documents", - field=models.ManyToManyField( - blank=True, related_name="program_documents", to="programs.document" - ), + field=models.ManyToManyField(blank=True, related_name="program_documents", to="programs.document"), ), ] diff --git a/programs/migrations/0062_navigatorcounties_navigator_counties.py b/programs/migrations/0062_navigatorcounties_navigator_counties.py index b0212add..df2da244 100644 --- a/programs/migrations/0062_navigatorcounties_navigator_counties.py +++ b/programs/migrations/0062_navigatorcounties_navigator_counties.py @@ -27,8 +27,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name="navigator", name="counties", - field=models.ManyToManyField( - blank=True, related_name="navigator", to="programs.navigatorcounties" - ), + field=models.ManyToManyField(blank=True, related_name="navigator", to="programs.navigatorcounties"), ), ] diff --git a/programs/migrations/0063_navigatorcounty_delete_navigatorcounties_and_more.py b/programs/migrations/0063_navigatorcounty_delete_navigatorcounties_and_more.py index dcf1a554..1f146ef6 100644 --- a/programs/migrations/0063_navigatorcounty_delete_navigatorcounties_and_more.py +++ b/programs/migrations/0063_navigatorcounty_delete_navigatorcounties_and_more.py @@ -30,8 +30,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name="navigator", name="counties", - field=models.ManyToManyField( - blank=True, related_name="navigator", to="programs.navigatorcounty" - ), + field=models.ManyToManyField(blank=True, related_name="navigator", to="programs.navigatorcounty"), ), ] diff --git a/programs/migrations/0066_auto_20240130_1146.py b/programs/migrations/0066_auto_20240130_1146.py index fde4ea86..7ff778d7 100644 --- a/programs/migrations/0066_auto_20240130_1146.py +++ b/programs/migrations/0066_auto_20240130_1146.py @@ -4,19 +4,17 @@ def add_warning(apps, schema_editor): - Program = apps.get_model('programs', 'Program') - UrgentNeed = apps.get_model('programs', 'UrgentNeed') - Translation = apps.get_model('translations', 'Translation') + Program = apps.get_model("programs", "Program") + UrgentNeed = apps.get_model("programs", "UrgentNeed") + Translation = apps.get_model("translations", "Translation") for need in UrgentNeed.objects.all(): - translation = Translation.objects.add_translation( - f'urgent_need.{need.name.text}-{need.id}_warning', '' - ) + translation = Translation.objects.add_translation(f"urgent_need.{need.name.text}-{need.id}_warning", "") UrgentNeed.objects.filter(pk=need.id).update(warning=translation.id) for program in Program.objects.all(): translation = Translation.objects.add_translation( - f'programs.{program.name_abbreviated}-{program.id}_warning', '' + f"programs.{program.name_abbreviated}-{program.id}_warning", "" ) Program.objects.filter(pk=program.id).update(warning=translation.id) diff --git a/programs/models.py b/programs/models.py index 7c54254c..147a8354 100644 --- a/programs/models.py +++ b/programs/models.py @@ -34,26 +34,21 @@ def __str__(self): class LegalStatus(models.Model): status = models.CharField(max_length=256) - parent = models.ForeignKey('self', related_name='children', blank=True, null=True, on_delete=models.SET_NULL) + parent = models.ForeignKey("self", related_name="children", blank=True, null=True, on_delete=models.SET_NULL) def __str__(self): return self.status class DocumentManager(models.Manager): - translated_fields = ('text',) + translated_fields = ("text",) def new_document(self, external_name): - translation = Translation.objects.add_translation( - f'document.{external_name}_temporary_key', '' - ) + translation = Translation.objects.add_translation(f"document.{external_name}_temporary_key", "") - document = self.create( - external_name=external_name, - text=translation - ) + document = self.create(external_name=external_name, text=translation) - translation.label = f'document.{external_name}_{document.id}' + translation.label = f"document.{external_name}_{document.id}" translation.save() return document @@ -61,7 +56,7 @@ def new_document(self, external_name): class Document(models.Model): external_name = models.CharField(max_length=120, blank=True, null=True, unique=True) - text = models.ForeignKey(Translation, related_name='documents', blank=False, null=False, on_delete=models.PROTECT) + text = models.ForeignKey(Translation, related_name="documents", blank=False, null=False, on_delete=models.PROTECT) objects = DocumentManager() @@ -71,23 +66,23 @@ def __str__(self) -> str: class ProgramManager(models.Manager): translated_fields = ( - 'description_short', - 'name', - 'description', - 'learn_more_link', - 'apply_button_link', - 'value_type', - 'estimated_delivery_time', - 'estimated_application_time', - 'category', - 'warning', + "description_short", + "name", + "description", + "learn_more_link", + "apply_button_link", + "value_type", + "estimated_delivery_time", + "estimated_application_time", + "category", + "warning", ) def new_program(self, name_abbreviated): translations = {} for field in self.translated_fields: translations[field] = Translation.objects.add_translation( - f'program.{name_abbreviated}_temporary_key-{field}', '' + f"program.{name_abbreviated}_temporary_key-{field}", "" ) program = self.create( @@ -99,7 +94,7 @@ def new_program(self, name_abbreviated): ) for [field, translation] in translations.items(): - translation.label = f'program.{name_abbreviated}_{program.id}-{field}' + translation.label = f"program.{name_abbreviated}_{program.id}-{field}" translation.save() return program @@ -111,68 +106,46 @@ def new_program(self, name_abbreviated): class Program(models.Model): name_abbreviated = models.CharField(max_length=120) external_name = models.CharField(max_length=120, blank=True, null=True, unique=True) - legal_status_required = models.ManyToManyField(LegalStatus, related_name='programs', blank=True) - documents = models.ManyToManyField(Document, related_name='program_documents', blank=True) + legal_status_required = models.ManyToManyField(LegalStatus, related_name="programs", blank=True) + documents = models.ManyToManyField(Document, related_name="program_documents", blank=True) active = models.BooleanField(blank=True, default=True) low_confidence = models.BooleanField(blank=True, null=False, default=False) - fpl = models.ForeignKey(FederalPoveryLimit, related_name='fpl', blank=True, null=True, on_delete=models.SET_NULL) + fpl = models.ForeignKey(FederalPoveryLimit, related_name="fpl", blank=True, null=True, on_delete=models.SET_NULL) description_short = models.ForeignKey( - Translation, - related_name='program_description_short', - blank=False, - null=False, - on_delete=models.PROTECT) + Translation, related_name="program_description_short", blank=False, null=False, on_delete=models.PROTECT + ) name = models.ForeignKey( - Translation, - related_name='program_name', - blank=False, - null=False, - on_delete=models.PROTECT) + Translation, related_name="program_name", blank=False, null=False, on_delete=models.PROTECT + ) description = models.ForeignKey( - Translation, - related_name='program_description', - blank=False, - null=False, - on_delete=models.PROTECT) + Translation, related_name="program_description", blank=False, null=False, on_delete=models.PROTECT + ) learn_more_link = models.ForeignKey( - Translation, - related_name='program_learn_more_link', - blank=False, - null=False, - on_delete=models.PROTECT) + Translation, related_name="program_learn_more_link", blank=False, null=False, on_delete=models.PROTECT + ) apply_button_link = models.ForeignKey( - Translation, - related_name='program_apply_button_link', - null=False, - on_delete=models.PROTECT) + Translation, related_name="program_apply_button_link", null=False, on_delete=models.PROTECT + ) value_type = models.ForeignKey( - Translation, - related_name='program_value_type', - blank=False, - null=False, - on_delete=models.PROTECT) + Translation, related_name="program_value_type", blank=False, null=False, on_delete=models.PROTECT + ) estimated_delivery_time = models.ForeignKey( - Translation, - related_name='program_estimated_delivery_time', - blank=False, - null=False, - on_delete=models.PROTECT) + Translation, related_name="program_estimated_delivery_time", blank=False, null=False, on_delete=models.PROTECT + ) estimated_application_time = models.ForeignKey( Translation, - related_name='program_estimated_application_time', + related_name="program_estimated_application_time", blank=False, null=False, - on_delete=models.PROTECT) + on_delete=models.PROTECT, + ) category = models.ForeignKey( - Translation, - related_name='program_category', - blank=False, - null=False, - on_delete=models.PROTECT) + Translation, related_name="program_category", blank=False, null=False, on_delete=models.PROTECT + ) warning = models.ForeignKey( Translation, - related_name='program_warning', + related_name="program_warning", blank=False, null=False, on_delete=models.PROTECT, @@ -217,7 +190,7 @@ class UrgentNeedCategory(models.Model): name = models.CharField(max_length=120) class Meta: - verbose_name_plural = 'Urgent Need Categories' + verbose_name_plural = "Urgent Need Categories" def __str__(self): return self.name @@ -225,17 +198,17 @@ def __str__(self): class UrgentNeedManager(models.Manager): translated_fields = ( - 'name', - 'description', - 'link', - 'type', - 'warning', + "name", + "description", + "link", + "type", + "warning", ) def new_urgent_need(self, name, phone_number): translations = {} for field in self.translated_fields: - translations[field] = Translation.objects.add_translation(f'urgent_need.{name}_temporary_key-{field}', '') + translations[field] = Translation.objects.add_translation(f"urgent_need.{name}_temporary_key-{field}", "") urgent_need = self.create( phone_number=phone_number, @@ -245,7 +218,7 @@ def new_urgent_need(self, name, phone_number): ) for [field, translation] in translations.items(): - translation.label = f'urgent_need.{name}_{urgent_need.id}-{field}' + translation.label = f"urgent_need.{name}_{urgent_need.id}-{field}" translation.save() return urgent_need @@ -254,41 +227,25 @@ def new_urgent_need(self, name, phone_number): class UrgentNeed(models.Model): external_name = models.CharField(max_length=120, blank=True, null=True, unique=True) phone_number = PhoneNumberField(blank=True, null=True) - type_short = models.ManyToManyField(UrgentNeedCategory, related_name='urgent_needs') + type_short = models.ManyToManyField(UrgentNeedCategory, related_name="urgent_needs") active = models.BooleanField(blank=True, null=False, default=True) low_confidence = models.BooleanField(blank=True, null=False, default=False) - functions = models.ManyToManyField(UrgentNeedFunction, related_name='function', blank=True) + functions = models.ManyToManyField(UrgentNeedFunction, related_name="function", blank=True) name = models.ForeignKey( - Translation, - related_name='urgent_need_name', - blank=False, - null=False, - on_delete=models.PROTECT) + Translation, related_name="urgent_need_name", blank=False, null=False, on_delete=models.PROTECT + ) description = models.ForeignKey( - Translation, - related_name='urgent_need_description', - blank=False, - null=False, - on_delete=models.PROTECT) + Translation, related_name="urgent_need_description", blank=False, null=False, on_delete=models.PROTECT + ) link = models.ForeignKey( - Translation, - related_name='urgent_need_link', - blank=False, - null=False, - on_delete=models.PROTECT) + Translation, related_name="urgent_need_link", blank=False, null=False, on_delete=models.PROTECT + ) type = models.ForeignKey( - Translation, - related_name='urgent_need_type', - blank=False, - null=False, - on_delete=models.PROTECT) + Translation, related_name="urgent_need_type", blank=False, null=False, on_delete=models.PROTECT + ) warning = models.ForeignKey( - Translation, - related_name='urgent_need_warning', - blank=False, - null=False, - on_delete=models.PROTECT + Translation, related_name="urgent_need_warning", blank=False, null=False, on_delete=models.PROTECT ) objects = UrgentNeedManager() @@ -306,16 +263,16 @@ def __str__(self) -> str: class NavigatorManager(models.Manager): translated_fields = ( - 'name', - 'email', - 'assistance_link', - 'description', + "name", + "email", + "assistance_link", + "description", ) def new_navigator(self, name, phone_number): translations = {} for field in self.translated_fields: - translations[field] = Translation.objects.add_translation(f'navigator.{name}_temporary_key-{field}', '') + translations[field] = Translation.objects.add_translation(f"navigator.{name}_temporary_key-{field}", "") navigator = self.create( phone_number=phone_number, @@ -323,42 +280,30 @@ def new_navigator(self, name, phone_number): ) for [field, translation] in translations.items(): - translation.label = f'navigator.{name}_{navigator.id}-{field}' + translation.label = f"navigator.{name}_{navigator.id}-{field}" translation.save() return navigator class Navigator(models.Model): - program = models.ManyToManyField(Program, related_name='navigator', blank=True) + program = models.ManyToManyField(Program, related_name="navigator", blank=True) external_name = models.CharField(max_length=120, blank=True, null=True, unique=True) phone_number = PhoneNumberField(blank=True, null=True) - counties = models.ManyToManyField(NavigatorCounty, related_name='navigator', blank=True) + counties = models.ManyToManyField(NavigatorCounty, related_name="navigator", blank=True) name = models.ForeignKey( - Translation, - related_name='navigator_name', - blank=False, - null=False, - on_delete=models.PROTECT) + Translation, related_name="navigator_name", blank=False, null=False, on_delete=models.PROTECT + ) email = models.ForeignKey( - Translation, - related_name='navigator_email', - blank=False, - null=False, - on_delete=models.PROTECT) + Translation, related_name="navigator_email", blank=False, null=False, on_delete=models.PROTECT + ) assistance_link = models.ForeignKey( - Translation, - related_name='navigator_assistance_link', - blank=False, - null=False, - on_delete=models.PROTECT) + Translation, related_name="navigator_assistance_link", blank=False, null=False, on_delete=models.PROTECT + ) description = models.ForeignKey( - Translation, - related_name='navigator_name_description', - blank=False, - null=False, - on_delete=models.PROTECT) + Translation, related_name="navigator_name_description", blank=False, null=False, on_delete=models.PROTECT + ) objects = NavigatorManager() @@ -376,9 +321,9 @@ def __str__(self): class Referrer(models.Model): referrer_code = models.CharField(max_length=64, unique=True) webhook_url = models.CharField(max_length=320, blank=True, null=True) - webhook_functions = models.ManyToManyField(WebHookFunction, related_name='web_hook', blank=True) - primary_navigators = models.ManyToManyField(Navigator, related_name='primary_navigators', blank=True) - remove_programs = models.ManyToManyField(Program, related_name='removed_programs', blank=True) + webhook_functions = models.ManyToManyField(WebHookFunction, related_name="web_hook", blank=True) + primary_navigators = models.ManyToManyField(Navigator, related_name="primary_navigators", blank=True) + remove_programs = models.ManyToManyField(Program, related_name="removed_programs", blank=True) def __str__(self): return self.referrer_code diff --git a/programs/programs/__init__.py b/programs/programs/__init__.py index f2f2c433..13e75b6d 100644 --- a/programs/programs/__init__.py +++ b/programs/programs/__init__.py @@ -2,7 +2,4 @@ from .federal import federal_calculators from .calc import ProgramCalculator -calculators: dict[str, type[ProgramCalculator]] = { - **co_calculators, - **federal_calculators -} +calculators: dict[str, type[ProgramCalculator]] = {**co_calculators, **federal_calculators} diff --git a/programs/programs/calc.py b/programs/programs/calc.py index 8124e6e5..e957e019 100644 --- a/programs/programs/calc.py +++ b/programs/programs/calc.py @@ -1,6 +1,7 @@ from screener.models import Screen from programs.util import Dependencies from typing import TYPE_CHECKING + if TYPE_CHECKING: from programs.models import Program @@ -14,9 +15,9 @@ def __init__(self): self.eligible_member_count = 0 def condition(self, passed: bool, message=None): - ''' + """ Uses a condition to update the pass fail messages and eligibility. - ''' + """ if message is None: if not passed: @@ -29,22 +30,22 @@ def condition(self, passed: bool, message=None): self.failed(message) def failed(self, msg): - ''' + """ Mark eligibility as failed and add a message to `fail_messages` - ''' + """ self.eligible = False self.fail_messages.append(msg) def passed(self, msg): - ''' + """ Add a message to `pass_messages` - ''' + """ self.pass_messages.append(msg) def member_eligibility(self, members, conditions): - ''' + """ Filter out members that do not meet the condition and make eligibility messages - ''' + """ if len(conditions) <= 0: self.eligible_member_count = len(members) return members @@ -60,9 +61,9 @@ def member_eligibility(self, members, conditions): return self.member_eligibility(eligible_members, conditions) def to_dict(self): - ''' + """ Return the eligibility as a dictionary - ''' + """ return { "eligible": self.eligible, "passed": self.pass_messages, @@ -72,9 +73,10 @@ def to_dict(self): class ProgramCalculator: - ''' + """ Base class for all Programs - ''' + """ + dependencies = tuple() amount = 0 @@ -84,20 +86,20 @@ def __init__(self, screen: Screen, program: "Program", data): self.data = data def eligible(self) -> Eligibility: - ''' + """ Returns the `Eligibility` object with whether or not the program is eligible - ''' + """ return Eligibility() def value(self, eligible_members: int): - ''' + """ Return the value of the program - ''' + """ return self.amount @classmethod def can_calc(cls, missing_dependencies: Dependencies): - ''' + """ Returns whether or not the program can be calculated with the missing dependencies - ''' + """ return not missing_dependencies.has(*cls.dependencies) diff --git a/programs/programs/co/__init__.py b/programs/programs/co/__init__.py index ea5aa311..6e1d5b52 100644 --- a/programs/programs/co/__init__.py +++ b/programs/programs/co/__init__.py @@ -29,32 +29,31 @@ co_calculators: dict[str, type[ProgramCalculator]] = { - 'rtdlive': RtdLive, - 'cccap': ChildCareAssistance, - 'mydenver': MyDenver, - 'cocb': CashBack, - 'leap': EnergyAssistance, - 'erc': EnergyResourceCenter, - 'omnisalud': OmniSalud, - 'cdhcs': DentalHealthCareSeniors, - 'rhc': ReproductiveHealthCare, - 'cfhc': ConnectForHealth, - 'fps': FamilyPlanningServices, - 'dpp': DenverPreschoolProgram, - 'ede': EveryDayEats, - 'cpcr': PropertyCreditRebate, - 'upk': UniversalPreschool, - 'myspark': MySpark, - 'lwcr': LowWageCovidRelief, - 'cwd_medicaid': MedicaidChildWithDisability, - 'awd_medicaid': MedicaidAdultWithDisability, - 'emergency_medicaid': EmergencyMedicaid, - 'bca': BasicCashAssistance, - 'cowap': WeatherizationAssistance, - 'tabor': Tabor, - 'trua': Trua, - 'ubp': UtilityBillPay, - 'rag': RentalAssistanceGrant, - 'erap': EmergencyRentalAssistance, + "rtdlive": RtdLive, + "cccap": ChildCareAssistance, + "mydenver": MyDenver, + "cocb": CashBack, + "leap": EnergyAssistance, + "erc": EnergyResourceCenter, + "omnisalud": OmniSalud, + "cdhcs": DentalHealthCareSeniors, + "rhc": ReproductiveHealthCare, + "cfhc": ConnectForHealth, + "fps": FamilyPlanningServices, + "dpp": DenverPreschoolProgram, + "ede": EveryDayEats, + "cpcr": PropertyCreditRebate, + "upk": UniversalPreschool, + "myspark": MySpark, + "lwcr": LowWageCovidRelief, + "cwd_medicaid": MedicaidChildWithDisability, + "awd_medicaid": MedicaidAdultWithDisability, + "emergency_medicaid": EmergencyMedicaid, + "bca": BasicCashAssistance, + "cowap": WeatherizationAssistance, + "tabor": Tabor, + "trua": Trua, + "ubp": UtilityBillPay, + "rag": RentalAssistanceGrant, + "erap": EmergencyRentalAssistance, } - diff --git a/programs/programs/co/basic_cash_assistance/calculator.py b/programs/programs/co/basic_cash_assistance/calculator.py index f86dcf38..6d8e0710 100644 --- a/programs/programs/co/basic_cash_assistance/calculator.py +++ b/programs/programs/co/basic_cash_assistance/calculator.py @@ -5,8 +5,8 @@ class BasicCashAssistance(ProgramCalculator): amount = 1_000 - county = 'Denver County' - dependencies = ['zipcode', 'age'] + county = "Denver County" + dependencies = ["zipcode", "age"] def eligible(self) -> Eligibility: e = Eligibility() diff --git a/programs/programs/co/cash_back/calculator.py b/programs/programs/co/cash_back/calculator.py index 320321ff..7c4fd16c 100644 --- a/programs/programs/co/cash_back/calculator.py +++ b/programs/programs/co/cash_back/calculator.py @@ -4,7 +4,7 @@ class CashBack(ProgramCalculator): amount = 750 - dependencies = ['age'] + dependencies = ["age"] def eligible(self) -> Eligibility: e = Eligibility() diff --git a/programs/programs/co/child_care_assistance/calculator.py b/programs/programs/co/child_care_assistance/calculator.py index b5b4f9b6..991c651c 100644 --- a/programs/programs/co/child_care_assistance/calculator.py +++ b/programs/programs/co/child_care_assistance/calculator.py @@ -6,8 +6,8 @@ class CCCAPCache(GoogleSheetsCache): - sheet_id = '1WzobLnLoxGbN_JfTuw3jUCZV5N7IA_0uvwEkIoMt3Wk' - range_name = 'Sheet1!A14:J78' + sheet_id = "1WzobLnLoxGbN_JfTuw3jUCZV5N7IA_0uvwEkIoMt3Wk" + range_name = "Sheet1!A14:J78" class ChildCareAssistance(ProgramCalculator): @@ -16,7 +16,7 @@ class ChildCareAssistance(ProgramCalculator): max_age_preschool = 4 max_age_afterschool = 13 max_age_afterschool_disabled = 19 - dependencies = ['age', 'income_amount', 'income_frequency', 'zipcode', 'household_size'] + dependencies = ["age", "income_amount", "income_frequency", "zipcode", "household_size"] county_values = CCCAPCache() def eligible(self) -> Eligibility: @@ -34,8 +34,8 @@ def eligible(self) -> Eligibility: e.condition(bool(cccap_county_data), messages.location()) # income - frequency = 'yearly' - income_types = ['all'] + frequency = "yearly" + income_types = ["all"] gross_income = self.screen.calc_gross_income(frequency, income_types) if cccap_county_data: income_limit = cccap_county_data[self.screen.household_size] * 12 @@ -54,9 +54,11 @@ def value(self, eligible_members: int): value += ChildCareAssistance.preschool_value elif household_member.age < ChildCareAssistance.max_age_afterschool: value += ChildCareAssistance.afterschool_value - elif household_member.age >= ChildCareAssistance.max_age_afterschool and \ - household_member.age <= ChildCareAssistance.max_age_afterschool_disabled and \ - household_member.has_disability(): + elif ( + household_member.age >= ChildCareAssistance.max_age_afterschool + and household_member.age <= ChildCareAssistance.max_age_afterschool_disabled + and household_member.has_disability() + ): value += ChildCareAssistance.afterschool_value return value @@ -68,9 +70,11 @@ def _num_cccap_children(self): for household_member in household_members: if household_member.age < ChildCareAssistance.max_age_afterschool: children += 1 - elif household_member.age >= ChildCareAssistance.max_age_afterschool and \ - household_member.age <= ChildCareAssistance.max_age_afterschool_disabled and \ - household_member.has_disability(): + elif ( + household_member.age >= ChildCareAssistance.max_age_afterschool + and household_member.age <= ChildCareAssistance.max_age_afterschool_disabled + and household_member.has_disability() + ): children += 1 return children @@ -80,21 +84,20 @@ def _cccap_county_values(self, county_name): sheet_values = self.county_values.fetch() cccap_county_name = county_name.replace(" County", "") - non_decimal = re.compile(r'[^\d.]+') + non_decimal = re.compile(r"[^\d.]+") for row in sheet_values: if row[0] == cccap_county_name: match = { 1: -1, - 2: float(non_decimal.sub('', row[2])), - 3: float(non_decimal.sub('', row[3])), - 4: float(non_decimal.sub('', row[4])), - 5: float(non_decimal.sub('', row[5])), - 6: float(non_decimal.sub('', row[6])), - 7: float(non_decimal.sub('', row[7])), - 8: float(non_decimal.sub('', row[8])), - 9: float(non_decimal.sub('', row[9])) + 2: float(non_decimal.sub("", row[2])), + 3: float(non_decimal.sub("", row[3])), + 4: float(non_decimal.sub("", row[4])), + 5: float(non_decimal.sub("", row[5])), + 6: float(non_decimal.sub("", row[6])), + 7: float(non_decimal.sub("", row[7])), + 8: float(non_decimal.sub("", row[8])), + 9: float(non_decimal.sub("", row[9])), } return match - diff --git a/programs/programs/co/connect_for_health/calculator.py b/programs/programs/co/connect_for_health/calculator.py index 20ffcd89..33cf5c6e 100644 --- a/programs/programs/co/connect_for_health/calculator.py +++ b/programs/programs/co/connect_for_health/calculator.py @@ -5,18 +5,18 @@ class CFHCache(GoogleSheetsCache): default = {} - sheet_id = '1SuOhwX5psXsipMS_G5DE_f9jLS2qWxf6temxY445EQg' + sheet_id = "1SuOhwX5psXsipMS_G5DE_f9jLS2qWxf6temxY445EQg" range_name = "'2023 report'!A2:B65" def update(self): data = super().update() - return {d[0].strip() + ' County': float(d[1].replace(',', '')) for d in data} + return {d[0].strip() + " County": float(d[1].replace(",", "")) for d in data} class ConnectForHealth(ProgramCalculator): percent_of_fpl = 4 - dependencies = ['insurance', 'income_amount', 'income_frequency', 'county', 'household_size'] + dependencies = ["insurance", "income_amount", "income_frequency", "county", "household_size"] county_values = CFHCache() def eligible(self) -> Eligibility: @@ -25,37 +25,30 @@ def eligible(self) -> Eligibility: # Medicade eligibility is_medicaid_eligible = False for benefit in self.data: - if benefit['name_abbreviated'] == 'medicaid': - is_medicaid_eligible = benefit['eligible'] + if benefit["name_abbreviated"] == "medicaid": + is_medicaid_eligible = benefit["eligible"] break - e.condition(not is_medicaid_eligible, messages.must_not_have_benefit('Medicaid')) + e.condition(not is_medicaid_eligible, messages.must_not_have_benefit("Medicaid")) # Someone has no health insurance - has_no_hi = self.screen.has_insurance_types(('none', 'private')) + has_no_hi = self.screen.has_insurance_types(("none", "private")) e.condition(has_no_hi, messages.has_no_insurance()) # HH member has no va insurance e.member_eligibility( self.screen.household_members.all(), - [ - ( - lambda m: not m.insurance.has_insurance_types(('va', 'private')), - messages.must_not_have_benefit('VA') - ) - ] + [(lambda m: not m.insurance.has_insurance_types(("va", "private")), messages.must_not_have_benefit("VA"))], ) # Income fpl = self.program.fpl.as_dict() income_band = int(fpl[self.screen.household_size] / 12 * ConnectForHealth.percent_of_fpl) - gross_income = int(self.screen.calc_gross_income('yearly', ('all',)) / 12) - e.condition(gross_income < income_band, - messages.income(gross_income, income_band)) + gross_income = int(self.screen.calc_gross_income("yearly", ("all",)) / 12) + e.condition(gross_income < income_band, messages.income(gross_income, income_band)) return e def value(self, eligible_members: int): values = self.county_values.fetch() return values[self.screen.county] * 12 - diff --git a/programs/programs/co/connect_for_health/tests.py b/programs/programs/co/connect_for_health/tests.py index c963e90c..10d99cb7 100644 --- a/programs/programs/co/connect_for_health/tests.py +++ b/programs/programs/co/connect_for_health/tests.py @@ -7,8 +7,8 @@ class TestConnectForHealth(TestCase): def setUp(self): self.screen1 = Screen.objects.create( agree_to_tos=True, - zipcode='80205', - county='Denver County', + zipcode="80205", + county="Denver County", household_size=1, household_assets=0, has_employer_hi=True, @@ -19,7 +19,7 @@ def setUp(self): ) self.person1 = HouseholdMember.objects.create( screen=self.screen1, - relationship='headOfHousehold', + relationship="headOfHousehold", age=60, student=False, student_full_time=False, @@ -43,11 +43,7 @@ def test_health_insurance_failed_all_conditions(self): self.screen1.has_no_hi = False self.screen1.save() income = IncomeStream.objects.create( - screen=self.screen1, - household_member=self.person1, - type='wages', - amount=5800, - frequency='monthly' + screen=self.screen1, household_member=self.person1, type="wages", amount=5800, frequency="monthly" ) cfhc = ConnectForHealth(self.screen1) diff --git a/programs/programs/co/dental_health_care_seniors/calculator.py b/programs/programs/co/dental_health_care_seniors/calculator.py index f1ce6dfa..d6f26352 100644 --- a/programs/programs/co/dental_health_care_seniors/calculator.py +++ b/programs/programs/co/dental_health_care_seniors/calculator.py @@ -6,7 +6,7 @@ class DentalHealthCareSeniors(ProgramCalculator): amount = 80 min_age = 60 percent_of_fpl = 2.5 - dependencies = ['age', 'income_amount', 'income_frequency', 'insurance', 'household_size'] + dependencies = ["age", "income_amount", "income_frequency", "insurance", "household_size"] def eligible(self) -> Eligibility: e = Eligibility() @@ -14,22 +14,21 @@ def eligible(self) -> Eligibility: self.screen.household_members.all(), [ ( - lambda m: m.insurance.has_insurance_types(('medicaid', 'private')), - messages.must_not_have_benefit('Medicaid') + lambda m: m.insurance.has_insurance_types(("medicaid", "private")), + messages.must_not_have_benefit("Medicaid"), ), ( lambda m: m.age > DentalHealthCareSeniors.min_age, - messages.older_than(DentalHealthCareSeniors.min_age) - ) - ] + messages.older_than(DentalHealthCareSeniors.min_age), + ), + ], ) # Income test fpl = self.program.fpl.as_dict() gross_income = int(self.screen.calc_gross_income("monthly", ["all"])) income_band = int(DentalHealthCareSeniors.percent_of_fpl * fpl[self.screen.household_size] / 12) - e.condition(gross_income <= income_band, - messages.income(gross_income, income_band)) + e.condition(gross_income <= income_band, messages.income(gross_income, income_band)) return e diff --git a/programs/programs/co/dental_health_care_seniors/tests.py b/programs/programs/co/dental_health_care_seniors/tests.py index d6bd2319..44bc1672 100644 --- a/programs/programs/co/dental_health_care_seniors/tests.py +++ b/programs/programs/co/dental_health_care_seniors/tests.py @@ -7,15 +7,15 @@ class TestDentalHealthCareSeniorsPension(TestCase): def setUp(self): self.screen1 = Screen.objects.create( agree_to_tos=True, - zipcode='80205', - county='Denver County', + zipcode="80205", + county="Denver County", household_size=1, household_assets=0, - has_no_hi=True + has_no_hi=True, ) self.person1 = HouseholdMember.objects.create( screen=self.screen1, - relationship='headOfHousehold', + relationship="headOfHousehold", age=60, student=False, student_full_time=False, @@ -41,11 +41,7 @@ def test_dental_health_care_seniors_failed_all_conditions(self): self.screen1.has_medicaid = True self.screen1.save() IncomeStream.objects.create( - screen=self.screen1, - household_member=self.person1, - type='wages', - amount=3000, - frequency='monthly' + screen=self.screen1, household_member=self.person1, type="wages", amount=3000, frequency="monthly" ) cdhcs = DentalHealthCareSeniors(self.screen1) diff --git a/programs/programs/co/denver_preschool_program/calculator.py b/programs/programs/co/denver_preschool_program/calculator.py index bc19c482..4fcb9a8e 100644 --- a/programs/programs/co/denver_preschool_program/calculator.py +++ b/programs/programs/co/denver_preschool_program/calculator.py @@ -8,7 +8,7 @@ class DenverPreschoolProgram(ProgramCalculator): min_age = 3 max_age = 4 county = "Denver County" - dependencies = ['age', 'zipcode'] + dependencies = ["age", "zipcode"] def eligible(self) -> Eligibility: e = Eligibility() @@ -18,8 +18,7 @@ def eligible(self) -> Eligibility: age_min=DenverPreschoolProgram.min_age, age_max=DenverPreschoolProgram.max_age ) - e.condition(num_children >= 1, - messages.child(DenverPreschoolProgram.min_age, DenverPreschoolProgram.max_age)) + e.condition(num_children >= 1, messages.child(DenverPreschoolProgram.min_age, DenverPreschoolProgram.max_age)) if self.screen.county is not None: counties = [self.screen.county] @@ -27,7 +26,6 @@ def eligible(self) -> Eligibility: counties = counties_from_zip(self.screen.zipcode) # Lives in Denver - e.condition(DenverPreschoolProgram.county in counties, - messages.location()) + e.condition(DenverPreschoolProgram.county in counties, messages.location()) return e diff --git a/programs/programs/co/denver_preschool_program/tests.py b/programs/programs/co/denver_preschool_program/tests.py index 916018ab..08ebf51c 100644 --- a/programs/programs/co/denver_preschool_program/tests.py +++ b/programs/programs/co/denver_preschool_program/tests.py @@ -6,14 +6,11 @@ class TestDenverPreschoolProgram(TestCase): def setUp(self): self.screen1 = Screen.objects.create( - agree_to_tos=True, - zipcode='80205', - county='Denver County', - household_size=2 + agree_to_tos=True, zipcode="80205", county="Denver County", household_size=2 ) self.person1 = HouseholdMember.objects.create( screen=self.screen1, - relationship='headOfHousehold', + relationship="headOfHousehold", age=30, student=False, student_full_time=False, @@ -28,7 +25,7 @@ def setUp(self): ) self.person2 = HouseholdMember.objects.create( screen=self.screen1, - relationship='child', + relationship="child", age=3, student=False, student_full_time=False, diff --git a/programs/programs/co/emergency_rental_assistance/calculator.py b/programs/programs/co/emergency_rental_assistance/calculator.py index 18ccfda9..dc79d697 100644 --- a/programs/programs/co/emergency_rental_assistance/calculator.py +++ b/programs/programs/co/emergency_rental_assistance/calculator.py @@ -6,18 +6,18 @@ class EmergencyRentalAssistanceIncomeLimitsCache(GoogleSheetsCache): default = {} - sheet_id = '1QHb-ZT0Y2oWjFMoeP_wy8ClveslINWdehb-CXhB8WSE' + sheet_id = "1QHb-ZT0Y2oWjFMoeP_wy8ClveslINWdehb-CXhB8WSE" range_name = "'2022 80% AMI'!A2:I" def update(self): data = super().update() - return {d[0].strip() + ' County': [int(v.replace(',', '')) for v in d[1:]] for d in data} + return {d[0].strip() + " County": [int(v.replace(",", "")) for v in d[1:]] for d in data} class EmergencyRentalAssistance(ProgramCalculator): amount = 13_848 - dependencies = ['income_amount', 'income_frequency', 'household_size', 'zipcode'] + dependencies = ["income_amount", "income_frequency", "household_size", "zipcode"] income_cache = EmergencyRentalAssistanceIncomeLimitsCache() def eligible(self) -> Eligibility: @@ -27,11 +27,10 @@ def eligible(self) -> Eligibility: counties = counties_from_zip(self.screen.zipcode) county_name = self.screen.county if self.screen.county is not None else counties[0] - income = self.screen.calc_gross_income('yearly', ['all']) - income_limits = EmergencyRentalAssistance.income_cache.fetch() + income = self.screen.calc_gross_income("yearly", ["all"]) + income_limits = EmergencyRentalAssistance.income_cache.fetch() # NOTE: 80% to income is already applied in the sheet. income_limit = income_limits[county_name][self.screen.household_size - 1] e.condition(income < income_limit, messages.income(income, income_limit)) return e - diff --git a/programs/programs/co/energy_assistance/calculator.py b/programs/programs/co/energy_assistance/calculator.py index 0ade8cce..e774b3b3 100644 --- a/programs/programs/co/energy_assistance/calculator.py +++ b/programs/programs/co/energy_assistance/calculator.py @@ -9,10 +9,10 @@ class LeapValueCache(Cache): expire_time = 60 * 60 * 24 default = [] - sheet_id = '1W8WbJsb5Mgb4CUkte2SCuDnqigqkmaO3LC0KSfhEdGg' + sheet_id = "1W8WbJsb5Mgb4CUkte2SCuDnqigqkmaO3LC0KSfhEdGg" range_name = "'FFY 2024'!A1:G65" - county_column = '2023/2024 Season\nUpdated: \n4/30/2024' - average_column = 'Average Benefit' + county_column = "2023/2024 Season\nUpdated: \n4/30/2024" + average_column = "Average Benefit" def update(self): data = GoogleSheets(self.sheet_id, self.range_name).data_by_column(self.county_column, self.average_column) @@ -31,7 +31,7 @@ class EnergyAssistance(ProgramCalculator): 7: 8_001, 8: 8_179, } - dependencies = ['income_frequency', 'income_amount', 'zipcode', 'household_size'] + dependencies = ["income_frequency", "income_amount", "zipcode", "household_size"] county_values = LeapValueCache() def eligible(self) -> Eligibility: @@ -39,13 +39,11 @@ def eligible(self) -> Eligibility: # income frequency = "monthly" - income_types = ['all'] + income_types = ["all"] income_limit = EnergyAssistance.income_bands[self.screen.household_size] leap_income = self.screen.calc_gross_income(frequency, income_types) - e.condition( - leap_income < income_limit, messages.income(leap_income, income_limit) - ) + e.condition(leap_income < income_limit, messages.income(leap_income, income_limit)) return e @@ -60,9 +58,9 @@ def value(self, eligible_members: int): values = [] for row in data: - county = row[0].strip().replace('Application County: ', '') + ' County' + county = row[0].strip().replace("Application County: ", "") + " County" if county in counties: - values.append(int(float(row[1].replace('$', '')))) + values.append(int(float(row[1].replace("$", "")))) value = 362 lowest = math.inf @@ -74,4 +72,3 @@ def value(self, eligible_members: int): lowest = possible_value return value - diff --git a/programs/programs/co/energy_resource_center/calculator.py b/programs/programs/co/energy_resource_center/calculator.py index 57ad3e14..89470343 100644 --- a/programs/programs/co/energy_resource_center/calculator.py +++ b/programs/programs/co/energy_resource_center/calculator.py @@ -4,17 +4,8 @@ class EnergyResourceCenter(ProgramCalculator): amount = 4000 - income_bands = { - 1: 2880, - 2: 3766, - 3: 4652, - 4: 5539, - 5: 6425, - 6: 7311, - 7: 7477, - 8: 7644 - } - dependencies = ['household_size', 'income_amount', 'income_frequency'] + income_bands = {1: 2880, 2: 3766, 3: 4652, 4: 5539, 5: 6425, 6: 7311, 7: 7477, 8: 7644} + dependencies = ["household_size", "income_amount", "income_frequency"] def eligible(self) -> Eligibility: e = Eligibility() @@ -22,7 +13,6 @@ def eligible(self) -> Eligibility: # income gross_income = self.screen.calc_gross_income("monthly", ["all"]) income_band = EnergyResourceCenter.income_bands[self.screen.household_size] - e.condition(gross_income <= income_band, - messages.income(gross_income, income_band)) + e.condition(gross_income <= income_band, messages.income(gross_income, income_band)) return e diff --git a/programs/programs/co/energy_resource_center/tests.py b/programs/programs/co/energy_resource_center/tests.py index 3821af10..49610c97 100644 --- a/programs/programs/co/energy_resource_center/tests.py +++ b/programs/programs/co/energy_resource_center/tests.py @@ -7,14 +7,14 @@ class TestEnergyResourceCenterPension(TestCase): def setUp(self): self.screen1 = Screen.objects.create( agree_to_tos=True, - zipcode='80205', - county='Denver County', + zipcode="80205", + county="Denver County", household_size=1, household_assets=0, ) self.person1 = HouseholdMember.objects.create( screen=self.screen1, - relationship='headOfHousehold', + relationship="headOfHousehold", age=60, student=False, student_full_time=False, @@ -36,14 +36,9 @@ def test_energy_resource_center_visually_impaired_is_eligible(self): def test_energy_resource_center_failed_income_condition(self): income = IncomeStream.objects.create( - screen=self.screen1, - household_member=self.person1, - type='wages', - amount=3000, - frequency='monthly' + screen=self.screen1, household_member=self.person1, type="wages", amount=3000, frequency="monthly" ) erc = EnergyResourceCenter(self.screen1) eligibility = erc.eligibility self.assertFalse(eligibility["eligible"]) - diff --git a/programs/programs/co/every_day_eats/calculator.py b/programs/programs/co/every_day_eats/calculator.py index 4dbc585c..fec2df6a 100644 --- a/programs/programs/co/every_day_eats/calculator.py +++ b/programs/programs/co/every_day_eats/calculator.py @@ -6,7 +6,7 @@ class EveryDayEats(ProgramCalculator): amount = 600 min_age = 60 percent_of_fpl = 1.3 - dependencies = ['age', 'income_amount', 'income_frequency', 'household_size'] + dependencies = ["age", "income_amount", "income_frequency", "household_size"] def eligible(self) -> Eligibility: e = Eligibility() @@ -18,7 +18,7 @@ def eligible(self) -> Eligibility: # Income fpl = self.program.fpl.as_dict() income_limit = EveryDayEats.percent_of_fpl * fpl[self.screen.household_size] - gross_income = self.screen.calc_gross_income('yearly', ['all']) + gross_income = self.screen.calc_gross_income("yearly", ["all"]) e.condition(gross_income < income_limit, messages.income(gross_income, income_limit)) diff --git a/programs/programs/co/every_day_eats/tests.py b/programs/programs/co/every_day_eats/tests.py index 01fc093f..03606c18 100644 --- a/programs/programs/co/every_day_eats/tests.py +++ b/programs/programs/co/every_day_eats/tests.py @@ -7,14 +7,14 @@ class TestEveryDayEatsPension(TestCase): def setUp(self): self.screen1 = Screen.objects.create( agree_to_tos=True, - zipcode='80205', - county='Denver County', + zipcode="80205", + county="Denver County", household_size=1, household_assets=0, ) self.person1 = HouseholdMember.objects.create( screen=self.screen1, - relationship='headOfHousehold', + relationship="headOfHousehold", age=60, student=False, student_full_time=False, @@ -36,11 +36,7 @@ def test_every_day_eats_visually_impaired_is_eligible(self): def test_every_day_eats_failed_all_conditions(self): income = IncomeStream.objects.create( - screen=self.screen1, - household_member=self.person1, - type='wages', - amount=3000, - frequency='monthly' + screen=self.screen1, household_member=self.person1, type="wages", amount=3000, frequency="monthly" ) self.person1.age = 30 self.person1.save() diff --git a/programs/programs/co/low_wage_covid_relief/calculator.py b/programs/programs/co/low_wage_covid_relief/calculator.py index 7938250c..49967572 100644 --- a/programs/programs/co/low_wage_covid_relief/calculator.py +++ b/programs/programs/co/low_wage_covid_relief/calculator.py @@ -6,7 +6,7 @@ class LowWageCovidRelief(ProgramCalculator): amount = 1_500 - auto_eligible_benefits = ('medicaid', 'tanf', 'snap', 'wic', 'leap') + auto_eligible_benefits = ("medicaid", "tanf", "snap", "wic", "leap") income_limits = { 1: -math.inf, 2: 3_266.25, @@ -17,8 +17,8 @@ class LowWageCovidRelief(ProgramCalculator): 7: 7_522.50, 8: 8_373.75, } - county = 'Adams County' - dependencies = ['zipode', 'household_size', 'income_amount', 'income_frequency'] + county = "Adams County" + dependencies = ["zipode", "household_size", "income_amount", "income_frequency"] def eligible(self) -> Eligibility: e = Eligibility() @@ -37,13 +37,13 @@ def eligible(self) -> Eligibility: has_benefit = self.screen.has_benefit(benefit) for benefit in self.data: - if benefit['name_abbreviated'] in LowWageCovidRelief.auto_eligible_benefits and benefit['eligible']: + if benefit["name_abbreviated"] in LowWageCovidRelief.auto_eligible_benefits and benefit["eligible"]: has_benefit = True break # meets income limit income_limit = LowWageCovidRelief.income_limits[self.screen.household_size] - income = self.screen.calc_gross_income('monthly', ['all']) + income = self.screen.calc_gross_income("monthly", ["all"]) meets_income_limit = income <= income_limit if not (meets_income_limit or has_benefit): diff --git a/programs/programs/co/medicaid/adult_with_disability/calculator.py b/programs/programs/co/medicaid/adult_with_disability/calculator.py index 6307319b..06d8db03 100644 --- a/programs/programs/co/medicaid/adult_with_disability/calculator.py +++ b/programs/programs/co/medicaid/adult_with_disability/calculator.py @@ -6,45 +6,48 @@ class MedicaidAdultWithDisability(ProgramCalculator): min_age = 16 max_income_percent = 4.5 earned_deduction = 65 - earned_percent = .5 + earned_percent = 0.5 amount = 310 unearned_deduction = 20 min_age = 16 - insurance_types = ('employer', 'private', 'none') - dependencies = ['insurance', 'age', 'household_size', 'income_type', 'income_amount', 'income_frequency'] + insurance_types = ("employer", "private", "none") + dependencies = ["insurance", "age", "household_size", "income_type", "income_amount", "income_frequency"] def eligible(self) -> Eligibility: e = Eligibility() # Does not qualify for Medicaid - is_medicaid_eligible = self.screen.has_insurance_types(('medicaid',)) + is_medicaid_eligible = self.screen.has_insurance_types(("medicaid",)) for benefit in self.data: - if benefit["name_abbreviated"] == 'medicaid': + if benefit["name_abbreviated"] == "medicaid": is_medicaid_eligible = benefit["eligible"] break - e.condition(not is_medicaid_eligible, messages.must_not_have_benefit('Medicaid')) + e.condition(not is_medicaid_eligible, messages.must_not_have_benefit("Medicaid")) def income_eligible(member): fpl = self.program.fpl.as_dict() income_limit = fpl[self.screen.household_size] * MedicaidAdultWithDisability.max_income_percent earned_deduction = MedicaidAdultWithDisability.earned_deduction earned_percent = MedicaidAdultWithDisability.earned_percent - earned = max(0, int( - (int(member.calc_gross_income('yearly', ['earned'])) - earned_deduction) * earned_percent - )) + earned = max( + 0, int((int(member.calc_gross_income("yearly", ["earned"])) - earned_deduction) * earned_percent) + ) unearned_deduction = MedicaidAdultWithDisability.unearned_deduction - unearned = int(member.calc_gross_income('yearly', ['unearned'])) - unearned_deduction + unearned = int(member.calc_gross_income("yearly", ["unearned"])) - unearned_deduction return earned + unearned <= income_limit - e.member_eligibility(self.screen.household_members.all(), [ - ( - lambda m: m.age >= MedicaidAdultWithDisability.min_age, - messages.older_than(min_age=MedicaidAdultWithDisability.min_age) - ), - (lambda m: m.long_term_disability or m.visually_impaired, messages.has_disability()), - (lambda m: m.insurance.has_insurance_types(MedicaidAdultWithDisability.insurance_types), None), - (income_eligible, None) - ]) + e.member_eligibility( + self.screen.household_members.all(), + [ + ( + lambda m: m.age >= MedicaidAdultWithDisability.min_age, + messages.older_than(min_age=MedicaidAdultWithDisability.min_age), + ), + (lambda m: m.long_term_disability or m.visually_impaired, messages.has_disability()), + (lambda m: m.insurance.has_insurance_types(MedicaidAdultWithDisability.insurance_types), None), + (income_eligible, None), + ], + ) return e diff --git a/programs/programs/co/medicaid/child_with_disability/calculator.py b/programs/programs/co/medicaid/child_with_disability/calculator.py index 4a49afb6..170c7aef 100644 --- a/programs/programs/co/medicaid/child_with_disability/calculator.py +++ b/programs/programs/co/medicaid/child_with_disability/calculator.py @@ -6,37 +6,40 @@ class MedicaidChildWithDisability(ProgramCalculator): max_age = 18 max_income_percent = 3 earned_deduction = 90 - income_percent = 1 - .33 - insurance_types = ('employer', 'private', 'none') + income_percent = 1 - 0.33 + insurance_types = ("employer", "private", "none") amount = 200 - dependencies = ['insurance', 'age', 'household_size', 'income_type', 'income_amount', 'income_frequency'] + dependencies = ["insurance", "age", "household_size", "income_type", "income_amount", "income_frequency"] def eligible(self) -> Eligibility: e = Eligibility() # Does not qualify for Medicaid - is_medicaid_eligible = self.screen.has_insurance_types(['medicaid']) + is_medicaid_eligible = self.screen.has_insurance_types(["medicaid"]) for benefit in self.data: - if benefit["name_abbreviated"] == 'medicaid': + if benefit["name_abbreviated"] == "medicaid": is_medicaid_eligible = benefit["eligible"] break - e.condition(not is_medicaid_eligible, messages.must_not_have_benefit('Medicaid')) + e.condition(not is_medicaid_eligible, messages.must_not_have_benefit("Medicaid")) fpl = self.program.fpl.as_dict() income_limit = fpl[self.screen.household_size] * MedicaidChildWithDisability.max_income_percent - earned = max(0, int( - self.screen.calc_gross_income('yearly', ['earned']) - MedicaidChildWithDisability.earned_deduction - )) - unearned = self.screen.calc_gross_income('yearly', ['unearned']) + earned = max( + 0, int(self.screen.calc_gross_income("yearly", ["earned"]) - MedicaidChildWithDisability.earned_deduction) + ) + unearned = self.screen.calc_gross_income("yearly", ["unearned"]) income = (earned + unearned) * MedicaidChildWithDisability.income_percent e.condition(income <= income_limit, messages.income(income, income_limit)) - e.member_eligibility(self.screen.household_members.all(), [ - (lambda m: m.age <= MedicaidChildWithDisability.max_age, messages.child()), - (lambda m: m.long_term_disability or m.visually_impaired, messages.has_disability()), - (lambda m: m.insurance.has_insurance_types(MedicaidChildWithDisability.insurance_types), None), - (lambda m: not (m.calc_gross_income('yearly', ['earned']) >= 0 and m.age >= 16), None), - ]) + e.member_eligibility( + self.screen.household_members.all(), + [ + (lambda m: m.age <= MedicaidChildWithDisability.max_age, messages.child()), + (lambda m: m.long_term_disability or m.visually_impaired, messages.has_disability()), + (lambda m: m.insurance.has_insurance_types(MedicaidChildWithDisability.insurance_types), None), + (lambda m: not (m.calc_gross_income("yearly", ["earned"]) >= 0 and m.age >= 16), None), + ], + ) return e diff --git a/programs/programs/co/medicaid/emergency/calculator.py b/programs/programs/co/medicaid/emergency/calculator.py index 3e0f5f4c..308a16b0 100644 --- a/programs/programs/co/medicaid/emergency/calculator.py +++ b/programs/programs/co/medicaid/emergency/calculator.py @@ -4,7 +4,7 @@ class EmergencyMedicaid(ProgramCalculator): amount = 9_540 - dependencies = ['insurance'] + dependencies = ["insurance"] def eligible(self) -> Eligibility: e = Eligibility() @@ -12,19 +12,14 @@ def eligible(self) -> Eligibility: # Does qualify for Medicaid is_medicaid_eligible = False for benefit in self.data: - if benefit["name_abbreviated"] == 'medicaid': + if benefit["name_abbreviated"] == "medicaid": is_medicaid_eligible = benefit["eligible"] break - e.condition(is_medicaid_eligible, messages.must_have_benefit('Medicaid')) + e.condition(is_medicaid_eligible, messages.must_have_benefit("Medicaid")) e.member_eligibility( self.screen.household_members.all(), - [ - ( - lambda m: m.insurance.has_insurance_types(('none',)), - messages.has_no_insurance() - ) - ] + [(lambda m: m.insurance.has_insurance_types(("none",)), messages.has_no_insurance())], ) return e diff --git a/programs/programs/co/medicaid/family_planning_services/calculator.py b/programs/programs/co/medicaid/family_planning_services/calculator.py index 68b1fc0f..072d7cc5 100644 --- a/programs/programs/co/medicaid/family_planning_services/calculator.py +++ b/programs/programs/co/medicaid/family_planning_services/calculator.py @@ -6,7 +6,7 @@ class FamilyPlanningServices(ProgramCalculator): amount = 404 min_age = 12 fpl_percent = 2.6 - dependencies = ['age', 'insurance', 'income_frequency', 'income_amount', 'household_size'] + dependencies = ["age", "insurance", "income_frequency", "income_amount", "household_size"] def eligible(self) -> Eligibility: e = Eligibility() @@ -14,30 +14,27 @@ def eligible(self) -> Eligibility: # Does not have insurance has_no_insurance = False for member in self.screen.household_members.all(): - has_no_insurance = member.insurance.has_insurance_types(('none',)) or has_no_insurance + has_no_insurance = member.insurance.has_insurance_types(("none",)) or has_no_insurance e.condition(has_no_insurance, messages.has_no_insurance()) # Not Medicaid eligible - is_medicaid_eligible = self.screen.has_benefit('medicaid') + is_medicaid_eligible = self.screen.has_benefit("medicaid") for benefit in self.data: - if benefit["name_abbreviated"] == 'medicaid': + if benefit["name_abbreviated"] == "medicaid": is_medicaid_eligible = benefit["eligible"] or is_medicaid_eligible break - e.condition(not is_medicaid_eligible, messages.must_not_have_benefit('Medicaid')) + e.condition(not is_medicaid_eligible, messages.must_not_have_benefit("Medicaid")) e.member_eligibility( self.screen.household_members.all(), - [ - (lambda m: not m.pregnant, None), - (lambda m: m.age >= FamilyPlanningServices.min_age, None) - ] + [(lambda m: not m.pregnant, None), (lambda m: m.age >= FamilyPlanningServices.min_age, None)], ) # Income fpl = self.program.fpl.as_dict() income_limit = int(FamilyPlanningServices.fpl_percent * fpl[self.screen.household_size]) - gross_income = int(self.screen.calc_gross_income('yearly', ['all'])) + gross_income = int(self.screen.calc_gross_income("yearly", ["all"])) e.condition(gross_income < income_limit, messages.income(gross_income, income_limit)) diff --git a/programs/programs/co/medicaid/family_planning_services/tests.py b/programs/programs/co/medicaid/family_planning_services/tests.py index e8b466a4..a9ea43ea 100644 --- a/programs/programs/co/medicaid/family_planning_services/tests.py +++ b/programs/programs/co/medicaid/family_planning_services/tests.py @@ -7,14 +7,14 @@ class TestFamilyPlanningServicesPension(TestCase): def setUp(self): self.screen1 = Screen.objects.create( agree_to_tos=True, - zipcode='80205', - county='Denver County', + zipcode="80205", + county="Denver County", household_size=2, household_assets=0, ) self.person1 = HouseholdMember.objects.create( screen=self.screen1, - relationship='headOfHousehold', + relationship="headOfHousehold", age=60, student=False, student_full_time=False, @@ -29,7 +29,7 @@ def setUp(self): ) self.person2 = HouseholdMember.objects.create( screen=self.screen1, - relationship='child', + relationship="child", age=10, student=True, student_full_time=False, @@ -44,7 +44,7 @@ def setUp(self): ) def test_family_planning_services_pass_all_conditions(self): - fps = FamilyPlanningServices(self.screen1, [{"name_abbreviated": 'medicaid', "eligible": False}]) + fps = FamilyPlanningServices(self.screen1, [{"name_abbreviated": "medicaid", "eligible": False}]) eligibility = fps.eligibility self.assertTrue(eligibility["eligible"]) @@ -53,15 +53,10 @@ def test_family_planning_services_failed_all_conditions(self): self.person2.age = 20 self.person2.save() IncomeStream.objects.create( - screen=self.screen1, - household_member=self.person1, - type='wages', - amount=4000, - frequency='monthly' + screen=self.screen1, household_member=self.person1, type="wages", amount=4000, frequency="monthly" ) - fps = FamilyPlanningServices(self.screen1, - [{"name_abbreviated": 'medicaid', "eligible": True}]) + fps = FamilyPlanningServices(self.screen1, [{"name_abbreviated": "medicaid", "eligible": True}]) eligibility = fps.eligibility self.assertFalse(eligibility["eligible"]) diff --git a/programs/programs/co/my_spark/calculator.py b/programs/programs/co/my_spark/calculator.py index 5b0c9204..9b8bd989 100644 --- a/programs/programs/co/my_spark/calculator.py +++ b/programs/programs/co/my_spark/calculator.py @@ -7,8 +7,8 @@ class MySpark(ProgramCalculator): amount_per_child = 1_000 max_age = 14 min_age = 11 - county = 'Denver County' - dependencies = ['age', 'zipcode'] + county = "Denver County" + dependencies = ["age", "zipcode"] def eligible(self) -> Eligibility: e = Eligibility() @@ -16,10 +16,10 @@ def eligible(self) -> Eligibility: # Qualify for FRL is_frl_eligible = False for benefit in self.data: - if benefit["name_abbreviated"] == 'nslp': + if benefit["name_abbreviated"] == "nslp": is_frl_eligible = benefit["eligible"] break - e.condition(is_frl_eligible, messages.must_have_benefit('Free or Reduced Lunch')) + e.condition(is_frl_eligible, messages.must_have_benefit("Free or Reduced Lunch")) if self.screen.county is not None: counties = [self.screen.county] @@ -35,9 +35,9 @@ def eligible(self) -> Eligibility: [ ( lambda m: m.age >= MySpark.min_age and m.age <= MySpark.max_age, - messages.child(MySpark.min_age, MySpark.max_age) + messages.child(MySpark.min_age, MySpark.max_age), ) - ] + ], ) return e diff --git a/programs/programs/co/mydenver/calculator.py b/programs/programs/co/mydenver/calculator.py index ad87dd15..7985e7a4 100644 --- a/programs/programs/co/mydenver/calculator.py +++ b/programs/programs/co/mydenver/calculator.py @@ -4,11 +4,11 @@ class MyDenver(ProgramCalculator): - eligible_counties = ['Denver County'] + eligible_counties = ["Denver County"] child_age_min = 5 child_age_max = 18 - child_relationship = ['child', 'fosterChild', 'stepChild', 'grandChild', 'relatedOther', 'headOfHousehold'] - dependencies = ['age', 'zipcode', 'relationship'] + child_relationship = ["child", "fosterChild", "stepChild", "grandChild", "relatedOther", "headOfHousehold"] + dependencies = ["age", "zipcode", "relationship"] def eligible(self) -> Eligibility: e = Eligibility() @@ -30,7 +30,7 @@ def eligible(self) -> Eligibility: children = self.screen.num_children( age_max=MyDenver.child_age_max, age_min=MyDenver.child_age_min, - child_relationship=MyDenver.child_relationship + child_relationship=MyDenver.child_relationship, ) e.condition(children > 0, messages.child(min_age=5)) @@ -41,7 +41,7 @@ def value(self, eligible_members: int): children = self.screen.num_children( age_max=MyDenver.child_age_max, age_min=MyDenver.child_age_min, - child_relationship=MyDenver.child_relationship + child_relationship=MyDenver.child_relationship, ) return children * 150 diff --git a/programs/programs/co/nfp/calculator.py b/programs/programs/co/nfp/calculator.py index e01a6b21..d71adeef 100644 --- a/programs/programs/co/nfp/calculator.py +++ b/programs/programs/co/nfp/calculator.py @@ -6,21 +6,13 @@ def calculate_nfp(screen, data, program): eligibility = eligibility_nfp(screen, program) value = value_nfp(screen) - calculation = { - 'eligibility': eligibility, - 'value': value - } + calculation = {"eligibility": eligibility, "value": value} return calculation def eligibility_nfp(screen, program): - - eligibility = { - "eligible": True, - "passed": [], - "failed": [] - } + eligibility = {"eligible": True, "passed": [], "failed": []} frequency = "yearly" @@ -36,10 +28,12 @@ def eligibility_nfp(screen, program): eligibility["eligible"] = False eligibility["failed"].append( _("Calculated income of ") - + str(math.trunc(gross_income)) + _(" for a household with ") + + str(math.trunc(gross_income)) + + _(" for a household with ") + str(screen.household_size) + _(" members is above the income limit of ") - + str(income_limit)) + + str(income_limit) + ) else: eligibility["passed"].append( _("Calculated income of ") @@ -47,7 +41,8 @@ def eligibility_nfp(screen, program): + _(" for a household with ") + str(screen.household_size) + _(" members is below the income limit of ") - + str(income_limit)) + + str(income_limit) + ) return eligibility diff --git a/programs/programs/co/omnisalud/calculator.py b/programs/programs/co/omnisalud/calculator.py index d6b5145d..b8d22887 100644 --- a/programs/programs/co/omnisalud/calculator.py +++ b/programs/programs/co/omnisalud/calculator.py @@ -6,7 +6,7 @@ class OmniSalud(ProgramCalculator): individual_limit = 1699 family_4_limit = 3469 amount = 610 - dependencies = ['income_amount', 'income_frequency', 'household_size', 'age', 'insurance'] + dependencies = ["income_amount", "income_frequency", "household_size", "age", "insurance"] def eligible(self) -> Eligibility: e = Eligibility() @@ -17,7 +17,7 @@ def eligible(self) -> Eligibility: e.condition(gross_income <= income_band, messages.income(gross_income, income_band)) # No health insurance - has_no_hi = self.screen.has_insurance_types(('none',)) + has_no_hi = self.screen.has_insurance_types(("none",)) e.condition(has_no_hi, messages.has_no_insurance()) return e diff --git a/programs/programs/co/omnisalud/tests.py b/programs/programs/co/omnisalud/tests.py index 0078afd0..23845a1a 100644 --- a/programs/programs/co/omnisalud/tests.py +++ b/programs/programs/co/omnisalud/tests.py @@ -7,15 +7,15 @@ class TestOmniSaludPension(TestCase): def setUp(self): self.screen1 = Screen.objects.create( agree_to_tos=True, - zipcode='80205', - county='Denver County', + zipcode="80205", + county="Denver County", household_size=1, household_assets=0, - has_no_hi=True + has_no_hi=True, ) self.person1 = HouseholdMember.objects.create( screen=self.screen1, - relationship='headOfHousehold', + relationship="headOfHousehold", age=20, student=False, student_full_time=False, @@ -39,11 +39,7 @@ def test_omnisalud_failed_all_conditions(self): self.screen1.has_no_hi = False self.screen1.save() IncomeStream.objects.create( - screen=self.screen1, - household_member=self.person1, - type='wages', - amount=2000, - frequency='monthly' + screen=self.screen1, household_member=self.person1, type="wages", amount=2000, frequency="monthly" ) omnisalud = OmniSalud(self.screen1) diff --git a/programs/programs/co/pe/__init__.py b/programs/programs/co/pe/__init__.py index 871fc89a..a43da0d8 100644 --- a/programs/programs/co/pe/__init__.py +++ b/programs/programs/co/pe/__init__.py @@ -4,19 +4,18 @@ co_member_calculators = { - 'co_medicaid': member.CoMedicaid, - 'andcs': member.AidToTheNeedyAndDisabled, - 'oap': member.OldAgePension, - 'chp': member.Chp, + "co_medicaid": member.CoMedicaid, + "andcs": member.AidToTheNeedyAndDisabled, + "oap": member.OldAgePension, + "chp": member.Chp, } co_tax_unit_calculators = { - 'coeitc': tax.Coeitc, - 'coctc': tax.Coctc, + "coeitc": tax.Coeitc, + "coctc": tax.Coctc, } co_pe_calculators: dict[str, type[PolicyEngineCalulator]] = { **co_member_calculators, **co_tax_unit_calculators, } - diff --git a/programs/programs/co/pe/member.py b/programs/programs/co/pe/member.py index ecaca3ea..fc8ab608 100644 --- a/programs/programs/co/pe/member.py +++ b/programs/programs/co/pe/member.py @@ -10,7 +10,7 @@ class CoMedicaid(Medicaid): class AidToTheNeedyAndDisabled(PolicyEngineMembersCalculator): - pe_name = 'co_state_supplement' + pe_name = "co_state_supplement" pe_inputs = [ dependency.member.SsiCountableResourcesDependency, dependency.member.SsiReportedDependency, @@ -27,7 +27,7 @@ class AidToTheNeedyAndDisabled(PolicyEngineMembersCalculator): class OldAgePension(PolicyEngineMembersCalculator): - pe_name = 'co_oap' + pe_name = "co_oap" pe_inputs = [ dependency.member.SsiCountableResourcesDependency, dependency.member.SsiEarnedIncomeDependency, @@ -41,7 +41,7 @@ class OldAgePension(PolicyEngineMembersCalculator): class Chp(PolicyEngineMembersCalculator): - pe_name = 'co_chp' + pe_name = "co_chp" pe_inputs = [ dependency.member.AgeDependency, dependency.member.PregnancyDependency, @@ -55,7 +55,7 @@ def value(self): total = 0 for _, pvalue in self.get_data().items(): - if pvalue['co_chp_eligible'][self.pe_period] > 0 and self.screen.has_insurance_types(('none',)): + if pvalue["co_chp_eligible"][self.pe_period] > 0 and self.screen.has_insurance_types(("none",)): total += self.amount return total diff --git a/programs/programs/co/pe/tax.py b/programs/programs/co/pe/tax.py index e260c77a..feea9ca4 100644 --- a/programs/programs/co/pe/tax.py +++ b/programs/programs/co/pe/tax.py @@ -4,13 +4,13 @@ class Coeitc(PolicyEngineTaxUnitCalulator): - pe_name = 'co_eitc' + pe_name = "co_eitc" pe_inputs = Eitc.pe_inputs pe_outputs = [dependency.tax.Coeitc] class Coctc(PolicyEngineTaxUnitCalulator): - pe_name = 'ctc' + pe_name = "ctc" pe_inputs = [ dependency.member.AgeDependency, dependency.member.TaxUnitDependentDependency, @@ -20,18 +20,18 @@ class Coctc(PolicyEngineTaxUnitCalulator): pe_outputs = [dependency.tax.Ctc] income_bands = { - "single": [{"max": 25000, "percent": .6}, {"max": 50000, "percent": .3}, {"max": 75000, "percent": .1}], - "maried": [{"max": 35000, "percent": .6}, {"max": 60000, "percent": .3}, {"max": 85000, "percent": .1}] + "single": [{"max": 25000, "percent": 0.6}, {"max": 50000, "percent": 0.3}, {"max": 75000, "percent": 0.1}], + "maried": [{"max": 35000, "percent": 0.6}, {"max": 60000, "percent": 0.3}, {"max": 85000, "percent": 0.1}], } def value(self): - income = self.screen.calc_gross_income('yearly', ['all']) - relationship_status = 'maried' if self.screen.is_joint() else 'single' + income = self.screen.calc_gross_income("yearly", ["all"]) + relationship_status = "maried" if self.screen.is_joint() else "single" multiplier = 0 for band in self.income_bands[relationship_status]: # if the income is less than the band then set the multiplier and break out of the loop - if income <= band['max']: - multiplier = band['percent'] + if income <= band["max"]: + multiplier = band["percent"] break return self.get_data()[self.pe_name][self.pe_period] * multiplier diff --git a/programs/programs/co/property_credit_rebate/calculator.py b/programs/programs/co/property_credit_rebate/calculator.py index 274271c3..7165047d 100644 --- a/programs/programs/co/property_credit_rebate/calculator.py +++ b/programs/programs/co/property_credit_rebate/calculator.py @@ -7,7 +7,7 @@ class PropertyCreditRebate(ProgramCalculator): min_age = 65 disabled_min_age = 18 income_limit = {"single": 18_026, "married": 23_345} - dependencies = ['age', 'income_frequency', 'income_amount', 'relationship'] + dependencies = ["age", "income_frequency", "income_amount", "relationship"] def eligible(self) -> Eligibility: e = Eligibility() @@ -22,20 +22,20 @@ def eligible(self) -> Eligibility: # Someone is old enough someone_old_enough = self.screen.num_adults(age_max=PropertyCreditRebate.min_age) >= 1 - e.condition(someone_disabled or someone_old_enough, - messages.has_disability()) + e.condition(someone_disabled or someone_old_enough, messages.has_disability()) - e.condition(someone_disabled or someone_old_enough, - messages.older_than(PropertyCreditRebate.min_age)) + e.condition(someone_disabled or someone_old_enough, messages.older_than(PropertyCreditRebate.min_age)) # Income test - relationship_status = 'single' + relationship_status = "single" for member_id, married_to in self.screen.relationship_map().items(): if married_to is not None: - relationship_status = 'married' + relationship_status = "married" - gross_income = self.screen.calc_gross_income('yearly', ['all']) - e.condition(gross_income <= PropertyCreditRebate.income_limit[relationship_status], - messages.income(gross_income, PropertyCreditRebate.income_limit[relationship_status])) + gross_income = self.screen.calc_gross_income("yearly", ["all"]) + e.condition( + gross_income <= PropertyCreditRebate.income_limit[relationship_status], + messages.income(gross_income, PropertyCreditRebate.income_limit[relationship_status]), + ) return e diff --git a/programs/programs/co/property_credit_rebate/tests.py b/programs/programs/co/property_credit_rebate/tests.py index 849bbfea..3cb476ab 100644 --- a/programs/programs/co/property_credit_rebate/tests.py +++ b/programs/programs/co/property_credit_rebate/tests.py @@ -7,16 +7,16 @@ class TestPropertyCreditRebatePension(TestCase): def setUp(self): self.screen1 = Screen.objects.create( agree_to_tos=True, - zipcode='80205', - county='Denver County', + zipcode="80205", + county="Denver County", household_size=2, household_assets=0, has_tanf=False, - has_ssi=False + has_ssi=False, ) self.person1 = HouseholdMember.objects.create( screen=self.screen1, - relationship='headOfHousehold', + relationship="headOfHousehold", age=65, student=False, student_full_time=False, @@ -45,12 +45,8 @@ def test_property_credit_rebate_failed_all_conditions(self): self.person1.disabled = False self.person1.save() income = IncomeStream.objects.create( - screen=self.screen1, - household_member=self.person1, - type='wages', - amount=2000, - frequency='monthly' - ) + screen=self.screen1, household_member=self.person1, type="wages", amount=2000, frequency="monthly" + ) cpcr = PropertyCreditRebate(self.screen1) eligibility = cpcr.eligibility diff --git a/programs/programs/co/rental_assistance_grant/calculator.py b/programs/programs/co/rental_assistance_grant/calculator.py index 20e7c02f..a0fd0af3 100644 --- a/programs/programs/co/rental_assistance_grant/calculator.py +++ b/programs/programs/co/rental_assistance_grant/calculator.py @@ -6,18 +6,18 @@ class RAGCache(GoogleSheetsCache): default = {} - sheet_id = '1DntpIXZfUY2yTy1_rAhaGLUH4PUAfpTSAn-j2tf2tts' + sheet_id = "1DntpIXZfUY2yTy1_rAhaGLUH4PUAfpTSAn-j2tf2tts" range_name = "'2023 80% AMI'!A2:I65" def update(self): data = super().update() - return {d[0].strip() + ' County': [int(v.replace(',', '')) for v in d[1:]] for d in data} + return {d[0].strip() + " County": [int(v.replace(",", "")) for v in d[1:]] for d in data} class RentalAssistanceGrant(ProgramCalculator): amount = 10_000 - dependencies = ['income_amount', 'income_frequency', 'household_size', 'zipcode'] + dependencies = ["income_amount", "income_frequency", "household_size", "zipcode"] income_limits = RAGCache() def eligible(self) -> Eligibility: @@ -28,7 +28,7 @@ def eligible(self) -> Eligibility: county_name = self.screen.county if self.screen.county is not None else counties[0] # income - gross_income = int(self.screen.calc_gross_income('yearly', ['all'])) + gross_income = int(self.screen.calc_gross_income("yearly", ["all"])) limits = self.income_limits.fetch() @@ -40,4 +40,3 @@ def eligible(self) -> Eligibility: e.condition(gross_income <= income_limit, messages.income(gross_income, income_limit)) return e - diff --git a/programs/programs/co/reproductive_health_care/calculator.py b/programs/programs/co/reproductive_health_care/calculator.py index 54debbd8..dd498460 100644 --- a/programs/programs/co/reproductive_health_care/calculator.py +++ b/programs/programs/co/reproductive_health_care/calculator.py @@ -4,19 +4,19 @@ class ReproductiveHealthCare(ProgramCalculator): amount = 268 - dependencies = ['insurance'] + dependencies = ["insurance"] def eligible(self) -> Eligibility: e = Eligibility() # No health insurance - has_no_hi = self.screen.has_insurance_types(('none',)) + has_no_hi = self.screen.has_insurance_types(("none",)) e.condition(has_no_hi, messages.has_no_insurance()) # Medicade eligibility is_medicaid_eligible = False for benefit in self.data: - if benefit["name_abbreviated"] == 'medicaid': + if benefit["name_abbreviated"] == "medicaid": is_medicaid_eligible = benefit["eligible"] break diff --git a/programs/programs/co/reproductive_health_care/tests.py b/programs/programs/co/reproductive_health_care/tests.py index 10fd1ad3..76ee25a5 100644 --- a/programs/programs/co/reproductive_health_care/tests.py +++ b/programs/programs/co/reproductive_health_care/tests.py @@ -30,9 +30,7 @@ def setUp(self): ) def test_reproductive_health_care_pass_all_conditions(self): - rhc = ReproductiveHealthCare( - self.screen1, [{"name_abbreviated": "medicaid", "eligible": True}] - ) + rhc = ReproductiveHealthCare(self.screen1, [{"name_abbreviated": "medicaid", "eligible": True}]) eligibility = rhc.eligibility self.assertTrue(eligibility["eligible"]) @@ -41,9 +39,7 @@ def test_reproductive_health_care_failed_all_conditions(self): self.person1.has_no_hi = False self.person1.save() - rhc = ReproductiveHealthCare( - self.screen1, [{"name_abbreviated": "medicaid", "eligible": False}] - ) + rhc = ReproductiveHealthCare(self.screen1, [{"name_abbreviated": "medicaid", "eligible": False}]) eligibility = rhc.eligibility self.assertFalse(eligibility["eligible"]) diff --git a/programs/programs/co/rtdlive/calculator.py b/programs/programs/co/rtdlive/calculator.py index 2772afcb..025c2512 100644 --- a/programs/programs/co/rtdlive/calculator.py +++ b/programs/programs/co/rtdlive/calculator.py @@ -6,19 +6,19 @@ class RtdLive(ProgramCalculator): eligible_counties = [ - 'Adams County', - 'Arapahoe County', - 'Boulder County', - 'Broomfield County', - 'Denver County', - 'Douglas County', - 'Jefferson County' + "Adams County", + "Arapahoe County", + "Boulder County", + "Broomfield County", + "Denver County", + "Douglas County", + "Jefferson County", ] min_age = 20 max_age = 64 percent_of_fpl = 2.5 amount = 732 - dependencies = ['age', 'income_amount', 'income_frequency', 'zipcode', 'household_size'] + dependencies = ["age", "income_amount", "income_frequency", "zipcode", "household_size"] def eligible(self) -> Eligibility: e = Eligibility() @@ -29,7 +29,7 @@ def eligible(self) -> Eligibility: # income frequency = "yearly" - income_types = ['all'] + income_types = ["all"] fpl = self.program.fpl.as_dict() income_limit = RtdLive.percent_of_fpl * fpl[len(members)] @@ -47,7 +47,7 @@ def eligible(self) -> Eligibility: lambda m: m.age >= RtdLive.min_age and m.age <= RtdLive.max_age, messages.adult(RtdLive.min_age, RtdLive.max_age), ), - ] + ], ) # geography diff --git a/programs/programs/co/tabor/calculator.py b/programs/programs/co/tabor/calculator.py index fbacb075..ea1e4006 100644 --- a/programs/programs/co/tabor/calculator.py +++ b/programs/programs/co/tabor/calculator.py @@ -5,16 +5,14 @@ class Tabor(ProgramCalculator): min_age = 18 amount = 800 - dependencies = ['age'] + dependencies = ["age"] def eligible(self) -> Eligibility: e = Eligibility() e.member_eligibility( self.screen.household_members.all(), - [ - (lambda m: m.age >= Tabor.min_age, messages.older_than(Tabor.min_age)) - ] + [(lambda m: m.age >= Tabor.min_age, messages.older_than(Tabor.min_age))], ) return e diff --git a/programs/programs/co/trua/calculator.py b/programs/programs/co/trua/calculator.py index 33057c53..396dbfcf 100644 --- a/programs/programs/co/trua/calculator.py +++ b/programs/programs/co/trua/calculator.py @@ -15,16 +15,16 @@ class Trua(ProgramCalculator): 8: 124_950, } - county = 'Denver County' + county = "Denver County" amount = 6_500 - dependencies = ['income_amount', 'income_frequency', 'household_size', 'zipcode'] + dependencies = ["income_amount", "income_frequency", "household_size", "zipcode"] def eligible(self) -> Eligibility: e = Eligibility() # Income test gross_income = int(self.screen.calc_gross_income("monthly", ["all"])) - income_limit = int(Trua.income_limit[self.screen.household_size]/12) + income_limit = int(Trua.income_limit[self.screen.household_size] / 12) # Location test zipcode = self.screen.zipcode diff --git a/programs/programs/co/universal_preschool/calculator.py b/programs/programs/co/universal_preschool/calculator.py index 0916f97e..5e1241a6 100644 --- a/programs/programs/co/universal_preschool/calculator.py +++ b/programs/programs/co/universal_preschool/calculator.py @@ -6,12 +6,8 @@ class UniversalPreschool(ProgramCalculator): qualifying_age = 3 age = 4 percent_of_fpl = 2.7 - amount = { - '10_hours': 4_837, - '15_hours': 6_044, - '30_hours': 10_655 - } - dependencies = ['age', 'income_amount', 'income_frequency', 'relationship', 'household_size'] + amount = {"10_hours": 4_837, "15_hours": 6_044, "30_hours": 10_655} + dependencies = ["age", "income_amount", "income_frequency", "relationship", "household_size"] def eligible(self) -> Eligibility: e = Eligibility() @@ -19,7 +15,7 @@ def eligible(self) -> Eligibility: foster_children = self.screen.num_children( age_min=UniversalPreschool.qualifying_age, age_max=UniversalPreschool.age, - child_relationship=['fosterChild'] + child_relationship=["fosterChild"], ) income_requirement = self._meets_income_requirement() @@ -28,15 +24,14 @@ def eligible(self) -> Eligibility: # Has child children = self.screen.num_children(age_min=UniversalPreschool.age, age_max=UniversalPreschool.age) qualifying_children = self.screen.num_children( - age_min=UniversalPreschool.qualifying_age, - age_max=UniversalPreschool.age + age_min=UniversalPreschool.qualifying_age, age_max=UniversalPreschool.age ) min_age = UniversalPreschool.qualifying_age if other_factors else UniversalPreschool.age e.condition( children >= 1 or (qualifying_children >= 1 and other_factors), - messages.child(min_age, UniversalPreschool.age) + messages.child(min_age, UniversalPreschool.age), ) return e @@ -48,17 +43,17 @@ def value(self, eligible_members: int): for child in self.screen.household_members.filter( age__range=(UniversalPreschool.qualifying_age, UniversalPreschool.age) ): - if child.relationship == 'fosterChild' or income_requirement: + if child.relationship == "fosterChild" or income_requirement: if child.age == 3: - value += UniversalPreschool.amount['10_hours'] + value += UniversalPreschool.amount["10_hours"] else: - value += UniversalPreschool.amount['30_hours'] + value += UniversalPreschool.amount["30_hours"] else: - value += UniversalPreschool.amount['15_hours'] + value += UniversalPreschool.amount["15_hours"] return value def _meets_income_requirement(self): fpl = self.program.fpl.as_dict() income_limit = int(UniversalPreschool.percent_of_fpl * fpl[self.screen.household_size]) - return self.screen.calc_gross_income('yearly', ['all']) < income_limit + return self.screen.calc_gross_income("yearly", ["all"]) < income_limit diff --git a/programs/programs/co/utility_bill_pay/calculator.py b/programs/programs/co/utility_bill_pay/calculator.py index e93169bd..f47b513c 100644 --- a/programs/programs/co/utility_bill_pay/calculator.py +++ b/programs/programs/co/utility_bill_pay/calculator.py @@ -13,9 +13,9 @@ class UtilityBillPay(ProgramCalculator): 96_014, 101_120, ) - presumptive_eligibility = ('snap', 'ssi', 'andcs', 'tanf', 'wic') + presumptive_eligibility = ("snap", "ssi", "andcs", "tanf", "wic") amount = 350 - dependencies = ['household_size', 'income_amount', 'income_frequency'] + dependencies = ["household_size", "income_amount", "income_frequency"] def eligible(self) -> Eligibility: e = Eligibility() @@ -27,7 +27,7 @@ def eligible(self) -> Eligibility: presumptive_eligible = True # income - income = int(self.screen.calc_gross_income('yearly', ['all'])) + income = int(self.screen.calc_gross_income("yearly", ["all"])) income_limit = UtilityBillPay.income_limits[self.screen.household_size - 1] e.condition(income < income_limit or presumptive_eligible, messages.income(income, income_limit)) diff --git a/programs/programs/co/weatherization_assistance/calculator.py b/programs/programs/co/weatherization_assistance/calculator.py index 596d2b48..2f8190dc 100644 --- a/programs/programs/co/weatherization_assistance/calculator.py +++ b/programs/programs/co/weatherization_assistance/calculator.py @@ -13,16 +13,16 @@ class WeatherizationAssistance(ProgramCalculator): 96_014, 101_120, ) - presumptive_eligibility = ('andcs', 'ssi', 'snap', 'leap', 'tanf') + presumptive_eligibility = ("andcs", "ssi", "snap", "leap", "tanf") amount = 350 - dependencies = ['household_size', 'income_amount', 'income_frequency'] + dependencies = ["household_size", "income_amount", "income_frequency"] def eligible(self) -> Eligibility: e = Eligibility() # income condition income_limit = WeatherizationAssistance.income_limits[self.screen.household_size - 1] - income = int(self.screen.calc_gross_income('yearly', ['all'])) + income = int(self.screen.calc_gross_income("yearly", ["all"])) income_eligible = income <= income_limit # categorical eligibility diff --git a/programs/programs/federal/__init__.py b/programs/programs/federal/__init__.py index b8f23164..60fd00ab 100644 --- a/programs/programs/federal/__init__.py +++ b/programs/programs/federal/__init__.py @@ -4,7 +4,7 @@ from ..calc import ProgramCalculator federal_calculators: dict[str, type[ProgramCalculator]] = { - 'ssdi': Ssdi, - 'chs': HeadStart, - 'medicare_savings': MedicareSavings, + "ssdi": Ssdi, + "chs": HeadStart, + "medicare_savings": MedicareSavings, } diff --git a/programs/programs/federal/head_start/calculator.py b/programs/programs/federal/head_start/calculator.py index 2e343d80..d9f5dec9 100644 --- a/programs/programs/federal/head_start/calculator.py +++ b/programs/programs/federal/head_start/calculator.py @@ -8,9 +8,9 @@ class HeadStart(ProgramCalculator): amount = 10655 max_age = 5 min_age = 3 - adams_percent_of_fpl = 1.3 # Adams County uses 130% FPL instead of 100% FPL - adams_county = 'Adams County' - dependencies = ['age', 'household_size', 'income_frequency', 'income_amount', 'zipcode'] + adams_percent_of_fpl = 1.3 # Adams County uses 130% FPL instead of 100% FPL + adams_county = "Adams County" + dependencies = ["age", "household_size", "income_frequency", "income_amount", "zipcode"] def eligible(self) -> Eligibility: e = Eligibility() @@ -33,17 +33,19 @@ def eligible(self) -> Eligibility: break e.condition(in_eligible_county, messages.location()) - + in_adams = HeadStart.adams_county in counties # income fpl = self.program.fpl.as_dict() income_limit = int(fpl[self.screen.household_size] / 12) income_limit_adams_county = int(fpl[self.screen.household_size] / 12 * HeadStart.adams_percent_of_fpl) - gross_income = int(self.screen.calc_gross_income('monthly', ['all'])) + gross_income = int(self.screen.calc_gross_income("monthly", ["all"])) if in_adams: - e.condition(gross_income < income_limit_adams_county, messages.income(gross_income, income_limit_adams_county)) + e.condition( + gross_income < income_limit_adams_county, messages.income(gross_income, income_limit_adams_county) + ) else: e.condition(gross_income < income_limit, messages.income(gross_income, income_limit)) diff --git a/programs/programs/federal/head_start/eligible_zipcodes.py b/programs/programs/federal/head_start/eligible_zipcodes.py index 1b643547..d24b33c5 100644 --- a/programs/programs/federal/head_start/eligible_zipcodes.py +++ b/programs/programs/federal/head_start/eligible_zipcodes.py @@ -1,40 +1,40 @@ eligible_zipcode = [ - 'Adams County', - 'Alamosa County', - 'Arapahoe County', - 'Archuleta County', - 'Bent County', - 'Boulder County', - 'Chaffee County', - 'Conejos County', - 'Costilla County', - 'Delta County', - 'Denver County', - 'Eagle County', - 'El Paso County', - 'Fremont County', - 'Garfield County', - 'Huerfano County', - 'Jefferson County', - 'La Plata County', - 'Lake County', - 'Larimer County', - 'Las Animas County', - 'Lincoln County', - 'Logan County', - 'Mesa County', - 'Moffat County', - 'Montezuma County', - 'Montrose County', - 'Morgan County', - 'Otero County', - 'Prowers County', - 'Pueblo County', - 'Rio Grande County', - 'Saguache County', - 'Summit County', - 'Teller County', - 'Washington County', - 'Weld County', - 'Yuma County', + "Adams County", + "Alamosa County", + "Arapahoe County", + "Archuleta County", + "Bent County", + "Boulder County", + "Chaffee County", + "Conejos County", + "Costilla County", + "Delta County", + "Denver County", + "Eagle County", + "El Paso County", + "Fremont County", + "Garfield County", + "Huerfano County", + "Jefferson County", + "La Plata County", + "Lake County", + "Larimer County", + "Las Animas County", + "Lincoln County", + "Logan County", + "Mesa County", + "Moffat County", + "Montezuma County", + "Montrose County", + "Morgan County", + "Otero County", + "Prowers County", + "Pueblo County", + "Rio Grande County", + "Saguache County", + "Summit County", + "Teller County", + "Washington County", + "Weld County", + "Yuma County", ] diff --git a/programs/programs/federal/head_start/tests.py b/programs/programs/federal/head_start/tests.py index 89c7866c..0e8ce00b 100644 --- a/programs/programs/federal/head_start/tests.py +++ b/programs/programs/federal/head_start/tests.py @@ -7,14 +7,14 @@ class TestHeadStartPension(TestCase): def setUp(self): self.screen1 = Screen.objects.create( agree_to_tos=True, - zipcode='80205', - county='Denver County', + zipcode="80205", + county="Denver County", household_size=2, household_assets=0, ) self.person1 = HouseholdMember.objects.create( screen=self.screen1, - relationship='headOfHousehold', + relationship="headOfHousehold", age=30, student=False, student_full_time=False, @@ -29,7 +29,7 @@ def setUp(self): ) self.person2 = HouseholdMember.objects.create( screen=self.screen1, - relationship='child', + relationship="child", age=4, student=False, student_full_time=False, @@ -51,17 +51,13 @@ def test_head_start_visually_impaired_is_eligible(self): def test_head_start_failed_all_conditions(self): income = IncomeStream.objects.create( - screen=self.screen1, - household_member=self.person1, - type='wages', - amount=2000, - frequency='monthly' + screen=self.screen1, household_member=self.person1, type="wages", amount=2000, frequency="monthly" ) self.screen1.save() - self.person2.age=6 + self.person2.age = 6 self.person2.save() chs = HeadStart(self.screen1) eligibility = chs.eligibility - self.assertFalse(eligibility["eligible"]) \ No newline at end of file + self.assertFalse(eligibility["eligible"]) diff --git a/programs/programs/federal/medicare_savings/calculator.py b/programs/programs/federal/medicare_savings/calculator.py index 0803e45f..b3ef1177 100644 --- a/programs/programs/federal/medicare_savings/calculator.py +++ b/programs/programs/federal/medicare_savings/calculator.py @@ -3,18 +3,18 @@ class MedicareSavings(ProgramCalculator): - valid_insurance = ('none', 'employer', 'private', 'medicare') + valid_insurance = ("none", "employer", "private", "medicare") asset_limit = { - 'single': 10_930, - 'married': 17_130, + "single": 10_930, + "married": 17_130, } income_limit = { - 'single': 1_715, - 'married': 2_320, + "single": 1_715, + "married": 2_320, } min_age = 65 amount = 175 - dependencies = ['household_assets', 'relationship', 'income_frequency', 'income_amount', 'age'] + dependencies = ["household_assets", "relationship", "income_frequency", "income_amount", "age"] def eligible(self) -> Eligibility: e = Eligibility() @@ -22,19 +22,19 @@ def eligible(self) -> Eligibility: members = self.screen.household_members.all() def asset_limit(member): - status = 'married' if member.is_married()['is_married'] else 'single' + status = "married" if member.is_married()["is_married"] else "single" return self.screen.household_assets < MedicareSavings.asset_limit[status] def income_limit(member): is_married = member.is_married() - if not is_married['is_married']: - status = 'single' + if not is_married["is_married"]: + status = "single" spouse_income = 0 else: - status = 'married' - spouse_income = is_married['married_to'].calc_gross_income('monthly', ('all',)) + status = "married" + spouse_income = is_married["married_to"].calc_gross_income("monthly", ("all",)) max_income = MedicareSavings.income_limit[status] - income = member.calc_gross_income('monthly', ('all',)) + spouse_income + income = member.calc_gross_income("monthly", ("all",)) + spouse_income return income < max_income e.member_eligibility( @@ -43,11 +43,11 @@ def income_limit(member): (lambda m: m.age >= MedicareSavings.min_age, messages.older_than(MedicareSavings.min_age)), ( lambda m: m.insurance.has_insurance_types(MedicareSavings.valid_insurance), - messages.has_no_insurance() + messages.has_no_insurance(), ), (asset_limit, None), - (income_limit, None) - ] + (income_limit, None), + ], ) return e diff --git a/programs/programs/federal/pe/__init__.py b/programs/programs/federal/pe/__init__.py index 5416e2db..bafc4afa 100644 --- a/programs/programs/federal/pe/__init__.py +++ b/programs/programs/federal/pe/__init__.py @@ -5,22 +5,22 @@ federal_member_calculators = { - 'wic': member.Wic, - 'pell_grant': member.PellGrant, - 'ssi': member.Ssi, + "wic": member.Wic, + "pell_grant": member.PellGrant, + "ssi": member.Ssi, } federal_spm_unit_calculators = { - 'acp': spm.Acp, - 'lifeline': spm.Lifeline, - 'nslp': spm.SchoolLunch, - 'snap': spm.Snap, - 'tanf': spm.Tanf, + "acp": spm.Acp, + "lifeline": spm.Lifeline, + "nslp": spm.SchoolLunch, + "snap": spm.Snap, + "tanf": spm.Tanf, } federal_tax_unit_calculators = { - 'eitc': tax.Eitc, - 'ctc': tax.Ctc, + "eitc": tax.Eitc, + "ctc": tax.Ctc, } federal_pe_calculators: dict[str, type[PolicyEngineCalulator]] = { @@ -28,4 +28,3 @@ **federal_spm_unit_calculators, **federal_tax_unit_calculators, } - diff --git a/programs/programs/federal/pe/member.py b/programs/programs/federal/pe/member.py index 09bc929c..f335600a 100644 --- a/programs/programs/federal/pe/member.py +++ b/programs/programs/federal/pe/member.py @@ -4,14 +4,14 @@ class Wic(PolicyEngineMembersCalculator): wic_categories = { - 'NONE': 0, - 'INFANT': 130, - 'CHILD': 74, + "NONE": 0, + "INFANT": 130, + "CHILD": 74, "PREGNANT": 100, "POSTPARTUM": 100, "BREASTFEEDING": 100, } - pe_name = 'wic' + pe_name = "wic" pe_inputs = [ dependency.member.PregnancyDependency, dependency.member.AgeDependency, @@ -24,13 +24,13 @@ def value(self): for _, pvalue in self.get_data().items(): if pvalue[self.pe_name][self.pe_period] > 0: - total += self.wic_categories[pvalue['wic_category'][self.pe_period]] * 12 + total += self.wic_categories[pvalue["wic_category"][self.pe_period]] * 12 return total class Medicaid(PolicyEngineMembersCalculator): - pe_name = 'medicaid' + pe_name = "medicaid" pe_inputs = [ dependency.member.AgeDependency, dependency.member.PregnancyDependency, @@ -70,23 +70,25 @@ def value(self): if pvalue[self.pe_name][self.pe_period] <= 0: continue - total += self._value_by_age(pvalue['age'][self.pe_period]) + total += self._value_by_age(pvalue["age"][self.pe_period]) in_wic_demographic = False for member in self.screen.household_members.all(): if member.pregnant is True or member.age <= 5: in_wic_demographic = True if total == 0 and in_wic_demographic: - if self.screen.has_benefit('medicaid') is True \ - or self.screen.has_benefit('tanf') is True \ - or self.screen.has_benefit('snap') is True: + if ( + self.screen.has_benefit("medicaid") is True + or self.screen.has_benefit("tanf") is True + or self.screen.has_benefit("snap") is True + ): total = self.presumptive_amount return total class PellGrant(PolicyEngineMembersCalculator): - pe_name = 'pell_grant' + pe_name = "pell_grant" pe_inputs = [ dependency.member.PellGrantDependentAvailableIncomeDependency, dependency.member.PellGrantCountableAssetsDependency, @@ -102,7 +104,7 @@ class PellGrant(PolicyEngineMembersCalculator): class Ssi(PolicyEngineMembersCalculator): - pe_name = 'ssi' + pe_name = "ssi" pe_inputs = [ dependency.member.SsiCountableResourcesDependency, dependency.member.SsiReportedDependency, @@ -116,4 +118,3 @@ class Ssi(PolicyEngineMembersCalculator): dependency.member.TaxUnitDependentDependency, ] pe_outputs = [dependency.member.Ssi] - diff --git a/programs/programs/federal/pe/spm.py b/programs/programs/federal/pe/spm.py index ec430ff7..152e7657 100644 --- a/programs/programs/federal/pe/spm.py +++ b/programs/programs/federal/pe/spm.py @@ -4,7 +4,7 @@ class Snap(PolicyEngineSpmCalulator): - pe_name = 'snap' + pe_name = "snap" pe_inputs = [ dependency.spm.SnapChildSupportDeductionDependency, dependency.spm.SnapGrossIncomeDependency, @@ -29,7 +29,7 @@ def value(self): class SchoolLunch(PolicyEngineSpmCalulator): - pe_name = 'school_meal_daily_subsidy' + pe_name = "school_meal_daily_subsidy" pe_inputs = dependency.school_lunch_income pe_outputs = [dependency.spm.SchoolMealDailySubsidy, dependency.spm.SchoolMealTier] @@ -40,14 +40,14 @@ def value(self): num_children = self.screen.num_children(3, 18) if self.get_data()[self.pe_name][self.pe_period] > 0 and num_children > 0: - if self.get_data()['school_meal_tier'][self.pe_period] != 'PAID': + if self.get_data()["school_meal_tier"][self.pe_period] != "PAID": total = SchoolLunch.amount * num_children return total class Tanf(PolicyEngineSpmCalulator): - pe_name = 'co_tanf' + pe_name = "co_tanf" pe_inputs = [ dependency.member.AgeDependency, dependency.member.PregnancyDependency, @@ -59,7 +59,7 @@ class Tanf(PolicyEngineSpmCalulator): class Acp(PolicyEngineSpmCalulator): - pe_name = 'acp' + pe_name = "acp" pe_inputs = [ dependency.spm.BroadbandCostDependency, *dependency.irs_gross_income, @@ -68,7 +68,7 @@ class Acp(PolicyEngineSpmCalulator): class Lifeline(PolicyEngineSpmCalulator): - pe_name = 'lifeline' + pe_name = "lifeline" pe_inputs = [ dependency.spm.BroadbandCostDependency, *dependency.irs_gross_income, diff --git a/programs/programs/federal/pe/tax.py b/programs/programs/federal/pe/tax.py index b7e63e8c..ceb6673e 100644 --- a/programs/programs/federal/pe/tax.py +++ b/programs/programs/federal/pe/tax.py @@ -3,7 +3,7 @@ class Eitc(PolicyEngineTaxUnitCalulator): - pe_name = 'eitc' + pe_name = "eitc" pe_inputs = [ dependency.member.AgeDependency, dependency.member.TaxUnitSpouseDependency, @@ -13,9 +13,8 @@ class Eitc(PolicyEngineTaxUnitCalulator): pe_outputs = [dependency.tax.Eitc] - class Ctc(PolicyEngineTaxUnitCalulator): - pe_name = 'ctc' + pe_name = "ctc" pe_inputs = [ dependency.member.AgeDependency, dependency.member.TaxUnitDependentDependency, @@ -23,5 +22,3 @@ class Ctc(PolicyEngineTaxUnitCalulator): *dependency.irs_gross_income, ] pe_outputs = [dependency.tax.Ctc] - - diff --git a/programs/programs/federal/ssdi/calculator.py b/programs/programs/federal/ssdi/calculator.py index 031e742f..b7472fb0 100644 --- a/programs/programs/federal/ssdi/calculator.py +++ b/programs/programs/federal/ssdi/calculator.py @@ -7,7 +7,7 @@ class Ssdi(ProgramCalculator): income_limit = 1_550 income_limit_blind = 2_590 amount = 1_537 - dependencies = ['income_amount', 'income_frequency', 'household_size'] + dependencies = ["income_amount", "income_frequency", "household_size"] def eligible(self) -> Eligibility: e = Eligibility() @@ -20,7 +20,7 @@ def income_condition(member): nonlocal cat_eligibile income_limit = Ssdi.income_limit_blind if member.visually_impaired else Ssdi.income_limit - member_income = member.calc_gross_income('monthly', ('all',)) + member_income = member.calc_gross_income("monthly", ("all",)) if member_income < lowest_income: lowest_income = member_income @@ -30,10 +30,7 @@ def income_condition(member): e.member_eligibility( self.screen.household_members.all(), - [ - (lambda m: m.has_disability(), messages.has_disability()), - (income_condition, None) - ] + [(lambda m: m.has_disability(), messages.has_disability()), (income_condition, None)], ) if cat_eligibile > 0: diff --git a/programs/programs/messages.py b/programs/programs/messages.py index 49f18f07..0ab02d29 100644 --- a/programs/programs/messages.py +++ b/programs/programs/messages.py @@ -1,118 +1,98 @@ def translation(name, i, message): - return { - 'default_message': message, - 'label': f'eligibility_message.{name}-{i}' - } + return {"default_message": message, "label": f"eligibility_message.{name}-{i}"} def income(income, max_income): - ''' + """ Household makes ${income} per year which must be less than ${max_income} - ''' + """ return ( - translation('income', 0, 'Household makes'), - f' ${round(income)} ', - translation('income', 1, 'per year which must be less than'), - f' ${round(max_income)}' + translation("income", 0, "Household makes"), + f" ${round(income)} ", + translation("income", 1, "per year which must be less than"), + f" ${round(max_income)}", ) def assets(asset_limit): - ''' + """ Household resources must not exceed ${asset_limit} - ''' - return ( - translation('assets', 0, 'Household resources must not exceed'), - f' ${round(asset_limit)}' - ) + """ + return (translation("assets", 0, "Household resources must not exceed"), f" ${round(asset_limit)}") def child(min_age=0, max_age=18): - ''' + """ Must have a child between the ages of {min_age} and {max_age} - ''' + """ return ( - translation('child', 0, 'Must have a child between the ages of'), - f' {min_age} ', - translation('child', 1, 'and'), - f' {max_age}' + translation("child", 0, "Must have a child between the ages of"), + f" {min_age} ", + translation("child", 1, "and"), + f" {max_age}", ) def adult(min_age, max_age): - ''' + """ Someone in the household must be between the ages of {min_age} and {max_age} - ''' + """ return ( - translation('adult', 0, 'Someone in the household must be between the ages of'), - f' {min_age} ', - translation('adult', 1, 'and'), - f' {max_age}' + translation("adult", 0, "Someone in the household must be between the ages of"), + f" {min_age} ", + translation("adult", 1, "and"), + f" {max_age}", ) def older_than(min_age): - ''' + """ Someone in the household must be at least {min_age} years old - ''' + """ return ( - translation('older_than', 0, 'Someone in the household must be at least'), - f' {min_age} ', - translation('older_than', 1, 'years old') + translation("older_than", 0, "Someone in the household must be at least"), + f" {min_age} ", + translation("older_than", 1, "years old"), ) def must_have_benefit(benefit_name): - ''' + """ Household must have {benefit_name} - ''' - return ( - translation('has_benefit', 0, 'Household must have'), - f' {benefit_name}' - ) + """ + return (translation("has_benefit", 0, "Household must have"), f" {benefit_name}") def must_not_have_benefit(benefit_name): - ''' + """ Household must not have {benefit_name} - ''' - return ( - translation('not_have_benefit', 0, 'Household must not have'), - f' {benefit_name}' - ) + """ + return (translation("not_have_benefit", 0, "Household must not have"), f" {benefit_name}") def location(): - ''' + """ Must live in an eligible location - ''' - return ( - translation('location', 0, 'Must live in an eligible location'), - ) + """ + return (translation("location", 0, "Must live in an eligible location"),) def has_disability(): - ''' + """ Someone in the household must have a disability - ''' - return ( - translation('disability', 0, 'Someone in the household must have a disability'), - ) + """ + return (translation("disability", 0, "Someone in the household must have a disability"),) def has_no_insurance(): - ''' + """ Someone in the household must not have health insurance - ''' - return ( - translation('no_insurance', 0, 'Someone in the household must not have health insurance'), - ) + """ + return (translation("no_insurance", 0, "Someone in the household must not have health insurance"),) def is_pregnant(): - ''' + """ Someone in the household must be pregnant - ''' - return ( - translation('pregnant', 0, 'Someone in the household must be pregnant'), - ) + """ + return (translation("pregnant", 0, "Someone in the household must be pregnant"),) diff --git a/programs/programs/nc/pe/__init__.py b/programs/programs/nc/pe/__init__.py index 9d323c10..9a7fb52d 100644 --- a/programs/programs/nc/pe/__init__.py +++ b/programs/programs/nc/pe/__init__.py @@ -3,11 +3,10 @@ nc_member_calculators = { - 'nc_medicaid': member.NcMedicaid, + "nc_medicaid": member.NcMedicaid, } nc_pe_calculators: dict[str, type[PolicyEngineCalulator]] = { **nc_member_calculators, } - diff --git a/programs/programs/nc/pe/member.py b/programs/programs/nc/pe/member.py index 2db5e5e2..3c2d7c23 100644 --- a/programs/programs/nc/pe/member.py +++ b/programs/programs/nc/pe/member.py @@ -2,12 +2,11 @@ class NcMedicaid(Medicaid): - child_medicaid_average = 200 * 12 # TODO: NC specific average goes here - adult_medicaid_average = 310 * 12 # TODO: NC specific average goes here - aged_medicaid_average = 170 * 12 # TODO: NC specific average goes here + child_medicaid_average = 200 * 12 # TODO: NC specific average goes here + adult_medicaid_average = 310 * 12 # TODO: NC specific average goes here + aged_medicaid_average = 170 * 12 # TODO: NC specific average goes here # NOTE: You can also overide the methods on the parent Medicaid class # def value(self): # ... # return 500 - diff --git a/programs/programs/policyengine/calculators/__init__.py b/programs/programs/policyengine/calculators/__init__.py index 6ecf236c..7adce32a 100644 --- a/programs/programs/policyengine/calculators/__init__.py +++ b/programs/programs/policyengine/calculators/__init__.py @@ -1,7 +1,16 @@ -from programs.programs.federal.pe import federal_member_calculators, federal_spm_unit_calculators, federal_tax_unit_calculators +from programs.programs.federal.pe import ( + federal_member_calculators, + federal_spm_unit_calculators, + federal_tax_unit_calculators, +) from programs.programs.co.pe import co_member_calculators, co_tax_unit_calculators from programs.programs.nc.pe import nc_member_calculators -from .base import PolicyEngineMembersCalculator, PolicyEngineSpmCalulator, PolicyEngineTaxUnitCalulator, PolicyEngineCalulator +from .base import ( + PolicyEngineMembersCalculator, + PolicyEngineSpmCalulator, + PolicyEngineTaxUnitCalulator, + PolicyEngineCalulator, +) all_member_calculators: dict[str, type[PolicyEngineMembersCalculator]] = { @@ -26,4 +35,3 @@ } all_pe_programs = all_calculators.keys() - diff --git a/programs/programs/policyengine/calculators/base.py b/programs/programs/policyengine/calculators/base.py index fa95cb3c..e838ff07 100644 --- a/programs/programs/policyengine/calculators/base.py +++ b/programs/programs/policyengine/calculators/base.py @@ -7,16 +7,16 @@ class PolicyEngineCalulator(ProgramCalculator): - ''' + """ Base class for all Policy Engine programs - ''' + """ pe_inputs: List[type[PolicyEngineScreenInput]] = [] pe_outputs: List[type[PolicyEngineScreenInput]] = [] - pe_name = '' - pe_category = '' - pe_sub_category = '' + pe_name = "" + pe_category = "" + pe_sub_category = "" pe_period = YEAR def __init__(self, screen: Screen, pe_data): @@ -34,9 +34,9 @@ def value(self): return self.get_data()[self.pe_name][self.pe_period] def get_data(self): - ''' + """ Return Policy Engine dictionary of the program category and subcategory - ''' + """ return self.pe_data[self.pe_category][self.pe_sub_category] @classmethod @@ -47,18 +47,21 @@ def can_calc(cls, missing_dependencies: Dependencies): return True + class PolicyEngineTaxUnitCalulator(PolicyEngineCalulator): - pe_category = 'tax_units' - pe_sub_category = 'tax_unit' + pe_category = "tax_units" + pe_sub_category = "tax_unit" pe_period = PREVIOUS_YEAR + class PolicyEngineSpmCalulator(PolicyEngineCalulator): - pe_category = 'spm_units' - pe_sub_category = 'spm_unit' + pe_category = "spm_units" + pe_sub_category = "spm_unit" + class PolicyEngineMembersCalculator(PolicyEngineCalulator): tax_dependent = True - pe_category = 'people' + pe_category = "people" def value(self): total = 0 @@ -75,8 +78,7 @@ def value(self): return total def in_tax_unit(self, member_id) -> bool: - return str(member_id) in self.pe_data['tax_units']['tax_unit']['members'] + return str(member_id) in self.pe_data["tax_units"]["tax_unit"]["members"] def get_data(self): return self.pe_data[self.pe_category] - diff --git a/programs/programs/policyengine/calculators/constants.py b/programs/programs/policyengine/calculators/constants.py index 2143bb25..11af220f 100644 --- a/programs/programs/policyengine/calculators/constants.py +++ b/programs/programs/policyengine/calculators/constants.py @@ -2,6 +2,6 @@ # Medicaid # CHP+ -YEAR = '2024' -PREVIOUS_YEAR = '2023' -SNAP_PERIOD = '2024-01' +YEAR = "2024" +PREVIOUS_YEAR = "2023" +SNAP_PERIOD = "2024-01" diff --git a/programs/programs/policyengine/calculators/dependencies/base.py b/programs/programs/policyengine/calculators/dependencies/base.py index 11f9cd56..03a962e2 100644 --- a/programs/programs/policyengine/calculators/dependencies/base.py +++ b/programs/programs/policyengine/calculators/dependencies/base.py @@ -3,14 +3,14 @@ class PolicyEngineScreenInput: - ''' + """ Base class for all Policy Engine dependencies - ''' + """ member = False - unit = '' - sub_unit = '' - field = '' + unit = "" + sub_unit = "" + field = "" dependencies = tuple() def __init__(self, screen: Screen, members: List[HouseholdMember], relationship_map): @@ -19,36 +19,36 @@ def __init__(self, screen: Screen, members: List[HouseholdMember], relationship_ self.relationship_map = relationship_map def value(self): - ''' + """ Return the value to send to Policy Engine - ''' + """ return None class TaxUnit(PolicyEngineScreenInput): - ''' + """ Base class for all tax unit Policy Engine dependencies - ''' + """ - unit = 'tax_units' - sub_unit = 'tax_unit' + unit = "tax_units" + sub_unit = "tax_unit" class SpmUnit(PolicyEngineScreenInput): - ''' + """ Base class for all spm unit Policy Engine dependencies - ''' + """ - unit = 'spm_units' - sub_unit = 'spm_unit' + unit = "spm_units" + sub_unit = "spm_unit" class Member(PolicyEngineScreenInput): - ''' + """ Base class for all member unit Policy Engine dependencies - ''' + """ - unit = 'people' + unit = "people" member = True def __init__(self, screen: Screen, member: HouseholdMember, relationship_map): @@ -61,9 +61,9 @@ def value(self): class DependencyError(Exception): - ''' + """ Dependency conflict error - ''' + """ def __init__(self, field, value_1, value_2) -> None: - super().__init__(f'Confilcting Policy Engine Dependencies in {field}: {value_1} and {value_2}') + super().__init__(f"Confilcting Policy Engine Dependencies in {field}: {value_1} and {value_2}") diff --git a/programs/programs/policyengine/calculators/dependencies/member.py b/programs/programs/policyengine/calculators/dependencies/member.py index 273e8263..bc5e1d28 100644 --- a/programs/programs/policyengine/calculators/dependencies/member.py +++ b/programs/programs/policyengine/calculators/dependencies/member.py @@ -2,50 +2,50 @@ class AgeDependency(Member): - field = 'age' - dependencies = ('age',) + field = "age" + dependencies = ("age",) def value(self): return self.member.age class PregnancyDependency(Member): - field = 'is_pregnant' + field = "is_pregnant" def value(self): return self.member.pregnant or False class FullTimeCollegeStudentDependency(Member): - field = 'is_full_time_college_student' + field = "is_full_time_college_student" def value(self): return self.member.student or False class TaxUnitHeadDependency(Member): - field = 'is_tax_unit_head' - dependencies = ('relationship',) + field = "is_tax_unit_head" + dependencies = ("relationship",) def value(self): return self.member.is_head() class TaxUnitSpouseDependency(Member): - field = 'is_tax_unit_spouse' - dependencies = ('relationship',) + field = "is_tax_unit_spouse" + dependencies = ("relationship",) def value(self): return self.member.is_spouse() class TaxUnitDependentDependency(Member): - field = 'is_tax_unit_dependent' + field = "is_tax_unit_dependent" dependencies = ( - 'relationship', - 'age', - 'income_amount', - 'income_frequency', + "relationship", + "age", + "income_amount", + "income_frequency", ) def value(self): @@ -53,37 +53,37 @@ def value(self): class WicCategory(Member): - field = 'wic_category' + field = "wic_category" class Wic(Member): - field = 'wic' + field = "wic" class Medicaid(Member): - field = 'medicaid' + field = "medicaid" class Ssi(Member): - field = 'ssi' + field = "ssi" class IsDisabledDependency(Member): - field = 'is_disabled' + field = "is_disabled" def value(self): return self.member.disabled or self.member.long_term_disability class IsBlindDependency(Member): - field = 'is_blind' + field = "is_blind" def value(self): return self.member.visually_impaired class SsiReportedDependency(Member): - field = 'ssi_reported' + field = "ssi_reported" def value(self): # Policy Eninge uses this value for is_ssi_disabled, but it does not apply to MFB @@ -91,10 +91,10 @@ def value(self): class SsiCountableResourcesDependency(Member): - field = 'ssi_countable_resources' + field = "ssi_countable_resources" dependencies = ( - 'household_assets', - 'age', + "household_assets", + "age", ) def value(self): @@ -106,102 +106,102 @@ def value(self): class SsiAmountIfEligible(Member): - field = 'ssi_amount_if_eligible' + field = "ssi_amount_if_eligible" class Andcs(Member): - field = 'co_state_supplement' + field = "co_state_supplement" class Oap(Member): - field = 'co_oap' + field = "co_oap" class PellGrant(Member): - field = 'pell_grant' + field = "pell_grant" class PellGrantDependentAvailableIncomeDependency(Member): - field = 'pell_grant_dependent_available_income' + field = "pell_grant_dependent_available_income" dependencies = ( - 'income_type', - 'income_amount', - 'income_frequency', + "income_type", + "income_amount", + "income_frequency", ) def value(self): - return int(self.member.calc_gross_income('yearly', ['all'])) + return int(self.member.calc_gross_income("yearly", ["all"])) class PellGrantCountableAssetsDependency(Member): - field = 'pell_grant_countable_assets' - dependencies = ('household_assets',) + field = "pell_grant_countable_assets" + dependencies = ("household_assets",) def value(self): return int(self.screen.household_assets) class CostOfAttendingCollegeDependency(Member): - field = 'cost_of_attending_college' - dependencies = ('age',) + field = "cost_of_attending_college" + dependencies = ("age",) def value(self): return 22_288 * (self.member.age >= 16 and self.member.student) class PellGrantMonthsInSchoolDependency(Member): - field = 'pell_grant_months_in_school' + field = "pell_grant_months_in_school" def value(self): return 9 class ChpEligible(Member): - field = 'co_chp_eligible' + field = "co_chp_eligible" class IncomeDependency(Member): dependencies = ( - 'income_type', - 'income_amount', - 'income_frequency', + "income_type", + "income_amount", + "income_frequency", ) income_types = [] def value(self): - return int(self.member.calc_gross_income('yearly', self.income_types)) + return int(self.member.calc_gross_income("yearly", self.income_types)) class EmploymentIncomeDependency(IncomeDependency): - field = 'employment_income' - income_types = ['wages'] + field = "employment_income" + income_types = ["wages"] class SelfEmploymentIncomeDependency(IncomeDependency): - field = 'self_employment_income' - income_types = ['selfEmployment'] + field = "self_employment_income" + income_types = ["selfEmployment"] class RentalIncomeDependency(IncomeDependency): - field = 'rental_income' - income_types = ['rental'] + field = "rental_income" + income_types = ["rental"] class PensionIncomeDependency(IncomeDependency): - field = 'taxable_pension_income' - income_types = ['pension', 'veteran'] + field = "taxable_pension_income" + income_types = ["pension", "veteran"] class SocialSecurityIncomeDependency(IncomeDependency): - field = 'social_security' - income_types = ['sSDisability', 'sSSurvivor', 'sSRetirement', 'sSDependent'] + field = "social_security" + income_types = ["sSDisability", "sSSurvivor", "sSRetirement", "sSDependent"] class SsiEarnedIncomeDependency(IncomeDependency): - field = 'ssi_earned_income' - income_types = ['earned'] + field = "ssi_earned_income" + income_types = ["earned"] class SsiUnearnedIncomeDependency(IncomeDependency): - field = 'ssi_unearned_income' - income_types = ['unearned'] + field = "ssi_unearned_income" + income_types = ["unearned"] diff --git a/programs/programs/policyengine/calculators/dependencies/spm.py b/programs/programs/policyengine/calculators/dependencies/spm.py index ec142e8e..fa59adcd 100644 --- a/programs/programs/policyengine/calculators/dependencies/spm.py +++ b/programs/programs/policyengine/calculators/dependencies/spm.py @@ -3,40 +3,40 @@ class SnapChildSupportDeductionDependency(SpmUnit): - field = 'snap_child_support_deduction' + field = "snap_child_support_deduction" def value(self): - return self.screen.calc_expenses('yearly', ['childSupport']) + return self.screen.calc_expenses("yearly", ["childSupport"]) class SnapDependentCareDeductionDependency(SpmUnit): - field = 'childcare_expenses' + field = "childcare_expenses" def value(self): - return self.screen.calc_expenses('yearly', ['childCare']) + return self.screen.calc_expenses("yearly", ["childCare"]) class SnapEarnedIncomeDependency(SpmUnit): - field = 'snap_earned_income' + field = "snap_earned_income" dependencies = ( - 'income_type', - 'income_amount', - 'income_frequency', + "income_type", + "income_amount", + "income_frequency", ) def value(self): - return self.screen.calc_gross_income('yearly', ['earned']) + return self.screen.calc_gross_income("yearly", ["earned"]) class HousingCostDependency(SpmUnit): - field = 'housing_cost' + field = "housing_cost" def value(self): - return int(self.screen.calc_expenses('yearly', ['rent', 'mortgage'])) + return int(self.screen.calc_expenses("yearly", ["rent", "mortgage"])) class SnapAssetsDependency(SpmUnit): - field = 'snap_assets' + field = "snap_assets" def value(self): assets = self.screen.household_assets or 0 @@ -44,149 +44,145 @@ def value(self): class SnapGrossIncomeDependency(SpmUnit): - field = 'snap_gross_income' + field = "snap_gross_income" dependencies = ( - 'income_amount', - 'income_frequency', + "income_amount", + "income_frequency", ) def value(self): - return int(self.screen.calc_gross_income('yearly', ['all'])) + return int(self.screen.calc_gross_income("yearly", ["all"])) class MeetsSnapGrossIncomeTestDependency(SpmUnit): - field = 'meets_snap_gross_income_test' + field = "meets_snap_gross_income_test" dependencies = ( - 'income_amount', - 'income_frequency', - 'household_size', + "income_amount", + "income_frequency", + "household_size", ) def value(self): - fpl = FederalPoveryLimit.objects.get(year='THIS YEAR').as_dict() - snap_gross_income = self.screen.calc_gross_income('yearly', ['all']) + fpl = FederalPoveryLimit.objects.get(year="THIS YEAR").as_dict() + snap_gross_income = self.screen.calc_gross_income("yearly", ["all"]) snap_gross_limit = 2 * fpl[self.screen.household_size] return snap_gross_income < snap_gross_limit class MeetsSnapAssetTestDependency(SpmUnit): - field = 'meets_snap_asset_test' + field = "meets_snap_asset_test" def value(self): return True class MeetsSnapCategoricalEligibilityDependency(SpmUnit): - field = 'meets_snap_categorical_eligibility' + field = "meets_snap_categorical_eligibility" def value(self): return False class HasHeatingCoolingExpenseDependency(SpmUnit): - field = 'has_heating_cooling_expense' + field = "has_heating_cooling_expense" def value(self): - return self.screen.has_expense(['heating', 'cooling']) + return self.screen.has_expense(["heating", "cooling"]) class HasPhoneExpenseDependency(SpmUnit): - field = 'has_phone_expense' + field = "has_phone_expense" def value(self): - return self.screen.has_expense(['telephone']) + return self.screen.has_expense(["telephone"]) class UtilityExpenseDependency(SpmUnit): - field = 'utility_expense' + field = "utility_expense" def value(self): - return int( - self.screen.calc_expenses( - 'yearly', ['otherUtilities', 'heating', 'cooling'] - ) - ) + return int(self.screen.calc_expenses("yearly", ["otherUtilities", "heating", "cooling"])) class HeatingCoolingExpenseDependency(SpmUnit): - field = 'heating_cooling_expense' + field = "heating_cooling_expense" def value(self): - return self.screen.calc_expenses('yearly', ['heating', 'cooling']) + return self.screen.calc_expenses("yearly", ["heating", "cooling"]) class PhoneExpenseDependency(SpmUnit): - field = 'phone_expense' + field = "phone_expense" def value(self): - return self.screen.calc_expenses('yearly', ['telephone']) + return self.screen.calc_expenses("yearly", ["telephone"]) class ElectricityExpenseDependency(SpmUnit): - field = 'electricity_expense' + field = "electricity_expense" def value(self): - return self.screen.calc_expenses('yearly', ['otherUtilities']) + return self.screen.calc_expenses("yearly", ["otherUtilities"]) class SnapEmergencyAllotmentDependency(SpmUnit): - field = 'snap_emergency_allotment' + field = "snap_emergency_allotment" def value(self): return 0 class Snap(SpmUnit): - field = 'snap' + field = "snap" class Acp(SpmUnit): - field = 'acp' + field = "acp" class SchoolMealDailySubsidy(SpmUnit): - field = 'school_meal_daily_subsidy' + field = "school_meal_daily_subsidy" class SchoolMealTier(SpmUnit): - field = 'school_meal_tier' + field = "school_meal_tier" class Lifeline(SpmUnit): - field = 'lifeline' + field = "lifeline" class TanfCountableGrossIncomeDependency(SpmUnit): - field = 'co_tanf_countable_gross_earned_income' + field = "co_tanf_countable_gross_earned_income" dependencies = ( - 'income_type', - 'income_amount', - 'income_frequency', + "income_type", + "income_amount", + "income_frequency", ) def value(self): - return int(self.screen.calc_gross_income('yearly', ['earned'])) + return int(self.screen.calc_gross_income("yearly", ["earned"])) class TanfCountableGrossUnearnedIncomeDependency(SpmUnit): - field = 'co_tanf_countable_gross_unearned_income' + field = "co_tanf_countable_gross_unearned_income" dependencies = ( - 'income_type', - 'income_amount', - 'income_frequency', + "income_type", + "income_amount", + "income_frequency", ) def value(self): - return int(self.screen.calc_gross_income('yearly', ['unearned'])) + return int(self.screen.calc_gross_income("yearly", ["unearned"])) class Tanf(SpmUnit): - field = 'co_tanf' + field = "co_tanf" class BroadbandCostDependency(SpmUnit): - field = 'broadband_cost' + field = "broadband_cost" def value(self): return 500 diff --git a/programs/programs/policyengine/calculators/dependencies/tax.py b/programs/programs/policyengine/calculators/dependencies/tax.py index 95edfce6..76007591 100644 --- a/programs/programs/policyengine/calculators/dependencies/tax.py +++ b/programs/programs/policyengine/calculators/dependencies/tax.py @@ -3,26 +3,26 @@ class Eitc(TaxUnit): - field = 'eitc' + field = "eitc" class Coeitc(TaxUnit): - field = 'co_eitc' + field = "co_eitc" class Ctc(TaxUnit): - field = 'ctc' + field = "ctc" class JointDependency(TaxUnit): - field = 'tax_unit_is_joint' + field = "tax_unit_is_joint" def value(self): return self.screen.is_joint() class PellGrantPrimaryIncomeDependency(TaxUnit): - field = 'pell_grant_primary_income' + field = "pell_grant_primary_income" def value(self): total = 0 @@ -30,14 +30,14 @@ def value(self): is_head = TaxUnitHeadDependency(self.screen, member, self.relationship_map).value() is_spouse = TaxUnitSpouseDependency(self.screen, member, self.relationship_map).value() if is_head or is_spouse: - total += int(member.calc_gross_income('yearly', ['all'])) + total += int(member.calc_gross_income("yearly", ["all"])) return total class PellGrantDependentsInCollegeDependency(TaxUnit): - field = 'pell_grant_dependents_in_college' - dependencies = ('student',) + field = "pell_grant_dependents_in_college" + dependencies = ("student",) def value(self): pell_grant_dependents_in_college = 0 diff --git a/programs/programs/policyengine/policy_engine.py b/programs/programs/policyengine/policy_engine.py index a724abf2..4cee4f27 100644 --- a/programs/programs/policyengine/policy_engine.py +++ b/programs/programs/policyengine/policy_engine.py @@ -25,7 +25,7 @@ def calc_pe_eligibility(screen: Screen, missing_fields: Dependencies) -> dict[st if len(valid_programs.values()) == 0 or len(screen.household_members.all()) == 0: return {} - data = policy_engine_calculate(pe_input(screen, valid_programs.values()))['result'] + data = policy_engine_calculate(pe_input(screen, valid_programs.values()))["result"] all_eligibility: dict[str, Eligibility] = {} for name_abbr, Calculator in valid_programs.items(): @@ -40,18 +40,15 @@ def calc_pe_eligibility(screen: Screen, missing_fields: Dependencies) -> dict[st def policy_engine_calculate(data): - response = requests.post( - "https://api.policyengine.org/us/calculate", - json=data - ) + response = requests.post("https://api.policyengine.org/us/calculate", json=data) data = response.json() return data def pe_input(screen: Screen, programs: List[type[PolicyEngineCalulator]]): - ''' + """ Generate Policy Engine API request from the list of programs. - ''' + """ raw_input = { "household": { "people": {}, @@ -60,23 +57,14 @@ def pe_input(screen: Screen, programs: List[type[PolicyEngineCalulator]]): "members": [], } }, - "families": { - "family": { - "members": [] - } - }, - "households": { - "household": { - "state_code_str": {YEAR: "CO", PREVIOUS_YEAR: "CO"}, - "members": [] - } - }, + "families": {"family": {"members": []}}, + "households": {"household": {"state_code_str": {YEAR: "CO", PREVIOUS_YEAR: "CO"}, "members": []}}, "spm_units": { "spm_unit": { "members": [], } }, - "marital_units": {} + "marital_units": {}, } } members = screen.household_members.all() @@ -84,19 +72,19 @@ def pe_input(screen: Screen, programs: List[type[PolicyEngineCalulator]]): for member in members: member_id = str(member.id) - household = raw_input['household'] + household = raw_input["household"] - household['families']['family']['members'].append(member_id) - household['households']['household']['members'].append(member_id) - household['spm_units']['spm_unit']['members'].append(member_id) - household['people'][member_id] = {} + household["families"]["family"]["members"].append(member_id) + household["households"]["household"]["members"].append(member_id) + household["spm_units"]["spm_unit"]["members"].append(member_id) + household["people"][member_id] = {} is_tax_unit_head = TaxUnitHeadDependency(screen, member, relationship_map).value() is_tax_unit_spouse = TaxUnitSpouseDependency(screen, member, relationship_map).value() is_tax_unit_dependent = TaxUnitDependentDependency(screen, member, relationship_map).value() if is_tax_unit_head or is_tax_unit_spouse or is_tax_unit_dependent: - household['tax_units']['tax_unit']['members'].append(member_id) + household["tax_units"]["tax_unit"]["members"].append(member_id) already_added = set() for member_1, member_2 in relationship_map.items(): @@ -104,14 +92,14 @@ def pe_input(screen: Screen, programs: List[type[PolicyEngineCalulator]]): continue marital_unit = (str(member_1), str(member_2)) - raw_input['household']['marital_units']['-'.join(marital_unit)] = {'members': marital_unit} + raw_input["household"]["marital_units"]["-".join(marital_unit)] = {"members": marital_unit} already_added.add(member_1) already_added.add(member_2) for Program in programs: for Data in Program.pe_inputs + Program.pe_outputs: period = Program.pe_period - if hasattr(Program, 'pe_output_period') and Data in Program.pe_outputs: + if hasattr(Program, "pe_output_period") and Data in Program.pe_outputs: period = Program.pe_output_period if not Data.member: diff --git a/programs/programs/urgent_needs/urgent_need_functions.py b/programs/programs/urgent_needs/urgent_need_functions.py index 0cd44e0a..9f5ebce4 100644 --- a/programs/programs/urgent_needs/urgent_need_functions.py +++ b/programs/programs/urgent_needs/urgent_need_functions.py @@ -5,17 +5,17 @@ class UrgentNeedFunction: - ''' + """ Base class for all urgent need conditions - ''' + """ dependencies = [] @classmethod def calc(cls, screen: Screen, missing_dependencies: Dependencies): - ''' + """ Calculate if the urgent need can be calculated and if the condition is met - ''' + """ if not cls.can_calc(missing_dependencies): return False @@ -23,16 +23,16 @@ def calc(cls, screen: Screen, missing_dependencies: Dependencies): @classmethod def eligible(cls, screen: Screen): - ''' + """ Returns if the condition is met - ''' + """ return True @classmethod def can_calc(cls, missing_dependencies: Dependencies): - ''' + """ Returns if the condition can be calculated - ''' + """ if missing_dependencies.has(*cls.dependencies): return False @@ -40,97 +40,97 @@ def can_calc(cls, missing_dependencies: Dependencies): class LivesInDenver(UrgentNeedFunction): - dependencies = ['county'] + dependencies = ["county"] @classmethod def eligible(cls, screen: Screen): - ''' + """ Household lives in the Denver County - ''' - return screen.county == 'Denver County' + """ + return screen.county == "Denver County" class MealInCounties(UrgentNeedFunction): - dependencies = ['county'] + dependencies = ["county"] @classmethod def eligible(cls, screen: Screen): - ''' + """ Household lives in Denver or Jefferson County - ''' - eligible_counties = ['Denver County', 'Jefferson County'] + """ + eligible_counties = ["Denver County", "Jefferson County"] return screen.county in eligible_counties class HelpkitchenZipcode(UrgentNeedFunction): - dependencies = ['zipcode'] + dependencies = ["zipcode"] @classmethod def eligible(cls, screen: Screen): - ''' + """ Lives in a zipcode that is eligible for HelpKitchen - ''' + """ zipcodes = [ - '80010', - '80011', - '80012', - '80013', - '80014', - '80015', - '80016', - '80017', - '80018', - '80019', - '80045', - '80102', - '80112', - '80137', - '80138', - '80230', - '80231', - '80238', - '80247', - '80249', + "80010", + "80011", + "80012", + "80013", + "80014", + "80015", + "80016", + "80017", + "80018", + "80019", + "80045", + "80102", + "80112", + "80137", + "80138", + "80230", + "80231", + "80238", + "80247", + "80249", ] return screen.zipcode in zipcodes class Child(UrgentNeedFunction): - dependencies = ['age'] + dependencies = ["age"] @classmethod def eligible(cls, screen: Screen): - ''' + """ Return True if someone is younger than 18 - ''' - return screen.num_children(child_relationship=['all']) >= 1 + """ + return screen.num_children(child_relationship=["all"]) >= 1 class BiaFoodDelivery(UrgentNeedFunction): - dependencies = ['county'] + dependencies = ["county"] @classmethod def eligible(cls, screen: Screen): - ''' + """ Return True if in Adams, Arapahoe, Denver or Jefferson county - ''' + """ eligible_counties = [ - 'Adams County', - 'Arapahoe County', - 'Denver County', - 'Jefferson County', + "Adams County", + "Arapahoe County", + "Denver County", + "Jefferson County", ] return screen.county in eligible_counties class Trua(UrgentNeedFunction): - dependencies = ['household_size', 'income_amount', 'income_frequency'] + dependencies = ["household_size", "income_amount", "income_frequency"] @classmethod def eligible(cls, screen: Screen): - ''' + """ Return True if the household is below the income limit for their household size - ''' + """ income_limits = { 1: 66_300, 2: 75_750, @@ -141,19 +141,19 @@ def eligible(cls, screen: Screen): 7: 117_400, 8: 124_950, } - household_income = screen.calc_gross_income('yearly', ['all']) + household_income = screen.calc_gross_income("yearly", ["all"]) income_limit = income_limits[screen.household_size] return household_income <= income_limit class ForeclosureFinAssistProgram(UrgentNeedFunction): - dependencies = ['household_size', 'income_amount', 'income_frequency', 'county'] + dependencies = ["household_size", "income_amount", "income_frequency", "county"] @classmethod def eligible(cls, screen: Screen): - ''' + """ Return True if the household is at or below 80% the income limit for their household size & they live in Denver - ''' + """ income_limits = { 1: 66_300, 2: 75_750, @@ -164,9 +164,9 @@ def eligible(cls, screen: Screen): 7: 117_400, 8: 124_950, } - household_income = screen.calc_gross_income('yearly', ['all']) + household_income = screen.calc_gross_income("yearly", ["all"]) income_limit = income_limits[screen.household_size] - return household_income <= income_limit and screen.county == 'Denver County' + return household_income <= income_limit and screen.county == "Denver County" class EocIncomeLimitCache(GoogleSheetsCache): @@ -177,113 +177,108 @@ class EocIncomeLimitCache(GoogleSheetsCache): def update(self): data = super().update() - return {d[0].strip() + ' County': [int(v.replace(',', '')) for v in d[1:]] for d in data} + return {d[0].strip() + " County": [int(v.replace(",", "")) for v in d[1:]] for d in data} class Eoc(UrgentNeedFunction): limits_cache = EocIncomeLimitCache() - dependencies = ['income_amount', 'income_frequency', 'household_size', 'county'] + dependencies = ["income_amount", "income_frequency", "household_size", "county"] @classmethod def eligible(cls, screen: Screen): - ''' + """ Return True if the household is below the income limit for their county and household size - ''' + """ - income = int(screen.calc_gross_income('yearly', ['all'])) + income = int(screen.calc_gross_income("yearly", ["all"])) limits = Eoc.limits_cache.fetch() if screen.county not in limits: return False - income_limit = limits[screen.county][ - screen.household_size - 1 - ] + income_limit = limits[screen.county][screen.household_size - 1] return income < income_limit class CoLegalServices(UrgentNeedFunction): - dependencies = ['income_amount', 'income_frequency', 'household_size', 'age'] + dependencies = ["income_amount", "income_frequency", "household_size", "age"] @classmethod def eligible(cls, screen: Screen): - ''' + """ Return True if the household is has an income bellow 200% FPL or someone in the household is over 60 years old - ''' - fpl = FederalPoveryLimit.objects.get(year='THIS YEAR').as_dict() - is_income_eligible = ( - screen.calc_gross_income('yearly', ['all']) < fpl[screen.household_size] - ) + """ + fpl = FederalPoveryLimit.objects.get(year="THIS YEAR").as_dict() + is_income_eligible = screen.calc_gross_income("yearly", ["all"]) < fpl[screen.household_size] is_age_eligible = screen.num_adults(age_max=60) return is_income_eligible or is_age_eligible class CoEmergencyMortgageIncomeLimitCache(GoogleSheetsCache): default = {} - sheet_id = '1M_BQxs135UV4uO-CUpHtt9Xy89l1RmSufdP9c3nEh-M' + sheet_id = "1M_BQxs135UV4uO-CUpHtt9Xy89l1RmSufdP9c3nEh-M" range_name = "'100% AMI 2023'!A2:I65" def update(self): data = super().update() - return {d[0] + ' County': [int(v.replace(',', '')) for v in d[1:]] for d in data} + return {d[0] + " County": [int(v.replace(",", "")) for v in d[1:]] for d in data} class CoEmergencyMortgageAssistance(UrgentNeedFunction): limits_cache = CoEmergencyMortgageIncomeLimitCache() - dependencies = ['income_amount', 'income_frequency', 'household_size', 'county'] + dependencies = ["income_amount", "income_frequency", "household_size", "county"] @classmethod def eligible(cls, screen: Screen): - income = int(screen.calc_gross_income('yearly', ['all'])) + income = int(screen.calc_gross_income("yearly", ["all"])) limits = CoEmergencyMortgageAssistance.limits_cache.fetch() if screen.county not in limits: return False - income_limit = limits[screen.county][ - screen.household_size - 1 - ] + income_limit = limits[screen.county][screen.household_size - 1] return income < income_limit + class ChildFirst(UrgentNeedFunction): - dependencies = ['age', 'county'] + dependencies = ["age", "county"] @classmethod def eligible(cls, screen: Screen): - ''' + """ Return True if the household has a child aged 0-5 and lives in an eligible county - ''' + """ is_age_eligible = screen.num_children(age_max=5) eligible_counties = [ - 'Adams County', - 'Alamosa County', - 'Arapahoe County', - 'Bent County', - 'Boulder County', - 'Broomfield County', - 'Chaffee County', - 'Clear Creek County', - 'Conejos County', - 'Costilla County', - 'Crowley County', - 'Custer County', - 'Douglas County', - 'El Paso County', - 'Fremont County', - 'Gilpin County', - 'Jefferson County', - 'Lake County', - 'Mineral County', - 'Otero County', - 'Rio Grand County', - 'Routt County', - 'Saguache County', - 'Weld County', + "Adams County", + "Alamosa County", + "Arapahoe County", + "Bent County", + "Boulder County", + "Broomfield County", + "Chaffee County", + "Clear Creek County", + "Conejos County", + "Costilla County", + "Crowley County", + "Custer County", + "Douglas County", + "El Paso County", + "Fremont County", + "Gilpin County", + "Jefferson County", + "Lake County", + "Mineral County", + "Otero County", + "Rio Grand County", + "Routt County", + "Saguache County", + "Weld County", ] - return is_age_eligible and screen.county in eligible_counties \ No newline at end of file + return is_age_eligible and screen.county in eligible_counties diff --git a/programs/serializers.py b/programs/serializers.py index 420f1335..14643e37 100644 --- a/programs/serializers.py +++ b/programs/serializers.py @@ -5,16 +5,16 @@ class NavigatorAPISerializer(serializers.ModelSerializer): class Meta: model = Navigator - fields = '__all__' + fields = "__all__" class ProgramSerializer(serializers.ModelSerializer): class Meta: model = Program - fields = '__all__' + fields = "__all__" class UrgentNeedAPISerializer(serializers.ModelSerializer): class Meta: model = UrgentNeed - fields = '__all__' + fields = "__all__" diff --git a/programs/urls.py b/programs/urls.py index 7d39e395..ddebede9 100644 --- a/programs/urls.py +++ b/programs/urls.py @@ -3,12 +3,10 @@ from . import views router = routers.DefaultRouter() -router.register(r'programs', views.ProgramViewSet) -router.register(r'navigators', views.NavigatorViewSet) -router.register(r'urgent-needs', views.UrgentNeedViewSet) +router.register(r"programs", views.ProgramViewSet) +router.register(r"navigators", views.NavigatorViewSet) +router.register(r"urgent-needs", views.UrgentNeedViewSet) # Wire up our API using automatic URL routing. # Additionally, we include login URLs for the browsable API. -urlpatterns = [ - path('', include(router.urls)) -] +urlpatterns = [path("", include(router.urls))] diff --git a/programs/views.py b/programs/views.py index fbd38a66..0c6adaeb 100644 --- a/programs/views.py +++ b/programs/views.py @@ -4,32 +4,32 @@ from programs.serializers import ProgramSerializer, NavigatorAPISerializer, UrgentNeedAPISerializer -class ProgramViewSet(mixins.RetrieveModelMixin, - viewsets.GenericViewSet): +class ProgramViewSet(mixins.RetrieveModelMixin, viewsets.GenericViewSet): """ API endpoint that allows programs to be viewed or edited. """ + queryset = Program.objects.all() serializer_class = ProgramSerializer permission_classes = [permissions.IsAuthenticated] # filterset_fields = ['legal_status_required', 'value_type'] -class NavigatorViewSet(mixins.RetrieveModelMixin, - viewsets.GenericViewSet): +class NavigatorViewSet(mixins.RetrieveModelMixin, viewsets.GenericViewSet): """ API endpoint that allows programs to be viewed or edited. """ + queryset = Navigator.objects.all() serializer_class = NavigatorAPISerializer permission_classes = [permissions.IsAuthenticated] -class UrgentNeedViewSet(mixins.RetrieveModelMixin, - viewsets.GenericViewSet): +class UrgentNeedViewSet(mixins.RetrieveModelMixin, viewsets.GenericViewSet): """ API endpoint that allows programs to be viewed or edited. """ + queryset = UrgentNeed.objects.all() serializer_class = UrgentNeedAPISerializer permission_classes = [permissions.IsAuthenticated] diff --git a/screener/admin.py b/screener/admin.py index e159b13a..82d4b7fd 100644 --- a/screener/admin.py +++ b/screener/admin.py @@ -7,10 +7,9 @@ class screenAdmin(admin.ModelAdmin): - search_fields = ('id',) + search_fields = ("id",) admin.site.register(Screen, screenAdmin) admin.site.register(Message) admin.site.register(IncomeStream) - diff --git a/screener/apps.py b/screener/apps.py index d2b31097..1b0ed4d7 100644 --- a/screener/apps.py +++ b/screener/apps.py @@ -2,5 +2,5 @@ class ScreenerConfig(AppConfig): - default_auto_field = 'django.db.models.BigAutoField' - name = 'screener' + default_auto_field = "django.db.models.BigAutoField" + name = "screener" diff --git a/screener/management/commands/batch_snapshots.py b/screener/management/commands/batch_snapshots.py index 9efe1832..d77f8bde 100644 --- a/screener/management/commands/batch_snapshots.py +++ b/screener/management/commands/batch_snapshots.py @@ -6,44 +6,38 @@ class Command(BaseCommand): - help = ''' + help = """ Creates snapshots for all users. Limit default is 1. Defaults to only creating snapshots for users with emails. - ''' + """ def add_arguments(self, parser): - parser.add_argument('--limit', default=1, type=int) - parser.add_argument('--all', default=False, type=bool) - parser.add_argument('--new', default=False, type=bool) + parser.add_argument("--limit", default=1, type=int) + parser.add_argument("--all", default=False, type=bool) + parser.add_argument("--new", default=False, type=bool) def handle(self, *args, **options): # Get the screens - screens = Screen.objects.filter( - agree_to_tos=True, - is_test=False, - is_test_data=False, - completed=True - ) - - if not options['all']: + screens = Screen.objects.filter(agree_to_tos=True, is_test=False, is_test_data=False, completed=True) + + if not options["all"]: screens = screens.exclude(user__isnull=True) - if options['new']: + if options["new"]: screens = screens.filter(eligibility_snapshots__isnull=True) # List[:None] is everything in the list - limit = None if options['limit'] == -1 else options['limit'] - screens = screens.order_by('-submission_date')[:limit] + limit = None if options["limit"] == -1 else options["limit"] + screens = screens.order_by("-submission_date")[:limit] # Calculate eligibility for each screen errors = [] - for i in trange(len(screens), desc='Screens'): + for i in trange(len(screens), desc="Screens"): try: eligibility_results(screens[i], batch=True) time.sleep(1) except Exception as e: - errors.append(str(screens[i].id) + ': ' + str(e)) + errors.append(str(screens[i].id) + ": " + str(e)) if len(errors): - self.stdout.write( - self.style.ERROR('The following screens had errors:\n' + '\n'.join(errors))) + self.stdout.write(self.style.ERROR("The following screens had errors:\n" + "\n".join(errors))) diff --git a/screener/management/commands/email_new_benefits.py b/screener/management/commands/email_new_benefits.py index e6301a6e..c893cd3a 100644 --- a/screener/management/commands/email_new_benefits.py +++ b/screener/management/commands/email_new_benefits.py @@ -5,26 +5,24 @@ class Command(BaseCommand): - help = ''' + help = """ Update number of new benefits and amount of new benefits in HubSpot - ''' + """ def add_arguments(self, parser): - parser.add_argument('--limit', default=1, type=int) + parser.add_argument("--limit", default=1, type=int) def handle(self, *args, **options): screens = Screen.objects.all().exclude(user__isnull=True) latest_snapshots = [] - limit = options['limit'] + limit = options["limit"] for screen in screens: try: - previous_snapshot = EligibilitySnapshot.objects \ - .filter(is_batch=True, screen=screen) \ - .latest('submission_date') - except ObjectDoesNotExist: - self.stdout.write( - self.style.WARNING(f'No snapshots for screen with id of {screen.id}') + previous_snapshot = EligibilitySnapshot.objects.filter(is_batch=True, screen=screen).latest( + "submission_date" ) + except ObjectDoesNotExist: + self.stdout.write(self.style.WARNING(f"No snapshots for screen with id of {screen.id}")) continue latest_snapshots.append(previous_snapshot) @@ -48,9 +46,7 @@ def handle(self, *args, **options): limit -= 1 if not len(existing_users): - self.stdout.write( - self.style.WARNING('No users in HubSpot. Make sure that you add users to HubSpot first') - ) + self.stdout.write(self.style.WARNING("No users in HubSpot. Make sure that you add users to HubSpot first")) return hubspot.bulk_update(existing_users) diff --git a/screener/migrations/0001_initial.py b/screener/migrations/0001_initial.py index 1cf4e8fd..5269a795 100644 --- a/screener/migrations/0001_initial.py +++ b/screener/migrations/0001_initial.py @@ -5,46 +5,44 @@ class Migration(migrations.Migration): - initial = True - dependencies = [ - ] + dependencies = [] operations = [ migrations.CreateModel( - name='Screen', + name="Screen", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('submission_date', models.DateTimeField(auto_now=True)), - ('agree_to_tos', models.BooleanField()), - ('applicant_age', models.IntegerField()), - ('zipcode', models.CharField(max_length=5)), - ('student', models.BooleanField()), - ('student_full_time', models.BooleanField()), - ('pregnant', models.BooleanField()), - ('unemployed', models.BooleanField()), - ('worked_in_last_18_mos', models.BooleanField()), - ('visually_impaired', models.BooleanField()), - ('disabled', models.BooleanField()), - ('veteran', models.BooleanField()), - ('medicaid', models.BooleanField()), - ('disability_medicaid', models.BooleanField()), - ('has_income', models.BooleanField()), - ('has_expenses', models.BooleanField()), - ('household_size', models.IntegerField()), - ('household_assets', models.DecimalField(decimal_places=2, max_digits=10)), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("submission_date", models.DateTimeField(auto_now=True)), + ("agree_to_tos", models.BooleanField()), + ("applicant_age", models.IntegerField()), + ("zipcode", models.CharField(max_length=5)), + ("student", models.BooleanField()), + ("student_full_time", models.BooleanField()), + ("pregnant", models.BooleanField()), + ("unemployed", models.BooleanField()), + ("worked_in_last_18_mos", models.BooleanField()), + ("visually_impaired", models.BooleanField()), + ("disabled", models.BooleanField()), + ("veteran", models.BooleanField()), + ("medicaid", models.BooleanField()), + ("disability_medicaid", models.BooleanField()), + ("has_income", models.BooleanField()), + ("has_expenses", models.BooleanField()), + ("household_size", models.IntegerField()), + ("household_assets", models.DecimalField(decimal_places=2, max_digits=10)), ], ), migrations.CreateModel( - name='incomeStream', + name="incomeStream", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('type', models.CharField(max_length=30)), - ('label', models.CharField(max_length=200)), - ('amount', models.DecimalField(decimal_places=2, max_digits=10)), - ('frequency', models.CharField(max_length=30)), - ('screen', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='screener.screen')), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("type", models.CharField(max_length=30)), + ("label", models.CharField(max_length=200)), + ("amount", models.DecimalField(decimal_places=2, max_digits=10)), + ("frequency", models.CharField(max_length=30)), + ("screen", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="screener.screen")), ], ), ] diff --git a/screener/migrations/0002_screen_housing_situation_expense.py b/screener/migrations/0002_screen_housing_situation_expense.py index 9c29bffa..296acba1 100644 --- a/screener/migrations/0002_screen_housing_situation_expense.py +++ b/screener/migrations/0002_screen_housing_situation_expense.py @@ -5,26 +5,25 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0001_initial'), + ("screener", "0001_initial"), ] operations = [ migrations.AddField( - model_name='screen', - name='housing_situation', - field=models.CharField(default='rent', max_length=30), + model_name="screen", + name="housing_situation", + field=models.CharField(default="rent", max_length=30), preserve_default=False, ), migrations.CreateModel( - name='Expense', + name="Expense", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=30)), - ('amount', models.DecimalField(decimal_places=2, max_digits=10)), - ('frequency', models.CharField(max_length=30)), - ('screen', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='screener.screen')), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("name", models.CharField(max_length=30)), + ("amount", models.DecimalField(decimal_places=2, max_digits=10)), + ("frequency", models.CharField(max_length=30)), + ("screen", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="screener.screen")), ], ), ] diff --git a/screener/migrations/0003_rename_type_incomestream_name.py b/screener/migrations/0003_rename_type_incomestream_name.py index 493fe880..085cd9c4 100644 --- a/screener/migrations/0003_rename_type_incomestream_name.py +++ b/screener/migrations/0003_rename_type_incomestream_name.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0002_screen_housing_situation_expense'), + ("screener", "0002_screen_housing_situation_expense"), ] operations = [ migrations.RenameField( - model_name='incomestream', - old_name='type', - new_name='name', + model_name="incomestream", + old_name="type", + new_name="name", ), ] diff --git a/screener/migrations/0004_remove_incomestream_label.py b/screener/migrations/0004_remove_incomestream_label.py index 8f2f2dfa..e8aebb8d 100644 --- a/screener/migrations/0004_remove_incomestream_label.py +++ b/screener/migrations/0004_remove_incomestream_label.py @@ -4,14 +4,13 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0003_rename_type_incomestream_name'), + ("screener", "0003_rename_type_incomestream_name"), ] operations = [ migrations.RemoveField( - model_name='incomestream', - name='label', + model_name="incomestream", + name="label", ), ] diff --git a/screener/migrations/0005_alter_incomestream_screen.py b/screener/migrations/0005_alter_incomestream_screen.py index f4d6f091..b36feb5b 100644 --- a/screener/migrations/0005_alter_incomestream_screen.py +++ b/screener/migrations/0005_alter_incomestream_screen.py @@ -5,15 +5,16 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0004_remove_incomestream_label'), + ("screener", "0004_remove_incomestream_label"), ] operations = [ migrations.AlterField( - model_name='incomestream', - name='screen', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='incomestreams', to='screener.screen'), + model_name="incomestream", + name="screen", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name="incomestreams", to="screener.screen" + ), ), ] diff --git a/screener/migrations/0006_rename_name_expense_type_and_more.py b/screener/migrations/0006_rename_name_expense_type_and_more.py index b592d8fe..7b62cdff 100644 --- a/screener/migrations/0006_rename_name_expense_type_and_more.py +++ b/screener/migrations/0006_rename_name_expense_type_and_more.py @@ -5,25 +5,26 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0005_alter_incomestream_screen'), + ("screener", "0005_alter_incomestream_screen"), ] operations = [ migrations.RenameField( - model_name='expense', - old_name='name', - new_name='type', + model_name="expense", + old_name="name", + new_name="type", ), migrations.RenameField( - model_name='incomestream', - old_name='name', - new_name='type', + model_name="incomestream", + old_name="name", + new_name="type", ), migrations.AlterField( - model_name='expense', - name='screen', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='expenses', to='screener.screen'), + model_name="expense", + name="screen", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name="expenses", to="screener.screen" + ), ), ] diff --git a/screener/migrations/0007_rename_applicant_age_screen_age.py b/screener/migrations/0007_rename_applicant_age_screen_age.py index b54fd4bc..336ad346 100644 --- a/screener/migrations/0007_rename_applicant_age_screen_age.py +++ b/screener/migrations/0007_rename_applicant_age_screen_age.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0006_rename_name_expense_type_and_more'), + ("screener", "0006_rename_name_expense_type_and_more"), ] operations = [ migrations.RenameField( - model_name='screen', - old_name='applicant_age', - new_name='age', + model_name="screen", + old_name="applicant_age", + new_name="age", ), ] diff --git a/screener/migrations/0008_householdmember.py b/screener/migrations/0008_householdmember.py index a655842a..d668e41e 100644 --- a/screener/migrations/0008_householdmember.py +++ b/screener/migrations/0008_householdmember.py @@ -5,31 +5,37 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0007_rename_applicant_age_screen_age'), + ("screener", "0007_rename_applicant_age_screen_age"), ] operations = [ migrations.CreateModel( - name='HouseholdMember', + name="HouseholdMember", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('age', models.IntegerField()), - ('zipcode', models.CharField(max_length=5)), - ('student', models.BooleanField()), - ('student_full_time', models.BooleanField()), - ('pregnant', models.BooleanField()), - ('unemployed', models.BooleanField()), - ('worked_in_last_18_mos', models.BooleanField()), - ('visually_impaired', models.BooleanField()), - ('disabled', models.BooleanField()), - ('veteran', models.BooleanField()), - ('medicaid', models.BooleanField()), - ('disability_medicaid', models.BooleanField()), - ('has_income', models.BooleanField()), - ('has_expenses', models.BooleanField()), - ('screen', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='householdmembers', to='screener.screen')), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("age", models.IntegerField()), + ("zipcode", models.CharField(max_length=5)), + ("student", models.BooleanField()), + ("student_full_time", models.BooleanField()), + ("pregnant", models.BooleanField()), + ("unemployed", models.BooleanField()), + ("worked_in_last_18_mos", models.BooleanField()), + ("visually_impaired", models.BooleanField()), + ("disabled", models.BooleanField()), + ("veteran", models.BooleanField()), + ("medicaid", models.BooleanField()), + ("disability_medicaid", models.BooleanField()), + ("has_income", models.BooleanField()), + ("has_expenses", models.BooleanField()), + ( + "screen", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="householdmembers", + to="screener.screen", + ), + ), ], ), ] diff --git a/screener/migrations/0009_remove_householdmember_zipcode.py b/screener/migrations/0009_remove_householdmember_zipcode.py index ca828419..7ad698b1 100644 --- a/screener/migrations/0009_remove_householdmember_zipcode.py +++ b/screener/migrations/0009_remove_householdmember_zipcode.py @@ -4,14 +4,13 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0008_householdmember'), + ("screener", "0008_householdmember"), ] operations = [ migrations.RemoveField( - model_name='householdmember', - name='zipcode', + model_name="householdmember", + name="zipcode", ), ] diff --git a/screener/migrations/0010_remove_screen_age_remove_screen_disability_medicaid_and_more.py b/screener/migrations/0010_remove_screen_age_remove_screen_disability_medicaid_and_more.py index 9167e3de..940dbabe 100644 --- a/screener/migrations/0010_remove_screen_age_remove_screen_disability_medicaid_and_more.py +++ b/screener/migrations/0010_remove_screen_age_remove_screen_disability_medicaid_and_more.py @@ -4,62 +4,61 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0009_remove_householdmember_zipcode'), + ("screener", "0009_remove_householdmember_zipcode"), ] operations = [ migrations.RemoveField( - model_name='screen', - name='age', + model_name="screen", + name="age", ), migrations.RemoveField( - model_name='screen', - name='disability_medicaid', + model_name="screen", + name="disability_medicaid", ), migrations.RemoveField( - model_name='screen', - name='disabled', + model_name="screen", + name="disabled", ), migrations.RemoveField( - model_name='screen', - name='has_expenses', + model_name="screen", + name="has_expenses", ), migrations.RemoveField( - model_name='screen', - name='has_income', + model_name="screen", + name="has_income", ), migrations.RemoveField( - model_name='screen', - name='medicaid', + model_name="screen", + name="medicaid", ), migrations.RemoveField( - model_name='screen', - name='pregnant', + model_name="screen", + name="pregnant", ), migrations.RemoveField( - model_name='screen', - name='student', + model_name="screen", + name="student", ), migrations.RemoveField( - model_name='screen', - name='student_full_time', + model_name="screen", + name="student_full_time", ), migrations.RemoveField( - model_name='screen', - name='unemployed', + model_name="screen", + name="unemployed", ), migrations.RemoveField( - model_name='screen', - name='veteran', + model_name="screen", + name="veteran", ), migrations.RemoveField( - model_name='screen', - name='visually_impaired', + model_name="screen", + name="visually_impaired", ), migrations.RemoveField( - model_name='screen', - name='worked_in_last_18_mos', + model_name="screen", + name="worked_in_last_18_mos", ), ] diff --git a/screener/migrations/0011_expense_household_member_and_more.py b/screener/migrations/0011_expense_household_member_and_more.py index 38a0147d..c7edfe9d 100644 --- a/screener/migrations/0011_expense_household_member_and_more.py +++ b/screener/migrations/0011_expense_household_member_and_more.py @@ -5,22 +5,31 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0010_remove_screen_age_remove_screen_disability_medicaid_and_more'), + ("screener", "0010_remove_screen_age_remove_screen_disability_medicaid_and_more"), ] operations = [ migrations.AddField( - model_name='expense', - name='household_member', - field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, related_name='expenses', to='screener.householdmember'), + model_name="expense", + name="household_member", + field=models.ForeignKey( + default=1, + on_delete=django.db.models.deletion.CASCADE, + related_name="expenses", + to="screener.householdmember", + ), preserve_default=False, ), migrations.AddField( - model_name='incomestream', - name='household_member', - field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, related_name='incomestreams', to='screener.householdmember'), + model_name="incomestream", + name="household_member", + field=models.ForeignKey( + default=1, + on_delete=django.db.models.deletion.CASCADE, + related_name="incomestreams", + to="screener.householdmember", + ), preserve_default=False, ), ] diff --git a/screener/migrations/0012_alter_householdmember_screen_and_more.py b/screener/migrations/0012_alter_householdmember_screen_and_more.py index 40dcc7ff..0d480450 100644 --- a/screener/migrations/0012_alter_householdmember_screen_and_more.py +++ b/screener/migrations/0012_alter_householdmember_screen_and_more.py @@ -5,25 +5,32 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0011_expense_household_member_and_more'), + ("screener", "0011_expense_household_member_and_more"), ] operations = [ migrations.AlterField( - model_name='householdmember', - name='screen', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='household_members', to='screener.screen'), + model_name="householdmember", + name="screen", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name="household_members", to="screener.screen" + ), ), migrations.AlterField( - model_name='incomestream', - name='household_member', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='income_streams', to='screener.householdmember'), + model_name="incomestream", + name="household_member", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="income_streams", + to="screener.householdmember", + ), ), migrations.AlterField( - model_name='incomestream', - name='screen', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='income_streams', to='screener.screen'), + model_name="incomestream", + name="screen", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name="income_streams", to="screener.screen" + ), ), ] diff --git a/screener/migrations/0013_householdmember_relationship.py b/screener/migrations/0013_householdmember_relationship.py index 3ba8336f..cd66da4e 100644 --- a/screener/migrations/0013_householdmember_relationship.py +++ b/screener/migrations/0013_householdmember_relationship.py @@ -4,16 +4,15 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0012_alter_householdmember_screen_and_more'), + ("screener", "0012_alter_householdmember_screen_and_more"), ] operations = [ migrations.AddField( - model_name='householdmember', - name='relationship', - field=models.CharField(default='parent', max_length=30), + model_name="householdmember", + name="relationship", + field=models.CharField(default="parent", max_length=30), preserve_default=False, ), ] diff --git a/screener/migrations/0014_screen_cell_screen_email.py b/screener/migrations/0014_screen_cell_screen_email.py index 0dc0d7ed..6f7bd68e 100644 --- a/screener/migrations/0014_screen_cell_screen_email.py +++ b/screener/migrations/0014_screen_cell_screen_email.py @@ -5,20 +5,19 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0013_householdmember_relationship'), + ("screener", "0013_householdmember_relationship"), ] operations = [ migrations.AddField( - model_name='screen', - name='cell', + model_name="screen", + name="cell", field=phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, region=None), ), migrations.AddField( - model_name='screen', - name='email', + model_name="screen", + name="email", field=models.CharField(blank=True, max_length=320), ), ] diff --git a/screener/migrations/0015_remove_screen_cell.py b/screener/migrations/0015_remove_screen_cell.py index ba186afd..f2703086 100644 --- a/screener/migrations/0015_remove_screen_cell.py +++ b/screener/migrations/0015_remove_screen_cell.py @@ -4,14 +4,13 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0014_screen_cell_screen_email'), + ("screener", "0014_screen_cell_screen_email"), ] operations = [ migrations.RemoveField( - model_name='screen', - name='cell', + model_name="screen", + name="cell", ), ] diff --git a/screener/migrations/0016_remove_screen_email.py b/screener/migrations/0016_remove_screen_email.py index 6456247b..6ecccab0 100644 --- a/screener/migrations/0016_remove_screen_email.py +++ b/screener/migrations/0016_remove_screen_email.py @@ -4,14 +4,13 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0015_remove_screen_cell'), + ("screener", "0015_remove_screen_cell"), ] operations = [ migrations.RemoveField( - model_name='screen', - name='email', + model_name="screen", + name="email", ), ] diff --git a/screener/migrations/0017_screen_last_email_request_date.py b/screener/migrations/0017_screen_last_email_request_date.py index 2c15230d..5e69a6a8 100644 --- a/screener/migrations/0017_screen_last_email_request_date.py +++ b/screener/migrations/0017_screen_last_email_request_date.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0016_remove_screen_email'), + ("screener", "0016_remove_screen_email"), ] operations = [ migrations.AddField( - model_name='screen', - name='last_email_request_date', + model_name="screen", + name="last_email_request_date", field=models.DateTimeField(blank=True, null=True), ), ] diff --git a/screener/migrations/0018_screen_user.py b/screener/migrations/0018_screen_user.py index 3509e95e..03d0fc79 100644 --- a/screener/migrations/0018_screen_user.py +++ b/screener/migrations/0018_screen_user.py @@ -6,16 +6,21 @@ class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('screener', '0017_screen_last_email_request_date'), + ("screener", "0017_screen_last_email_request_date"), ] operations = [ migrations.AddField( - model_name='screen', - name='user', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='screens', to=settings.AUTH_USER_MODEL), + model_name="screen", + name="user", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="screens", + to=settings.AUTH_USER_MODEL, + ), ), ] diff --git a/screener/migrations/0019_screen_start_date.py b/screener/migrations/0019_screen_start_date.py index 4bdb856b..b7e1a673 100644 --- a/screener/migrations/0019_screen_start_date.py +++ b/screener/migrations/0019_screen_start_date.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0018_screen_user'), + ("screener", "0018_screen_user"), ] operations = [ migrations.AddField( - model_name='screen', - name='start_date', + model_name="screen", + name="start_date", field=models.DateTimeField(blank=True, null=True), ), ] diff --git a/screener/migrations/0020_screen_is_test.py b/screener/migrations/0020_screen_is_test.py index 1bd1fb96..5535a831 100644 --- a/screener/migrations/0020_screen_is_test.py +++ b/screener/migrations/0020_screen_is_test.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0019_screen_start_date'), + ("screener", "0019_screen_start_date"), ] operations = [ migrations.AddField( - model_name='screen', - name='is_test', + model_name="screen", + name="is_test", field=models.BooleanField(blank=True, default=False), ), ] diff --git a/screener/migrations/0021_messages.py b/screener/migrations/0021_messages.py index f8377f68..9f3fb465 100644 --- a/screener/migrations/0021_messages.py +++ b/screener/migrations/0021_messages.py @@ -6,21 +6,33 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0020_screen_is_test'), + ("screener", "0020_screen_is_test"), ] operations = [ migrations.CreateModel( - name='Messages', + name="Messages", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('sent', models.DateTimeField(auto_now=True)), - ('cell', phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, null=True, region=None, unique=True)), - ('email', models.EmailField(blank=True, max_length=254, null=True, unique=True, verbose_name='email address')), - ('message', models.CharField(blank=True, max_length=320, null=True)), - ('screen', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='messages', to='screener.screen')), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("sent", models.DateTimeField(auto_now=True)), + ( + "cell", + phonenumber_field.modelfields.PhoneNumberField( + blank=True, max_length=128, null=True, region=None, unique=True + ), + ), + ( + "email", + models.EmailField(blank=True, max_length=254, null=True, unique=True, verbose_name="email address"), + ), + ("message", models.CharField(blank=True, max_length=320, null=True)), + ( + "screen", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name="messages", to="screener.screen" + ), + ), ], ), ] diff --git a/screener/migrations/0022_rename_messages_message.py b/screener/migrations/0022_rename_messages_message.py index 71f7f1e2..bc9145c0 100644 --- a/screener/migrations/0022_rename_messages_message.py +++ b/screener/migrations/0022_rename_messages_message.py @@ -4,14 +4,13 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0021_messages'), + ("screener", "0021_messages"), ] operations = [ migrations.RenameModel( - old_name='Messages', - new_name='Message', + old_name="Messages", + new_name="Message", ), ] diff --git a/screener/migrations/0023_rename_message_message_content_message_type.py b/screener/migrations/0023_rename_message_message_content_message_type.py index 87ed8481..b5d83512 100644 --- a/screener/migrations/0023_rename_message_message_content_message_type.py +++ b/screener/migrations/0023_rename_message_message_content_message_type.py @@ -4,21 +4,20 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0022_rename_messages_message'), + ("screener", "0022_rename_messages_message"), ] operations = [ migrations.RenameField( - model_name='message', - old_name='message', - new_name='content', + model_name="message", + old_name="message", + new_name="content", ), migrations.AddField( - model_name='message', - name='type', - field=models.CharField(default='', max_length=30), + model_name="message", + name="type", + field=models.CharField(default="", max_length=30), preserve_default=False, ), ] diff --git a/screener/migrations/0024_alter_message_cell_alter_message_email.py b/screener/migrations/0024_alter_message_cell_alter_message_email.py index 263d9d29..9ee9261b 100644 --- a/screener/migrations/0024_alter_message_cell_alter_message_email.py +++ b/screener/migrations/0024_alter_message_cell_alter_message_email.py @@ -5,20 +5,19 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0023_rename_message_message_content_message_type'), + ("screener", "0023_rename_message_message_content_message_type"), ] operations = [ migrations.AlterField( - model_name='message', - name='cell', + model_name="message", + name="cell", field=phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, null=True, region=None), ), migrations.AlterField( - model_name='message', - name='email', - field=models.EmailField(blank=True, max_length=254, null=True, verbose_name='email address'), + model_name="message", + name="email", + field=models.EmailField(blank=True, max_length=254, null=True, verbose_name="email address"), ), ] diff --git a/screener/migrations/0025_screen_external_id.py b/screener/migrations/0025_screen_external_id.py index 67bced38..69083f2d 100644 --- a/screener/migrations/0025_screen_external_id.py +++ b/screener/migrations/0025_screen_external_id.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0024_alter_message_cell_alter_message_email'), + ("screener", "0024_alter_message_cell_alter_message_email"), ] operations = [ migrations.AddField( - model_name='screen', - name='external_id', + model_name="screen", + name="external_id", field=models.CharField(blank=True, max_length=120, null=True), ), ] diff --git a/screener/migrations/0026_screen_filed_taxes.py b/screener/migrations/0026_screen_filed_taxes.py index 40b12481..e2d500fe 100644 --- a/screener/migrations/0026_screen_filed_taxes.py +++ b/screener/migrations/0026_screen_filed_taxes.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0025_screen_external_id'), + ("screener", "0025_screen_external_id"), ] operations = [ migrations.AddField( - model_name='screen', - name='filed_taxes', + model_name="screen", + name="filed_taxes", field=models.BooleanField(blank=True, default=None, null=True), ), ] diff --git a/screener/migrations/0027_remove_screen_filed_taxes.py b/screener/migrations/0027_remove_screen_filed_taxes.py index 98c2743d..1b30d814 100644 --- a/screener/migrations/0027_remove_screen_filed_taxes.py +++ b/screener/migrations/0027_remove_screen_filed_taxes.py @@ -4,14 +4,13 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0026_screen_filed_taxes'), + ("screener", "0026_screen_filed_taxes"), ] operations = [ migrations.RemoveField( - model_name='screen', - name='filed_taxes', + model_name="screen", + name="filed_taxes", ), ] diff --git a/screener/migrations/0028_screen_last_tax_filing_year.py b/screener/migrations/0028_screen_last_tax_filing_year.py index 7e602175..41f24c6d 100644 --- a/screener/migrations/0028_screen_last_tax_filing_year.py +++ b/screener/migrations/0028_screen_last_tax_filing_year.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0027_remove_screen_filed_taxes'), + ("screener", "0027_remove_screen_filed_taxes"), ] operations = [ migrations.AddField( - model_name='screen', - name='last_tax_filing_year', + model_name="screen", + name="last_tax_filing_year", field=models.CharField(blank=True, default=None, max_length=120, null=True), ), ] diff --git a/screener/migrations/0029_alter_screen_housing_situation.py b/screener/migrations/0029_alter_screen_housing_situation.py index 97fa7799..20e71f1c 100644 --- a/screener/migrations/0029_alter_screen_housing_situation.py +++ b/screener/migrations/0029_alter_screen_housing_situation.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0028_screen_last_tax_filing_year'), + ("screener", "0028_screen_last_tax_filing_year"), ] operations = [ migrations.AlterField( - model_name='screen', - name='housing_situation', + model_name="screen", + name="housing_situation", field=models.CharField(blank=True, default=None, max_length=30, null=True), ), ] diff --git a/screener/migrations/0030_screen_has_acp_screen_has_ccb_screen_has_cccap_and_more.py b/screener/migrations/0030_screen_has_acp_screen_has_ccb_screen_has_cccap_and_more.py index 24cf05f0..bd2b3276 100644 --- a/screener/migrations/0030_screen_has_acp_screen_has_ccb_screen_has_cccap_and_more.py +++ b/screener/migrations/0030_screen_has_acp_screen_has_ccb_screen_has_cccap_and_more.py @@ -4,85 +4,84 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0029_alter_screen_housing_situation'), + ("screener", "0029_alter_screen_housing_situation"), ] operations = [ migrations.AddField( - model_name='screen', - name='has_acp', + model_name="screen", + name="has_acp", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_ccb', + model_name="screen", + name="has_ccb", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_cccap', + model_name="screen", + name="has_cccap", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_chp', + model_name="screen", + name="has_chp", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_coeitc', + model_name="screen", + name="has_coeitc", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_ctc', + model_name="screen", + name="has_ctc", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_eitc', + model_name="screen", + name="has_eitc", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_lifeline', + model_name="screen", + name="has_lifeline", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_medicaid', + model_name="screen", + name="has_medicaid", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_mydenver', + model_name="screen", + name="has_mydenver", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_nslp', + model_name="screen", + name="has_nslp", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_rtdlive', + model_name="screen", + name="has_rtdlive", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_snap', + model_name="screen", + name="has_snap", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_tanf', + model_name="screen", + name="has_tanf", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_wic', + model_name="screen", + name="has_wic", field=models.BooleanField(blank=True, default=False, null=True), ), ] diff --git a/screener/migrations/0031_alter_householdmember_disability_medicaid_and_more.py b/screener/migrations/0031_alter_householdmember_disability_medicaid_and_more.py index 4b1dd9c4..d80cc09e 100644 --- a/screener/migrations/0031_alter_householdmember_disability_medicaid_and_more.py +++ b/screener/migrations/0031_alter_householdmember_disability_medicaid_and_more.py @@ -4,20 +4,19 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0030_screen_has_acp_screen_has_ccb_screen_has_cccap_and_more'), + ("screener", "0030_screen_has_acp_screen_has_ccb_screen_has_cccap_and_more"), ] operations = [ migrations.AlterField( - model_name='householdmember', - name='disability_medicaid', + model_name="householdmember", + name="disability_medicaid", field=models.BooleanField(blank=True, null=True), ), migrations.AlterField( - model_name='householdmember', - name='medicaid', + model_name="householdmember", + name="medicaid", field=models.BooleanField(blank=True, null=True), ), ] diff --git a/screener/migrations/0032_message_uid.py b/screener/migrations/0032_message_uid.py index 14ad42c9..d0010baa 100644 --- a/screener/migrations/0032_message_uid.py +++ b/screener/migrations/0032_message_uid.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0031_alter_householdmember_disability_medicaid_and_more'), + ("screener", "0031_alter_householdmember_disability_medicaid_and_more"), ] operations = [ migrations.AddField( - model_name='message', - name='uid', + model_name="message", + name="uid", field=models.IntegerField(blank=True, null=True), ), ] diff --git a/screener/migrations/0033_screen_referral_source.py b/screener/migrations/0033_screen_referral_source.py index 92c783e3..486aeeed 100644 --- a/screener/migrations/0033_screen_referral_source.py +++ b/screener/migrations/0033_screen_referral_source.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0032_message_uid'), + ("screener", "0032_message_uid"), ] operations = [ migrations.AddField( - model_name='screen', - name='referral_source', + model_name="screen", + name="referral_source", field=models.CharField(blank=True, default=None, max_length=320, null=True), ), ] diff --git a/screener/migrations/0034_alter_screen_household_assets.py b/screener/migrations/0034_alter_screen_household_assets.py index 83bff2c4..e586bbab 100644 --- a/screener/migrations/0034_alter_screen_household_assets.py +++ b/screener/migrations/0034_alter_screen_household_assets.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0033_screen_referral_source'), + ("screener", "0033_screen_referral_source"), ] operations = [ migrations.AlterField( - model_name='screen', - name='household_assets', + model_name="screen", + name="household_assets", field=models.DecimalField(blank=True, decimal_places=2, default=None, max_digits=10, null=True), ), ] diff --git a/screener/migrations/0035_screen_county.py b/screener/migrations/0035_screen_county.py index e1717eb8..4fc78071 100644 --- a/screener/migrations/0035_screen_county.py +++ b/screener/migrations/0035_screen_county.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0034_alter_screen_household_assets'), + ("screener", "0034_alter_screen_household_assets"), ] operations = [ migrations.AddField( - model_name='screen', - name='county', + model_name="screen", + name="county", field=models.CharField(blank=True, default=None, max_length=120, null=True), ), ] diff --git a/screener/migrations/0036_screen_request_language_code.py b/screener/migrations/0036_screen_request_language_code.py index a56c4cb9..571c1a5d 100644 --- a/screener/migrations/0036_screen_request_language_code.py +++ b/screener/migrations/0036_screen_request_language_code.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0035_screen_county'), + ("screener", "0035_screen_county"), ] operations = [ migrations.AddField( - model_name='screen', - name='request_language_code', + model_name="screen", + name="request_language_code", field=models.CharField(blank=True, max_length=12, null=True), ), ] diff --git a/screener/migrations/0037_eligibilitysnapshot_programeligibilitysnapshot.py b/screener/migrations/0037_eligibilitysnapshot_programeligibilitysnapshot.py index 89028830..a026c130 100644 --- a/screener/migrations/0037_eligibilitysnapshot_programeligibilitysnapshot.py +++ b/screener/migrations/0037_eligibilitysnapshot_programeligibilitysnapshot.py @@ -5,35 +5,48 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0036_screen_request_language_code'), + ("screener", "0036_screen_request_language_code"), ] operations = [ migrations.CreateModel( - name='EligibilitySnapshot', + name="EligibilitySnapshot", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('submission_date', models.DateTimeField(auto_now=True)), - ('screen', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='eligibility_snapshots', to='screener.screen')), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("submission_date", models.DateTimeField(auto_now=True)), + ( + "screen", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="eligibility_snapshots", + to="screener.screen", + ), + ), ], ), migrations.CreateModel( - name='ProgramEligibilitySnapshot', + name="ProgramEligibilitySnapshot", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=320)), - ('name_abbreviated', models.CharField(max_length=32)), - ('value_type', models.CharField(max_length=120)), - ('estimated_value', models.DecimalField(decimal_places=2, max_digits=10)), - ('estimated_delivery_time', models.CharField(max_length=120)), - ('estimated_application_time', models.CharField(max_length=120)), - ('legal_status_required', models.CharField(max_length=120)), - ('eligible', models.BooleanField()), - ('failed_tests', models.JSONField()), - ('passed_tests', models.JSONField()), - ('eligibility_snapshot', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='program_snapshots', to='screener.eligibilitysnapshot')), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("name", models.CharField(max_length=320)), + ("name_abbreviated", models.CharField(max_length=32)), + ("value_type", models.CharField(max_length=120)), + ("estimated_value", models.DecimalField(decimal_places=2, max_digits=10)), + ("estimated_delivery_time", models.CharField(max_length=120)), + ("estimated_application_time", models.CharField(max_length=120)), + ("legal_status_required", models.CharField(max_length=120)), + ("eligible", models.BooleanField()), + ("failed_tests", models.JSONField()), + ("passed_tests", models.JSONField()), + ( + "eligibility_snapshot", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="program_snapshots", + to="screener.eligibilitysnapshot", + ), + ), ], ), ] diff --git a/screener/migrations/0038_alter_programeligibilitysnapshot_estimated_application_time_and_more.py b/screener/migrations/0038_alter_programeligibilitysnapshot_estimated_application_time_and_more.py index 18bafb77..d8a24e8c 100644 --- a/screener/migrations/0038_alter_programeligibilitysnapshot_estimated_application_time_and_more.py +++ b/screener/migrations/0038_alter_programeligibilitysnapshot_estimated_application_time_and_more.py @@ -4,35 +4,34 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0037_eligibilitysnapshot_programeligibilitysnapshot'), + ("screener", "0037_eligibilitysnapshot_programeligibilitysnapshot"), ] operations = [ migrations.AlterField( - model_name='programeligibilitysnapshot', - name='estimated_application_time', + model_name="programeligibilitysnapshot", + name="estimated_application_time", field=models.CharField(blank=True, max_length=120, null=True), ), migrations.AlterField( - model_name='programeligibilitysnapshot', - name='estimated_delivery_time', + model_name="programeligibilitysnapshot", + name="estimated_delivery_time", field=models.CharField(blank=True, max_length=120, null=True), ), migrations.AlterField( - model_name='programeligibilitysnapshot', - name='failed_tests', + model_name="programeligibilitysnapshot", + name="failed_tests", field=models.JSONField(blank=True, null=True), ), migrations.AlterField( - model_name='programeligibilitysnapshot', - name='legal_status_required', + model_name="programeligibilitysnapshot", + name="legal_status_required", field=models.CharField(blank=True, max_length=120, null=True), ), migrations.AlterField( - model_name='programeligibilitysnapshot', - name='passed_tests', + model_name="programeligibilitysnapshot", + name="passed_tests", field=models.JSONField(blank=True, null=True), ), ] diff --git a/screener/migrations/0039_screen_has_ssi.py b/screener/migrations/0039_screen_has_ssi.py index 116f4e23..84aa63e9 100644 --- a/screener/migrations/0039_screen_has_ssi.py +++ b/screener/migrations/0039_screen_has_ssi.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0038_alter_programeligibilitysnapshot_estimated_application_time_and_more'), + ("screener", "0038_alter_programeligibilitysnapshot_estimated_application_time_and_more"), ] operations = [ migrations.AddField( - model_name='screen', - name='has_ssi', + model_name="screen", + name="has_ssi", field=models.BooleanField(blank=True, default=False, null=True), ), ] diff --git a/screener/migrations/0040_screen_has_chp_hi_screen_has_employer_hi_and_more.py b/screener/migrations/0040_screen_has_chp_hi_screen_has_employer_hi_and_more.py index d5f205d5..b52afd91 100644 --- a/screener/migrations/0040_screen_has_chp_hi_screen_has_employer_hi_and_more.py +++ b/screener/migrations/0040_screen_has_chp_hi_screen_has_employer_hi_and_more.py @@ -4,35 +4,34 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0039_screen_has_ssi'), + ("screener", "0039_screen_has_ssi"), ] operations = [ migrations.AddField( - model_name='screen', - name='has_chp_hi', + model_name="screen", + name="has_chp_hi", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_employer_hi', + model_name="screen", + name="has_employer_hi", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_medicaid_hi', + model_name="screen", + name="has_medicaid_hi", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_no_hi', + model_name="screen", + name="has_no_hi", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_private_hi', + model_name="screen", + name="has_private_hi", field=models.BooleanField(blank=True, default=False, null=True), ), ] diff --git a/screener/migrations/0041_screen_referrer_code.py b/screener/migrations/0041_screen_referrer_code.py index 8cdcb3cd..bfcb342b 100644 --- a/screener/migrations/0041_screen_referrer_code.py +++ b/screener/migrations/0041_screen_referrer_code.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0040_screen_has_chp_hi_screen_has_employer_hi_and_more'), + ("screener", "0040_screen_has_chp_hi_screen_has_employer_hi_and_more"), ] operations = [ migrations.AddField( - model_name='screen', - name='referrer_code', + model_name="screen", + name="referrer_code", field=models.CharField(blank=True, default=None, max_length=320, null=True), ), ] diff --git a/screener/migrations/0042_screen_needs_baby_supplies_and_more.py b/screener/migrations/0042_screen_needs_baby_supplies_and_more.py index e1c1808f..4e6a039a 100644 --- a/screener/migrations/0042_screen_needs_baby_supplies_and_more.py +++ b/screener/migrations/0042_screen_needs_baby_supplies_and_more.py @@ -4,40 +4,39 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0041_screen_referrer_code'), + ("screener", "0041_screen_referrer_code"), ] operations = [ migrations.AddField( - model_name='screen', - name='needs_baby_supplies', + model_name="screen", + name="needs_baby_supplies", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='needs_child_dev_help', + model_name="screen", + name="needs_child_dev_help", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='needs_food', + model_name="screen", + name="needs_food", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='needs_funeral_help', + model_name="screen", + name="needs_funeral_help", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='needs_housing_help', + model_name="screen", + name="needs_housing_help", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='needs_mental_health_help', + model_name="screen", + name="needs_mental_health_help", field=models.BooleanField(blank=True, default=False, null=True), ), ] diff --git a/screener/migrations/0043_screen_has_medicare_hi.py b/screener/migrations/0043_screen_has_medicare_hi.py index e4e6f54e..e5babd3d 100644 --- a/screener/migrations/0043_screen_has_medicare_hi.py +++ b/screener/migrations/0043_screen_has_medicare_hi.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0042_screen_needs_baby_supplies_and_more'), + ("screener", "0042_screen_needs_baby_supplies_and_more"), ] operations = [ migrations.AddField( - model_name='screen', - name='has_medicare_hi', + model_name="screen", + name="has_medicare_hi", field=models.BooleanField(blank=True, default=False, null=True), ), ] diff --git a/screener/migrations/0044_screen_is_verified.py b/screener/migrations/0044_screen_is_verified.py index b0ce051f..65b0ce57 100644 --- a/screener/migrations/0044_screen_is_verified.py +++ b/screener/migrations/0044_screen_is_verified.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0043_screen_has_medicare_hi'), + ("screener", "0043_screen_has_medicare_hi"), ] operations = [ migrations.AddField( - model_name='screen', - name='is_verified', + model_name="screen", + name="is_verified", field=models.BooleanField(blank=True, default=False), ), ] diff --git a/screener/migrations/0045_screen_uuid.py b/screener/migrations/0045_screen_uuid.py index efa0f356..11d1d653 100644 --- a/screener/migrations/0045_screen_uuid.py +++ b/screener/migrations/0045_screen_uuid.py @@ -5,15 +5,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0044_screen_is_verified'), + ("screener", "0044_screen_is_verified"), ] operations = [ migrations.AddField( - model_name='screen', - name='uuid', + model_name="screen", + name="uuid", field=models.UUIDField(default=uuid.uuid4, editable=False), ), ] diff --git a/screener/migrations/0046_alter_screen_uuid.py b/screener/migrations/0046_alter_screen_uuid.py index 55eeae10..5e8d3853 100644 --- a/screener/migrations/0046_alter_screen_uuid.py +++ b/screener/migrations/0046_alter_screen_uuid.py @@ -5,15 +5,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0045_screen_uuid'), + ("screener", "0045_screen_uuid"), ] operations = [ migrations.AlterField( - model_name='screen', - name='uuid', + model_name="screen", + name="uuid", field=models.UUIDField(default=uuid.uuid4), ), ] diff --git a/screener/migrations/0047_incomestream_hours_worked.py b/screener/migrations/0047_incomestream_hours_worked.py index 144f8eb7..9cd2edd9 100644 --- a/screener/migrations/0047_incomestream_hours_worked.py +++ b/screener/migrations/0047_incomestream_hours_worked.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0046_alter_screen_uuid'), + ("screener", "0046_alter_screen_uuid"), ] operations = [ migrations.AddField( - model_name='incomestream', - name='hours_worked', + model_name="incomestream", + name="hours_worked", field=models.IntegerField(null=True), ), ] diff --git a/screener/migrations/0048_screen_needs_family_planning_help.py b/screener/migrations/0048_screen_needs_family_planning_help.py index ebc5c318..2a7f76eb 100644 --- a/screener/migrations/0048_screen_needs_family_planning_help.py +++ b/screener/migrations/0048_screen_needs_family_planning_help.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0047_incomestream_hours_worked'), + ("screener", "0047_incomestream_hours_worked"), ] operations = [ migrations.AddField( - model_name='screen', - name='needs_family_planning_help', + model_name="screen", + name="needs_family_planning_help", field=models.BooleanField(blank=True, default=False, null=True), ), ] diff --git a/screener/migrations/0049_eligibilitysnapshot_batch.py b/screener/migrations/0049_eligibilitysnapshot_batch.py index 00664c9c..4c3142eb 100644 --- a/screener/migrations/0049_eligibilitysnapshot_batch.py +++ b/screener/migrations/0049_eligibilitysnapshot_batch.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0048_screen_needs_family_planning_help'), + ("screener", "0048_screen_needs_family_planning_help"), ] operations = [ migrations.AddField( - model_name='eligibilitysnapshot', - name='batch', + model_name="eligibilitysnapshot", + name="batch", field=models.BooleanField(default=False), ), ] diff --git a/screener/migrations/0050_rename_batch_eligibilitysnapshot_is_batch.py b/screener/migrations/0050_rename_batch_eligibilitysnapshot_is_batch.py index 65329ee0..84ba7698 100644 --- a/screener/migrations/0050_rename_batch_eligibilitysnapshot_is_batch.py +++ b/screener/migrations/0050_rename_batch_eligibilitysnapshot_is_batch.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0049_eligibilitysnapshot_batch'), + ("screener", "0049_eligibilitysnapshot_batch"), ] operations = [ migrations.RenameField( - model_name='eligibilitysnapshot', - old_name='batch', - new_name='is_batch', + model_name="eligibilitysnapshot", + old_name="batch", + new_name="is_batch", ), ] diff --git a/screener/migrations/0051_programeligibilitysnapshot_new.py b/screener/migrations/0051_programeligibilitysnapshot_new.py index fe09c847..aed99351 100644 --- a/screener/migrations/0051_programeligibilitysnapshot_new.py +++ b/screener/migrations/0051_programeligibilitysnapshot_new.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0050_rename_batch_eligibilitysnapshot_is_batch'), + ("screener", "0050_rename_batch_eligibilitysnapshot_is_batch"), ] operations = [ migrations.AddField( - model_name='programeligibilitysnapshot', - name='new', + model_name="programeligibilitysnapshot", + name="new", field=models.BooleanField(default=False), ), ] diff --git a/screener/migrations/0052_alter_expense_household_member.py b/screener/migrations/0052_alter_expense_household_member.py index b9230f44..63d6119a 100644 --- a/screener/migrations/0052_alter_expense_household_member.py +++ b/screener/migrations/0052_alter_expense_household_member.py @@ -5,15 +5,19 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0051_programeligibilitysnapshot_new'), + ("screener", "0051_programeligibilitysnapshot_new"), ] operations = [ migrations.AlterField( - model_name='expense', - name='household_member', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='expenses', to='screener.householdmember'), + model_name="expense", + name="household_member", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="expenses", + to="screener.householdmember", + ), ), ] diff --git a/screener/migrations/0053_alter_householdmember_has_expenses_and_more.py b/screener/migrations/0053_alter_householdmember_has_expenses_and_more.py index f80325bb..7cef8bbb 100644 --- a/screener/migrations/0053_alter_householdmember_has_expenses_and_more.py +++ b/screener/migrations/0053_alter_householdmember_has_expenses_and_more.py @@ -4,20 +4,19 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0052_alter_expense_household_member'), + ("screener", "0052_alter_expense_household_member"), ] operations = [ migrations.AlterField( - model_name='householdmember', - name='has_expenses', + model_name="householdmember", + name="has_expenses", field=models.BooleanField(null=True), ), migrations.AlterField( - model_name='householdmember', - name='has_income', + model_name="householdmember", + name="has_income", field=models.BooleanField(null=True), ), ] diff --git a/screener/migrations/0054_alter_expense_amount_alter_expense_frequency_and_more.py b/screener/migrations/0054_alter_expense_amount_alter_expense_frequency_and_more.py index d7bb9d19..f2044965 100644 --- a/screener/migrations/0054_alter_expense_amount_alter_expense_frequency_and_more.py +++ b/screener/migrations/0054_alter_expense_amount_alter_expense_frequency_and_more.py @@ -4,125 +4,124 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0053_alter_householdmember_has_expenses_and_more'), + ("screener", "0053_alter_householdmember_has_expenses_and_more"), ] operations = [ migrations.AlterField( - model_name='expense', - name='amount', + model_name="expense", + name="amount", field=models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True), ), migrations.AlterField( - model_name='expense', - name='frequency', + model_name="expense", + name="frequency", field=models.CharField(blank=True, max_length=30, null=True), ), migrations.AlterField( - model_name='expense', - name='type', + model_name="expense", + name="type", field=models.CharField(blank=True, max_length=30, null=True), ), migrations.AlterField( - model_name='householdmember', - name='age', + model_name="householdmember", + name="age", field=models.IntegerField(blank=True, null=True), ), migrations.AlterField( - model_name='householdmember', - name='disabled', + model_name="householdmember", + name="disabled", field=models.BooleanField(blank=True, null=True), ), migrations.AlterField( - model_name='householdmember', - name='has_expenses', + model_name="householdmember", + name="has_expenses", field=models.BooleanField(blank=True, null=True), ), migrations.AlterField( - model_name='householdmember', - name='has_income', + model_name="householdmember", + name="has_income", field=models.BooleanField(blank=True, null=True), ), migrations.AlterField( - model_name='householdmember', - name='pregnant', + model_name="householdmember", + name="pregnant", field=models.BooleanField(blank=True, null=True), ), migrations.AlterField( - model_name='householdmember', - name='relationship', + model_name="householdmember", + name="relationship", field=models.CharField(blank=True, max_length=30, null=True), ), migrations.AlterField( - model_name='householdmember', - name='student', + model_name="householdmember", + name="student", field=models.BooleanField(blank=True, null=True), ), migrations.AlterField( - model_name='householdmember', - name='student_full_time', + model_name="householdmember", + name="student_full_time", field=models.BooleanField(blank=True, null=True), ), migrations.AlterField( - model_name='householdmember', - name='unemployed', + model_name="householdmember", + name="unemployed", field=models.BooleanField(blank=True, null=True), ), migrations.AlterField( - model_name='householdmember', - name='veteran', + model_name="householdmember", + name="veteran", field=models.BooleanField(blank=True, null=True), ), migrations.AlterField( - model_name='householdmember', - name='visually_impaired', + model_name="householdmember", + name="visually_impaired", field=models.BooleanField(blank=True, null=True), ), migrations.AlterField( - model_name='householdmember', - name='worked_in_last_18_mos', + model_name="householdmember", + name="worked_in_last_18_mos", field=models.BooleanField(blank=True, null=True), ), migrations.AlterField( - model_name='incomestream', - name='amount', + model_name="incomestream", + name="amount", field=models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True), ), migrations.AlterField( - model_name='incomestream', - name='frequency', + model_name="incomestream", + name="frequency", field=models.CharField(blank=True, max_length=30, null=True), ), migrations.AlterField( - model_name='incomestream', - name='hours_worked', + model_name="incomestream", + name="hours_worked", field=models.IntegerField(blank=True, null=True), ), migrations.AlterField( - model_name='incomestream', - name='type', + model_name="incomestream", + name="type", field=models.CharField(blank=True, max_length=30, null=True), ), migrations.AlterField( - model_name='screen', - name='agree_to_tos', + model_name="screen", + name="agree_to_tos", field=models.BooleanField(blank=True, null=True), ), migrations.AlterField( - model_name='screen', - name='household_size', + model_name="screen", + name="household_size", field=models.IntegerField(blank=True, null=True), ), migrations.AlterField( - model_name='screen', - name='submission_date', + model_name="screen", + name="submission_date", field=models.DateTimeField(blank=True, null=True), ), migrations.AlterField( - model_name='screen', - name='zipcode', + model_name="screen", + name="zipcode", field=models.CharField(blank=True, max_length=5, null=True), ), ] diff --git a/screener/migrations/0055_screen_has_andcs_screen_has_benefits_and_more.py b/screener/migrations/0055_screen_has_andcs_screen_has_benefits_and_more.py index 07b3a853..0499cd39 100644 --- a/screener/migrations/0055_screen_has_andcs_screen_has_benefits_and_more.py +++ b/screener/migrations/0055_screen_has_andcs_screen_has_benefits_and_more.py @@ -4,60 +4,59 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0054_alter_expense_amount_alter_expense_frequency_and_more'), + ("screener", "0054_alter_expense_amount_alter_expense_frequency_and_more"), ] operations = [ migrations.AddField( - model_name='screen', - name='has_andcs', + model_name="screen", + name="has_andcs", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_benefits', - field=models.CharField(blank=True, default='preferNotToAnswer', max_length=32, null=True), + model_name="screen", + name="has_benefits", + field=models.CharField(blank=True, default="preferNotToAnswer", max_length=32, null=True), ), migrations.AddField( - model_name='screen', - name='has_cdhcs', + model_name="screen", + name="has_cdhcs", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_chs', + model_name="screen", + name="has_chs", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_cpcr', + model_name="screen", + name="has_cpcr", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_dpp', + model_name="screen", + name="has_dpp", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_ede', + model_name="screen", + name="has_ede", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_erc', + model_name="screen", + name="has_erc", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_leap', + model_name="screen", + name="has_leap", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_oap', + model_name="screen", + name="has_oap", field=models.BooleanField(blank=True, default=False, null=True), ), ] diff --git a/screener/migrations/0056_screen_completed.py b/screener/migrations/0056_screen_completed.py index 38f8afa1..e2ed6944 100644 --- a/screener/migrations/0056_screen_completed.py +++ b/screener/migrations/0056_screen_completed.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0055_screen_has_andcs_screen_has_benefits_and_more'), + ("screener", "0055_screen_has_andcs_screen_has_benefits_and_more"), ] operations = [ migrations.AddField( - model_name='screen', - name='completed', + model_name="screen", + name="completed", field=models.BooleanField(default=True), preserve_default=False, ), diff --git a/screener/migrations/0057_screen_has_coctc_screen_has_upk.py b/screener/migrations/0057_screen_has_coctc_screen_has_upk.py index 5df00262..c31e431e 100644 --- a/screener/migrations/0057_screen_has_coctc_screen_has_upk.py +++ b/screener/migrations/0057_screen_has_coctc_screen_has_upk.py @@ -4,20 +4,19 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0056_screen_completed'), + ("screener", "0056_screen_completed"), ] operations = [ migrations.AddField( - model_name='screen', - name='has_coctc', + model_name="screen", + name="has_coctc", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_upk', + model_name="screen", + name="has_upk", field=models.BooleanField(blank=True, default=False, null=True), ), ] diff --git a/screener/migrations/0058_webhookfunctions_webhooks_webhookstranslation.py b/screener/migrations/0058_webhookfunctions_webhooks_webhookstranslation.py index d0b6c4f7..9535fb58 100644 --- a/screener/migrations/0058_webhookfunctions_webhooks_webhookstranslation.py +++ b/screener/migrations/0058_webhookfunctions_webhooks_webhookstranslation.py @@ -7,46 +7,54 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0057_screen_has_coctc_screen_has_upk'), + ("screener", "0057_screen_has_coctc_screen_has_upk"), ] operations = [ migrations.CreateModel( - name='WebHookFunctions', + name="WebHookFunctions", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=64)), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("name", models.CharField(max_length=64)), ], ), migrations.CreateModel( - name='WebHooks', + name="WebHooks", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('referrer_code', models.CharField(max_length=120)), - ('url', models.CharField(max_length=320)), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("referrer_code", models.CharField(max_length=120)), + ("url", models.CharField(max_length=320)), ], options={ - 'abstract': False, + "abstract": False, }, bases=(parler.models.TranslatableModelMixin, models.Model), ), migrations.CreateModel( - name='WebHooksTranslation', + name="WebHooksTranslation", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('language_code', models.CharField(db_index=True, max_length=15, verbose_name='Language')), - ('consent_text', models.TextField()), - ('master', parler.fields.TranslationsForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='screener.webhooks')), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("language_code", models.CharField(db_index=True, max_length=15, verbose_name="Language")), + ("consent_text", models.TextField()), + ( + "master", + parler.fields.TranslationsForeignKey( + editable=False, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="translations", + to="screener.webhooks", + ), + ), ], options={ - 'verbose_name': 'web hooks Translation', - 'db_table': 'screener_webhooks_translation', - 'db_tablespace': '', - 'managed': True, - 'default_permissions': (), - 'unique_together': {('language_code', 'master')}, + "verbose_name": "web hooks Translation", + "db_table": "screener_webhooks_translation", + "db_tablespace": "", + "managed": True, + "default_permissions": (), + "unique_together": {("language_code", "master")}, }, bases=(parler.models.TranslatedFieldsModelMixin, models.Model), ), diff --git a/screener/migrations/0059_webhook_webhookfunction_webhooktranslation_and_more.py b/screener/migrations/0059_webhook_webhookfunction_webhooktranslation_and_more.py index 936b95c4..ace290bc 100644 --- a/screener/migrations/0059_webhook_webhookfunction_webhooktranslation_and_more.py +++ b/screener/migrations/0059_webhook_webhookfunction_webhooktranslation_and_more.py @@ -7,69 +7,77 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0058_webhookfunctions_webhooks_webhookstranslation'), + ("screener", "0058_webhookfunctions_webhooks_webhookstranslation"), ] operations = [ migrations.CreateModel( - name='WebHook', + name="WebHook", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('referrer_code', models.CharField(max_length=120)), - ('url', models.CharField(max_length=320)), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("referrer_code", models.CharField(max_length=120)), + ("url", models.CharField(max_length=320)), ], options={ - 'abstract': False, + "abstract": False, }, bases=(parler.models.TranslatableModelMixin, models.Model), ), migrations.CreateModel( - name='WebHookFunction', + name="WebHookFunction", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=64)), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("name", models.CharField(max_length=64)), ], ), migrations.CreateModel( - name='WebHookTranslation', + name="WebHookTranslation", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('language_code', models.CharField(db_index=True, max_length=15, verbose_name='Language')), - ('consent_text', models.TextField()), - ('master', parler.fields.TranslationsForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='screener.webhook')), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("language_code", models.CharField(db_index=True, max_length=15, verbose_name="Language")), + ("consent_text", models.TextField()), + ( + "master", + parler.fields.TranslationsForeignKey( + editable=False, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="translations", + to="screener.webhook", + ), + ), ], options={ - 'verbose_name': 'web hook Translation', - 'db_table': 'screener_webhook_translation', - 'db_tablespace': '', - 'managed': True, - 'default_permissions': (), - 'unique_together': {('language_code', 'master')}, + "verbose_name": "web hook Translation", + "db_table": "screener_webhook_translation", + "db_tablespace": "", + "managed": True, + "default_permissions": (), + "unique_together": {("language_code", "master")}, }, bases=(parler.models.TranslatedFieldsModelMixin, models.Model), ), migrations.DeleteModel( - name='WebHookFunctions', + name="WebHookFunctions", ), migrations.AlterUniqueTogether( - name='webhookstranslation', + name="webhookstranslation", unique_together=None, ), migrations.RemoveField( - model_name='webhookstranslation', - name='master', + model_name="webhookstranslation", + name="master", ), migrations.DeleteModel( - name='WebHooks', + name="WebHooks", ), migrations.DeleteModel( - name='WebHooksTranslation', + name="WebHooksTranslation", ), migrations.AddField( - model_name='webhook', - name='functions', - field=models.ManyToManyField(related_name='function', to='screener.webhookfunction'), + model_name="webhook", + name="functions", + field=models.ManyToManyField(related_name="function", to="screener.webhookfunction"), ), ] diff --git a/screener/migrations/0060_screen_is_test_data.py b/screener/migrations/0060_screen_is_test_data.py index 95e95ddf..77b681cf 100644 --- a/screener/migrations/0060_screen_is_test_data.py +++ b/screener/migrations/0060_screen_is_test_data.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0059_webhook_webhookfunction_webhooktranslation_and_more'), + ("screener", "0059_webhook_webhookfunction_webhooktranslation_and_more"), ] operations = [ migrations.AddField( - model_name='screen', - name='is_test_data', + model_name="screen", + name="is_test_data", field=models.BooleanField(blank=True, default=False), ), ] diff --git a/screener/migrations/0061_alter_screen_is_test_data.py b/screener/migrations/0061_alter_screen_is_test_data.py index 809b2542..65e46c3b 100644 --- a/screener/migrations/0061_alter_screen_is_test_data.py +++ b/screener/migrations/0061_alter_screen_is_test_data.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0060_screen_is_test_data'), + ("screener", "0060_screen_is_test_data"), ] operations = [ migrations.AlterField( - model_name='screen', - name='is_test_data', + model_name="screen", + name="is_test_data", field=models.BooleanField(blank=True), ), ] diff --git a/screener/migrations/0062_alter_screen_is_test_data.py b/screener/migrations/0062_alter_screen_is_test_data.py index 22abc76a..8d5e8b56 100644 --- a/screener/migrations/0062_alter_screen_is_test_data.py +++ b/screener/migrations/0062_alter_screen_is_test_data.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0061_alter_screen_is_test_data'), + ("screener", "0061_alter_screen_is_test_data"), ] operations = [ migrations.AlterField( - model_name='screen', - name='is_test_data', + model_name="screen", + name="is_test_data", field=models.BooleanField(blank=True, null=True), ), ] diff --git a/screener/migrations/0063_alter_webhooktranslation_unique_together_and_more.py b/screener/migrations/0063_alter_webhooktranslation_unique_together_and_more.py index 1bceb48f..eb14c3ad 100644 --- a/screener/migrations/0063_alter_webhooktranslation_unique_together_and_more.py +++ b/screener/migrations/0063_alter_webhooktranslation_unique_together_and_more.py @@ -4,27 +4,26 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0062_alter_screen_is_test_data'), + ("screener", "0062_alter_screen_is_test_data"), ] operations = [ migrations.AlterUniqueTogether( - name='webhooktranslation', + name="webhooktranslation", unique_together=None, ), migrations.RemoveField( - model_name='webhooktranslation', - name='master', + model_name="webhooktranslation", + name="master", ), migrations.DeleteModel( - name='WebHook', + name="WebHook", ), migrations.DeleteModel( - name='WebHookFunction', + name="WebHookFunction", ), migrations.DeleteModel( - name='WebHookTranslation', + name="WebHookTranslation", ), ] diff --git a/screener/migrations/0064_screen_needs_dental_care_help_and_more.py b/screener/migrations/0064_screen_needs_dental_care_help_and_more.py index 6f41d27f..9d483c51 100644 --- a/screener/migrations/0064_screen_needs_dental_care_help_and_more.py +++ b/screener/migrations/0064_screen_needs_dental_care_help_and_more.py @@ -4,25 +4,24 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0063_alter_webhooktranslation_unique_together_and_more'), + ("screener", "0063_alter_webhooktranslation_unique_together_and_more"), ] operations = [ migrations.AddField( - model_name='screen', - name='needs_dental_care_help', + model_name="screen", + name="needs_dental_care_help", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='needs_job_resources', + model_name="screen", + name="needs_job_resources", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='needs_legal_services', + model_name="screen", + name="needs_legal_services", field=models.BooleanField(blank=True, default=False, null=True), ), ] diff --git a/screener/migrations/0065_rename_needs_dental_care_help_screen_needs_dental_care.py b/screener/migrations/0065_rename_needs_dental_care_help_screen_needs_dental_care.py index 72b4b84a..10ee521d 100644 --- a/screener/migrations/0065_rename_needs_dental_care_help_screen_needs_dental_care.py +++ b/screener/migrations/0065_rename_needs_dental_care_help_screen_needs_dental_care.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0064_screen_needs_dental_care_help_and_more'), + ("screener", "0064_screen_needs_dental_care_help_and_more"), ] operations = [ migrations.RenameField( - model_name='screen', - old_name='needs_dental_care_help', - new_name='needs_dental_care', + model_name="screen", + old_name="needs_dental_care_help", + new_name="needs_dental_care", ), ] diff --git a/screener/migrations/0066_screen_is_13_or_older.py b/screener/migrations/0066_screen_is_13_or_older.py index d4b9553c..f48e87c7 100644 --- a/screener/migrations/0066_screen_is_13_or_older.py +++ b/screener/migrations/0066_screen_is_13_or_older.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0065_rename_needs_dental_care_help_screen_needs_dental_care'), + ("screener", "0065_rename_needs_dental_care_help_screen_needs_dental_care"), ] operations = [ migrations.AddField( - model_name='screen', - name='is_13_or_older', + model_name="screen", + name="is_13_or_older", field=models.BooleanField(blank=True, null=True), ), ] diff --git a/screener/migrations/0067_alter_expense_household_member_alter_screen_user.py b/screener/migrations/0067_alter_expense_household_member_alter_screen_user.py index b0efdc35..4f5c1320 100644 --- a/screener/migrations/0067_alter_expense_household_member_alter_screen_user.py +++ b/screener/migrations/0067_alter_expense_household_member_alter_screen_user.py @@ -6,21 +6,31 @@ class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('screener', '0066_screen_is_13_or_older'), + ("screener", "0066_screen_is_13_or_older"), ] operations = [ migrations.AlterField( - model_name='expense', - name='household_member', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='expenses', to='screener.householdmember'), + model_name="expense", + name="household_member", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name="expenses", + to="screener.householdmember", + ), ), migrations.AlterField( - model_name='screen', - name='user', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='screens', to=settings.AUTH_USER_MODEL), + model_name="screen", + name="user", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name="screens", + to=settings.AUTH_USER_MODEL, + ), ), ] diff --git a/screener/migrations/0068_householdmember_insurance.py b/screener/migrations/0068_householdmember_insurance.py index 9d1d2106..eabbbba4 100644 --- a/screener/migrations/0068_householdmember_insurance.py +++ b/screener/migrations/0068_householdmember_insurance.py @@ -4,15 +4,28 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0067_alter_expense_household_member_alter_screen_user'), + ("screener", "0067_alter_expense_household_member_alter_screen_user"), ] operations = [ migrations.AddField( - model_name='householdmember', - name='insurance', - field=models.CharField(choices=[('dont_know', 'Dont Know'), ('none', 'None'), ('employer', 'Employer'), ('private', 'Private'), ('chp', 'Chp'), ('medicaid', 'Medicaid'), ('medicare', 'Medicare'), ('emergency_medicaid', 'Emergency Medicaid'), ('family_planning', 'Family Planning')], default='dont_know', max_length=64), + model_name="householdmember", + name="insurance", + field=models.CharField( + choices=[ + ("dont_know", "Dont Know"), + ("none", "None"), + ("employer", "Employer"), + ("private", "Private"), + ("chp", "Chp"), + ("medicaid", "Medicaid"), + ("medicare", "Medicare"), + ("emergency_medicaid", "Emergency Medicaid"), + ("family_planning", "Family Planning"), + ], + default="dont_know", + max_length=64, + ), ), ] diff --git a/screener/migrations/0069_alter_screen_has_chp_hi_alter_screen_has_employer_hi_and_more.py b/screener/migrations/0069_alter_screen_has_chp_hi_alter_screen_has_employer_hi_and_more.py index 27ab9d63..17c16f92 100644 --- a/screener/migrations/0069_alter_screen_has_chp_hi_alter_screen_has_employer_hi_and_more.py +++ b/screener/migrations/0069_alter_screen_has_chp_hi_alter_screen_has_employer_hi_and_more.py @@ -4,40 +4,39 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0068_householdmember_insurance'), + ("screener", "0068_householdmember_insurance"), ] operations = [ migrations.AlterField( - model_name='screen', - name='has_chp_hi', + model_name="screen", + name="has_chp_hi", field=models.BooleanField(blank=True, default=None, null=True), ), migrations.AlterField( - model_name='screen', - name='has_employer_hi', + model_name="screen", + name="has_employer_hi", field=models.BooleanField(blank=True, default=None, null=True), ), migrations.AlterField( - model_name='screen', - name='has_medicaid_hi', + model_name="screen", + name="has_medicaid_hi", field=models.BooleanField(blank=True, default=None, null=True), ), migrations.AlterField( - model_name='screen', - name='has_medicare_hi', + model_name="screen", + name="has_medicare_hi", field=models.BooleanField(blank=True, default=None, null=True), ), migrations.AlterField( - model_name='screen', - name='has_no_hi', + model_name="screen", + name="has_no_hi", field=models.BooleanField(blank=True, default=None, null=True), ), migrations.AlterField( - model_name='screen', - name='has_private_hi', + model_name="screen", + name="has_private_hi", field=models.BooleanField(blank=True, default=None, null=True), ), ] diff --git a/screener/migrations/0070_remove_programeligibilitysnapshot_legal_status_required.py b/screener/migrations/0070_remove_programeligibilitysnapshot_legal_status_required.py index 7735ee07..be878856 100644 --- a/screener/migrations/0070_remove_programeligibilitysnapshot_legal_status_required.py +++ b/screener/migrations/0070_remove_programeligibilitysnapshot_legal_status_required.py @@ -4,14 +4,13 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0069_alter_screen_has_chp_hi_alter_screen_has_employer_hi_and_more'), + ("screener", "0069_alter_screen_has_chp_hi_alter_screen_has_employer_hi_and_more"), ] operations = [ migrations.RemoveField( - model_name='programeligibilitysnapshot', - name='legal_status_required', + model_name="programeligibilitysnapshot", + name="legal_status_required", ), ] diff --git a/screener/migrations/0074_alter_screen_household_assets.py b/screener/migrations/0074_alter_screen_household_assets.py index 00a2cb39..534b039c 100644 --- a/screener/migrations/0074_alter_screen_household_assets.py +++ b/screener/migrations/0074_alter_screen_household_assets.py @@ -12,8 +12,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name="screen", name="household_assets", - field=models.DecimalField( - blank=True, decimal_places=2, default=0, max_digits=10, null=True - ), + field=models.DecimalField(blank=True, decimal_places=2, default=0, max_digits=10, null=True), ), ] diff --git a/screener/migrations/0075_alter_screen_household_assets.py b/screener/migrations/0075_alter_screen_household_assets.py index 045f3d6e..51896937 100644 --- a/screener/migrations/0075_alter_screen_household_assets.py +++ b/screener/migrations/0075_alter_screen_household_assets.py @@ -12,8 +12,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name="screen", name="household_assets", - field=models.DecimalField( - blank=True, decimal_places=2, default=None, max_digits=10, null=True - ), + field=models.DecimalField(blank=True, decimal_places=2, default=None, max_digits=10, null=True), ), ] diff --git a/screener/models.py b/screener/models.py index 93420b75..0f25cd14 100644 --- a/screener/models.py +++ b/screener/models.py @@ -30,10 +30,10 @@ class Screen(models.Model): is_test = models.BooleanField(default=False, blank=True) is_test_data = models.BooleanField(blank=True, null=True) is_verified = models.BooleanField(default=False, blank=True) - user = models.ForeignKey(User, related_name='screens', on_delete=models.SET_NULL, blank=True, null=True) + user = models.ForeignKey(User, related_name="screens", on_delete=models.SET_NULL, blank=True, null=True) external_id = models.CharField(max_length=120, blank=True, null=True) request_language_code = models.CharField(max_length=12, blank=True, null=True) - has_benefits = models.CharField(max_length=32, default='preferNotToAnswer', blank=True, null=True) + has_benefits = models.CharField(max_length=32, default="preferNotToAnswer", blank=True, null=True) has_tanf = models.BooleanField(default=False, blank=True, null=True) has_wic = models.BooleanField(default=False, blank=True, null=True) has_snap = models.BooleanField(default=False, blank=True, null=True) @@ -115,15 +115,13 @@ def has_expense(self, expense_types): return True return False - def num_children(self, age_min=0, age_max=18, include_pregnant=False, child_relationship=['all']): + def num_children(self, age_min=0, age_max=18, include_pregnant=False, child_relationship=["all"]): children = 0 household_members = self.household_members.all() for household_member in household_members: - has_child_relationship = household_member.relationship in child_relationship or 'all' in child_relationship - if household_member.age >= age_min and \ - household_member.age <= age_max and \ - has_child_relationship: + has_child_relationship = household_member.relationship in child_relationship or "all" in child_relationship + if household_member.age >= age_min and household_member.age <= age_max and has_child_relationship: children += 1 if household_member.pregnant and include_pregnant: children += 1 @@ -140,15 +138,15 @@ def num_adults(self, age_max=19): def num_guardians(self): parents = 0 - child_relationship = ['child', 'fosterChild'] - guardian_relationship = ['parent', 'fosterParent'] + child_relationship = ["child", "fosterChild"] + guardian_relationship = ["parent", "fosterParent"] hoh_child_exists = False household_members = self.household_members.all() for household_member in household_members: if household_member.relationship in child_relationship: hoh_child_exists = True - elif household_member.relationship == 'headOfHousehold': + elif household_member.relationship == "headOfHousehold": if household_member.pregnant: hoh_child_exists = True elif household_member.pregnant: @@ -157,9 +155,9 @@ def num_guardians(self): parents += 1 for household_member in household_members: - if hoh_child_exists and household_member.relationship == 'spouse': + if hoh_child_exists and household_member.relationship == "spouse": parents += 1 - elif hoh_child_exists and household_member.relationship == 'headOfHousehold': + elif hoh_child_exists and household_member.relationship == "headOfHousehold": parents += 1 return parents @@ -168,7 +166,7 @@ def is_joint(self): is_joint = False household_members = self.household_members.all() for household_member in household_members: - if household_member.relationship == 'spouse': + if household_member.relationship == "spouse": is_joint = True return is_joint @@ -186,35 +184,38 @@ def relationship_map(self): all_members = self.household_members.values() for member in all_members: - if member['id'] in relationship_map and relationship_map[member['id']] is not None: + if member["id"] in relationship_map and relationship_map[member["id"]] is not None: continue - relationship = member['relationship'] + relationship = member["relationship"] probable_spouse = None - if relationship == 'headOfHousehold': + if relationship == "headOfHousehold": for other_member in all_members: - if other_member['relationship'] in ('spouse', 'domesticPartner') and\ - other_member['id'] not in relationship_map: - probable_spouse = other_member['id'] + if ( + other_member["relationship"] in ("spouse", "domesticPartner") + and other_member["id"] not in relationship_map + ): + probable_spouse = other_member["id"] break - elif relationship in ('spouse', 'domesticPartner'): + elif relationship in ("spouse", "domesticPartner"): for other_member in all_members: - if other_member['relationship'] == 'headOfHousehold' and\ - other_member['id'] not in relationship_map: - probable_spouse = other_member['id'] + if other_member["relationship"] == "headOfHousehold" and other_member["id"] not in relationship_map: + probable_spouse = other_member["id"] break - elif relationship in ('parent', 'fosterParent', 'stepParent', 'grandParent'): + elif relationship in ("parent", "fosterParent", "stepParent", "grandParent"): for other_member in all_members: - if other_member['relationship'] == relationship and\ - other_member['id'] != member['id'] and\ - other_member['id'] not in relationship_map: - probable_spouse = other_member['id'] + if ( + other_member["relationship"] == relationship + and other_member["id"] != member["id"] + and other_member["id"] not in relationship_map + ): + probable_spouse = other_member["id"] break - relationship_map[member['id']] = probable_spouse + relationship_map[member["id"]] = probable_spouse if probable_spouse is not None: - relationship_map[probable_spouse] = member['id'] + relationship_map[probable_spouse] = member["id"] return relationship_map @@ -227,40 +228,40 @@ def has_insurance_types(self, types, strict=True): def has_benefit(self, name_abbreviated): name_map = { - 'tanf': self.has_tanf, - 'wic': self.has_wic, - 'snap': self.has_snap, - 'lifeline': self.has_lifeline, - 'acp': self.has_acp, - 'eitc': self.has_eitc, - 'coeitc': self.has_coeitc, - 'nslp': self.has_nslp, - 'ctc': self.has_ctc, - 'rtdlive': self.has_rtdlive, - 'cccap': self.has_cccap, - 'mydenver': self.has_mydenver, - 'ccb': self.has_ccb, - 'ssi': self.has_ssi or self.calc_gross_income('yearly', ('sSI',)) > 0, - 'andcs': self.has_andcs, - 'chs': self.has_chs, - 'cpcr': self.has_cpcr, - 'cdhcs': self.has_cdhcs, - 'dpp': self.has_dpp, - 'ede': self.has_ede, - 'erc': self.has_erc, - 'leap': self.has_leap, - 'oap': self.has_oap, - 'coctc': self.has_coctc, - 'upk': self.has_upk, - 'ssdi': self.has_ssdi or self.calc_gross_income('yearly', ('sSDisability',)) > 0, - 'pell_grant': self.has_pell_grant, - 'rag': self.has_rag, - 'cowap': self.has_cowap, - 'ubp': self.has_ubp, - 'medicaid': self.has_medicaid or self.has_medicaid_hi, - 'medicare': self.has_medicare_hi, - 'chp': self.has_chp or self.has_chp_hi, - 'va': self.has_va, + "tanf": self.has_tanf, + "wic": self.has_wic, + "snap": self.has_snap, + "lifeline": self.has_lifeline, + "acp": self.has_acp, + "eitc": self.has_eitc, + "coeitc": self.has_coeitc, + "nslp": self.has_nslp, + "ctc": self.has_ctc, + "rtdlive": self.has_rtdlive, + "cccap": self.has_cccap, + "mydenver": self.has_mydenver, + "ccb": self.has_ccb, + "ssi": self.has_ssi or self.calc_gross_income("yearly", ("sSI",)) > 0, + "andcs": self.has_andcs, + "chs": self.has_chs, + "cpcr": self.has_cpcr, + "cdhcs": self.has_cdhcs, + "dpp": self.has_dpp, + "ede": self.has_ede, + "erc": self.has_erc, + "leap": self.has_leap, + "oap": self.has_oap, + "coctc": self.has_coctc, + "upk": self.has_upk, + "ssdi": self.has_ssdi or self.calc_gross_income("yearly", ("sSDisability",)) > 0, + "pell_grant": self.has_pell_grant, + "rag": self.has_rag, + "cowap": self.has_cowap, + "ubp": self.has_ubp, + "medicaid": self.has_medicaid or self.has_medicaid_hi, + "medicare": self.has_medicare_hi, + "chp": self.has_chp or self.has_chp_hi, + "va": self.has_va, } has_insurance = self.has_insurance_types((name_abbreviated,), strict=False) @@ -273,19 +274,21 @@ def has_benefit(self, name_abbreviated): return has_insurance or has_benefit def set_screen_is_test(self): - referral_source_tests = ['testorprospect', 'test'] + referral_source_tests = ["testorprospect", "test"] - self.is_test_data = self.is_test or \ - (self.referral_source is not None and self.referral_source.lower() in referral_source_tests) or \ - (self.referrer_code is not None and self.referrer_code.lower() in referral_source_tests) + self.is_test_data = ( + self.is_test + or (self.referral_source is not None and self.referral_source.lower() in referral_source_tests) + or (self.referrer_code is not None and self.referrer_code.lower() in referral_source_tests) + ) self.save() def get_head(self): for member in self.household_members.all(): - if member.relationship == 'headOfHousehold': + if member.relationship == "headOfHousehold": return member - raise Exception('No head of household') + raise Exception("No head of household") def get_language_code(self): language_code = settings.LANGUAGE_CODE @@ -296,7 +299,7 @@ def get_language_code(self): return language_code def missing_fields(self): - screen_fields = ('zipcode', 'county', 'household_size', 'household_assets') + screen_fields = ("zipcode", "county", "household_size", "household_assets") missing_fields = Dependencies() @@ -317,7 +320,7 @@ def missing_fields(self): class Message(models.Model): sent = models.DateTimeField(auto_now=True) type = models.CharField(max_length=30) - screen = models.ForeignKey(Screen, related_name='messages', on_delete=models.CASCADE) + screen = models.ForeignKey(Screen, related_name="messages", on_delete=models.CASCADE) content = models.CharField(max_length=320, blank=True, null=True) uid = models.IntegerField(blank=True, null=True) @@ -325,7 +328,7 @@ class Message(models.Model): # Table of fields specific to individual household members. Parent model is the # Screen class HouseholdMember(models.Model): - screen = models.ForeignKey(Screen, related_name='household_members', on_delete=models.CASCADE) + screen = models.ForeignKey(Screen, related_name="household_members", on_delete=models.CASCADE) relationship = models.CharField(max_length=30, blank=True, null=True) age = models.IntegerField(blank=True, null=True) student = models.BooleanField(blank=True, null=True) @@ -381,13 +384,13 @@ def calc_net_income(self, frequency, income_types, expense_types): return float(net_income) def is_married(self): - if self.relationship in ('spouse', 'domesticPartner'): - head_of_house = HouseholdMember.objects.all().filter(screen=self.screen, relationship='headOfHousehold')[0] + if self.relationship in ("spouse", "domesticPartner"): + head_of_house = HouseholdMember.objects.all().filter(screen=self.screen, relationship="headOfHousehold")[0] return {"is_married": True, "married_to": head_of_house} - if self.relationship == 'headOfHousehold': + if self.relationship == "headOfHousehold": all_household_members = HouseholdMember.objects.all().filter(screen=self.screen) for member in all_household_members: - if member.relationship in ('spouse', 'domesticPartner'): + if member.relationship in ("spouse", "domesticPartner"): return {"is_married": True, "married_to": member} return {"is_married": False} @@ -395,7 +398,7 @@ def has_disability(self): return self.disabled or self.visually_impaired or self.long_term_disability def is_head(self): - return self.relationship == 'headOfHousehold' + return self.relationship == "headOfHousehold" def is_spouse(self): return self.screen.relationship_map()[self.screen.get_head().id] == self.id @@ -404,15 +407,8 @@ def is_dependent(self): is_tax_unit_spouse = self.is_spouse() is_tax_unit_head = self.is_head() is_tax_unit_dependent = ( - ( - self.age <= 18 - or (self.student and self.age <= 23) - or self.has_disability() - ) - and ( - self.calc_gross_income('yearly', ['all']) - <= self.screen.calc_gross_income('yearly', ['all']) / 2 - ) + (self.age <= 18 or (self.student and self.age <= 23) or self.has_disability()) + and (self.calc_gross_income("yearly", ["all"]) <= self.screen.calc_gross_income("yearly", ["all"]) / 2) and (not (is_tax_unit_head or is_tax_unit_spouse)) ) @@ -423,14 +419,14 @@ def is_in_household(self): def missing_fields(self): member_fields = ( - 'relationship', - 'age', - 'student', - 'pregnant', - 'visually_impaired', - 'disabled', - 'long_term_disability', - 'insurance' + "relationship", + "age", + "student", + "pregnant", + "visually_impaired", + "disabled", + "long_term_disability", + "insurance", ) missing_fields = Dependencies() @@ -447,8 +443,8 @@ def missing_fields(self): # HouseholdMember income streams class IncomeStream(models.Model): - screen = models.ForeignKey(Screen, related_name='income_streams', on_delete=models.CASCADE) - household_member = models.ForeignKey(HouseholdMember, related_name='income_streams', on_delete=models.CASCADE) + screen = models.ForeignKey(Screen, related_name="income_streams", on_delete=models.CASCADE) + household_member = models.ForeignKey(HouseholdMember, related_name="income_streams", on_delete=models.CASCADE) type = models.CharField(max_length=30, blank=True, null=True) amount = models.DecimalField(decimal_places=2, max_digits=10, blank=True, null=True) frequency = models.CharField(max_length=30, blank=True, null=True) @@ -490,20 +486,24 @@ def _hour_to_month(self): return self.amount * self.hours_worked * Decimal(4.35) def missing_fields(self): - income_fields = ('type', 'amount', 'frequency',) + income_fields = ( + "type", + "amount", + "frequency", + ) missing_fields = Dependencies() for field in income_fields: if getattr(self, field) is None: - missing_fields.add('income_' + field) + missing_fields.add("income_" + field) return missing_fields # HouseholdMember expenses class Expense(models.Model): - screen = models.ForeignKey(Screen, related_name='expenses', on_delete=models.CASCADE) - household_member = models.ForeignKey(HouseholdMember, related_name='expenses', on_delete=models.SET_NULL, null=True) + screen = models.ForeignKey(Screen, related_name="expenses", on_delete=models.CASCADE) + household_member = models.ForeignKey(HouseholdMember, related_name="expenses", on_delete=models.SET_NULL, null=True) type = models.CharField(max_length=30, blank=True, null=True) amount = models.DecimalField(decimal_places=2, max_digits=10, blank=True, null=True) frequency = models.CharField(max_length=30, blank=True, null=True) @@ -536,23 +536,20 @@ def yearly(self): return yearly def missing_fields(self): - expense_fields = ('type', 'amount') + expense_fields = ("type", "amount") missing_fields = Dependencies() for field in expense_fields: if getattr(self, field) is None: - missing_fields.add('expense_' + field) + missing_fields.add("expense_" + field) return missing_fields class Insurance(models.Model): household_member = models.OneToOneField( - HouseholdMember, - related_name='insurance', - null=False, - on_delete=models.CASCADE + HouseholdMember, related_name="insurance", null=False, on_delete=models.CASCADE ) dont_know = models.BooleanField(default=False) none = models.BooleanField(default=True) @@ -566,14 +563,14 @@ class Insurance(models.Model): va = models.BooleanField(default=False) def has_insurance_types(self, types, strict=True): - if 'none' in types: - types = (*types, 'dont_know') + if "none" in types: + types = (*types, "dont_know") insurance = self.insurance_map() for hi_type in types: if hi_type not in insurance: if strict: - raise KeyError(f'{hi_type} not in insurance types') + raise KeyError(f"{hi_type} not in insurance types") continue if insurance[hi_type]: @@ -583,16 +580,16 @@ def has_insurance_types(self, types, strict=True): def insurance_map(self): return { - 'dont_know': self.dont_know, - 'none': self.none, - 'employer': self.employer, - 'private': self.private, - 'chp': self.chp, - 'medicaid': self.medicaid, - 'medicare': self.medicare, - 'emergency_medicaid': self.emergency_medicaid, - 'family_planning': self.family_planning, - 'va': self.va, + "dont_know": self.dont_know, + "none": self.none, + "employer": self.employer, + "private": self.private, + "chp": self.chp, + "medicaid": self.medicaid, + "medicare": self.medicare, + "emergency_medicaid": self.emergency_medicaid, + "family_planning": self.family_planning, + "va": self.va, } @@ -600,7 +597,7 @@ def insurance_map(self): # for a completed screen. This table is currently used primarily for analytics # but will eventually drive new benefit update notifications class EligibilitySnapshot(models.Model): - screen = models.ForeignKey(Screen, related_name='eligibility_snapshots', on_delete=models.CASCADE) + screen = models.ForeignKey(Screen, related_name="eligibility_snapshots", on_delete=models.CASCADE) submission_date = models.DateTimeField(auto_now=True) is_batch = models.BooleanField(default=False) @@ -608,7 +605,9 @@ class EligibilitySnapshot(models.Model): # Eligibility results for each specific program per screen. These are # aggregated per screen using the EligibilitySnapshot id class ProgramEligibilitySnapshot(models.Model): - eligibility_snapshot = models.ForeignKey(EligibilitySnapshot, related_name='program_snapshots', on_delete=models.CASCADE) + eligibility_snapshot = models.ForeignKey( + EligibilitySnapshot, related_name="program_snapshots", on_delete=models.CASCADE + ) new = models.BooleanField(default=False) name = models.CharField(max_length=320) name_abbreviated = models.CharField(max_length=32) diff --git a/screener/one_time_scripts.py b/screener/one_time_scripts.py index 8ad8f55d..8cbbcf61 100644 --- a/screener/one_time_scripts.py +++ b/screener/one_time_scripts.py @@ -11,18 +11,119 @@ def generate_bwf_snapshots(): - bwf_ids = ['123', '121001', '119201', '119151', '118901', '119001', '118751', '118301', '118001', '117651', - '117501', '117451', '116601', '116551', '116351', '116151', '115851', '115801', '114751', '114501', - '114401', '114201', '114001', '113901', '113651', '113501', '113451', '111301', '108751', '108151', - '107101', '106551', '106201', '101901', '101701', '100451', '100201', '95051', '93801', '82751', - '82701', '77151', '71851', '71051', '70851', '70751', '70701', '70351', '70301', '70201', '68651', - '67401', '67001', '66651', '66601', '66301', '65851', '65101', '65001', '64951', '64801', '64751', - '62951', '59051', '59001', '58801', '58201', '57851', '57651', '57601', '56801', '56351', '56101', - '55901', '55801', '55501', '55451', '55051', '54951', '54801', '54751', '54551', '76501', '54151', - '53351', '53051', '52701', '52351', '52301', '52151', '51601', '51151', '51001', '49901', '49851', - '49551', '49251', '48901', '48701', '48551', '48501', '48401', '47751', '46951', '46751', '46151', - '46001', '41201', '40701', '40101'] - screens = Screen.objects.filter(external_id__in=bwf_ids).order_by('-submission_date') + bwf_ids = [ + "123", + "121001", + "119201", + "119151", + "118901", + "119001", + "118751", + "118301", + "118001", + "117651", + "117501", + "117451", + "116601", + "116551", + "116351", + "116151", + "115851", + "115801", + "114751", + "114501", + "114401", + "114201", + "114001", + "113901", + "113651", + "113501", + "113451", + "111301", + "108751", + "108151", + "107101", + "106551", + "106201", + "101901", + "101701", + "100451", + "100201", + "95051", + "93801", + "82751", + "82701", + "77151", + "71851", + "71051", + "70851", + "70751", + "70701", + "70351", + "70301", + "70201", + "68651", + "67401", + "67001", + "66651", + "66601", + "66301", + "65851", + "65101", + "65001", + "64951", + "64801", + "64751", + "62951", + "59051", + "59001", + "58801", + "58201", + "57851", + "57651", + "57601", + "56801", + "56351", + "56101", + "55901", + "55801", + "55501", + "55451", + "55051", + "54951", + "54801", + "54751", + "54551", + "76501", + "54151", + "53351", + "53051", + "52701", + "52351", + "52301", + "52151", + "51601", + "51151", + "51001", + "49901", + "49851", + "49551", + "49251", + "48901", + "48701", + "48551", + "48501", + "48401", + "47751", + "46951", + "46751", + "46151", + "46001", + "41201", + "40701", + "40101", + ] + screens = Screen.objects.filter(external_id__in=bwf_ids).order_by("-submission_date") total_screens = screens.count() print("Total BWF Screens found: " + str(total_screens)) @@ -42,13 +143,58 @@ def generate_bwf_snapshots(): eligibility_snapshot.save() eligibility_snapshot.generate_program_snapshots() count += 1 - print("Snapshot " + str(count) + "/" + str(total_screens_without_snapshots) + " generated for " + str(screen.external_id)) + print( + "Snapshot " + + str(count) + + "/" + + str(total_screens_without_snapshots) + + " generated for " + + str(screen.external_id) + ) def generate_nav_snapshots(): - nav_ids = ['3171', '3183', '3200', '3230', '3233', '3243', '3245', '3248', '3260', '3373', '3374', '3375', '3376', - '3377', '3300', '3301', '3310', '3312', '3313', '3316', '3343', '3363', '3364', '3365', '3368', '3397', - '3398', '3399', '2686', '2693', '2690', '2688', '2694', '2707', '2715', '2710', '2711', '2709', '2713'] + nav_ids = [ + "3171", + "3183", + "3200", + "3230", + "3233", + "3243", + "3245", + "3248", + "3260", + "3373", + "3374", + "3375", + "3376", + "3377", + "3300", + "3301", + "3310", + "3312", + "3313", + "3316", + "3343", + "3363", + "3364", + "3365", + "3368", + "3397", + "3398", + "3399", + "2686", + "2693", + "2690", + "2688", + "2694", + "2707", + "2715", + "2710", + "2711", + "2709", + "2713", + ] screens = Screen.objects.filter(id__in=nav_ids) total_screens = screens.count() @@ -62,7 +208,7 @@ def generate_nav_snapshots(): def generate_bia_sample_snapshot(): - nav_ids = ['4097', '4147', '4148', '4149'] + nav_ids = ["4097", "4147", "4148", "4149"] screens = Screen.objects.filter(id__in=nav_ids) total_screens = screens.count() @@ -76,40 +222,36 @@ def generate_bia_sample_snapshot(): def add_from_json(new_json_str): - ''' + """ Add json string from screen endpoint as parameter. Use triple quotes if in shell - ''' + """ new_json = json.loads(new_json_str) screen = Screen.objects.create( - **{k: v for k, v in new_json.items() if k not in ('household_members', 'id', 'uuid', 'user', 'expenses')}, - ) + **{k: v for k, v in new_json.items() if k not in ("household_members", "id", "uuid", "user", "expenses")}, + ) members = [] incomes = [] expenses = [] - for member in new_json['household_members']: - household_member = {k: v for k, v in member.items() if k not in ('income_streams', 'expenses', 'screen', 'id')} + for member in new_json["household_members"]: + household_member = {k: v for k, v in member.items() if k not in ("income_streams", "expenses", "screen", "id")} member_model = HouseholdMember(**household_member, screen=screen) members.append(member_model) - for income in member['income_streams']: - income = {k: v for k, v in income.items() if k not in ('household_member', 'screen', 'id')} - incomes.append(IncomeStream(**income, - screen=screen, - household_member=member_model)) - for expense in new_json['expenses']: - expense = {k: v for k, v in expense.items() if k not in ('household_member', 'screen', 'id')} - expenses.append(Expense(**expense, - screen=screen, - household_member=member_model)) + for income in member["income_streams"]: + income = {k: v for k, v in income.items() if k not in ("household_member", "screen", "id")} + incomes.append(IncomeStream(**income, screen=screen, household_member=member_model)) + for expense in new_json["expenses"]: + expense = {k: v for k, v in expense.items() if k not in ("household_member", "screen", "id")} + expenses.append(Expense(**expense, screen=screen, household_member=member_model)) HouseholdMember.objects.bulk_create(members) IncomeStream.objects.bulk_create(incomes) Expense.objects.bulk_create(expenses) - print('id:', screen.id) - print('uuid:', screen.uuid) + print("id:", screen.id) + print("uuid:", screen.uuid) def uniqueUUIDs(): @@ -118,12 +260,12 @@ def uniqueUUIDs(): currentUUIDs = [] for screen in screens: if screen.uuid in currentUUIDs: - print(screen.uuid, 'was replaced') + print(screen.uuid, "was replaced") screen.uuid = uuid.uuid4() screen.save() currentUUIDs.append(screen.uuid) - print('done') + print("done") def update_is_test_data(): @@ -132,7 +274,7 @@ def update_is_test_data(): for screen in screens: screen.set_screen_is_test() - print('done') + print("done") def fix_insurance(): @@ -148,4 +290,4 @@ def fix_insurance(): member.insurance = Insurance.objects.create(household_member=member) member.save() - print('done') + print("done") diff --git a/screener/serializers.py b/screener/serializers.py index e6186af5..fe0bbdda 100644 --- a/screener/serializers.py +++ b/screener/serializers.py @@ -8,7 +8,7 @@ class MessageSerializer(serializers.ModelSerializer): class Meta: model = Message - fields = '__all__' + fields = "__all__" class InsuranceSerializer(serializers.ModelSerializer): @@ -16,8 +16,8 @@ class InsuranceSerializer(serializers.ModelSerializer): class Meta: model = Insurance - fields = '__all__' - read_only_fields = ('household_member',) + fields = "__all__" + read_only_fields = ("household_member",) class IncomeStreamSerializer(serializers.ModelSerializer): @@ -25,8 +25,8 @@ class IncomeStreamSerializer(serializers.ModelSerializer): class Meta: model = IncomeStream - fields = '__all__' - read_only_fields = ('screen', 'household_member', 'id') + fields = "__all__" + read_only_fields = ("screen", "household_member", "id") class ExpenseSerializer(serializers.ModelSerializer): @@ -34,8 +34,8 @@ class ExpenseSerializer(serializers.ModelSerializer): class Meta: model = Expense - fields = '__all__' - read_only_fields = ('screen', 'household_member', 'id') + fields = "__all__" + read_only_fields = ("screen", "household_member", "id") class HouseholdMemberSerializer(serializers.ModelSerializer): @@ -45,26 +45,26 @@ class HouseholdMemberSerializer(serializers.ModelSerializer): class Meta: model = HouseholdMember fields = ( - 'id', - 'screen', - 'relationship', - 'age', - 'student', - 'student_full_time', - 'pregnant', - 'unemployed', - 'worked_in_last_18_mos', - 'visually_impaired', - 'disabled', - 'long_term_disability', - 'veteran', - 'medicaid', - 'disability_medicaid', - 'has_income', - 'income_streams', - 'insurance', + "id", + "screen", + "relationship", + "age", + "student", + "student_full_time", + "pregnant", + "unemployed", + "worked_in_last_18_mos", + "visually_impaired", + "disabled", + "long_term_disability", + "veteran", + "medicaid", + "disability_medicaid", + "has_income", + "income_streams", + "insurance", ) - read_only_fields = ('screen', 'id') + read_only_fields = ("screen", "id") class ScreenSerializer(serializers.ModelSerializer): @@ -75,98 +75,98 @@ class ScreenSerializer(serializers.ModelSerializer): class Meta: model = Screen fields = ( - 'id', - 'uuid', - 'completed', - 'is_test', - 'is_test_data', - 'start_date', - 'submission_date', - 'agree_to_tos', - 'is_13_or_older', - 'zipcode', - 'county', - 'referral_source', - 'referrer_code', - 'household_size', - 'household_assets', - 'housing_situation', - 'household_members', - 'last_email_request_date', - 'last_tax_filing_year', - 'expenses', - 'user', - 'external_id', - 'request_language_code', - 'has_benefits', - 'has_tanf', - 'has_wic', - 'has_snap', - 'has_lifeline', - 'has_acp', - 'has_eitc', - 'has_coeitc', - 'has_nslp', - 'has_ctc', - 'has_medicaid', - 'has_rtdlive', - 'has_cccap', - 'has_mydenver', - 'has_chp', - 'has_ccb', - 'has_ssi', - 'has_andcs', - 'has_chs', - 'has_cpcr', - 'has_cdhcs', - 'has_dpp', - 'has_ede', - 'has_erc', - 'has_leap', - 'has_oap', - 'has_coctc', - 'has_upk', - 'has_ssdi', - 'has_cowap', - 'has_ubp', - 'has_pell_grant', - 'has_rag', - 'has_employer_hi', - 'has_private_hi', - 'has_medicaid_hi', - 'has_medicare_hi', - 'has_chp_hi', - 'has_no_hi', - 'has_va', - 'needs_food', - 'needs_baby_supplies', - 'needs_housing_help', - 'needs_mental_health_help', - 'needs_child_dev_help', - 'needs_funeral_help', - 'needs_family_planning_help', - 'needs_job_resources', - 'needs_dental_care', - 'needs_legal_services' + "id", + "uuid", + "completed", + "is_test", + "is_test_data", + "start_date", + "submission_date", + "agree_to_tos", + "is_13_or_older", + "zipcode", + "county", + "referral_source", + "referrer_code", + "household_size", + "household_assets", + "housing_situation", + "household_members", + "last_email_request_date", + "last_tax_filing_year", + "expenses", + "user", + "external_id", + "request_language_code", + "has_benefits", + "has_tanf", + "has_wic", + "has_snap", + "has_lifeline", + "has_acp", + "has_eitc", + "has_coeitc", + "has_nslp", + "has_ctc", + "has_medicaid", + "has_rtdlive", + "has_cccap", + "has_mydenver", + "has_chp", + "has_ccb", + "has_ssi", + "has_andcs", + "has_chs", + "has_cpcr", + "has_cdhcs", + "has_dpp", + "has_ede", + "has_erc", + "has_leap", + "has_oap", + "has_coctc", + "has_upk", + "has_ssdi", + "has_cowap", + "has_ubp", + "has_pell_grant", + "has_rag", + "has_employer_hi", + "has_private_hi", + "has_medicaid_hi", + "has_medicare_hi", + "has_chp_hi", + "has_no_hi", + "has_va", + "needs_food", + "needs_baby_supplies", + "needs_housing_help", + "needs_mental_health_help", + "needs_child_dev_help", + "needs_funeral_help", + "needs_family_planning_help", + "needs_job_resources", + "needs_dental_care", + "needs_legal_services", ) read_only_fields = ( - 'id', - 'uuid', - 'submision_date', - 'last_email_request_date', - 'completed', - 'user', - 'is_test_data' + "id", + "uuid", + "submision_date", + "last_email_request_date", + "completed", + "user", + "is_test_data", ) def create(self, validated_data): - household_members = validated_data.pop('household_members') - expenses = validated_data.pop('expenses') + household_members = validated_data.pop("household_members") + expenses = validated_data.pop("expenses") screen = Screen.objects.create(**validated_data, completed=False) screen.set_screen_is_test() for member in household_members: - incomes = member.pop('income_streams') - insurance = member.pop('insurance') + incomes = member.pop("income_streams") + insurance = member.pop("insurance") household_member = HouseholdMember.objects.create(**member, screen=screen) for income in incomes: IncomeStream.objects.create(**income, screen=screen, household_member=household_member) @@ -176,14 +176,14 @@ def create(self, validated_data): return screen def update(self, instance, validated_data): - household_members = validated_data.pop('household_members') - expenses = validated_data.pop('expenses') + household_members = validated_data.pop("household_members") + expenses = validated_data.pop("expenses") Screen.objects.filter(pk=instance.id).update(**validated_data) HouseholdMember.objects.filter(screen=instance).delete() Expense.objects.filter(screen=instance).delete() for member in household_members: - incomes = member.pop('income_streams') - insurance = member.pop('insurance') + incomes = member.pop("income_streams") + insurance = member.pop("insurance") household_member = HouseholdMember.objects.create(**member, screen=instance) for income in incomes: IncomeStream.objects.create(**income, screen=instance, household_member=household_member) @@ -236,14 +236,14 @@ class EligibilitySerializer(serializers.Serializer): documents = DocumentSerializer(many=True) class Meta: - fields = '__all__' + fields = "__all__" class EligibilityTranslationSerializer(serializers.Serializer): translations = serializers.DictField() class Meta: - fields = ('translations',) + fields = ("translations",) class UrgentNeedSerializer(serializers.Serializer): diff --git a/screener/tests.py b/screener/tests.py index 013defb8..17958a59 100644 --- a/screener/tests.py +++ b/screener/tests.py @@ -8,7 +8,7 @@ def test_create_single_parent_two_children_household(self): self.assertTrue(isinstance(screen, Screen)) -def create_default_household_member(screen, relationship='headOfHousehold', age=25): +def create_default_household_member(screen, relationship="headOfHousehold", age=25): default = screen.household_members.create( relationship=relationship, age=age, @@ -23,7 +23,7 @@ def create_default_household_member(screen, relationship='headOfHousehold', age= medicaid=False, disability_medicaid=False, has_income=True, - has_expenses=True + has_expenses=True, ) return default @@ -34,16 +34,16 @@ def create_default_household_member(screen, relationship='headOfHousehold', age= # 1900 in monthly expenses between childcare and rent # no assets def create_single_parent_two_children_household(annual_income): - screen = Screen.objects.create(household_assets=0, household_size=3, - zipcode='80204', agree_to_tos=True, - housing_situation='renting') + screen = Screen.objects.create( + household_assets=0, household_size=3, zipcode="80204", agree_to_tos=True, housing_situation="renting" + ) parent = create_default_household_member(screen) - parent.expenses.create(type='rent', amount='1200', frequency='monthly', screen=screen) - parent.expenses.create(type='childCare', amount='700', frequency='monthly', screen=screen) - parent.income_streams.create(type='wages', amount=annual_income, frequency='yearly', screen=screen) + parent.expenses.create(type="rent", amount="1200", frequency="monthly", screen=screen) + parent.expenses.create(type="childCare", amount="700", frequency="monthly", screen=screen) + parent.income_streams.create(type="wages", amount=annual_income, frequency="yearly", screen=screen) - create_default_household_member(screen, relationship='child', age=4) - create_default_household_member(screen, relationship='child', age=6) + create_default_household_member(screen, relationship="child", age=4) + create_default_household_member(screen, relationship="child", age=6) return screen diff --git a/screener/urls.py b/screener/urls.py index a91e6c6c..04edf7c5 100644 --- a/screener/urls.py +++ b/screener/urls.py @@ -3,13 +3,12 @@ from . import views router = routers.DefaultRouter() -router.register(r'screens', views.ScreenViewSet) -router.register(r'messages', views.MessageViewSet) +router.register(r"screens", views.ScreenViewSet) +router.register(r"messages", views.MessageViewSet) urlpatterns = [ - path('', views.index, name='index'), - path('', include(router.urls)), - path('api-auth/', include('rest_framework.urls', namespace='rest_framework')), - path('eligibility/', views.EligibilityTranslationView.as_view(), - name='translated screen eligibility endpoint') + path("", views.index, name="index"), + path("", include(router.urls)), + path("api-auth/", include("rest_framework.urls", namespace="rest_framework")), + path("eligibility/", views.EligibilityTranslationView.as_view(), name="translated screen eligibility endpoint"), ] diff --git a/screener/views.py b/screener/views.py index 1f4080c2..36718831 100644 --- a/screener/views.py +++ b/screener/views.py @@ -50,12 +50,12 @@ class ScreenViewSet( API endpoint that allows screens to be viewed or edited. """ - queryset = Screen.objects.all().order_by('-submission_date') + queryset = Screen.objects.all().order_by("-submission_date") serializer_class = ScreenSerializer permission_classes = [permissions.DjangoModelPermissions] - filterset_fields = ['agree_to_tos', 'is_test'] + filterset_fields = ["agree_to_tos", "is_test"] paginate_by = 10 - paginate_by_param = 'page_size' + paginate_by_param = "page_size" max_paginate_by = 100 def retrieve(self, request, pk=None): @@ -82,7 +82,7 @@ class HouseholdMemberViewSet(viewsets.ModelViewSet): queryset = HouseholdMember.objects.all() serializer_class = HouseholdMemberSerializer permission_classes = [permissions.DjangoModelPermissions] - filterset_fields = ['has_income'] + filterset_fields = ["has_income"] class IncomeStreamViewSet(viewsets.ModelViewSet): @@ -93,7 +93,7 @@ class IncomeStreamViewSet(viewsets.ModelViewSet): queryset = IncomeStream.objects.all() serializer_class = IncomeStreamSerializer permission_classes = [permissions.DjangoModelPermissions] - filterset_fields = ['screen'] + filterset_fields = ["screen"] class ExpenseViewSet(viewsets.ModelViewSet): @@ -104,11 +104,10 @@ class ExpenseViewSet(viewsets.ModelViewSet): queryset = Expense.objects.all() serializer_class = ExpenseSerializer permission_classes = [permissions.DjangoModelPermissions] - filterset_fields = ['screen'] + filterset_fields = ["screen"] class EligibilityView(views.APIView): - def get(self, request, id): data = eligibility_results(id) results = EligibilitySerializer(data, many=True).data @@ -116,7 +115,6 @@ def get(self, request, id): class EligibilityTranslationView(views.APIView): - @swagger_auto_schema(responses={200: ResultsSerializer()}) def get(self, request, id): screen = Screen.objects.get(uuid=id) @@ -146,19 +144,19 @@ class MessageViewSet(mixins.CreateModelMixin, viewsets.GenericViewSet): API endpoint that logs messages sent. """ - queryset = Message.objects.all().order_by('-sent') + queryset = Message.objects.all().order_by("-sent") serializer_class = MessageSerializer permission_classes = [permissions.DjangoModelPermissions] def create(self, request): body = json.loads(request.body.decode()) - screen = Screen.objects.get(uuid=body['screen']) + screen = Screen.objects.get(uuid=body["screen"]) message = MessageUser(screen, screen.get_language_code()) - if 'email' in body: - message.email(body['email'], send_tests=True) - if 'phone' in body: - message.text('+1' + body['phone'], send_tests=True) + if "email" in body: + message.email(body["email"], send_tests=True) + if "phone" in body: + message.text("+1" + body["phone"], send_tests=True) return Response({}, status=status.HTTP_201_CREATED) @@ -171,22 +169,16 @@ def eligibility_results(screen, batch=False): excluded_programs = [] if referrer is not None: - excluded_programs = referrer.remove_programs.values('id') + excluded_programs = referrer.remove_programs.values("id") all_programs = Program.objects.exclude(id__in=excluded_programs).prefetch_related( - 'legal_status_required', 'documents' + "legal_status_required", "documents" ) data = [] try: - previous_snapshot = EligibilitySnapshot.objects.filter( - is_batch=False, screen=screen - ).latest('submission_date') - previous_results = ( - None - if previous_snapshot is None - else previous_snapshot.program_snapshots.all() - ) + previous_snapshot = EligibilitySnapshot.objects.filter(is_batch=False, screen=screen).latest("submission_date") + previous_results = None if previous_snapshot is None else previous_snapshot.program_snapshots.all() except ObjectDoesNotExist: previous_snapshot = None snapshot = EligibilitySnapshot.objects.create(screen=screen, is_batch=batch) @@ -198,7 +190,7 @@ def eligibility_results(screen, batch=False): pe_programs = all_pe_programs def sort_first(program): - calc_first = ('tanf', 'ssi', 'medicaid', 'nslp', 'leap') + calc_first = ("tanf", "ssi", "medicaid", "nslp", "leap") if program.name_abbreviated in calc_first: return 0 @@ -225,23 +217,21 @@ def sort_first(program): eligibility = pe_eligibility[program.name_abbreviated] - all_navigators = program.navigator.all().prefetch_related('counties') + all_navigators = program.navigator.all().prefetch_related("counties") county_navigators = [] for nav in all_navigators: counties = nav.counties.all() - if len(counties) == 0 or (screen.county is not None and any( - screen.county in county.name for county in counties - )): + if len(counties) == 0 or ( + screen.county is not None and any(screen.county in county.name for county in counties) + ): county_navigators.append(nav) if referrer is None: navigators = county_navigators else: primary_navigators = referrer.primary_navigators.all() - referrer_navigators = [ - nav for nav in primary_navigators if nav in county_navigators - ] + referrer_navigators = [nav for nav in primary_navigators if nav in county_navigators] if len(referrer_navigators) == 0: navigators = county_navigators else: @@ -252,16 +242,14 @@ def sort_first(program): for previous_snapshot in previous_results: if ( previous_snapshot.name_abbreviated == program.name_abbreviated - and eligibility['eligible'] == previous_snapshot.eligible + and eligibility["eligible"] == previous_snapshot.eligible ): new = False else: new = False if not skip and program.active: - legal_status = [ - status.status for status in program.legal_status_required.all() - ] + legal_status = [status.status for status in program.legal_status_required.all()] ProgramEligibilitySnapshot.objects.create( eligibility_snapshot=snapshot, name=program.name.text, @@ -281,12 +269,8 @@ def sort_first(program): "name": default_message(program.name), "name_abbreviated": program.name_abbreviated, "estimated_value": eligibility["estimated_value"], - "estimated_delivery_time": default_message( - program.estimated_delivery_time - ), - "estimated_application_time": default_message( - program.estimated_application_time - ), + "estimated_delivery_time": default_message(program.estimated_delivery_time), + "estimated_application_time": default_message(program.estimated_application_time), "description_short": default_message(program.description_short), "short_name": program.name_abbreviated, "description": default_message(program.description), @@ -299,22 +283,18 @@ def sort_first(program): "eligible": eligibility["eligible"], "failed_tests": eligibility["failed"], "passed_tests": eligibility["passed"], - "navigators": [ - serialized_navigator(navigator) for navigator in navigators - ], + "navigators": [serialized_navigator(navigator) for navigator in navigators], "already_has": screen.has_benefit(program.name_abbreviated), "new": new, "low_confidence": program.low_confidence, - "documents": [ - default_message(d.text) for d in program.documents.all() - ], + "documents": [default_message(d.text) for d in program.documents.all()], } ) eligible_programs = [] for program in data: clean_program = program - clean_program['estimated_value'] = math.trunc(clean_program['estimated_value']) + clean_program["estimated_value"] = math.trunc(clean_program["estimated_value"]) eligible_programs.append(clean_program) return eligible_programs, missing_programs @@ -322,7 +302,7 @@ def sort_first(program): def default_message(translation): translation.set_current_language(settings.LANGUAGE_CODE) - return {'default_message': translation.text, 'label': translation.label} + return {"default_message": translation.text, "label": translation.label} def serialized_navigator(navigator): @@ -339,44 +319,32 @@ def serialized_navigator(navigator): def urgent_need_results(screen): possible_needs = { - 'food': screen.needs_food, - 'baby supplies': screen.needs_baby_supplies, - 'housing': screen.needs_housing_help, - 'mental health': screen.needs_mental_health_help, - 'child dev': screen.needs_child_dev_help, - 'funeral': screen.needs_funeral_help, - 'family planning': screen.needs_family_planning_help, - 'job resources': screen.needs_job_resources, - 'dental care': screen.needs_dental_care, - 'legal services': screen.needs_legal_services, + "food": screen.needs_food, + "baby supplies": screen.needs_baby_supplies, + "housing": screen.needs_housing_help, + "mental health": screen.needs_mental_health_help, + "child dev": screen.needs_child_dev_help, + "funeral": screen.needs_funeral_help, + "family planning": screen.needs_family_planning_help, + "job resources": screen.needs_job_resources, + "dental care": screen.needs_dental_care, + "legal services": screen.needs_legal_services, } missing_dependencies = screen.missing_fields() need_functions = { - 'denver': urgent_need_functions.LivesInDenver.calc( - screen, missing_dependencies - ), - 'meal': urgent_need_functions.MealInCounties.calc( - screen, missing_dependencies - ), - 'helpkitchen_zipcode': urgent_need_functions.HelpkitchenZipcode.calc( - screen, missing_dependencies - ), - 'child': urgent_need_functions.Child.calc(screen, missing_dependencies), - 'bia_food_delivery': urgent_need_functions.BiaFoodDelivery.calc( - screen, missing_dependencies - ), - 'trua': urgent_need_functions.Trua.calc(screen, missing_dependencies), - 'ffap': urgent_need_functions.ForeclosureFinAssistProgram.calc(screen, missing_dependencies), - 'eoc': urgent_need_functions.Eoc.calc(screen, missing_dependencies), - 'co_legal_services': urgent_need_functions.CoLegalServices.calc( - screen, missing_dependencies - ), - 'co_emergency_mortgage': urgent_need_functions.CoEmergencyMortgageAssistance.calc( - screen, missing_dependencies - ), - 'child_first': urgent_need_functions.ChildFirst.calc(screen, missing_dependencies), + "denver": urgent_need_functions.LivesInDenver.calc(screen, missing_dependencies), + "meal": urgent_need_functions.MealInCounties.calc(screen, missing_dependencies), + "helpkitchen_zipcode": urgent_need_functions.HelpkitchenZipcode.calc(screen, missing_dependencies), + "child": urgent_need_functions.Child.calc(screen, missing_dependencies), + "bia_food_delivery": urgent_need_functions.BiaFoodDelivery.calc(screen, missing_dependencies), + "trua": urgent_need_functions.Trua.calc(screen, missing_dependencies), + "ffap": urgent_need_functions.ForeclosureFinAssistProgram.calc(screen, missing_dependencies), + "eoc": urgent_need_functions.Eoc.calc(screen, missing_dependencies), + "co_legal_services": urgent_need_functions.CoLegalServices.calc(screen, missing_dependencies), + "co_emergency_mortgage": urgent_need_functions.CoEmergencyMortgageAssistance.calc(screen, missing_dependencies), + "child_first": urgent_need_functions.ChildFirst.calc(screen, missing_dependencies), } list_of_needs = [] @@ -384,9 +352,7 @@ def urgent_need_results(screen): if has_need: list_of_needs.append(need) - urgent_need_resources = UrgentNeed.objects.filter( - type_short__name__in=list_of_needs, active=True - ).distinct() + urgent_need_resources = UrgentNeed.objects.filter(type_short__name__in=list_of_needs, active=True).distinct() eligible_urgent_needs = [] for need in urgent_need_resources: diff --git a/screener/webhooks.py b/screener/webhooks.py index 624c99e1..c8cf12dd 100644 --- a/screener/webhooks.py +++ b/screener/webhooks.py @@ -4,7 +4,7 @@ import requests -class Hook(): +class Hook: def __init__(self, hook: Referrer): self.hook = hook self.functions = [func.name for func in hook.webhook_functions.all()] @@ -12,11 +12,11 @@ def __init__(self, hook: Referrer): def send(self, screen: Screen, results: dict): if screen.completed: return - request_data = {'external_id': screen.external_id} - if 'send_screen' in self.functions: + request_data = {"external_id": screen.external_id} + if "send_screen" in self.functions: key, value = self.screen_data(screen) request_data[key] = value - if 'send_results' in self.functions: + if "send_results" in self.functions: key, value = self.send_eligibility(results) request_data[key] = value @@ -28,10 +28,10 @@ def send(self, screen: Screen, results: dict): def screen_data(self, screen: Screen): screen_dict = ScreenSerializer(screen).data - return 'screen', screen_dict + return "screen", screen_dict def send_eligibility(self, results: dict): - return 'eligibility', results + return "eligibility", results def eligibility_hooks(): diff --git a/translations/admin.py b/translations/admin.py index e9bcd3a5..63f1c69c 100644 --- a/translations/admin.py +++ b/translations/admin.py @@ -4,7 +4,7 @@ class TranslationAdmin(TranslatableAdmin): - search_fields = ('label',) + search_fields = ("label",) admin.site.register(Translation, TranslatableAdmin) diff --git a/translations/apps.py b/translations/apps.py index cfd4a9e5..f21c6589 100644 --- a/translations/apps.py +++ b/translations/apps.py @@ -2,5 +2,5 @@ class TranslationsConfig(AppConfig): - default_auto_field = 'django.db.models.BigAutoField' - name = 'translations' + default_auto_field = "django.db.models.BigAutoField" + name = "translations" diff --git a/translations/bulk_import_translations.py b/translations/bulk_import_translations.py index 65b16bc1..95de7137 100644 --- a/translations/bulk_import_translations.py +++ b/translations/bulk_import_translations.py @@ -9,8 +9,8 @@ @transaction.atomic def bulk_add(translations): - if config('ALLOW_TRANSLATION_IMPORT', 'False') != 'True': - raise Exception('Translation import not allowed') + if config("ALLOW_TRANSLATION_IMPORT", "False") != "True": + raise Exception("Translation import not allowed") protected_translation_ids = [] Translation.objects.select_for_update().all() @@ -28,19 +28,16 @@ def bulk_add(translations): Translation.objects.exclude(id__in=protected_translation_ids).delete() translations_data = list(translations.items()) - for i in trange(len(translations_data), desc='Translations'): + for i in trange(len(translations_data), desc="Translations"): label, details = translations_data[i] translation = Translation.objects.add_translation( - label, - details['langs'][settings.LANGUAGE_CODE][0], - active=details['active'], - no_auto=details['no_auto'] + label, details["langs"][settings.LANGUAGE_CODE][0], active=details["active"], no_auto=details["no_auto"] ) - del details['langs'][settings.LANGUAGE_CODE] + del details["langs"][settings.LANGUAGE_CODE] - if details['reference'] is not False: - ref = details['reference'] - if ref[0] == 'programs_program': + if details["reference"] is not False: + ref = details["reference"] + if ref[0] == "programs_program": try: obj = Program.objects.get(external_name=ref[1]) obj.active = True @@ -48,14 +45,14 @@ def bulk_add(translations): obj = Program.objects.new_program(ref[1]) obj.external_name = ref[1] obj.save() - elif ref[0] == 'programs_navigator': + elif ref[0] == "programs_navigator": try: obj = Navigator.objects.get(external_name=ref[1]) except ObjectDoesNotExist: obj = Navigator.objects.new_navigator(ref[1], None) obj.external_name = ref[1] obj.save() - elif ref[0] == 'programs_urgentneed': + elif ref[0] == "programs_urgentneed": try: obj = UrgentNeed.objects.get(external_name=ref[1]) obj.active = True @@ -63,7 +60,7 @@ def bulk_add(translations): obj = UrgentNeed.objects.new_urgent_need(ref[1], None) obj.external_name = ref[1] obj.save() - elif ref[0] == 'programs_document': + elif ref[0] == "programs_document": try: obj = Document.objects.get(external_name=ref[1]) except ObjectDoesNotExist: @@ -71,13 +68,8 @@ def bulk_add(translations): getattr(translation, ref[2]).set([obj]) - for lang, message in details['langs'].items(): - Translation.objects.edit_translation_by_id( - translation.id, - lang, - message[0], - manual=message[1] - ) + for lang, message in details["langs"].items(): + Translation.objects.edit_translation_by_id(translation.id, lang, message[0], manual=message[1]) def translation_ids(model): diff --git a/translations/management/commands/bulk_export.py b/translations/management/commands/bulk_export.py index af39210e..fc852287 100644 --- a/translations/management/commands/bulk_export.py +++ b/translations/management/commands/bulk_export.py @@ -4,10 +4,10 @@ class Command(BaseCommand): - help = ''' + help = """ Get translation export - ''' + """ def handle(self, *args, **options) -> str: - self.stdout.reconfigure(encoding='utf-8') + self.stdout.reconfigure(encoding="utf-8") return json.dumps(Translation.objects.export_translations(), ensure_ascii=False) diff --git a/translations/management/commands/bulk_import.py b/translations/management/commands/bulk_import.py index b338e70c..66abce57 100644 --- a/translations/management/commands/bulk_import.py +++ b/translations/management/commands/bulk_import.py @@ -6,21 +6,24 @@ class Command(BaseCommand): - ''' + """ Run on heroku: `heroku run --no-tty -a [HEROKU APP NAME] manage.py bulk_import < [PATH TO FILE]` - ''' + """ - help = ''' + help = """ Get translation export - ''' + """ def add_arguments(self, parser): parser.add_argument( - 'data', nargs='?', type=argparse.FileType('r', encoding='utf-8'), default=stdin, + "data", + nargs="?", + type=argparse.FileType("r", encoding="utf-8"), + default=stdin, ) def handle(self, *args, **options): - data = json.load(options['data']) + data = json.load(options["data"]) bulk_add(data) diff --git a/translations/management/commands/bulk_translate.py b/translations/management/commands/bulk_translate.py index e5c23a63..0d4cca8d 100644 --- a/translations/management/commands/bulk_translate.py +++ b/translations/management/commands/bulk_translate.py @@ -5,24 +5,24 @@ class Command(BaseCommand): - help = ''' + help = """ Get translation export - ''' + """ def add_arguments(self, parser): - parser.add_argument('--limit', default=1, type=int) - parser.add_argument('--all', default=False, type=bool) - parser.add_argument('--lang', default=settings.LANGUAGE_CODE, type=str) + parser.add_argument("--limit", default=1, type=int) + parser.add_argument("--all", default=False, type=bool) + parser.add_argument("--lang", default=settings.LANGUAGE_CODE, type=str) def handle(self, *args, **options): - limit = 10_000 if options['all'] else min(10_000, options['limit']) + limit = 10_000 if options["all"] else min(10_000, options["limit"]) max_batch_size = 128 char_limit = 5_000 - lang = options['lang'] + lang = options["lang"] translate = Translate() - translations = Translation.objects.prefetch_related('translations').language(settings.LANGUAGE_CODE).all() + translations = Translation.objects.prefetch_related("translations").language(settings.LANGUAGE_CODE).all() total_count = 0 temp_chars = 0 diff --git a/translations/migrations/0001_initial.py b/translations/migrations/0001_initial.py index f6231ca7..1d53c90f 100644 --- a/translations/migrations/0001_initial.py +++ b/translations/migrations/0001_initial.py @@ -7,40 +7,47 @@ class Migration(migrations.Migration): - initial = True - dependencies = [ - ] + dependencies = [] operations = [ migrations.CreateModel( - name='Translation', + name="Translation", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('label', models.CharField(max_length=128, unique=True)), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("label", models.CharField(max_length=128, unique=True)), ], options={ - 'abstract': False, + "abstract": False, }, bases=(parler.models.TranslatableModelMixin, models.Model), ), migrations.CreateModel( - name='TranslationTranslation', + name="TranslationTranslation", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('language_code', models.CharField(db_index=True, max_length=15, verbose_name='Language')), - ('text', models.TextField(blank=True, null=True)), - ('edited', models.BooleanField(default=False)), - ('master', parler.fields.TranslationsForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='translations.translation')), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("language_code", models.CharField(db_index=True, max_length=15, verbose_name="Language")), + ("text", models.TextField(blank=True, null=True)), + ("edited", models.BooleanField(default=False)), + ( + "master", + parler.fields.TranslationsForeignKey( + editable=False, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="translations", + to="translations.translation", + ), + ), ], options={ - 'verbose_name': 'translation Translation', - 'db_table': 'translations_translation_translation', - 'db_tablespace': '', - 'managed': True, - 'default_permissions': (), - 'unique_together': {('language_code', 'master')}, + "verbose_name": "translation Translation", + "db_table": "translations_translation_translation", + "db_tablespace": "", + "managed": True, + "default_permissions": (), + "unique_together": {("language_code", "master")}, }, bases=(parler.models.TranslatedFieldsModelMixin, models.Model), ), diff --git a/translations/migrations/0002_translation_active.py b/translations/migrations/0002_translation_active.py index af090adf..bcb759be 100644 --- a/translations/migrations/0002_translation_active.py +++ b/translations/migrations/0002_translation_active.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('translations', '0001_initial'), + ("translations", "0001_initial"), ] operations = [ migrations.AddField( - model_name='translation', - name='active', + model_name="translation", + name="active", field=models.BooleanField(default=True), ), ] diff --git a/translations/migrations/0003_alter_translation_managers.py b/translations/migrations/0003_alter_translation_managers.py index 264b0024..e3ae1db4 100644 --- a/translations/migrations/0003_alter_translation_managers.py +++ b/translations/migrations/0003_alter_translation_managers.py @@ -5,16 +5,15 @@ class Migration(migrations.Migration): - dependencies = [ - ('translations', '0002_translation_active'), + ("translations", "0002_translation_active"), ] operations = [ migrations.AlterModelManagers( - name='translation', + name="translation", managers=[ - ('objects', translations.models.TranslationManager()), + ("objects", translations.models.TranslationManager()), ], ), ] diff --git a/translations/migrations/0004_translation_no_auto.py b/translations/migrations/0004_translation_no_auto.py index 7af1943b..7113a986 100644 --- a/translations/migrations/0004_translation_no_auto.py +++ b/translations/migrations/0004_translation_no_auto.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('translations', '0003_alter_translation_managers'), + ("translations", "0003_alter_translation_managers"), ] operations = [ migrations.AddField( - model_name='translation', - name='no_auto', + model_name="translation", + name="no_auto", field=models.BooleanField(default=False), ), ] diff --git a/translations/models.py b/translations/models.py index a94e3900..81bcc3c9 100644 --- a/translations/models.py +++ b/translations/models.py @@ -8,7 +8,7 @@ class TranslationManager(TranslatableManager): def add_translation(self, label, default_message, active=True, no_auto=False): default_lang = settings.LANGUAGE_CODE - parent = self.get_or_create(label=label, defaults={'active': active, 'no_auto': no_auto})[0] + parent = self.get_or_create(label=label, defaults={"active": active, "no_auto": no_auto})[0] if parent.active != active or parent.active != no_auto: parent.active = active parent.no_auto = no_auto @@ -21,7 +21,7 @@ def edit_translation(self, label, lang, translation, manual=True): parent = self.language(lang).get(label=label) lang_trans = parent.get_lang(lang) - is_edited = lang_trans is not None and lang_trans.edited is True and lang_trans.text != '' + is_edited = lang_trans is not None and lang_trans.edited is True and lang_trans.text != "" if manual is False and (is_edited or parent.no_auto): return parent @@ -31,10 +31,10 @@ def edit_translation(self, label, lang, translation, manual=True): return parent def edit_translation_by_id(self, id, lang, translation, manual=True): - parent = self.prefetch_related('translations').language(lang).get(pk=id) + parent = self.prefetch_related("translations").language(lang).get(pk=id) lang_trans = parent.get_lang(lang) - is_edited = lang_trans is not None and lang_trans.edited is True and lang_trans.text != '' + is_edited = lang_trans is not None and lang_trans.edited is True and lang_trans.text != "" if manual is False and (is_edited or parent.no_auto): return parent @@ -43,8 +43,8 @@ def edit_translation_by_id(self, id, lang, translation, manual=True): parent.save() return parent - def all_translations(self, langs=[lang['code'] for lang in settings.PARLER_LANGUAGES[None]]): - translations = self.prefetch_related('translations') + def all_translations(self, langs=[lang["code"] for lang in settings.PARLER_LANGUAGES[None]]): + translations = self.prefetch_related("translations") translations_dict = {} for lang in langs: lang_translations = {} @@ -57,7 +57,7 @@ def all_translations(self, langs=[lang['code'] for lang in settings.PARLER_LANGU def export_translations(self): all_langs = settings.PARLER_LANGUAGES[None] - translations = self.prefetch_related('translations') + translations = self.prefetch_related("translations") translations_export = {} for translation in translations: @@ -67,23 +67,22 @@ def export_translations(self): continue translations_export[translation.label] = { - 'active': translation.active, - 'no_auto': translation.no_auto, - 'langs': {}, - 'reference': reference, + "active": translation.active, + "no_auto": translation.no_auto, + "langs": {}, + "reference": reference, } for lang in all_langs: - translation.set_current_language(lang['code']) - translations_export[translation.label]['langs'][lang['code']] = (translation.text, translation.edited) + translation.set_current_language(lang["code"]) + translations_export[translation.label]["langs"][lang["code"]] = (translation.text, translation.edited) return translations_export class Translation(TranslatableModel): translations = TranslatedFields( - text=models.TextField(null=True, blank=True), - edited=models.BooleanField(default=False, null=False) + text=models.TextField(null=True, blank=True), edited=models.BooleanField(default=False, null=False) ) active = models.BooleanField(default=True, null=False) no_auto = models.BooleanField(default=False, null=False) @@ -99,7 +98,7 @@ def in_program(self): # https://stackoverflow.com/questions/54711671/django-how-to-determine-if-an-object-is-referenced-by-any-other-object has_relationship = False for reverse in (f for f in self._meta.get_fields() if f.auto_created and not f.concrete): - if reverse.related_name == 'translations': + if reverse.related_name == "translations": continue name = reverse.get_accessor_name() has_reverse_other = getattr(self, name).count() diff --git a/translations/urls.py b/translations/urls.py index 62e42591..4ef097cc 100644 --- a/translations/urls.py +++ b/translations/urls.py @@ -3,27 +3,27 @@ urlpatterns = [ - path('', views.TranslationView.as_view()), - path('admin', views.admin_view), - path('admin/filter', views.filter_view), - path('admin/create', views.create_translation_view), - path('admin/programs', views.programs_view), - path('admin/programs/filter', views.programs_filter_view), - path('admin/programs/create', views.create_program_view), - path('admin/programs/', views.program_view), - path('admin/navigators', views.navigators_view), - path('admin/navigators/filter', views.navigator_filter_view), - path('admin/navigators/create', views.create_navigator_view), - path('admin/navigators/', views.navigator_view), - path('admin/documents', views.documents_view), - path('admin/documents/filter', views.document_filter_view), - path('admin/documents/create', views.create_document_view), - path('admin/documents/', views.document_view), - path('admin/urgent_needs', views.urgent_needs_view), - path('admin/urgent_needs/filter', views.urgent_need_filter_view), - path('admin/urgent_needs/create', views.create_urgent_need_view), - path('admin/urgent_needs/', views.urgent_need_view), - path('admin/', views.translation_view), - path('admin//', views.edit_translation), - path('admin///auto', views.auto_translate), + path("", views.TranslationView.as_view()), + path("admin", views.admin_view), + path("admin/filter", views.filter_view), + path("admin/create", views.create_translation_view), + path("admin/programs", views.programs_view), + path("admin/programs/filter", views.programs_filter_view), + path("admin/programs/create", views.create_program_view), + path("admin/programs/", views.program_view), + path("admin/navigators", views.navigators_view), + path("admin/navigators/filter", views.navigator_filter_view), + path("admin/navigators/create", views.create_navigator_view), + path("admin/navigators/", views.navigator_view), + path("admin/documents", views.documents_view), + path("admin/documents/filter", views.document_filter_view), + path("admin/documents/create", views.create_document_view), + path("admin/documents/", views.document_view), + path("admin/urgent_needs", views.urgent_needs_view), + path("admin/urgent_needs/filter", views.urgent_need_filter_view), + path("admin/urgent_needs/create", views.create_urgent_need_view), + path("admin/urgent_needs/", views.urgent_need_view), + path("admin/", views.translation_view), + path("admin//", views.edit_translation), + path("admin///auto", views.auto_translate), ] diff --git a/translations/views.py b/translations/views.py index 049ba724..b3e0db6a 100644 --- a/translations/views.py +++ b/translations/views.py @@ -14,10 +14,9 @@ class TranslationView(views.APIView): - def get(self, request): - language = request.query_params.get('lang') - all_langs = [lang['code'] for lang in settings.PARLER_LANGUAGES[None]] + language = request.query_params.get("lang") + all_langs = [lang["code"] for lang in settings.PARLER_LANGUAGES[None]] if language in all_langs: translations = Translation.objects.all_translations([language]) @@ -29,27 +28,27 @@ def get(self, request): class NewTranslationForm(forms.Form): label = forms.CharField(max_length=128) - default_message = forms.CharField(widget=forms.Textarea(attrs={'name': 'text', 'rows': 3, 'cols': 50})) + default_message = forms.CharField(widget=forms.Textarea(attrs={"name": "text", "rows": 3, "cols": 50})) -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def admin_view(request): - if request.method == 'GET': + if request.method == "GET": translations = Translation.objects.all() context = { - 'translations': translations, + "translations": translations, } return render(request, "main.html", context) - elif request.method == 'POST': + elif request.method == "POST": form = NewTranslationForm(request.POST) if form.is_valid(): - text = form['default_message'].value() - translation = Translation.objects.add_translation(form['label'].value(), text) + text = form["default_message"].value() + translation = Translation.objects.add_translation(form["label"].value(), text) - auto_translations = Translate().bulk_translate(['__all__'], [text])[text] + auto_translations = Translate().bulk_translate(["__all__"], [text])[text] for [language, auto_text] in auto_translations.items(): Translation.objects.edit_translation_by_id(translation.id, language, auto_text, False) @@ -59,33 +58,28 @@ def admin_view(request): return response -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def create_translation_view(request): - context = { - 'form': NewTranslationForm(), - 'route': '/api/translations/admin' - } + context = {"form": NewTranslationForm(), "route": "/api/translations/admin"} return render(request, "util/create_form.html", context) -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def filter_view(request): - translations = Translation.objects \ - .filter(label__contains=request.GET.get('label', '')) \ - .translated(text__contains=request.GET.get('text', '')) + translations = Translation.objects.filter(label__contains=request.GET.get("label", "")).translated( + text__contains=request.GET.get("text", "") + ) - context = { - 'translations': translations - } + context = {"translations": translations} return render(request, "translations.html", context) class TranslationForm(forms.Form): - text = forms.CharField(widget=forms.Textarea(attrs={'name': 'text', 'rows': 3, 'cols': 50}), required=False) + text = forms.CharField(widget=forms.Textarea(attrs={"name": "text", "rows": 3, "cols": 50}), required=False) class LabelForm(forms.Form): @@ -94,89 +88,87 @@ class LabelForm(forms.Form): no_auto = forms.BooleanField(required=False) -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def translation_view(request, id=0): - if request.method == 'GET': - translation = Translation.objects.prefetch_related('translations').get(pk=id) - langs = [lang['code'] for lang in settings.PARLER_LANGUAGES[None]] + if request.method == "GET": + translation = Translation.objects.prefetch_related("translations").get(pk=id) + langs = [lang["code"] for lang in settings.PARLER_LANGUAGES[None]] - translations = {t.language_code: TranslationForm({'text': t.text}) for t in translation.translations.all()} + translations = {t.language_code: TranslationForm({"text": t.text}) for t in translation.translations.all()} for lang in langs: if lang not in translations: translations[lang] = TranslationForm() context = { - 'translation': translation, - 'langs': translations, - 'label_form': LabelForm({ - 'label': translation.label, - 'active': translation.active, - 'no_auto': translation.no_auto - }) + "translation": translation, + "langs": translations, + "label_form": LabelForm( + {"label": translation.label, "active": translation.active, "no_auto": translation.no_auto} + ), } return render(request, "edit/main.html", context) - elif request.method == 'POST': + elif request.method == "POST": form = LabelForm(request.POST) if form.is_valid(): translation = Translation.objects.get(pk=id) - translation.label = form['label'].value() - translation.active = form['active'].value() - translation.no_auto = form['no_auto'].value() + translation.label = form["label"].value() + translation.active = form["active"].value() + translation.no_auto = form["no_auto"].value() translation.save() context = { - 'form': LabelForm({ - 'label': translation.label, - 'active': translation.active, - 'no_auto': translation.no_auto - }) + "form": LabelForm( + {"label": translation.label, "active": translation.active, "no_auto": translation.no_auto} + ) } return render(request, "edit/form.html", context) - elif request.method == 'DELETE': + elif request.method == "DELETE": try: Translation.objects.get(pk=id).delete() except ProtectedError: return render( request, - 'error.html', - {"error_message": "Please delete the program that this translation is attached to if you want to delete this translation"} + "error.html", + { + "error_message": "Please delete the program that this translation is attached to if you want to delete this translation" + }, ) response = HttpResponse() response.headers["HX-Redirect"] = "/api/translations/admin" return response -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required -def edit_translation(request, id=0, lang='en-us'): - if request.method == 'POST': +def edit_translation(request, id=0, lang="en-us"): + if request.method == "POST": form = TranslationForm(request.POST) if form.is_valid(): - text = form['text'].value() + text = form["text"].value() translation = Translation.objects.edit_translation_by_id(id, lang, text) if lang == settings.LANGUAGE_CODE: - translations = Translate().bulk_translate(['__all__'], [text])[text] + translations = Translate().bulk_translate(["__all__"], [text])[text] for [language, translation] in translations.items(): Translation.objects.edit_translation_by_id(id, language, translation, False) parent = Translation.objects.get(pk=id) - forms = {t.language_code: TranslationForm({'text': t.text}) for t in parent.translations.all()} + forms = {t.language_code: TranslationForm({"text": t.text}) for t in parent.translations.all()} context = { - 'translation': parent, - 'langs': forms, + "translation": parent, + "langs": forms, } return render(request, "edit/langs.html", context) -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required -def auto_translate(request, id=0, lang='en-us'): - if request.method == 'POST': +def auto_translate(request, id=0, lang="en-us"): + if request.method == "POST": translation = Translation.objects.language(settings.LANGUAGE_CODE).get(pk=id) auto = Translate().translate(lang, translation.text) @@ -187,9 +179,9 @@ def auto_translate(request, id=0, lang='en-us'): new_translation.save() context = { - 'form': TranslationForm({'text': new_translation.text}), - 'lang': lang, - 'translation': translation, + "form": TranslationForm({"text": new_translation.text}), + "lang": lang, + "translation": translation, } return render(request, "edit/lang_form.html", context) @@ -198,64 +190,55 @@ class NewProgramForm(forms.Form): name_abbreviated = forms.CharField(max_length=120) -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def programs_view(request): - if request.method == 'GET': + if request.method == "GET": programs = Program.objects.all() - context = { - 'programs': programs - } + context = {"programs": programs} - return render(request, 'programs/main.html', context) - elif request.method == 'POST': + return render(request, "programs/main.html", context) + elif request.method == "POST": form = NewProgramForm(request.POST) if form.is_valid(): program = Program.objects.new_program( - form['name_abbreviated'].value(), + form["name_abbreviated"].value(), ) response = HttpResponse() response.headers["HX-Redirect"] = f"/api/translations/admin/programs/{program.id}" return response -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def create_program_view(request): - if request.method == 'GET': - context = { - 'form': NewProgramForm(), - 'route': '/api/translations/admin/programs' - } + if request.method == "GET": + context = {"form": NewProgramForm(), "route": "/api/translations/admin/programs"} - return render(request, 'util/create_form.html', context) + return render(request, "util/create_form.html", context) -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def program_view(request, id=0): - if request.method == 'GET': + if request.method == "GET": program = Program.objects.get(pk=id) - context = { - 'program': program - } + context = {"program": program} - return render(request, 'programs/program.html', context) + return render(request, "programs/program.html", context) -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def programs_filter_view(request): - if request.method == 'GET': + if request.method == "GET": programs = Program.objects.all() - query = request.GET.get('name', '') + query = request.GET.get("name", "") programs = filter(lambda p: query in p.name.text, programs) - context = { - 'programs': programs - } + context = {"programs": programs} - return render(request, 'programs/list.html', context) + return render(request, "programs/list.html", context) class NewNavigatorForm(forms.Form): @@ -263,66 +246,57 @@ class NewNavigatorForm(forms.Form): phone_number = PhoneNumberField(required=False) -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def navigators_view(request): - if request.method == 'GET': + if request.method == "GET": navigators = Navigator.objects.all() - context = { - 'navigators': navigators - } + context = {"navigators": navigators} - return render(request, 'navigators/main.html', context) - if request.method == 'POST': + return render(request, "navigators/main.html", context) + if request.method == "POST": form = NewNavigatorForm(request.POST) if form.is_valid(): navigator = Navigator.objects.new_navigator( - form['label'].value(), - form['phone_number'].value(), + form["label"].value(), + form["phone_number"].value(), ) response = HttpResponse() response.headers["HX-Redirect"] = f"/api/translations/admin/navigators/{navigator.id}" return response -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def create_navigator_view(request): - if request.method == 'GET': - context = { - 'form': NewNavigatorForm(), - 'route': '/api/translations/admin/navigators' - } + if request.method == "GET": + context = {"form": NewNavigatorForm(), "route": "/api/translations/admin/navigators"} - return render(request, 'util/create_form.html', context) + return render(request, "util/create_form.html", context) -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def navigator_view(request, id=0): - if request.method == 'GET': + if request.method == "GET": navigator = Navigator.objects.get(pk=id) - context = { - 'navigator': navigator - } + context = {"navigator": navigator} - return render(request, 'navigators/navigator.html', context) + return render(request, "navigators/navigator.html", context) -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def navigator_filter_view(request): - if request.method == 'GET': + if request.method == "GET": navigators = Navigator.objects.all() - query = request.GET.get('name', '') + query = request.GET.get("name", "") navigators = filter(lambda p: query in p.name.text, navigators) - context = { - 'navigators': navigators - } + context = {"navigators": navigators} - return render(request, 'navigators/list.html', context) + return render(request, "navigators/list.html", context) class NewUrgentNeedForm(forms.Form): @@ -330,125 +304,107 @@ class NewUrgentNeedForm(forms.Form): phone_number = PhoneNumberField(required=False) -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def urgent_needs_view(request): - if request.method == 'GET': + if request.method == "GET": urgent_needs = UrgentNeed.objects.all() - context = { - 'urgent_needs': urgent_needs - } + context = {"urgent_needs": urgent_needs} - return render(request, 'urgent_needs/main.html', context) - if request.method == 'POST': + return render(request, "urgent_needs/main.html", context) + if request.method == "POST": form = NewUrgentNeedForm(request.POST) if form.is_valid(): urgent_need = UrgentNeed.objects.new_urgent_need( - form['label'].value(), - form['phone_number'].value(), + form["label"].value(), + form["phone_number"].value(), ) response = HttpResponse() response.headers["HX-Redirect"] = f"/api/translations/admin/urgent_needs/{urgent_need.id}" return response -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def create_urgent_need_view(request): - if request.method == 'GET': - context = { - 'form': NewUrgentNeedForm(), - 'route': '/api/translations/admin/urgent_needs' - } + if request.method == "GET": + context = {"form": NewUrgentNeedForm(), "route": "/api/translations/admin/urgent_needs"} - return render(request, 'util/create_form.html', context) + return render(request, "util/create_form.html", context) -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def urgent_need_view(request, id=0): - if request.method == 'GET': + if request.method == "GET": urgent_need = UrgentNeed.objects.get(pk=id) - context = { - 'urgent_need': urgent_need - } + context = {"urgent_need": urgent_need} - return render(request, 'urgent_needs/urgent_need.html', context) + return render(request, "urgent_needs/urgent_need.html", context) -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def urgent_need_filter_view(request): - if request.method == 'GET': + if request.method == "GET": urgent_needs = UrgentNeed.objects.all() - query = request.GET.get('name', '') + query = request.GET.get("name", "") urgent_needs = filter(lambda p: query in p.name.text, urgent_needs) - context = { - 'urgent_needs': urgent_needs - } + context = {"urgent_needs": urgent_needs} - return render(request, 'urgent_needs/list.html', context) + return render(request, "urgent_needs/list.html", context) class NewDocumentForm(forms.Form): external_name = forms.CharField(max_length=120) -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def documents_view(request): - if request.method == 'GET': + if request.method == "GET": documents = Document.objects.all() - context = { - 'documents': documents - } + context = {"documents": documents} - return render(request, 'documents/main.html', context) - if request.method == 'POST': + return render(request, "documents/main.html", context) + if request.method == "POST": form = NewDocumentForm(request.POST) if form.is_valid(): - document = Document.objects.new_document(form['external_name'].value()) + document = Document.objects.new_document(form["external_name"].value()) response = HttpResponse() response.headers["HX-Redirect"] = f"/api/translations/admin/documents/{document.id}" return response -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def create_document_view(request): - if request.method == 'GET': - context = { - 'form': NewDocumentForm(), - 'route': '/api/translations/admin/documents' - } + if request.method == "GET": + context = {"form": NewDocumentForm(), "route": "/api/translations/admin/documents"} - return render(request, 'util/create_form.html', context) + return render(request, "util/create_form.html", context) -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def document_view(request, id=0): - if request.method == 'GET': + if request.method == "GET": document = Document.objects.get(pk=id) - context = { - 'document': document - } + context = {"document": document} - return render(request, 'documents/document.html', context) + return render(request, "documents/document.html", context) -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def document_filter_view(request): - if request.method == 'GET': - query = request.GET.get('name', '') + if request.method == "GET": + query = request.GET.get("name", "") documents = Document.objects.filter(external_name__contains=query) - context = { - 'documents': documents - } + context = {"documents": documents} - return render(request, 'documents/list.html', context) + return render(request, "documents/list.html", context) From df257134ab8456d12ca13a3dcfa641fa0b9d5b8e Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 7 May 2024 16:01:03 -0600 Subject: [PATCH 5/9] update line length --- .github/workflows/format.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/format.yaml b/.github/workflows/format.yaml index 5eeed422..4e6996cc 100644 --- a/.github/workflows/format.yaml +++ b/.github/workflows/format.yaml @@ -8,4 +8,4 @@ jobs: - uses: actions/checkout@v4 - uses: rickstaa/action-black@v1 with: - black_args: ". --check" + black_args: ". --check -l 120" From 85b4451e6da4a5b556cbe0326477edc2b4a8f70b Mon Sep 17 00:00:00 2001 From: Caleb Date: Wed, 8 May 2024 10:28:27 -0600 Subject: [PATCH 6/9] add vscode default settings.json --- .gitignore | 3 ++- .vscode/settings.json.default | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .vscode/settings.json.default diff --git a/.gitignore b/.gitignore index f6629ff9..45b6a3e7 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,5 @@ __pycache__/ *.py[cod] *$py.class -.vscode +.vscode/**/* +!.vscode/settings.json.default diff --git a/.vscode/settings.json.default b/.vscode/settings.json.default new file mode 100644 index 00000000..d3a49201 --- /dev/null +++ b/.vscode/settings.json.default @@ -0,0 +1,7 @@ +{ + "[python]": { + "editor.defaultFormatter": "ms-python.black-formatter", + "editor.formatOnSave": true + }, + "black-formatter.args": ["-l", "120"] +} From 999e1a8bddb479ee3d70e089229437965267e911 Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 28 May 2024 10:54:04 -0600 Subject: [PATCH 7/9] add script to update user info in hubspot --- .../urgent_needs/urgent_need_functions.py | 2 +- screener/one_time_scripts.py | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/programs/programs/urgent_needs/urgent_need_functions.py b/programs/programs/urgent_needs/urgent_need_functions.py index 65c9a0a4..559b05b6 100644 --- a/programs/programs/urgent_needs/urgent_need_functions.py +++ b/programs/programs/urgent_needs/urgent_need_functions.py @@ -296,7 +296,7 @@ class EarlyChildhoodMentalHealthSupport(UrgentNeedFunction): @classmethod def eligible(cls, screen: Screen): ''' - Return True if the householdh as a child aged 0-5 + Return True if the household has a child aged 0-5 ''' return screen.num_children(age_max=cls.max_age) > 0 diff --git a/screener/one_time_scripts.py b/screener/one_time_scripts.py index 8ad8f55d..eb84784c 100644 --- a/screener/one_time_scripts.py +++ b/screener/one_time_scripts.py @@ -1,3 +1,5 @@ +from tqdm import trange +from integrations.services.hubspot.integration import Hubspot, upsert_user_hubspot from .models import ( Screen, EligibilitySnapshot, @@ -8,6 +10,7 @@ ) import json import uuid +import time def generate_bwf_snapshots(): @@ -149,3 +152,26 @@ def fix_insurance(): member.save() print('done') + + +def update_hubspot_extra_fields(): + screens = list(Screen.objects.filter(user__isnull=False)) + hubspot = Hubspot() + + failed = [] + + for i in trange(len(screens), desc='Translations'): + screen = screens[i] + user = screen.user + if user.external_id is None or user.external_id == '': + continue + + try: + hubspot.update_contact(user.external_id, hubspot.mfb_user_to_hubspot_contact(user, screen)) + except Exception as e: + failed.append(f'failed to update user with id: {user.id} and external id: {user.external_id}') + time.sleep(.2) + + print('\n'.join(failed)) + print('done') + From 6a1b291511b132b0b0415c234ff82f982e6fa462 Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 28 May 2024 11:34:57 -0600 Subject: [PATCH 8/9] Revert "format" This reverts commit 034a8172d0669da00eabd269d2012bb9a89ae4c0. --- authentication/admin.py | 23 +- authentication/apps.py | 4 +- authentication/migrations/0001_initial.py | 90 +- ...e_user_cell_user_email_or_cell_and_more.py | 27 +- authentication/migrations/0003_user_screen.py | 17 +- .../migrations/0004_user_tcpa_consent.py | 7 +- ...cell_alter_user_email_alter_user_screen.py | 23 +- .../migrations/0006_remove_user_screen.py | 7 +- .../0007_alter_user_cell_alter_user_email.py | 17 +- ...0008_user_send_offers_user_send_updates.py | 11 +- ...er_user_first_name_alter_user_last_name.py | 11 +- .../migrations/0010_user_language_code.py | 7 +- .../migrations/0011_alter_user_managers.py | 8 +- .../migrations/0012_user_external_id.py | 7 +- authentication/models.py | 20 +- authentication/serializers.py | 50 +- authentication/urls.py | 6 +- authentication/views.py | 19 +- benefits/asgi.py | 2 +- benefits/settings.py | 198 +- benefits/urls.py | 36 +- benefits/views.py | 10 +- benefits/wsgi.py | 2 +- configuration/admin.py | 6 +- .../management/commands/add_config.py | 2587 +---------------- configuration/models.py | 5 +- configuration/serializers.py | 3 +- configuration/urls.py | 4 +- configuration/views.py | 4 +- integrations/apps.py | 2 +- .../management/commands/hubspotsync.py | 50 +- .../services/communications/__init__.py | 1 + .../services/communications/message.py | 20 +- .../services/google_translate/integration.py | 28 +- integrations/services/hubspot/integration.py | 63 +- integrations/services/sheets/sheets.py | 31 +- integrations/util/cache.py | 4 +- manage.py | 4 +- programs/admin.py | 26 +- programs/apps.py | 4 +- programs/co_county_zips.py | 4 +- programs/management/commands/add_history.py | 65 +- programs/management/commands/diff_history.py | 32 +- programs/management/commands/quick_start.py | 198 +- .../management/commands/rm_latest_history.py | 10 +- programs/migrations/0001_initial.py | 27 +- .../0002_program_programnameshort.py | 9 +- ...link_program_apply_button_link_and_more.py | 57 +- ...gram_snapshot_program_description_short.py | 9 +- .../0005_rename_program_name_program_name.py | 9 +- ...escription_program_description_and_more.py | 15 +- ...7_alter_program_estimated_delivery_time.py | 7 +- ...008_alter_program_legal_status_required.py | 7 +- .../migrations/0009_program_value_type.py | 9 +- ...ink_program__apply_button_link_and_more.py | 63 +- .../migrations/0011_add_translation_model.py | 52 +- .../0012_migrate_translatable_fields.py | 30 +- ...ove_program__apply_button_link_and_more.py | 43 +- ...mtranslation_estimated_application_time.py | 7 +- .../0015_programtranslation_active.py | 7 +- .../0016_alter_programtranslation_active.py | 7 +- .../0017_navigator_navigatortranslation.py | 53 +- .../0018_alter_navigatortranslation_cell.py | 7 +- ...igatortranslation_phone_number_and_more.py | 15 +- ...020_remove_navigatortranslation_program.py | 7 +- .../0021_navigatortranslation_program.py | 9 +- ...tortranslation_assistance_link_and_more.py | 35 +- .../0023_navigator_assistance_link.py | 7 +- ...move_navigator_assistance_link_and_more.py | 29 +- ...igatortranslation_phone_number_and_more.py | 11 +- ..._remove_navigator_phone_number_and_more.py | 11 +- ...igatortranslation_phone_number_and_more.py | 11 +- .../0028_alter_navigator_phone_number.py | 7 +- .../0029_programtranslation_catagory.py | 9 +- ...me_catagory_programtranslation_category.py | 9 +- .../0031_urgentneed_urgentneedtranslation.py | 55 +- ...urgentneedfunction_urgentneed_functions.py | 15 +- .../0033_alter_urgentneed_functions.py | 9 +- .../0034_alter_urgentneedtranslation_link.py | 7 +- .../migrations/0035_federalpoverylimit.py | 25 +- ...ederalpoverylimit_has_2_people_and_more.py | 45 +- .../0037_alter_federalpoverylimit_year.py | 7 +- programs/migrations/0038_program_fpl.py | 15 +- ...okfunction_referrer_referrertranslation.py | 68 +- ...alter_referrer_white_label_css_and_more.py | 31 +- ...emove_referrer_white_label_css_and_more.py | 117 +- .../migrations/0042_auto_20230905_1620.py | 54 +- .../migrations/0043_auto_20230906_0938.py | 35 +- ...rogram_legal_status_required_1_and_more.py | 11 +- .../migrations/0045_auto_20230906_0951.py | 17 +- .../0046_delete_programtranslation.py | 5 +- .../0047_alter_program_active_1_and_more.py | 99 +- ...rename_active_1_program_active_and_more.py | 75 +- ...link_1_navigator_description_1_and_more.py | 189 +- .../migrations/0050_auto_20230906_1427.py | 53 +- ...eedtranslation_unique_together_and_more.py | 13 +- ...er_navigator_assistance_link_1_and_more.py | 85 +- ...nk_1_navigator_assistance_link_and_more.py | 51 +- ...nal_name_program_external_name_and_more.py | 15 +- ..._alter_navigator_external_name_and_more.py | 15 +- ...y_remove_urgentneed_type_short_and_more.py | 19 +- ...ter_urgentneedcategory_options_and_more.py | 34 +- .../0058_program_legal_status_required.py | 9 +- ...059_alter_program_legal_status_required.py | 9 +- .../0060_alter_navigator_program.py | 4 +- .../0061_referrer_remove_programs.py | 4 +- .../0062_document_program_documents.py | 4 +- ...62_navigatorcounties_navigator_counties.py | 4 +- ...ounty_delete_navigatorcounties_and_more.py | 4 +- .../migrations/0066_auto_20240130_1146.py | 12 +- programs/models.py | 213 +- programs/programs/__init__.py | 5 +- programs/programs/calc.py | 38 +- programs/programs/co/__init__.py | 55 +- .../co/basic_cash_assistance/calculator.py | 4 +- programs/programs/co/cash_back/calculator.py | 2 +- .../co/child_care_assistance/calculator.py | 45 +- .../co/connect_for_health/calculator.py | 27 +- .../programs/co/connect_for_health/tests.py | 12 +- .../dental_health_care_seniors/calculator.py | 15 +- .../co/dental_health_care_seniors/tests.py | 14 +- .../co/denver_preschool_program/calculator.py | 8 +- .../co/denver_preschool_program/tests.py | 9 +- .../emergency_rental_assistance/calculator.py | 11 +- .../co/energy_assistance/calculator.py | 19 +- .../co/energy_resource_center/calculator.py | 16 +- .../co/energy_resource_center/tests.py | 13 +- .../programs/co/every_day_eats/calculator.py | 4 +- programs/programs/co/every_day_eats/tests.py | 12 +- .../co/low_wage_covid_relief/calculator.py | 10 +- .../adult_with_disability/calculator.py | 41 +- .../child_with_disability/calculator.py | 35 +- .../co/medicaid/emergency/calculator.py | 13 +- .../family_planning_services/calculator.py | 17 +- .../family_planning_services/tests.py | 19 +- programs/programs/co/my_spark/calculator.py | 12 +- programs/programs/co/mydenver/calculator.py | 10 +- programs/programs/co/nfp/calculator.py | 21 +- programs/programs/co/omnisalud/calculator.py | 4 +- programs/programs/co/omnisalud/tests.py | 14 +- programs/programs/co/pe/__init__.py | 13 +- programs/programs/co/pe/member.py | 8 +- programs/programs/co/pe/tax.py | 16 +- .../co/property_credit_rebate/calculator.py | 20 +- .../co/property_credit_rebate/tests.py | 16 +- .../co/rental_assistance_grant/calculator.py | 9 +- .../co/reproductive_health_care/calculator.py | 6 +- .../co/reproductive_health_care/tests.py | 8 +- programs/programs/co/rtdlive/calculator.py | 20 +- programs/programs/co/tabor/calculator.py | 6 +- programs/programs/co/trua/calculator.py | 6 +- .../co/universal_preschool/calculator.py | 25 +- .../co/utility_bill_pay/calculator.py | 6 +- .../weatherization_assistance/calculator.py | 6 +- programs/programs/federal/__init__.py | 6 +- .../programs/federal/head_start/calculator.py | 14 +- .../federal/head_start/eligible_zipcodes.py | 76 +- programs/programs/federal/head_start/tests.py | 18 +- .../federal/medicare_savings/calculator.py | 30 +- programs/programs/federal/pe/__init__.py | 21 +- programs/programs/federal/pe/member.py | 27 +- programs/programs/federal/pe/spm.py | 12 +- programs/programs/federal/pe/tax.py | 7 +- programs/programs/federal/ssdi/calculator.py | 9 +- programs/programs/messages.py | 110 +- programs/programs/nc/pe/__init__.py | 3 +- programs/programs/nc/pe/member.py | 7 +- .../policyengine/calculators/__init__.py | 14 +- .../programs/policyengine/calculators/base.py | 30 +- .../policyengine/calculators/constants.py | 6 +- .../calculators/dependencies/base.py | 42 +- .../calculators/dependencies/member.py | 112 +- .../calculators/dependencies/spm.py | 112 +- .../calculators/dependencies/tax.py | 16 +- .../programs/policyengine/policy_engine.py | 42 +- .../urgent_needs/urgent_need_functions.py | 213 +- programs/serializers.py | 6 +- programs/urls.py | 10 +- programs/views.py | 12 +- screener/admin.py | 3 +- screener/apps.py | 4 +- .../management/commands/batch_snapshots.py | 34 +- .../management/commands/email_new_benefits.py | 22 +- screener/migrations/0001_initial.py | 58 +- .../0002_screen_housing_situation_expense.py | 21 +- .../0003_rename_type_incomestream_name.py | 9 +- .../0004_remove_incomestream_label.py | 7 +- .../0005_alter_incomestream_screen.py | 11 +- .../0006_rename_name_expense_type_and_more.py | 23 +- .../0007_rename_applicant_age_screen_age.py | 9 +- screener/migrations/0008_householdmember.py | 44 +- .../0009_remove_householdmember_zipcode.py | 7 +- ...ove_screen_disability_medicaid_and_more.py | 55 +- .../0011_expense_household_member_and_more.py | 25 +- ...2_alter_householdmember_screen_and_more.py | 29 +- .../0013_householdmember_relationship.py | 9 +- .../0014_screen_cell_screen_email.py | 11 +- .../migrations/0015_remove_screen_cell.py | 7 +- .../migrations/0016_remove_screen_email.py | 7 +- .../0017_screen_last_email_request_date.py | 7 +- screener/migrations/0018_screen_user.py | 15 +- screener/migrations/0019_screen_start_date.py | 7 +- screener/migrations/0020_screen_is_test.py | 7 +- screener/migrations/0021_messages.py | 30 +- .../0022_rename_messages_message.py | 7 +- ...me_message_message_content_message_type.py | 15 +- ..._alter_message_cell_alter_message_email.py | 13 +- .../migrations/0025_screen_external_id.py | 7 +- .../migrations/0026_screen_filed_taxes.py | 7 +- .../0027_remove_screen_filed_taxes.py | 7 +- .../0028_screen_last_tax_filing_year.py | 7 +- .../0029_alter_screen_housing_situation.py | 7 +- ...creen_has_ccb_screen_has_cccap_and_more.py | 63 +- ...holdmember_disability_medicaid_and_more.py | 11 +- screener/migrations/0032_message_uid.py | 7 +- .../migrations/0033_screen_referral_source.py | 7 +- .../0034_alter_screen_household_assets.py | 7 +- screener/migrations/0035_screen_county.py | 7 +- .../0036_screen_request_language_code.py | 7 +- ...litysnapshot_programeligibilitysnapshot.py | 51 +- ...hot_estimated_application_time_and_more.py | 23 +- screener/migrations/0039_screen_has_ssi.py | 7 +- ..._chp_hi_screen_has_employer_hi_and_more.py | 23 +- .../migrations/0041_screen_referrer_code.py | 7 +- ...042_screen_needs_baby_supplies_and_more.py | 27 +- .../migrations/0043_screen_has_medicare_hi.py | 7 +- .../migrations/0044_screen_is_verified.py | 7 +- screener/migrations/0045_screen_uuid.py | 7 +- screener/migrations/0046_alter_screen_uuid.py | 7 +- .../0047_incomestream_hours_worked.py | 7 +- .../0048_screen_needs_family_planning_help.py | 7 +- .../0049_eligibilitysnapshot_batch.py | 7 +- ...name_batch_eligibilitysnapshot_is_batch.py | 9 +- .../0051_programeligibilitysnapshot_new.py | 7 +- .../0052_alter_expense_household_member.py | 14 +- ...r_householdmember_has_expenses_and_more.py | 11 +- ...amount_alter_expense_frequency_and_more.py | 95 +- ..._has_andcs_screen_has_benefits_and_more.py | 45 +- screener/migrations/0056_screen_completed.py | 7 +- .../0057_screen_has_coctc_screen_has_upk.py | 11 +- ...kfunctions_webhooks_webhookstranslation.py | 50 +- ...ookfunction_webhooktranslation_and_more.py | 68 +- .../migrations/0060_screen_is_test_data.py | 7 +- .../0061_alter_screen_is_test_data.py | 7 +- .../0062_alter_screen_is_test_data.py | 7 +- ...ooktranslation_unique_together_and_more.py | 15 +- ..._screen_needs_dental_care_help_and_more.py | 15 +- ...ntal_care_help_screen_needs_dental_care.py | 9 +- .../migrations/0066_screen_is_13_or_older.py | 7 +- ...ense_household_member_alter_screen_user.py | 26 +- .../0068_householdmember_insurance.py | 23 +- ...i_alter_screen_has_employer_hi_and_more.py | 27 +- ...igibilitysnapshot_legal_status_required.py | 7 +- .../0074_alter_screen_household_assets.py | 4 +- .../0075_alter_screen_household_assets.py | 4 +- screener/models.py | 243 +- screener/one_time_scripts.py | 220 +- screener/serializers.py | 232 +- screener/tests.py | 20 +- screener/urls.py | 13 +- screener/views.py | 138 +- screener/webhooks.py | 12 +- translations/admin.py | 2 +- translations/apps.py | 4 +- translations/bulk_import_translations.py | 34 +- .../management/commands/bulk_export.py | 6 +- .../management/commands/bulk_import.py | 15 +- .../management/commands/bulk_translate.py | 16 +- translations/migrations/0001_initial.py | 45 +- .../migrations/0002_translation_active.py | 7 +- .../0003_alter_translation_managers.py | 7 +- .../migrations/0004_translation_no_auto.py | 7 +- translations/models.py | 31 +- translations/urls.py | 46 +- translations/views.py | 308 +- 275 files changed, 3715 insertions(+), 6376 deletions(-) diff --git a/authentication/admin.py b/authentication/admin.py index 57ce4997..28ede927 100644 --- a/authentication/admin.py +++ b/authentication/admin.py @@ -4,26 +4,23 @@ class CustomUserAdmin(UserAdmin): - ordering = ("email_or_cell", "email") + ordering = ('email_or_cell', 'email') - list_display = ("email_or_cell", "is_staff") - list_filter = ("is_staff",) + list_display = ('email_or_cell', 'is_staff') + list_filter = ('is_staff',) fieldsets = ( - (None, {"fields": ("email_or_cell", "password")}), - ("Personal info", {"fields": ("email", "cell")}), - ("Permissions", {"fields": ("is_staff", "tcpa_consent", "groups")}), + (None, {'fields': ('email_or_cell', 'password')}), + ('Personal info', {'fields': ('email', 'cell')}), + ('Permissions', {'fields': ('is_staff', 'tcpa_consent', 'groups')}), ) # add_fieldsets is not a standard ModelAdmin attribute. UserAdmin # overrides get_fieldsets to use this attribute when creating a user. add_fieldsets = ( - ( - None, - { - "classes": ("wide",), - "fields": ("email_or_cell", "password1", "password2", "email", "cell", "tcpa_consent", "is_staff"), - }, - ), + (None, { + 'classes': ('wide',), + 'fields': ('email_or_cell', 'password1', 'password2', 'email', 'cell', 'tcpa_consent', 'is_staff'), + }), ) diff --git a/authentication/apps.py b/authentication/apps.py index 7b90ca12..ead97686 100644 --- a/authentication/apps.py +++ b/authentication/apps.py @@ -2,5 +2,5 @@ class AuthConfig(AppConfig): - default_auto_field = "django.db.models.BigAutoField" - name = "authentication" + default_auto_field = 'django.db.models.BigAutoField' + name = 'authentication' diff --git a/authentication/migrations/0001_initial.py b/authentication/migrations/0001_initial.py index 8b950326..dc1b18f1 100644 --- a/authentication/migrations/0001_initial.py +++ b/authentication/migrations/0001_initial.py @@ -7,88 +7,38 @@ class Migration(migrations.Migration): + initial = True dependencies = [ - ("auth", "0012_alter_user_first_name_max_length"), + ('auth', '0012_alter_user_first_name_max_length'), ] operations = [ migrations.CreateModel( - name="User", + name='User', fields=[ - ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), - ("password", models.CharField(max_length=128, verbose_name="password")), - ("last_login", models.DateTimeField(blank=True, null=True, verbose_name="last login")), - ( - "is_superuser", - models.BooleanField( - default=False, - help_text="Designates that this user has all permissions without explicitly assigning them.", - verbose_name="superuser status", - ), - ), - ( - "username", - models.CharField( - error_messages={"unique": "A user with that username already exists."}, - help_text="Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.", - max_length=150, - unique=True, - validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], - verbose_name="username", - ), - ), - ("first_name", models.CharField(blank=True, max_length=150, verbose_name="first name")), - ("last_name", models.CharField(blank=True, max_length=150, verbose_name="last name")), - ("email", models.EmailField(blank=True, max_length=254, verbose_name="email address")), - ( - "is_staff", - models.BooleanField( - default=False, - help_text="Designates whether the user can log into this admin site.", - verbose_name="staff status", - ), - ), - ( - "is_active", - models.BooleanField( - default=True, - help_text="Designates whether this user should be treated as active. Unselect this instead of deleting accounts.", - verbose_name="active", - ), - ), - ("date_joined", models.DateTimeField(default=django.utils.timezone.now, verbose_name="date joined")), - ( - "groups", - models.ManyToManyField( - blank=True, - help_text="The groups this user belongs to. A user will get all permissions granted to each of their groups.", - related_name="user_set", - related_query_name="user", - to="auth.group", - verbose_name="groups", - ), - ), - ( - "user_permissions", - models.ManyToManyField( - blank=True, - help_text="Specific permissions for this user.", - related_name="user_set", - related_query_name="user", - to="auth.permission", - verbose_name="user permissions", - ), - ), + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('password', models.CharField(max_length=128, verbose_name='password')), + ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')), + ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')), + ('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')), + ('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')), + ('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')), + ('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')), + ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')), + ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')), + ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')), + ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.group', verbose_name='groups')), + ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.permission', verbose_name='user permissions')), ], options={ - "verbose_name": "user", - "verbose_name_plural": "users", - "abstract": False, + 'verbose_name': 'user', + 'verbose_name_plural': 'users', + 'abstract': False, }, managers=[ - ("objects", django.contrib.auth.models.UserManager()), + ('objects', django.contrib.auth.models.UserManager()), ], ), ] diff --git a/authentication/migrations/0002_remove_user_username_user_cell_user_email_or_cell_and_more.py b/authentication/migrations/0002_remove_user_username_user_cell_user_email_or_cell_and_more.py index aaef7d13..3de50bff 100644 --- a/authentication/migrations/0002_remove_user_username_user_cell_user_email_or_cell_and_more.py +++ b/authentication/migrations/0002_remove_user_username_user_cell_user_email_or_cell_and_more.py @@ -5,32 +5,31 @@ class Migration(migrations.Migration): + dependencies = [ - ("authentication", "0001_initial"), + ('authentication', '0001_initial'), ] operations = [ migrations.RemoveField( - model_name="user", - name="username", + model_name='user', + name='username', ), migrations.AddField( - model_name="user", - name="cell", - field=phonenumber_field.modelfields.PhoneNumberField( - default="+17202373591", max_length=128, region=None, unique=True - ), + model_name='user', + name='cell', + field=phonenumber_field.modelfields.PhoneNumberField(default='+17202373591', max_length=128, region=None, unique=True), preserve_default=False, ), migrations.AddField( - model_name="user", - name="email_or_cell", - field=models.CharField(default="bhiatt@garycommunity.org", max_length=320, unique=True), + model_name='user', + name='email_or_cell', + field=models.CharField(default='bhiatt@garycommunity.org', max_length=320, unique=True), preserve_default=False, ), migrations.AlterField( - model_name="user", - name="email", - field=models.EmailField(max_length=254, unique=True, verbose_name="email address"), + model_name='user', + name='email', + field=models.EmailField(max_length=254, unique=True, verbose_name='email address'), ), ] diff --git a/authentication/migrations/0003_user_screen.py b/authentication/migrations/0003_user_screen.py index 85a6e3bf..07047841 100644 --- a/authentication/migrations/0003_user_screen.py +++ b/authentication/migrations/0003_user_screen.py @@ -5,22 +5,17 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0016_remove_screen_email"), - ("authentication", "0002_remove_user_username_user_cell_user_email_or_cell_and_more"), + ('screener', '0016_remove_screen_email'), + ('authentication', '0002_remove_user_username_user_cell_user_email_or_cell_and_more'), ] operations = [ migrations.AddField( - model_name="user", - name="screen", - field=models.ForeignKey( - blank=True, - default=1, - on_delete=django.db.models.deletion.CASCADE, - related_name="screen", - to="screener.screen", - ), + model_name='user', + name='screen', + field=models.ForeignKey(blank=True, default=1, on_delete=django.db.models.deletion.CASCADE, related_name='screen', to='screener.screen'), preserve_default=False, ), ] diff --git a/authentication/migrations/0004_user_tcpa_consent.py b/authentication/migrations/0004_user_tcpa_consent.py index 0558880e..c4cbf267 100644 --- a/authentication/migrations/0004_user_tcpa_consent.py +++ b/authentication/migrations/0004_user_tcpa_consent.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("authentication", "0003_user_screen"), + ('authentication', '0003_user_screen'), ] operations = [ migrations.AddField( - model_name="user", - name="tcpa_consent", + model_name='user', + name='tcpa_consent', field=models.BooleanField(default=False), preserve_default=False, ), diff --git a/authentication/migrations/0005_alter_user_cell_alter_user_email_alter_user_screen.py b/authentication/migrations/0005_alter_user_cell_alter_user_email_alter_user_screen.py index c75960cb..85b1efa5 100644 --- a/authentication/migrations/0005_alter_user_cell_alter_user_email_alter_user_screen.py +++ b/authentication/migrations/0005_alter_user_cell_alter_user_email_alter_user_screen.py @@ -6,27 +6,26 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0017_screen_last_email_request_date"), - ("authentication", "0004_user_tcpa_consent"), + ('screener', '0017_screen_last_email_request_date'), + ('authentication', '0004_user_tcpa_consent'), ] operations = [ migrations.AlterField( - model_name="user", - name="cell", + model_name='user', + name='cell', field=phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, region=None, unique=True), ), migrations.AlterField( - model_name="user", - name="email", - field=models.EmailField(blank=True, max_length=254, unique=True, verbose_name="email address"), + model_name='user', + name='email', + field=models.EmailField(blank=True, max_length=254, unique=True, verbose_name='email address'), ), migrations.AlterField( - model_name="user", - name="screen", - field=models.ForeignKey( - blank=True, on_delete=django.db.models.deletion.CASCADE, related_name="users", to="screener.screen" - ), + model_name='user', + name='screen', + field=models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, related_name='users', to='screener.screen'), ), ] diff --git a/authentication/migrations/0006_remove_user_screen.py b/authentication/migrations/0006_remove_user_screen.py index 0cde4425..9f9d471e 100644 --- a/authentication/migrations/0006_remove_user_screen.py +++ b/authentication/migrations/0006_remove_user_screen.py @@ -4,13 +4,14 @@ class Migration(migrations.Migration): + dependencies = [ - ("authentication", "0005_alter_user_cell_alter_user_email_alter_user_screen"), + ('authentication', '0005_alter_user_cell_alter_user_email_alter_user_screen'), ] operations = [ migrations.RemoveField( - model_name="user", - name="screen", + model_name='user', + name='screen', ), ] diff --git a/authentication/migrations/0007_alter_user_cell_alter_user_email.py b/authentication/migrations/0007_alter_user_cell_alter_user_email.py index 23e4f715..62269fb8 100644 --- a/authentication/migrations/0007_alter_user_cell_alter_user_email.py +++ b/authentication/migrations/0007_alter_user_cell_alter_user_email.py @@ -5,21 +5,20 @@ class Migration(migrations.Migration): + dependencies = [ - ("authentication", "0006_remove_user_screen"), + ('authentication', '0006_remove_user_screen'), ] operations = [ migrations.AlterField( - model_name="user", - name="cell", - field=phonenumber_field.modelfields.PhoneNumberField( - blank=True, max_length=128, null=True, region=None, unique=True - ), + model_name='user', + name='cell', + field=phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, null=True, region=None, unique=True), ), migrations.AlterField( - model_name="user", - name="email", - field=models.EmailField(blank=True, max_length=254, null=True, unique=True, verbose_name="email address"), + model_name='user', + name='email', + field=models.EmailField(blank=True, max_length=254, null=True, unique=True, verbose_name='email address'), ), ] diff --git a/authentication/migrations/0008_user_send_offers_user_send_updates.py b/authentication/migrations/0008_user_send_offers_user_send_updates.py index 00018186..139f8ed8 100644 --- a/authentication/migrations/0008_user_send_offers_user_send_updates.py +++ b/authentication/migrations/0008_user_send_offers_user_send_updates.py @@ -4,19 +4,20 @@ class Migration(migrations.Migration): + dependencies = [ - ("authentication", "0007_alter_user_cell_alter_user_email"), + ('authentication', '0007_alter_user_cell_alter_user_email'), ] operations = [ migrations.AddField( - model_name="user", - name="send_offers", + model_name='user', + name='send_offers', field=models.BooleanField(default=False), ), migrations.AddField( - model_name="user", - name="send_updates", + model_name='user', + name='send_updates', field=models.BooleanField(default=False), ), ] diff --git a/authentication/migrations/0009_alter_user_first_name_alter_user_last_name.py b/authentication/migrations/0009_alter_user_first_name_alter_user_last_name.py index 1a19ce8f..6766c753 100644 --- a/authentication/migrations/0009_alter_user_first_name_alter_user_last_name.py +++ b/authentication/migrations/0009_alter_user_first_name_alter_user_last_name.py @@ -4,19 +4,20 @@ class Migration(migrations.Migration): + dependencies = [ - ("authentication", "0008_user_send_offers_user_send_updates"), + ('authentication', '0008_user_send_offers_user_send_updates'), ] operations = [ migrations.AlterField( - model_name="user", - name="first_name", + model_name='user', + name='first_name', field=models.CharField(blank=True, max_length=320, null=True), ), migrations.AlterField( - model_name="user", - name="last_name", + model_name='user', + name='last_name', field=models.CharField(blank=True, max_length=320, null=True), ), ] diff --git a/authentication/migrations/0010_user_language_code.py b/authentication/migrations/0010_user_language_code.py index 6522d847..369c56a5 100644 --- a/authentication/migrations/0010_user_language_code.py +++ b/authentication/migrations/0010_user_language_code.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("authentication", "0009_alter_user_first_name_alter_user_last_name"), + ('authentication', '0009_alter_user_first_name_alter_user_last_name'), ] operations = [ migrations.AddField( - model_name="user", - name="language_code", + model_name='user', + name='language_code', field=models.CharField(blank=True, max_length=12, null=True), ), ] diff --git a/authentication/migrations/0011_alter_user_managers.py b/authentication/migrations/0011_alter_user_managers.py index db9c6959..5371c3ef 100644 --- a/authentication/migrations/0011_alter_user_managers.py +++ b/authentication/migrations/0011_alter_user_managers.py @@ -4,13 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("authentication", "0010_user_language_code"), + ('authentication', '0010_user_language_code'), ] operations = [ migrations.AlterModelManagers( - name="user", - managers=[], + name='user', + managers=[ + ], ), ] diff --git a/authentication/migrations/0012_user_external_id.py b/authentication/migrations/0012_user_external_id.py index 90a0380f..9713bd33 100644 --- a/authentication/migrations/0012_user_external_id.py +++ b/authentication/migrations/0012_user_external_id.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("authentication", "0011_alter_user_managers"), + ('authentication', '0011_alter_user_managers'), ] operations = [ migrations.AddField( - model_name="user", - name="external_id", + model_name='user', + name='external_id', field=models.CharField(blank=True, max_length=320, null=True), ), ] diff --git a/authentication/models.py b/authentication/models.py index 4facb483..fb734b6e 100644 --- a/authentication/models.py +++ b/authentication/models.py @@ -10,9 +10,12 @@ def create_user(self, email_or_cell, tcpa_consent, password=None): Creates and saves a User with the given email or cell and password. """ if not email_or_cell: - raise ValueError("Users must have an email address or cell phone number") + raise ValueError('Users must have an email address or cell phone number') - user = self.model(email_or_cell=email_or_cell, tcpa_consent=tcpa_consent) + user = self.model( + email_or_cell=email_or_cell, + tcpa_consent=tcpa_consent + ) user.set_password(password) user.save(using=self._db) @@ -23,14 +26,17 @@ def create_superuser(self, email_or_cell, tcpa_consent, password=None): Creates and saves a superuser with the given email, date of birth and password. """ - user = self.create_user(email_or_cell=email_or_cell, password=password, tcpa_consent=tcpa_consent) + user = self.create_user( + email_or_cell=email_or_cell, + password=password, + tcpa_consent=tcpa_consent + ) user.is_admin = True user.is_superuser = True user.is_staff = True user.save(using=self._db) return user - # Users are created by the screener when someone signs up to provide feedback # or be notified of future benefits that are available to them. The unique id # can be either a cell phone number or email address. @@ -38,7 +44,7 @@ class User(AbstractUser): username = None email_or_cell = models.CharField(max_length=320, unique=True) cell = PhoneNumberField(unique=True, blank=True, null=True) - email = models.EmailField(_("email address"), unique=True, blank=True, null=True) + email = models.EmailField(_('email address'), unique=True, blank=True, null=True) first_name = models.CharField(max_length=320, blank=True, null=True) last_name = models.CharField(max_length=320, blank=True, null=True) language_code = models.CharField(max_length=12, blank=True, null=True) @@ -49,8 +55,8 @@ class User(AbstractUser): objects = UserManager() - USERNAME_FIELD = "email_or_cell" - REQUIRED_FIELDS = ["tcpa_consent"] + USERNAME_FIELD = 'email_or_cell' + REQUIRED_FIELDS = ['tcpa_consent'] def save(self, **kwargs): self.cell = self.cell or None diff --git a/authentication/serializers.py b/authentication/serializers.py index 6c9c143b..13c1d838 100644 --- a/authentication/serializers.py +++ b/authentication/serializers.py @@ -8,30 +8,30 @@ class UserSerializer(serializers.ModelSerializer): class Meta: model = User fields = ( - "id", - "date_joined", - "last_login", - "cell", - "email", - "first_name", - "last_name", - "email_or_cell", - "language_code", - "tcpa_consent", - "send_offers", - "send_updates", + 'id', + 'date_joined', + 'last_login', + 'cell', + 'email', + 'first_name', + 'last_name', + 'email_or_cell', + 'language_code', + 'tcpa_consent', + 'send_offers', + 'send_updates' ) create_only_fields = ( - "id", - "date_joined", - "last_login", - "cell", - "email", - "first_name", - "last_name", - "email_or_cell", - "language_code", - "tcpa_consent", + 'id', + 'date_joined', + 'last_login', + 'cell', + 'email', + 'first_name', + 'last_name', + 'email_or_cell', + 'language_code', + 'tcpa_consent', ) @@ -40,4 +40,8 @@ class UserOffersSerializer(serializers.ModelSerializer): class Meta: model = User - fields = ("id", "send_offers", "send_updates") + fields = ( + 'id', + 'send_offers', + 'send_updates' + ) diff --git a/authentication/urls.py b/authentication/urls.py index ebab708d..ca03f0d0 100644 --- a/authentication/urls.py +++ b/authentication/urls.py @@ -3,8 +3,10 @@ from . import views router = routers.DefaultRouter() -router.register(r"users", views.UserViewSet) +router.register(r'users', views.UserViewSet) # Wire up our API using automatic URL routing. # Additionally, we include login URLs for the browsable API. -urlpatterns = [path("", include(router.urls))] +urlpatterns = [ + path('', include(router.urls)) +] diff --git a/authentication/views.py b/authentication/views.py index 9251599a..f9fefbb3 100644 --- a/authentication/views.py +++ b/authentication/views.py @@ -10,18 +10,18 @@ import uuid -class UserViewSet(mixins.UpdateModelMixin, viewsets.GenericViewSet): +class UserViewSet(mixins.UpdateModelMixin, + viewsets.GenericViewSet): """ API endpoint that allows users to be viewed or edited. """ - - queryset = User.objects.all().order_by("-email_or_cell") + queryset = User.objects.all().order_by('-email_or_cell') serializer_class = UserSerializer permission_classes = [permissions.DjangoModelPermissions] def update(self, request, pk=None): if pk is None: - return Response("Must have an associated screen", status=400) + return Response('Must have an associated screen', status=400) screen = Screen.objects.get(uuid=pk) user = screen.user if user: @@ -45,8 +45,8 @@ def update(self, request, pk=None): upsert_user_to_hubspot(screen, screen.user) except Exception: capture_message( - "HubSpot upsert failed", - level="warning", + 'HubSpot upsert failed', + level='warning', ) return Response("Invalid Email", status=400) @@ -65,13 +65,14 @@ def upsert_user_to_hubspot(screen, user): hubspot_id = upsert_user_hubspot(user, screen=screen) if hubspot_id: - random_id = str(uuid.uuid4()).replace("-", "") + random_id = str(uuid.uuid4()).replace('-', '') user.external_id = hubspot_id - user.email_or_cell = f"{hubspot_id}+{random_id}@myfriendben.org" + user.email_or_cell = f'{hubspot_id}+{random_id}@myfriendben.org' user.first_name = None user.last_name = None user.cell = None user.email = None user.save() else: - raise Exception("Failed to upsert user") + raise Exception('Failed to upsert user') + diff --git a/benefits/asgi.py b/benefits/asgi.py index 9d278da0..9c3d038c 100644 --- a/benefits/asgi.py +++ b/benefits/asgi.py @@ -11,6 +11,6 @@ from django.core.asgi import get_asgi_application -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "benefits.settings") +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'benefits.settings') application = get_asgi_application() diff --git a/benefits/settings.py b/benefits/settings.py index 774061c1..058f6a11 100644 --- a/benefits/settings.py +++ b/benefits/settings.py @@ -22,25 +22,25 @@ # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent -MEDIA_ROOT = os.path.join(BASE_DIR, "media") -MEDIA_URL = "/media/" +MEDIA_ROOT = os.path.join(BASE_DIR, 'media') +MEDIA_URL = '/media/' LOCALE_PATHS = [ - os.path.join(BASE_DIR, "locale"), + os.path.join(BASE_DIR, 'locale'), ] # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = config("SECRET_KEY") +SECRET_KEY = config('SECRET_KEY') # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = config("DJANGO_DEBUG", "False") == "True" +DEBUG = config('DJANGO_DEBUG', 'False') == 'True' -ALLOWED_HOSTS = ["*"] +ALLOWED_HOSTS = ['*'] -AUTH_USER_MODEL = "authentication.User" +AUTH_USER_MODEL = 'authentication.User' AUTHENTICATION_BACKENDS = [ "django.contrib.auth.backends.ModelBackend", @@ -48,13 +48,13 @@ ] REST_FRAMEWORK = { - "DEFAULT_FILTER_BACKENDS": ["django_filters.rest_framework.DjangoFilterBackend"], - "DEFAULT_AUTHENTICATION_CLASSES": [ - "rest_framework.authentication.SessionAuthentication", - "rest_framework.authentication.TokenAuthentication", + 'DEFAULT_FILTER_BACKENDS': ['django_filters.rest_framework.DjangoFilterBackend'], + 'DEFAULT_AUTHENTICATION_CLASSES': [ + 'rest_framework.authentication.SessionAuthentication', + 'rest_framework.authentication.TokenAuthentication', ], - "DEFAULT_PERMISSION_CLASSES": ["rest_framework.permissions.IsAuthenticated"], - "EXCEPTION_HANDLER": "benefits.views.drf_exception_handler", + 'DEFAULT_PERMISSION_CLASSES': ['rest_framework.permissions.IsAuthenticated'], + 'EXCEPTION_HANDLER': 'benefits.views.drf_exception_handler', } CORS_ALLOW_ALL_ORIGINS = True @@ -62,71 +62,71 @@ # Application definition INSTALLED_APPS = [ - "authentication.apps.AuthConfig", - "corsheaders", - "screener.apps.ScreenerConfig", - "programs.apps.ProgramsConfig", - "configuration.apps.ConfigurationConfig", - "integrations.apps.IntegrationsConfig", - "translations.apps.TranslationsConfig", - "rest_framework", - "rest_framework.authtoken", - "phonenumber_field", - "parler", - "django_filters", - "django.contrib.admin", - "django.contrib.auth", - "django.contrib.contenttypes", - "django.contrib.sessions", - "django.contrib.messages", - "django.contrib.staticfiles", - "drf_yasg", + 'authentication.apps.AuthConfig', + 'corsheaders', + 'screener.apps.ScreenerConfig', + 'programs.apps.ProgramsConfig', + 'configuration.apps.ConfigurationConfig', + 'integrations.apps.IntegrationsConfig', + 'translations.apps.TranslationsConfig', + 'rest_framework', + 'rest_framework.authtoken', + 'phonenumber_field', + 'parler', + 'django_filters', + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'drf_yasg', ] MIDDLEWARE = [ - "django.middleware.security.SecurityMiddleware", - "whitenoise.middleware.WhiteNoiseMiddleware", - "django.contrib.sessions.middleware.SessionMiddleware", - "corsheaders.middleware.CorsMiddleware", - "django.middleware.common.CommonMiddleware", - "django.middleware.csrf.CsrfViewMiddleware", - "django.contrib.auth.middleware.AuthenticationMiddleware", - "django.contrib.messages.middleware.MessageMiddleware", - "django.middleware.clickjacking.XFrameOptionsMiddleware", - "django.middleware.locale.LocaleMiddleware", + 'django.middleware.security.SecurityMiddleware', + 'whitenoise.middleware.WhiteNoiseMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'corsheaders.middleware.CorsMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', + 'django.middleware.locale.LocaleMiddleware', ] -ROOT_URLCONF = "benefits.urls" +ROOT_URLCONF = 'benefits.urls' TEMPLATES = [ { - "BACKEND": "django.template.backends.django.DjangoTemplates", - "DIRS": [os.path.join(BASE_DIR, "templates")], - "APP_DIRS": True, - "OPTIONS": { - "context_processors": [ - "django.template.context_processors.debug", - "django.template.context_processors.request", - "django.contrib.auth.context_processors.auth", - "django.contrib.messages.context_processors.messages", + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [os.path.join(BASE_DIR, 'templates')], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', ], }, }, ] -WSGI_APPLICATION = "benefits.wsgi.application" +WSGI_APPLICATION = 'benefits.wsgi.application' # Database # https://docs.djangoproject.com/en/3.2/ref/settings/#databases DATABASES = { - "default": { - "ENGINE": "django.db.backends.postgresql", - "NAME": config("DB_NAME"), - "USER": config("DB_USER"), - "PASSWORD": config("DB_PASS"), - "HOST": config("DB_HOST", "localhost"), + 'default': { + 'ENGINE': 'django.db.backends.postgresql', + 'NAME': config('DB_NAME'), + 'USER': config('DB_USER'), + 'PASSWORD': config('DB_PASS'), + 'HOST': config('DB_HOST', 'localhost'), } } @@ -136,16 +136,16 @@ AUTH_PASSWORD_VALIDATORS = [ { - "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator", + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { - "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator", + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { - "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator", + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { - "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator", + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] @@ -153,23 +153,23 @@ # Internationalization # https://docs.djangoproject.com/en/3.2/topics/i18n/ -LANGUAGE_CODE = "en-us" +LANGUAGE_CODE = 'en-us' LANGUAGES = ( - ("en-us", _("US English")), - ("es", _("Spanish")), - ("vi", _("Vietnamese")), - ("fr", _("French")), - ("am", _("Amharic")), - ("so", _("Somali")), - ("ru", _("Russian")), - ("ne", _("Nepali")), - ("my", _("Burmese")), - ("zh", _("Chinese")), - ("ar", _("Arabic")), + ('en-us', _("US English")), + ('es', _('Spanish')), + ('vi', _('Vietnamese')), + ('fr', _('French')), + ('am', _('Amharic')), + ('so', _('Somali')), + ('ru', _('Russian')), + ('ne', _('Nepali')), + ('my', _('Burmese')), + ('zh', _('Chinese')), + ('ar', _('Arabic')), ) -TIME_ZONE = "UTC" +TIME_ZONE = 'UTC' USE_I18N = True @@ -179,45 +179,45 @@ PARLER_DEFAULT_ACTIVATE = True PARLER_LANGUAGES = { None: ( - {"code": "en-us"}, - {"code": "es"}, - {"code": "vi"}, - {"code": "fr"}, - {"code": "am"}, - {"code": "so"}, - {"code": "ru"}, - {"code": "ne"}, - {"code": "my"}, - {"code": "zh"}, - {"code": "ar"}, + {'code': 'en-us'}, + {'code': 'es'}, + {'code': 'vi'}, + {'code': 'fr'}, + {'code': 'am'}, + {'code': 'so'}, + {'code': 'ru'}, + {'code': 'ne'}, + {'code': 'my'}, + {'code': 'zh'}, + {'code': 'ar'}, ), - "default": { - "fallbacks": ["en-us"], # defaults to PARLER_DEFAULT_LANGUAGE_CODE - "hide_untranslated": True, # the default; let .active_translations() return fallbacks too. + 'default': { + 'fallbacks': ['en-us'], # defaults to PARLER_DEFAULT_LANGUAGE_CODE + 'hide_untranslated': True, # the default; let .active_translations() return fallbacks too. }, } # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/3.2/howto/static-files/ -STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles") -STATIC_URL = "/static/" -STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage" +STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') +STATIC_URL = '/static/' +STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' # Default primary key field type # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field -DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" -CSRF_FAILURE_VIEW = "benefits.views.catch_403_view" +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' +CSRF_FAILURE_VIEW = 'benefits.views.catch_403_view' -SWAGGER_SETTINGS = {"SUPPORTED_SUBMIT_METHODS": ("get",)} +SWAGGER_SETTINGS = {'SUPPORTED_SUBMIT_METHODS': ('get',)} # Enable logging with Sentry if it is enabled -if config("SENTRY_DSN", None) is not None: +if config('SENTRY_DSN', None) is not None: sentry_sdk.init( - dsn=config("SENTRY_DSN"), + dsn=config('SENTRY_DSN'), integrations=[DjangoIntegration()], - environment="dev" if DEBUG else "production", + environment='dev' if DEBUG else 'production', ) django_heroku.settings(locals()) diff --git a/benefits/urls.py b/benefits/urls.py index 0caf97f5..0cf296a6 100644 --- a/benefits/urls.py +++ b/benefits/urls.py @@ -1,4 +1,4 @@ -"""benefits URL Configuration +'''benefits URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.2/topics/http/urls/ @@ -12,22 +12,22 @@ Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) -""" +''' from django.contrib import admin from django.urls import include, path from sesame.views import LoginView from drf_yasg.views import get_schema_view from drf_yasg import openapi -handler403 = "benefits.views.catch_403_view" -handler400 = "benefits.views.catch_400_view" +handler403 = 'benefits.views.catch_403_view' +handler400 = 'benefits.views.catch_400_view' schema_view = get_schema_view( openapi.Info( - default_version="v1", - title="Colorado Open Benefits API", - description="API calculates eligibility across over 40 benefit programs in Colorado", - version="0.0.1", + default_version='v1', + title='Colorado Open Benefits API', + description='API calculates eligibility across over 40 benefit programs in Colorado', + version='0.0.1', ), public=True, permission_classes=[], @@ -35,16 +35,16 @@ ) urlpatterns = [ - path("api/", include("configuration.urls")), - path("api/", include("screener.urls")), - path("api/", include("programs.urls")), - path("api/", include("authentication.urls")), - path("api/translations/", include("translations.urls")), - path("admin/", admin.site.urls), - path("sesame/login/", LoginView.as_view(), name="sesame-login"), + path('api/', include('configuration.urls')), + path('api/', include('screener.urls')), + path('api/', include('programs.urls')), + path('api/', include('authentication.urls')), + path('api/translations/', include('translations.urls')), + path('admin/', admin.site.urls), + path('sesame/login/', LoginView.as_view(), name='sesame-login'), path( - "api/documentation/", - schema_view.with_ui("swagger", cache_timeout=0), - name="schema-swagger-ui", + 'api/documentation/', + schema_view.with_ui('swagger', cache_timeout=0), + name='schema-swagger-ui', ), ] diff --git a/benefits/views.py b/benefits/views.py index f0321de6..4be4d2c6 100644 --- a/benefits/views.py +++ b/benefits/views.py @@ -4,15 +4,15 @@ def catch_403_view(*args, **kwargs): - capture_message("Unauthorized", level="warning") + capture_message('Unauthorized', level='warning') - return HttpResponseForbidden("Forbidden") + return HttpResponseForbidden('Forbidden') def catch_400_view(*args, **kwargs): - capture_message("Bad Request", level="warning") + capture_message('Bad Request', level='warning') - return HttpResponseBadRequest("Bad Request") + return HttpResponseBadRequest('Bad Request') def drf_exception_handler(exc, context): @@ -23,7 +23,7 @@ def drf_exception_handler(exc, context): capture_message( response.reason_phrase, - level="warning", + level='warning', ) return response diff --git a/benefits/wsgi.py b/benefits/wsgi.py index 3ef70567..f5d67b28 100644 --- a/benefits/wsgi.py +++ b/benefits/wsgi.py @@ -11,6 +11,6 @@ from django.core.wsgi import get_wsgi_application -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "benefits.settings") +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'benefits.settings') application = get_wsgi_application() diff --git a/configuration/admin.py b/configuration/admin.py index 49835f65..8374284d 100644 --- a/configuration/admin.py +++ b/configuration/admin.py @@ -1,9 +1,7 @@ from django.contrib import admin from .models import Configuration - class ConfigurationAdmin(admin.ModelAdmin): - search_fields = ("name",) - + search_fields = ('name',) -admin.site.register(Configuration, ConfigurationAdmin) +admin.site.register(Configuration, ConfigurationAdmin) \ No newline at end of file diff --git a/configuration/management/commands/add_config.py b/configuration/management/commands/add_config.py index 8e12c15a..92900bdc 100644 --- a/configuration/management/commands/add_config.py +++ b/configuration/management/commands/add_config.py @@ -1,2588 +1,41 @@ from django.core.management.base import BaseCommand from configuration.models import ( - Configuration, + Configuration, ) class Command(BaseCommand): - help = "Create and add config data to database" + help = ( + 'Create and add config data to database' + ) - acute_condition_options = { - "food": { - "icon": {"_name": "Food", "_classname": "option-card-icon"}, - "_label": "acuteConditionOptions.food", - "_default_message": "Food or groceries", - }, - "housing": { - "icon": {"_name": "Housing", "_classname": "option-card-icon"}, - "_label": "acuteConditionOptions.housing", - "_default_message": "Help with managing your mortgage, rent, or utilities", - }, - "support": { - "icon": {"_name": "Support", "_classname": "option-card-icon"}, - "_label": "acuteConditionOptions.support", - "_default_message": "A challenge you or your child would like to talk about", - }, - "dentalCare": { - "icon": {"_name": "Dental_care", "_classname": "option-card-icon"}, - "_label": "acuteConditionOptions.dentalCare", - "_default_message": "Low-cost dental care", - }, - "babySupplies": { - "icon": {"_name": "Baby_supplies", "_classname": "option-card-icon"}, - "_label": "acuteConditionOptions.babySupplies", - "_default_message": "Diapers and other baby supplies", - }, - "jobResources": { - "icon": {"_name": "Job_resources", "_classname": "option-card-icon"}, - "_label": "acuteConditionOptions.jobResources", - "_default_message": "Finding a job", - }, - "legalServices": { - "icon": {"_name": "Legal_services", "_classname": "option-card-icon"}, - "_label": "acuteConditionOptions.legalServices", - "_default_message": "Free or low-cost help with civil legal needs", - }, - "familyPlanning": { - "icon": {"_name": "Family_planning", "_classname": "option-card-icon"}, - "_label": "acuteConditionOptions.familyPlanning", - "_default_message": "Family planning or birth control", - }, - "childDevelopment": { - "icon": {"_name": "Child_development", "_classname": "option-card-icon"}, - "_label": "acuteConditionOptions.childDevelopment", - "_default_message": "Concern about your baby or toddler's development", - }, - } + acute_condition_options = {"food": {"icon": {"_name": "Food", "_classname": "option-card-icon"}, "_label": "acuteConditionOptions.food", "_default_message": "Food or groceries"}, "housing": {"icon": {"_name": "Housing", "_classname": "option-card-icon"}, "_label": "acuteConditionOptions.housing", "_default_message": "Help with managing your mortgage, rent, or utilities"}, "support": {"icon": {"_name": "Support", "_classname": "option-card-icon"}, "_label": "acuteConditionOptions.support", "_default_message": "A challenge you or your child would like to talk about"}, "dentalCare": {"icon": {"_name": "Dental_care", "_classname": "option-card-icon"}, "_label": "acuteConditionOptions.dentalCare", "_default_message": "Low-cost dental care"}, "babySupplies": {"icon": {"_name": "Baby_supplies", "_classname": "option-card-icon"}, "_label": "acuteConditionOptions.babySupplies", "_default_message": "Diapers and other baby supplies"}, "jobResources": {"icon": {"_name": "Job_resources", "_classname": "option-card-icon"}, "_label": "acuteConditionOptions.jobResources", "_default_message": "Finding a job"}, "legalServices": {"icon": {"_name": "Legal_services", "_classname": "option-card-icon"}, "_label": "acuteConditionOptions.legalServices", "_default_message": "Free or low-cost help with civil legal needs"}, "familyPlanning": {"icon": {"_name": "Family_planning", "_classname": "option-card-icon"}, "_label": "acuteConditionOptions.familyPlanning", "_default_message": "Family planning or birth control"}, "childDevelopment": {"icon": {"_name": "Child_development", "_classname": "option-card-icon"}, "_label": "acuteConditionOptions.childDevelopment", "_default_message": "Concern about your baby or toddler's development"}} - sign_up_options = { - "sendOffers": { - "_label": "signUpOptions.sendOffers", - "_default_message": "Please notify me when there are paid opportunities to provide feedback on MyFriendBen.", - }, - "sendUpdates": { - "_label": "signUpOptions.sendUpdates", - "_default_message": "Please notify me when new benefits become available to me that I am likely eligible for based on the information I have provided.", - }, - } + sign_up_options = {"sendOffers": {"_label": "signUpOptions.sendOffers", "_default_message": "Please notify me when there are paid opportunities to provide feedback on MyFriendBen."}, "sendUpdates": {"_label": "signUpOptions.sendUpdates", "_default_message": "Please notify me when new benefits become available to me that I am likely eligible for based on the information I have provided."}} - relationship_options = { - "child": {"_label": "relationshipOptions.child", "_default_message": "Child"}, - "parent": {"_label": "relationshipOptions.parent", "_default_message": "Parent"}, - "spouse": {"_label": "relationshipOptions.spouse", "_default_message": "Spouse"}, - "stepChild": {"_label": "relationshipOptions.stepChild", "_default_message": "Step-child"}, - "unrelated": {"_label": "relationshipOptions.unrelated", "_default_message": "Unrelated"}, - "grandChild": {"_label": "relationshipOptions.grandChild", "_default_message": "Grandchild"}, - "stepParent": {"_label": "relationshipOptions.stepParent", "_default_message": "Step-parent"}, - "fosterChild": { - "_label": "relationshipOptions.fosterChildOrKinshipChild", - "_default_message": "Foster Child / Kinship Care", - }, - "grandParent": {"_label": "relationshipOptions.grandParent", "_default_message": "Grandparent"}, - "fosterParent": {"_label": "relationshipOptions.fosterParent", "_default_message": "Foster Parent"}, - "relatedOther": {"_label": "relationshipOptions.relatedOther", "_default_message": "Related in some other way"}, - "domesticPartner": {"_label": "relationshipOptions.domesticPartner", "_default_message": "Domestic Partner"}, - "sisterOrBrother": {"_label": "relationshipOptions.sisterOrBrother", "_default_message": "Sister/Brother"}, - "stepSisterOrBrother": { - "_label": "relationshipOptions.stepSisterOrBrother", - "_default_message": "Step-sister/Step-brother", - }, - "boyfriendOrGirlfriend": { - "_label": "relationshipOptions.boyfriendOrGirlfriend", - "_default_message": "Boyfriend/Girlfriend", - }, - } + relationship_options = {"child": {"_label": "relationshipOptions.child", "_default_message": "Child"}, "parent": {"_label": "relationshipOptions.parent", "_default_message": "Parent"}, "spouse": {"_label": "relationshipOptions.spouse", "_default_message": "Spouse"}, "stepChild": {"_label": "relationshipOptions.stepChild", "_default_message": "Step-child"}, "unrelated": {"_label": "relationshipOptions.unrelated", "_default_message": "Unrelated"}, "grandChild": {"_label": "relationshipOptions.grandChild", "_default_message": "Grandchild"}, "stepParent": {"_label": "relationshipOptions.stepParent", "_default_message": "Step-parent"}, "fosterChild": {"_label": "relationshipOptions.fosterChildOrKinshipChild", "_default_message": "Foster Child / Kinship Care"}, "grandParent": {"_label": "relationshipOptions.grandParent", "_default_message": "Grandparent"}, "fosterParent": {"_label": "relationshipOptions.fosterParent", "_default_message": "Foster Parent"}, "relatedOther": {"_label": "relationshipOptions.relatedOther", "_default_message": "Related in some other way"}, "domesticPartner": {"_label": "relationshipOptions.domesticPartner", "_default_message": "Domestic Partner"}, "sisterOrBrother": {"_label": "relationshipOptions.sisterOrBrother", "_default_message": "Sister/Brother"}, "stepSisterOrBrother": {"_label": "relationshipOptions.stepSisterOrBrother", "_default_message": "Step-sister/Step-brother"}, "boyfriendOrGirlfriend": {"_label": "relationshipOptions.boyfriendOrGirlfriend", "_default_message": "Boyfriend/Girlfriend"}} - referral_options = { - "bia": "Benefits in Action", - "cch": "Colorado Coalition for the Homeless", - "gac": "Get Ahead Colorado", - "lgs": "Let's Get Set", - "cedp": "Community Economic Defense Project (CEDP)", - "frca": "Family Resource Center Association", - "211co": "2-1-1 Colorado", - "other": {"_label": "referralOptions.other", "_default_message": "Other"}, - "jeffcoHS": "Jeffco Human Services", - "socialMedia": {"_label": "referralOptions.socialMedia", "_default_message": "Social Media"}, - "searchEngine": {"_label": "referralOptions.searchEngine", "_default_message": "Google or other search engine"}, - "testOrProspect": { - "_label": "referralOptions.testOrProspect", - "_default_message": "Test / Prospective Partner", - }, - "villageExchange": "Village Exchange", - "taxAssistanceSite": { - "_label": "referralOptions.taxAssistanceSite", - "_default_message": "Tax Assistance Site (VITA/Tax Help Colorado)", - }, - } + referral_options = {"bia": "Benefits in Action", "cch": "Colorado Coalition for the Homeless", "gac": "Get Ahead Colorado", "lgs": "Let's Get Set", "cedp": "Community Economic Defense Project (CEDP)", "frca": "Family Resource Center Association", "211co": "2-1-1 Colorado", "other": {"_label": "referralOptions.other", "_default_message": "Other"}, "jeffcoHS": "Jeffco Human Services", "socialMedia": {"_label": "referralOptions.socialMedia", "_default_message": "Social Media"}, "searchEngine": {"_label": "referralOptions.searchEngine", "_default_message": "Google or other search engine"}, "testOrProspect": {"_label": "referralOptions.testOrProspect", "_default_message": "Test / Prospective Partner"}, "villageExchange": "Village Exchange", "taxAssistanceSite": {"_label": "referralOptions.taxAssistanceSite", "_default_message": "Tax Assistance Site (VITA/Tax Help Colorado)"}} - language_options = { - "am": "አማርኛ", - "es": "Español", - "fr": "Français", - "my": "မြန်မာဘာသာစကား", - "ne": "नेपाली", - "ru": "Русский", - "so": "Soomaali", - "vi": "Tiếng Việt", - "zh": "汉语", - "en-us": "English", - } + language_options = {"am": "አማርኛ", "es": "Español", "fr": "Français", "my": "မြန်မာဘာသာစကား", "ne": "नेपाली", "ru": "Русский", "so": "Soomaali", "vi": "Tiếng Việt", "zh": "汉语", "en-us": "English"} - income_options = { - "sSI": {"_label": "incomeOptions.sSI", "_default_message": "Supplemental Security Income (SSI)"}, - "gifts": {"_label": "incomeOptions.gifts", "_default_message": "Gifts/Contributions (Received)"}, - "wages": {"_label": "incomeOptions.wages", "_default_message": "Wages, salaries, tips"}, - "rental": {"_label": "incomeOptions.rental", "_default_message": "Rental Income"}, - "alimony": {"_label": "incomeOptions.alimony", "_default_message": "Alimony (Received)"}, - "boarder": {"_label": "incomeOptions.boarder", "_default_message": "Boarder or Lodger"}, - "pension": {"_label": "incomeOptions.pension", "_default_message": "Military, Government, or Private Pension"}, - "veteran": {"_label": "incomeOptions.veteran", "_default_message": "Veteran's Pension or Benefits"}, - "investment": { - "_label": "incomeOptions.investment", - "_default_message": "Investment Income (interest, dividends, and profit from selling stocks)", - }, - "sSSurvivor": { - "_label": "incomeOptions.sSSurvivor", - "_default_message": "Social Security Survivor's Benefits (Widow/Widower)", - }, - "sSDependent": { - "_label": "incomeOptions.sSDependent", - "_default_message": "Social Security Dependent Benefits (retirement, disability, or survivors)", - }, - "workersComp": {"_label": "incomeOptions.workersComp", "_default_message": "Worker's Compensation"}, - "childSupport": {"_label": "incomeOptions.childSupport", "_default_message": "Child Support (Received)"}, - "deferredComp": { - "_label": "incomeOptions.deferredComp", - "_default_message": "Withdrawals from Deferred Compensation (IRA, Keogh, etc.)", - }, - "sSDisability": { - "_label": "incomeOptions.sSDisability", - "_default_message": "Social Security Disability Benefits", - }, - "sSRetirement": { - "_label": "incomeOptions.sSRetirement", - "_default_message": "Social Security Retirement Benefits", - }, - "unemployment": {"_label": "incomeOptions.unemployment", "_default_message": "Unemployment Benefits"}, - "cOSDisability": { - "_label": "incomeOptions.cOSDisability", - "_default_message": "Colorado State Disability Benefits", - }, - "cashAssistance": {"_label": "incomeOptions.cashAssistance", "_default_message": "Cash Assistance Grant"}, - "selfEmployment": { - "_label": "incomeOptions.selfEmployment", - "_default_message": "Income from freelance, independent contractor, or self-employment work", - }, - } + income_options = {"sSI": {"_label": "incomeOptions.sSI", "_default_message": "Supplemental Security Income (SSI)"}, "gifts": {"_label": "incomeOptions.gifts", "_default_message": "Gifts/Contributions (Received)"}, "wages": {"_label": "incomeOptions.wages", "_default_message": "Wages, salaries, tips"}, "rental": {"_label": "incomeOptions.rental", "_default_message": "Rental Income"}, "alimony": {"_label": "incomeOptions.alimony", "_default_message": "Alimony (Received)"}, "boarder": {"_label": "incomeOptions.boarder", "_default_message": "Boarder or Lodger"}, "pension": {"_label": "incomeOptions.pension", "_default_message": "Military, Government, or Private Pension"}, "veteran": {"_label": "incomeOptions.veteran", "_default_message": "Veteran's Pension or Benefits"}, "investment": {"_label": "incomeOptions.investment", "_default_message": "Investment Income (interest, dividends, and profit from selling stocks)"}, "sSSurvivor": {"_label": "incomeOptions.sSSurvivor", "_default_message": "Social Security Survivor's Benefits (Widow/Widower)"}, "sSDependent": {"_label": "incomeOptions.sSDependent", "_default_message": "Social Security Dependent Benefits (retirement, disability, or survivors)"}, "workersComp": {"_label": "incomeOptions.workersComp", "_default_message": "Worker's Compensation"}, "childSupport": {"_label": "incomeOptions.childSupport", "_default_message": "Child Support (Received)"}, "deferredComp": {"_label": "incomeOptions.deferredComp", "_default_message": "Withdrawals from Deferred Compensation (IRA, Keogh, etc.)"}, "sSDisability": {"_label": "incomeOptions.sSDisability", "_default_message": "Social Security Disability Benefits"}, "sSRetirement": {"_label": "incomeOptions.sSRetirement", "_default_message": "Social Security Retirement Benefits"}, "unemployment": {"_label": "incomeOptions.unemployment", "_default_message": "Unemployment Benefits"}, "cOSDisability": {"_label": "incomeOptions.cOSDisability", "_default_message": "Colorado State Disability Benefits"}, "cashAssistance": {"_label": "incomeOptions.cashAssistance", "_default_message": "Cash Assistance Grant"}, "selfEmployment": {"_label": "incomeOptions.selfEmployment", "_default_message": "Income from freelance, independent contractor, or self-employment work"}} - health_insurance_options = { - "you": { - "chp": { - "icon": {"_name": "Chp", "_classname": "option-card-icon"}, - "_label": "healthInsuranceOptions.chp", - "_default_message": "Child Health Plan Plus (CHP+)", - }, - "none": { - "icon": {"_name": "None", "_classname": "option-card-icon"}, - "_label": "healthInsuranceOptions.none-I", - "_default_message": "I do not have health insurance", - }, - "private": { - "icon": {"_name": "PrivateInsurance", "_classname": "option-card-icon"}, - "_label": "healthInsuranceOptions.private", - "_default_message": "Private (non-employer) health insurance", - }, - "employer": { - "icon": {"_name": "Employer", "_classname": "option-card-icon"}, - "_label": "healthInsuranceOptions.employer", - "_default_message": "Employer-provided health insurance", - }, - "medicaid": { - "icon": {"_name": "Medicaid", "_classname": "option-card-icon"}, - "_label": "healthInsuranceOptions.medicaid", - "_default_message": "Health First Colorado (Full Medicaid)", - }, - "medicare": { - "icon": {"_name": "Medicare", "_classname": "option-card-icon"}, - "_label": "healthInsuranceOptions.medicare", - "_default_message": "Medicare", - }, - "dont_know": { - "icon": {"_name": "Dont_know", "_classname": "option-card-icon"}, - "_label": "healthInsuranceOptions.dont_know", - "_default_message": "Don't Know", - }, - "family_planning": { - "icon": {"_name": "Family_planning", "_classname": "option-card-icon"}, - "_label": "healthInsuranceOptions.family_planning", - "_default_message": "Family Planning Limited Medicaid", - }, - "emergency_medicaid": { - "icon": {"_name": "Emergency_medicaid", "_classname": "option-card-icon"}, - "_label": "healthInsuranceOptions.emergency_medicaid", - "_default_message": "Emergency Medicaid / Reproductive Health", - }, - }, - "them": { - "chp": { - "icon": {"_name": "Chp", "_classname": "option-card-icon"}, - "_label": "healthInsuranceOptions.chp", - "_default_message": "Child Health Plan Plus (CHP+)", - }, - "none": { - "icon": {"_name": "None", "_classname": "option-card-icon"}, - "_label": "healthInsuranceOptions.none-they", - "_default_message": "They do not have health insurance", - }, - "private": { - "icon": {"_name": "PrivateInsurance", "_classname": "option-card-icon"}, - "_label": "healthInsuranceOptions.private", - "_default_message": "Private (non-employer) health insurance", - }, - "employer": { - "icon": {"_name": "Employer", "_classname": "option-card-icon"}, - "_label": "healthInsuranceOptions.employer", - "_default_message": "Employer-provided health insurance", - }, - "medicaid": { - "icon": {"_name": "Medicaid", "_classname": "option-card-icon"}, - "_label": "healthInsuranceOptions.medicaid", - "_default_message": "Health First Colorado (Full Medicaid)", - }, - "medicare": { - "icon": {"_name": "Medicare", "_classname": "option-card-icon"}, - "_label": "healthInsuranceOptions.medicare", - "_default_message": "Medicare", - }, - "dont_know": { - "icon": {"_name": "Dont_know", "_classname": "option-card-icon"}, - "_label": "healthInsuranceOptions.dont_know", - "_default_message": "Don't Know", - }, - "family_planning": { - "icon": {"_name": "Family_planning", "_classname": "option-card-icon"}, - "_label": "healthInsuranceOptions.family_planning", - "_default_message": "Family Planning Limited Medicaid", - }, - "emergency_medicaid": { - "icon": {"_name": "Emergency_medicaid", "_classname": "option-card-icon"}, - "_label": "healthInsuranceOptions.emergency_medicaid", - "_default_message": "Emergency Medicaid / Reproductive Health", - }, - }, - } + health_insurance_options = {"you": {"chp": {"icon": {"_name": "Chp", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.chp", "_default_message": "Child Health Plan Plus (CHP+)"}, "none": {"icon": {"_name": "None", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.none-I", "_default_message": "I do not have health insurance"}, "private": {"icon": {"_name": "PrivateInsurance", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.private", "_default_message": "Private (non-employer) health insurance"}, "employer": {"icon": {"_name": "Employer", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.employer", "_default_message": "Employer-provided health insurance"}, "medicaid": {"icon": {"_name": "Medicaid", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.medicaid", "_default_message": "Health First Colorado (Full Medicaid)"}, "medicare": {"icon": {"_name": "Medicare", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.medicare", "_default_message": "Medicare"}, "dont_know": {"icon": {"_name": "Dont_know", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.dont_know", "_default_message": "Don't Know"}, "family_planning": {"icon": {"_name": "Family_planning", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.family_planning", "_default_message": "Family Planning Limited Medicaid"}, "emergency_medicaid": {"icon": {"_name": "Emergency_medicaid", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.emergency_medicaid", "_default_message": "Emergency Medicaid / Reproductive Health"}}, "them": {"chp": {"icon": {"_name": "Chp", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.chp", "_default_message": "Child Health Plan Plus (CHP+)"}, "none": {"icon": {"_name": "None", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.none-they", "_default_message": "They do not have health insurance"}, "private": {"icon": {"_name": "PrivateInsurance", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.private", "_default_message": "Private (non-employer) health insurance"}, "employer": {"icon": {"_name": "Employer", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.employer", "_default_message": "Employer-provided health insurance"}, "medicaid": {"icon": {"_name": "Medicaid", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.medicaid", "_default_message": "Health First Colorado (Full Medicaid)"}, "medicare": {"icon": {"_name": "Medicare", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.medicare", "_default_message": "Medicare"}, "dont_know": {"icon": {"_name": "Dont_know", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.dont_know", "_default_message": "Don't Know"}, "family_planning": {"icon": {"_name": "Family_planning", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.family_planning", "_default_message": "Family Planning Limited Medicaid"}, "emergency_medicaid": {"icon": {"_name": "Emergency_medicaid", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.emergency_medicaid", "_default_message": "Emergency Medicaid / Reproductive Health"}}} - housing_options = { - "hotel": {"_label": "housingOptions.hotel", "_default_message": "In a hotel"}, - "owner": { - "_label": "housingOptions.owner", - "_default_message": "You or a household member owns the home or apartment", - }, - "renting": {"_label": "housingOptions.renting", "_default_message": "Renting"}, - "shelter": {"_label": "housingOptions.shelter", "_default_message": "In a shelter or homeless"}, - "preferNotToSay": {"_label": "housingOptions.preferNotToSay", "_default_message": "Prefer not to say"}, - "stayingWithFriend": {"_label": "housingOptions.stayingWithFriend", "_default_message": "Staying with friend"}, - } + housing_options = {"hotel": {"_label": "housingOptions.hotel", "_default_message": "In a hotel"}, "owner": {"_label": "housingOptions.owner", "_default_message": "You or a household member owns the home or apartment"}, "renting": {"_label": "housingOptions.renting", "_default_message": "Renting"}, "shelter": {"_label": "housingOptions.shelter", "_default_message": "In a shelter or homeless"}, "preferNotToSay": {"_label": "housingOptions.preferNotToSay", "_default_message": "Prefer not to say"}, "stayingWithFriend": {"_label": "housingOptions.stayingWithFriend", "_default_message": "Staying with friend"}} - frequency_options = { - "hourly": {"_label": "frequencyOptions.hourly", "_default_message": "hourly"}, - "weekly": {"_label": "frequencyOptions.weekly", "_default_message": "every week"}, - "monthly": {"_label": "frequencyOptions.monthly", "_default_message": "every month"}, - "biweekly": {"_label": "frequencyOptions.biweekly", "_default_message": "every 2 weeks"}, - } + frequency_options = {"hourly": {"_label": "frequencyOptions.hourly", "_default_message": "hourly"}, "weekly": {"_label": "frequencyOptions.weekly", "_default_message": "every week"}, "monthly": {"_label": "frequencyOptions.monthly", "_default_message": "every month"}, "biweekly": {"_label": "frequencyOptions.biweekly", "_default_message": "every 2 weeks"}} - expense_options = { - "auto": {"_label": "expenseOptions.auto", "_default_message": "Auto Insurance Premium &/or Payment"}, - "rent": {"_label": "expenseOptions.rent", "_default_message": "Rent"}, - "cooling": {"_label": "expenseOptions.cooling", "_default_message": "Cooling"}, - "heating": {"_label": "expenseOptions.heating", "_default_message": "Heating"}, - "medical": {"_label": "expenseOptions.medical", "_default_message": "Medical Insurance Premium &/or Bills"}, - "internet": {"_label": "expenseOptions.internet", "_default_message": "Internet"}, - "mortgage": {"_label": "expenseOptions.mortgage", "_default_message": "Mortgage"}, - "childCare": {"_label": "expenseOptions.childCare", "_default_message": "Child Care"}, - "telephone": {"_label": "expenseOptions.telephone", "_default_message": "Telephone"}, - "creditCard": {"_label": "expenseOptions.creditCard", "_default_message": "Credit Card Debt"}, - "childSupport": {"_label": "expenseOptions.childSupport", "_default_message": "Child Support (Paid)"}, - "personalLoan": {"_label": "expenseOptions.personalLoan", "_default_message": "Personal Loan"}, - "studentLoans": {"_label": "expenseOptions.studentLoans", "_default_message": "Student Loans"}, - "dependentCare": {"_label": "expenseOptions.dependentCare", "_default_message": "Dependent Care"}, - "otherUtilities": {"_label": "expenseOptions.otherUtilities", "_default_message": "Other Utilities"}, - } + expense_options = {"auto": {"_label": "expenseOptions.auto", "_default_message": "Auto Insurance Premium &/or Payment"}, "rent": {"_label": "expenseOptions.rent", "_default_message": "Rent"}, "cooling": {"_label": "expenseOptions.cooling", "_default_message": "Cooling"}, "heating": {"_label": "expenseOptions.heating", "_default_message": "Heating"}, "medical": {"_label": "expenseOptions.medical", "_default_message": "Medical Insurance Premium &/or Bills"}, "internet": {"_label": "expenseOptions.internet", "_default_message": "Internet"}, "mortgage": {"_label": "expenseOptions.mortgage", "_default_message": "Mortgage"}, "childCare": {"_label": "expenseOptions.childCare", "_default_message": "Child Care"}, "telephone": {"_label": "expenseOptions.telephone", "_default_message": "Telephone"}, "creditCard": {"_label": "expenseOptions.creditCard", "_default_message": "Credit Card Debt"}, "childSupport": {"_label": "expenseOptions.childSupport", "_default_message": "Child Support (Paid)"}, "personalLoan": {"_label": "expenseOptions.personalLoan", "_default_message": "Personal Loan"}, "studentLoans": {"_label": "expenseOptions.studentLoans", "_default_message": "Student Loans"}, "dependentCare": {"_label": "expenseOptions.dependentCare", "_default_message": "Dependent Care"}, "otherUtilities": {"_label": "expenseOptions.otherUtilities", "_default_message": "Other Utilities"}} - condition_options = { - "you": { - "student": { - "icon": {"_name": "Student", "_classname": "option-card-icon"}, - "_label": "conditionOptions.student", - "_default_message": "Student at a college, university, or other post-secondary institution like a job-training program", - }, - "disabled": { - "icon": {"_name": "Disabled", "_classname": "option-card-icon"}, - "_label": "conditionOptions.disabled", - "_default_message": "Have any disabilities that make you unable to work now or in the future", - }, - "pregnant": { - "icon": {"_name": "Pregnant", "_classname": "option-card-icon"}, - "_label": "conditionOptions.pregnant", - "_default_message": "Pregnant", - }, - "longTermDisability": { - "icon": {"_name": "LongTermDisability", "_classname": "option-card-icon"}, - "_label": "conditionOptions.longTermDisability", - "_default_message": "Any medical or developmental condition that has lasted, or is expected to last, more than 12 months", - }, - "blindOrVisuallyImpaired": { - "icon": {"_name": "BlindOrVisuallyImpaired", "_classname": "option-card-icon"}, - "_label": "conditionOptions.blindOrVisuallyImpaired", - "_default_message": "Blind or visually impaired", - }, - }, - "them": { - "student": { - "icon": {"_name": "Student", "_classname": "option-card-icon"}, - "_label": "conditionOptions.student", - "_default_message": "Student at a college, university, or other post-secondary institution like a job-training program", - }, - "disabled": { - "icon": {"_name": "Disabled", "_classname": "option-card-icon"}, - "_label": "conditionOptions.disabled-them", - "_default_message": "Have any disabilities that make them unable to work now or in the future", - }, - "pregnant": { - "icon": {"_name": "Pregnant", "_classname": "option-card-icon"}, - "_label": "conditionOptions.pregnant", - "_default_message": "Pregnant", - }, - "longTermDisability": { - "icon": {"_name": "LongTermDisability", "_classname": "option-card-icon"}, - "_label": "conditionOptions.longTermDisability", - "_default_message": "Any medical or developmental condition that has lasted, or is expected to last, more than 12 months", - }, - "blindOrVisuallyImpaired": { - "icon": {"_name": "BlindOrVisuallyImpaired", "_classname": "option-card-icon"}, - "_label": "conditionOptions.blindOrVisuallyImpaired", - "_default_message": "Blind or visually impaired", - }, - }, - } + condition_options = {"you": {"student": {"icon": {"_name": "Student", "_classname": "option-card-icon"}, "_label": "conditionOptions.student", "_default_message": "Student at a college, university, or other post-secondary institution like a job-training program"}, "disabled": {"icon": {"_name": "Disabled", "_classname": "option-card-icon"}, "_label": "conditionOptions.disabled", "_default_message": "Have any disabilities that make you unable to work now or in the future"}, "pregnant": {"icon": {"_name": "Pregnant", "_classname": "option-card-icon"}, "_label": "conditionOptions.pregnant", "_default_message": "Pregnant"}, "longTermDisability": {"icon": {"_name": "LongTermDisability", "_classname": "option-card-icon"}, "_label": "conditionOptions.longTermDisability", "_default_message": "Any medical or developmental condition that has lasted, or is expected to last, more than 12 months"}, "blindOrVisuallyImpaired": {"icon": {"_name": "BlindOrVisuallyImpaired", "_classname": "option-card-icon"}, "_label": "conditionOptions.blindOrVisuallyImpaired", "_default_message": "Blind or visually impaired"}}, "them": {"student": {"icon": {"_name": "Student", "_classname": "option-card-icon"}, "_label": "conditionOptions.student", "_default_message": "Student at a college, university, or other post-secondary institution like a job-training program"}, "disabled": {"icon": {"_name": "Disabled", "_classname": "option-card-icon"}, "_label": "conditionOptions.disabled-them", "_default_message": "Have any disabilities that make them unable to work now or in the future"}, "pregnant": {"icon": {"_name": "Pregnant", "_classname": "option-card-icon"}, "_label": "conditionOptions.pregnant", "_default_message": "Pregnant"}, "longTermDisability": {"icon": {"_name": "LongTermDisability", "_classname": "option-card-icon"}, "_label": "conditionOptions.longTermDisability", "_default_message": "Any medical or developmental condition that has lasted, or is expected to last, more than 12 months"}, "blindOrVisuallyImpaired": {"icon": {"_name": "BlindOrVisuallyImpaired", "_classname": "option-card-icon"}, "_label": "conditionOptions.blindOrVisuallyImpaired", "_default_message": "Blind or visually impaired"}}} - co_zipcodes = { - "80001": "80001", - "80002": "80002", - "80003": "80003", - "80004": "80004", - "80005": "80005", - "80006": "80006", - "80007": "80007", - "80010": "80010", - "80011": "80011", - "80012": "80012", - "80013": "80013", - "80014": "80014", - "80015": "80015", - "80016": "80016", - "80017": "80017", - "80018": "80018", - "80019": "80019", - "80020": "80020", - "80021": "80021", - "80022": "80022", - "80023": "80023", - "80024": "80024", - "80025": "80025", - "80026": "80026", - "80027": "80027", - "80028": "80028", - "80030": "80030", - "80031": "80031", - "80033": "80033", - "80034": "80034", - "80035": "80035", - "80036": "80036", - "80037": "80037", - "80038": "80038", - "80040": "80040", - "80041": "80041", - "80042": "80042", - "80044": "80044", - "80045": "80045", - "80046": "80046", - "80047": "80047", - "80101": "80101", - "80102": "80102", - "80103": "80103", - "80104": "80104", - "80105": "80105", - "80106": "80106", - "80107": "80107", - "80108": "80108", - "80109": "80109", - "80110": "80110", - "80111": "80111", - "80112": "80112", - "80113": "80113", - "80116": "80116", - "80117": "80117", - "80118": "80118", - "80120": "80120", - "80121": "80121", - "80122": "80122", - "80123": "80123", - "80124": "80124", - "80125": "80125", - "80126": "80126", - "80127": "80127", - "80128": "80128", - "80129": "80129", - "80130": "80130", - "80131": "80131", - "80132": "80132", - "80133": "80133", - "80134": "80134", - "80135": "80135", - "80136": "80136", - "80137": "80137", - "80138": "80138", - "80150": "80150", - "80151": "80151", - "80155": "80155", - "80160": "80160", - "80161": "80161", - "80162": "80162", - "80163": "80163", - "80165": "80165", - "80166": "80166", - "80201": "80201", - "80202": "80202", - "80203": "80203", - "80204": "80204", - "80205": "80205", - "80206": "80206", - "80207": "80207", - "80208": "80208", - "80209": "80209", - "80210": "80210", - "80211": "80211", - "80212": "80212", - "80214": "80214", - "80215": "80215", - "80216": "80216", - "80217": "80217", - "80218": "80218", - "80219": "80219", - "80220": "80220", - "80221": "80221", - "80222": "80222", - "80223": "80223", - "80224": "80224", - "80225": "80225", - "80226": "80226", - "80227": "80227", - "80228": "80228", - "80229": "80229", - "80230": "80230", - "80231": "80231", - "80232": "80232", - "80233": "80233", - "80234": "80234", - "80235": "80235", - "80236": "80236", - "80237": "80237", - "80238": "80238", - "80239": "80239", - "80241": "80241", - "80243": "80243", - "80244": "80244", - "80246": "80246", - "80247": "80247", - "80248": "80248", - "80249": "80249", - "80250": "80250", - "80251": "80251", - "80252": "80252", - "80256": "80256", - "80257": "80257", - "80259": "80259", - "80260": "80260", - "80261": "80261", - "80262": "80262", - "80263": "80263", - "80264": "80264", - "80265": "80265", - "80266": "80266", - "80271": "80271", - "80273": "80273", - "80274": "80274", - "80279": "80279", - "80280": "80280", - "80281": "80281", - "80290": "80290", - "80291": "80291", - "80293": "80293", - "80294": "80294", - "80295": "80295", - "80299": "80299", - "80301": "80301", - "80302": "80302", - "80303": "80303", - "80304": "80304", - "80305": "80305", - "80306": "80306", - "80307": "80307", - "80308": "80308", - "80309": "80309", - "80310": "80310", - "80314": "80314", - "80321": "80321", - "80322": "80322", - "80323": "80323", - "80328": "80328", - "80329": "80329", - "80401": "80401", - "80402": "80402", - "80403": "80403", - "80419": "80419", - "80420": "80420", - "80421": "80421", - "80422": "80422", - "80423": "80423", - "80424": "80424", - "80425": "80425", - "80426": "80426", - "80427": "80427", - "80428": "80428", - "80429": "80429", - "80430": "80430", - "80432": "80432", - "80433": "80433", - "80434": "80434", - "80435": "80435", - "80436": "80436", - "80437": "80437", - "80438": "80438", - "80439": "80439", - "80440": "80440", - "80442": "80442", - "80443": "80443", - "80444": "80444", - "80446": "80446", - "80447": "80447", - "80448": "80448", - "80449": "80449", - "80451": "80451", - "80452": "80452", - "80453": "80453", - "80454": "80454", - "80455": "80455", - "80456": "80456", - "80457": "80457", - "80459": "80459", - "80461": "80461", - "80463": "80463", - "80465": "80465", - "80466": "80466", - "80467": "80467", - "80468": "80468", - "80469": "80469", - "80470": "80470", - "80471": "80471", - "80473": "80473", - "80474": "80474", - "80475": "80475", - "80476": "80476", - "80477": "80477", - "80478": "80478", - "80479": "80479", - "80480": "80480", - "80481": "80481", - "80482": "80482", - "80483": "80483", - "80487": "80487", - "80488": "80488", - "80497": "80497", - "80498": "80498", - "80501": "80501", - "80502": "80502", - "80503": "80503", - "80504": "80504", - "80510": "80510", - "80511": "80511", - "80512": "80512", - "80513": "80513", - "80514": "80514", - "80515": "80515", - "80516": "80516", - "80517": "80517", - "80520": "80520", - "80521": "80521", - "80522": "80522", - "80523": "80523", - "80524": "80524", - "80525": "80525", - "80526": "80526", - "80527": "80527", - "80528": "80528", - "80530": "80530", - "80532": "80532", - "80533": "80533", - "80534": "80534", - "80535": "80535", - "80536": "80536", - "80537": "80537", - "80538": "80538", - "80539": "80539", - "80540": "80540", - "80541": "80541", - "80542": "80542", - "80543": "80543", - "80544": "80544", - "80545": "80545", - "80546": "80546", - "80547": "80547", - "80549": "80549", - "80550": "80550", - "80551": "80551", - "80553": "80553", - "80601": "80601", - "80602": "80602", - "80603": "80603", - "80610": "80610", - "80611": "80611", - "80612": "80612", - "80614": "80614", - "80615": "80615", - "80620": "80620", - "80621": "80621", - "80622": "80622", - "80623": "80623", - "80624": "80624", - "80631": "80631", - "80632": "80632", - "80633": "80633", - "80634": "80634", - "80638": "80638", - "80639": "80639", - "80640": "80640", - "80642": "80642", - "80643": "80643", - "80644": "80644", - "80645": "80645", - "80646": "80646", - "80648": "80648", - "80649": "80649", - "80650": "80650", - "80651": "80651", - "80652": "80652", - "80653": "80653", - "80654": "80654", - "80701": "80701", - "80705": "80705", - "80720": "80720", - "80721": "80721", - "80722": "80722", - "80723": "80723", - "80726": "80726", - "80727": "80727", - "80728": "80728", - "80729": "80729", - "80731": "80731", - "80732": "80732", - "80733": "80733", - "80734": "80734", - "80735": "80735", - "80736": "80736", - "80737": "80737", - "80740": "80740", - "80741": "80741", - "80742": "80742", - "80743": "80743", - "80744": "80744", - "80745": "80745", - "80746": "80746", - "80747": "80747", - "80749": "80749", - "80750": "80750", - "80751": "80751", - "80754": "80754", - "80755": "80755", - "80757": "80757", - "80758": "80758", - "80759": "80759", - "80801": "80801", - "80802": "80802", - "80804": "80804", - "80805": "80805", - "80807": "80807", - "80808": "80808", - "80809": "80809", - "80810": "80810", - "80812": "80812", - "80813": "80813", - "80814": "80814", - "80815": "80815", - "80816": "80816", - "80817": "80817", - "80818": "80818", - "80819": "80819", - "80820": "80820", - "80821": "80821", - "80822": "80822", - "80823": "80823", - "80824": "80824", - "80825": "80825", - "80826": "80826", - "80827": "80827", - "80828": "80828", - "80829": "80829", - "80830": "80830", - "80831": "80831", - "80832": "80832", - "80833": "80833", - "80834": "80834", - "80835": "80835", - "80836": "80836", - "80840": "80840", - "80841": "80841", - "80860": "80860", - "80861": "80861", - "80862": "80862", - "80863": "80863", - "80864": "80864", - "80866": "80866", - "80901": "80901", - "80902": "80902", - "80903": "80903", - "80904": "80904", - "80905": "80905", - "80906": "80906", - "80907": "80907", - "80908": "80908", - "80909": "80909", - "80910": "80910", - "80911": "80911", - "80912": "80912", - "80913": "80913", - "80914": "80914", - "80915": "80915", - "80916": "80916", - "80917": "80917", - "80918": "80918", - "80919": "80919", - "80920": "80920", - "80921": "80921", - "80922": "80922", - "80923": "80923", - "80924": "80924", - "80925": "80925", - "80926": "80926", - "80927": "80927", - "80928": "80928", - "80929": "80929", - "80930": "80930", - "80931": "80931", - "80932": "80932", - "80933": "80933", - "80934": "80934", - "80935": "80935", - "80936": "80936", - "80937": "80937", - "80938": "80938", - "80939": "80939", - "80940": "80940", - "80941": "80941", - "80942": "80942", - "80943": "80943", - "80944": "80944", - "80945": "80945", - "80946": "80946", - "80947": "80947", - "80949": "80949", - "80950": "80950", - "80951": "80951", - "80960": "80960", - "80962": "80962", - "80970": "80970", - "80977": "80977", - "80995": "80995", - "80997": "80997", - "81001": "81001", - "81002": "81002", - "81003": "81003", - "81004": "81004", - "81005": "81005", - "81006": "81006", - "81007": "81007", - "81008": "81008", - "81009": "81009", - "81010": "81010", - "81011": "81011", - "81012": "81012", - "81019": "81019", - "81020": "81020", - "81021": "81021", - "81022": "81022", - "81023": "81023", - "81024": "81024", - "81025": "81025", - "81027": "81027", - "81029": "81029", - "81030": "81030", - "81033": "81033", - "81034": "81034", - "81036": "81036", - "81038": "81038", - "81039": "81039", - "81040": "81040", - "81041": "81041", - "81043": "81043", - "81044": "81044", - "81045": "81045", - "81046": "81046", - "81047": "81047", - "81049": "81049", - "81050": "81050", - "81052": "81052", - "81054": "81054", - "81055": "81055", - "81057": "81057", - "81058": "81058", - "81059": "81059", - "81062": "81062", - "81063": "81063", - "81064": "81064", - "81067": "81067", - "81069": "81069", - "81071": "81071", - "81073": "81073", - "81075": "81075", - "81076": "81076", - "81077": "81077", - "81081": "81081", - "81082": "81082", - "81084": "81084", - "81087": "81087", - "81089": "81089", - "81090": "81090", - "81091": "81091", - "81092": "81092", - "81101": "81101", - "81102": "81102", - "81120": "81120", - "81121": "81121", - "81122": "81122", - "81123": "81123", - "81124": "81124", - "81125": "81125", - "81126": "81126", - "81127": "81127", - "81128": "81128", - "81129": "81129", - "81130": "81130", - "81131": "81131", - "81132": "81132", - "81133": "81133", - "81134": "81134", - "81135": "81135", - "81136": "81136", - "81137": "81137", - "81138": "81138", - "81140": "81140", - "81141": "81141", - "81143": "81143", - "81144": "81144", - "81146": "81146", - "81147": "81147", - "81148": "81148", - "81149": "81149", - "81151": "81151", - "81152": "81152", - "81153": "81153", - "81154": "81154", - "81155": "81155", - "81157": "81157", - "81201": "81201", - "81210": "81210", - "81211": "81211", - "81212": "81212", - "81215": "81215", - "81220": "81220", - "81221": "81221", - "81222": "81222", - "81223": "81223", - "81224": "81224", - "81225": "81225", - "81226": "81226", - "81227": "81227", - "81228": "81228", - "81230": "81230", - "81231": "81231", - "81232": "81232", - "81233": "81233", - "81235": "81235", - "81236": "81236", - "81237": "81237", - "81239": "81239", - "81240": "81240", - "81241": "81241", - "81242": "81242", - "81243": "81243", - "81244": "81244", - "81247": "81247", - "81248": "81248", - "81251": "81251", - "81252": "81252", - "81253": "81253", - "81290": "81290", - "81301": "81301", - "81302": "81302", - "81303": "81303", - "81320": "81320", - "81321": "81321", - "81323": "81323", - "81324": "81324", - "81325": "81325", - "81326": "81326", - "81327": "81327", - "81328": "81328", - "81329": "81329", - "81330": "81330", - "81331": "81331", - "81332": "81332", - "81334": "81334", - "81335": "81335", - "81401": "81401", - "81402": "81402", - "81403": "81403", - "81410": "81410", - "81411": "81411", - "81413": "81413", - "81414": "81414", - "81415": "81415", - "81416": "81416", - "81418": "81418", - "81419": "81419", - "81420": "81420", - "81422": "81422", - "81423": "81423", - "81424": "81424", - "81425": "81425", - "81426": "81426", - "81427": "81427", - "81428": "81428", - "81429": "81429", - "81430": "81430", - "81431": "81431", - "81432": "81432", - "81433": "81433", - "81434": "81434", - "81435": "81435", - "81501": "81501", - "81502": "81502", - "81503": "81503", - "81504": "81504", - "81505": "81505", - "81506": "81506", - "81507": "81507", - "81520": "81520", - "81521": "81521", - "81522": "81522", - "81523": "81523", - "81524": "81524", - "81525": "81525", - "81526": "81526", - "81527": "81527", - "81601": "81601", - "81602": "81602", - "81610": "81610", - "81611": "81611", - "81612": "81612", - "81615": "81615", - "81620": "81620", - "81621": "81621", - "81623": "81623", - "81624": "81624", - "81625": "81625", - "81626": "81626", - "81630": "81630", - "81631": "81631", - "81632": "81632", - "81633": "81633", - "81635": "81635", - "81636": "81636", - "81637": "81637", - "81638": "81638", - "81639": "81639", - "81640": "81640", - "81641": "81641", - "81642": "81642", - "81643": "81643", - "81645": "81645", - "81646": "81646", - "81647": "81647", - "81648": "81648", - "81649": "81649", - "81650": "81650", - "81652": "81652", - "81653": "81653", - "81654": "81654", - "81655": "81655", - "81656": "81656", - "81657": "81657", - "81658": "81658", - } + co_zipcodes = {"80001": "80001", "80002": "80002", "80003": "80003", "80004": "80004", "80005": "80005", "80006": "80006", "80007": "80007", "80010": "80010", "80011": "80011", "80012": "80012", "80013": "80013", "80014": "80014", "80015": "80015", "80016": "80016", "80017": "80017", "80018": "80018", "80019": "80019", "80020": "80020", "80021": "80021", "80022": "80022", "80023": "80023", "80024": "80024", "80025": "80025", "80026": "80026", "80027": "80027", "80028": "80028", "80030": "80030", "80031": "80031", "80033": "80033", "80034": "80034", "80035": "80035", "80036": "80036", "80037": "80037", "80038": "80038", "80040": "80040", "80041": "80041", "80042": "80042", "80044": "80044", "80045": "80045", "80046": "80046", "80047": "80047", "80101": "80101", "80102": "80102", "80103": "80103", "80104": "80104", "80105": "80105", "80106": "80106", "80107": "80107", "80108": "80108", "80109": "80109", "80110": "80110", "80111": "80111", "80112": "80112", "80113": "80113", "80116": "80116", "80117": "80117", "80118": "80118", "80120": "80120", "80121": "80121", "80122": "80122", "80123": "80123", "80124": "80124", "80125": "80125", "80126": "80126", "80127": "80127", "80128": "80128", "80129": "80129", "80130": "80130", "80131": "80131", "80132": "80132", "80133": "80133", "80134": "80134", "80135": "80135", "80136": "80136", "80137": "80137", "80138": "80138", "80150": "80150", "80151": "80151", "80155": "80155", "80160": "80160", "80161": "80161", "80162": "80162", "80163": "80163", "80165": "80165", "80166": "80166", "80201": "80201", "80202": "80202", "80203": "80203", "80204": "80204", "80205": "80205", "80206": "80206", "80207": "80207", "80208": "80208", "80209": "80209", "80210": "80210", "80211": "80211", "80212": "80212", "80214": "80214", "80215": "80215", "80216": "80216", "80217": "80217", "80218": "80218", "80219": "80219", "80220": "80220", "80221": "80221", "80222": "80222", "80223": "80223", "80224": "80224", "80225": "80225", "80226": "80226", "80227": "80227", "80228": "80228", "80229": "80229", "80230": "80230", "80231": "80231", "80232": "80232", "80233": "80233", "80234": "80234", "80235": "80235", "80236": "80236", "80237": "80237", "80238": "80238", "80239": "80239", "80241": "80241", "80243": "80243", "80244": "80244", "80246": "80246", "80247": "80247", "80248": "80248", "80249": "80249", "80250": "80250", "80251": "80251", "80252": "80252", "80256": "80256", "80257": "80257", "80259": "80259", "80260": "80260", "80261": "80261", "80262": "80262", "80263": "80263", "80264": "80264", "80265": "80265", "80266": "80266", "80271": "80271", "80273": "80273", "80274": "80274", "80279": "80279", "80280": "80280", "80281": "80281", "80290": "80290", "80291": "80291", "80293": "80293", "80294": "80294", "80295": "80295", "80299": "80299", "80301": "80301", "80302": "80302", "80303": "80303", "80304": "80304", "80305": "80305", "80306": "80306", "80307": "80307", "80308": "80308", "80309": "80309", "80310": "80310", "80314": "80314", "80321": "80321", "80322": "80322", "80323": "80323", "80328": "80328", "80329": "80329", "80401": "80401", "80402": "80402", "80403": "80403", "80419": "80419", "80420": "80420", "80421": "80421", "80422": "80422", "80423": "80423", "80424": "80424", "80425": "80425", "80426": "80426", "80427": "80427", "80428": "80428", "80429": "80429", "80430": "80430", "80432": "80432", "80433": "80433", "80434": "80434", "80435": "80435", "80436": "80436", "80437": "80437", "80438": "80438", "80439": "80439", "80440": "80440", "80442": "80442", "80443": "80443", "80444": "80444", "80446": "80446", "80447": "80447", "80448": "80448", "80449": "80449", "80451": "80451", "80452": "80452", "80453": "80453", "80454": "80454", "80455": "80455", "80456": "80456", "80457": "80457", "80459": "80459", "80461": "80461", "80463": "80463", "80465": "80465", "80466": "80466", "80467": "80467", "80468": "80468", "80469": "80469", "80470": "80470", "80471": "80471", "80473": "80473", "80474": "80474", "80475": "80475", "80476": "80476", "80477": "80477", "80478": "80478", "80479": "80479", "80480": "80480", "80481": "80481", "80482": "80482", "80483": "80483", "80487": "80487", "80488": "80488", "80497": "80497", "80498": "80498", "80501": "80501", "80502": "80502", "80503": "80503", "80504": "80504", "80510": "80510", "80511": "80511", "80512": "80512", "80513": "80513", "80514": "80514", "80515": "80515", "80516": "80516", "80517": "80517", "80520": "80520", "80521": "80521", "80522": "80522", "80523": "80523", "80524": "80524", "80525": "80525", "80526": "80526", "80527": "80527", "80528": "80528", "80530": "80530", "80532": "80532", "80533": "80533", "80534": "80534", "80535": "80535", "80536": "80536", "80537": "80537", "80538": "80538", "80539": "80539", "80540": "80540", "80541": "80541", "80542": "80542", "80543": "80543", "80544": "80544", "80545": "80545", "80546": "80546", "80547": "80547", "80549": "80549", "80550": "80550", "80551": "80551", "80553": "80553", "80601": "80601", "80602": "80602", "80603": "80603", "80610": "80610", "80611": "80611", "80612": "80612", "80614": "80614", "80615": "80615", "80620": "80620", "80621": "80621", "80622": "80622", "80623": "80623", "80624": "80624", "80631": "80631", "80632": "80632", "80633": "80633", "80634": "80634", "80638": "80638", "80639": "80639", "80640": "80640", "80642": "80642", "80643": "80643", "80644": "80644", "80645": "80645", "80646": "80646", "80648": "80648", "80649": "80649", "80650": "80650", "80651": "80651", "80652": "80652", "80653": "80653", "80654": "80654", "80701": "80701", "80705": "80705", "80720": "80720", "80721": "80721", "80722": "80722", "80723": "80723", "80726": "80726", "80727": "80727", "80728": "80728", "80729": "80729", "80731": "80731", "80732": "80732", "80733": "80733", "80734": "80734", "80735": "80735", "80736": "80736", "80737": "80737", "80740": "80740", "80741": "80741", "80742": "80742", "80743": "80743", "80744": "80744", "80745": "80745", "80746": "80746", "80747": "80747", "80749": "80749", "80750": "80750", "80751": "80751", "80754": "80754", "80755": "80755", "80757": "80757", "80758": "80758", "80759": "80759", "80801": "80801", "80802": "80802", "80804": "80804", "80805": "80805", "80807": "80807", "80808": "80808", "80809": "80809", "80810": "80810", "80812": "80812", "80813": "80813", "80814": "80814", "80815": "80815", "80816": "80816", "80817": "80817", "80818": "80818", "80819": "80819", "80820": "80820", "80821": "80821", "80822": "80822", "80823": "80823", "80824": "80824", "80825": "80825", "80826": "80826", "80827": "80827", "80828": "80828", "80829": "80829", "80830": "80830", "80831": "80831", "80832": "80832", "80833": "80833", "80834": "80834", "80835": "80835", "80836": "80836", "80840": "80840", "80841": "80841", "80860": "80860", "80861": "80861", "80862": "80862", "80863": "80863", "80864": "80864", "80866": "80866", "80901": "80901", "80902": "80902", "80903": "80903", "80904": "80904", "80905": "80905", "80906": "80906", "80907": "80907", "80908": "80908", "80909": "80909", "80910": "80910", "80911": "80911", "80912": "80912", "80913": "80913", "80914": "80914", "80915": "80915", "80916": "80916", "80917": "80917", "80918": "80918", "80919": "80919", "80920": "80920", "80921": "80921", "80922": "80922", "80923": "80923", "80924": "80924", "80925": "80925", "80926": "80926", "80927": "80927", "80928": "80928", "80929": "80929", "80930": "80930", "80931": "80931", "80932": "80932", "80933": "80933", "80934": "80934", "80935": "80935", "80936": "80936", "80937": "80937", "80938": "80938", "80939": "80939", "80940": "80940", "80941": "80941", "80942": "80942", "80943": "80943", "80944": "80944", "80945": "80945", "80946": "80946", "80947": "80947", "80949": "80949", "80950": "80950", "80951": "80951", "80960": "80960", "80962": "80962", "80970": "80970", "80977": "80977", "80995": "80995", "80997": "80997", "81001": "81001", "81002": "81002", "81003": "81003", "81004": "81004", "81005": "81005", "81006": "81006", "81007": "81007", "81008": "81008", "81009": "81009", "81010": "81010", "81011": "81011", "81012": "81012", "81019": "81019", "81020": "81020", "81021": "81021", "81022": "81022", "81023": "81023", "81024": "81024", "81025": "81025", "81027": "81027", "81029": "81029", "81030": "81030", "81033": "81033", "81034": "81034", "81036": "81036", "81038": "81038", "81039": "81039", "81040": "81040", "81041": "81041", "81043": "81043", "81044": "81044", "81045": "81045", "81046": "81046", "81047": "81047", "81049": "81049", "81050": "81050", "81052": "81052", "81054": "81054", "81055": "81055", "81057": "81057", "81058": "81058", "81059": "81059", "81062": "81062", "81063": "81063", "81064": "81064", "81067": "81067", "81069": "81069", "81071": "81071", "81073": "81073", "81075": "81075", "81076": "81076", "81077": "81077", "81081": "81081", "81082": "81082", "81084": "81084", "81087": "81087", "81089": "81089", "81090": "81090", "81091": "81091", "81092": "81092", "81101": "81101", "81102": "81102", "81120": "81120", "81121": "81121", "81122": "81122", "81123": "81123", "81124": "81124", "81125": "81125", "81126": "81126", "81127": "81127", "81128": "81128", "81129": "81129", "81130": "81130", "81131": "81131", "81132": "81132", "81133": "81133", "81134": "81134", "81135": "81135", "81136": "81136", "81137": "81137", "81138": "81138", "81140": "81140", "81141": "81141", "81143": "81143", "81144": "81144", "81146": "81146", "81147": "81147", "81148": "81148", "81149": "81149", "81151": "81151", "81152": "81152", "81153": "81153", "81154": "81154", "81155": "81155", "81157": "81157", "81201": "81201", "81210": "81210", "81211": "81211", "81212": "81212", "81215": "81215", "81220": "81220", "81221": "81221", "81222": "81222", "81223": "81223", "81224": "81224", "81225": "81225", "81226": "81226", "81227": "81227", "81228": "81228", "81230": "81230", "81231": "81231", "81232": "81232", "81233": "81233", "81235": "81235", "81236": "81236", "81237": "81237", "81239": "81239", "81240": "81240", "81241": "81241", "81242": "81242", "81243": "81243", "81244": "81244", "81247": "81247", "81248": "81248", "81251": "81251", "81252": "81252", "81253": "81253", "81290": "81290", "81301": "81301", "81302": "81302", "81303": "81303", "81320": "81320", "81321": "81321", "81323": "81323", "81324": "81324", "81325": "81325", "81326": "81326", "81327": "81327", "81328": "81328", "81329": "81329", "81330": "81330", "81331": "81331", "81332": "81332", "81334": "81334", "81335": "81335", "81401": "81401", "81402": "81402", "81403": "81403", "81410": "81410", "81411": "81411", "81413": "81413", "81414": "81414", "81415": "81415", "81416": "81416", "81418": "81418", "81419": "81419", "81420": "81420", "81422": "81422", "81423": "81423", "81424": "81424", "81425": "81425", "81426": "81426", "81427": "81427", "81428": "81428", "81429": "81429", "81430": "81430", "81431": "81431", "81432": "81432", "81433": "81433", "81434": "81434", "81435": "81435", "81501": "81501", "81502": "81502", "81503": "81503", "81504": "81504", "81505": "81505", "81506": "81506", "81507": "81507", "81520": "81520", "81521": "81521", "81522": "81522", "81523": "81523", "81524": "81524", "81525": "81525", "81526": "81526", "81527": "81527", "81601": "81601", "81602": "81602", "81610": "81610", "81611": "81611", "81612": "81612", "81615": "81615", "81620": "81620", "81621": "81621", "81623": "81623", "81624": "81624", "81625": "81625", "81626": "81626", "81630": "81630", "81631": "81631", "81632": "81632", "81633": "81633", "81635": "81635", "81636": "81636", "81637": "81637", "81638": "81638", "81639": "81639", "81640": "81640", "81641": "81641", "81642": "81642", "81643": "81643", "81645": "81645", "81646": "81646", "81647": "81647", "81648": "81648", "81649": "81649", "81650": "81650", "81652": "81652", "81653": "81653", "81654": "81654", "81655": "81655", "81656": "81656", "81657": "81657", "81658": "81658"} + + counties_by_zipcode = {"80002": {"Adams County": "Adams County", "Denver County": "Denver County", "Jefferson County": "Jefferson County"}, "80003": {"Adams County": "Adams County", "Jefferson County": "Jefferson County"}, "80004": {"Jefferson County": "Jefferson County"}, "80005": {"Jefferson County": "Jefferson County", "Broomfield County": "Broomfield County"}, "80007": {"Boulder County": "Boulder County", "Jefferson County": "Jefferson County", "Broomfield County": "Broomfield County"}, "80010": {"Adams County": "Adams County", "Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80011": {"Adams County": "Adams County", "Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80012": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80013": {"Arapahoe County": "Arapahoe County"}, "80014": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80015": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80016": {"Denver County": "Denver County", "Elbert County": "Elbert County", "Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, "80017": {"Arapahoe County": "Arapahoe County"}, "80018": {"Adams County": "Adams County", "Arapahoe County": "Arapahoe County"}, "80019": {"Adams County": "Adams County", "Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80020": {"Adams County": "Adams County", "Boulder County": "Boulder County", "Jefferson County": "Jefferson County", "Broomfield County": "Broomfield County"}, "80021": {"Boulder County": "Boulder County", "Jefferson County": "Jefferson County", "Broomfield County": "Broomfield County"}, "80022": {"Adams County": "Adams County", "Denver County": "Denver County"}, "80023": {"Weld County": "Weld County", "Adams County": "Adams County", "Boulder County": "Boulder County", "Broomfield County": "Broomfield County"}, "80024": {"Adams County": "Adams County"}, "80025": {"Boulder County": "Boulder County", "Jefferson County": "Jefferson County"}, "80026": {"Weld County": "Weld County", "Boulder County": "Boulder County", "Broomfield County": "Broomfield County"}, "80027": {"Boulder County": "Boulder County", "Jefferson County": "Jefferson County", "Broomfield County": "Broomfield County"}, "80030": {"Adams County": "Adams County", "Jefferson County": "Jefferson County"}, "80031": {"Adams County": "Adams County", "Jefferson County": "Jefferson County", "Broomfield County": "Broomfield County"}, "80033": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, "80045": {"Adams County": "Adams County", "Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80101": {"Elbert County": "Elbert County", "Arapahoe County": "Arapahoe County"}, "80102": {"Weld County": "Weld County", "Adams County": "Adams County", "Elbert County": "Elbert County", "Arapahoe County": "Arapahoe County"}, "80103": {"Adams County": "Adams County", "Elbert County": "Elbert County", "Morgan County": "Morgan County", "Arapahoe County": "Arapahoe County"}, "80104": {"Douglas County": "Douglas County"}, "80105": {"Adams County": "Adams County", "Elbert County": "Elbert County", "Lincoln County": "Lincoln County", "Arapahoe County": "Arapahoe County", "Washington County": "Washington County"}, "80106": {"Elbert County": "Elbert County", "Douglas County": "Douglas County", "El Paso County": "El Paso County"}, "80107": {"Elbert County": "Elbert County", "Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, "80108": {"Douglas County": "Douglas County"}, "80109": {"Douglas County": "Douglas County"}, "80110": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80111": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80112": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, "80113": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80116": {"Elbert County": "Elbert County", "Douglas County": "Douglas County"}, "80117": {"Elbert County": "Elbert County"}, "80118": {"Elbert County": "Elbert County", "Douglas County": "Douglas County", "El Paso County": "El Paso County"}, "80120": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, "80121": {"Arapahoe County": "Arapahoe County"}, "80122": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, "80123": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County", "Jefferson County": "Jefferson County"}, "80124": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, "80125": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County", "Jefferson County": "Jefferson County"}, "80126": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, "80127": {"Denver County": "Denver County", "Douglas County": "Douglas County", "Jefferson County": "Jefferson County"}, "80128": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County", "Jefferson County": "Jefferson County"}, "80129": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, "80130": {"Douglas County": "Douglas County"}, "80131": {"Douglas County": "Douglas County"}, "80132": {"Douglas County": "Douglas County", "El Paso County": "El Paso County"}, "80133": {"Teller County": "Teller County", "Douglas County": "Douglas County", "El Paso County": "El Paso County"}, "80134": {"Elbert County": "Elbert County", "Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, "80135": {"Park County": "Park County", "Teller County": "Teller County", "Douglas County": "Douglas County", "El Paso County": "El Paso County", "Jefferson County": "Jefferson County"}, "80136": {"Weld County": "Weld County", "Adams County": "Adams County", "Elbert County": "Elbert County", "Arapahoe County": "Arapahoe County"}, "80137": {"Adams County": "Adams County", "Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80138": {"Elbert County": "Elbert County", "Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, "80202": {"Denver County": "Denver County"}, "80203": {"Denver County": "Denver County"}, "80204": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, "80205": {"Denver County": "Denver County"}, "80206": {"Denver County": "Denver County"}, "80207": {"Denver County": "Denver County"}, "80209": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80210": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80211": {"Denver County": "Denver County"}, "80212": {"Adams County": "Adams County", "Denver County": "Denver County", "Jefferson County": "Jefferson County"}, "80214": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, "80215": {"Jefferson County": "Jefferson County"}, "80216": {"Adams County": "Adams County", "Denver County": "Denver County"}, "80218": {"Denver County": "Denver County"}, "80219": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County", "Jefferson County": "Jefferson County"}, "80220": {"Adams County": "Adams County", "Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80221": {"Adams County": "Adams County", "Denver County": "Denver County"}, "80222": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80223": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80224": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80226": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, "80227": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, "80228": {"Jefferson County": "Jefferson County"}, "80229": {"Adams County": "Adams County"}, "80230": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80231": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80232": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, "80233": {"Adams County": "Adams County"}, "80234": {"Adams County": "Adams County", "Broomfield County": "Broomfield County"}, "80235": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, "80236": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County", "Jefferson County": "Jefferson County"}, "80237": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80238": {"Adams County": "Adams County", "Denver County": "Denver County"}, "80239": {"Adams County": "Adams County", "Denver County": "Denver County"}, "80241": {"Adams County": "Adams County"}, "80246": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80247": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80249": {"Adams County": "Adams County", "Denver County": "Denver County"}, "80260": {"Adams County": "Adams County"}, "80264": {"Denver County": "Denver County"}, "80290": {"Denver County": "Denver County"}, "80293": {"Denver County": "Denver County"}, "80294": {"Denver County": "Denver County"}, "80301": {"Boulder County": "Boulder County"}, "80302": {"Boulder County": "Boulder County"}, "80303": {"Boulder County": "Boulder County", "Jefferson County": "Jefferson County"}, "80304": {"Boulder County": "Boulder County"}, "80305": {"Boulder County": "Boulder County"}, "80310": {"Boulder County": "Boulder County"}, "80401": {"Jefferson County": "Jefferson County"}, "80403": {"Gilpin County": "Gilpin County", "Boulder County": "Boulder County", "Jefferson County": "Jefferson County", "Clear Creek County": "Clear Creek County"}, "80419": {"Jefferson County": "Jefferson County"}, "80420": {"Lake County": "Lake County", "Park County": "Park County", "Summit County": "Summit County"}, "80421": {"Park County": "Park County", "Jefferson County": "Jefferson County", "Clear Creek County": "Clear Creek County"}, "80422": {"Grand County": "Grand County", "Gilpin County": "Gilpin County", "Boulder County": "Boulder County", "Jefferson County": "Jefferson County", "Clear Creek County": "Clear Creek County"}, "80423": {"Eagle County": "Eagle County", "Grand County": "Grand County", "Routt County": "Routt County", "Summit County": "Summit County"}, "80424": {"Lake County": "Lake County", "Park County": "Park County", "Summit County": "Summit County"}, "80425": {"Douglas County": "Douglas County", "Jefferson County": "Jefferson County"}, "80426": {"Eagle County": "Eagle County", "Routt County": "Routt County", "Garfield County": "Garfield County"}, "80427": {"Gilpin County": "Gilpin County", "Jefferson County": "Jefferson County", "Clear Creek County": "Clear Creek County"}, "80428": {"Routt County": "Routt County", "Jackson County": "Jackson County"}, "80432": {"Park County": "Park County"}, "80433": {"Park County": "Park County", "Douglas County": "Douglas County", "Jefferson County": "Jefferson County"}, "80434": {"Jackson County": "Jackson County"}, "80435": {"Park County": "Park County", "Summit County": "Summit County", "Clear Creek County": "Clear Creek County"}, "80436": {"Grand County": "Grand County", "Clear Creek County": "Clear Creek County"}, "80438": {"Grand County": "Grand County", "Clear Creek County": "Clear Creek County"}, "80439": {"Park County": "Park County", "Gilpin County": "Gilpin County", "Jefferson County": "Jefferson County", "Clear Creek County": "Clear Creek County"}, "80440": {"Lake County": "Lake County", "Park County": "Park County", "Summit County": "Summit County"}, "80442": {"Grand County": "Grand County"}, "80443": {"Lake County": "Lake County", "Park County": "Park County", "Eagle County": "Eagle County", "Summit County": "Summit County"}, "80444": {"Park County": "Park County", "Summit County": "Summit County", "Clear Creek County": "Clear Creek County"}, "80446": {"Grand County": "Grand County", "Boulder County": "Boulder County", "Jackson County": "Jackson County"}, "80447": {"Grand County": "Grand County", "Boulder County": "Boulder County", "Jackson County": "Jackson County", "Larimer County": "Larimer County"}, "80448": {"Park County": "Park County", "Summit County": "Summit County", "Jefferson County": "Jefferson County", "Clear Creek County": "Clear Creek County"}, "80449": {"Lake County": "Lake County", "Park County": "Park County", "Chaffee County": "Chaffee County", "Fremont County": "Fremont County"}, "80451": {"Grand County": "Grand County"}, "80452": {"Park County": "Park County", "Grand County": "Grand County", "Gilpin County": "Gilpin County", "Clear Creek County": "Clear Creek County"}, "80453": {"Jefferson County": "Jefferson County"}, "80454": {"Jefferson County": "Jefferson County"}, "80455": {"Boulder County": "Boulder County"}, "80456": {"Park County": "Park County", "Summit County": "Summit County", "Jefferson County": "Jefferson County"}, "80457": {"Jefferson County": "Jefferson County"}, "80459": {"Eagle County": "Eagle County", "Grand County": "Grand County", "Routt County": "Routt County", "Summit County": "Summit County", "Jackson County": "Jackson County"}, "80461": {"Lake County": "Lake County", "Park County": "Park County", "Eagle County": "Eagle County", "Pitkin County": "Pitkin County", "Summit County": "Summit County", "Chaffee County": "Chaffee County"}, "80463": {"Eagle County": "Eagle County", "Grand County": "Grand County", "Routt County": "Routt County"}, "80465": {"Jefferson County": "Jefferson County"}, "80466": {"Grand County": "Grand County", "Gilpin County": "Gilpin County", "Boulder County": "Boulder County"}, "80467": {"Grand County": "Grand County", "Routt County": "Routt County", "Rio Blanco County": "Rio Blanco County"}, "80468": {"Grand County": "Grand County", "Summit County": "Summit County", "Clear Creek County": "Clear Creek County"}, "80469": {"Routt County": "Routt County", "Rio Blanco County": "Rio Blanco County"}, "80470": {"Park County": "Park County", "Jefferson County": "Jefferson County", "Clear Creek County": "Clear Creek County"}, "80471": {"Gilpin County": "Gilpin County", "Boulder County": "Boulder County"}, "80473": {"Grand County": "Grand County", "Jackson County": "Jackson County"}, "80475": {"Park County": "Park County"}, "80476": {"Grand County": "Grand County", "Summit County": "Summit County", "Clear Creek County": "Clear Creek County"}, "80477": {"Routt County": "Routt County"}, "80478": {"Grand County": "Grand County"}, "80479": {"Eagle County": "Eagle County", "Routt County": "Routt County"}, "80480": {"Grand County": "Grand County", "Routt County": "Routt County", "Jackson County": "Jackson County", "Larimer County": "Larimer County"}, "80481": {"Grand County": "Grand County", "Boulder County": "Boulder County"}, "80482": {"Grand County": "Grand County", "Gilpin County": "Gilpin County", "Boulder County": "Boulder County", "Clear Creek County": "Clear Creek County"}, "80483": {"Routt County": "Routt County", "Garfield County": "Garfield County", "Rio Blanco County": "Rio Blanco County"}, "80487": {"Grand County": "Grand County", "Routt County": "Routt County", "Jackson County": "Jackson County"}, "80488": {"Routt County": "Routt County"}, "80497": {"Grand County": "Grand County", "Summit County": "Summit County", "Clear Creek County": "Clear Creek County"}, "80498": {"Eagle County": "Eagle County", "Grand County": "Grand County", "Summit County": "Summit County"}, "80501": {"Weld County": "Weld County", "Boulder County": "Boulder County"}, "80503": {"Boulder County": "Boulder County", "Larimer County": "Larimer County"}, "80504": {"Weld County": "Weld County", "Boulder County": "Boulder County", "Larimer County": "Larimer County"}, "80510": {"Grand County": "Grand County", "Boulder County": "Boulder County", "Larimer County": "Larimer County"}, "80511": {"Larimer County": "Larimer County"}, "80512": {"Grand County": "Grand County", "Jackson County": "Jackson County", "Larimer County": "Larimer County"}, "80513": {"Weld County": "Weld County", "Boulder County": "Boulder County", "Larimer County": "Larimer County"}, "80514": {"Weld County": "Weld County", "Broomfield County": "Broomfield County"}, "80515": {"Larimer County": "Larimer County"}, "80516": {"Weld County": "Weld County", "Adams County": "Adams County", "Boulder County": "Boulder County", "Broomfield County": "Broomfield County"}, "80517": {"Grand County": "Grand County", "Boulder County": "Boulder County", "Larimer County": "Larimer County"}, "80520": {"Weld County": "Weld County"}, "80521": {"Larimer County": "Larimer County"}, "80524": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, "80525": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, "80526": {"Larimer County": "Larimer County"}, "80528": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, "80530": {"Weld County": "Weld County"}, "80532": {"Larimer County": "Larimer County"}, "80534": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, "80535": {"Larimer County": "Larimer County"}, "80536": {"Larimer County": "Larimer County"}, "80537": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, "80538": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, "80540": {"Boulder County": "Boulder County", "Larimer County": "Larimer County"}, "80542": {"Weld County": "Weld County"}, "80543": {"Weld County": "Weld County"}, "80544": {"Boulder County": "Boulder County"}, "80545": {"Larimer County": "Larimer County"}, "80546": {"Weld County": "Weld County"}, "80547": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, "80549": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, "80550": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, "80601": {"Weld County": "Weld County", "Adams County": "Adams County"}, "80602": {"Weld County": "Weld County", "Adams County": "Adams County", "Broomfield County": "Broomfield County"}, "80603": {"Weld County": "Weld County", "Adams County": "Adams County", "Denver County": "Denver County", "Broomfield County": "Broomfield County"}, "80610": {"Weld County": "Weld County"}, "80611": {"Weld County": "Weld County", "Morgan County": "Morgan County"}, "80612": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, "80615": {"Weld County": "Weld County"}, "80620": {"Weld County": "Weld County"}, "80621": {"Weld County": "Weld County"}, "80622": {"Weld County": "Weld County"}, "80623": {"Weld County": "Weld County"}, "80624": {"Weld County": "Weld County"}, "80631": {"Weld County": "Weld County"}, "80634": {"Weld County": "Weld County"}, "80640": {"Adams County": "Adams County"}, "80642": {"Weld County": "Weld County", "Adams County": "Adams County", "Denver County": "Denver County"}, "80643": {"Weld County": "Weld County", "Adams County": "Adams County"}, "80644": {"Weld County": "Weld County"}, "80645": {"Weld County": "Weld County"}, "80648": {"Weld County": "Weld County"}, "80649": {"Weld County": "Weld County", "Morgan County": "Morgan County"}, "80650": {"Weld County": "Weld County"}, "80651": {"Weld County": "Weld County"}, "80652": {"Weld County": "Weld County", "Adams County": "Adams County", "Morgan County": "Morgan County"}, "80653": {"Morgan County": "Morgan County"}, "80654": {"Weld County": "Weld County", "Adams County": "Adams County", "Morgan County": "Morgan County"}, "80701": {"Weld County": "Weld County", "Adams County": "Adams County", "Morgan County": "Morgan County", "Washington County": "Washington County"}, "80705": {"Morgan County": "Morgan County"}, "80720": {"Yuma County": "Yuma County", "Logan County": "Logan County", "Morgan County": "Morgan County", "Washington County": "Washington County"}, "80721": {"Phillips County": "Phillips County", "Sedgwick County": "Sedgwick County"}, "80722": {"Logan County": "Logan County", "Washington County": "Washington County"}, "80723": {"Morgan County": "Morgan County", "Washington County": "Washington County"}, "80726": {"Logan County": "Logan County", "Sedgwick County": "Sedgwick County"}, "80727": {"Yuma County": "Yuma County"}, "80728": {"Logan County": "Logan County", "Sedgwick County": "Sedgwick County", "Washington County": "Washington County"}, "80729": {"Weld County": "Weld County"}, "80731": {"Yuma County": "Yuma County", "Logan County": "Logan County", "Phillips County": "Phillips County", "Sedgwick County": "Sedgwick County", "Washington County": "Washington County"}, "80733": {"Logan County": "Logan County", "Morgan County": "Morgan County", "Washington County": "Washington County"}, "80734": {"Yuma County": "Yuma County", "Phillips County": "Phillips County", "Sedgwick County": "Sedgwick County"}, "80735": {"Yuma County": "Yuma County", "Kit Carson County": "Kit Carson County"}, "80736": {"Logan County": "Logan County"}, "80737": {"Phillips County": "Phillips County", "Sedgwick County": "Sedgwick County"}, "80740": {"Lincoln County": "Lincoln County", "Washington County": "Washington County"}, "80741": {"Weld County": "Weld County", "Logan County": "Logan County", "Morgan County": "Morgan County", "Washington County": "Washington County"}, "80742": {"Weld County": "Weld County", "Logan County": "Logan County", "Morgan County": "Morgan County"}, "80743": {"Yuma County": "Yuma County", "Logan County": "Logan County", "Washington County": "Washington County"}, "80744": {"Phillips County": "Phillips County", "Sedgwick County": "Sedgwick County"}, "80745": {"Weld County": "Weld County", "Logan County": "Logan County"}, "80746": {"Phillips County": "Phillips County"}, "80747": {"Logan County": "Logan County"}, "80749": {"Logan County": "Logan County", "Phillips County": "Phillips County", "Sedgwick County": "Sedgwick County"}, "80750": {"Weld County": "Weld County", "Logan County": "Logan County", "Morgan County": "Morgan County", "Washington County": "Washington County"}, "80751": {"Logan County": "Logan County", "Washington County": "Washington County"}, "80754": {"Weld County": "Weld County", "Logan County": "Logan County", "Morgan County": "Morgan County"}, "80755": {"Yuma County": "Yuma County"}, "80757": {"Adams County": "Adams County", "Morgan County": "Morgan County", "Lincoln County": "Lincoln County", "Arapahoe County": "Arapahoe County", "Washington County": "Washington County"}, "80758": {"Yuma County": "Yuma County", "Phillips County": "Phillips County"}, "80759": {"Yuma County": "Yuma County", "Logan County": "Logan County", "Phillips County": "Phillips County", "Washington County": "Washington County"}, "80801": {"Washington County": "Washington County"}, "80802": {"Kiowa County": "Kiowa County", "Cheyenne County": "Cheyenne County", "Kit Carson County": "Kit Carson County"}, "80804": {"Lincoln County": "Lincoln County", "Kit Carson County": "Kit Carson County", "Washington County": "Washington County"}, "80805": {"Yuma County": "Yuma County", "Cheyenne County": "Cheyenne County", "Kit Carson County": "Kit Carson County"}, "80807": {"Yuma County": "Yuma County", "Cheyenne County": "Cheyenne County", "Kit Carson County": "Kit Carson County"}, "80808": {"Elbert County": "Elbert County", "El Paso County": "El Paso County"}, "80809": {"Teller County": "Teller County", "El Paso County": "El Paso County"}, "80810": {"Kiowa County": "Kiowa County", "Cheyenne County": "Cheyenne County", "Kit Carson County": "Kit Carson County"}, "80812": {"Yuma County": "Yuma County", "Kit Carson County": "Kit Carson County", "Washington County": "Washington County"}, "80813": {"Teller County": "Teller County", "El Paso County": "El Paso County", "Fremont County": "Fremont County"}, "80814": {"Teller County": "Teller County"}, "80815": {"Lincoln County": "Lincoln County", "Cheyenne County": "Cheyenne County", "Kit Carson County": "Kit Carson County", "Washington County": "Washington County"}, "80816": {"Park County": "Park County", "Teller County": "Teller County", "Fremont County": "Fremont County"}, "80817": {"Pueblo County": "Pueblo County", "El Paso County": "El Paso County"}, "80818": {"Lincoln County": "Lincoln County", "Washington County": "Washington County"}, "80819": {"Teller County": "Teller County", "El Paso County": "El Paso County"}, "80820": {"Park County": "Park County", "Teller County": "Teller County", "Fremont County": "Fremont County"}, "80821": {"Elbert County": "Elbert County", "Lincoln County": "Lincoln County", "Cheyenne County": "Cheyenne County", "Kit Carson County": "Kit Carson County"}, "80822": {"Yuma County": "Yuma County", "Kit Carson County": "Kit Carson County", "Washington County": "Washington County"}, "80823": {"Kiowa County": "Kiowa County", "Crowley County": "Crowley County", "Lincoln County": "Lincoln County", "Cheyenne County": "Cheyenne County"}, "80824": {"Yuma County": "Yuma County", "Kit Carson County": "Kit Carson County"}, "80825": {"Kiowa County": "Kiowa County", "Lincoln County": "Lincoln County", "Cheyenne County": "Cheyenne County", "Kit Carson County": "Kit Carson County"}, "80827": {"Park County": "Park County", "Teller County": "Teller County", "Douglas County": "Douglas County", "Jefferson County": "Jefferson County"}, "80828": {"Elbert County": "Elbert County", "Lincoln County": "Lincoln County", "Arapahoe County": "Arapahoe County", "Washington County": "Washington County"}, "80829": {"Teller County": "Teller County", "El Paso County": "El Paso County"}, "80830": {"Elbert County": "Elbert County", "El Paso County": "El Paso County", "Lincoln County": "Lincoln County"}, "80831": {"Elbert County": "Elbert County", "El Paso County": "El Paso County"}, "80832": {"Elbert County": "Elbert County", "El Paso County": "El Paso County", "Lincoln County": "Lincoln County"}, "80833": {"Elbert County": "Elbert County", "Pueblo County": "Pueblo County", "Crowley County": "Crowley County", "El Paso County": "El Paso County", "Lincoln County": "Lincoln County"}, "80834": {"Cheyenne County": "Cheyenne County", "Kit Carson County": "Kit Carson County", "Washington County": "Washington County"}, "80835": {"Elbert County": "Elbert County", "El Paso County": "El Paso County"}, "80836": {"Yuma County": "Yuma County", "Cheyenne County": "Cheyenne County", "Kit Carson County": "Kit Carson County"}, "80840": {"El Paso County": "El Paso County"}, "80860": {"Teller County": "Teller County", "El Paso County": "El Paso County", "Fremont County": "Fremont County"}, "80861": {"Yuma County": "Yuma County", "Cheyenne County": "Cheyenne County", "Kit Carson County": "Kit Carson County", "Washington County": "Washington County"}, "80862": {"Lincoln County": "Lincoln County", "Cheyenne County": "Cheyenne County", "Kit Carson County": "Kit Carson County"}, "80863": {"Teller County": "Teller County", "Douglas County": "Douglas County", "El Paso County": "El Paso County"}, "80864": {"Pueblo County": "Pueblo County", "Crowley County": "Crowley County", "El Paso County": "El Paso County", "Lincoln County": "Lincoln County"}, "80902": {"El Paso County": "El Paso County"}, "80903": {"El Paso County": "El Paso County"}, "80904": {"El Paso County": "El Paso County"}, "80905": {"El Paso County": "El Paso County"}, "80906": {"Teller County": "Teller County", "El Paso County": "El Paso County"}, "80907": {"El Paso County": "El Paso County"}, "80908": {"Elbert County": "Elbert County", "Douglas County": "Douglas County", "El Paso County": "El Paso County"}, "80909": {"El Paso County": "El Paso County"}, "80910": {"El Paso County": "El Paso County"}, "80911": {"El Paso County": "El Paso County"}, "80913": {"El Paso County": "El Paso County"}, "80914": {"El Paso County": "El Paso County"}, "80915": {"El Paso County": "El Paso County"}, "80916": {"El Paso County": "El Paso County"}, "80917": {"El Paso County": "El Paso County"}, "80918": {"El Paso County": "El Paso County"}, "80919": {"El Paso County": "El Paso County"}, "80920": {"El Paso County": "El Paso County"}, "80921": {"Teller County": "Teller County", "El Paso County": "El Paso County"}, "80922": {"El Paso County": "El Paso County"}, "80923": {"El Paso County": "El Paso County"}, "80924": {"El Paso County": "El Paso County"}, "80925": {"El Paso County": "El Paso County"}, "80926": {"Teller County": "Teller County", "El Paso County": "El Paso County", "Fremont County": "Fremont County"}, "80927": {"El Paso County": "El Paso County"}, "80928": {"Pueblo County": "Pueblo County", "El Paso County": "El Paso County"}, "80929": {"El Paso County": "El Paso County"}, "80930": {"El Paso County": "El Paso County"}, "80938": {"El Paso County": "El Paso County"}, "80939": {"El Paso County": "El Paso County"}, "80951": {"El Paso County": "El Paso County"}, "81001": {"Pueblo County": "Pueblo County"}, "81003": {"Pueblo County": "Pueblo County"}, "81004": {"Pueblo County": "Pueblo County"}, "81005": {"Custer County": "Custer County", "Pueblo County": "Pueblo County", "Fremont County": "Fremont County"}, "81006": {"Pueblo County": "Pueblo County"}, "81007": {"Pueblo County": "Pueblo County", "Fremont County": "Fremont County"}, "81008": {"Pueblo County": "Pueblo County", "El Paso County": "El Paso County"}, "81019": {"Pueblo County": "Pueblo County"}, "81020": {"Pueblo County": "Pueblo County", "Huerfano County": "Huerfano County", "Las Animas County": "Las Animas County"}, "81021": {"Bent County": "Bent County", "Kiowa County": "Kiowa County", "Otero County": "Otero County", "Crowley County": "Crowley County", "Lincoln County": "Lincoln County"}, "81022": {"Pueblo County": "Pueblo County", "Huerfano County": "Huerfano County"}, "81023": {"Custer County": "Custer County", "Pueblo County": "Pueblo County"}, "81024": {"Las Animas County": "Las Animas County"}, "81025": {"Pueblo County": "Pueblo County", "Crowley County": "Crowley County", "El Paso County": "El Paso County", "Lincoln County": "Lincoln County"}, "81027": {"Las Animas County": "Las Animas County"}, "81029": {"Baca County": "Baca County"}, "81030": {"Otero County": "Otero County"}, "81033": {"Crowley County": "Crowley County"}, "81036": {"Bent County": "Bent County", "Kiowa County": "Kiowa County", "Prowers County": "Prowers County", "Cheyenne County": "Cheyenne County"}, "81038": {"Bent County": "Bent County"}, "81039": {"Otero County": "Otero County", "Pueblo County": "Pueblo County", "Crowley County": "Crowley County", "Huerfano County": "Huerfano County", "Las Animas County": "Las Animas County"}, "81040": {"Custer County": "Custer County", "Pueblo County": "Pueblo County", "Alamosa County": "Alamosa County", "Costilla County": "Costilla County", "Huerfano County": "Huerfano County", "Saguache County": "Saguache County"}, "81041": {"Baca County": "Baca County", "Prowers County": "Prowers County"}, "81043": {"Prowers County": "Prowers County"}, "81044": {"Baca County": "Baca County", "Bent County": "Bent County"}, "81045": {"Kiowa County": "Kiowa County", "Lincoln County": "Lincoln County", "Cheyenne County": "Cheyenne County"}, "81047": {"Baca County": "Baca County", "Kiowa County": "Kiowa County", "Prowers County": "Prowers County"}, "81049": {"Baca County": "Baca County", "Bent County": "Bent County", "Otero County": "Otero County", "Las Animas County": "Las Animas County"}, "81050": {"Bent County": "Bent County", "Kiowa County": "Kiowa County", "Otero County": "Otero County", "Crowley County": "Crowley County", "Las Animas County": "Las Animas County"}, "81052": {"Baca County": "Baca County", "Bent County": "Bent County", "Kiowa County": "Kiowa County", "Prowers County": "Prowers County"}, "81054": {"Baca County": "Baca County", "Bent County": "Bent County", "Kiowa County": "Kiowa County", "Otero County": "Otero County", "Las Animas County": "Las Animas County"}, "81055": {"Costilla County": "Costilla County", "Huerfano County": "Huerfano County", "Las Animas County": "Las Animas County"}, "81057": {"Bent County": "Bent County"}, "81058": {"Otero County": "Otero County", "Crowley County": "Crowley County"}, "81059": {"Otero County": "Otero County", "Pueblo County": "Pueblo County", "Las Animas County": "Las Animas County"}, "81062": {"Otero County": "Otero County", "Pueblo County": "Pueblo County", "Crowley County": "Crowley County", "El Paso County": "El Paso County", "Lincoln County": "Lincoln County"}, "81063": {"Otero County": "Otero County", "Crowley County": "Crowley County", "Lincoln County": "Lincoln County"}, "81064": {"Baca County": "Baca County", "Las Animas County": "Las Animas County"}, "81067": {"Otero County": "Otero County", "Pueblo County": "Pueblo County", "Crowley County": "Crowley County", "Las Animas County": "Las Animas County"}, "81069": {"Custer County": "Custer County", "Pueblo County": "Pueblo County", "Huerfano County": "Huerfano County"}, "81071": {"Kiowa County": "Kiowa County", "Prowers County": "Prowers County", "Cheyenne County": "Cheyenne County"}, "81073": {"Baca County": "Baca County", "Bent County": "Bent County", "Prowers County": "Prowers County", "Las Animas County": "Las Animas County"}, "81076": {"Kiowa County": "Kiowa County", "Otero County": "Otero County", "Crowley County": "Crowley County", "Lincoln County": "Lincoln County"}, "81077": {"Otero County": "Otero County"}, "81081": {"Las Animas County": "Las Animas County"}, "81082": {"Las Animas County": "Las Animas County"}, "81084": {"Baca County": "Baca County", "Prowers County": "Prowers County"}, "81087": {"Baca County": "Baca County"}, "81089": {"Pueblo County": "Pueblo County", "Huerfano County": "Huerfano County", "Las Animas County": "Las Animas County"}, "81090": {"Baca County": "Baca County", "Prowers County": "Prowers County"}, "81091": {"Costilla County": "Costilla County", "Huerfano County": "Huerfano County", "Las Animas County": "Las Animas County"}, "81092": {"Bent County": "Bent County", "Kiowa County": "Kiowa County", "Prowers County": "Prowers County"}, "81101": {"Alamosa County": "Alamosa County", "Conejos County": "Conejos County", "Costilla County": "Costilla County", "Rio Grande County": "Rio Grande County"}, "81120": {"Conejos County": "Conejos County", "Costilla County": "Costilla County", "Archuleta County": "Archuleta County", "Rio Grande County": "Rio Grande County"}, "81121": {"La Plata County": "La Plata County", "Archuleta County": "Archuleta County"}, "81122": {"Hinsdale County": "Hinsdale County", "La Plata County": "La Plata County", "San Juan County": "San Juan County", "Archuleta County": "Archuleta County"}, "81123": {"Alamosa County": "Alamosa County", "Conejos County": "Conejos County", "Costilla County": "Costilla County", "Huerfano County": "Huerfano County"}, "81124": {"Conejos County": "Conejos County"}, "81125": {"Alamosa County": "Alamosa County", "Saguache County": "Saguache County", "Rio Grande County": "Rio Grande County"}, "81126": {"Costilla County": "Costilla County"}, "81128": {"Conejos County": "Conejos County", "Archuleta County": "Archuleta County"}, "81129": {"Conejos County": "Conejos County"}, "81130": {"Mineral County": "Mineral County", "Hinsdale County": "Hinsdale County", "Saguache County": "Saguache County", "San Juan County": "San Juan County", "Archuleta County": "Archuleta County", "Rio Grande County": "Rio Grande County"}, "81131": {"Custer County": "Custer County", "Alamosa County": "Alamosa County", "Huerfano County": "Huerfano County", "Saguache County": "Saguache County"}, "81132": {"Conejos County": "Conejos County", "Mineral County": "Mineral County", "Saguache County": "Saguache County", "Rio Grande County": "Rio Grande County"}, "81133": {"Costilla County": "Costilla County", "Huerfano County": "Huerfano County"}, "81136": {"Alamosa County": "Alamosa County", "Saguache County": "Saguache County"}, "81137": {"La Plata County": "La Plata County", "Archuleta County": "Archuleta County"}, "81138": {"Costilla County": "Costilla County"}, "81140": {"Alamosa County": "Alamosa County", "Conejos County": "Conejos County", "Rio Grande County": "Rio Grande County"}, "81141": {"Conejos County": "Conejos County", "Costilla County": "Costilla County"}, "81143": {"Custer County": "Custer County", "Saguache County": "Saguache County"}, "81144": {"Alamosa County": "Alamosa County", "Conejos County": "Conejos County", "Rio Grande County": "Rio Grande County"}, "81146": {"Alamosa County": "Alamosa County", "Costilla County": "Costilla County", "Huerfano County": "Huerfano County", "Saguache County": "Saguache County"}, "81147": {"Conejos County": "Conejos County", "Mineral County": "Mineral County", "Hinsdale County": "Hinsdale County", "La Plata County": "La Plata County", "San Juan County": "San Juan County", "Archuleta County": "Archuleta County", "Rio Grande County": "Rio Grande County"}, "81148": {"Conejos County": "Conejos County"}, "81149": {"Mineral County": "Mineral County", "Saguache County": "Saguache County"}, "81151": {"Alamosa County": "Alamosa County", "Conejos County": "Conejos County", "Costilla County": "Costilla County"}, "81152": {"Conejos County": "Conejos County", "Costilla County": "Costilla County", "Huerfano County": "Huerfano County", "Las Animas County": "Las Animas County"}, "81154": {"Conejos County": "Conejos County", "Mineral County": "Mineral County", "Archuleta County": "Archuleta County", "Rio Grande County": "Rio Grande County"}, "81155": {"Custer County": "Custer County", "Chaffee County": "Chaffee County", "Fremont County": "Fremont County", "Saguache County": "Saguache County"}, "81201": {"Park County": "Park County", "Chaffee County": "Chaffee County", "Fremont County": "Fremont County", "Gunnison County": "Gunnison County", "Saguache County": "Saguache County"}, "81210": {"Pitkin County": "Pitkin County", "Chaffee County": "Chaffee County", "Gunnison County": "Gunnison County"}, "81211": {"Lake County": "Lake County", "Park County": "Park County", "Pitkin County": "Pitkin County", "Chaffee County": "Chaffee County", "Gunnison County": "Gunnison County"}, "81212": {"Park County": "Park County", "Custer County": "Custer County", "Teller County": "Teller County", "Fremont County": "Fremont County"}, "81220": {"Ouray County": "Ouray County", "Gunnison County": "Gunnison County", "Hinsdale County": "Hinsdale County", "Montrose County": "Montrose County"}, "81221": {"Fremont County": "Fremont County"}, "81222": {"Fremont County": "Fremont County", "Saguache County": "Saguache County"}, "81223": {"Custer County": "Custer County", "Fremont County": "Fremont County", "Saguache County": "Saguache County"}, "81224": {"Pitkin County": "Pitkin County", "Gunnison County": "Gunnison County"}, "81225": {"Pitkin County": "Pitkin County", "Gunnison County": "Gunnison County"}, "81226": {"Custer County": "Custer County", "Fremont County": "Fremont County"}, "81227": {"Chaffee County": "Chaffee County"}, "81230": {"Delta County": "Delta County", "Mineral County": "Mineral County", "Gunnison County": "Gunnison County", "Hinsdale County": "Hinsdale County", "Montrose County": "Montrose County", "Saguache County": "Saguache County"}, "81231": {"Gunnison County": "Gunnison County"}, "81232": {"Custer County": "Custer County", "Fremont County": "Fremont County"}, "81233": {"Fremont County": "Fremont County", "Saguache County": "Saguache County"}, "81235": {"Ouray County": "Ouray County", "Mineral County": "Mineral County", "Gunnison County": "Gunnison County", "Hinsdale County": "Hinsdale County", "Saguache County": "Saguache County", "San Juan County": "San Juan County"}, "81236": {"Chaffee County": "Chaffee County", "Gunnison County": "Gunnison County"}, "81237": {"Gunnison County": "Gunnison County"}, "81239": {"Gunnison County": "Gunnison County", "Saguache County": "Saguache County"}, "81240": {"Pueblo County": "Pueblo County", "Teller County": "Teller County", "El Paso County": "El Paso County", "Fremont County": "Fremont County"}, "81241": {"Gunnison County": "Gunnison County"}, "81242": {"Chaffee County": "Chaffee County"}, "81243": {"Gunnison County": "Gunnison County", "Hinsdale County": "Hinsdale County", "Saguache County": "Saguache County"}, "81244": {"Fremont County": "Fremont County"}, "81248": {"Chaffee County": "Chaffee County", "Gunnison County": "Gunnison County", "Saguache County": "Saguache County"}, "81251": {"Lake County": "Lake County", "Pitkin County": "Pitkin County", "Chaffee County": "Chaffee County"}, "81252": {"Custer County": "Custer County", "Fremont County": "Fremont County", "Huerfano County": "Huerfano County", "Saguache County": "Saguache County"}, "81253": {"Custer County": "Custer County", "Pueblo County": "Pueblo County", "Fremont County": "Fremont County"}, "81301": {"Dolores County": "Dolores County", "La Plata County": "La Plata County", "San Juan County": "San Juan County", "Montezuma County": "Montezuma County", "San Miguel County": "San Miguel County"}, "81303": {"La Plata County": "La Plata County"}, "81320": {"Dolores County": "Dolores County", "Montezuma County": "Montezuma County", "San Miguel County": "San Miguel County"}, "81321": {"Montezuma County": "Montezuma County"}, "81323": {"Dolores County": "Dolores County", "La Plata County": "La Plata County", "San Juan County": "San Juan County", "Montezuma County": "Montezuma County", "San Miguel County": "San Miguel County"}, "81324": {"Dolores County": "Dolores County", "Montezuma County": "Montezuma County", "San Miguel County": "San Miguel County"}, "81325": {"Dolores County": "Dolores County", "Montrose County": "Montrose County", "Montezuma County": "Montezuma County", "San Miguel County": "San Miguel County"}, "81326": {"La Plata County": "La Plata County", "Montezuma County": "Montezuma County"}, "81327": {"Montezuma County": "Montezuma County"}, "81328": {"La Plata County": "La Plata County", "Montezuma County": "Montezuma County"}, "81330": {"Montezuma County": "Montezuma County"}, "81331": {"Dolores County": "Dolores County", "Montezuma County": "Montezuma County"}, "81332": {"Dolores County": "Dolores County", "La Plata County": "La Plata County", "San Juan County": "San Juan County", "Montezuma County": "Montezuma County", "San Miguel County": "San Miguel County"}, "81334": {"La Plata County": "La Plata County", "Montezuma County": "Montezuma County"}, "81335": {"Montezuma County": "Montezuma County"}, "81401": {"Delta County": "Delta County", "Ouray County": "Ouray County", "Gunnison County": "Gunnison County", "Montrose County": "Montrose County"}, "81403": {"Ouray County": "Ouray County", "Gunnison County": "Gunnison County", "Montrose County": "Montrose County", "San Miguel County": "San Miguel County"}, "81410": {"Delta County": "Delta County"}, "81411": {"Montrose County": "Montrose County", "San Miguel County": "San Miguel County"}, "81413": {"Mesa County": "Mesa County", "Delta County": "Delta County"}, "81415": {"Delta County": "Delta County", "Gunnison County": "Gunnison County", "Montrose County": "Montrose County"}, "81416": {"Mesa County": "Mesa County", "Delta County": "Delta County", "Montrose County": "Montrose County"}, "81418": {"Delta County": "Delta County"}, "81419": {"Mesa County": "Mesa County", "Delta County": "Delta County"}, "81422": {"Mesa County": "Mesa County", "Montrose County": "Montrose County", "San Miguel County": "San Miguel County"}, "81423": {"Dolores County": "Dolores County", "Montrose County": "Montrose County", "San Miguel County": "San Miguel County"}, "81424": {"Montrose County": "Montrose County"}, "81425": {"Mesa County": "Mesa County", "Delta County": "Delta County", "Montrose County": "Montrose County"}, "81426": {"Dolores County": "Dolores County", "San Juan County": "San Juan County", "San Miguel County": "San Miguel County"}, "81427": {"Ouray County": "Ouray County", "Hinsdale County": "Hinsdale County", "San Juan County": "San Juan County", "San Miguel County": "San Miguel County"}, "81428": {"Mesa County": "Mesa County", "Delta County": "Delta County", "Gunnison County": "Gunnison County"}, "81429": {"Montrose County": "Montrose County", "San Miguel County": "San Miguel County"}, "81430": {"Ouray County": "Ouray County", "Dolores County": "Dolores County", "Montrose County": "Montrose County", "San Miguel County": "San Miguel County"}, "81431": {"Montrose County": "Montrose County", "San Miguel County": "San Miguel County"}, "81432": {"Ouray County": "Ouray County", "Gunnison County": "Gunnison County", "Hinsdale County": "Hinsdale County", "Montrose County": "Montrose County", "San Miguel County": "San Miguel County"}, "81433": {"Ouray County": "Ouray County", "Hinsdale County": "Hinsdale County", "La Plata County": "La Plata County", "San Juan County": "San Juan County", "San Miguel County": "San Miguel County"}, "81434": {"Mesa County": "Mesa County", "Delta County": "Delta County", "Pitkin County": "Pitkin County", "Gunnison County": "Gunnison County"}, "81435": {"Ouray County": "Ouray County", "Dolores County": "Dolores County", "San Juan County": "San Juan County", "San Miguel County": "San Miguel County"}, "81501": {"Mesa County": "Mesa County"}, "81503": {"Mesa County": "Mesa County"}, "81504": {"Mesa County": "Mesa County"}, "81505": {"Mesa County": "Mesa County"}, "81506": {"Mesa County": "Mesa County"}, "81507": {"Mesa County": "Mesa County"}, "81520": {"Mesa County": "Mesa County"}, "81521": {"Mesa County": "Mesa County"}, "81522": {"Mesa County": "Mesa County", "Montrose County": "Montrose County"}, "81523": {"Mesa County": "Mesa County"}, "81524": {"Mesa County": "Mesa County", "Garfield County": "Garfield County"}, "81525": {"Mesa County": "Mesa County", "Garfield County": "Garfield County"}, "81526": {"Mesa County": "Mesa County"}, "81527": {"Mesa County": "Mesa County", "Delta County": "Delta County", "Montrose County": "Montrose County"}, "81601": {"Eagle County": "Eagle County", "Pitkin County": "Pitkin County", "Garfield County": "Garfield County"}, "81610": {"Moffat County": "Moffat County", "Rio Blanco County": "Rio Blanco County"}, "81611": {"Lake County": "Lake County", "Pitkin County": "Pitkin County", "Chaffee County": "Chaffee County", "Gunnison County": "Gunnison County"}, "81612": {"Pitkin County": "Pitkin County"}, "81615": {"Pitkin County": "Pitkin County"}, "81620": {"Eagle County": "Eagle County"}, "81621": {"Eagle County": "Eagle County", "Pitkin County": "Pitkin County", "Garfield County": "Garfield County"}, "81623": {"Mesa County": "Mesa County", "Eagle County": "Eagle County", "Pitkin County": "Pitkin County", "Garfield County": "Garfield County", "Gunnison County": "Gunnison County"}, "81624": {"Mesa County": "Mesa County", "Delta County": "Delta County", "Pitkin County": "Pitkin County", "Garfield County": "Garfield County", "Gunnison County": "Gunnison County"}, "81625": {"Routt County": "Routt County", "Moffat County": "Moffat County"}, "81630": {"Mesa County": "Mesa County", "Garfield County": "Garfield County", "Rio Blanco County": "Rio Blanco County"}, "81631": {"Eagle County": "Eagle County"}, "81632": {"Eagle County": "Eagle County"}, "81633": {"Moffat County": "Moffat County", "Rio Blanco County": "Rio Blanco County"}, "81635": {"Mesa County": "Mesa County", "Garfield County": "Garfield County", "Rio Blanco County": "Rio Blanco County"}, "81637": {"Eagle County": "Eagle County", "Routt County": "Routt County", "Garfield County": "Garfield County", "Rio Blanco County": "Rio Blanco County"}, "81638": {"Routt County": "Routt County", "Moffat County": "Moffat County", "Rio Blanco County": "Rio Blanco County"}, "81639": {"Routt County": "Routt County", "Moffat County": "Moffat County", "Rio Blanco County": "Rio Blanco County"}, "81640": {"Moffat County": "Moffat County", "Rio Blanco County": "Rio Blanco County"}, "81641": {"Routt County": "Routt County", "Moffat County": "Moffat County", "Garfield County": "Garfield County", "Rio Blanco County": "Rio Blanco County"}, "81642": {"Lake County": "Lake County", "Eagle County": "Eagle County", "Pitkin County": "Pitkin County"}, "81643": {"Mesa County": "Mesa County", "Delta County": "Delta County"}, "81645": {"Lake County": "Lake County", "Eagle County": "Eagle County", "Pitkin County": "Pitkin County", "Summit County": "Summit County"}, "81646": {"Mesa County": "Mesa County", "Delta County": "Delta County"}, "81647": {"Mesa County": "Mesa County", "Pitkin County": "Pitkin County", "Garfield County": "Garfield County", "Rio Blanco County": "Rio Blanco County"}, "81648": {"Moffat County": "Moffat County", "Garfield County": "Garfield County", "Rio Blanco County": "Rio Blanco County"}, "81649": {"Eagle County": "Eagle County", "Summit County": "Summit County"}, "81650": {"Mesa County": "Mesa County", "Garfield County": "Garfield County", "Rio Blanco County": "Rio Blanco County"}, "81652": {"Mesa County": "Mesa County", "Garfield County": "Garfield County"}, "81653": {"Routt County": "Routt County", "Moffat County": "Moffat County"}, "81654": {"Pitkin County": "Pitkin County", "Gunnison County": "Gunnison County"}, "81655": {"Eagle County": "Eagle County", "Summit County": "Summit County"}, "81656": {"Pitkin County": "Pitkin County"}, "81657": {"Eagle County": "Eagle County", "Summit County": "Summit County"}, "82063": {"Jackson County": "Jackson County", "Larimer County": "Larimer County"}} - counties_by_zipcode = { - "80002": { - "Adams County": "Adams County", - "Denver County": "Denver County", - "Jefferson County": "Jefferson County", - }, - "80003": {"Adams County": "Adams County", "Jefferson County": "Jefferson County"}, - "80004": {"Jefferson County": "Jefferson County"}, - "80005": {"Jefferson County": "Jefferson County", "Broomfield County": "Broomfield County"}, - "80007": { - "Boulder County": "Boulder County", - "Jefferson County": "Jefferson County", - "Broomfield County": "Broomfield County", - }, - "80010": { - "Adams County": "Adams County", - "Denver County": "Denver County", - "Arapahoe County": "Arapahoe County", - }, - "80011": { - "Adams County": "Adams County", - "Denver County": "Denver County", - "Arapahoe County": "Arapahoe County", - }, - "80012": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, - "80013": {"Arapahoe County": "Arapahoe County"}, - "80014": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, - "80015": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, - "80016": { - "Denver County": "Denver County", - "Elbert County": "Elbert County", - "Douglas County": "Douglas County", - "Arapahoe County": "Arapahoe County", - }, - "80017": {"Arapahoe County": "Arapahoe County"}, - "80018": {"Adams County": "Adams County", "Arapahoe County": "Arapahoe County"}, - "80019": { - "Adams County": "Adams County", - "Denver County": "Denver County", - "Arapahoe County": "Arapahoe County", - }, - "80020": { - "Adams County": "Adams County", - "Boulder County": "Boulder County", - "Jefferson County": "Jefferson County", - "Broomfield County": "Broomfield County", - }, - "80021": { - "Boulder County": "Boulder County", - "Jefferson County": "Jefferson County", - "Broomfield County": "Broomfield County", - }, - "80022": {"Adams County": "Adams County", "Denver County": "Denver County"}, - "80023": { - "Weld County": "Weld County", - "Adams County": "Adams County", - "Boulder County": "Boulder County", - "Broomfield County": "Broomfield County", - }, - "80024": {"Adams County": "Adams County"}, - "80025": {"Boulder County": "Boulder County", "Jefferson County": "Jefferson County"}, - "80026": { - "Weld County": "Weld County", - "Boulder County": "Boulder County", - "Broomfield County": "Broomfield County", - }, - "80027": { - "Boulder County": "Boulder County", - "Jefferson County": "Jefferson County", - "Broomfield County": "Broomfield County", - }, - "80030": {"Adams County": "Adams County", "Jefferson County": "Jefferson County"}, - "80031": { - "Adams County": "Adams County", - "Jefferson County": "Jefferson County", - "Broomfield County": "Broomfield County", - }, - "80033": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, - "80045": { - "Adams County": "Adams County", - "Denver County": "Denver County", - "Arapahoe County": "Arapahoe County", - }, - "80101": {"Elbert County": "Elbert County", "Arapahoe County": "Arapahoe County"}, - "80102": { - "Weld County": "Weld County", - "Adams County": "Adams County", - "Elbert County": "Elbert County", - "Arapahoe County": "Arapahoe County", - }, - "80103": { - "Adams County": "Adams County", - "Elbert County": "Elbert County", - "Morgan County": "Morgan County", - "Arapahoe County": "Arapahoe County", - }, - "80104": {"Douglas County": "Douglas County"}, - "80105": { - "Adams County": "Adams County", - "Elbert County": "Elbert County", - "Lincoln County": "Lincoln County", - "Arapahoe County": "Arapahoe County", - "Washington County": "Washington County", - }, - "80106": { - "Elbert County": "Elbert County", - "Douglas County": "Douglas County", - "El Paso County": "El Paso County", - }, - "80107": { - "Elbert County": "Elbert County", - "Douglas County": "Douglas County", - "Arapahoe County": "Arapahoe County", - }, - "80108": {"Douglas County": "Douglas County"}, - "80109": {"Douglas County": "Douglas County"}, - "80110": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, - "80111": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, - "80112": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, - "80113": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, - "80116": {"Elbert County": "Elbert County", "Douglas County": "Douglas County"}, - "80117": {"Elbert County": "Elbert County"}, - "80118": { - "Elbert County": "Elbert County", - "Douglas County": "Douglas County", - "El Paso County": "El Paso County", - }, - "80120": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, - "80121": {"Arapahoe County": "Arapahoe County"}, - "80122": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, - "80123": { - "Denver County": "Denver County", - "Arapahoe County": "Arapahoe County", - "Jefferson County": "Jefferson County", - }, - "80124": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, - "80125": { - "Douglas County": "Douglas County", - "Arapahoe County": "Arapahoe County", - "Jefferson County": "Jefferson County", - }, - "80126": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, - "80127": { - "Denver County": "Denver County", - "Douglas County": "Douglas County", - "Jefferson County": "Jefferson County", - }, - "80128": { - "Douglas County": "Douglas County", - "Arapahoe County": "Arapahoe County", - "Jefferson County": "Jefferson County", - }, - "80129": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, - "80130": {"Douglas County": "Douglas County"}, - "80131": {"Douglas County": "Douglas County"}, - "80132": {"Douglas County": "Douglas County", "El Paso County": "El Paso County"}, - "80133": { - "Teller County": "Teller County", - "Douglas County": "Douglas County", - "El Paso County": "El Paso County", - }, - "80134": { - "Elbert County": "Elbert County", - "Douglas County": "Douglas County", - "Arapahoe County": "Arapahoe County", - }, - "80135": { - "Park County": "Park County", - "Teller County": "Teller County", - "Douglas County": "Douglas County", - "El Paso County": "El Paso County", - "Jefferson County": "Jefferson County", - }, - "80136": { - "Weld County": "Weld County", - "Adams County": "Adams County", - "Elbert County": "Elbert County", - "Arapahoe County": "Arapahoe County", - }, - "80137": { - "Adams County": "Adams County", - "Denver County": "Denver County", - "Arapahoe County": "Arapahoe County", - }, - "80138": { - "Elbert County": "Elbert County", - "Douglas County": "Douglas County", - "Arapahoe County": "Arapahoe County", - }, - "80202": {"Denver County": "Denver County"}, - "80203": {"Denver County": "Denver County"}, - "80204": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, - "80205": {"Denver County": "Denver County"}, - "80206": {"Denver County": "Denver County"}, - "80207": {"Denver County": "Denver County"}, - "80209": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, - "80210": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, - "80211": {"Denver County": "Denver County"}, - "80212": { - "Adams County": "Adams County", - "Denver County": "Denver County", - "Jefferson County": "Jefferson County", - }, - "80214": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, - "80215": {"Jefferson County": "Jefferson County"}, - "80216": {"Adams County": "Adams County", "Denver County": "Denver County"}, - "80218": {"Denver County": "Denver County"}, - "80219": { - "Denver County": "Denver County", - "Arapahoe County": "Arapahoe County", - "Jefferson County": "Jefferson County", - }, - "80220": { - "Adams County": "Adams County", - "Denver County": "Denver County", - "Arapahoe County": "Arapahoe County", - }, - "80221": {"Adams County": "Adams County", "Denver County": "Denver County"}, - "80222": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, - "80223": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, - "80224": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, - "80226": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, - "80227": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, - "80228": {"Jefferson County": "Jefferson County"}, - "80229": {"Adams County": "Adams County"}, - "80230": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, - "80231": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, - "80232": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, - "80233": {"Adams County": "Adams County"}, - "80234": {"Adams County": "Adams County", "Broomfield County": "Broomfield County"}, - "80235": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, - "80236": { - "Denver County": "Denver County", - "Arapahoe County": "Arapahoe County", - "Jefferson County": "Jefferson County", - }, - "80237": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, - "80238": {"Adams County": "Adams County", "Denver County": "Denver County"}, - "80239": {"Adams County": "Adams County", "Denver County": "Denver County"}, - "80241": {"Adams County": "Adams County"}, - "80246": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, - "80247": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, - "80249": {"Adams County": "Adams County", "Denver County": "Denver County"}, - "80260": {"Adams County": "Adams County"}, - "80264": {"Denver County": "Denver County"}, - "80290": {"Denver County": "Denver County"}, - "80293": {"Denver County": "Denver County"}, - "80294": {"Denver County": "Denver County"}, - "80301": {"Boulder County": "Boulder County"}, - "80302": {"Boulder County": "Boulder County"}, - "80303": {"Boulder County": "Boulder County", "Jefferson County": "Jefferson County"}, - "80304": {"Boulder County": "Boulder County"}, - "80305": {"Boulder County": "Boulder County"}, - "80310": {"Boulder County": "Boulder County"}, - "80401": {"Jefferson County": "Jefferson County"}, - "80403": { - "Gilpin County": "Gilpin County", - "Boulder County": "Boulder County", - "Jefferson County": "Jefferson County", - "Clear Creek County": "Clear Creek County", - }, - "80419": {"Jefferson County": "Jefferson County"}, - "80420": {"Lake County": "Lake County", "Park County": "Park County", "Summit County": "Summit County"}, - "80421": { - "Park County": "Park County", - "Jefferson County": "Jefferson County", - "Clear Creek County": "Clear Creek County", - }, - "80422": { - "Grand County": "Grand County", - "Gilpin County": "Gilpin County", - "Boulder County": "Boulder County", - "Jefferson County": "Jefferson County", - "Clear Creek County": "Clear Creek County", - }, - "80423": { - "Eagle County": "Eagle County", - "Grand County": "Grand County", - "Routt County": "Routt County", - "Summit County": "Summit County", - }, - "80424": {"Lake County": "Lake County", "Park County": "Park County", "Summit County": "Summit County"}, - "80425": {"Douglas County": "Douglas County", "Jefferson County": "Jefferson County"}, - "80426": {"Eagle County": "Eagle County", "Routt County": "Routt County", "Garfield County": "Garfield County"}, - "80427": { - "Gilpin County": "Gilpin County", - "Jefferson County": "Jefferson County", - "Clear Creek County": "Clear Creek County", - }, - "80428": {"Routt County": "Routt County", "Jackson County": "Jackson County"}, - "80432": {"Park County": "Park County"}, - "80433": { - "Park County": "Park County", - "Douglas County": "Douglas County", - "Jefferson County": "Jefferson County", - }, - "80434": {"Jackson County": "Jackson County"}, - "80435": { - "Park County": "Park County", - "Summit County": "Summit County", - "Clear Creek County": "Clear Creek County", - }, - "80436": {"Grand County": "Grand County", "Clear Creek County": "Clear Creek County"}, - "80438": {"Grand County": "Grand County", "Clear Creek County": "Clear Creek County"}, - "80439": { - "Park County": "Park County", - "Gilpin County": "Gilpin County", - "Jefferson County": "Jefferson County", - "Clear Creek County": "Clear Creek County", - }, - "80440": {"Lake County": "Lake County", "Park County": "Park County", "Summit County": "Summit County"}, - "80442": {"Grand County": "Grand County"}, - "80443": { - "Lake County": "Lake County", - "Park County": "Park County", - "Eagle County": "Eagle County", - "Summit County": "Summit County", - }, - "80444": { - "Park County": "Park County", - "Summit County": "Summit County", - "Clear Creek County": "Clear Creek County", - }, - "80446": { - "Grand County": "Grand County", - "Boulder County": "Boulder County", - "Jackson County": "Jackson County", - }, - "80447": { - "Grand County": "Grand County", - "Boulder County": "Boulder County", - "Jackson County": "Jackson County", - "Larimer County": "Larimer County", - }, - "80448": { - "Park County": "Park County", - "Summit County": "Summit County", - "Jefferson County": "Jefferson County", - "Clear Creek County": "Clear Creek County", - }, - "80449": { - "Lake County": "Lake County", - "Park County": "Park County", - "Chaffee County": "Chaffee County", - "Fremont County": "Fremont County", - }, - "80451": {"Grand County": "Grand County"}, - "80452": { - "Park County": "Park County", - "Grand County": "Grand County", - "Gilpin County": "Gilpin County", - "Clear Creek County": "Clear Creek County", - }, - "80453": {"Jefferson County": "Jefferson County"}, - "80454": {"Jefferson County": "Jefferson County"}, - "80455": {"Boulder County": "Boulder County"}, - "80456": { - "Park County": "Park County", - "Summit County": "Summit County", - "Jefferson County": "Jefferson County", - }, - "80457": {"Jefferson County": "Jefferson County"}, - "80459": { - "Eagle County": "Eagle County", - "Grand County": "Grand County", - "Routt County": "Routt County", - "Summit County": "Summit County", - "Jackson County": "Jackson County", - }, - "80461": { - "Lake County": "Lake County", - "Park County": "Park County", - "Eagle County": "Eagle County", - "Pitkin County": "Pitkin County", - "Summit County": "Summit County", - "Chaffee County": "Chaffee County", - }, - "80463": {"Eagle County": "Eagle County", "Grand County": "Grand County", "Routt County": "Routt County"}, - "80465": {"Jefferson County": "Jefferson County"}, - "80466": {"Grand County": "Grand County", "Gilpin County": "Gilpin County", "Boulder County": "Boulder County"}, - "80467": { - "Grand County": "Grand County", - "Routt County": "Routt County", - "Rio Blanco County": "Rio Blanco County", - }, - "80468": { - "Grand County": "Grand County", - "Summit County": "Summit County", - "Clear Creek County": "Clear Creek County", - }, - "80469": {"Routt County": "Routt County", "Rio Blanco County": "Rio Blanco County"}, - "80470": { - "Park County": "Park County", - "Jefferson County": "Jefferson County", - "Clear Creek County": "Clear Creek County", - }, - "80471": {"Gilpin County": "Gilpin County", "Boulder County": "Boulder County"}, - "80473": {"Grand County": "Grand County", "Jackson County": "Jackson County"}, - "80475": {"Park County": "Park County"}, - "80476": { - "Grand County": "Grand County", - "Summit County": "Summit County", - "Clear Creek County": "Clear Creek County", - }, - "80477": {"Routt County": "Routt County"}, - "80478": {"Grand County": "Grand County"}, - "80479": {"Eagle County": "Eagle County", "Routt County": "Routt County"}, - "80480": { - "Grand County": "Grand County", - "Routt County": "Routt County", - "Jackson County": "Jackson County", - "Larimer County": "Larimer County", - }, - "80481": {"Grand County": "Grand County", "Boulder County": "Boulder County"}, - "80482": { - "Grand County": "Grand County", - "Gilpin County": "Gilpin County", - "Boulder County": "Boulder County", - "Clear Creek County": "Clear Creek County", - }, - "80483": { - "Routt County": "Routt County", - "Garfield County": "Garfield County", - "Rio Blanco County": "Rio Blanco County", - }, - "80487": {"Grand County": "Grand County", "Routt County": "Routt County", "Jackson County": "Jackson County"}, - "80488": {"Routt County": "Routt County"}, - "80497": { - "Grand County": "Grand County", - "Summit County": "Summit County", - "Clear Creek County": "Clear Creek County", - }, - "80498": {"Eagle County": "Eagle County", "Grand County": "Grand County", "Summit County": "Summit County"}, - "80501": {"Weld County": "Weld County", "Boulder County": "Boulder County"}, - "80503": {"Boulder County": "Boulder County", "Larimer County": "Larimer County"}, - "80504": {"Weld County": "Weld County", "Boulder County": "Boulder County", "Larimer County": "Larimer County"}, - "80510": { - "Grand County": "Grand County", - "Boulder County": "Boulder County", - "Larimer County": "Larimer County", - }, - "80511": {"Larimer County": "Larimer County"}, - "80512": { - "Grand County": "Grand County", - "Jackson County": "Jackson County", - "Larimer County": "Larimer County", - }, - "80513": {"Weld County": "Weld County", "Boulder County": "Boulder County", "Larimer County": "Larimer County"}, - "80514": {"Weld County": "Weld County", "Broomfield County": "Broomfield County"}, - "80515": {"Larimer County": "Larimer County"}, - "80516": { - "Weld County": "Weld County", - "Adams County": "Adams County", - "Boulder County": "Boulder County", - "Broomfield County": "Broomfield County", - }, - "80517": { - "Grand County": "Grand County", - "Boulder County": "Boulder County", - "Larimer County": "Larimer County", - }, - "80520": {"Weld County": "Weld County"}, - "80521": {"Larimer County": "Larimer County"}, - "80524": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, - "80525": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, - "80526": {"Larimer County": "Larimer County"}, - "80528": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, - "80530": {"Weld County": "Weld County"}, - "80532": {"Larimer County": "Larimer County"}, - "80534": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, - "80535": {"Larimer County": "Larimer County"}, - "80536": {"Larimer County": "Larimer County"}, - "80537": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, - "80538": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, - "80540": {"Boulder County": "Boulder County", "Larimer County": "Larimer County"}, - "80542": {"Weld County": "Weld County"}, - "80543": {"Weld County": "Weld County"}, - "80544": {"Boulder County": "Boulder County"}, - "80545": {"Larimer County": "Larimer County"}, - "80546": {"Weld County": "Weld County"}, - "80547": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, - "80549": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, - "80550": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, - "80601": {"Weld County": "Weld County", "Adams County": "Adams County"}, - "80602": { - "Weld County": "Weld County", - "Adams County": "Adams County", - "Broomfield County": "Broomfield County", - }, - "80603": { - "Weld County": "Weld County", - "Adams County": "Adams County", - "Denver County": "Denver County", - "Broomfield County": "Broomfield County", - }, - "80610": {"Weld County": "Weld County"}, - "80611": {"Weld County": "Weld County", "Morgan County": "Morgan County"}, - "80612": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, - "80615": {"Weld County": "Weld County"}, - "80620": {"Weld County": "Weld County"}, - "80621": {"Weld County": "Weld County"}, - "80622": {"Weld County": "Weld County"}, - "80623": {"Weld County": "Weld County"}, - "80624": {"Weld County": "Weld County"}, - "80631": {"Weld County": "Weld County"}, - "80634": {"Weld County": "Weld County"}, - "80640": {"Adams County": "Adams County"}, - "80642": {"Weld County": "Weld County", "Adams County": "Adams County", "Denver County": "Denver County"}, - "80643": {"Weld County": "Weld County", "Adams County": "Adams County"}, - "80644": {"Weld County": "Weld County"}, - "80645": {"Weld County": "Weld County"}, - "80648": {"Weld County": "Weld County"}, - "80649": {"Weld County": "Weld County", "Morgan County": "Morgan County"}, - "80650": {"Weld County": "Weld County"}, - "80651": {"Weld County": "Weld County"}, - "80652": {"Weld County": "Weld County", "Adams County": "Adams County", "Morgan County": "Morgan County"}, - "80653": {"Morgan County": "Morgan County"}, - "80654": {"Weld County": "Weld County", "Adams County": "Adams County", "Morgan County": "Morgan County"}, - "80701": { - "Weld County": "Weld County", - "Adams County": "Adams County", - "Morgan County": "Morgan County", - "Washington County": "Washington County", - }, - "80705": {"Morgan County": "Morgan County"}, - "80720": { - "Yuma County": "Yuma County", - "Logan County": "Logan County", - "Morgan County": "Morgan County", - "Washington County": "Washington County", - }, - "80721": {"Phillips County": "Phillips County", "Sedgwick County": "Sedgwick County"}, - "80722": {"Logan County": "Logan County", "Washington County": "Washington County"}, - "80723": {"Morgan County": "Morgan County", "Washington County": "Washington County"}, - "80726": {"Logan County": "Logan County", "Sedgwick County": "Sedgwick County"}, - "80727": {"Yuma County": "Yuma County"}, - "80728": { - "Logan County": "Logan County", - "Sedgwick County": "Sedgwick County", - "Washington County": "Washington County", - }, - "80729": {"Weld County": "Weld County"}, - "80731": { - "Yuma County": "Yuma County", - "Logan County": "Logan County", - "Phillips County": "Phillips County", - "Sedgwick County": "Sedgwick County", - "Washington County": "Washington County", - }, - "80733": { - "Logan County": "Logan County", - "Morgan County": "Morgan County", - "Washington County": "Washington County", - }, - "80734": { - "Yuma County": "Yuma County", - "Phillips County": "Phillips County", - "Sedgwick County": "Sedgwick County", - }, - "80735": {"Yuma County": "Yuma County", "Kit Carson County": "Kit Carson County"}, - "80736": {"Logan County": "Logan County"}, - "80737": {"Phillips County": "Phillips County", "Sedgwick County": "Sedgwick County"}, - "80740": {"Lincoln County": "Lincoln County", "Washington County": "Washington County"}, - "80741": { - "Weld County": "Weld County", - "Logan County": "Logan County", - "Morgan County": "Morgan County", - "Washington County": "Washington County", - }, - "80742": {"Weld County": "Weld County", "Logan County": "Logan County", "Morgan County": "Morgan County"}, - "80743": { - "Yuma County": "Yuma County", - "Logan County": "Logan County", - "Washington County": "Washington County", - }, - "80744": {"Phillips County": "Phillips County", "Sedgwick County": "Sedgwick County"}, - "80745": {"Weld County": "Weld County", "Logan County": "Logan County"}, - "80746": {"Phillips County": "Phillips County"}, - "80747": {"Logan County": "Logan County"}, - "80749": { - "Logan County": "Logan County", - "Phillips County": "Phillips County", - "Sedgwick County": "Sedgwick County", - }, - "80750": { - "Weld County": "Weld County", - "Logan County": "Logan County", - "Morgan County": "Morgan County", - "Washington County": "Washington County", - }, - "80751": {"Logan County": "Logan County", "Washington County": "Washington County"}, - "80754": {"Weld County": "Weld County", "Logan County": "Logan County", "Morgan County": "Morgan County"}, - "80755": {"Yuma County": "Yuma County"}, - "80757": { - "Adams County": "Adams County", - "Morgan County": "Morgan County", - "Lincoln County": "Lincoln County", - "Arapahoe County": "Arapahoe County", - "Washington County": "Washington County", - }, - "80758": {"Yuma County": "Yuma County", "Phillips County": "Phillips County"}, - "80759": { - "Yuma County": "Yuma County", - "Logan County": "Logan County", - "Phillips County": "Phillips County", - "Washington County": "Washington County", - }, - "80801": {"Washington County": "Washington County"}, - "80802": { - "Kiowa County": "Kiowa County", - "Cheyenne County": "Cheyenne County", - "Kit Carson County": "Kit Carson County", - }, - "80804": { - "Lincoln County": "Lincoln County", - "Kit Carson County": "Kit Carson County", - "Washington County": "Washington County", - }, - "80805": { - "Yuma County": "Yuma County", - "Cheyenne County": "Cheyenne County", - "Kit Carson County": "Kit Carson County", - }, - "80807": { - "Yuma County": "Yuma County", - "Cheyenne County": "Cheyenne County", - "Kit Carson County": "Kit Carson County", - }, - "80808": {"Elbert County": "Elbert County", "El Paso County": "El Paso County"}, - "80809": {"Teller County": "Teller County", "El Paso County": "El Paso County"}, - "80810": { - "Kiowa County": "Kiowa County", - "Cheyenne County": "Cheyenne County", - "Kit Carson County": "Kit Carson County", - }, - "80812": { - "Yuma County": "Yuma County", - "Kit Carson County": "Kit Carson County", - "Washington County": "Washington County", - }, - "80813": { - "Teller County": "Teller County", - "El Paso County": "El Paso County", - "Fremont County": "Fremont County", - }, - "80814": {"Teller County": "Teller County"}, - "80815": { - "Lincoln County": "Lincoln County", - "Cheyenne County": "Cheyenne County", - "Kit Carson County": "Kit Carson County", - "Washington County": "Washington County", - }, - "80816": {"Park County": "Park County", "Teller County": "Teller County", "Fremont County": "Fremont County"}, - "80817": {"Pueblo County": "Pueblo County", "El Paso County": "El Paso County"}, - "80818": {"Lincoln County": "Lincoln County", "Washington County": "Washington County"}, - "80819": {"Teller County": "Teller County", "El Paso County": "El Paso County"}, - "80820": {"Park County": "Park County", "Teller County": "Teller County", "Fremont County": "Fremont County"}, - "80821": { - "Elbert County": "Elbert County", - "Lincoln County": "Lincoln County", - "Cheyenne County": "Cheyenne County", - "Kit Carson County": "Kit Carson County", - }, - "80822": { - "Yuma County": "Yuma County", - "Kit Carson County": "Kit Carson County", - "Washington County": "Washington County", - }, - "80823": { - "Kiowa County": "Kiowa County", - "Crowley County": "Crowley County", - "Lincoln County": "Lincoln County", - "Cheyenne County": "Cheyenne County", - }, - "80824": {"Yuma County": "Yuma County", "Kit Carson County": "Kit Carson County"}, - "80825": { - "Kiowa County": "Kiowa County", - "Lincoln County": "Lincoln County", - "Cheyenne County": "Cheyenne County", - "Kit Carson County": "Kit Carson County", - }, - "80827": { - "Park County": "Park County", - "Teller County": "Teller County", - "Douglas County": "Douglas County", - "Jefferson County": "Jefferson County", - }, - "80828": { - "Elbert County": "Elbert County", - "Lincoln County": "Lincoln County", - "Arapahoe County": "Arapahoe County", - "Washington County": "Washington County", - }, - "80829": {"Teller County": "Teller County", "El Paso County": "El Paso County"}, - "80830": { - "Elbert County": "Elbert County", - "El Paso County": "El Paso County", - "Lincoln County": "Lincoln County", - }, - "80831": {"Elbert County": "Elbert County", "El Paso County": "El Paso County"}, - "80832": { - "Elbert County": "Elbert County", - "El Paso County": "El Paso County", - "Lincoln County": "Lincoln County", - }, - "80833": { - "Elbert County": "Elbert County", - "Pueblo County": "Pueblo County", - "Crowley County": "Crowley County", - "El Paso County": "El Paso County", - "Lincoln County": "Lincoln County", - }, - "80834": { - "Cheyenne County": "Cheyenne County", - "Kit Carson County": "Kit Carson County", - "Washington County": "Washington County", - }, - "80835": {"Elbert County": "Elbert County", "El Paso County": "El Paso County"}, - "80836": { - "Yuma County": "Yuma County", - "Cheyenne County": "Cheyenne County", - "Kit Carson County": "Kit Carson County", - }, - "80840": {"El Paso County": "El Paso County"}, - "80860": { - "Teller County": "Teller County", - "El Paso County": "El Paso County", - "Fremont County": "Fremont County", - }, - "80861": { - "Yuma County": "Yuma County", - "Cheyenne County": "Cheyenne County", - "Kit Carson County": "Kit Carson County", - "Washington County": "Washington County", - }, - "80862": { - "Lincoln County": "Lincoln County", - "Cheyenne County": "Cheyenne County", - "Kit Carson County": "Kit Carson County", - }, - "80863": { - "Teller County": "Teller County", - "Douglas County": "Douglas County", - "El Paso County": "El Paso County", - }, - "80864": { - "Pueblo County": "Pueblo County", - "Crowley County": "Crowley County", - "El Paso County": "El Paso County", - "Lincoln County": "Lincoln County", - }, - "80902": {"El Paso County": "El Paso County"}, - "80903": {"El Paso County": "El Paso County"}, - "80904": {"El Paso County": "El Paso County"}, - "80905": {"El Paso County": "El Paso County"}, - "80906": {"Teller County": "Teller County", "El Paso County": "El Paso County"}, - "80907": {"El Paso County": "El Paso County"}, - "80908": { - "Elbert County": "Elbert County", - "Douglas County": "Douglas County", - "El Paso County": "El Paso County", - }, - "80909": {"El Paso County": "El Paso County"}, - "80910": {"El Paso County": "El Paso County"}, - "80911": {"El Paso County": "El Paso County"}, - "80913": {"El Paso County": "El Paso County"}, - "80914": {"El Paso County": "El Paso County"}, - "80915": {"El Paso County": "El Paso County"}, - "80916": {"El Paso County": "El Paso County"}, - "80917": {"El Paso County": "El Paso County"}, - "80918": {"El Paso County": "El Paso County"}, - "80919": {"El Paso County": "El Paso County"}, - "80920": {"El Paso County": "El Paso County"}, - "80921": {"Teller County": "Teller County", "El Paso County": "El Paso County"}, - "80922": {"El Paso County": "El Paso County"}, - "80923": {"El Paso County": "El Paso County"}, - "80924": {"El Paso County": "El Paso County"}, - "80925": {"El Paso County": "El Paso County"}, - "80926": { - "Teller County": "Teller County", - "El Paso County": "El Paso County", - "Fremont County": "Fremont County", - }, - "80927": {"El Paso County": "El Paso County"}, - "80928": {"Pueblo County": "Pueblo County", "El Paso County": "El Paso County"}, - "80929": {"El Paso County": "El Paso County"}, - "80930": {"El Paso County": "El Paso County"}, - "80938": {"El Paso County": "El Paso County"}, - "80939": {"El Paso County": "El Paso County"}, - "80951": {"El Paso County": "El Paso County"}, - "81001": {"Pueblo County": "Pueblo County"}, - "81003": {"Pueblo County": "Pueblo County"}, - "81004": {"Pueblo County": "Pueblo County"}, - "81005": { - "Custer County": "Custer County", - "Pueblo County": "Pueblo County", - "Fremont County": "Fremont County", - }, - "81006": {"Pueblo County": "Pueblo County"}, - "81007": {"Pueblo County": "Pueblo County", "Fremont County": "Fremont County"}, - "81008": {"Pueblo County": "Pueblo County", "El Paso County": "El Paso County"}, - "81019": {"Pueblo County": "Pueblo County"}, - "81020": { - "Pueblo County": "Pueblo County", - "Huerfano County": "Huerfano County", - "Las Animas County": "Las Animas County", - }, - "81021": { - "Bent County": "Bent County", - "Kiowa County": "Kiowa County", - "Otero County": "Otero County", - "Crowley County": "Crowley County", - "Lincoln County": "Lincoln County", - }, - "81022": {"Pueblo County": "Pueblo County", "Huerfano County": "Huerfano County"}, - "81023": {"Custer County": "Custer County", "Pueblo County": "Pueblo County"}, - "81024": {"Las Animas County": "Las Animas County"}, - "81025": { - "Pueblo County": "Pueblo County", - "Crowley County": "Crowley County", - "El Paso County": "El Paso County", - "Lincoln County": "Lincoln County", - }, - "81027": {"Las Animas County": "Las Animas County"}, - "81029": {"Baca County": "Baca County"}, - "81030": {"Otero County": "Otero County"}, - "81033": {"Crowley County": "Crowley County"}, - "81036": { - "Bent County": "Bent County", - "Kiowa County": "Kiowa County", - "Prowers County": "Prowers County", - "Cheyenne County": "Cheyenne County", - }, - "81038": {"Bent County": "Bent County"}, - "81039": { - "Otero County": "Otero County", - "Pueblo County": "Pueblo County", - "Crowley County": "Crowley County", - "Huerfano County": "Huerfano County", - "Las Animas County": "Las Animas County", - }, - "81040": { - "Custer County": "Custer County", - "Pueblo County": "Pueblo County", - "Alamosa County": "Alamosa County", - "Costilla County": "Costilla County", - "Huerfano County": "Huerfano County", - "Saguache County": "Saguache County", - }, - "81041": {"Baca County": "Baca County", "Prowers County": "Prowers County"}, - "81043": {"Prowers County": "Prowers County"}, - "81044": {"Baca County": "Baca County", "Bent County": "Bent County"}, - "81045": { - "Kiowa County": "Kiowa County", - "Lincoln County": "Lincoln County", - "Cheyenne County": "Cheyenne County", - }, - "81047": {"Baca County": "Baca County", "Kiowa County": "Kiowa County", "Prowers County": "Prowers County"}, - "81049": { - "Baca County": "Baca County", - "Bent County": "Bent County", - "Otero County": "Otero County", - "Las Animas County": "Las Animas County", - }, - "81050": { - "Bent County": "Bent County", - "Kiowa County": "Kiowa County", - "Otero County": "Otero County", - "Crowley County": "Crowley County", - "Las Animas County": "Las Animas County", - }, - "81052": { - "Baca County": "Baca County", - "Bent County": "Bent County", - "Kiowa County": "Kiowa County", - "Prowers County": "Prowers County", - }, - "81054": { - "Baca County": "Baca County", - "Bent County": "Bent County", - "Kiowa County": "Kiowa County", - "Otero County": "Otero County", - "Las Animas County": "Las Animas County", - }, - "81055": { - "Costilla County": "Costilla County", - "Huerfano County": "Huerfano County", - "Las Animas County": "Las Animas County", - }, - "81057": {"Bent County": "Bent County"}, - "81058": {"Otero County": "Otero County", "Crowley County": "Crowley County"}, - "81059": { - "Otero County": "Otero County", - "Pueblo County": "Pueblo County", - "Las Animas County": "Las Animas County", - }, - "81062": { - "Otero County": "Otero County", - "Pueblo County": "Pueblo County", - "Crowley County": "Crowley County", - "El Paso County": "El Paso County", - "Lincoln County": "Lincoln County", - }, - "81063": { - "Otero County": "Otero County", - "Crowley County": "Crowley County", - "Lincoln County": "Lincoln County", - }, - "81064": {"Baca County": "Baca County", "Las Animas County": "Las Animas County"}, - "81067": { - "Otero County": "Otero County", - "Pueblo County": "Pueblo County", - "Crowley County": "Crowley County", - "Las Animas County": "Las Animas County", - }, - "81069": { - "Custer County": "Custer County", - "Pueblo County": "Pueblo County", - "Huerfano County": "Huerfano County", - }, - "81071": { - "Kiowa County": "Kiowa County", - "Prowers County": "Prowers County", - "Cheyenne County": "Cheyenne County", - }, - "81073": { - "Baca County": "Baca County", - "Bent County": "Bent County", - "Prowers County": "Prowers County", - "Las Animas County": "Las Animas County", - }, - "81076": { - "Kiowa County": "Kiowa County", - "Otero County": "Otero County", - "Crowley County": "Crowley County", - "Lincoln County": "Lincoln County", - }, - "81077": {"Otero County": "Otero County"}, - "81081": {"Las Animas County": "Las Animas County"}, - "81082": {"Las Animas County": "Las Animas County"}, - "81084": {"Baca County": "Baca County", "Prowers County": "Prowers County"}, - "81087": {"Baca County": "Baca County"}, - "81089": { - "Pueblo County": "Pueblo County", - "Huerfano County": "Huerfano County", - "Las Animas County": "Las Animas County", - }, - "81090": {"Baca County": "Baca County", "Prowers County": "Prowers County"}, - "81091": { - "Costilla County": "Costilla County", - "Huerfano County": "Huerfano County", - "Las Animas County": "Las Animas County", - }, - "81092": {"Bent County": "Bent County", "Kiowa County": "Kiowa County", "Prowers County": "Prowers County"}, - "81101": { - "Alamosa County": "Alamosa County", - "Conejos County": "Conejos County", - "Costilla County": "Costilla County", - "Rio Grande County": "Rio Grande County", - }, - "81120": { - "Conejos County": "Conejos County", - "Costilla County": "Costilla County", - "Archuleta County": "Archuleta County", - "Rio Grande County": "Rio Grande County", - }, - "81121": {"La Plata County": "La Plata County", "Archuleta County": "Archuleta County"}, - "81122": { - "Hinsdale County": "Hinsdale County", - "La Plata County": "La Plata County", - "San Juan County": "San Juan County", - "Archuleta County": "Archuleta County", - }, - "81123": { - "Alamosa County": "Alamosa County", - "Conejos County": "Conejos County", - "Costilla County": "Costilla County", - "Huerfano County": "Huerfano County", - }, - "81124": {"Conejos County": "Conejos County"}, - "81125": { - "Alamosa County": "Alamosa County", - "Saguache County": "Saguache County", - "Rio Grande County": "Rio Grande County", - }, - "81126": {"Costilla County": "Costilla County"}, - "81128": {"Conejos County": "Conejos County", "Archuleta County": "Archuleta County"}, - "81129": {"Conejos County": "Conejos County"}, - "81130": { - "Mineral County": "Mineral County", - "Hinsdale County": "Hinsdale County", - "Saguache County": "Saguache County", - "San Juan County": "San Juan County", - "Archuleta County": "Archuleta County", - "Rio Grande County": "Rio Grande County", - }, - "81131": { - "Custer County": "Custer County", - "Alamosa County": "Alamosa County", - "Huerfano County": "Huerfano County", - "Saguache County": "Saguache County", - }, - "81132": { - "Conejos County": "Conejos County", - "Mineral County": "Mineral County", - "Saguache County": "Saguache County", - "Rio Grande County": "Rio Grande County", - }, - "81133": {"Costilla County": "Costilla County", "Huerfano County": "Huerfano County"}, - "81136": {"Alamosa County": "Alamosa County", "Saguache County": "Saguache County"}, - "81137": {"La Plata County": "La Plata County", "Archuleta County": "Archuleta County"}, - "81138": {"Costilla County": "Costilla County"}, - "81140": { - "Alamosa County": "Alamosa County", - "Conejos County": "Conejos County", - "Rio Grande County": "Rio Grande County", - }, - "81141": {"Conejos County": "Conejos County", "Costilla County": "Costilla County"}, - "81143": {"Custer County": "Custer County", "Saguache County": "Saguache County"}, - "81144": { - "Alamosa County": "Alamosa County", - "Conejos County": "Conejos County", - "Rio Grande County": "Rio Grande County", - }, - "81146": { - "Alamosa County": "Alamosa County", - "Costilla County": "Costilla County", - "Huerfano County": "Huerfano County", - "Saguache County": "Saguache County", - }, - "81147": { - "Conejos County": "Conejos County", - "Mineral County": "Mineral County", - "Hinsdale County": "Hinsdale County", - "La Plata County": "La Plata County", - "San Juan County": "San Juan County", - "Archuleta County": "Archuleta County", - "Rio Grande County": "Rio Grande County", - }, - "81148": {"Conejos County": "Conejos County"}, - "81149": {"Mineral County": "Mineral County", "Saguache County": "Saguache County"}, - "81151": { - "Alamosa County": "Alamosa County", - "Conejos County": "Conejos County", - "Costilla County": "Costilla County", - }, - "81152": { - "Conejos County": "Conejos County", - "Costilla County": "Costilla County", - "Huerfano County": "Huerfano County", - "Las Animas County": "Las Animas County", - }, - "81154": { - "Conejos County": "Conejos County", - "Mineral County": "Mineral County", - "Archuleta County": "Archuleta County", - "Rio Grande County": "Rio Grande County", - }, - "81155": { - "Custer County": "Custer County", - "Chaffee County": "Chaffee County", - "Fremont County": "Fremont County", - "Saguache County": "Saguache County", - }, - "81201": { - "Park County": "Park County", - "Chaffee County": "Chaffee County", - "Fremont County": "Fremont County", - "Gunnison County": "Gunnison County", - "Saguache County": "Saguache County", - }, - "81210": { - "Pitkin County": "Pitkin County", - "Chaffee County": "Chaffee County", - "Gunnison County": "Gunnison County", - }, - "81211": { - "Lake County": "Lake County", - "Park County": "Park County", - "Pitkin County": "Pitkin County", - "Chaffee County": "Chaffee County", - "Gunnison County": "Gunnison County", - }, - "81212": { - "Park County": "Park County", - "Custer County": "Custer County", - "Teller County": "Teller County", - "Fremont County": "Fremont County", - }, - "81220": { - "Ouray County": "Ouray County", - "Gunnison County": "Gunnison County", - "Hinsdale County": "Hinsdale County", - "Montrose County": "Montrose County", - }, - "81221": {"Fremont County": "Fremont County"}, - "81222": {"Fremont County": "Fremont County", "Saguache County": "Saguache County"}, - "81223": { - "Custer County": "Custer County", - "Fremont County": "Fremont County", - "Saguache County": "Saguache County", - }, - "81224": {"Pitkin County": "Pitkin County", "Gunnison County": "Gunnison County"}, - "81225": {"Pitkin County": "Pitkin County", "Gunnison County": "Gunnison County"}, - "81226": {"Custer County": "Custer County", "Fremont County": "Fremont County"}, - "81227": {"Chaffee County": "Chaffee County"}, - "81230": { - "Delta County": "Delta County", - "Mineral County": "Mineral County", - "Gunnison County": "Gunnison County", - "Hinsdale County": "Hinsdale County", - "Montrose County": "Montrose County", - "Saguache County": "Saguache County", - }, - "81231": {"Gunnison County": "Gunnison County"}, - "81232": {"Custer County": "Custer County", "Fremont County": "Fremont County"}, - "81233": {"Fremont County": "Fremont County", "Saguache County": "Saguache County"}, - "81235": { - "Ouray County": "Ouray County", - "Mineral County": "Mineral County", - "Gunnison County": "Gunnison County", - "Hinsdale County": "Hinsdale County", - "Saguache County": "Saguache County", - "San Juan County": "San Juan County", - }, - "81236": {"Chaffee County": "Chaffee County", "Gunnison County": "Gunnison County"}, - "81237": {"Gunnison County": "Gunnison County"}, - "81239": {"Gunnison County": "Gunnison County", "Saguache County": "Saguache County"}, - "81240": { - "Pueblo County": "Pueblo County", - "Teller County": "Teller County", - "El Paso County": "El Paso County", - "Fremont County": "Fremont County", - }, - "81241": {"Gunnison County": "Gunnison County"}, - "81242": {"Chaffee County": "Chaffee County"}, - "81243": { - "Gunnison County": "Gunnison County", - "Hinsdale County": "Hinsdale County", - "Saguache County": "Saguache County", - }, - "81244": {"Fremont County": "Fremont County"}, - "81248": { - "Chaffee County": "Chaffee County", - "Gunnison County": "Gunnison County", - "Saguache County": "Saguache County", - }, - "81251": {"Lake County": "Lake County", "Pitkin County": "Pitkin County", "Chaffee County": "Chaffee County"}, - "81252": { - "Custer County": "Custer County", - "Fremont County": "Fremont County", - "Huerfano County": "Huerfano County", - "Saguache County": "Saguache County", - }, - "81253": { - "Custer County": "Custer County", - "Pueblo County": "Pueblo County", - "Fremont County": "Fremont County", - }, - "81301": { - "Dolores County": "Dolores County", - "La Plata County": "La Plata County", - "San Juan County": "San Juan County", - "Montezuma County": "Montezuma County", - "San Miguel County": "San Miguel County", - }, - "81303": {"La Plata County": "La Plata County"}, - "81320": { - "Dolores County": "Dolores County", - "Montezuma County": "Montezuma County", - "San Miguel County": "San Miguel County", - }, - "81321": {"Montezuma County": "Montezuma County"}, - "81323": { - "Dolores County": "Dolores County", - "La Plata County": "La Plata County", - "San Juan County": "San Juan County", - "Montezuma County": "Montezuma County", - "San Miguel County": "San Miguel County", - }, - "81324": { - "Dolores County": "Dolores County", - "Montezuma County": "Montezuma County", - "San Miguel County": "San Miguel County", - }, - "81325": { - "Dolores County": "Dolores County", - "Montrose County": "Montrose County", - "Montezuma County": "Montezuma County", - "San Miguel County": "San Miguel County", - }, - "81326": {"La Plata County": "La Plata County", "Montezuma County": "Montezuma County"}, - "81327": {"Montezuma County": "Montezuma County"}, - "81328": {"La Plata County": "La Plata County", "Montezuma County": "Montezuma County"}, - "81330": {"Montezuma County": "Montezuma County"}, - "81331": {"Dolores County": "Dolores County", "Montezuma County": "Montezuma County"}, - "81332": { - "Dolores County": "Dolores County", - "La Plata County": "La Plata County", - "San Juan County": "San Juan County", - "Montezuma County": "Montezuma County", - "San Miguel County": "San Miguel County", - }, - "81334": {"La Plata County": "La Plata County", "Montezuma County": "Montezuma County"}, - "81335": {"Montezuma County": "Montezuma County"}, - "81401": { - "Delta County": "Delta County", - "Ouray County": "Ouray County", - "Gunnison County": "Gunnison County", - "Montrose County": "Montrose County", - }, - "81403": { - "Ouray County": "Ouray County", - "Gunnison County": "Gunnison County", - "Montrose County": "Montrose County", - "San Miguel County": "San Miguel County", - }, - "81410": {"Delta County": "Delta County"}, - "81411": {"Montrose County": "Montrose County", "San Miguel County": "San Miguel County"}, - "81413": {"Mesa County": "Mesa County", "Delta County": "Delta County"}, - "81415": { - "Delta County": "Delta County", - "Gunnison County": "Gunnison County", - "Montrose County": "Montrose County", - }, - "81416": {"Mesa County": "Mesa County", "Delta County": "Delta County", "Montrose County": "Montrose County"}, - "81418": {"Delta County": "Delta County"}, - "81419": {"Mesa County": "Mesa County", "Delta County": "Delta County"}, - "81422": { - "Mesa County": "Mesa County", - "Montrose County": "Montrose County", - "San Miguel County": "San Miguel County", - }, - "81423": { - "Dolores County": "Dolores County", - "Montrose County": "Montrose County", - "San Miguel County": "San Miguel County", - }, - "81424": {"Montrose County": "Montrose County"}, - "81425": {"Mesa County": "Mesa County", "Delta County": "Delta County", "Montrose County": "Montrose County"}, - "81426": { - "Dolores County": "Dolores County", - "San Juan County": "San Juan County", - "San Miguel County": "San Miguel County", - }, - "81427": { - "Ouray County": "Ouray County", - "Hinsdale County": "Hinsdale County", - "San Juan County": "San Juan County", - "San Miguel County": "San Miguel County", - }, - "81428": {"Mesa County": "Mesa County", "Delta County": "Delta County", "Gunnison County": "Gunnison County"}, - "81429": {"Montrose County": "Montrose County", "San Miguel County": "San Miguel County"}, - "81430": { - "Ouray County": "Ouray County", - "Dolores County": "Dolores County", - "Montrose County": "Montrose County", - "San Miguel County": "San Miguel County", - }, - "81431": {"Montrose County": "Montrose County", "San Miguel County": "San Miguel County"}, - "81432": { - "Ouray County": "Ouray County", - "Gunnison County": "Gunnison County", - "Hinsdale County": "Hinsdale County", - "Montrose County": "Montrose County", - "San Miguel County": "San Miguel County", - }, - "81433": { - "Ouray County": "Ouray County", - "Hinsdale County": "Hinsdale County", - "La Plata County": "La Plata County", - "San Juan County": "San Juan County", - "San Miguel County": "San Miguel County", - }, - "81434": { - "Mesa County": "Mesa County", - "Delta County": "Delta County", - "Pitkin County": "Pitkin County", - "Gunnison County": "Gunnison County", - }, - "81435": { - "Ouray County": "Ouray County", - "Dolores County": "Dolores County", - "San Juan County": "San Juan County", - "San Miguel County": "San Miguel County", - }, - "81501": {"Mesa County": "Mesa County"}, - "81503": {"Mesa County": "Mesa County"}, - "81504": {"Mesa County": "Mesa County"}, - "81505": {"Mesa County": "Mesa County"}, - "81506": {"Mesa County": "Mesa County"}, - "81507": {"Mesa County": "Mesa County"}, - "81520": {"Mesa County": "Mesa County"}, - "81521": {"Mesa County": "Mesa County"}, - "81522": {"Mesa County": "Mesa County", "Montrose County": "Montrose County"}, - "81523": {"Mesa County": "Mesa County"}, - "81524": {"Mesa County": "Mesa County", "Garfield County": "Garfield County"}, - "81525": {"Mesa County": "Mesa County", "Garfield County": "Garfield County"}, - "81526": {"Mesa County": "Mesa County"}, - "81527": {"Mesa County": "Mesa County", "Delta County": "Delta County", "Montrose County": "Montrose County"}, - "81601": { - "Eagle County": "Eagle County", - "Pitkin County": "Pitkin County", - "Garfield County": "Garfield County", - }, - "81610": {"Moffat County": "Moffat County", "Rio Blanco County": "Rio Blanco County"}, - "81611": { - "Lake County": "Lake County", - "Pitkin County": "Pitkin County", - "Chaffee County": "Chaffee County", - "Gunnison County": "Gunnison County", - }, - "81612": {"Pitkin County": "Pitkin County"}, - "81615": {"Pitkin County": "Pitkin County"}, - "81620": {"Eagle County": "Eagle County"}, - "81621": { - "Eagle County": "Eagle County", - "Pitkin County": "Pitkin County", - "Garfield County": "Garfield County", - }, - "81623": { - "Mesa County": "Mesa County", - "Eagle County": "Eagle County", - "Pitkin County": "Pitkin County", - "Garfield County": "Garfield County", - "Gunnison County": "Gunnison County", - }, - "81624": { - "Mesa County": "Mesa County", - "Delta County": "Delta County", - "Pitkin County": "Pitkin County", - "Garfield County": "Garfield County", - "Gunnison County": "Gunnison County", - }, - "81625": {"Routt County": "Routt County", "Moffat County": "Moffat County"}, - "81630": { - "Mesa County": "Mesa County", - "Garfield County": "Garfield County", - "Rio Blanco County": "Rio Blanco County", - }, - "81631": {"Eagle County": "Eagle County"}, - "81632": {"Eagle County": "Eagle County"}, - "81633": {"Moffat County": "Moffat County", "Rio Blanco County": "Rio Blanco County"}, - "81635": { - "Mesa County": "Mesa County", - "Garfield County": "Garfield County", - "Rio Blanco County": "Rio Blanco County", - }, - "81637": { - "Eagle County": "Eagle County", - "Routt County": "Routt County", - "Garfield County": "Garfield County", - "Rio Blanco County": "Rio Blanco County", - }, - "81638": { - "Routt County": "Routt County", - "Moffat County": "Moffat County", - "Rio Blanco County": "Rio Blanco County", - }, - "81639": { - "Routt County": "Routt County", - "Moffat County": "Moffat County", - "Rio Blanco County": "Rio Blanco County", - }, - "81640": {"Moffat County": "Moffat County", "Rio Blanco County": "Rio Blanco County"}, - "81641": { - "Routt County": "Routt County", - "Moffat County": "Moffat County", - "Garfield County": "Garfield County", - "Rio Blanco County": "Rio Blanco County", - }, - "81642": {"Lake County": "Lake County", "Eagle County": "Eagle County", "Pitkin County": "Pitkin County"}, - "81643": {"Mesa County": "Mesa County", "Delta County": "Delta County"}, - "81645": { - "Lake County": "Lake County", - "Eagle County": "Eagle County", - "Pitkin County": "Pitkin County", - "Summit County": "Summit County", - }, - "81646": {"Mesa County": "Mesa County", "Delta County": "Delta County"}, - "81647": { - "Mesa County": "Mesa County", - "Pitkin County": "Pitkin County", - "Garfield County": "Garfield County", - "Rio Blanco County": "Rio Blanco County", - }, - "81648": { - "Moffat County": "Moffat County", - "Garfield County": "Garfield County", - "Rio Blanco County": "Rio Blanco County", - }, - "81649": {"Eagle County": "Eagle County", "Summit County": "Summit County"}, - "81650": { - "Mesa County": "Mesa County", - "Garfield County": "Garfield County", - "Rio Blanco County": "Rio Blanco County", - }, - "81652": {"Mesa County": "Mesa County", "Garfield County": "Garfield County"}, - "81653": {"Routt County": "Routt County", "Moffat County": "Moffat County"}, - "81654": {"Pitkin County": "Pitkin County", "Gunnison County": "Gunnison County"}, - "81655": {"Eagle County": "Eagle County", "Summit County": "Summit County"}, - "81656": {"Pitkin County": "Pitkin County"}, - "81657": {"Eagle County": "Eagle County", "Summit County": "Summit County"}, - "82063": {"Jackson County": "Jackson County", "Larimer County": "Larimer County"}, - } - - category_benefits = { - "cash": { - "benefits": { - "oap": { - "_label": "cashAssistanceBenefits.oap", - "_default_message": "State cash assistance for individuals 60 years of age or older (Old Age Pension/OAP)", - }, - "ssi": { - "_label": "cashAssistanceBenefits.ssi", - "_default_message": "Federal cash assistance for individuals who are disabled, blind, or 65 years of age or older (Supplemental Security Income/SSI)", - }, - "ssdi": { - "_label": "cashAssistanceBenefits.ssdi", - "_default_message": "Social security benefit for people with disabilities (Social Security Disability Insurance/SSDI)", - }, - "tanf": { - "_label": "cashAssistanceBenefits.tanf", - "_default_message": "Cash assistance and work support (Temporary Assistance for Needy Families (TANF/Colorado Works))", - }, - "andcs": { - "_label": "cashAssistanceBenefits.andcs", - "_default_message": "State cash assistance for individuals who are disabled and receiving SSI (Aid to the Needy Disabled - Colorado Supplement/AND-CS)", - }, - }, - "category_name": "Cash Assistance", - }, - "childCare": { - "benefits": { - "upk": { - "_label": "childCareBenefits.univpresc", - "_default_message": "Free preschool (Universal Preschool Colorado)", - }, - "pell": { - "_label": "childCareBenefits.pell", - "_default_message": "Federal grant to finance college costs (Pell Grant)", - }, - "cccap": { - "_label": "childCareBenefits.cccap", - "_default_message": "Help with child care costs (Colorado Child Care Assistance Program/CCCAP)", - }, - "mydenver": { - "_label": "childCareBenefits.mydenver", - "_default_message": "Reduced-cost youth programs (MY Denver Card)", - }, - "coheadstart": { - "_label": "childCareBenefits.coheadstart", - "_default_message": "Free early child care and preschool (Colorado Head Start)", - }, - "denverpresc": { - "_label": "childCareBenefits.denverpresc", - "_default_message": "Tuition credits for Denver preschoolers (Denver Preschool Program)", - }, - }, - "category_name": "Child Care, Youth, and Education", - }, - "healthCare": { - "benefits": { - "dentallowincseniors": { - "_label": "healthCareBenefits.dentallowincseniors", - "_default_message": "Low-cost dental care for people 60 years of age or older (Colorado Dental Health Program for Low-Income Seniors)", - } - }, - "category_name": "Health Care", - }, - "taxCredits": { - "benefits": { - "ctc": { - "_label": "taxCreditBenefits.ctc", - "_default_message": "Federal tax credit: child tax credit (Child Tax Credit)", - }, - "eitc": { - "_label": "taxCreditBenefits.eitc", - "_default_message": "Federal tax credit: earned income (Earned Income Tax Credit)", - }, - "coctc": { - "_label": "taxCreditBenefits.coctc", - "_default_message": "State tax credit: Colorado child tax credit", - }, - "coeitc": { - "_label": "taxCreditBenefits.coeitc", - "_default_message": "State tax credit: earned income (Colorado Earned Income Tax Credit/Expanded Earned Income Tax Credit)", - }, - }, - "category_name": "Tax Credits", - }, - "transportation": { - "benefits": { - "rtdlive": { - "_label": "transportationBenefits.rtdlive", - "_default_message": "Discounted RTD fares (RTD LiVE)", - } - }, - "category_name": "Transportation", - }, - "foodAndNutrition": { - "benefits": { - "ede": { - "_label": "foodAndNutritionBenefits.ede", - "_default_message": "Food support for people 60 years of age or older (Everyday Eats)", - }, - "wic": { - "_label": "foodAndNutritionBenefits.wic", - "_default_message": "Food and breastfeeding assistance (Special Supplemental Nutrition Program for Women, Infants, and Children/WIC)", - }, - "nslp": { - "_label": "foodAndNutritionBenefits.nslp", - "_default_message": "Free school meals (National School Lunch Program)", - }, - "snap": { - "_label": "foodAndNutritionBenefits.snap", - "_default_message": "Food assistance (Supplemental Nutrition Assistance Program/SNAP)", - }, - }, - "category_name": "Food and Nutrition", - }, - "housingAndUtilities": { - "benefits": { - "acp": { - "_label": "housingAndUtilities.acp", - "_default_message": "Home internet discount (Affordable Connectivity Program)", - }, - "ubp": { - "_label": "housingAndUtilities.ubp", - "_default_message": "Help paying utility bills (Colorado Utility Bill Help Program)", - }, - "leap": { - "_label": "housingAndUtilities.leap", - "_default_message": "Help with winter heating bills (Low-Income Energy Assistance Program/LEAP)", - }, - "cowap": { - "_label": "housingAndUtilities.cowap", - "_default_message": "Free home energy upgrades (Weatherization Assistance Program)", - }, - "lifeline": { - "_label": "housingAndUtilities.lifeline", - "_default_message": "Phone or internet discount (Lifeline Phone/Internet Service)", - }, - "coPropTaxRentHeatCreditRebate": { - "_label": "cashAssistanceBenefits.coPropTaxRentHeatCreditRebate", - "_default_message": "Cash to pay property tax, rent, and heat bills (Colorado Property Tax/Rent/Heat Credit Rebate)", - }, - }, - "category_name": "Housing and Utilities", - }, - } + category_benefits = {"cash": {"benefits": {"oap": {"_label": "cashAssistanceBenefits.oap", "_default_message": "State cash assistance for individuals 60 years of age or older (Old Age Pension/OAP)"}, "ssi": {"_label": "cashAssistanceBenefits.ssi", "_default_message": "Federal cash assistance for individuals who are disabled, blind, or 65 years of age or older (Supplemental Security Income/SSI)"}, "ssdi": {"_label": "cashAssistanceBenefits.ssdi", "_default_message": "Social security benefit for people with disabilities (Social Security Disability Insurance/SSDI)"}, "tanf": {"_label": "cashAssistanceBenefits.tanf", "_default_message": "Cash assistance and work support (Temporary Assistance for Needy Families (TANF/Colorado Works))"}, "andcs": {"_label": "cashAssistanceBenefits.andcs", "_default_message": "State cash assistance for individuals who are disabled and receiving SSI (Aid to the Needy Disabled - Colorado Supplement/AND-CS)"}}, "category_name": "Cash Assistance"}, "childCare": {"benefits": {"upk": {"_label": "childCareBenefits.univpresc", "_default_message": "Free preschool (Universal Preschool Colorado)"}, "pell": {"_label": "childCareBenefits.pell", "_default_message": "Federal grant to finance college costs (Pell Grant)"}, "cccap": {"_label": "childCareBenefits.cccap", "_default_message": "Help with child care costs (Colorado Child Care Assistance Program/CCCAP)"}, "mydenver": {"_label": "childCareBenefits.mydenver", "_default_message": "Reduced-cost youth programs (MY Denver Card)"}, "coheadstart": {"_label": "childCareBenefits.coheadstart", "_default_message": "Free early child care and preschool (Colorado Head Start)"}, "denverpresc": {"_label": "childCareBenefits.denverpresc", "_default_message": "Tuition credits for Denver preschoolers (Denver Preschool Program)"}}, "category_name": "Child Care, Youth, and Education"}, "healthCare": {"benefits": {"dentallowincseniors": {"_label": "healthCareBenefits.dentallowincseniors", "_default_message": "Low-cost dental care for people 60 years of age or older (Colorado Dental Health Program for Low-Income Seniors)"}}, "category_name": "Health Care"}, "taxCredits": {"benefits": {"ctc": {"_label": "taxCreditBenefits.ctc", "_default_message": "Federal tax credit: child tax credit (Child Tax Credit)"}, "eitc": {"_label": "taxCreditBenefits.eitc", "_default_message": "Federal tax credit: earned income (Earned Income Tax Credit)"}, "coctc": {"_label": "taxCreditBenefits.coctc", "_default_message": "State tax credit: Colorado child tax credit"}, "coeitc": {"_label": "taxCreditBenefits.coeitc", "_default_message": "State tax credit: earned income (Colorado Earned Income Tax Credit/Expanded Earned Income Tax Credit)"}}, "category_name": "Tax Credits"}, "transportation": {"benefits": {"rtdlive": {"_label": "transportationBenefits.rtdlive", "_default_message": "Discounted RTD fares (RTD LiVE)"}}, "category_name": "Transportation"}, "foodAndNutrition": {"benefits": {"ede": {"_label": "foodAndNutritionBenefits.ede", "_default_message": "Food support for people 60 years of age or older (Everyday Eats)"}, "wic": {"_label": "foodAndNutritionBenefits.wic", "_default_message": "Food and breastfeeding assistance (Special Supplemental Nutrition Program for Women, Infants, and Children/WIC)"}, "nslp": {"_label": "foodAndNutritionBenefits.nslp", "_default_message": "Free school meals (National School Lunch Program)"}, "snap": {"_label": "foodAndNutritionBenefits.snap", "_default_message": "Food assistance (Supplemental Nutrition Assistance Program/SNAP)"}}, "category_name": "Food and Nutrition"}, "housingAndUtilities": {"benefits": {"acp": {"_label": "housingAndUtilities.acp", "_default_message": "Home internet discount (Affordable Connectivity Program)"}, "ubp": {"_label": "housingAndUtilities.ubp", "_default_message": "Help paying utility bills (Colorado Utility Bill Help Program)"}, "leap": {"_label": "housingAndUtilities.leap", "_default_message": "Help with winter heating bills (Low-Income Energy Assistance Program/LEAP)"}, "cowap": {"_label": "housingAndUtilities.cowap", "_default_message": "Free home energy upgrades (Weatherization Assistance Program)"}, "lifeline": {"_label": "housingAndUtilities.lifeline", "_default_message": "Phone or internet discount (Lifeline Phone/Internet Service)"}, "coPropTaxRentHeatCreditRebate": {"_label": "cashAssistanceBenefits.coPropTaxRentHeatCreditRebate", "_default_message": "Cash to pay property tax, rent, and heat bills (Colorado Property Tax/Rent/Heat Credit Rebate)"}}, "category_name": "Housing and Utilities"}} def handle(self, *args, **options): # Save acute_condition_options to database @@ -2625,4 +78,4 @@ def handle(self, *args, **options): Configuration.objects.create(name="counties_by_zipcode", data=self.counties_by_zipcode, active=True) # Save category_benefits to database - Configuration.objects.create(name="category_benefits", data=self.category_benefits, active=True) + Configuration.objects.create(name="category_benefits", data=self.category_benefits, active=True) \ No newline at end of file diff --git a/configuration/models.py b/configuration/models.py index 9a78753f..381fc791 100644 --- a/configuration/models.py +++ b/configuration/models.py @@ -1,10 +1,9 @@ from django.db import models - class Configuration(models.Model): name = models.CharField(max_length=320) data = models.JSONField(default=dict) active = models.BooleanField() - + def __str__(self): - return self.name + return self.name \ No newline at end of file diff --git a/configuration/serializers.py b/configuration/serializers.py index 6fedd161..8e767be6 100644 --- a/configuration/serializers.py +++ b/configuration/serializers.py @@ -1,10 +1,9 @@ from configuration.models import Configuration from rest_framework import serializers - class ConfigurationSerializer(serializers.ModelSerializer): id = serializers.ReadOnlyField() class Meta: model = Configuration - fields = "__all__" + fields = '__all__' \ No newline at end of file diff --git a/configuration/urls.py b/configuration/urls.py index b97f2c6a..0e786d1a 100644 --- a/configuration/urls.py +++ b/configuration/urls.py @@ -3,8 +3,8 @@ from . import views router = routers.DefaultRouter() -router.register(r"configuration", views.ConfigurationView) +router.register(r'configuration', views.ConfigurationView) urlpatterns = [ - path("", include(router.urls)), + path('', include(router.urls)), ] diff --git a/configuration/views.py b/configuration/views.py index 9da1b1aa..fcbed50e 100644 --- a/configuration/views.py +++ b/configuration/views.py @@ -10,13 +10,13 @@ class ConfigurationView(viewsets.ReadOnlyModelViewSet): """ API endpoint that allows configurations to be viewed. """ - queryset = Configuration.objects.filter(active=True) serializer_class = ConfigurationSerializer permission_classes = [permissions.DjangoModelPermissions] + def retrieve(self, request, pk=None): configuration = get_object_or_404(self.queryset, name=pk) serializer = ConfigurationSerializer(configuration) - return Response(serializer.data) + return Response(serializer.data) \ No newline at end of file diff --git a/integrations/apps.py b/integrations/apps.py index f50c67a6..bb57e755 100644 --- a/integrations/apps.py +++ b/integrations/apps.py @@ -2,4 +2,4 @@ class IntegrationsConfig(AppConfig): - name = "integrations" + name = 'integrations' diff --git a/integrations/management/commands/hubspotsync.py b/integrations/management/commands/hubspotsync.py index 7fb95061..0b408c44 100644 --- a/integrations/management/commands/hubspotsync.py +++ b/integrations/management/commands/hubspotsync.py @@ -8,26 +8,26 @@ class Command(BaseCommand): - help = "Syncs new users to Hubspot and clears PII from local records" + help = 'Syncs new users to Hubspot and clears PII from local records' def add_arguments(self, parser): - parser.add_argument("limit", nargs="?", default="1", type=int) + parser.add_argument('limit', nargs='?', default='1', type=int) def handle(self, *args, **options): - limit = options["limit"] + limit = options['limit'] status = self.sync_mfb_hubspot_users(limit) - if len(status["completed"]) > 0: - self.stdout.write(self.style.SUCCESS("Successfully synced %s users." % len(status["completed"]))) - for message in status["completed"]: + if len(status['completed']) > 0: + self.stdout.write( + self.style.SUCCESS('Successfully synced %s users.' % len(status['completed']))) + for message in status['completed']: self.stdout.write( - self.style.SUCCESS("Successfully synced user %s with contact %s." % (message[0], message[1])) - ) - if len(status["failed"]) > 0: - self.stdout.write(self.style.WARNING("Failed to sync %s users." % len(status["failed"]))) - for message in status["failed"]: + self.style.SUCCESS('Successfully synced user %s with contact %s.' % (message[0], message[1]))) + if len(status['failed']) > 0: + self.stdout.write( + self.style.WARNING('Failed to sync %s users.' % len(status['failed']))) + for message in status['failed']: self.stdout.write( - self.style.SUCCESS("Successfully synced user %s with contact %s." % (message[0], message[1])) - ) + self.style.SUCCESS('Successfully synced user %s with contact %s.' % (message[0], message[1]))) # MFB allows users to sign up to receive benefits updates or offers. If they do # so PII is temporarily stored against their user record. This cron function @@ -35,21 +35,23 @@ def handle(self, *args, **options): # hubspot, and then clears the PII on the user record in favor of storing the # external id. This separates PII from household demographic. def sync_mfb_hubspot_users(self, limit): - status = {"processed": 0, "completed": [], "failed": []} + status = { + 'processed': 0, + 'completed': [], + 'failed': [] + } screen = None processed = 0 # for now, we only sync users to hubspot who have signed up for offers or # updates and given TCPA consent - unsynced = ( - User.objects.filter(Q(send_offers=True) | Q(send_updates=True)) - .filter(external_id__isnull=True) + unsynced = User.objects.filter(Q(send_offers=True) | Q(send_updates=True))\ + .filter(external_id__isnull=True)\ .filter(tcpa_consent=True) - ) for user in unsynced: if processed < limit: - user_screens = Screen.objects.filter(user_id=user.id).order_by("-submission_date") + user_screens = Screen.objects.filter(user_id=user.id).order_by('-submission_date') if user_screens: screen = user_screens.first() else: @@ -57,19 +59,19 @@ def sync_mfb_hubspot_users(self, limit): hubspot_id = upsert_user_hubspot(user, screen) if hubspot_id: self.replace_pii_with_hubspot_id(hubspot_id, user) - status["completed"].append((user.id, hubspot_id)) + status['completed'].append((user.id, hubspot_id)) else: - status["failed"].append((user.id, hubspot_id)) + status['failed'].append((user.id, hubspot_id)) # Delay to prevent hitting rate limit of 100 req per 10 seconds - time.sleep(0.2) + time.sleep(.2) processed += 1 return status # stores an external id from hubspot and then clears all of the PII def replace_pii_with_hubspot_id(self, hubspot_id, user): - random_id = str(uuid.uuid4()).replace("-", "") + random_id = str(uuid.uuid4()).replace('-', '') user.external_id = hubspot_id - user.email_or_cell = f"{hubspot_id}+{random_id}@myfriendben.org" + user.email_or_cell = f'{hubspot_id}+{random_id}@myfriendben.org' user.first_name = None user.last_name = None user.cell = None diff --git a/integrations/services/communications/__init__.py b/integrations/services/communications/__init__.py index 10f4b18e..18608ce6 100644 --- a/integrations/services/communications/__init__.py +++ b/integrations/services/communications/__init__.py @@ -1 +1,2 @@ from .message import MessageUser + diff --git a/integrations/services/communications/message.py b/integrations/services/communications/message.py index 45a84103..c709261b 100644 --- a/integrations/services/communications/message.py +++ b/integrations/services/communications/message.py @@ -16,8 +16,8 @@ class MessageUser: cell_auth_token = config("TWILIO_TOKEN") cell_from_phone_number = config("TWILIO_PHONE_NUMBER") - email_from = "screener@myfriendben.org" - email_api_key = config("SENDGRID") + email_from = 'screener@myfriendben.org' + email_api_key = config('SENDGRID') def __init__(self, screen: Screen, lang: str) -> None: self.screen = screen @@ -45,16 +45,16 @@ def email(self, email: str, send_tests=False): sg.client.mail.send.post(request_body=mail.get()) - self.log("emailScreen") + self.log('emailScreen') def _email_client(self): return sendgrid.SendGridAPIClient(api_key=self.email_api_key) def _email_subject(self): - return Translation.objects.get(label="sendResults.email-subject").get_lang(self.lang).text + return Translation.objects.get(label='sendResults.email-subject').get_lang(self.lang).text def _email_body(self): - words = Translation.objects.get(label="sendResults.email").get_lang(self.lang).text + words = Translation.objects.get(label='sendResults.email').get_lang(self.lang).text url = self._generate_link() return words + f' {url}' @@ -69,21 +69,22 @@ def text(self, cell: str, send_tests=False): to=cell, ) - self.log("textScreen") + self.log('textScreen') def _text_body(self): - words = Translation.objects.get(label="sendResults.email").get_lang(self.lang).text + words = Translation.objects.get(label='sendResults.email').get_lang(self.lang).text url = self._generate_link() - return f"{words} {url}" + return f'{words} {url}' def _cell_client(self): return Client(self.cell_account_sid, self.cell_auth_token) + def _generate_link(self): return f"{self.front_end_domain}/{self.screen.uuid}/results" - def log(self, type: Literal["emailScreen", "textScreen"]): + def log(self, type: Literal['emailScreen', 'textScreen']): self.screen.last_email_request_date = timezone.now() self.screen.save() @@ -91,3 +92,4 @@ def log(self, type: Literal["emailScreen", "textScreen"]): type=type, screen=self.screen, ) + diff --git a/integrations/services/google_translate/integration.py b/integrations/services/google_translate/integration.py index 29a1eb02..7405f47c 100644 --- a/integrations/services/google_translate/integration.py +++ b/integrations/services/google_translate/integration.py @@ -6,50 +6,50 @@ import html -class Translate: +class Translate(): main_language: str = settings.LANGUAGE_CODE languages: list[str] = [ - lang["code"] for lang in settings.PARLER_LANGUAGES[None] if lang["code"] != settings.LANGUAGE_CODE + lang['code'] for lang in settings.PARLER_LANGUAGES[None] if lang['code'] != settings.LANGUAGE_CODE ] def __init__(self): - info = json.loads(config("GOOGLE_APPLICATION_CREDENTIALS")) + info = json.loads(config('GOOGLE_APPLICATION_CREDENTIALS')) creds = service_account.Credentials.from_service_account_info(info) self.client = translate.Client(credentials=creds) def translate(self, lang: str, text: str): - """ + ''' Translates the text from the default language to the lang param language. - """ + ''' if lang not in Translate.languages: - raise Exception(f"{lang} is not configured in settings, or is the default language") + raise Exception(f'{lang} is not configured in settings, or is the default language') result = self.client.translate(text, target_language=lang, source_language=Translate.main_language) return self.format_text(result) def bulk_translate(self, langs: list[str], texts: list[str]): - """ + ''' Translates all of the texts to the target langs. Include __all__ in langs to tranlsate to all languages. - """ - if "__all__" in langs: + ''' + if '__all__' in langs: langs = Translate.languages translations = {text: {} for text in texts} for lang in langs: if lang not in Translate.languages: - raise Exception(f"{lang} is not configured in settings, or is the default language") + raise Exception(f'{lang} is not configured in settings, or is the default language') results = self.client.translate(texts, target_language=lang, source_language=Translate.main_language) for result in results: - translations[result["input"]][lang] = self.format_text(result) + translations[result['input']][lang] = self.format_text(result) return translations def format_text(self, result): - leading_spaces = len(result["input"]) - len(result["input"].lstrip(" ")) - trailing_spaces = len(result["input"]) - len(result["input"].rstrip(" ")) + leading_spaces = len(result['input']) - len(result['input'].lstrip(' ')) + trailing_spaces = len(result['input']) - len(result['input'].rstrip(' ')) - return " " * leading_spaces + html.unescape(result["translatedText"]) + " " * trailing_spaces + return ' ' * leading_spaces + html.unescape(result['translatedText']) + ' ' * trailing_spaces diff --git a/integrations/services/hubspot/integration.py b/integrations/services/hubspot/integration.py index 6fdd5825..2f792d4d 100644 --- a/integrations/services/hubspot/integration.py +++ b/integrations/services/hubspot/integration.py @@ -16,8 +16,8 @@ def upsert_user_hubspot(user, screen=None): def update_send_offers_hubspot(external_id, send_offers, send_updates): hubspot = Hubspot() contact = { - "ab01___send_offers": send_offers, - "ab01___send_updates": send_updates, + 'ab01___send_offers': send_offers, + 'ab01___send_updates': send_updates, } try: hubspot.update_contact(external_id, contact) @@ -25,9 +25,9 @@ def update_send_offers_hubspot(external_id, send_offers, send_updates): print(e) -class Hubspot: +class Hubspot(): def __init__(self): - self.api_client = HubSpot(access_token=config("HUBSPOT")) + self.api_client = HubSpot(access_token=config('HUBSPOT')) # Hubspot has no insert or update option in their latest API, so the code # below first attempts to create a contact. If there is already a contact @@ -40,7 +40,7 @@ def upsert_contact(self, contact): contact_id = api_response.id except ApiException as e: http_body = json.loads(e.body) - if http_body["category"] == "CONFLICT": + if http_body['category'] == 'CONFLICT': try: contact_id = self.get_conflict_contact_id(e) self.update_contact(contact_id, contact) @@ -52,16 +52,21 @@ def upsert_contact(self, contact): return contact_id def create_contact(self, user): - simple_public_object_input = SimplePublicObjectInput(properties=user) + simple_public_object_input = SimplePublicObjectInput( + properties=user + ) api_response = self.api_client.crm.contacts.basic_api.create( simple_public_object_input=simple_public_object_input ) return api_response def update_contact(self, contact_id, user): - simple_public_object_input = SimplePublicObjectInput(properties=user) + simple_public_object_input = SimplePublicObjectInput( + properties=user + ) api_response = self.api_client.crm.contacts.basic_api.update( - contact_id, simple_public_object_input=simple_public_object_input + contact_id, + simple_public_object_input=simple_public_object_input ) return api_response @@ -78,38 +83,38 @@ def get_conflict_contact_id(self, e): http_body = json.loads(e.body) # strip everything out of the error message except the contact id # https://community.hubspot.com/t5/APIs-Integrations/Contacts-v3-contact-exists-error/m-p/364629 - contact_id = re.sub("[^0-9]", "", http_body["message"]) + contact_id = re.sub('[^0-9]', '', http_body['message']) return contact_id def mfb_user_to_hubspot_contact(self, user, screen=None): contact = { - "email": user.email, - "firstname": user.first_name, - "lastname": user.last_name, - "phone": str(user.cell), - "benefits_screener_id": user.id, - "ab01___send_offers": user.send_offers, - "ab01___send_updates": user.send_updates, - "ab01___tcpa_consent_to_contact": user.tcpa_consent, - "hs_language": user.language_code, - "ab01___screener_id": None, - "ab01___screener_uuid": None, - "ab01___1st_mfb_completion_date": user.date_joined.date().isoformat(), - "full_name": f"{user.first_name} {user.last_name}", + 'email': user.email, + 'firstname': user.first_name, + 'lastname': user.last_name, + 'phone': str(user.cell), + 'benefits_screener_id': user.id, + 'ab01___send_offers': user.send_offers, + 'ab01___send_updates': user.send_updates, + 'ab01___tcpa_consent_to_contact': user.tcpa_consent, + 'hs_language': user.language_code, + 'ab01___screener_id': None, + 'ab01___screener_uuid': None, + 'ab01___1st_mfb_completion_date': user.date_joined.date().isoformat(), + 'full_name': f'{user.first_name} {user.last_name}' } if screen: - contact["ab01___screener_id"] = screen.id - contact["ab01___uuid"] = str(screen.uuid) + contact['ab01___screener_id'] = screen.id + contact['ab01___uuid'] = str(screen.uuid) return contact def format_email_new_benefit(self, user, num_benefits, value_benefits): contact = { - "id": user.external_id, - "properties": { - "ab01___number_of_new_benefits": int(num_benefits), - "ab01___new_benefit_total_value": int(value_benefits), - }, + 'id': user.external_id, + 'properties': { + 'ab01___number_of_new_benefits': int(num_benefits), + 'ab01___new_benefit_total_value': int(value_benefits), + } } return contact diff --git a/integrations/services/sheets/sheets.py b/integrations/services/sheets/sheets.py index a09e46a6..4f6dc1c8 100644 --- a/integrations/services/sheets/sheets.py +++ b/integrations/services/sheets/sheets.py @@ -6,9 +6,9 @@ class GoogleSheets: - info = json.loads(config("GOOGLE_APPLICATION_CREDENTIALS")) + info = json.loads(config('GOOGLE_APPLICATION_CREDENTIALS')) creds = service_account.Credentials.from_service_account_info(info) - service = build("sheets", "v4", credentials=creds) + service = build('sheets', 'v4', credentials=creds) sheet = service.spreadsheets() class ColumnDoesNotExist(Exception): @@ -19,18 +19,20 @@ def __init__(self, spreadsheet_id: str, cell_range: str) -> None: self.cell_range = cell_range def data(self) -> list[list[any]]: - """ + ''' return a list of rows in the cell range - """ - result = self.sheet.values().get(spreadsheetId=self.spreadsheet_id, range=self.cell_range).execute() - values = result.get("values", []) + ''' + result = self.sheet.values().get( + spreadsheetId=self.spreadsheet_id, range=self.cell_range + ).execute() + values = result.get('values', []) return values def data_by_column(self, *column_names: str) -> list[dict[str, any]]: - """ + ''' return an array of dictionaries containing the column names and their values - """ + ''' data = self.data() raw_column_names = data[0] @@ -59,20 +61,20 @@ def data_by_column(self, *column_names: str) -> list[dict[str, any]]: return organized_data def print_raw_column_names(self): - """ + ''' print the column names of the spreadsheet WARN: this should only be used during development - """ + ''' raw_column_names = self.data()[0] for name in raw_column_names: print(repr(name)) def _raise_missing_columns(self, needed_columns: list[str], existing_columns: list[str]): - """ + ''' raise an exception with the column names from needed_columns that are not in existing_columns - """ + ''' missing_columns = [] for column in needed_columns: @@ -86,10 +88,11 @@ class GoogleSheetsCache(Cache): expire_time = 60 * 60 * 24 default = [] - sheet_id = "" - range_name = "" + sheet_id = '' + range_name = '' def update(self): sheet_values = GoogleSheets(self.sheet_id, self.range_name).data() return sheet_values + diff --git a/integrations/util/cache.py b/integrations/util/cache.py index 1c6d91f4..a340fb3e 100644 --- a/integrations/util/cache.py +++ b/integrations/util/cache.py @@ -2,7 +2,7 @@ import datetime -class Cache: +class Cache(): expire_time = 0 default = 0 @@ -18,7 +18,7 @@ def _update_cache(self): self.data = self.update() self.last_update = datetime.datetime.now() except Exception: - capture_message(f"Failed to update {self.__class__.__name__}", level="warning") + capture_message(f'Failed to update {self.__class__.__name__}', level='warning') def should_update(self): return datetime.datetime.now() > self.last_update + datetime.timedelta(seconds=self.expire_time) diff --git a/manage.py b/manage.py index cec8e4c5..2dd7eb2e 100755 --- a/manage.py +++ b/manage.py @@ -6,7 +6,7 @@ def main(): """Run administrative tasks.""" - os.environ.setdefault("DJANGO_SETTINGS_MODULE", "benefits.settings") + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'benefits.settings') try: from django.core.management import execute_from_command_line except ImportError as exc: @@ -18,5 +18,5 @@ def main(): execute_from_command_line(sys.argv) -if __name__ == "__main__": +if __name__ == '__main__': main() diff --git a/programs/admin.py b/programs/admin.py index e7627acb..8fdf1b8a 100644 --- a/programs/admin.py +++ b/programs/admin.py @@ -15,49 +15,49 @@ class ProgramAdmin(admin.ModelAdmin): - search_fields = ("name_abbreviated",) + search_fields = ('name_abbreviated',) class LegalStatusAdmin(admin.ModelAdmin): - search_fields = ("status",) + search_fields = ('status',) class NavigatorCountiesAdmin(admin.ModelAdmin): - search_fields = ("name",) + search_fields = ('name',) class NavigatorAdmin(admin.ModelAdmin): - search_fields = ("translations__name",) + search_fields = ('translations__name',) class UrgentNeedAdmin(admin.ModelAdmin): - search_fields = ("translations__name",) + search_fields = ('translations__name',) class UrgentNeedCategoryAdmin(admin.ModelAdmin): - search_fields = ("name",) - fields = ("name",) + search_fields = ('name',) + fields = ('name',) class UrgentNeedFunctionAdmin(admin.ModelAdmin): - search_fields = ("name",) - fields = ("name",) + search_fields = ('name',) + fields = ('name',) class FederalPovertyLimitAdmin(admin.ModelAdmin): - search_fields = ("year",) + search_fields = ('year',) class DocumentAdmin(admin.ModelAdmin): - search_fields = ("name",) + search_fields = ('name',) class ReferrerAdmin(admin.ModelAdmin): - search_fields = ("referrer_code",) + search_fields = ('referrer_code',) class WebHookFunctionsAdmin(admin.ModelAdmin): - search_fields = ("name",) + search_fields = ('name',) admin.site.register(LegalStatus, LegalStatusAdmin) diff --git a/programs/apps.py b/programs/apps.py index 34c4c1e7..8d5355c3 100644 --- a/programs/apps.py +++ b/programs/apps.py @@ -2,5 +2,5 @@ class ProgramsConfig(AppConfig): - default_auto_field = "django.db.models.BigAutoField" - name = "programs" + default_auto_field = 'django.db.models.BigAutoField' + name = 'programs' diff --git a/programs/co_county_zips.py b/programs/co_county_zips.py index bcb3f762..78746a10 100644 --- a/programs/co_county_zips.py +++ b/programs/co_county_zips.py @@ -1,3 +1,4 @@ + def counties_from_zip(lookup_zip): matches = [] @@ -910,7 +911,8 @@ def counties_from_zip(lookup_zip): "81416", "81521", ], - "Mineral County": ["81230", "81149", "81147", "81154", "81235", "81132", "81130"], + "Mineral County": [ + "81230", "81149", "81147", "81154", "81235", "81132", "81130"], "Moffat County": [ "81648", "81638", diff --git a/programs/management/commands/add_history.py b/programs/management/commands/add_history.py index 5a1faa94..8edaeaae 100644 --- a/programs/management/commands/add_history.py +++ b/programs/management/commands/add_history.py @@ -8,33 +8,38 @@ class Command(BaseCommand): - help = "Adds a new program eligibility snapshot to the history yaml file for all screens" + help = 'Adds a new program eligibility snapshot to the history yaml file for all screens' def create_screen(self, path): - with open(path, "r") as file: + with open(path, 'r') as file: screen_dict = yaml.safe_load(file) screen = Screen.objects.create( - **{key: value for key, value in screen_dict.items() if key != "household_members"}, + **{key: value for key, value in screen_dict.items() if key != 'household_members'}, agree_to_tos=True, completed=False, is_test=True - ) + ) members = [] incomes = [] expenses = [] - for member in screen_dict["household_members"]: - has_income = len(member["incomes"]) >= 1 - has_expense = len(member["expenses"]) >= 1 - household_member = {key: value for key, value in member.items() if key not in ("incomes", "expenses")} - member_model = HouseholdMember( - **household_member, has_income=has_income, has_expenses=has_expense, screen=screen - ) + for member in screen_dict['household_members']: + has_income = len(member['incomes']) >= 1 + has_expense = len(member['expenses']) >= 1 + household_member = {key: value for key, value in member.items() if key not in ('incomes', 'expenses')} + member_model = HouseholdMember(**household_member, + has_income=has_income, + has_expenses=has_expense, + screen=screen) members.append(member_model) - for income in member["incomes"]: - incomes.append(IncomeStream(**income, screen=screen, household_member=member_model)) - for expense in member["expenses"]: - expenses.append(Expense(**expense, screen=screen, household_member=member_model)) + for income in member['incomes']: + incomes.append(IncomeStream(**income, + screen=screen, + household_member=member_model)) + for expense in member['expenses']: + expenses.append(Expense(**expense, + screen=screen, + household_member=member_model)) HouseholdMember.objects.bulk_create(members) IncomeStream.objects.bulk_create(incomes) @@ -45,32 +50,32 @@ def create_screen(self, path): def eligibility(self, screen): eligibility = {} for benefit, calculator in calculators.items(): - raw_result = calculator( - screen, - [ - {"name_abbreviated": "medicaid", "eligible": False if benefit == "cfhc" else True}, - {"name_abbreviated": "tanf", "eligible": False}, - ], - ) - eligibility[benefit] = {"eligibility": raw_result["eligibility"]["eligible"], "value": raw_result["value"]} + raw_result = calculator(screen, [ + {'name_abbreviated': 'medicaid', 'eligible': False if benefit == 'cfhc' else True}, + {'name_abbreviated': 'tanf', 'eligible': False} + ]) + eligibility[benefit] = { + 'eligibility': raw_result['eligibility']['eligible'], + 'value': raw_result['value'] + } return eligibility def update_history(seld, eligibility, path, date): - with open(path, "r") as file: + with open(path, 'r') as file: history = yaml.safe_load(file) - with open(path, "w") as file: + with open(path, 'w') as file: if history is None: - yaml.dump([{"date": date, "eligibility": eligibility}], file) + yaml.dump([{'date': date, 'eligibility': eligibility}], file) else: - history.append({"date": date, "eligibility": eligibility}) + history.append({'date': date, 'eligibility': eligibility}) yaml.dump(history, file) def handle(self, *args, **options): - base_path = os.path.join(settings.BASE_DIR, "programs", "program_history") + base_path = os.path.join(settings.BASE_DIR, 'programs', 'program_history') date = datetime.now().strftime("%m/%d/%Y %H:%M:%S") for directory in os.listdir(base_path): print(directory) - screen = self.create_screen(os.path.join(base_path, directory, "screen.yaml")) + screen = self.create_screen(os.path.join(base_path, directory, 'screen.yaml')) eligibility = self.eligibility(screen) - self.update_history(eligibility, os.path.join(base_path, directory, "history.yaml"), date) + self.update_history(eligibility, os.path.join(base_path, directory, 'history.yaml'), date) diff --git a/programs/management/commands/diff_history.py b/programs/management/commands/diff_history.py index 3fd8006f..9698fe98 100644 --- a/programs/management/commands/diff_history.py +++ b/programs/management/commands/diff_history.py @@ -5,42 +5,42 @@ class Command(BaseCommand): - help = "Checks history for changes" + help = 'Checks history for changes' def compare(self, file): - with open(file, "r") as file: + with open(file, 'r') as file: history = yaml.safe_load(file) try: - latest = history[-1]["eligibility"] - second_latest = history[-2]["eligibility"] + latest = history[-1]['eligibility'] + second_latest = history[-2]['eligibility'] except IndexError: - print("nothing to compare") + print('nothing to compare') return for key in latest: try: - new_eligible = latest[key]["eligibility"] + new_eligible = latest[key]['eligibility'] except KeyError: - print(key, "was deleted") + print(key, 'was deleted') continue try: - old_eligible = second_latest[key]["eligibility"] + old_eligible = second_latest[key]['eligibility'] except KeyError: - print(key, "was added") + print(key, 'was added') continue if new_eligible != old_eligible: - print(f" {key}: {old_eligible} => {new_eligible}") + print(f' {key}: {old_eligible} => {new_eligible}') - new_value = latest[key]["value"] - old_value = second_latest[key]["value"] + new_value = latest[key]['value'] + old_value = second_latest[key]['value'] if new_value != old_value: - print(f" {key}: {old_value} => {new_value}") + print(f' {key}: {old_value} => {new_value}') def handle(self, *args, **options): - base_path = os.path.join(settings.BASE_DIR, "programs", "program_history") + base_path = os.path.join(settings.BASE_DIR, 'programs', 'program_history') for directory in os.listdir(base_path): - print(directory + ":") - self.compare(os.path.join(base_path, directory, "history.yaml")) + print(directory+':') + self.compare(os.path.join(base_path, directory, 'history.yaml')) diff --git a/programs/management/commands/quick_start.py b/programs/management/commands/quick_start.py index 7c2460f4..3f89859f 100644 --- a/programs/management/commands/quick_start.py +++ b/programs/management/commands/quick_start.py @@ -12,7 +12,9 @@ class Command(BaseCommand): - help = "create programs, navigators, urgent needs, and other starting database stuff" + help = ( + 'create programs, navigators, urgent needs, and other starting database stuff' + ) fpl = { 1: 13_590, @@ -25,116 +27,116 @@ class Command(BaseCommand): 8: 41_910, } legal_statuses = [ - "gc_under18_no5", - "gc_18plus_no5", - "gc_5plus", - "refugee", - "green_card", - "non_citizen", - "citizen", - "other", - "otherHealthCarePregnant", - "otherHealthCareUnder19", - "otherWithWorkPermission", + 'gc_under18_no5', + 'gc_18plus_no5', + 'gc_5plus', + 'refugee', + 'green_card', + 'non_citizen', + 'citizen', + 'other', + 'otherHealthCarePregnant', + 'otherHealthCareUnder19', + 'otherWithWorkPermission', ] urgent_need_categories = [ - "legal services", - "dental care", - "job resources", - "family planning", - "funeral", - "child dev", - "mental health", - "housing", - "baby supplies", - "food", + 'legal services', + 'dental care', + 'job resources', + 'family planning', + 'funeral', + 'child dev', + 'mental health', + 'housing', + 'baby supplies', + 'food', ] urgent_need_functions = [ - "co_legal_services", - "eoc", - "trua", - "bia_food_delivery", - "child", - "helpkitchen_zipcode", - "denver", + 'co_legal_services', + 'eoc', + 'trua', + 'bia_food_delivery', + 'child', + 'helpkitchen_zipcode', + 'denver', ] programs = [ - {"abbr": "cwd_medicaid", "external": "cwd_medicaid"}, - {"abbr": "awd_medicaid", "external": "awd_medivaid"}, - {"abbr": "emergency_medicaid", "external": "emergency_medicaid"}, - {"abbr": "medicare_savings", "external": "medicare_savings"}, - {"abbr": "ssi", "external": "ssi"}, - {"abbr": "trua", "external": "trua"}, - {"abbr": "rhc", "external": "rhc"}, - {"abbr": "wic", "external": "wic"}, - {"abbr": "omnisalud", "external": "omnisalud"}, - {"abbr": "dpp", "external": "dpp"}, - {"abbr": "lwcr", "external": "lwcr"}, - {"abbr": "lifeline", "external": "lifeline"}, - {"abbr": "fps", "external": "fps"}, - {"abbr": "leap", "external": "leap"}, - {"abbr": "pell_grant", "external": "pell_grant"}, - {"abbr": "mydenver", "external": "mydenver"}, - {"abbr": "ede", "external": "ede"}, - {"abbr": "cdhcs", "external": "cdhcs"}, - {"abbr": "nslp", "external": "nslp"}, - {"abbr": "erc", "external": "erc"}, - {"abbr": "chs", "external": "chs"}, - {"abbr": "cccap", "external": "cccap"}, - {"abbr": "chp", "external": "chp"}, - {"abbr": "coeitc", "external": "coexeitc"}, - {"abbr": "acp", "external": "acp"}, - {"abbr": "rtdlive", "external": "rtdlive"}, - {"abbr": "coctc", "external": "coctc"}, - {"abbr": "ssdi", "external": "ssdi"}, - {"abbr": "tanf", "external": "tanf"}, - {"abbr": "coeitc", "external": "coeitc"}, - {"abbr": "cpcr", "external": "cpcr"}, - {"abbr": "eitc", "external": "eitc"}, - {"abbr": "cfhc", "external": "cfhc"}, - {"abbr": "myspark", "external": "myspark"}, - {"abbr": "snap", "external": "snap"}, - {"abbr": "ctc", "external": "ctc"}, - {"abbr": "medicaid", "external": "medicaid"}, - {"abbr": "andcs", "external": "andcs"}, - {"abbr": "oap", "external": "oap"}, - {"abbr": "upk", "external": "upk"}, + {'abbr': 'cwd_medicaid', 'external': 'cwd_medicaid'}, + {'abbr': 'awd_medicaid', 'external': 'awd_medivaid'}, + {'abbr': 'emergency_medicaid', 'external': 'emergency_medicaid'}, + {'abbr': 'medicare_savings', 'external': 'medicare_savings'}, + {'abbr': 'ssi', 'external': 'ssi'}, + {'abbr': 'trua', 'external': 'trua'}, + {'abbr': 'rhc', 'external': 'rhc'}, + {'abbr': 'wic', 'external': 'wic'}, + {'abbr': 'omnisalud', 'external': 'omnisalud'}, + {'abbr': 'dpp', 'external': 'dpp'}, + {'abbr': 'lwcr', 'external': 'lwcr'}, + {'abbr': 'lifeline', 'external': 'lifeline'}, + {'abbr': 'fps', 'external': 'fps'}, + {'abbr': 'leap', 'external': 'leap'}, + {'abbr': 'pell_grant', 'external': 'pell_grant'}, + {'abbr': 'mydenver', 'external': 'mydenver'}, + {'abbr': 'ede', 'external': 'ede'}, + {'abbr': 'cdhcs', 'external': 'cdhcs'}, + {'abbr': 'nslp', 'external': 'nslp'}, + {'abbr': 'erc', 'external': 'erc'}, + {'abbr': 'chs', 'external': 'chs'}, + {'abbr': 'cccap', 'external': 'cccap'}, + {'abbr': 'chp', 'external': 'chp'}, + {'abbr': 'coeitc', 'external': 'coexeitc'}, + {'abbr': 'acp', 'external': 'acp'}, + {'abbr': 'rtdlive', 'external': 'rtdlive'}, + {'abbr': 'coctc', 'external': 'coctc'}, + {'abbr': 'ssdi', 'external': 'ssdi'}, + {'abbr': 'tanf', 'external': 'tanf'}, + {'abbr': 'coeitc', 'external': 'coeitc'}, + {'abbr': 'cpcr', 'external': 'cpcr'}, + {'abbr': 'eitc', 'external': 'eitc'}, + {'abbr': 'cfhc', 'external': 'cfhc'}, + {'abbr': 'myspark', 'external': 'myspark'}, + {'abbr': 'snap', 'external': 'snap'}, + {'abbr': 'ctc', 'external': 'ctc'}, + {'abbr': 'medicaid', 'external': 'medicaid'}, + {'abbr': 'andcs', 'external': 'andcs'}, + {'abbr': 'oap', 'external': 'oap'}, + {'abbr': 'upk', 'external': 'upk'}, ] urgent_needs = [ - "bia_food", - "coemap", - "dbap", - "plentiful", - "eic", - "ccs", - "ndbn", - "hfc", - "rhc", - "fps", - "better_offer", - "cedp", - "chc", - "cda", - "eocbpa", - "cls", - "trua", - "imatter", + 'bia_food', + 'coemap', + 'dbap', + 'plentiful', + 'eic', + 'ccs', + 'ndbn', + 'hfc', + 'rhc', + 'fps', + 'better_offer', + 'cedp', + 'chc', + 'cda', + 'eocbpa', + 'cls', + 'trua', + 'imatter', ] navigators = [ - "gac", - "bia", - "bdt", - "acc", - "mhuw", - "dpp", - "uph", - "cowicc", + 'gac', + 'bia', + 'bdt', + 'acc', + 'mhuw', + 'dpp', + 'uph', + 'cowicc', ] def handle(self, *args, **options): # create FPL fpl = FederalPoveryLimit.objects.create( - year="THIS YEAR", + year='THIS YEAR', has_1_person=self.fpl[1], has_2_people=self.fpl[2], has_3_people=self.fpl[3], @@ -162,8 +164,8 @@ def handle(self, *args, **options): # create programs programs = [] for program in self.programs: - new_program = Program.objects.new_program(program["abbr"]) - new_program.external_name = program["external"] + new_program = Program.objects.new_program(program['abbr']) + new_program.external_name = program['external'] new_program.fpl = fpl for status in statuses: # set all legal statuses for each program diff --git a/programs/management/commands/rm_latest_history.py b/programs/management/commands/rm_latest_history.py index 762a36dc..c52b25bb 100644 --- a/programs/management/commands/rm_latest_history.py +++ b/programs/management/commands/rm_latest_history.py @@ -5,19 +5,19 @@ class Command(BaseCommand): - help = "Checks history for changes" + help = 'Checks history for changes' def remove_latest(self, path): - with open(path, "r") as file: + with open(path, 'r') as file: history = yaml.safe_load(file) history = history[:-1] - with open(path, "w") as file: + with open(path, 'w') as file: yaml.dump(history, file) def handle(self, *args, **options): - base_path = os.path.join(settings.BASE_DIR, "programs", "program_history") + base_path = os.path.join(settings.BASE_DIR, 'programs', 'program_history') for directory in os.listdir(base_path): print(directory) - self.remove_latest(os.path.join(base_path, directory, "history.yaml")) + self.remove_latest(os.path.join(base_path, directory, 'history.yaml')) diff --git a/programs/migrations/0001_initial.py b/programs/migrations/0001_initial.py index 258f33b7..94d27846 100644 --- a/programs/migrations/0001_initial.py +++ b/programs/migrations/0001_initial.py @@ -4,26 +4,27 @@ import parler.fields import parler.models - class Migration(migrations.Migration): + initial = True - dependencies = [] + dependencies = [ + ] operations = [ migrations.CreateModel( - name="Program", + name='Program', fields=[ - ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), - ("programSnapshot", models.TextField()), - ("programName", models.CharField(max_length=120)), - ("programDescription", models.TextField()), - ("learnMoreLink", models.CharField(max_length=320)), - ("applyButtonLink", models.CharField(max_length=320)), - ("dollarValue", models.IntegerField()), - ("estimatedDeliveryTime", models.CharField(max_length=120)), - ("legalStatusRequired", models.BooleanField()), + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('programSnapshot', models.TextField()), + ('programName', models.CharField(max_length=120)), + ('programDescription', models.TextField()), + ('learnMoreLink', models.CharField(max_length=320)), + ('applyButtonLink', models.CharField(max_length=320)), + ('dollarValue', models.IntegerField()), + ('estimatedDeliveryTime', models.CharField(max_length=120)), + ('legalStatusRequired', models.BooleanField()), ], - bases=(parler.models.TranslatableModelMixin, models.Model), + bases=(parler.models.TranslatableModelMixin, models.Model) ), ] diff --git a/programs/migrations/0002_program_programnameshort.py b/programs/migrations/0002_program_programnameshort.py index 056d7300..fa128a4a 100644 --- a/programs/migrations/0002_program_programnameshort.py +++ b/programs/migrations/0002_program_programnameshort.py @@ -4,15 +4,16 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0001_initial"), + ('programs', '0001_initial'), ] operations = [ migrations.AddField( - model_name="program", - name="programNameShort", - field=models.CharField(default="snap", max_length=120), + model_name='program', + name='programNameShort', + field=models.CharField(default='snap', max_length=120), preserve_default=False, ), ] diff --git a/programs/migrations/0003_rename_applybuttonlink_program_apply_button_link_and_more.py b/programs/migrations/0003_rename_applybuttonlink_program_apply_button_link_and_more.py index ff041972..55be7831 100644 --- a/programs/migrations/0003_rename_applybuttonlink_program_apply_button_link_and_more.py +++ b/programs/migrations/0003_rename_applybuttonlink_program_apply_button_link_and_more.py @@ -4,54 +4,55 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0002_program_programnameshort"), + ('programs', '0002_program_programnameshort'), ] operations = [ migrations.RenameField( - model_name="program", - old_name="applyButtonLink", - new_name="apply_button_link", + model_name='program', + old_name='applyButtonLink', + new_name='apply_button_link', ), migrations.RenameField( - model_name="program", - old_name="dollarValue", - new_name="dollar_value", + model_name='program', + old_name='dollarValue', + new_name='dollar_value', ), migrations.RenameField( - model_name="program", - old_name="estimatedDeliveryTime", - new_name="estimated_delivery_time", + model_name='program', + old_name='estimatedDeliveryTime', + new_name='estimated_delivery_time', ), migrations.RenameField( - model_name="program", - old_name="learnMoreLink", - new_name="learn_more_link", + model_name='program', + old_name='learnMoreLink', + new_name='learn_more_link', ), migrations.RenameField( - model_name="program", - old_name="legalStatusRequired", - new_name="legal_status_required", + model_name='program', + old_name='legalStatusRequired', + new_name='legal_status_required', ), migrations.RenameField( - model_name="program", - old_name="programDescription", - new_name="program_description", + model_name='program', + old_name='programDescription', + new_name='program_description', ), migrations.RenameField( - model_name="program", - old_name="programName", - new_name="program_name", + model_name='program', + old_name='programName', + new_name='program_name', ), migrations.RenameField( - model_name="program", - old_name="programNameShort", - new_name="program_name_short", + model_name='program', + old_name='programNameShort', + new_name='program_name_short', ), migrations.RenameField( - model_name="program", - old_name="programSnapshot", - new_name="program_snapshot", + model_name='program', + old_name='programSnapshot', + new_name='program_snapshot', ), ] diff --git a/programs/migrations/0004_rename_program_snapshot_program_description_short.py b/programs/migrations/0004_rename_program_snapshot_program_description_short.py index 0d9564e7..290e77ac 100644 --- a/programs/migrations/0004_rename_program_snapshot_program_description_short.py +++ b/programs/migrations/0004_rename_program_snapshot_program_description_short.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0003_rename_applybuttonlink_program_apply_button_link_and_more"), + ('programs', '0003_rename_applybuttonlink_program_apply_button_link_and_more'), ] operations = [ migrations.RenameField( - model_name="program", - old_name="program_snapshot", - new_name="description_short", + model_name='program', + old_name='program_snapshot', + new_name='description_short', ), ] diff --git a/programs/migrations/0005_rename_program_name_program_name.py b/programs/migrations/0005_rename_program_name_program_name.py index 6a020db9..e45319c6 100644 --- a/programs/migrations/0005_rename_program_name_program_name.py +++ b/programs/migrations/0005_rename_program_name_program_name.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0004_rename_program_snapshot_program_description_short"), + ('programs', '0004_rename_program_snapshot_program_description_short'), ] operations = [ migrations.RenameField( - model_name="program", - old_name="program_name", - new_name="name", + model_name='program', + old_name='program_name', + new_name='name', ), ] diff --git a/programs/migrations/0006_rename_program_description_program_description_and_more.py b/programs/migrations/0006_rename_program_description_program_description_and_more.py index 1846cf8f..e6001367 100644 --- a/programs/migrations/0006_rename_program_description_program_description_and_more.py +++ b/programs/migrations/0006_rename_program_description_program_description_and_more.py @@ -4,19 +4,20 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0005_rename_program_name_program_name"), + ('programs', '0005_rename_program_name_program_name'), ] operations = [ migrations.RenameField( - model_name="program", - old_name="program_description", - new_name="description", + model_name='program', + old_name='program_description', + new_name='description', ), migrations.RenameField( - model_name="program", - old_name="program_name_short", - new_name="name_abbreviated", + model_name='program', + old_name='program_name_short', + new_name='name_abbreviated', ), ] diff --git a/programs/migrations/0007_alter_program_estimated_delivery_time.py b/programs/migrations/0007_alter_program_estimated_delivery_time.py index 4a1a6bd8..c8b21efd 100644 --- a/programs/migrations/0007_alter_program_estimated_delivery_time.py +++ b/programs/migrations/0007_alter_program_estimated_delivery_time.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0006_rename_program_description_program_description_and_more"), + ('programs', '0006_rename_program_description_program_description_and_more'), ] operations = [ migrations.AlterField( - model_name="program", - name="estimated_delivery_time", + model_name='program', + name='estimated_delivery_time', field=models.CharField(max_length=320), ), ] diff --git a/programs/migrations/0008_alter_program_legal_status_required.py b/programs/migrations/0008_alter_program_legal_status_required.py index bcdd2a87..36454bce 100644 --- a/programs/migrations/0008_alter_program_legal_status_required.py +++ b/programs/migrations/0008_alter_program_legal_status_required.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0007_alter_program_estimated_delivery_time"), + ('programs', '0007_alter_program_estimated_delivery_time'), ] operations = [ migrations.AlterField( - model_name="program", - name="legal_status_required", + model_name='program', + name='legal_status_required', field=models.CharField(max_length=120), ), ] diff --git a/programs/migrations/0009_program_value_type.py b/programs/migrations/0009_program_value_type.py index e2f61b6f..6d127a49 100644 --- a/programs/migrations/0009_program_value_type.py +++ b/programs/migrations/0009_program_value_type.py @@ -4,15 +4,16 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0008_alter_program_legal_status_required"), + ('programs', '0008_alter_program_legal_status_required'), ] operations = [ migrations.AddField( - model_name="program", - name="value_type", - field=models.CharField(default="non-discretionary", max_length=120), + model_name='program', + name='value_type', + field=models.CharField(default='non-discretionary', max_length=120), preserve_default=False, ), ] diff --git a/programs/migrations/0010_rename_apply_button_link_program__apply_button_link_and_more.py b/programs/migrations/0010_rename_apply_button_link_program__apply_button_link_and_more.py index 2a7ffbc2..3f94cdbd 100644 --- a/programs/migrations/0010_rename_apply_button_link_program__apply_button_link_and_more.py +++ b/programs/migrations/0010_rename_apply_button_link_program__apply_button_link_and_more.py @@ -4,59 +4,60 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0009_program_value_type"), + ('programs', '0009_program_value_type'), ] operations = [ migrations.RenameField( - model_name="program", - old_name="apply_button_link", - new_name="_apply_button_link", + model_name='program', + old_name='apply_button_link', + new_name='_apply_button_link', ), migrations.RenameField( - model_name="program", - old_name="description", - new_name="_description", + model_name='program', + old_name='description', + new_name='_description', ), migrations.RenameField( - model_name="program", - old_name="description_short", - new_name="_description_short", + model_name='program', + old_name='description_short', + new_name='_description_short', ), migrations.RenameField( - model_name="program", - old_name="dollar_value", - new_name="_dollar_value", + model_name='program', + old_name='dollar_value', + new_name='_dollar_value', ), migrations.RenameField( - model_name="program", - old_name="estimated_delivery_time", - new_name="_estimated_delivery_time", + model_name='program', + old_name='estimated_delivery_time', + new_name='_estimated_delivery_time', ), migrations.RenameField( - model_name="program", - old_name="learn_more_link", - new_name="_learn_more_link", + model_name='program', + old_name='learn_more_link', + new_name='_learn_more_link', ), migrations.RenameField( - model_name="program", - old_name="legal_status_required", - new_name="_legal_status_required", + model_name='program', + old_name='legal_status_required', + new_name='_legal_status_required', ), migrations.RenameField( - model_name="program", - old_name="name", - new_name="_name", + model_name='program', + old_name='name', + new_name='_name', ), migrations.RenameField( - model_name="program", - old_name="name_abbreviated", - new_name="_name_abbreviated", + model_name='program', + old_name='name_abbreviated', + new_name='_name_abbreviated', ), migrations.RenameField( - model_name="program", - old_name="value_type", - new_name="_value_type", + model_name='program', + old_name='value_type', + new_name='_value_type', ), ] diff --git a/programs/migrations/0011_add_translation_model.py b/programs/migrations/0011_add_translation_model.py index 0a807c4e..c7318de7 100644 --- a/programs/migrations/0011_add_translation_model.py +++ b/programs/migrations/0011_add_translation_model.py @@ -7,44 +7,36 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0010_rename_apply_button_link_program__apply_button_link_and_more"), + ('programs', '0010_rename_apply_button_link_program__apply_button_link_and_more'), ] operations = [ migrations.CreateModel( - name="ProgramTranslation", + name='ProgramTranslation', fields=[ - ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), - ("language_code", models.CharField(db_index=True, max_length=15, verbose_name="Language")), - ("description_short", models.TextField()), - ("name", models.CharField(max_length=120)), - ("name_abbreviated", models.CharField(max_length=120)), - ("description", models.TextField()), - ("learn_more_link", models.CharField(max_length=320)), - ("apply_button_link", models.CharField(max_length=320)), - ("dollar_value", models.IntegerField()), - ("value_type", models.CharField(max_length=120)), - ("estimated_delivery_time", models.CharField(max_length=320)), - ("legal_status_required", models.CharField(max_length=120)), - ( - "master", - parler.fields.TranslationsForeignKey( - editable=False, - null=True, - on_delete=django.db.models.deletion.CASCADE, - related_name="translations", - to="programs.program", - ), - ), + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('language_code', models.CharField(db_index=True, max_length=15, verbose_name='Language')), + ('description_short', models.TextField()), + ('name', models.CharField(max_length=120)), + ('name_abbreviated', models.CharField(max_length=120)), + ('description', models.TextField()), + ('learn_more_link', models.CharField(max_length=320)), + ('apply_button_link', models.CharField(max_length=320)), + ('dollar_value', models.IntegerField()), + ('value_type', models.CharField(max_length=120)), + ('estimated_delivery_time', models.CharField(max_length=320)), + ('legal_status_required', models.CharField(max_length=120)), + ('master', parler.fields.TranslationsForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='programs.program')), ], options={ - "verbose_name": "program Translation", - "db_table": "programs_program_translation", - "db_tablespace": "", - "managed": True, - "default_permissions": (), - "unique_together": {("language_code", "master")}, + 'verbose_name': 'program Translation', + 'db_table': 'programs_program_translation', + 'db_tablespace': '', + 'managed': True, + 'default_permissions': (), + 'unique_together': {('language_code', 'master')}, }, bases=(parler.models.TranslatedFieldsModelMixin, models.Model), ), diff --git a/programs/migrations/0012_migrate_translatable_fields.py b/programs/migrations/0012_migrate_translatable_fields.py index cde7cc50..e34f5246 100644 --- a/programs/migrations/0012_migrate_translatable_fields.py +++ b/programs/migrations/0012_migrate_translatable_fields.py @@ -4,31 +4,31 @@ def forwards_func(apps, schema_editor): - Program = apps.get_model("programs", "Program") - ProgramTranslation = apps.get_model("programs", "ProgramTranslation") + Program = apps.get_model('programs', 'Program') + ProgramTranslation = apps.get_model('programs', 'ProgramTranslation') for object in Program.objects.all(): ProgramTranslation.objects.create( master_id=object.pk, language_code=settings.LANGUAGE_CODE, - description_short=object._description_short, - name=object._name, - name_abbreviated=object._name_abbreviated, - description=object._description, - learn_more_link=object._learn_more_link, - apply_button_link=object._apply_button_link, - dollar_value=object._dollar_value, - value_type=object._value_type, - estimated_delivery_time=object._estimated_delivery_time, - legal_status_required=object._legal_status_required, + description_short = object._description_short, + name = object._name, + name_abbreviated = object._name_abbreviated, + description = object._description, + learn_more_link = object._learn_more_link, + apply_button_link = object._apply_button_link, + dollar_value = object._dollar_value, + value_type = object._value_type, + estimated_delivery_time = object._estimated_delivery_time, + legal_status_required = object._legal_status_required ) - class Migration(migrations.Migration): + dependencies = [ - ("programs", "0011_add_translation_model"), + ('programs', '0011_add_translation_model'), ] operations = [ migrations.RunPython(forwards_func), - ] + ] \ No newline at end of file diff --git a/programs/migrations/0013_remove_program__apply_button_link_and_more.py b/programs/migrations/0013_remove_program__apply_button_link_and_more.py index 8af02cab..28dd2663 100644 --- a/programs/migrations/0013_remove_program__apply_button_link_and_more.py +++ b/programs/migrations/0013_remove_program__apply_button_link_and_more.py @@ -4,49 +4,50 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0012_migrate_translatable_fields"), + ('programs', '0012_migrate_translatable_fields'), ] operations = [ migrations.RemoveField( - model_name="program", - name="_apply_button_link", + model_name='program', + name='_apply_button_link', ), migrations.RemoveField( - model_name="program", - name="_description", + model_name='program', + name='_description', ), migrations.RemoveField( - model_name="program", - name="_description_short", + model_name='program', + name='_description_short', ), migrations.RemoveField( - model_name="program", - name="_dollar_value", + model_name='program', + name='_dollar_value', ), migrations.RemoveField( - model_name="program", - name="_estimated_delivery_time", + model_name='program', + name='_estimated_delivery_time', ), migrations.RemoveField( - model_name="program", - name="_learn_more_link", + model_name='program', + name='_learn_more_link', ), migrations.RemoveField( - model_name="program", - name="_legal_status_required", + model_name='program', + name='_legal_status_required', ), migrations.RemoveField( - model_name="program", - name="_name", + model_name='program', + name='_name', ), migrations.RemoveField( - model_name="program", - name="_name_abbreviated", + model_name='program', + name='_name_abbreviated', ), migrations.RemoveField( - model_name="program", - name="_value_type", + model_name='program', + name='_value_type', ), ] diff --git a/programs/migrations/0014_programtranslation_estimated_application_time.py b/programs/migrations/0014_programtranslation_estimated_application_time.py index 87bfbd17..00125414 100644 --- a/programs/migrations/0014_programtranslation_estimated_application_time.py +++ b/programs/migrations/0014_programtranslation_estimated_application_time.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0013_remove_program__apply_button_link_and_more"), + ('programs', '0013_remove_program__apply_button_link_and_more'), ] operations = [ migrations.AddField( - model_name="programtranslation", - name="estimated_application_time", + model_name='programtranslation', + name='estimated_application_time', field=models.CharField(blank=True, default=None, max_length=320, null=True), ), ] diff --git a/programs/migrations/0015_programtranslation_active.py b/programs/migrations/0015_programtranslation_active.py index b2fa6244..c603b279 100644 --- a/programs/migrations/0015_programtranslation_active.py +++ b/programs/migrations/0015_programtranslation_active.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0014_programtranslation_estimated_application_time"), + ('programs', '0014_programtranslation_estimated_application_time'), ] operations = [ migrations.AddField( - model_name="programtranslation", - name="active", + model_name='programtranslation', + name='active', field=models.BooleanField(blank=True, default=False), ), ] diff --git a/programs/migrations/0016_alter_programtranslation_active.py b/programs/migrations/0016_alter_programtranslation_active.py index 405e51a9..dff7dddb 100644 --- a/programs/migrations/0016_alter_programtranslation_active.py +++ b/programs/migrations/0016_alter_programtranslation_active.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0015_programtranslation_active"), + ('programs', '0015_programtranslation_active'), ] operations = [ migrations.AlterField( - model_name="programtranslation", - name="active", + model_name='programtranslation', + name='active', field=models.BooleanField(blank=True, default=True), ), ] diff --git a/programs/migrations/0017_navigator_navigatortranslation.py b/programs/migrations/0017_navigator_navigatortranslation.py index 816a8dac..2b6bffcc 100644 --- a/programs/migrations/0017_navigator_navigatortranslation.py +++ b/programs/migrations/0017_navigator_navigatortranslation.py @@ -8,53 +8,42 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0016_alter_programtranslation_active"), + ('programs', '0016_alter_programtranslation_active'), ] operations = [ migrations.CreateModel( - name="Navigator", + name='Navigator', fields=[ - ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ], options={ - "abstract": False, + 'abstract': False, }, bases=(parler.models.TranslatableModelMixin, models.Model), ), migrations.CreateModel( - name="NavigatorTranslation", + name='NavigatorTranslation', fields=[ - ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), - ("language_code", models.CharField(db_index=True, max_length=15, verbose_name="Language")), - ("name", models.CharField(max_length=120)), - ( - "cell", - phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, null=True, region=None), - ), - ("email", models.EmailField(blank=True, max_length=254, null=True, verbose_name="email address")), - ("assistance_link", models.CharField(blank=True, max_length=320)), - ("description", models.TextField()), - ( - "master", - parler.fields.TranslationsForeignKey( - editable=False, - null=True, - on_delete=django.db.models.deletion.CASCADE, - related_name="translations", - to="programs.navigator", - ), - ), - ("program", models.ManyToManyField(to="programs.program")), + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('language_code', models.CharField(db_index=True, max_length=15, verbose_name='Language')), + ('name', models.CharField(max_length=120)), + ('cell', phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, null=True, region=None)), + ('email', models.EmailField(blank=True, max_length=254, null=True, verbose_name='email address')), + ('assistance_link', models.CharField(blank=True, max_length=320)), + ('description', models.TextField()), + ('master', parler.fields.TranslationsForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='programs.navigator')), + ('program', models.ManyToManyField(to='programs.program')), ], options={ - "verbose_name": "navigator Translation", - "db_table": "programs_navigator_translation", - "db_tablespace": "", - "managed": True, - "default_permissions": (), - "unique_together": {("language_code", "master")}, + 'verbose_name': 'navigator Translation', + 'db_table': 'programs_navigator_translation', + 'db_tablespace': '', + 'managed': True, + 'default_permissions': (), + 'unique_together': {('language_code', 'master')}, }, bases=(parler.models.TranslatedFieldsModelMixin, models.Model), ), diff --git a/programs/migrations/0018_alter_navigatortranslation_cell.py b/programs/migrations/0018_alter_navigatortranslation_cell.py index e6e872bc..3eb7fa8c 100644 --- a/programs/migrations/0018_alter_navigatortranslation_cell.py +++ b/programs/migrations/0018_alter_navigatortranslation_cell.py @@ -5,14 +5,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0017_navigator_navigatortranslation"), + ('programs', '0017_navigator_navigatortranslation'), ] operations = [ migrations.AlterField( - model_name="navigatortranslation", - name="cell", + model_name='navigatortranslation', + name='cell', field=phonenumber_field.modelfields.PhoneNumberField(max_length=128, region=None), ), ] diff --git a/programs/migrations/0019_rename_cell_navigatortranslation_phone_number_and_more.py b/programs/migrations/0019_rename_cell_navigatortranslation_phone_number_and_more.py index b9fdb878..d4f3441e 100644 --- a/programs/migrations/0019_rename_cell_navigatortranslation_phone_number_and_more.py +++ b/programs/migrations/0019_rename_cell_navigatortranslation_phone_number_and_more.py @@ -4,19 +4,20 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0018_alter_navigatortranslation_cell"), + ('programs', '0018_alter_navigatortranslation_cell'), ] operations = [ migrations.RenameField( - model_name="navigatortranslation", - old_name="cell", - new_name="phone_number", + model_name='navigatortranslation', + old_name='cell', + new_name='phone_number', ), migrations.AlterField( - model_name="navigatortranslation", - name="program", - field=models.ManyToManyField(related_name="navigator", to="programs.program"), + model_name='navigatortranslation', + name='program', + field=models.ManyToManyField(related_name='navigator', to='programs.program'), ), ] diff --git a/programs/migrations/0020_remove_navigatortranslation_program.py b/programs/migrations/0020_remove_navigatortranslation_program.py index 9f588613..b1207a4e 100644 --- a/programs/migrations/0020_remove_navigatortranslation_program.py +++ b/programs/migrations/0020_remove_navigatortranslation_program.py @@ -4,13 +4,14 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0019_rename_cell_navigatortranslation_phone_number_and_more"), + ('programs', '0019_rename_cell_navigatortranslation_phone_number_and_more'), ] operations = [ migrations.RemoveField( - model_name="navigatortranslation", - name="program", + model_name='navigatortranslation', + name='program', ), ] diff --git a/programs/migrations/0021_navigatortranslation_program.py b/programs/migrations/0021_navigatortranslation_program.py index 39d84b79..5d221ac3 100644 --- a/programs/migrations/0021_navigatortranslation_program.py +++ b/programs/migrations/0021_navigatortranslation_program.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0020_remove_navigatortranslation_program"), + ('programs', '0020_remove_navigatortranslation_program'), ] operations = [ migrations.AddField( - model_name="navigatortranslation", - name="program", - field=models.ManyToManyField(related_name="navigator", to="programs.program"), + model_name='navigatortranslation', + name='program', + field=models.ManyToManyField(related_name='navigator', to='programs.program'), ), ] diff --git a/programs/migrations/0022_remove_navigatortranslation_assistance_link_and_more.py b/programs/migrations/0022_remove_navigatortranslation_assistance_link_and_more.py index 00f47829..1f5f1573 100644 --- a/programs/migrations/0022_remove_navigatortranslation_assistance_link_and_more.py +++ b/programs/migrations/0022_remove_navigatortranslation_assistance_link_and_more.py @@ -5,41 +5,42 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0021_navigatortranslation_program"), + ('programs', '0021_navigatortranslation_program'), ] operations = [ migrations.RemoveField( - model_name="navigatortranslation", - name="assistance_link", + model_name='navigatortranslation', + name='assistance_link', ), migrations.RemoveField( - model_name="navigatortranslation", - name="email", + model_name='navigatortranslation', + name='email', ), migrations.RemoveField( - model_name="navigatortranslation", - name="phone_number", + model_name='navigatortranslation', + name='phone_number', ), migrations.RemoveField( - model_name="navigatortranslation", - name="program", + model_name='navigatortranslation', + name='program', ), migrations.AddField( - model_name="navigator", - name="email", - field=models.EmailField(blank=True, max_length=254, null=True, verbose_name="email address"), + model_name='navigator', + name='email', + field=models.EmailField(blank=True, max_length=254, null=True, verbose_name='email address'), ), migrations.AddField( - model_name="navigator", - name="phone_number", + model_name='navigator', + name='phone_number', field=phonenumber_field.modelfields.PhoneNumberField(default=0, max_length=128, region=None), preserve_default=False, ), migrations.AddField( - model_name="navigator", - name="program", - field=models.ManyToManyField(related_name="navigator", to="programs.program"), + model_name='navigator', + name='program', + field=models.ManyToManyField(related_name='navigator', to='programs.program'), ), ] diff --git a/programs/migrations/0023_navigator_assistance_link.py b/programs/migrations/0023_navigator_assistance_link.py index df4d1479..7d1cf337 100644 --- a/programs/migrations/0023_navigator_assistance_link.py +++ b/programs/migrations/0023_navigator_assistance_link.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0022_remove_navigatortranslation_assistance_link_and_more"), + ('programs', '0022_remove_navigatortranslation_assistance_link_and_more'), ] operations = [ migrations.AddField( - model_name="navigator", - name="assistance_link", + model_name='navigator', + name='assistance_link', field=models.CharField(blank=True, max_length=320), ), ] diff --git a/programs/migrations/0024_remove_navigator_assistance_link_and_more.py b/programs/migrations/0024_remove_navigator_assistance_link_and_more.py index 7d151426..7bc05b95 100644 --- a/programs/migrations/0024_remove_navigator_assistance_link_and_more.py +++ b/programs/migrations/0024_remove_navigator_assistance_link_and_more.py @@ -5,36 +5,37 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0023_navigator_assistance_link"), + ('programs', '0023_navigator_assistance_link'), ] operations = [ migrations.RemoveField( - model_name="navigator", - name="assistance_link", + model_name='navigator', + name='assistance_link', ), migrations.RemoveField( - model_name="navigator", - name="email", + model_name='navigator', + name='email', ), migrations.RemoveField( - model_name="navigator", - name="phone_number", + model_name='navigator', + name='phone_number', ), migrations.AddField( - model_name="navigatortranslation", - name="assistance_link", + model_name='navigatortranslation', + name='assistance_link', field=models.CharField(blank=True, max_length=320), ), migrations.AddField( - model_name="navigatortranslation", - name="email", - field=models.EmailField(blank=True, max_length=254, null=True, verbose_name="email address"), + model_name='navigatortranslation', + name='email', + field=models.EmailField(blank=True, max_length=254, null=True, verbose_name='email address'), ), migrations.AddField( - model_name="navigatortranslation", - name="phone_number", + model_name='navigatortranslation', + name='phone_number', field=phonenumber_field.modelfields.PhoneNumberField(default=0, max_length=128, region=None), preserve_default=False, ), diff --git a/programs/migrations/0025_remove_navigatortranslation_phone_number_and_more.py b/programs/migrations/0025_remove_navigatortranslation_phone_number_and_more.py index 6fdcabe2..2953c949 100644 --- a/programs/migrations/0025_remove_navigatortranslation_phone_number_and_more.py +++ b/programs/migrations/0025_remove_navigatortranslation_phone_number_and_more.py @@ -5,18 +5,19 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0024_remove_navigator_assistance_link_and_more"), + ('programs', '0024_remove_navigator_assistance_link_and_more'), ] operations = [ migrations.RemoveField( - model_name="navigatortranslation", - name="phone_number", + model_name='navigatortranslation', + name='phone_number', ), migrations.AddField( - model_name="navigator", - name="phone_number", + model_name='navigator', + name='phone_number', field=phonenumber_field.modelfields.PhoneNumberField(default=0, max_length=128, region=None), preserve_default=False, ), diff --git a/programs/migrations/0026_remove_navigator_phone_number_and_more.py b/programs/migrations/0026_remove_navigator_phone_number_and_more.py index 4e89bcb4..32797317 100644 --- a/programs/migrations/0026_remove_navigator_phone_number_and_more.py +++ b/programs/migrations/0026_remove_navigator_phone_number_and_more.py @@ -5,18 +5,19 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0025_remove_navigatortranslation_phone_number_and_more"), + ('programs', '0025_remove_navigatortranslation_phone_number_and_more'), ] operations = [ migrations.RemoveField( - model_name="navigator", - name="phone_number", + model_name='navigator', + name='phone_number', ), migrations.AddField( - model_name="navigatortranslation", - name="phone_number", + model_name='navigatortranslation', + name='phone_number', field=phonenumber_field.modelfields.PhoneNumberField(default=0, max_length=128, region=None), preserve_default=False, ), diff --git a/programs/migrations/0027_remove_navigatortranslation_phone_number_and_more.py b/programs/migrations/0027_remove_navigatortranslation_phone_number_and_more.py index a1bd4920..955e8e1e 100644 --- a/programs/migrations/0027_remove_navigatortranslation_phone_number_and_more.py +++ b/programs/migrations/0027_remove_navigatortranslation_phone_number_and_more.py @@ -5,18 +5,19 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0026_remove_navigator_phone_number_and_more"), + ('programs', '0026_remove_navigator_phone_number_and_more'), ] operations = [ migrations.RemoveField( - model_name="navigatortranslation", - name="phone_number", + model_name='navigatortranslation', + name='phone_number', ), migrations.AddField( - model_name="navigator", - name="phone_number", + model_name='navigator', + name='phone_number', field=phonenumber_field.modelfields.PhoneNumberField(default=0, max_length=128, region=None), preserve_default=False, ), diff --git a/programs/migrations/0028_alter_navigator_phone_number.py b/programs/migrations/0028_alter_navigator_phone_number.py index 193f4ab6..7b057179 100644 --- a/programs/migrations/0028_alter_navigator_phone_number.py +++ b/programs/migrations/0028_alter_navigator_phone_number.py @@ -5,14 +5,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0027_remove_navigatortranslation_phone_number_and_more"), + ('programs', '0027_remove_navigatortranslation_phone_number_and_more'), ] operations = [ migrations.AlterField( - model_name="navigator", - name="phone_number", + model_name='navigator', + name='phone_number', field=phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, null=True, region=None), ), ] diff --git a/programs/migrations/0029_programtranslation_catagory.py b/programs/migrations/0029_programtranslation_catagory.py index 7a222abd..fdfd2b8e 100644 --- a/programs/migrations/0029_programtranslation_catagory.py +++ b/programs/migrations/0029_programtranslation_catagory.py @@ -4,15 +4,16 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0028_alter_navigator_phone_number"), + ('programs', '0028_alter_navigator_phone_number'), ] operations = [ migrations.AddField( - model_name="programtranslation", - name="catagory", - field=models.CharField(default="no category", max_length=120), + model_name='programtranslation', + name='catagory', + field=models.CharField(default='no category', max_length=120), preserve_default=False, ), ] diff --git a/programs/migrations/0030_rename_catagory_programtranslation_category.py b/programs/migrations/0030_rename_catagory_programtranslation_category.py index 92ff0fc3..a8209894 100644 --- a/programs/migrations/0030_rename_catagory_programtranslation_category.py +++ b/programs/migrations/0030_rename_catagory_programtranslation_category.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0029_programtranslation_catagory"), + ('programs', '0029_programtranslation_catagory'), ] operations = [ migrations.RenameField( - model_name="programtranslation", - old_name="catagory", - new_name="category", + model_name='programtranslation', + old_name='catagory', + new_name='category', ), ] diff --git a/programs/migrations/0031_urgentneed_urgentneedtranslation.py b/programs/migrations/0031_urgentneed_urgentneedtranslation.py index f73c9765..c60f6554 100644 --- a/programs/migrations/0031_urgentneed_urgentneedtranslation.py +++ b/programs/migrations/0031_urgentneed_urgentneedtranslation.py @@ -8,54 +8,43 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0030_rename_catagory_programtranslation_category"), + ('programs', '0030_rename_catagory_programtranslation_category'), ] operations = [ migrations.CreateModel( - name="UrgentNeed", + name='UrgentNeed', fields=[ - ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), - ( - "phone_number", - phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, null=True, region=None), - ), - ("type_short", models.CharField(max_length=120)), - ("active", models.BooleanField(blank=True, default=True)), + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('phone_number', phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, null=True, region=None)), + ('type_short', models.CharField(max_length=120)), + ('active', models.BooleanField(blank=True, default=True)), ], options={ - "abstract": False, + 'abstract': False, }, bases=(parler.models.TranslatableModelMixin, models.Model), ), migrations.CreateModel( - name="UrgentNeedTranslation", + name='UrgentNeedTranslation', fields=[ - ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), - ("language_code", models.CharField(db_index=True, max_length=15, verbose_name="Language")), - ("name", models.CharField(max_length=120)), - ("description", models.TextField()), - ("link", models.CharField(max_length=320)), - ("type", models.CharField(max_length=120)), - ( - "master", - parler.fields.TranslationsForeignKey( - editable=False, - null=True, - on_delete=django.db.models.deletion.CASCADE, - related_name="translations", - to="programs.urgentneed", - ), - ), + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('language_code', models.CharField(db_index=True, max_length=15, verbose_name='Language')), + ('name', models.CharField(max_length=120)), + ('description', models.TextField()), + ('link', models.CharField(max_length=320)), + ('type', models.CharField(max_length=120)), + ('master', parler.fields.TranslationsForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='programs.urgentneed')), ], options={ - "verbose_name": "urgent need Translation", - "db_table": "programs_urgentneed_translation", - "db_tablespace": "", - "managed": True, - "default_permissions": (), - "unique_together": {("language_code", "master")}, + 'verbose_name': 'urgent need Translation', + 'db_table': 'programs_urgentneed_translation', + 'db_tablespace': '', + 'managed': True, + 'default_permissions': (), + 'unique_together': {('language_code', 'master')}, }, bases=(parler.models.TranslatedFieldsModelMixin, models.Model), ), diff --git a/programs/migrations/0032_urgentneedfunction_urgentneed_functions.py b/programs/migrations/0032_urgentneedfunction_urgentneed_functions.py index 4716ef84..93264c67 100644 --- a/programs/migrations/0032_urgentneedfunction_urgentneed_functions.py +++ b/programs/migrations/0032_urgentneedfunction_urgentneed_functions.py @@ -4,21 +4,22 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0031_urgentneed_urgentneedtranslation"), + ('programs', '0031_urgentneed_urgentneedtranslation'), ] operations = [ migrations.CreateModel( - name="UrgentNeedFunction", + name='UrgentNeedFunction', fields=[ - ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), - ("name", models.CharField(max_length=32)), + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=32)), ], ), migrations.AddField( - model_name="urgentneed", - name="functions", - field=models.ManyToManyField(related_name="function", to="programs.urgentneedfunction"), + model_name='urgentneed', + name='functions', + field=models.ManyToManyField(related_name='function', to='programs.urgentneedfunction'), ), ] diff --git a/programs/migrations/0033_alter_urgentneed_functions.py b/programs/migrations/0033_alter_urgentneed_functions.py index 529a8d9c..660b3551 100644 --- a/programs/migrations/0033_alter_urgentneed_functions.py +++ b/programs/migrations/0033_alter_urgentneed_functions.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0032_urgentneedfunction_urgentneed_functions"), + ('programs', '0032_urgentneedfunction_urgentneed_functions'), ] operations = [ migrations.AlterField( - model_name="urgentneed", - name="functions", - field=models.ManyToManyField(blank=True, related_name="function", to="programs.urgentneedfunction"), + model_name='urgentneed', + name='functions', + field=models.ManyToManyField(blank=True, related_name='function', to='programs.urgentneedfunction'), ), ] diff --git a/programs/migrations/0034_alter_urgentneedtranslation_link.py b/programs/migrations/0034_alter_urgentneedtranslation_link.py index a0e64eb4..f4f4c6b2 100644 --- a/programs/migrations/0034_alter_urgentneedtranslation_link.py +++ b/programs/migrations/0034_alter_urgentneedtranslation_link.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0033_alter_urgentneed_functions"), + ('programs', '0033_alter_urgentneed_functions'), ] operations = [ migrations.AlterField( - model_name="urgentneedtranslation", - name="link", + model_name='urgentneedtranslation', + name='link', field=models.CharField(blank=True, max_length=320, null=True), ), ] diff --git a/programs/migrations/0035_federalpoverylimit.py b/programs/migrations/0035_federalpoverylimit.py index 7e2ae4af..3b2dd758 100644 --- a/programs/migrations/0035_federalpoverylimit.py +++ b/programs/migrations/0035_federalpoverylimit.py @@ -4,24 +4,25 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0034_alter_urgentneedtranslation_link"), + ('programs', '0034_alter_urgentneedtranslation_link'), ] operations = [ migrations.CreateModel( - name="FederalPoveryLimit", + name='FederalPoveryLimit', fields=[ - ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), - ("year", models.CharField(max_length=32)), - ("has_1_person", models.IntegerField()), - ("has_2_person", models.IntegerField()), - ("has_3_person", models.IntegerField()), - ("has_4_person", models.IntegerField()), - ("has_5_person", models.IntegerField()), - ("has_6_person", models.IntegerField()), - ("has_7_person", models.IntegerField()), - ("has_8_person", models.IntegerField()), + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('year', models.CharField(max_length=32)), + ('has_1_person', models.IntegerField()), + ('has_2_person', models.IntegerField()), + ('has_3_person', models.IntegerField()), + ('has_4_person', models.IntegerField()), + ('has_5_person', models.IntegerField()), + ('has_6_person', models.IntegerField()), + ('has_7_person', models.IntegerField()), + ('has_8_person', models.IntegerField()), ], ), ] diff --git a/programs/migrations/0036_rename_has_2_person_federalpoverylimit_has_2_people_and_more.py b/programs/migrations/0036_rename_has_2_person_federalpoverylimit_has_2_people_and_more.py index 4b797788..0e6ced24 100644 --- a/programs/migrations/0036_rename_has_2_person_federalpoverylimit_has_2_people_and_more.py +++ b/programs/migrations/0036_rename_has_2_person_federalpoverylimit_has_2_people_and_more.py @@ -4,44 +4,45 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0035_federalpoverylimit"), + ('programs', '0035_federalpoverylimit'), ] operations = [ migrations.RenameField( - model_name="federalpoverylimit", - old_name="has_2_person", - new_name="has_2_people", + model_name='federalpoverylimit', + old_name='has_2_person', + new_name='has_2_people', ), migrations.RenameField( - model_name="federalpoverylimit", - old_name="has_3_person", - new_name="has_3_people", + model_name='federalpoverylimit', + old_name='has_3_person', + new_name='has_3_people', ), migrations.RenameField( - model_name="federalpoverylimit", - old_name="has_4_person", - new_name="has_4_people", + model_name='federalpoverylimit', + old_name='has_4_person', + new_name='has_4_people', ), migrations.RenameField( - model_name="federalpoverylimit", - old_name="has_5_person", - new_name="has_5_people", + model_name='federalpoverylimit', + old_name='has_5_person', + new_name='has_5_people', ), migrations.RenameField( - model_name="federalpoverylimit", - old_name="has_6_person", - new_name="has_6_people", + model_name='federalpoverylimit', + old_name='has_6_person', + new_name='has_6_people', ), migrations.RenameField( - model_name="federalpoverylimit", - old_name="has_7_person", - new_name="has_7_people", + model_name='federalpoverylimit', + old_name='has_7_person', + new_name='has_7_people', ), migrations.RenameField( - model_name="federalpoverylimit", - old_name="has_8_person", - new_name="has_8_people", + model_name='federalpoverylimit', + old_name='has_8_person', + new_name='has_8_people', ), ] diff --git a/programs/migrations/0037_alter_federalpoverylimit_year.py b/programs/migrations/0037_alter_federalpoverylimit_year.py index c1b848a8..6ea0c297 100644 --- a/programs/migrations/0037_alter_federalpoverylimit_year.py +++ b/programs/migrations/0037_alter_federalpoverylimit_year.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0036_rename_has_2_person_federalpoverylimit_has_2_people_and_more"), + ('programs', '0036_rename_has_2_person_federalpoverylimit_has_2_people_and_more'), ] operations = [ migrations.AlterField( - model_name="federalpoverylimit", - name="year", + model_name='federalpoverylimit', + name='year', field=models.CharField(max_length=32, unique=True), ), ] diff --git a/programs/migrations/0038_program_fpl.py b/programs/migrations/0038_program_fpl.py index d55276b2..41bc791c 100644 --- a/programs/migrations/0038_program_fpl.py +++ b/programs/migrations/0038_program_fpl.py @@ -5,20 +5,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0037_alter_federalpoverylimit_year"), + ('programs', '0037_alter_federalpoverylimit_year'), ] operations = [ migrations.AddField( - model_name="program", - name="fpl", - field=models.ForeignKey( - blank=True, - null=True, - on_delete=django.db.models.deletion.SET_NULL, - related_name="fpl", - to="programs.federalpoverylimit", - ), + model_name='program', + name='fpl', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='fpl', to='programs.federalpoverylimit'), ), ] diff --git a/programs/migrations/0039_webhookfunction_referrer_referrertranslation.py b/programs/migrations/0039_webhookfunction_referrer_referrertranslation.py index 94de0c56..22f38634 100644 --- a/programs/migrations/0039_webhookfunction_referrer_referrertranslation.py +++ b/programs/migrations/0039_webhookfunction_referrer_referrertranslation.py @@ -7,66 +7,52 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0038_program_fpl"), + ('programs', '0038_program_fpl'), ] operations = [ migrations.CreateModel( - name="WebHookFunction", + name='WebHookFunction', fields=[ - ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), - ("name", models.CharField(max_length=64)), + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=64)), ], ), migrations.CreateModel( - name="Referrer", + name='Referrer', fields=[ - ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), - ("referrer_code", models.CharField(max_length=64, unique=True)), - ("webhook_url", models.CharField(blank=True, max_length=320, null=True)), - ("logo", models.ImageField(upload_to="")), - ("white_label_css", models.FileField(upload_to="")), - ( - "primary_navigators", - models.ManyToManyField(blank=True, related_name="primary_navigators", to="programs.navigator"), - ), - ( - "webhook_functions", - models.ManyToManyField(blank=True, related_name="web_hook", to="programs.webhookfunction"), - ), + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('referrer_code', models.CharField(max_length=64, unique=True)), + ('webhook_url', models.CharField(blank=True, max_length=320, null=True)), + ('logo', models.ImageField(upload_to='')), + ('white_label_css', models.FileField(upload_to='')), + ('primary_navigators', models.ManyToManyField(blank=True, related_name='primary_navigators', to='programs.navigator')), + ('webhook_functions', models.ManyToManyField(blank=True, related_name='web_hook', to='programs.webhookfunction')), ], options={ - "abstract": False, + 'abstract': False, }, bases=(parler.models.TranslatableModelMixin, models.Model), ), migrations.CreateModel( - name="ReferrerTranslation", + name='ReferrerTranslation', fields=[ - ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), - ("language_code", models.CharField(db_index=True, max_length=15, verbose_name="Language")), - ("header_html", models.FileField(upload_to="")), - ("footer_html", models.FileField(upload_to="")), - ("consent_text", models.TextField()), - ( - "master", - parler.fields.TranslationsForeignKey( - editable=False, - null=True, - on_delete=django.db.models.deletion.CASCADE, - related_name="translations", - to="programs.referrer", - ), - ), + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('language_code', models.CharField(db_index=True, max_length=15, verbose_name='Language')), + ('header_html', models.FileField(upload_to='')), + ('footer_html', models.FileField(upload_to='')), + ('consent_text', models.TextField()), + ('master', parler.fields.TranslationsForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='programs.referrer')), ], options={ - "verbose_name": "referrer Translation", - "db_table": "programs_referrer_translation", - "db_tablespace": "", - "managed": True, - "default_permissions": (), - "unique_together": {("language_code", "master")}, + 'verbose_name': 'referrer Translation', + 'db_table': 'programs_referrer_translation', + 'db_tablespace': '', + 'managed': True, + 'default_permissions': (), + 'unique_together': {('language_code', 'master')}, }, bases=(parler.models.TranslatedFieldsModelMixin, models.Model), ), diff --git a/programs/migrations/0040_alter_referrer_logo_alter_referrer_white_label_css_and_more.py b/programs/migrations/0040_alter_referrer_logo_alter_referrer_white_label_css_and_more.py index 2042297b..2994a8ab 100644 --- a/programs/migrations/0040_alter_referrer_logo_alter_referrer_white_label_css_and_more.py +++ b/programs/migrations/0040_alter_referrer_logo_alter_referrer_white_label_css_and_more.py @@ -4,34 +4,35 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0039_webhookfunction_referrer_referrertranslation"), + ('programs', '0039_webhookfunction_referrer_referrertranslation'), ] operations = [ migrations.AlterField( - model_name="referrer", - name="logo", - field=models.ImageField(blank=True, null=True, upload_to=""), + model_name='referrer', + name='logo', + field=models.ImageField(blank=True, null=True, upload_to=''), ), migrations.AlterField( - model_name="referrer", - name="white_label_css", - field=models.FileField(blank=True, null=True, upload_to=""), + model_name='referrer', + name='white_label_css', + field=models.FileField(blank=True, null=True, upload_to=''), ), migrations.AlterField( - model_name="referrertranslation", - name="consent_text", + model_name='referrertranslation', + name='consent_text', field=models.TextField(blank=True, null=True), ), migrations.AlterField( - model_name="referrertranslation", - name="footer_html", - field=models.FileField(blank=True, null=True, upload_to=""), + model_name='referrertranslation', + name='footer_html', + field=models.FileField(blank=True, null=True, upload_to=''), ), migrations.AlterField( - model_name="referrertranslation", - name="header_html", - field=models.FileField(blank=True, null=True, upload_to=""), + model_name='referrertranslation', + name='header_html', + field=models.FileField(blank=True, null=True, upload_to=''), ), ] diff --git a/programs/migrations/0041_remove_referrer_logo_remove_referrer_white_label_css_and_more.py b/programs/migrations/0041_remove_referrer_logo_remove_referrer_white_label_css_and_more.py index 5790c472..430d2054 100644 --- a/programs/migrations/0041_remove_referrer_logo_remove_referrer_white_label_css_and_more.py +++ b/programs/migrations/0041_remove_referrer_logo_remove_referrer_white_label_css_and_more.py @@ -6,115 +6,70 @@ class Migration(migrations.Migration): dependencies = [ - ("translations", "0002_translation_active"), - ("programs", "0040_alter_referrer_logo_alter_referrer_white_label_css_and_more"), + ('translations', '0002_translation_active'), + ('programs', '0040_alter_referrer_logo_alter_referrer_white_label_css_and_more'), ] operations = [ migrations.RemoveField( - model_name="referrer", - name="logo", + model_name='referrer', + name='logo', ), migrations.RemoveField( - model_name="referrer", - name="white_label_css", + model_name='referrer', + name='white_label_css', ), migrations.AddField( - model_name="program", - name="active_1", + model_name='program', + name='active_1', field=models.BooleanField(blank=True, default=True, null=True), ), migrations.AddField( - model_name="program", - name="apply_button_link_1", - field=models.ForeignKey( - null=True, - on_delete=django.db.models.deletion.PROTECT, - related_name="apply_button_link", - to="translations.translation", - ), + model_name='program', + name='apply_button_link_1', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='apply_button_link', to='translations.translation'), ), migrations.AddField( - model_name="program", - name="category_1", - field=models.ForeignKey( - null=True, - on_delete=django.db.models.deletion.PROTECT, - related_name="category", - to="translations.translation", - ), + model_name='program', + name='category_1', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='category', to='translations.translation'), ), migrations.AddField( - model_name="program", - name="description_1", - field=models.ForeignKey( - null=True, - on_delete=django.db.models.deletion.PROTECT, - related_name="description", - to="translations.translation", - ), + model_name='program', + name='description_1', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='description', to='translations.translation'), ), migrations.AddField( - model_name="program", - name="description_short_1", - field=models.ForeignKey( - null=True, - on_delete=django.db.models.deletion.PROTECT, - related_name="description_short", - to="translations.translation", - ), + model_name='program', + name='description_short_1', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='description_short', to='translations.translation'), ), migrations.AddField( - model_name="program", - name="estimated_application_time_1", - field=models.ForeignKey( - null=True, - on_delete=django.db.models.deletion.PROTECT, - related_name="estimated_application_time", - to="translations.translation", - ), + model_name='program', + name='estimated_application_time_1', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='estimated_application_time', to='translations.translation'), ), migrations.AddField( - model_name="program", - name="estimated_delivery_time_1", - field=models.ForeignKey( - null=True, - on_delete=django.db.models.deletion.PROTECT, - related_name="estimated_delivery_time", - to="translations.translation", - ), + model_name='program', + name='estimated_delivery_time_1', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='estimated_delivery_time', to='translations.translation'), ), migrations.AddField( - model_name="program", - name="learn_more_link_1", - field=models.ForeignKey( - null=True, - on_delete=django.db.models.deletion.PROTECT, - related_name="learn_more_link", - to="translations.translation", - ), + model_name='program', + name='learn_more_link_1', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='learn_more_link', to='translations.translation'), ), migrations.AddField( - model_name="program", - name="name_1", - field=models.ForeignKey( - null=True, - on_delete=django.db.models.deletion.PROTECT, - related_name="name", - to="translations.translation", - ), + model_name='program', + name='name_1', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='name', to='translations.translation'), ), migrations.AddField( - model_name="program", - name="value_type_1", - field=models.ForeignKey( - null=True, - on_delete=django.db.models.deletion.PROTECT, - related_name="value_type", - to="translations.translation", - ), + model_name='program', + name='value_type_1', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='value_type', to='translations.translation'), ), migrations.DeleteModel( - name="ReferrerTranslation", + name='ReferrerTranslation', ), ] diff --git a/programs/migrations/0042_auto_20230905_1620.py b/programs/migrations/0042_auto_20230905_1620.py index 30638b97..c18ce108 100644 --- a/programs/migrations/0042_auto_20230905_1620.py +++ b/programs/migrations/0042_auto_20230905_1620.py @@ -5,44 +5,44 @@ def migrate_translations(apps, schema_editor): - Program = apps.get_model("programs", "Program") - Translation = apps.get_model("translations", "Translation") + Program = apps.get_model('programs', 'Program') + Translation = apps.get_model('translations', 'Translation') translated_fields = ( - "description_short", - "name", - "description", - "learn_more_link", - "apply_button_link", - "value_type", - "estimated_delivery_time", - "estimated_application_time", - "category", + 'description_short', + 'name', + 'description', + 'learn_more_link', + 'apply_button_link', + 'value_type', + 'estimated_delivery_time', + 'estimated_application_time', + 'category', + ) + non_translated_fields = ( + 'active', + 'legal_status_required', + 'name_abbreviated' ) - non_translated_fields = ("active", "legal_status_required", "name_abbreviated") for program in Program.objects.all(): for field in translated_fields: - translation = Translation.objects.add_translation( - f"program.{program.name_abbreviated}_{program.id}-{field}", getattr(program, field) - ) - setattr(program, field + "_1", translation) + translation = Translation.objects.add_translation(f'program.{program.name_abbreviated}_{program.id}-{field}', getattr(program, field)) + setattr(program, field + '_1', translation) for lang in settings.PARLER_LANGUAGES[None]: - program.set_current_language(lang["code"]) - Translation.objects.edit_translation( - f"program.{program.name_abbreviated}_{program.id}-{field}", - lang["code"], - getattr(program, field), - True, - ) + program.set_current_language(lang['code']) + Translation.objects.edit_translation(f'program.{program.name_abbreviated}_{program.id}-{field}', lang['code'], getattr(program, field), True) for field in non_translated_fields: - setattr(program, field + "_1", getattr(program, field)) + setattr(program, field + '_1', getattr(program, field)) program.save() class Migration(migrations.Migration): + dependencies = [ - ("programs", "0041_remove_referrer_logo_remove_referrer_white_label_css_and_more"), - ("translations", "0003_alter_translation_managers"), + ('programs', '0041_remove_referrer_logo_remove_referrer_white_label_css_and_more'), + ('translations', '0003_alter_translation_managers'), ] - operations = [migrations.RunPython(migrate_translations)] + operations = [ + migrations.RunPython(migrate_translations) + ] diff --git a/programs/migrations/0043_auto_20230906_0938.py b/programs/migrations/0043_auto_20230906_0938.py index 7d90d3d9..9360c94f 100644 --- a/programs/migrations/0043_auto_20230906_0938.py +++ b/programs/migrations/0043_auto_20230906_0938.py @@ -4,31 +4,34 @@ def connect_translations(apps, schema_editor): - Program = apps.get_model("programs", "Program") - Translation = apps.get_model("translations", "Translation") + Program = apps.get_model('programs', 'Program') + Translation = apps.get_model('translations', 'Translation') translated_fields = ( - "description_short", - "name", - "description", - "learn_more_link", - "apply_button_link", - "value_type", - "estimated_delivery_time", - "estimated_application_time", - "category", + 'description_short', + 'name', + 'description', + 'learn_more_link', + 'apply_button_link', + 'value_type', + 'estimated_delivery_time', + 'estimated_application_time', + 'category', ) for program in Program.objects.all(): for field in translated_fields: - translation = Translation.objects.get(label=f"program.{program.name_abbreviated}_{program.id}-{field}") - setattr(program, field + "_1", translation) + translation = Translation.objects.get(label=f'program.{program.name_abbreviated}_{program.id}-{field}') + setattr(program, field + '_1', translation) program.save() class Migration(migrations.Migration): + dependencies = [ - ("programs", "0042_auto_20230905_1620"), - ("translations", "0003_alter_translation_managers"), + ('programs', '0042_auto_20230905_1620'), + ('translations', '0003_alter_translation_managers'), ] - operations = [migrations.RunPython(connect_translations)] + operations = [ + migrations.RunPython(connect_translations) + ] diff --git a/programs/migrations/0044_program_legal_status_required_1_and_more.py b/programs/migrations/0044_program_legal_status_required_1_and_more.py index 2a6dfc61..962a0610 100644 --- a/programs/migrations/0044_program_legal_status_required_1_and_more.py +++ b/programs/migrations/0044_program_legal_status_required_1_and_more.py @@ -4,19 +4,20 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0043_auto_20230906_0938"), + ('programs', '0043_auto_20230906_0938'), ] operations = [ migrations.AddField( - model_name="program", - name="legal_status_required_1", + model_name='program', + name='legal_status_required_1', field=models.CharField(max_length=120, null=True), ), migrations.AddField( - model_name="program", - name="name_abbreviated_1", + model_name='program', + name='name_abbreviated_1', field=models.CharField(max_length=120, null=True), ), ] diff --git a/programs/migrations/0045_auto_20230906_0951.py b/programs/migrations/0045_auto_20230906_0951.py index 7b670181..8fe3bc9a 100644 --- a/programs/migrations/0045_auto_20230906_0951.py +++ b/programs/migrations/0045_auto_20230906_0951.py @@ -4,18 +4,25 @@ def other_data_migrations(apps, _): - Program = apps.get_model("programs", "Program") + Program = apps.get_model('programs', 'Program') - non_translated_fields = ("active", "legal_status_required", "name_abbreviated") + non_translated_fields = ( + 'active', + 'legal_status_required', + 'name_abbreviated' + ) for program in Program.objects.all(): for field in non_translated_fields: - setattr(program, field + "_1", getattr(program, field)) + setattr(program, field + '_1', getattr(program, field)) program.save() class Migration(migrations.Migration): + dependencies = [ - ("programs", "0044_program_legal_status_required_1_and_more"), + ('programs', '0044_program_legal_status_required_1_and_more'), ] - operations = [migrations.RunPython(other_data_migrations)] + operations = [ + migrations.RunPython(other_data_migrations) + ] diff --git a/programs/migrations/0046_delete_programtranslation.py b/programs/migrations/0046_delete_programtranslation.py index d72732d6..7b925bd8 100644 --- a/programs/migrations/0046_delete_programtranslation.py +++ b/programs/migrations/0046_delete_programtranslation.py @@ -4,12 +4,13 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0045_auto_20230906_0951"), + ('programs', '0045_auto_20230906_0951'), ] operations = [ migrations.DeleteModel( - name="ProgramTranslation", + name='ProgramTranslation', ), ] diff --git a/programs/migrations/0047_alter_program_active_1_and_more.py b/programs/migrations/0047_alter_program_active_1_and_more.py index c1312984..2fc46273 100644 --- a/programs/migrations/0047_alter_program_active_1_and_more.py +++ b/programs/migrations/0047_alter_program_active_1_and_more.py @@ -5,98 +5,71 @@ class Migration(migrations.Migration): + dependencies = [ - ("translations", "0003_alter_translation_managers"), - ("programs", "0046_delete_programtranslation"), + ('translations', '0003_alter_translation_managers'), + ('programs', '0046_delete_programtranslation'), ] operations = [ migrations.AlterField( - model_name="program", - name="active_1", + model_name='program', + name='active_1', field=models.BooleanField(blank=True, default=True), ), migrations.AlterField( - model_name="program", - name="apply_button_link_1", - field=models.ForeignKey( - on_delete=django.db.models.deletion.PROTECT, - related_name="apply_button_link", - to="translations.translation", - ), + model_name='program', + name='apply_button_link_1', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='apply_button_link', to='translations.translation'), ), migrations.AlterField( - model_name="program", - name="category_1", - field=models.ForeignKey( - on_delete=django.db.models.deletion.PROTECT, related_name="category", to="translations.translation" - ), + model_name='program', + name='category_1', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='category', to='translations.translation'), ), migrations.AlterField( - model_name="program", - name="description_1", - field=models.ForeignKey( - on_delete=django.db.models.deletion.PROTECT, related_name="description", to="translations.translation" - ), + model_name='program', + name='description_1', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='description', to='translations.translation'), ), migrations.AlterField( - model_name="program", - name="description_short_1", - field=models.ForeignKey( - on_delete=django.db.models.deletion.PROTECT, - related_name="description_short", - to="translations.translation", - ), + model_name='program', + name='description_short_1', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='description_short', to='translations.translation'), ), migrations.AlterField( - model_name="program", - name="estimated_application_time_1", - field=models.ForeignKey( - on_delete=django.db.models.deletion.PROTECT, - related_name="estimated_application_time", - to="translations.translation", - ), + model_name='program', + name='estimated_application_time_1', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='estimated_application_time', to='translations.translation'), ), migrations.AlterField( - model_name="program", - name="estimated_delivery_time_1", - field=models.ForeignKey( - on_delete=django.db.models.deletion.PROTECT, - related_name="estimated_delivery_time", - to="translations.translation", - ), + model_name='program', + name='estimated_delivery_time_1', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='estimated_delivery_time', to='translations.translation'), ), migrations.AlterField( - model_name="program", - name="learn_more_link_1", - field=models.ForeignKey( - on_delete=django.db.models.deletion.PROTECT, - related_name="learn_more_link", - to="translations.translation", - ), + model_name='program', + name='learn_more_link_1', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='learn_more_link', to='translations.translation'), ), migrations.AlterField( - model_name="program", - name="legal_status_required_1", + model_name='program', + name='legal_status_required_1', field=models.CharField(max_length=120), ), migrations.AlterField( - model_name="program", - name="name_1", - field=models.ForeignKey( - on_delete=django.db.models.deletion.PROTECT, related_name="name", to="translations.translation" - ), + model_name='program', + name='name_1', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='name', to='translations.translation'), ), migrations.AlterField( - model_name="program", - name="name_abbreviated_1", + model_name='program', + name='name_abbreviated_1', field=models.CharField(max_length=120), ), migrations.AlterField( - model_name="program", - name="value_type_1", - field=models.ForeignKey( - on_delete=django.db.models.deletion.PROTECT, related_name="value_type", to="translations.translation" - ), + model_name='program', + name='value_type_1', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='value_type', to='translations.translation'), ), ] diff --git a/programs/migrations/0048_rename_active_1_program_active_and_more.py b/programs/migrations/0048_rename_active_1_program_active_and_more.py index fd66ea2b..7bec3c84 100644 --- a/programs/migrations/0048_rename_active_1_program_active_and_more.py +++ b/programs/migrations/0048_rename_active_1_program_active_and_more.py @@ -4,69 +4,70 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0047_alter_program_active_1_and_more"), + ('programs', '0047_alter_program_active_1_and_more'), ] operations = [ migrations.RenameField( - model_name="program", - old_name="active_1", - new_name="active", + model_name='program', + old_name='active_1', + new_name='active', ), migrations.RenameField( - model_name="program", - old_name="apply_button_link_1", - new_name="apply_button_link", + model_name='program', + old_name='apply_button_link_1', + new_name='apply_button_link', ), migrations.RenameField( - model_name="program", - old_name="category_1", - new_name="category", + model_name='program', + old_name='category_1', + new_name='category', ), migrations.RenameField( - model_name="program", - old_name="description_1", - new_name="description", + model_name='program', + old_name='description_1', + new_name='description', ), migrations.RenameField( - model_name="program", - old_name="description_short_1", - new_name="description_short", + model_name='program', + old_name='description_short_1', + new_name='description_short', ), migrations.RenameField( - model_name="program", - old_name="estimated_application_time_1", - new_name="estimated_application_time", + model_name='program', + old_name='estimated_application_time_1', + new_name='estimated_application_time', ), migrations.RenameField( - model_name="program", - old_name="estimated_delivery_time_1", - new_name="estimated_delivery_time", + model_name='program', + old_name='estimated_delivery_time_1', + new_name='estimated_delivery_time', ), migrations.RenameField( - model_name="program", - old_name="learn_more_link_1", - new_name="learn_more_link", + model_name='program', + old_name='learn_more_link_1', + new_name='learn_more_link', ), migrations.RenameField( - model_name="program", - old_name="legal_status_required_1", - new_name="legal_status_required", + model_name='program', + old_name='legal_status_required_1', + new_name='legal_status_required', ), migrations.RenameField( - model_name="program", - old_name="name_1", - new_name="name", + model_name='program', + old_name='name_1', + new_name='name', ), migrations.RenameField( - model_name="program", - old_name="name_abbreviated_1", - new_name="name_abbreviated", + model_name='program', + old_name='name_abbreviated_1', + new_name='name_abbreviated', ), migrations.RenameField( - model_name="program", - old_name="value_type_1", - new_name="value_type", + model_name='program', + old_name='value_type_1', + new_name='value_type', ), ] diff --git a/programs/migrations/0049_navigator_assistance_link_1_navigator_description_1_and_more.py b/programs/migrations/0049_navigator_assistance_link_1_navigator_description_1_and_more.py index c6550838..206e9e9d 100644 --- a/programs/migrations/0049_navigator_assistance_link_1_navigator_description_1_and_more.py +++ b/programs/migrations/0049_navigator_assistance_link_1_navigator_description_1_and_more.py @@ -5,177 +5,96 @@ class Migration(migrations.Migration): + dependencies = [ - ("translations", "0003_alter_translation_managers"), - ("programs", "0048_rename_active_1_program_active_and_more"), + ('translations', '0003_alter_translation_managers'), + ('programs', '0048_rename_active_1_program_active_and_more'), ] operations = [ migrations.AddField( - model_name="navigator", - name="assistance_link_1", - field=models.ForeignKey( - blank=True, - null=True, - on_delete=django.db.models.deletion.PROTECT, - related_name="navigator_assistance_link", - to="translations.translation", - ), + model_name='navigator', + name='assistance_link_1', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='navigator_assistance_link', to='translations.translation'), ), migrations.AddField( - model_name="navigator", - name="description_1", - field=models.ForeignKey( - blank=True, - null=True, - on_delete=django.db.models.deletion.PROTECT, - related_name="navigator_name_description", - to="translations.translation", - ), + model_name='navigator', + name='description_1', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='navigator_name_description', to='translations.translation'), ), migrations.AddField( - model_name="navigator", - name="email_1", - field=models.ForeignKey( - blank=True, - null=True, - on_delete=django.db.models.deletion.PROTECT, - related_name="navigator_email", - to="translations.translation", - ), + model_name='navigator', + name='email_1', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='navigator_email', to='translations.translation'), ), migrations.AddField( - model_name="navigator", - name="name_1", - field=models.ForeignKey( - blank=True, - null=True, - on_delete=django.db.models.deletion.PROTECT, - related_name="navigator_name", - to="translations.translation", - ), + model_name='navigator', + name='name_1', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='navigator_name', to='translations.translation'), ), migrations.AddField( - model_name="urgentneed", - name="description_1", - field=models.ForeignKey( - blank=True, - null=True, - on_delete=django.db.models.deletion.PROTECT, - related_name="urgent_need_description", - to="translations.translation", - ), + model_name='urgentneed', + name='description_1', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='urgent_need_description', to='translations.translation'), ), migrations.AddField( - model_name="urgentneed", - name="link_1", - field=models.ForeignKey( - blank=True, - null=True, - on_delete=django.db.models.deletion.PROTECT, - related_name="urgent_need_link", - to="translations.translation", - ), + model_name='urgentneed', + name='link_1', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='urgent_need_link', to='translations.translation'), ), migrations.AddField( - model_name="urgentneed", - name="name_1", - field=models.ForeignKey( - blank=True, - null=True, - on_delete=django.db.models.deletion.PROTECT, - related_name="urgent_need_name", - to="translations.translation", - ), + model_name='urgentneed', + name='name_1', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='urgent_need_name', to='translations.translation'), ), migrations.AddField( - model_name="urgentneed", - name="type_1", - field=models.ForeignKey( - blank=True, - null=True, - on_delete=django.db.models.deletion.PROTECT, - related_name="urgent_need_type", - to="translations.translation", - ), + model_name='urgentneed', + name='type_1', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='urgent_need_type', to='translations.translation'), ), migrations.AlterField( - model_name="program", - name="apply_button_link", - field=models.ForeignKey( - on_delete=django.db.models.deletion.PROTECT, - related_name="program_apply_button_link", - to="translations.translation", - ), + model_name='program', + name='apply_button_link', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='program_apply_button_link', to='translations.translation'), ), migrations.AlterField( - model_name="program", - name="category", - field=models.ForeignKey( - on_delete=django.db.models.deletion.PROTECT, - related_name="program_category", - to="translations.translation", - ), + model_name='program', + name='category', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='program_category', to='translations.translation'), ), migrations.AlterField( - model_name="program", - name="description", - field=models.ForeignKey( - on_delete=django.db.models.deletion.PROTECT, - related_name="program_description", - to="translations.translation", - ), + model_name='program', + name='description', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='program_description', to='translations.translation'), ), migrations.AlterField( - model_name="program", - name="description_short", - field=models.ForeignKey( - on_delete=django.db.models.deletion.PROTECT, - related_name="program_description_short", - to="translations.translation", - ), + model_name='program', + name='description_short', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='program_description_short', to='translations.translation'), ), migrations.AlterField( - model_name="program", - name="estimated_application_time", - field=models.ForeignKey( - on_delete=django.db.models.deletion.PROTECT, - related_name="program_estimated_application_time", - to="translations.translation", - ), + model_name='program', + name='estimated_application_time', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='program_estimated_application_time', to='translations.translation'), ), migrations.AlterField( - model_name="program", - name="estimated_delivery_time", - field=models.ForeignKey( - on_delete=django.db.models.deletion.PROTECT, - related_name="program_estimated_delivery_time", - to="translations.translation", - ), + model_name='program', + name='estimated_delivery_time', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='program_estimated_delivery_time', to='translations.translation'), ), migrations.AlterField( - model_name="program", - name="learn_more_link", - field=models.ForeignKey( - on_delete=django.db.models.deletion.PROTECT, - related_name="program_learn_more_link", - to="translations.translation", - ), + model_name='program', + name='learn_more_link', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='program_learn_more_link', to='translations.translation'), ), migrations.AlterField( - model_name="program", - name="name", - field=models.ForeignKey( - on_delete=django.db.models.deletion.PROTECT, related_name="program_name", to="translations.translation" - ), + model_name='program', + name='name', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='program_name', to='translations.translation'), ), migrations.AlterField( - model_name="program", - name="value_type", - field=models.ForeignKey( - on_delete=django.db.models.deletion.PROTECT, - related_name="program_value_type", - to="translations.translation", - ), + model_name='program', + name='value_type', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='program_value_type', to='translations.translation'), ), ] diff --git a/programs/migrations/0050_auto_20230906_1427.py b/programs/migrations/0050_auto_20230906_1427.py index f753e67e..6a7e0494 100644 --- a/programs/migrations/0050_auto_20230906_1427.py +++ b/programs/migrations/0050_auto_20230906_1427.py @@ -5,59 +5,52 @@ def urgent_need_migrations(apps, _): - UrgentNeed = apps.get_model("programs", "UrgentNeed") - Translation = apps.get_model("translations", "Translation") + UrgentNeed = apps.get_model('programs', 'UrgentNeed') + Translation = apps.get_model('translations', 'Translation') translated_fields = ( - "name", - "description", - "link", - "type", + 'name', + 'description', + 'link', + 'type', ) for urgent_need in UrgentNeed.objects.all(): main_name = urgent_need.name for field in translated_fields: - translation = Translation.objects.add_translation( - f"urgent_need.{main_name}_{urgent_need.id}-{field}", getattr(urgent_need, field) - ) - setattr(urgent_need, field + "_1", translation) + translation = Translation.objects.add_translation(f'urgent_need.{main_name}_{urgent_need.id}-{field}', getattr(urgent_need, field)) + setattr(urgent_need, field + '_1', translation) for lang in settings.PARLER_LANGUAGES[None]: - urgent_need.set_current_language(lang["code"]) - Translation.objects.edit_translation( - f"urgent_need.{main_name}_{urgent_need.id}-{field}", lang["code"], getattr(urgent_need, field), True - ) + urgent_need.set_current_language(lang['code']) + Translation.objects.edit_translation(f'urgent_need.{main_name}_{urgent_need.id}-{field}', lang['code'], getattr(urgent_need, field), True) urgent_need.save() def navigator_migrations(apps, _): - Navigator = apps.get_model("programs", "Navigator") - Translation = apps.get_model("translations", "Translation") + Navigator = apps.get_model('programs', 'Navigator') + Translation = apps.get_model('translations', 'Translation') translated_fields = ( - "name", - "email", - "assistance_link", - "description", + 'name', + 'email', + 'assistance_link', + 'description', ) for navigator in Navigator.objects.all(): main_name = navigator.name for field in translated_fields: - translation = Translation.objects.add_translation( - f"navigator.{main_name}_{navigator.id}-{field}", getattr(navigator, field) - ) - setattr(navigator, field + "_1", translation) + translation = Translation.objects.add_translation(f'navigator.{main_name}_{navigator.id}-{field}', getattr(navigator, field)) + setattr(navigator, field + '_1', translation) for lang in settings.PARLER_LANGUAGES[None]: - navigator.set_current_language(lang["code"]) - Translation.objects.edit_translation( - f"navigator.{main_name}_{navigator.id}-{field}", lang["code"], getattr(navigator, field), True - ) + navigator.set_current_language(lang['code']) + Translation.objects.edit_translation(f'navigator.{main_name}_{navigator.id}-{field}', lang['code'], getattr(navigator, field), True) navigator.save() class Migration(migrations.Migration): + dependencies = [ - ("programs", "0049_navigator_assistance_link_1_navigator_description_1_and_more"), - ("translations", "0003_alter_translation_managers"), + ('programs', '0049_navigator_assistance_link_1_navigator_description_1_and_more'), + ('translations', '0003_alter_translation_managers'), ] operations = [ diff --git a/programs/migrations/0051_alter_urgentneedtranslation_unique_together_and_more.py b/programs/migrations/0051_alter_urgentneedtranslation_unique_together_and_more.py index bc62b8c7..c00907f1 100644 --- a/programs/migrations/0051_alter_urgentneedtranslation_unique_together_and_more.py +++ b/programs/migrations/0051_alter_urgentneedtranslation_unique_together_and_more.py @@ -4,23 +4,24 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0050_auto_20230906_1427"), + ('programs', '0050_auto_20230906_1427'), ] operations = [ migrations.AlterUniqueTogether( - name="urgentneedtranslation", + name='urgentneedtranslation', unique_together=None, ), migrations.RemoveField( - model_name="urgentneedtranslation", - name="master", + model_name='urgentneedtranslation', + name='master', ), migrations.DeleteModel( - name="NavigatorTranslation", + name='NavigatorTranslation', ), migrations.DeleteModel( - name="UrgentNeedTranslation", + name='UrgentNeedTranslation', ), ] diff --git a/programs/migrations/0052_alter_navigator_assistance_link_1_and_more.py b/programs/migrations/0052_alter_navigator_assistance_link_1_and_more.py index 73e8c3ee..865c43c9 100644 --- a/programs/migrations/0052_alter_navigator_assistance_link_1_and_more.py +++ b/programs/migrations/0052_alter_navigator_assistance_link_1_and_more.py @@ -5,82 +5,51 @@ class Migration(migrations.Migration): + dependencies = [ - ("translations", "0003_alter_translation_managers"), - ("programs", "0051_alter_urgentneedtranslation_unique_together_and_more"), + ('translations', '0003_alter_translation_managers'), + ('programs', '0051_alter_urgentneedtranslation_unique_together_and_more'), ] operations = [ migrations.AlterField( - model_name="navigator", - name="assistance_link_1", - field=models.ForeignKey( - on_delete=django.db.models.deletion.PROTECT, - related_name="navigator_assistance_link", - to="translations.translation", - ), + model_name='navigator', + name='assistance_link_1', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='navigator_assistance_link', to='translations.translation'), ), migrations.AlterField( - model_name="navigator", - name="description_1", - field=models.ForeignKey( - on_delete=django.db.models.deletion.PROTECT, - related_name="navigator_name_description", - to="translations.translation", - ), + model_name='navigator', + name='description_1', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='navigator_name_description', to='translations.translation'), ), migrations.AlterField( - model_name="navigator", - name="email_1", - field=models.ForeignKey( - on_delete=django.db.models.deletion.PROTECT, - related_name="navigator_email", - to="translations.translation", - ), + model_name='navigator', + name='email_1', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='navigator_email', to='translations.translation'), ), migrations.AlterField( - model_name="navigator", - name="name_1", - field=models.ForeignKey( - on_delete=django.db.models.deletion.PROTECT, - related_name="navigator_name", - to="translations.translation", - ), + model_name='navigator', + name='name_1', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='navigator_name', to='translations.translation'), ), migrations.AlterField( - model_name="urgentneed", - name="description_1", - field=models.ForeignKey( - on_delete=django.db.models.deletion.PROTECT, - related_name="urgent_need_description", - to="translations.translation", - ), + model_name='urgentneed', + name='description_1', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='urgent_need_description', to='translations.translation'), ), migrations.AlterField( - model_name="urgentneed", - name="link_1", - field=models.ForeignKey( - on_delete=django.db.models.deletion.PROTECT, - related_name="urgent_need_link", - to="translations.translation", - ), + model_name='urgentneed', + name='link_1', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='urgent_need_link', to='translations.translation'), ), migrations.AlterField( - model_name="urgentneed", - name="name_1", - field=models.ForeignKey( - on_delete=django.db.models.deletion.PROTECT, - related_name="urgent_need_name", - to="translations.translation", - ), + model_name='urgentneed', + name='name_1', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='urgent_need_name', to='translations.translation'), ), migrations.AlterField( - model_name="urgentneed", - name="type_1", - field=models.ForeignKey( - on_delete=django.db.models.deletion.PROTECT, - related_name="urgent_need_type", - to="translations.translation", - ), + model_name='urgentneed', + name='type_1', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='urgent_need_type', to='translations.translation'), ), ] diff --git a/programs/migrations/0053_rename_assistance_link_1_navigator_assistance_link_and_more.py b/programs/migrations/0053_rename_assistance_link_1_navigator_assistance_link_and_more.py index 3595687a..cb2bd7bc 100644 --- a/programs/migrations/0053_rename_assistance_link_1_navigator_assistance_link_and_more.py +++ b/programs/migrations/0053_rename_assistance_link_1_navigator_assistance_link_and_more.py @@ -4,49 +4,50 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0052_alter_navigator_assistance_link_1_and_more"), + ('programs', '0052_alter_navigator_assistance_link_1_and_more'), ] operations = [ migrations.RenameField( - model_name="navigator", - old_name="assistance_link_1", - new_name="assistance_link", + model_name='navigator', + old_name='assistance_link_1', + new_name='assistance_link', ), migrations.RenameField( - model_name="navigator", - old_name="description_1", - new_name="description", + model_name='navigator', + old_name='description_1', + new_name='description', ), migrations.RenameField( - model_name="navigator", - old_name="email_1", - new_name="email", + model_name='navigator', + old_name='email_1', + new_name='email', ), migrations.RenameField( - model_name="navigator", - old_name="name_1", - new_name="name", + model_name='navigator', + old_name='name_1', + new_name='name', ), migrations.RenameField( - model_name="urgentneed", - old_name="description_1", - new_name="description", + model_name='urgentneed', + old_name='description_1', + new_name='description', ), migrations.RenameField( - model_name="urgentneed", - old_name="link_1", - new_name="link", + model_name='urgentneed', + old_name='link_1', + new_name='link', ), migrations.RenameField( - model_name="urgentneed", - old_name="name_1", - new_name="name", + model_name='urgentneed', + old_name='name_1', + new_name='name', ), migrations.RenameField( - model_name="urgentneed", - old_name="type_1", - new_name="type", + model_name='urgentneed', + old_name='type_1', + new_name='type', ), ] diff --git a/programs/migrations/0054_navigator_external_name_program_external_name_and_more.py b/programs/migrations/0054_navigator_external_name_program_external_name_and_more.py index 2900d027..a76fd8d9 100644 --- a/programs/migrations/0054_navigator_external_name_program_external_name_and_more.py +++ b/programs/migrations/0054_navigator_external_name_program_external_name_and_more.py @@ -4,24 +4,25 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0053_rename_assistance_link_1_navigator_assistance_link_and_more"), + ('programs', '0053_rename_assistance_link_1_navigator_assistance_link_and_more'), ] operations = [ migrations.AddField( - model_name="navigator", - name="external_name", + model_name='navigator', + name='external_name', field=models.CharField(max_length=120, null=True, unique=True), ), migrations.AddField( - model_name="program", - name="external_name", + model_name='program', + name='external_name', field=models.CharField(max_length=120, null=True, unique=True), ), migrations.AddField( - model_name="urgentneed", - name="external_name", + model_name='urgentneed', + name='external_name', field=models.CharField(max_length=120, null=True, unique=True), ), ] diff --git a/programs/migrations/0055_alter_navigator_external_name_and_more.py b/programs/migrations/0055_alter_navigator_external_name_and_more.py index 56bc4415..941c9468 100644 --- a/programs/migrations/0055_alter_navigator_external_name_and_more.py +++ b/programs/migrations/0055_alter_navigator_external_name_and_more.py @@ -4,24 +4,25 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0054_navigator_external_name_program_external_name_and_more"), + ('programs', '0054_navigator_external_name_program_external_name_and_more'), ] operations = [ migrations.AlterField( - model_name="navigator", - name="external_name", + model_name='navigator', + name='external_name', field=models.CharField(blank=True, max_length=120, null=True, unique=True), ), migrations.AlterField( - model_name="program", - name="external_name", + model_name='program', + name='external_name', field=models.CharField(blank=True, max_length=120, null=True, unique=True), ), migrations.AlterField( - model_name="urgentneed", - name="external_name", + model_name='urgentneed', + name='external_name', field=models.CharField(blank=True, max_length=120, null=True, unique=True), ), ] diff --git a/programs/migrations/0056_urgentneedcategory_remove_urgentneed_type_short_and_more.py b/programs/migrations/0056_urgentneedcategory_remove_urgentneed_type_short_and_more.py index 79f7af3d..9f7f540b 100644 --- a/programs/migrations/0056_urgentneedcategory_remove_urgentneed_type_short_and_more.py +++ b/programs/migrations/0056_urgentneedcategory_remove_urgentneed_type_short_and_more.py @@ -4,25 +4,26 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0055_alter_navigator_external_name_and_more"), + ('programs', '0055_alter_navigator_external_name_and_more'), ] operations = [ migrations.CreateModel( - name="UrgentNeedCategory", + name='UrgentNeedCategory', fields=[ - ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), - ("name", models.CharField(max_length=120)), + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=120)), ], ), migrations.RemoveField( - model_name="urgentneed", - name="type_short", + model_name='urgentneed', + name='type_short', ), migrations.AddField( - model_name="urgentneed", - name="type_short", - field=models.ManyToManyField(related_name="type_short", to="programs.urgentneedcategory"), + model_name='urgentneed', + name='type_short', + field=models.ManyToManyField(related_name='type_short', to='programs.urgentneedcategory'), ), ] diff --git a/programs/migrations/0057_alter_urgentneedcategory_options_and_more.py b/programs/migrations/0057_alter_urgentneedcategory_options_and_more.py index 5dc54ad4..ce202af1 100644 --- a/programs/migrations/0057_alter_urgentneedcategory_options_and_more.py +++ b/programs/migrations/0057_alter_urgentneedcategory_options_and_more.py @@ -5,39 +5,31 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0056_urgentneedcategory_remove_urgentneed_type_short_and_more"), + ('programs', '0056_urgentneedcategory_remove_urgentneed_type_short_and_more'), ] operations = [ migrations.AlterModelOptions( - name="urgentneedcategory", - options={"verbose_name_plural": "Urgent Need Categories"}, + name='urgentneedcategory', + options={'verbose_name_plural': 'Urgent Need Categories'}, ), migrations.RemoveField( - model_name="program", - name="legal_status_required", + model_name='program', + name='legal_status_required', ), migrations.AlterField( - model_name="urgentneed", - name="type_short", - field=models.ManyToManyField(related_name="urgent_needs", to="programs.urgentneedcategory"), + model_name='urgentneed', + name='type_short', + field=models.ManyToManyField(related_name='urgent_needs', to='programs.urgentneedcategory'), ), migrations.CreateModel( - name="LegalStatus", + name='LegalStatus', fields=[ - ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), - ("status", models.CharField(max_length=256)), - ( - "parent", - models.ForeignKey( - blank=True, - null=True, - on_delete=django.db.models.deletion.SET_NULL, - related_name="children", - to="programs.legalstatus", - ), - ), + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('status', models.CharField(max_length=256)), + ('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='children', to='programs.legalstatus')), ], ), ] diff --git a/programs/migrations/0058_program_legal_status_required.py b/programs/migrations/0058_program_legal_status_required.py index 5653cdbb..16b01d6b 100644 --- a/programs/migrations/0058_program_legal_status_required.py +++ b/programs/migrations/0058_program_legal_status_required.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0057_alter_urgentneedcategory_options_and_more"), + ('programs', '0057_alter_urgentneedcategory_options_and_more'), ] operations = [ migrations.AddField( - model_name="program", - name="legal_status_required", - field=models.ManyToManyField(related_name="programs", to="programs.legalstatus"), + model_name='program', + name='legal_status_required', + field=models.ManyToManyField(related_name='programs', to='programs.legalstatus'), ), ] diff --git a/programs/migrations/0059_alter_program_legal_status_required.py b/programs/migrations/0059_alter_program_legal_status_required.py index 81f1e4e1..7513d4f5 100644 --- a/programs/migrations/0059_alter_program_legal_status_required.py +++ b/programs/migrations/0059_alter_program_legal_status_required.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("programs", "0058_program_legal_status_required"), + ('programs', '0058_program_legal_status_required'), ] operations = [ migrations.AlterField( - model_name="program", - name="legal_status_required", - field=models.ManyToManyField(blank=True, related_name="programs", to="programs.legalstatus"), + model_name='program', + name='legal_status_required', + field=models.ManyToManyField(blank=True, related_name='programs', to='programs.legalstatus'), ), ] diff --git a/programs/migrations/0060_alter_navigator_program.py b/programs/migrations/0060_alter_navigator_program.py index d2790a19..bf16d611 100644 --- a/programs/migrations/0060_alter_navigator_program.py +++ b/programs/migrations/0060_alter_navigator_program.py @@ -12,6 +12,8 @@ class Migration(migrations.Migration): migrations.AlterField( model_name="navigator", name="program", - field=models.ManyToManyField(blank=True, related_name="navigator", to="programs.program"), + field=models.ManyToManyField( + blank=True, related_name="navigator", to="programs.program" + ), ), ] diff --git a/programs/migrations/0061_referrer_remove_programs.py b/programs/migrations/0061_referrer_remove_programs.py index 8fd80118..fd76f695 100644 --- a/programs/migrations/0061_referrer_remove_programs.py +++ b/programs/migrations/0061_referrer_remove_programs.py @@ -12,6 +12,8 @@ class Migration(migrations.Migration): migrations.AddField( model_name="referrer", name="remove_programs", - field=models.ManyToManyField(blank=True, related_name="removed_programs", to="programs.program"), + field=models.ManyToManyField( + blank=True, related_name="removed_programs", to="programs.program" + ), ), ] diff --git a/programs/migrations/0062_document_program_documents.py b/programs/migrations/0062_document_program_documents.py index 217a5457..f62a9659 100644 --- a/programs/migrations/0062_document_program_documents.py +++ b/programs/migrations/0062_document_program_documents.py @@ -37,6 +37,8 @@ class Migration(migrations.Migration): migrations.AddField( model_name="program", name="documents", - field=models.ManyToManyField(blank=True, related_name="program_documents", to="programs.document"), + field=models.ManyToManyField( + blank=True, related_name="program_documents", to="programs.document" + ), ), ] diff --git a/programs/migrations/0062_navigatorcounties_navigator_counties.py b/programs/migrations/0062_navigatorcounties_navigator_counties.py index df2da244..b0212add 100644 --- a/programs/migrations/0062_navigatorcounties_navigator_counties.py +++ b/programs/migrations/0062_navigatorcounties_navigator_counties.py @@ -27,6 +27,8 @@ class Migration(migrations.Migration): migrations.AddField( model_name="navigator", name="counties", - field=models.ManyToManyField(blank=True, related_name="navigator", to="programs.navigatorcounties"), + field=models.ManyToManyField( + blank=True, related_name="navigator", to="programs.navigatorcounties" + ), ), ] diff --git a/programs/migrations/0063_navigatorcounty_delete_navigatorcounties_and_more.py b/programs/migrations/0063_navigatorcounty_delete_navigatorcounties_and_more.py index 1f146ef6..dcf1a554 100644 --- a/programs/migrations/0063_navigatorcounty_delete_navigatorcounties_and_more.py +++ b/programs/migrations/0063_navigatorcounty_delete_navigatorcounties_and_more.py @@ -30,6 +30,8 @@ class Migration(migrations.Migration): migrations.AlterField( model_name="navigator", name="counties", - field=models.ManyToManyField(blank=True, related_name="navigator", to="programs.navigatorcounty"), + field=models.ManyToManyField( + blank=True, related_name="navigator", to="programs.navigatorcounty" + ), ), ] diff --git a/programs/migrations/0066_auto_20240130_1146.py b/programs/migrations/0066_auto_20240130_1146.py index 7ff778d7..fde4ea86 100644 --- a/programs/migrations/0066_auto_20240130_1146.py +++ b/programs/migrations/0066_auto_20240130_1146.py @@ -4,17 +4,19 @@ def add_warning(apps, schema_editor): - Program = apps.get_model("programs", "Program") - UrgentNeed = apps.get_model("programs", "UrgentNeed") - Translation = apps.get_model("translations", "Translation") + Program = apps.get_model('programs', 'Program') + UrgentNeed = apps.get_model('programs', 'UrgentNeed') + Translation = apps.get_model('translations', 'Translation') for need in UrgentNeed.objects.all(): - translation = Translation.objects.add_translation(f"urgent_need.{need.name.text}-{need.id}_warning", "") + translation = Translation.objects.add_translation( + f'urgent_need.{need.name.text}-{need.id}_warning', '' + ) UrgentNeed.objects.filter(pk=need.id).update(warning=translation.id) for program in Program.objects.all(): translation = Translation.objects.add_translation( - f"programs.{program.name_abbreviated}-{program.id}_warning", "" + f'programs.{program.name_abbreviated}-{program.id}_warning', '' ) Program.objects.filter(pk=program.id).update(warning=translation.id) diff --git a/programs/models.py b/programs/models.py index 147a8354..7c54254c 100644 --- a/programs/models.py +++ b/programs/models.py @@ -34,21 +34,26 @@ def __str__(self): class LegalStatus(models.Model): status = models.CharField(max_length=256) - parent = models.ForeignKey("self", related_name="children", blank=True, null=True, on_delete=models.SET_NULL) + parent = models.ForeignKey('self', related_name='children', blank=True, null=True, on_delete=models.SET_NULL) def __str__(self): return self.status class DocumentManager(models.Manager): - translated_fields = ("text",) + translated_fields = ('text',) def new_document(self, external_name): - translation = Translation.objects.add_translation(f"document.{external_name}_temporary_key", "") + translation = Translation.objects.add_translation( + f'document.{external_name}_temporary_key', '' + ) - document = self.create(external_name=external_name, text=translation) + document = self.create( + external_name=external_name, + text=translation + ) - translation.label = f"document.{external_name}_{document.id}" + translation.label = f'document.{external_name}_{document.id}' translation.save() return document @@ -56,7 +61,7 @@ def new_document(self, external_name): class Document(models.Model): external_name = models.CharField(max_length=120, blank=True, null=True, unique=True) - text = models.ForeignKey(Translation, related_name="documents", blank=False, null=False, on_delete=models.PROTECT) + text = models.ForeignKey(Translation, related_name='documents', blank=False, null=False, on_delete=models.PROTECT) objects = DocumentManager() @@ -66,23 +71,23 @@ def __str__(self) -> str: class ProgramManager(models.Manager): translated_fields = ( - "description_short", - "name", - "description", - "learn_more_link", - "apply_button_link", - "value_type", - "estimated_delivery_time", - "estimated_application_time", - "category", - "warning", + 'description_short', + 'name', + 'description', + 'learn_more_link', + 'apply_button_link', + 'value_type', + 'estimated_delivery_time', + 'estimated_application_time', + 'category', + 'warning', ) def new_program(self, name_abbreviated): translations = {} for field in self.translated_fields: translations[field] = Translation.objects.add_translation( - f"program.{name_abbreviated}_temporary_key-{field}", "" + f'program.{name_abbreviated}_temporary_key-{field}', '' ) program = self.create( @@ -94,7 +99,7 @@ def new_program(self, name_abbreviated): ) for [field, translation] in translations.items(): - translation.label = f"program.{name_abbreviated}_{program.id}-{field}" + translation.label = f'program.{name_abbreviated}_{program.id}-{field}' translation.save() return program @@ -106,46 +111,68 @@ def new_program(self, name_abbreviated): class Program(models.Model): name_abbreviated = models.CharField(max_length=120) external_name = models.CharField(max_length=120, blank=True, null=True, unique=True) - legal_status_required = models.ManyToManyField(LegalStatus, related_name="programs", blank=True) - documents = models.ManyToManyField(Document, related_name="program_documents", blank=True) + legal_status_required = models.ManyToManyField(LegalStatus, related_name='programs', blank=True) + documents = models.ManyToManyField(Document, related_name='program_documents', blank=True) active = models.BooleanField(blank=True, default=True) low_confidence = models.BooleanField(blank=True, null=False, default=False) - fpl = models.ForeignKey(FederalPoveryLimit, related_name="fpl", blank=True, null=True, on_delete=models.SET_NULL) + fpl = models.ForeignKey(FederalPoveryLimit, related_name='fpl', blank=True, null=True, on_delete=models.SET_NULL) description_short = models.ForeignKey( - Translation, related_name="program_description_short", blank=False, null=False, on_delete=models.PROTECT - ) + Translation, + related_name='program_description_short', + blank=False, + null=False, + on_delete=models.PROTECT) name = models.ForeignKey( - Translation, related_name="program_name", blank=False, null=False, on_delete=models.PROTECT - ) + Translation, + related_name='program_name', + blank=False, + null=False, + on_delete=models.PROTECT) description = models.ForeignKey( - Translation, related_name="program_description", blank=False, null=False, on_delete=models.PROTECT - ) + Translation, + related_name='program_description', + blank=False, + null=False, + on_delete=models.PROTECT) learn_more_link = models.ForeignKey( - Translation, related_name="program_learn_more_link", blank=False, null=False, on_delete=models.PROTECT - ) + Translation, + related_name='program_learn_more_link', + blank=False, + null=False, + on_delete=models.PROTECT) apply_button_link = models.ForeignKey( - Translation, related_name="program_apply_button_link", null=False, on_delete=models.PROTECT - ) + Translation, + related_name='program_apply_button_link', + null=False, + on_delete=models.PROTECT) value_type = models.ForeignKey( - Translation, related_name="program_value_type", blank=False, null=False, on_delete=models.PROTECT - ) + Translation, + related_name='program_value_type', + blank=False, + null=False, + on_delete=models.PROTECT) estimated_delivery_time = models.ForeignKey( - Translation, related_name="program_estimated_delivery_time", blank=False, null=False, on_delete=models.PROTECT - ) + Translation, + related_name='program_estimated_delivery_time', + blank=False, + null=False, + on_delete=models.PROTECT) estimated_application_time = models.ForeignKey( Translation, - related_name="program_estimated_application_time", + related_name='program_estimated_application_time', blank=False, null=False, - on_delete=models.PROTECT, - ) + on_delete=models.PROTECT) category = models.ForeignKey( - Translation, related_name="program_category", blank=False, null=False, on_delete=models.PROTECT - ) + Translation, + related_name='program_category', + blank=False, + null=False, + on_delete=models.PROTECT) warning = models.ForeignKey( Translation, - related_name="program_warning", + related_name='program_warning', blank=False, null=False, on_delete=models.PROTECT, @@ -190,7 +217,7 @@ class UrgentNeedCategory(models.Model): name = models.CharField(max_length=120) class Meta: - verbose_name_plural = "Urgent Need Categories" + verbose_name_plural = 'Urgent Need Categories' def __str__(self): return self.name @@ -198,17 +225,17 @@ def __str__(self): class UrgentNeedManager(models.Manager): translated_fields = ( - "name", - "description", - "link", - "type", - "warning", + 'name', + 'description', + 'link', + 'type', + 'warning', ) def new_urgent_need(self, name, phone_number): translations = {} for field in self.translated_fields: - translations[field] = Translation.objects.add_translation(f"urgent_need.{name}_temporary_key-{field}", "") + translations[field] = Translation.objects.add_translation(f'urgent_need.{name}_temporary_key-{field}', '') urgent_need = self.create( phone_number=phone_number, @@ -218,7 +245,7 @@ def new_urgent_need(self, name, phone_number): ) for [field, translation] in translations.items(): - translation.label = f"urgent_need.{name}_{urgent_need.id}-{field}" + translation.label = f'urgent_need.{name}_{urgent_need.id}-{field}' translation.save() return urgent_need @@ -227,25 +254,41 @@ def new_urgent_need(self, name, phone_number): class UrgentNeed(models.Model): external_name = models.CharField(max_length=120, blank=True, null=True, unique=True) phone_number = PhoneNumberField(blank=True, null=True) - type_short = models.ManyToManyField(UrgentNeedCategory, related_name="urgent_needs") + type_short = models.ManyToManyField(UrgentNeedCategory, related_name='urgent_needs') active = models.BooleanField(blank=True, null=False, default=True) low_confidence = models.BooleanField(blank=True, null=False, default=False) - functions = models.ManyToManyField(UrgentNeedFunction, related_name="function", blank=True) + functions = models.ManyToManyField(UrgentNeedFunction, related_name='function', blank=True) name = models.ForeignKey( - Translation, related_name="urgent_need_name", blank=False, null=False, on_delete=models.PROTECT - ) + Translation, + related_name='urgent_need_name', + blank=False, + null=False, + on_delete=models.PROTECT) description = models.ForeignKey( - Translation, related_name="urgent_need_description", blank=False, null=False, on_delete=models.PROTECT - ) + Translation, + related_name='urgent_need_description', + blank=False, + null=False, + on_delete=models.PROTECT) link = models.ForeignKey( - Translation, related_name="urgent_need_link", blank=False, null=False, on_delete=models.PROTECT - ) + Translation, + related_name='urgent_need_link', + blank=False, + null=False, + on_delete=models.PROTECT) type = models.ForeignKey( - Translation, related_name="urgent_need_type", blank=False, null=False, on_delete=models.PROTECT - ) + Translation, + related_name='urgent_need_type', + blank=False, + null=False, + on_delete=models.PROTECT) warning = models.ForeignKey( - Translation, related_name="urgent_need_warning", blank=False, null=False, on_delete=models.PROTECT + Translation, + related_name='urgent_need_warning', + blank=False, + null=False, + on_delete=models.PROTECT ) objects = UrgentNeedManager() @@ -263,16 +306,16 @@ def __str__(self) -> str: class NavigatorManager(models.Manager): translated_fields = ( - "name", - "email", - "assistance_link", - "description", + 'name', + 'email', + 'assistance_link', + 'description', ) def new_navigator(self, name, phone_number): translations = {} for field in self.translated_fields: - translations[field] = Translation.objects.add_translation(f"navigator.{name}_temporary_key-{field}", "") + translations[field] = Translation.objects.add_translation(f'navigator.{name}_temporary_key-{field}', '') navigator = self.create( phone_number=phone_number, @@ -280,30 +323,42 @@ def new_navigator(self, name, phone_number): ) for [field, translation] in translations.items(): - translation.label = f"navigator.{name}_{navigator.id}-{field}" + translation.label = f'navigator.{name}_{navigator.id}-{field}' translation.save() return navigator class Navigator(models.Model): - program = models.ManyToManyField(Program, related_name="navigator", blank=True) + program = models.ManyToManyField(Program, related_name='navigator', blank=True) external_name = models.CharField(max_length=120, blank=True, null=True, unique=True) phone_number = PhoneNumberField(blank=True, null=True) - counties = models.ManyToManyField(NavigatorCounty, related_name="navigator", blank=True) + counties = models.ManyToManyField(NavigatorCounty, related_name='navigator', blank=True) name = models.ForeignKey( - Translation, related_name="navigator_name", blank=False, null=False, on_delete=models.PROTECT - ) + Translation, + related_name='navigator_name', + blank=False, + null=False, + on_delete=models.PROTECT) email = models.ForeignKey( - Translation, related_name="navigator_email", blank=False, null=False, on_delete=models.PROTECT - ) + Translation, + related_name='navigator_email', + blank=False, + null=False, + on_delete=models.PROTECT) assistance_link = models.ForeignKey( - Translation, related_name="navigator_assistance_link", blank=False, null=False, on_delete=models.PROTECT - ) + Translation, + related_name='navigator_assistance_link', + blank=False, + null=False, + on_delete=models.PROTECT) description = models.ForeignKey( - Translation, related_name="navigator_name_description", blank=False, null=False, on_delete=models.PROTECT - ) + Translation, + related_name='navigator_name_description', + blank=False, + null=False, + on_delete=models.PROTECT) objects = NavigatorManager() @@ -321,9 +376,9 @@ def __str__(self): class Referrer(models.Model): referrer_code = models.CharField(max_length=64, unique=True) webhook_url = models.CharField(max_length=320, blank=True, null=True) - webhook_functions = models.ManyToManyField(WebHookFunction, related_name="web_hook", blank=True) - primary_navigators = models.ManyToManyField(Navigator, related_name="primary_navigators", blank=True) - remove_programs = models.ManyToManyField(Program, related_name="removed_programs", blank=True) + webhook_functions = models.ManyToManyField(WebHookFunction, related_name='web_hook', blank=True) + primary_navigators = models.ManyToManyField(Navigator, related_name='primary_navigators', blank=True) + remove_programs = models.ManyToManyField(Program, related_name='removed_programs', blank=True) def __str__(self): return self.referrer_code diff --git a/programs/programs/__init__.py b/programs/programs/__init__.py index 13e75b6d..f2f2c433 100644 --- a/programs/programs/__init__.py +++ b/programs/programs/__init__.py @@ -2,4 +2,7 @@ from .federal import federal_calculators from .calc import ProgramCalculator -calculators: dict[str, type[ProgramCalculator]] = {**co_calculators, **federal_calculators} +calculators: dict[str, type[ProgramCalculator]] = { + **co_calculators, + **federal_calculators +} diff --git a/programs/programs/calc.py b/programs/programs/calc.py index e957e019..8124e6e5 100644 --- a/programs/programs/calc.py +++ b/programs/programs/calc.py @@ -1,7 +1,6 @@ from screener.models import Screen from programs.util import Dependencies from typing import TYPE_CHECKING - if TYPE_CHECKING: from programs.models import Program @@ -15,9 +14,9 @@ def __init__(self): self.eligible_member_count = 0 def condition(self, passed: bool, message=None): - """ + ''' Uses a condition to update the pass fail messages and eligibility. - """ + ''' if message is None: if not passed: @@ -30,22 +29,22 @@ def condition(self, passed: bool, message=None): self.failed(message) def failed(self, msg): - """ + ''' Mark eligibility as failed and add a message to `fail_messages` - """ + ''' self.eligible = False self.fail_messages.append(msg) def passed(self, msg): - """ + ''' Add a message to `pass_messages` - """ + ''' self.pass_messages.append(msg) def member_eligibility(self, members, conditions): - """ + ''' Filter out members that do not meet the condition and make eligibility messages - """ + ''' if len(conditions) <= 0: self.eligible_member_count = len(members) return members @@ -61,9 +60,9 @@ def member_eligibility(self, members, conditions): return self.member_eligibility(eligible_members, conditions) def to_dict(self): - """ + ''' Return the eligibility as a dictionary - """ + ''' return { "eligible": self.eligible, "passed": self.pass_messages, @@ -73,10 +72,9 @@ def to_dict(self): class ProgramCalculator: - """ + ''' Base class for all Programs - """ - + ''' dependencies = tuple() amount = 0 @@ -86,20 +84,20 @@ def __init__(self, screen: Screen, program: "Program", data): self.data = data def eligible(self) -> Eligibility: - """ + ''' Returns the `Eligibility` object with whether or not the program is eligible - """ + ''' return Eligibility() def value(self, eligible_members: int): - """ + ''' Return the value of the program - """ + ''' return self.amount @classmethod def can_calc(cls, missing_dependencies: Dependencies): - """ + ''' Returns whether or not the program can be calculated with the missing dependencies - """ + ''' return not missing_dependencies.has(*cls.dependencies) diff --git a/programs/programs/co/__init__.py b/programs/programs/co/__init__.py index 6e1d5b52..ea5aa311 100644 --- a/programs/programs/co/__init__.py +++ b/programs/programs/co/__init__.py @@ -29,31 +29,32 @@ co_calculators: dict[str, type[ProgramCalculator]] = { - "rtdlive": RtdLive, - "cccap": ChildCareAssistance, - "mydenver": MyDenver, - "cocb": CashBack, - "leap": EnergyAssistance, - "erc": EnergyResourceCenter, - "omnisalud": OmniSalud, - "cdhcs": DentalHealthCareSeniors, - "rhc": ReproductiveHealthCare, - "cfhc": ConnectForHealth, - "fps": FamilyPlanningServices, - "dpp": DenverPreschoolProgram, - "ede": EveryDayEats, - "cpcr": PropertyCreditRebate, - "upk": UniversalPreschool, - "myspark": MySpark, - "lwcr": LowWageCovidRelief, - "cwd_medicaid": MedicaidChildWithDisability, - "awd_medicaid": MedicaidAdultWithDisability, - "emergency_medicaid": EmergencyMedicaid, - "bca": BasicCashAssistance, - "cowap": WeatherizationAssistance, - "tabor": Tabor, - "trua": Trua, - "ubp": UtilityBillPay, - "rag": RentalAssistanceGrant, - "erap": EmergencyRentalAssistance, + 'rtdlive': RtdLive, + 'cccap': ChildCareAssistance, + 'mydenver': MyDenver, + 'cocb': CashBack, + 'leap': EnergyAssistance, + 'erc': EnergyResourceCenter, + 'omnisalud': OmniSalud, + 'cdhcs': DentalHealthCareSeniors, + 'rhc': ReproductiveHealthCare, + 'cfhc': ConnectForHealth, + 'fps': FamilyPlanningServices, + 'dpp': DenverPreschoolProgram, + 'ede': EveryDayEats, + 'cpcr': PropertyCreditRebate, + 'upk': UniversalPreschool, + 'myspark': MySpark, + 'lwcr': LowWageCovidRelief, + 'cwd_medicaid': MedicaidChildWithDisability, + 'awd_medicaid': MedicaidAdultWithDisability, + 'emergency_medicaid': EmergencyMedicaid, + 'bca': BasicCashAssistance, + 'cowap': WeatherizationAssistance, + 'tabor': Tabor, + 'trua': Trua, + 'ubp': UtilityBillPay, + 'rag': RentalAssistanceGrant, + 'erap': EmergencyRentalAssistance, } + diff --git a/programs/programs/co/basic_cash_assistance/calculator.py b/programs/programs/co/basic_cash_assistance/calculator.py index 6d8e0710..f86dcf38 100644 --- a/programs/programs/co/basic_cash_assistance/calculator.py +++ b/programs/programs/co/basic_cash_assistance/calculator.py @@ -5,8 +5,8 @@ class BasicCashAssistance(ProgramCalculator): amount = 1_000 - county = "Denver County" - dependencies = ["zipcode", "age"] + county = 'Denver County' + dependencies = ['zipcode', 'age'] def eligible(self) -> Eligibility: e = Eligibility() diff --git a/programs/programs/co/cash_back/calculator.py b/programs/programs/co/cash_back/calculator.py index 7c4fd16c..320321ff 100644 --- a/programs/programs/co/cash_back/calculator.py +++ b/programs/programs/co/cash_back/calculator.py @@ -4,7 +4,7 @@ class CashBack(ProgramCalculator): amount = 750 - dependencies = ["age"] + dependencies = ['age'] def eligible(self) -> Eligibility: e = Eligibility() diff --git a/programs/programs/co/child_care_assistance/calculator.py b/programs/programs/co/child_care_assistance/calculator.py index 991c651c..b5b4f9b6 100644 --- a/programs/programs/co/child_care_assistance/calculator.py +++ b/programs/programs/co/child_care_assistance/calculator.py @@ -6,8 +6,8 @@ class CCCAPCache(GoogleSheetsCache): - sheet_id = "1WzobLnLoxGbN_JfTuw3jUCZV5N7IA_0uvwEkIoMt3Wk" - range_name = "Sheet1!A14:J78" + sheet_id = '1WzobLnLoxGbN_JfTuw3jUCZV5N7IA_0uvwEkIoMt3Wk' + range_name = 'Sheet1!A14:J78' class ChildCareAssistance(ProgramCalculator): @@ -16,7 +16,7 @@ class ChildCareAssistance(ProgramCalculator): max_age_preschool = 4 max_age_afterschool = 13 max_age_afterschool_disabled = 19 - dependencies = ["age", "income_amount", "income_frequency", "zipcode", "household_size"] + dependencies = ['age', 'income_amount', 'income_frequency', 'zipcode', 'household_size'] county_values = CCCAPCache() def eligible(self) -> Eligibility: @@ -34,8 +34,8 @@ def eligible(self) -> Eligibility: e.condition(bool(cccap_county_data), messages.location()) # income - frequency = "yearly" - income_types = ["all"] + frequency = 'yearly' + income_types = ['all'] gross_income = self.screen.calc_gross_income(frequency, income_types) if cccap_county_data: income_limit = cccap_county_data[self.screen.household_size] * 12 @@ -54,11 +54,9 @@ def value(self, eligible_members: int): value += ChildCareAssistance.preschool_value elif household_member.age < ChildCareAssistance.max_age_afterschool: value += ChildCareAssistance.afterschool_value - elif ( - household_member.age >= ChildCareAssistance.max_age_afterschool - and household_member.age <= ChildCareAssistance.max_age_afterschool_disabled - and household_member.has_disability() - ): + elif household_member.age >= ChildCareAssistance.max_age_afterschool and \ + household_member.age <= ChildCareAssistance.max_age_afterschool_disabled and \ + household_member.has_disability(): value += ChildCareAssistance.afterschool_value return value @@ -70,11 +68,9 @@ def _num_cccap_children(self): for household_member in household_members: if household_member.age < ChildCareAssistance.max_age_afterschool: children += 1 - elif ( - household_member.age >= ChildCareAssistance.max_age_afterschool - and household_member.age <= ChildCareAssistance.max_age_afterschool_disabled - and household_member.has_disability() - ): + elif household_member.age >= ChildCareAssistance.max_age_afterschool and \ + household_member.age <= ChildCareAssistance.max_age_afterschool_disabled and \ + household_member.has_disability(): children += 1 return children @@ -84,20 +80,21 @@ def _cccap_county_values(self, county_name): sheet_values = self.county_values.fetch() cccap_county_name = county_name.replace(" County", "") - non_decimal = re.compile(r"[^\d.]+") + non_decimal = re.compile(r'[^\d.]+') for row in sheet_values: if row[0] == cccap_county_name: match = { 1: -1, - 2: float(non_decimal.sub("", row[2])), - 3: float(non_decimal.sub("", row[3])), - 4: float(non_decimal.sub("", row[4])), - 5: float(non_decimal.sub("", row[5])), - 6: float(non_decimal.sub("", row[6])), - 7: float(non_decimal.sub("", row[7])), - 8: float(non_decimal.sub("", row[8])), - 9: float(non_decimal.sub("", row[9])), + 2: float(non_decimal.sub('', row[2])), + 3: float(non_decimal.sub('', row[3])), + 4: float(non_decimal.sub('', row[4])), + 5: float(non_decimal.sub('', row[5])), + 6: float(non_decimal.sub('', row[6])), + 7: float(non_decimal.sub('', row[7])), + 8: float(non_decimal.sub('', row[8])), + 9: float(non_decimal.sub('', row[9])) } return match + diff --git a/programs/programs/co/connect_for_health/calculator.py b/programs/programs/co/connect_for_health/calculator.py index 33cf5c6e..20ffcd89 100644 --- a/programs/programs/co/connect_for_health/calculator.py +++ b/programs/programs/co/connect_for_health/calculator.py @@ -5,18 +5,18 @@ class CFHCache(GoogleSheetsCache): default = {} - sheet_id = "1SuOhwX5psXsipMS_G5DE_f9jLS2qWxf6temxY445EQg" + sheet_id = '1SuOhwX5psXsipMS_G5DE_f9jLS2qWxf6temxY445EQg' range_name = "'2023 report'!A2:B65" def update(self): data = super().update() - return {d[0].strip() + " County": float(d[1].replace(",", "")) for d in data} + return {d[0].strip() + ' County': float(d[1].replace(',', '')) for d in data} class ConnectForHealth(ProgramCalculator): percent_of_fpl = 4 - dependencies = ["insurance", "income_amount", "income_frequency", "county", "household_size"] + dependencies = ['insurance', 'income_amount', 'income_frequency', 'county', 'household_size'] county_values = CFHCache() def eligible(self) -> Eligibility: @@ -25,30 +25,37 @@ def eligible(self) -> Eligibility: # Medicade eligibility is_medicaid_eligible = False for benefit in self.data: - if benefit["name_abbreviated"] == "medicaid": - is_medicaid_eligible = benefit["eligible"] + if benefit['name_abbreviated'] == 'medicaid': + is_medicaid_eligible = benefit['eligible'] break - e.condition(not is_medicaid_eligible, messages.must_not_have_benefit("Medicaid")) + e.condition(not is_medicaid_eligible, messages.must_not_have_benefit('Medicaid')) # Someone has no health insurance - has_no_hi = self.screen.has_insurance_types(("none", "private")) + has_no_hi = self.screen.has_insurance_types(('none', 'private')) e.condition(has_no_hi, messages.has_no_insurance()) # HH member has no va insurance e.member_eligibility( self.screen.household_members.all(), - [(lambda m: not m.insurance.has_insurance_types(("va", "private")), messages.must_not_have_benefit("VA"))], + [ + ( + lambda m: not m.insurance.has_insurance_types(('va', 'private')), + messages.must_not_have_benefit('VA') + ) + ] ) # Income fpl = self.program.fpl.as_dict() income_band = int(fpl[self.screen.household_size] / 12 * ConnectForHealth.percent_of_fpl) - gross_income = int(self.screen.calc_gross_income("yearly", ("all",)) / 12) - e.condition(gross_income < income_band, messages.income(gross_income, income_band)) + gross_income = int(self.screen.calc_gross_income('yearly', ('all',)) / 12) + e.condition(gross_income < income_band, + messages.income(gross_income, income_band)) return e def value(self, eligible_members: int): values = self.county_values.fetch() return values[self.screen.county] * 12 + diff --git a/programs/programs/co/connect_for_health/tests.py b/programs/programs/co/connect_for_health/tests.py index 10d99cb7..c963e90c 100644 --- a/programs/programs/co/connect_for_health/tests.py +++ b/programs/programs/co/connect_for_health/tests.py @@ -7,8 +7,8 @@ class TestConnectForHealth(TestCase): def setUp(self): self.screen1 = Screen.objects.create( agree_to_tos=True, - zipcode="80205", - county="Denver County", + zipcode='80205', + county='Denver County', household_size=1, household_assets=0, has_employer_hi=True, @@ -19,7 +19,7 @@ def setUp(self): ) self.person1 = HouseholdMember.objects.create( screen=self.screen1, - relationship="headOfHousehold", + relationship='headOfHousehold', age=60, student=False, student_full_time=False, @@ -43,7 +43,11 @@ def test_health_insurance_failed_all_conditions(self): self.screen1.has_no_hi = False self.screen1.save() income = IncomeStream.objects.create( - screen=self.screen1, household_member=self.person1, type="wages", amount=5800, frequency="monthly" + screen=self.screen1, + household_member=self.person1, + type='wages', + amount=5800, + frequency='monthly' ) cfhc = ConnectForHealth(self.screen1) diff --git a/programs/programs/co/dental_health_care_seniors/calculator.py b/programs/programs/co/dental_health_care_seniors/calculator.py index d6f26352..f1ce6dfa 100644 --- a/programs/programs/co/dental_health_care_seniors/calculator.py +++ b/programs/programs/co/dental_health_care_seniors/calculator.py @@ -6,7 +6,7 @@ class DentalHealthCareSeniors(ProgramCalculator): amount = 80 min_age = 60 percent_of_fpl = 2.5 - dependencies = ["age", "income_amount", "income_frequency", "insurance", "household_size"] + dependencies = ['age', 'income_amount', 'income_frequency', 'insurance', 'household_size'] def eligible(self) -> Eligibility: e = Eligibility() @@ -14,21 +14,22 @@ def eligible(self) -> Eligibility: self.screen.household_members.all(), [ ( - lambda m: m.insurance.has_insurance_types(("medicaid", "private")), - messages.must_not_have_benefit("Medicaid"), + lambda m: m.insurance.has_insurance_types(('medicaid', 'private')), + messages.must_not_have_benefit('Medicaid') ), ( lambda m: m.age > DentalHealthCareSeniors.min_age, - messages.older_than(DentalHealthCareSeniors.min_age), - ), - ], + messages.older_than(DentalHealthCareSeniors.min_age) + ) + ] ) # Income test fpl = self.program.fpl.as_dict() gross_income = int(self.screen.calc_gross_income("monthly", ["all"])) income_band = int(DentalHealthCareSeniors.percent_of_fpl * fpl[self.screen.household_size] / 12) - e.condition(gross_income <= income_band, messages.income(gross_income, income_band)) + e.condition(gross_income <= income_band, + messages.income(gross_income, income_band)) return e diff --git a/programs/programs/co/dental_health_care_seniors/tests.py b/programs/programs/co/dental_health_care_seniors/tests.py index 44bc1672..d6bd2319 100644 --- a/programs/programs/co/dental_health_care_seniors/tests.py +++ b/programs/programs/co/dental_health_care_seniors/tests.py @@ -7,15 +7,15 @@ class TestDentalHealthCareSeniorsPension(TestCase): def setUp(self): self.screen1 = Screen.objects.create( agree_to_tos=True, - zipcode="80205", - county="Denver County", + zipcode='80205', + county='Denver County', household_size=1, household_assets=0, - has_no_hi=True, + has_no_hi=True ) self.person1 = HouseholdMember.objects.create( screen=self.screen1, - relationship="headOfHousehold", + relationship='headOfHousehold', age=60, student=False, student_full_time=False, @@ -41,7 +41,11 @@ def test_dental_health_care_seniors_failed_all_conditions(self): self.screen1.has_medicaid = True self.screen1.save() IncomeStream.objects.create( - screen=self.screen1, household_member=self.person1, type="wages", amount=3000, frequency="monthly" + screen=self.screen1, + household_member=self.person1, + type='wages', + amount=3000, + frequency='monthly' ) cdhcs = DentalHealthCareSeniors(self.screen1) diff --git a/programs/programs/co/denver_preschool_program/calculator.py b/programs/programs/co/denver_preschool_program/calculator.py index 4fcb9a8e..bc19c482 100644 --- a/programs/programs/co/denver_preschool_program/calculator.py +++ b/programs/programs/co/denver_preschool_program/calculator.py @@ -8,7 +8,7 @@ class DenverPreschoolProgram(ProgramCalculator): min_age = 3 max_age = 4 county = "Denver County" - dependencies = ["age", "zipcode"] + dependencies = ['age', 'zipcode'] def eligible(self) -> Eligibility: e = Eligibility() @@ -18,7 +18,8 @@ def eligible(self) -> Eligibility: age_min=DenverPreschoolProgram.min_age, age_max=DenverPreschoolProgram.max_age ) - e.condition(num_children >= 1, messages.child(DenverPreschoolProgram.min_age, DenverPreschoolProgram.max_age)) + e.condition(num_children >= 1, + messages.child(DenverPreschoolProgram.min_age, DenverPreschoolProgram.max_age)) if self.screen.county is not None: counties = [self.screen.county] @@ -26,6 +27,7 @@ def eligible(self) -> Eligibility: counties = counties_from_zip(self.screen.zipcode) # Lives in Denver - e.condition(DenverPreschoolProgram.county in counties, messages.location()) + e.condition(DenverPreschoolProgram.county in counties, + messages.location()) return e diff --git a/programs/programs/co/denver_preschool_program/tests.py b/programs/programs/co/denver_preschool_program/tests.py index 08ebf51c..916018ab 100644 --- a/programs/programs/co/denver_preschool_program/tests.py +++ b/programs/programs/co/denver_preschool_program/tests.py @@ -6,11 +6,14 @@ class TestDenverPreschoolProgram(TestCase): def setUp(self): self.screen1 = Screen.objects.create( - agree_to_tos=True, zipcode="80205", county="Denver County", household_size=2 + agree_to_tos=True, + zipcode='80205', + county='Denver County', + household_size=2 ) self.person1 = HouseholdMember.objects.create( screen=self.screen1, - relationship="headOfHousehold", + relationship='headOfHousehold', age=30, student=False, student_full_time=False, @@ -25,7 +28,7 @@ def setUp(self): ) self.person2 = HouseholdMember.objects.create( screen=self.screen1, - relationship="child", + relationship='child', age=3, student=False, student_full_time=False, diff --git a/programs/programs/co/emergency_rental_assistance/calculator.py b/programs/programs/co/emergency_rental_assistance/calculator.py index dc79d697..18ccfda9 100644 --- a/programs/programs/co/emergency_rental_assistance/calculator.py +++ b/programs/programs/co/emergency_rental_assistance/calculator.py @@ -6,18 +6,18 @@ class EmergencyRentalAssistanceIncomeLimitsCache(GoogleSheetsCache): default = {} - sheet_id = "1QHb-ZT0Y2oWjFMoeP_wy8ClveslINWdehb-CXhB8WSE" + sheet_id = '1QHb-ZT0Y2oWjFMoeP_wy8ClveslINWdehb-CXhB8WSE' range_name = "'2022 80% AMI'!A2:I" def update(self): data = super().update() - return {d[0].strip() + " County": [int(v.replace(",", "")) for v in d[1:]] for d in data} + return {d[0].strip() + ' County': [int(v.replace(',', '')) for v in d[1:]] for d in data} class EmergencyRentalAssistance(ProgramCalculator): amount = 13_848 - dependencies = ["income_amount", "income_frequency", "household_size", "zipcode"] + dependencies = ['income_amount', 'income_frequency', 'household_size', 'zipcode'] income_cache = EmergencyRentalAssistanceIncomeLimitsCache() def eligible(self) -> Eligibility: @@ -27,10 +27,11 @@ def eligible(self) -> Eligibility: counties = counties_from_zip(self.screen.zipcode) county_name = self.screen.county if self.screen.county is not None else counties[0] - income = self.screen.calc_gross_income("yearly", ["all"]) - income_limits = EmergencyRentalAssistance.income_cache.fetch() + income = self.screen.calc_gross_income('yearly', ['all']) + income_limits = EmergencyRentalAssistance.income_cache.fetch() # NOTE: 80% to income is already applied in the sheet. income_limit = income_limits[county_name][self.screen.household_size - 1] e.condition(income < income_limit, messages.income(income, income_limit)) return e + diff --git a/programs/programs/co/energy_assistance/calculator.py b/programs/programs/co/energy_assistance/calculator.py index e774b3b3..0ade8cce 100644 --- a/programs/programs/co/energy_assistance/calculator.py +++ b/programs/programs/co/energy_assistance/calculator.py @@ -9,10 +9,10 @@ class LeapValueCache(Cache): expire_time = 60 * 60 * 24 default = [] - sheet_id = "1W8WbJsb5Mgb4CUkte2SCuDnqigqkmaO3LC0KSfhEdGg" + sheet_id = '1W8WbJsb5Mgb4CUkte2SCuDnqigqkmaO3LC0KSfhEdGg' range_name = "'FFY 2024'!A1:G65" - county_column = "2023/2024 Season\nUpdated: \n4/30/2024" - average_column = "Average Benefit" + county_column = '2023/2024 Season\nUpdated: \n4/30/2024' + average_column = 'Average Benefit' def update(self): data = GoogleSheets(self.sheet_id, self.range_name).data_by_column(self.county_column, self.average_column) @@ -31,7 +31,7 @@ class EnergyAssistance(ProgramCalculator): 7: 8_001, 8: 8_179, } - dependencies = ["income_frequency", "income_amount", "zipcode", "household_size"] + dependencies = ['income_frequency', 'income_amount', 'zipcode', 'household_size'] county_values = LeapValueCache() def eligible(self) -> Eligibility: @@ -39,11 +39,13 @@ def eligible(self) -> Eligibility: # income frequency = "monthly" - income_types = ["all"] + income_types = ['all'] income_limit = EnergyAssistance.income_bands[self.screen.household_size] leap_income = self.screen.calc_gross_income(frequency, income_types) - e.condition(leap_income < income_limit, messages.income(leap_income, income_limit)) + e.condition( + leap_income < income_limit, messages.income(leap_income, income_limit) + ) return e @@ -58,9 +60,9 @@ def value(self, eligible_members: int): values = [] for row in data: - county = row[0].strip().replace("Application County: ", "") + " County" + county = row[0].strip().replace('Application County: ', '') + ' County' if county in counties: - values.append(int(float(row[1].replace("$", "")))) + values.append(int(float(row[1].replace('$', '')))) value = 362 lowest = math.inf @@ -72,3 +74,4 @@ def value(self, eligible_members: int): lowest = possible_value return value + diff --git a/programs/programs/co/energy_resource_center/calculator.py b/programs/programs/co/energy_resource_center/calculator.py index 89470343..57ad3e14 100644 --- a/programs/programs/co/energy_resource_center/calculator.py +++ b/programs/programs/co/energy_resource_center/calculator.py @@ -4,8 +4,17 @@ class EnergyResourceCenter(ProgramCalculator): amount = 4000 - income_bands = {1: 2880, 2: 3766, 3: 4652, 4: 5539, 5: 6425, 6: 7311, 7: 7477, 8: 7644} - dependencies = ["household_size", "income_amount", "income_frequency"] + income_bands = { + 1: 2880, + 2: 3766, + 3: 4652, + 4: 5539, + 5: 6425, + 6: 7311, + 7: 7477, + 8: 7644 + } + dependencies = ['household_size', 'income_amount', 'income_frequency'] def eligible(self) -> Eligibility: e = Eligibility() @@ -13,6 +22,7 @@ def eligible(self) -> Eligibility: # income gross_income = self.screen.calc_gross_income("monthly", ["all"]) income_band = EnergyResourceCenter.income_bands[self.screen.household_size] - e.condition(gross_income <= income_band, messages.income(gross_income, income_band)) + e.condition(gross_income <= income_band, + messages.income(gross_income, income_band)) return e diff --git a/programs/programs/co/energy_resource_center/tests.py b/programs/programs/co/energy_resource_center/tests.py index 49610c97..3821af10 100644 --- a/programs/programs/co/energy_resource_center/tests.py +++ b/programs/programs/co/energy_resource_center/tests.py @@ -7,14 +7,14 @@ class TestEnergyResourceCenterPension(TestCase): def setUp(self): self.screen1 = Screen.objects.create( agree_to_tos=True, - zipcode="80205", - county="Denver County", + zipcode='80205', + county='Denver County', household_size=1, household_assets=0, ) self.person1 = HouseholdMember.objects.create( screen=self.screen1, - relationship="headOfHousehold", + relationship='headOfHousehold', age=60, student=False, student_full_time=False, @@ -36,9 +36,14 @@ def test_energy_resource_center_visually_impaired_is_eligible(self): def test_energy_resource_center_failed_income_condition(self): income = IncomeStream.objects.create( - screen=self.screen1, household_member=self.person1, type="wages", amount=3000, frequency="monthly" + screen=self.screen1, + household_member=self.person1, + type='wages', + amount=3000, + frequency='monthly' ) erc = EnergyResourceCenter(self.screen1) eligibility = erc.eligibility self.assertFalse(eligibility["eligible"]) + diff --git a/programs/programs/co/every_day_eats/calculator.py b/programs/programs/co/every_day_eats/calculator.py index fec2df6a..4dbc585c 100644 --- a/programs/programs/co/every_day_eats/calculator.py +++ b/programs/programs/co/every_day_eats/calculator.py @@ -6,7 +6,7 @@ class EveryDayEats(ProgramCalculator): amount = 600 min_age = 60 percent_of_fpl = 1.3 - dependencies = ["age", "income_amount", "income_frequency", "household_size"] + dependencies = ['age', 'income_amount', 'income_frequency', 'household_size'] def eligible(self) -> Eligibility: e = Eligibility() @@ -18,7 +18,7 @@ def eligible(self) -> Eligibility: # Income fpl = self.program.fpl.as_dict() income_limit = EveryDayEats.percent_of_fpl * fpl[self.screen.household_size] - gross_income = self.screen.calc_gross_income("yearly", ["all"]) + gross_income = self.screen.calc_gross_income('yearly', ['all']) e.condition(gross_income < income_limit, messages.income(gross_income, income_limit)) diff --git a/programs/programs/co/every_day_eats/tests.py b/programs/programs/co/every_day_eats/tests.py index 03606c18..01fc093f 100644 --- a/programs/programs/co/every_day_eats/tests.py +++ b/programs/programs/co/every_day_eats/tests.py @@ -7,14 +7,14 @@ class TestEveryDayEatsPension(TestCase): def setUp(self): self.screen1 = Screen.objects.create( agree_to_tos=True, - zipcode="80205", - county="Denver County", + zipcode='80205', + county='Denver County', household_size=1, household_assets=0, ) self.person1 = HouseholdMember.objects.create( screen=self.screen1, - relationship="headOfHousehold", + relationship='headOfHousehold', age=60, student=False, student_full_time=False, @@ -36,7 +36,11 @@ def test_every_day_eats_visually_impaired_is_eligible(self): def test_every_day_eats_failed_all_conditions(self): income = IncomeStream.objects.create( - screen=self.screen1, household_member=self.person1, type="wages", amount=3000, frequency="monthly" + screen=self.screen1, + household_member=self.person1, + type='wages', + amount=3000, + frequency='monthly' ) self.person1.age = 30 self.person1.save() diff --git a/programs/programs/co/low_wage_covid_relief/calculator.py b/programs/programs/co/low_wage_covid_relief/calculator.py index 49967572..7938250c 100644 --- a/programs/programs/co/low_wage_covid_relief/calculator.py +++ b/programs/programs/co/low_wage_covid_relief/calculator.py @@ -6,7 +6,7 @@ class LowWageCovidRelief(ProgramCalculator): amount = 1_500 - auto_eligible_benefits = ("medicaid", "tanf", "snap", "wic", "leap") + auto_eligible_benefits = ('medicaid', 'tanf', 'snap', 'wic', 'leap') income_limits = { 1: -math.inf, 2: 3_266.25, @@ -17,8 +17,8 @@ class LowWageCovidRelief(ProgramCalculator): 7: 7_522.50, 8: 8_373.75, } - county = "Adams County" - dependencies = ["zipode", "household_size", "income_amount", "income_frequency"] + county = 'Adams County' + dependencies = ['zipode', 'household_size', 'income_amount', 'income_frequency'] def eligible(self) -> Eligibility: e = Eligibility() @@ -37,13 +37,13 @@ def eligible(self) -> Eligibility: has_benefit = self.screen.has_benefit(benefit) for benefit in self.data: - if benefit["name_abbreviated"] in LowWageCovidRelief.auto_eligible_benefits and benefit["eligible"]: + if benefit['name_abbreviated'] in LowWageCovidRelief.auto_eligible_benefits and benefit['eligible']: has_benefit = True break # meets income limit income_limit = LowWageCovidRelief.income_limits[self.screen.household_size] - income = self.screen.calc_gross_income("monthly", ["all"]) + income = self.screen.calc_gross_income('monthly', ['all']) meets_income_limit = income <= income_limit if not (meets_income_limit or has_benefit): diff --git a/programs/programs/co/medicaid/adult_with_disability/calculator.py b/programs/programs/co/medicaid/adult_with_disability/calculator.py index 06d8db03..6307319b 100644 --- a/programs/programs/co/medicaid/adult_with_disability/calculator.py +++ b/programs/programs/co/medicaid/adult_with_disability/calculator.py @@ -6,48 +6,45 @@ class MedicaidAdultWithDisability(ProgramCalculator): min_age = 16 max_income_percent = 4.5 earned_deduction = 65 - earned_percent = 0.5 + earned_percent = .5 amount = 310 unearned_deduction = 20 min_age = 16 - insurance_types = ("employer", "private", "none") - dependencies = ["insurance", "age", "household_size", "income_type", "income_amount", "income_frequency"] + insurance_types = ('employer', 'private', 'none') + dependencies = ['insurance', 'age', 'household_size', 'income_type', 'income_amount', 'income_frequency'] def eligible(self) -> Eligibility: e = Eligibility() # Does not qualify for Medicaid - is_medicaid_eligible = self.screen.has_insurance_types(("medicaid",)) + is_medicaid_eligible = self.screen.has_insurance_types(('medicaid',)) for benefit in self.data: - if benefit["name_abbreviated"] == "medicaid": + if benefit["name_abbreviated"] == 'medicaid': is_medicaid_eligible = benefit["eligible"] break - e.condition(not is_medicaid_eligible, messages.must_not_have_benefit("Medicaid")) + e.condition(not is_medicaid_eligible, messages.must_not_have_benefit('Medicaid')) def income_eligible(member): fpl = self.program.fpl.as_dict() income_limit = fpl[self.screen.household_size] * MedicaidAdultWithDisability.max_income_percent earned_deduction = MedicaidAdultWithDisability.earned_deduction earned_percent = MedicaidAdultWithDisability.earned_percent - earned = max( - 0, int((int(member.calc_gross_income("yearly", ["earned"])) - earned_deduction) * earned_percent) - ) + earned = max(0, int( + (int(member.calc_gross_income('yearly', ['earned'])) - earned_deduction) * earned_percent + )) unearned_deduction = MedicaidAdultWithDisability.unearned_deduction - unearned = int(member.calc_gross_income("yearly", ["unearned"])) - unearned_deduction + unearned = int(member.calc_gross_income('yearly', ['unearned'])) - unearned_deduction return earned + unearned <= income_limit - e.member_eligibility( - self.screen.household_members.all(), - [ - ( - lambda m: m.age >= MedicaidAdultWithDisability.min_age, - messages.older_than(min_age=MedicaidAdultWithDisability.min_age), - ), - (lambda m: m.long_term_disability or m.visually_impaired, messages.has_disability()), - (lambda m: m.insurance.has_insurance_types(MedicaidAdultWithDisability.insurance_types), None), - (income_eligible, None), - ], - ) + e.member_eligibility(self.screen.household_members.all(), [ + ( + lambda m: m.age >= MedicaidAdultWithDisability.min_age, + messages.older_than(min_age=MedicaidAdultWithDisability.min_age) + ), + (lambda m: m.long_term_disability or m.visually_impaired, messages.has_disability()), + (lambda m: m.insurance.has_insurance_types(MedicaidAdultWithDisability.insurance_types), None), + (income_eligible, None) + ]) return e diff --git a/programs/programs/co/medicaid/child_with_disability/calculator.py b/programs/programs/co/medicaid/child_with_disability/calculator.py index 170c7aef..4a49afb6 100644 --- a/programs/programs/co/medicaid/child_with_disability/calculator.py +++ b/programs/programs/co/medicaid/child_with_disability/calculator.py @@ -6,40 +6,37 @@ class MedicaidChildWithDisability(ProgramCalculator): max_age = 18 max_income_percent = 3 earned_deduction = 90 - income_percent = 1 - 0.33 - insurance_types = ("employer", "private", "none") + income_percent = 1 - .33 + insurance_types = ('employer', 'private', 'none') amount = 200 - dependencies = ["insurance", "age", "household_size", "income_type", "income_amount", "income_frequency"] + dependencies = ['insurance', 'age', 'household_size', 'income_type', 'income_amount', 'income_frequency'] def eligible(self) -> Eligibility: e = Eligibility() # Does not qualify for Medicaid - is_medicaid_eligible = self.screen.has_insurance_types(["medicaid"]) + is_medicaid_eligible = self.screen.has_insurance_types(['medicaid']) for benefit in self.data: - if benefit["name_abbreviated"] == "medicaid": + if benefit["name_abbreviated"] == 'medicaid': is_medicaid_eligible = benefit["eligible"] break - e.condition(not is_medicaid_eligible, messages.must_not_have_benefit("Medicaid")) + e.condition(not is_medicaid_eligible, messages.must_not_have_benefit('Medicaid')) fpl = self.program.fpl.as_dict() income_limit = fpl[self.screen.household_size] * MedicaidChildWithDisability.max_income_percent - earned = max( - 0, int(self.screen.calc_gross_income("yearly", ["earned"]) - MedicaidChildWithDisability.earned_deduction) - ) - unearned = self.screen.calc_gross_income("yearly", ["unearned"]) + earned = max(0, int( + self.screen.calc_gross_income('yearly', ['earned']) - MedicaidChildWithDisability.earned_deduction + )) + unearned = self.screen.calc_gross_income('yearly', ['unearned']) income = (earned + unearned) * MedicaidChildWithDisability.income_percent e.condition(income <= income_limit, messages.income(income, income_limit)) - e.member_eligibility( - self.screen.household_members.all(), - [ - (lambda m: m.age <= MedicaidChildWithDisability.max_age, messages.child()), - (lambda m: m.long_term_disability or m.visually_impaired, messages.has_disability()), - (lambda m: m.insurance.has_insurance_types(MedicaidChildWithDisability.insurance_types), None), - (lambda m: not (m.calc_gross_income("yearly", ["earned"]) >= 0 and m.age >= 16), None), - ], - ) + e.member_eligibility(self.screen.household_members.all(), [ + (lambda m: m.age <= MedicaidChildWithDisability.max_age, messages.child()), + (lambda m: m.long_term_disability or m.visually_impaired, messages.has_disability()), + (lambda m: m.insurance.has_insurance_types(MedicaidChildWithDisability.insurance_types), None), + (lambda m: not (m.calc_gross_income('yearly', ['earned']) >= 0 and m.age >= 16), None), + ]) return e diff --git a/programs/programs/co/medicaid/emergency/calculator.py b/programs/programs/co/medicaid/emergency/calculator.py index 308a16b0..3e0f5f4c 100644 --- a/programs/programs/co/medicaid/emergency/calculator.py +++ b/programs/programs/co/medicaid/emergency/calculator.py @@ -4,7 +4,7 @@ class EmergencyMedicaid(ProgramCalculator): amount = 9_540 - dependencies = ["insurance"] + dependencies = ['insurance'] def eligible(self) -> Eligibility: e = Eligibility() @@ -12,14 +12,19 @@ def eligible(self) -> Eligibility: # Does qualify for Medicaid is_medicaid_eligible = False for benefit in self.data: - if benefit["name_abbreviated"] == "medicaid": + if benefit["name_abbreviated"] == 'medicaid': is_medicaid_eligible = benefit["eligible"] break - e.condition(is_medicaid_eligible, messages.must_have_benefit("Medicaid")) + e.condition(is_medicaid_eligible, messages.must_have_benefit('Medicaid')) e.member_eligibility( self.screen.household_members.all(), - [(lambda m: m.insurance.has_insurance_types(("none",)), messages.has_no_insurance())], + [ + ( + lambda m: m.insurance.has_insurance_types(('none',)), + messages.has_no_insurance() + ) + ] ) return e diff --git a/programs/programs/co/medicaid/family_planning_services/calculator.py b/programs/programs/co/medicaid/family_planning_services/calculator.py index 072d7cc5..68b1fc0f 100644 --- a/programs/programs/co/medicaid/family_planning_services/calculator.py +++ b/programs/programs/co/medicaid/family_planning_services/calculator.py @@ -6,7 +6,7 @@ class FamilyPlanningServices(ProgramCalculator): amount = 404 min_age = 12 fpl_percent = 2.6 - dependencies = ["age", "insurance", "income_frequency", "income_amount", "household_size"] + dependencies = ['age', 'insurance', 'income_frequency', 'income_amount', 'household_size'] def eligible(self) -> Eligibility: e = Eligibility() @@ -14,27 +14,30 @@ def eligible(self) -> Eligibility: # Does not have insurance has_no_insurance = False for member in self.screen.household_members.all(): - has_no_insurance = member.insurance.has_insurance_types(("none",)) or has_no_insurance + has_no_insurance = member.insurance.has_insurance_types(('none',)) or has_no_insurance e.condition(has_no_insurance, messages.has_no_insurance()) # Not Medicaid eligible - is_medicaid_eligible = self.screen.has_benefit("medicaid") + is_medicaid_eligible = self.screen.has_benefit('medicaid') for benefit in self.data: - if benefit["name_abbreviated"] == "medicaid": + if benefit["name_abbreviated"] == 'medicaid': is_medicaid_eligible = benefit["eligible"] or is_medicaid_eligible break - e.condition(not is_medicaid_eligible, messages.must_not_have_benefit("Medicaid")) + e.condition(not is_medicaid_eligible, messages.must_not_have_benefit('Medicaid')) e.member_eligibility( self.screen.household_members.all(), - [(lambda m: not m.pregnant, None), (lambda m: m.age >= FamilyPlanningServices.min_age, None)], + [ + (lambda m: not m.pregnant, None), + (lambda m: m.age >= FamilyPlanningServices.min_age, None) + ] ) # Income fpl = self.program.fpl.as_dict() income_limit = int(FamilyPlanningServices.fpl_percent * fpl[self.screen.household_size]) - gross_income = int(self.screen.calc_gross_income("yearly", ["all"])) + gross_income = int(self.screen.calc_gross_income('yearly', ['all'])) e.condition(gross_income < income_limit, messages.income(gross_income, income_limit)) diff --git a/programs/programs/co/medicaid/family_planning_services/tests.py b/programs/programs/co/medicaid/family_planning_services/tests.py index a9ea43ea..e8b466a4 100644 --- a/programs/programs/co/medicaid/family_planning_services/tests.py +++ b/programs/programs/co/medicaid/family_planning_services/tests.py @@ -7,14 +7,14 @@ class TestFamilyPlanningServicesPension(TestCase): def setUp(self): self.screen1 = Screen.objects.create( agree_to_tos=True, - zipcode="80205", - county="Denver County", + zipcode='80205', + county='Denver County', household_size=2, household_assets=0, ) self.person1 = HouseholdMember.objects.create( screen=self.screen1, - relationship="headOfHousehold", + relationship='headOfHousehold', age=60, student=False, student_full_time=False, @@ -29,7 +29,7 @@ def setUp(self): ) self.person2 = HouseholdMember.objects.create( screen=self.screen1, - relationship="child", + relationship='child', age=10, student=True, student_full_time=False, @@ -44,7 +44,7 @@ def setUp(self): ) def test_family_planning_services_pass_all_conditions(self): - fps = FamilyPlanningServices(self.screen1, [{"name_abbreviated": "medicaid", "eligible": False}]) + fps = FamilyPlanningServices(self.screen1, [{"name_abbreviated": 'medicaid', "eligible": False}]) eligibility = fps.eligibility self.assertTrue(eligibility["eligible"]) @@ -53,10 +53,15 @@ def test_family_planning_services_failed_all_conditions(self): self.person2.age = 20 self.person2.save() IncomeStream.objects.create( - screen=self.screen1, household_member=self.person1, type="wages", amount=4000, frequency="monthly" + screen=self.screen1, + household_member=self.person1, + type='wages', + amount=4000, + frequency='monthly' ) - fps = FamilyPlanningServices(self.screen1, [{"name_abbreviated": "medicaid", "eligible": True}]) + fps = FamilyPlanningServices(self.screen1, + [{"name_abbreviated": 'medicaid', "eligible": True}]) eligibility = fps.eligibility self.assertFalse(eligibility["eligible"]) diff --git a/programs/programs/co/my_spark/calculator.py b/programs/programs/co/my_spark/calculator.py index 9b8bd989..5b0c9204 100644 --- a/programs/programs/co/my_spark/calculator.py +++ b/programs/programs/co/my_spark/calculator.py @@ -7,8 +7,8 @@ class MySpark(ProgramCalculator): amount_per_child = 1_000 max_age = 14 min_age = 11 - county = "Denver County" - dependencies = ["age", "zipcode"] + county = 'Denver County' + dependencies = ['age', 'zipcode'] def eligible(self) -> Eligibility: e = Eligibility() @@ -16,10 +16,10 @@ def eligible(self) -> Eligibility: # Qualify for FRL is_frl_eligible = False for benefit in self.data: - if benefit["name_abbreviated"] == "nslp": + if benefit["name_abbreviated"] == 'nslp': is_frl_eligible = benefit["eligible"] break - e.condition(is_frl_eligible, messages.must_have_benefit("Free or Reduced Lunch")) + e.condition(is_frl_eligible, messages.must_have_benefit('Free or Reduced Lunch')) if self.screen.county is not None: counties = [self.screen.county] @@ -35,9 +35,9 @@ def eligible(self) -> Eligibility: [ ( lambda m: m.age >= MySpark.min_age and m.age <= MySpark.max_age, - messages.child(MySpark.min_age, MySpark.max_age), + messages.child(MySpark.min_age, MySpark.max_age) ) - ], + ] ) return e diff --git a/programs/programs/co/mydenver/calculator.py b/programs/programs/co/mydenver/calculator.py index 7985e7a4..ad87dd15 100644 --- a/programs/programs/co/mydenver/calculator.py +++ b/programs/programs/co/mydenver/calculator.py @@ -4,11 +4,11 @@ class MyDenver(ProgramCalculator): - eligible_counties = ["Denver County"] + eligible_counties = ['Denver County'] child_age_min = 5 child_age_max = 18 - child_relationship = ["child", "fosterChild", "stepChild", "grandChild", "relatedOther", "headOfHousehold"] - dependencies = ["age", "zipcode", "relationship"] + child_relationship = ['child', 'fosterChild', 'stepChild', 'grandChild', 'relatedOther', 'headOfHousehold'] + dependencies = ['age', 'zipcode', 'relationship'] def eligible(self) -> Eligibility: e = Eligibility() @@ -30,7 +30,7 @@ def eligible(self) -> Eligibility: children = self.screen.num_children( age_max=MyDenver.child_age_max, age_min=MyDenver.child_age_min, - child_relationship=MyDenver.child_relationship, + child_relationship=MyDenver.child_relationship ) e.condition(children > 0, messages.child(min_age=5)) @@ -41,7 +41,7 @@ def value(self, eligible_members: int): children = self.screen.num_children( age_max=MyDenver.child_age_max, age_min=MyDenver.child_age_min, - child_relationship=MyDenver.child_relationship, + child_relationship=MyDenver.child_relationship ) return children * 150 diff --git a/programs/programs/co/nfp/calculator.py b/programs/programs/co/nfp/calculator.py index d71adeef..e01a6b21 100644 --- a/programs/programs/co/nfp/calculator.py +++ b/programs/programs/co/nfp/calculator.py @@ -6,13 +6,21 @@ def calculate_nfp(screen, data, program): eligibility = eligibility_nfp(screen, program) value = value_nfp(screen) - calculation = {"eligibility": eligibility, "value": value} + calculation = { + 'eligibility': eligibility, + 'value': value + } return calculation def eligibility_nfp(screen, program): - eligibility = {"eligible": True, "passed": [], "failed": []} + + eligibility = { + "eligible": True, + "passed": [], + "failed": [] + } frequency = "yearly" @@ -28,12 +36,10 @@ def eligibility_nfp(screen, program): eligibility["eligible"] = False eligibility["failed"].append( _("Calculated income of ") - + str(math.trunc(gross_income)) - + _(" for a household with ") + + str(math.trunc(gross_income)) + _(" for a household with ") + str(screen.household_size) + _(" members is above the income limit of ") - + str(income_limit) - ) + + str(income_limit)) else: eligibility["passed"].append( _("Calculated income of ") @@ -41,8 +47,7 @@ def eligibility_nfp(screen, program): + _(" for a household with ") + str(screen.household_size) + _(" members is below the income limit of ") - + str(income_limit) - ) + + str(income_limit)) return eligibility diff --git a/programs/programs/co/omnisalud/calculator.py b/programs/programs/co/omnisalud/calculator.py index b8d22887..d6b5145d 100644 --- a/programs/programs/co/omnisalud/calculator.py +++ b/programs/programs/co/omnisalud/calculator.py @@ -6,7 +6,7 @@ class OmniSalud(ProgramCalculator): individual_limit = 1699 family_4_limit = 3469 amount = 610 - dependencies = ["income_amount", "income_frequency", "household_size", "age", "insurance"] + dependencies = ['income_amount', 'income_frequency', 'household_size', 'age', 'insurance'] def eligible(self) -> Eligibility: e = Eligibility() @@ -17,7 +17,7 @@ def eligible(self) -> Eligibility: e.condition(gross_income <= income_band, messages.income(gross_income, income_band)) # No health insurance - has_no_hi = self.screen.has_insurance_types(("none",)) + has_no_hi = self.screen.has_insurance_types(('none',)) e.condition(has_no_hi, messages.has_no_insurance()) return e diff --git a/programs/programs/co/omnisalud/tests.py b/programs/programs/co/omnisalud/tests.py index 23845a1a..0078afd0 100644 --- a/programs/programs/co/omnisalud/tests.py +++ b/programs/programs/co/omnisalud/tests.py @@ -7,15 +7,15 @@ class TestOmniSaludPension(TestCase): def setUp(self): self.screen1 = Screen.objects.create( agree_to_tos=True, - zipcode="80205", - county="Denver County", + zipcode='80205', + county='Denver County', household_size=1, household_assets=0, - has_no_hi=True, + has_no_hi=True ) self.person1 = HouseholdMember.objects.create( screen=self.screen1, - relationship="headOfHousehold", + relationship='headOfHousehold', age=20, student=False, student_full_time=False, @@ -39,7 +39,11 @@ def test_omnisalud_failed_all_conditions(self): self.screen1.has_no_hi = False self.screen1.save() IncomeStream.objects.create( - screen=self.screen1, household_member=self.person1, type="wages", amount=2000, frequency="monthly" + screen=self.screen1, + household_member=self.person1, + type='wages', + amount=2000, + frequency='monthly' ) omnisalud = OmniSalud(self.screen1) diff --git a/programs/programs/co/pe/__init__.py b/programs/programs/co/pe/__init__.py index a43da0d8..871fc89a 100644 --- a/programs/programs/co/pe/__init__.py +++ b/programs/programs/co/pe/__init__.py @@ -4,18 +4,19 @@ co_member_calculators = { - "co_medicaid": member.CoMedicaid, - "andcs": member.AidToTheNeedyAndDisabled, - "oap": member.OldAgePension, - "chp": member.Chp, + 'co_medicaid': member.CoMedicaid, + 'andcs': member.AidToTheNeedyAndDisabled, + 'oap': member.OldAgePension, + 'chp': member.Chp, } co_tax_unit_calculators = { - "coeitc": tax.Coeitc, - "coctc": tax.Coctc, + 'coeitc': tax.Coeitc, + 'coctc': tax.Coctc, } co_pe_calculators: dict[str, type[PolicyEngineCalulator]] = { **co_member_calculators, **co_tax_unit_calculators, } + diff --git a/programs/programs/co/pe/member.py b/programs/programs/co/pe/member.py index fc8ab608..ecaca3ea 100644 --- a/programs/programs/co/pe/member.py +++ b/programs/programs/co/pe/member.py @@ -10,7 +10,7 @@ class CoMedicaid(Medicaid): class AidToTheNeedyAndDisabled(PolicyEngineMembersCalculator): - pe_name = "co_state_supplement" + pe_name = 'co_state_supplement' pe_inputs = [ dependency.member.SsiCountableResourcesDependency, dependency.member.SsiReportedDependency, @@ -27,7 +27,7 @@ class AidToTheNeedyAndDisabled(PolicyEngineMembersCalculator): class OldAgePension(PolicyEngineMembersCalculator): - pe_name = "co_oap" + pe_name = 'co_oap' pe_inputs = [ dependency.member.SsiCountableResourcesDependency, dependency.member.SsiEarnedIncomeDependency, @@ -41,7 +41,7 @@ class OldAgePension(PolicyEngineMembersCalculator): class Chp(PolicyEngineMembersCalculator): - pe_name = "co_chp" + pe_name = 'co_chp' pe_inputs = [ dependency.member.AgeDependency, dependency.member.PregnancyDependency, @@ -55,7 +55,7 @@ def value(self): total = 0 for _, pvalue in self.get_data().items(): - if pvalue["co_chp_eligible"][self.pe_period] > 0 and self.screen.has_insurance_types(("none",)): + if pvalue['co_chp_eligible'][self.pe_period] > 0 and self.screen.has_insurance_types(('none',)): total += self.amount return total diff --git a/programs/programs/co/pe/tax.py b/programs/programs/co/pe/tax.py index feea9ca4..e260c77a 100644 --- a/programs/programs/co/pe/tax.py +++ b/programs/programs/co/pe/tax.py @@ -4,13 +4,13 @@ class Coeitc(PolicyEngineTaxUnitCalulator): - pe_name = "co_eitc" + pe_name = 'co_eitc' pe_inputs = Eitc.pe_inputs pe_outputs = [dependency.tax.Coeitc] class Coctc(PolicyEngineTaxUnitCalulator): - pe_name = "ctc" + pe_name = 'ctc' pe_inputs = [ dependency.member.AgeDependency, dependency.member.TaxUnitDependentDependency, @@ -20,18 +20,18 @@ class Coctc(PolicyEngineTaxUnitCalulator): pe_outputs = [dependency.tax.Ctc] income_bands = { - "single": [{"max": 25000, "percent": 0.6}, {"max": 50000, "percent": 0.3}, {"max": 75000, "percent": 0.1}], - "maried": [{"max": 35000, "percent": 0.6}, {"max": 60000, "percent": 0.3}, {"max": 85000, "percent": 0.1}], + "single": [{"max": 25000, "percent": .6}, {"max": 50000, "percent": .3}, {"max": 75000, "percent": .1}], + "maried": [{"max": 35000, "percent": .6}, {"max": 60000, "percent": .3}, {"max": 85000, "percent": .1}] } def value(self): - income = self.screen.calc_gross_income("yearly", ["all"]) - relationship_status = "maried" if self.screen.is_joint() else "single" + income = self.screen.calc_gross_income('yearly', ['all']) + relationship_status = 'maried' if self.screen.is_joint() else 'single' multiplier = 0 for band in self.income_bands[relationship_status]: # if the income is less than the band then set the multiplier and break out of the loop - if income <= band["max"]: - multiplier = band["percent"] + if income <= band['max']: + multiplier = band['percent'] break return self.get_data()[self.pe_name][self.pe_period] * multiplier diff --git a/programs/programs/co/property_credit_rebate/calculator.py b/programs/programs/co/property_credit_rebate/calculator.py index 7165047d..274271c3 100644 --- a/programs/programs/co/property_credit_rebate/calculator.py +++ b/programs/programs/co/property_credit_rebate/calculator.py @@ -7,7 +7,7 @@ class PropertyCreditRebate(ProgramCalculator): min_age = 65 disabled_min_age = 18 income_limit = {"single": 18_026, "married": 23_345} - dependencies = ["age", "income_frequency", "income_amount", "relationship"] + dependencies = ['age', 'income_frequency', 'income_amount', 'relationship'] def eligible(self) -> Eligibility: e = Eligibility() @@ -22,20 +22,20 @@ def eligible(self) -> Eligibility: # Someone is old enough someone_old_enough = self.screen.num_adults(age_max=PropertyCreditRebate.min_age) >= 1 - e.condition(someone_disabled or someone_old_enough, messages.has_disability()) + e.condition(someone_disabled or someone_old_enough, + messages.has_disability()) - e.condition(someone_disabled or someone_old_enough, messages.older_than(PropertyCreditRebate.min_age)) + e.condition(someone_disabled or someone_old_enough, + messages.older_than(PropertyCreditRebate.min_age)) # Income test - relationship_status = "single" + relationship_status = 'single' for member_id, married_to in self.screen.relationship_map().items(): if married_to is not None: - relationship_status = "married" + relationship_status = 'married' - gross_income = self.screen.calc_gross_income("yearly", ["all"]) - e.condition( - gross_income <= PropertyCreditRebate.income_limit[relationship_status], - messages.income(gross_income, PropertyCreditRebate.income_limit[relationship_status]), - ) + gross_income = self.screen.calc_gross_income('yearly', ['all']) + e.condition(gross_income <= PropertyCreditRebate.income_limit[relationship_status], + messages.income(gross_income, PropertyCreditRebate.income_limit[relationship_status])) return e diff --git a/programs/programs/co/property_credit_rebate/tests.py b/programs/programs/co/property_credit_rebate/tests.py index 3cb476ab..849bbfea 100644 --- a/programs/programs/co/property_credit_rebate/tests.py +++ b/programs/programs/co/property_credit_rebate/tests.py @@ -7,16 +7,16 @@ class TestPropertyCreditRebatePension(TestCase): def setUp(self): self.screen1 = Screen.objects.create( agree_to_tos=True, - zipcode="80205", - county="Denver County", + zipcode='80205', + county='Denver County', household_size=2, household_assets=0, has_tanf=False, - has_ssi=False, + has_ssi=False ) self.person1 = HouseholdMember.objects.create( screen=self.screen1, - relationship="headOfHousehold", + relationship='headOfHousehold', age=65, student=False, student_full_time=False, @@ -45,8 +45,12 @@ def test_property_credit_rebate_failed_all_conditions(self): self.person1.disabled = False self.person1.save() income = IncomeStream.objects.create( - screen=self.screen1, household_member=self.person1, type="wages", amount=2000, frequency="monthly" - ) + screen=self.screen1, + household_member=self.person1, + type='wages', + amount=2000, + frequency='monthly' + ) cpcr = PropertyCreditRebate(self.screen1) eligibility = cpcr.eligibility diff --git a/programs/programs/co/rental_assistance_grant/calculator.py b/programs/programs/co/rental_assistance_grant/calculator.py index a0fd0af3..20e7c02f 100644 --- a/programs/programs/co/rental_assistance_grant/calculator.py +++ b/programs/programs/co/rental_assistance_grant/calculator.py @@ -6,18 +6,18 @@ class RAGCache(GoogleSheetsCache): default = {} - sheet_id = "1DntpIXZfUY2yTy1_rAhaGLUH4PUAfpTSAn-j2tf2tts" + sheet_id = '1DntpIXZfUY2yTy1_rAhaGLUH4PUAfpTSAn-j2tf2tts' range_name = "'2023 80% AMI'!A2:I65" def update(self): data = super().update() - return {d[0].strip() + " County": [int(v.replace(",", "")) for v in d[1:]] for d in data} + return {d[0].strip() + ' County': [int(v.replace(',', '')) for v in d[1:]] for d in data} class RentalAssistanceGrant(ProgramCalculator): amount = 10_000 - dependencies = ["income_amount", "income_frequency", "household_size", "zipcode"] + dependencies = ['income_amount', 'income_frequency', 'household_size', 'zipcode'] income_limits = RAGCache() def eligible(self) -> Eligibility: @@ -28,7 +28,7 @@ def eligible(self) -> Eligibility: county_name = self.screen.county if self.screen.county is not None else counties[0] # income - gross_income = int(self.screen.calc_gross_income("yearly", ["all"])) + gross_income = int(self.screen.calc_gross_income('yearly', ['all'])) limits = self.income_limits.fetch() @@ -40,3 +40,4 @@ def eligible(self) -> Eligibility: e.condition(gross_income <= income_limit, messages.income(gross_income, income_limit)) return e + diff --git a/programs/programs/co/reproductive_health_care/calculator.py b/programs/programs/co/reproductive_health_care/calculator.py index dd498460..54debbd8 100644 --- a/programs/programs/co/reproductive_health_care/calculator.py +++ b/programs/programs/co/reproductive_health_care/calculator.py @@ -4,19 +4,19 @@ class ReproductiveHealthCare(ProgramCalculator): amount = 268 - dependencies = ["insurance"] + dependencies = ['insurance'] def eligible(self) -> Eligibility: e = Eligibility() # No health insurance - has_no_hi = self.screen.has_insurance_types(("none",)) + has_no_hi = self.screen.has_insurance_types(('none',)) e.condition(has_no_hi, messages.has_no_insurance()) # Medicade eligibility is_medicaid_eligible = False for benefit in self.data: - if benefit["name_abbreviated"] == "medicaid": + if benefit["name_abbreviated"] == 'medicaid': is_medicaid_eligible = benefit["eligible"] break diff --git a/programs/programs/co/reproductive_health_care/tests.py b/programs/programs/co/reproductive_health_care/tests.py index 76ee25a5..10fd1ad3 100644 --- a/programs/programs/co/reproductive_health_care/tests.py +++ b/programs/programs/co/reproductive_health_care/tests.py @@ -30,7 +30,9 @@ def setUp(self): ) def test_reproductive_health_care_pass_all_conditions(self): - rhc = ReproductiveHealthCare(self.screen1, [{"name_abbreviated": "medicaid", "eligible": True}]) + rhc = ReproductiveHealthCare( + self.screen1, [{"name_abbreviated": "medicaid", "eligible": True}] + ) eligibility = rhc.eligibility self.assertTrue(eligibility["eligible"]) @@ -39,7 +41,9 @@ def test_reproductive_health_care_failed_all_conditions(self): self.person1.has_no_hi = False self.person1.save() - rhc = ReproductiveHealthCare(self.screen1, [{"name_abbreviated": "medicaid", "eligible": False}]) + rhc = ReproductiveHealthCare( + self.screen1, [{"name_abbreviated": "medicaid", "eligible": False}] + ) eligibility = rhc.eligibility self.assertFalse(eligibility["eligible"]) diff --git a/programs/programs/co/rtdlive/calculator.py b/programs/programs/co/rtdlive/calculator.py index 025c2512..2772afcb 100644 --- a/programs/programs/co/rtdlive/calculator.py +++ b/programs/programs/co/rtdlive/calculator.py @@ -6,19 +6,19 @@ class RtdLive(ProgramCalculator): eligible_counties = [ - "Adams County", - "Arapahoe County", - "Boulder County", - "Broomfield County", - "Denver County", - "Douglas County", - "Jefferson County", + 'Adams County', + 'Arapahoe County', + 'Boulder County', + 'Broomfield County', + 'Denver County', + 'Douglas County', + 'Jefferson County' ] min_age = 20 max_age = 64 percent_of_fpl = 2.5 amount = 732 - dependencies = ["age", "income_amount", "income_frequency", "zipcode", "household_size"] + dependencies = ['age', 'income_amount', 'income_frequency', 'zipcode', 'household_size'] def eligible(self) -> Eligibility: e = Eligibility() @@ -29,7 +29,7 @@ def eligible(self) -> Eligibility: # income frequency = "yearly" - income_types = ["all"] + income_types = ['all'] fpl = self.program.fpl.as_dict() income_limit = RtdLive.percent_of_fpl * fpl[len(members)] @@ -47,7 +47,7 @@ def eligible(self) -> Eligibility: lambda m: m.age >= RtdLive.min_age and m.age <= RtdLive.max_age, messages.adult(RtdLive.min_age, RtdLive.max_age), ), - ], + ] ) # geography diff --git a/programs/programs/co/tabor/calculator.py b/programs/programs/co/tabor/calculator.py index ea1e4006..fbacb075 100644 --- a/programs/programs/co/tabor/calculator.py +++ b/programs/programs/co/tabor/calculator.py @@ -5,14 +5,16 @@ class Tabor(ProgramCalculator): min_age = 18 amount = 800 - dependencies = ["age"] + dependencies = ['age'] def eligible(self) -> Eligibility: e = Eligibility() e.member_eligibility( self.screen.household_members.all(), - [(lambda m: m.age >= Tabor.min_age, messages.older_than(Tabor.min_age))], + [ + (lambda m: m.age >= Tabor.min_age, messages.older_than(Tabor.min_age)) + ] ) return e diff --git a/programs/programs/co/trua/calculator.py b/programs/programs/co/trua/calculator.py index 396dbfcf..33057c53 100644 --- a/programs/programs/co/trua/calculator.py +++ b/programs/programs/co/trua/calculator.py @@ -15,16 +15,16 @@ class Trua(ProgramCalculator): 8: 124_950, } - county = "Denver County" + county = 'Denver County' amount = 6_500 - dependencies = ["income_amount", "income_frequency", "household_size", "zipcode"] + dependencies = ['income_amount', 'income_frequency', 'household_size', 'zipcode'] def eligible(self) -> Eligibility: e = Eligibility() # Income test gross_income = int(self.screen.calc_gross_income("monthly", ["all"])) - income_limit = int(Trua.income_limit[self.screen.household_size] / 12) + income_limit = int(Trua.income_limit[self.screen.household_size]/12) # Location test zipcode = self.screen.zipcode diff --git a/programs/programs/co/universal_preschool/calculator.py b/programs/programs/co/universal_preschool/calculator.py index 5e1241a6..0916f97e 100644 --- a/programs/programs/co/universal_preschool/calculator.py +++ b/programs/programs/co/universal_preschool/calculator.py @@ -6,8 +6,12 @@ class UniversalPreschool(ProgramCalculator): qualifying_age = 3 age = 4 percent_of_fpl = 2.7 - amount = {"10_hours": 4_837, "15_hours": 6_044, "30_hours": 10_655} - dependencies = ["age", "income_amount", "income_frequency", "relationship", "household_size"] + amount = { + '10_hours': 4_837, + '15_hours': 6_044, + '30_hours': 10_655 + } + dependencies = ['age', 'income_amount', 'income_frequency', 'relationship', 'household_size'] def eligible(self) -> Eligibility: e = Eligibility() @@ -15,7 +19,7 @@ def eligible(self) -> Eligibility: foster_children = self.screen.num_children( age_min=UniversalPreschool.qualifying_age, age_max=UniversalPreschool.age, - child_relationship=["fosterChild"], + child_relationship=['fosterChild'] ) income_requirement = self._meets_income_requirement() @@ -24,14 +28,15 @@ def eligible(self) -> Eligibility: # Has child children = self.screen.num_children(age_min=UniversalPreschool.age, age_max=UniversalPreschool.age) qualifying_children = self.screen.num_children( - age_min=UniversalPreschool.qualifying_age, age_max=UniversalPreschool.age + age_min=UniversalPreschool.qualifying_age, + age_max=UniversalPreschool.age ) min_age = UniversalPreschool.qualifying_age if other_factors else UniversalPreschool.age e.condition( children >= 1 or (qualifying_children >= 1 and other_factors), - messages.child(min_age, UniversalPreschool.age), + messages.child(min_age, UniversalPreschool.age) ) return e @@ -43,17 +48,17 @@ def value(self, eligible_members: int): for child in self.screen.household_members.filter( age__range=(UniversalPreschool.qualifying_age, UniversalPreschool.age) ): - if child.relationship == "fosterChild" or income_requirement: + if child.relationship == 'fosterChild' or income_requirement: if child.age == 3: - value += UniversalPreschool.amount["10_hours"] + value += UniversalPreschool.amount['10_hours'] else: - value += UniversalPreschool.amount["30_hours"] + value += UniversalPreschool.amount['30_hours'] else: - value += UniversalPreschool.amount["15_hours"] + value += UniversalPreschool.amount['15_hours'] return value def _meets_income_requirement(self): fpl = self.program.fpl.as_dict() income_limit = int(UniversalPreschool.percent_of_fpl * fpl[self.screen.household_size]) - return self.screen.calc_gross_income("yearly", ["all"]) < income_limit + return self.screen.calc_gross_income('yearly', ['all']) < income_limit diff --git a/programs/programs/co/utility_bill_pay/calculator.py b/programs/programs/co/utility_bill_pay/calculator.py index f47b513c..e93169bd 100644 --- a/programs/programs/co/utility_bill_pay/calculator.py +++ b/programs/programs/co/utility_bill_pay/calculator.py @@ -13,9 +13,9 @@ class UtilityBillPay(ProgramCalculator): 96_014, 101_120, ) - presumptive_eligibility = ("snap", "ssi", "andcs", "tanf", "wic") + presumptive_eligibility = ('snap', 'ssi', 'andcs', 'tanf', 'wic') amount = 350 - dependencies = ["household_size", "income_amount", "income_frequency"] + dependencies = ['household_size', 'income_amount', 'income_frequency'] def eligible(self) -> Eligibility: e = Eligibility() @@ -27,7 +27,7 @@ def eligible(self) -> Eligibility: presumptive_eligible = True # income - income = int(self.screen.calc_gross_income("yearly", ["all"])) + income = int(self.screen.calc_gross_income('yearly', ['all'])) income_limit = UtilityBillPay.income_limits[self.screen.household_size - 1] e.condition(income < income_limit or presumptive_eligible, messages.income(income, income_limit)) diff --git a/programs/programs/co/weatherization_assistance/calculator.py b/programs/programs/co/weatherization_assistance/calculator.py index 2f8190dc..596d2b48 100644 --- a/programs/programs/co/weatherization_assistance/calculator.py +++ b/programs/programs/co/weatherization_assistance/calculator.py @@ -13,16 +13,16 @@ class WeatherizationAssistance(ProgramCalculator): 96_014, 101_120, ) - presumptive_eligibility = ("andcs", "ssi", "snap", "leap", "tanf") + presumptive_eligibility = ('andcs', 'ssi', 'snap', 'leap', 'tanf') amount = 350 - dependencies = ["household_size", "income_amount", "income_frequency"] + dependencies = ['household_size', 'income_amount', 'income_frequency'] def eligible(self) -> Eligibility: e = Eligibility() # income condition income_limit = WeatherizationAssistance.income_limits[self.screen.household_size - 1] - income = int(self.screen.calc_gross_income("yearly", ["all"])) + income = int(self.screen.calc_gross_income('yearly', ['all'])) income_eligible = income <= income_limit # categorical eligibility diff --git a/programs/programs/federal/__init__.py b/programs/programs/federal/__init__.py index 60fd00ab..b8f23164 100644 --- a/programs/programs/federal/__init__.py +++ b/programs/programs/federal/__init__.py @@ -4,7 +4,7 @@ from ..calc import ProgramCalculator federal_calculators: dict[str, type[ProgramCalculator]] = { - "ssdi": Ssdi, - "chs": HeadStart, - "medicare_savings": MedicareSavings, + 'ssdi': Ssdi, + 'chs': HeadStart, + 'medicare_savings': MedicareSavings, } diff --git a/programs/programs/federal/head_start/calculator.py b/programs/programs/federal/head_start/calculator.py index d9f5dec9..2e343d80 100644 --- a/programs/programs/federal/head_start/calculator.py +++ b/programs/programs/federal/head_start/calculator.py @@ -8,9 +8,9 @@ class HeadStart(ProgramCalculator): amount = 10655 max_age = 5 min_age = 3 - adams_percent_of_fpl = 1.3 # Adams County uses 130% FPL instead of 100% FPL - adams_county = "Adams County" - dependencies = ["age", "household_size", "income_frequency", "income_amount", "zipcode"] + adams_percent_of_fpl = 1.3 # Adams County uses 130% FPL instead of 100% FPL + adams_county = 'Adams County' + dependencies = ['age', 'household_size', 'income_frequency', 'income_amount', 'zipcode'] def eligible(self) -> Eligibility: e = Eligibility() @@ -33,19 +33,17 @@ def eligible(self) -> Eligibility: break e.condition(in_eligible_county, messages.location()) - + in_adams = HeadStart.adams_county in counties # income fpl = self.program.fpl.as_dict() income_limit = int(fpl[self.screen.household_size] / 12) income_limit_adams_county = int(fpl[self.screen.household_size] / 12 * HeadStart.adams_percent_of_fpl) - gross_income = int(self.screen.calc_gross_income("monthly", ["all"])) + gross_income = int(self.screen.calc_gross_income('monthly', ['all'])) if in_adams: - e.condition( - gross_income < income_limit_adams_county, messages.income(gross_income, income_limit_adams_county) - ) + e.condition(gross_income < income_limit_adams_county, messages.income(gross_income, income_limit_adams_county)) else: e.condition(gross_income < income_limit, messages.income(gross_income, income_limit)) diff --git a/programs/programs/federal/head_start/eligible_zipcodes.py b/programs/programs/federal/head_start/eligible_zipcodes.py index d24b33c5..1b643547 100644 --- a/programs/programs/federal/head_start/eligible_zipcodes.py +++ b/programs/programs/federal/head_start/eligible_zipcodes.py @@ -1,40 +1,40 @@ eligible_zipcode = [ - "Adams County", - "Alamosa County", - "Arapahoe County", - "Archuleta County", - "Bent County", - "Boulder County", - "Chaffee County", - "Conejos County", - "Costilla County", - "Delta County", - "Denver County", - "Eagle County", - "El Paso County", - "Fremont County", - "Garfield County", - "Huerfano County", - "Jefferson County", - "La Plata County", - "Lake County", - "Larimer County", - "Las Animas County", - "Lincoln County", - "Logan County", - "Mesa County", - "Moffat County", - "Montezuma County", - "Montrose County", - "Morgan County", - "Otero County", - "Prowers County", - "Pueblo County", - "Rio Grande County", - "Saguache County", - "Summit County", - "Teller County", - "Washington County", - "Weld County", - "Yuma County", + 'Adams County', + 'Alamosa County', + 'Arapahoe County', + 'Archuleta County', + 'Bent County', + 'Boulder County', + 'Chaffee County', + 'Conejos County', + 'Costilla County', + 'Delta County', + 'Denver County', + 'Eagle County', + 'El Paso County', + 'Fremont County', + 'Garfield County', + 'Huerfano County', + 'Jefferson County', + 'La Plata County', + 'Lake County', + 'Larimer County', + 'Las Animas County', + 'Lincoln County', + 'Logan County', + 'Mesa County', + 'Moffat County', + 'Montezuma County', + 'Montrose County', + 'Morgan County', + 'Otero County', + 'Prowers County', + 'Pueblo County', + 'Rio Grande County', + 'Saguache County', + 'Summit County', + 'Teller County', + 'Washington County', + 'Weld County', + 'Yuma County', ] diff --git a/programs/programs/federal/head_start/tests.py b/programs/programs/federal/head_start/tests.py index 0e8ce00b..89c7866c 100644 --- a/programs/programs/federal/head_start/tests.py +++ b/programs/programs/federal/head_start/tests.py @@ -7,14 +7,14 @@ class TestHeadStartPension(TestCase): def setUp(self): self.screen1 = Screen.objects.create( agree_to_tos=True, - zipcode="80205", - county="Denver County", + zipcode='80205', + county='Denver County', household_size=2, household_assets=0, ) self.person1 = HouseholdMember.objects.create( screen=self.screen1, - relationship="headOfHousehold", + relationship='headOfHousehold', age=30, student=False, student_full_time=False, @@ -29,7 +29,7 @@ def setUp(self): ) self.person2 = HouseholdMember.objects.create( screen=self.screen1, - relationship="child", + relationship='child', age=4, student=False, student_full_time=False, @@ -51,13 +51,17 @@ def test_head_start_visually_impaired_is_eligible(self): def test_head_start_failed_all_conditions(self): income = IncomeStream.objects.create( - screen=self.screen1, household_member=self.person1, type="wages", amount=2000, frequency="monthly" + screen=self.screen1, + household_member=self.person1, + type='wages', + amount=2000, + frequency='monthly' ) self.screen1.save() - self.person2.age = 6 + self.person2.age=6 self.person2.save() chs = HeadStart(self.screen1) eligibility = chs.eligibility - self.assertFalse(eligibility["eligible"]) + self.assertFalse(eligibility["eligible"]) \ No newline at end of file diff --git a/programs/programs/federal/medicare_savings/calculator.py b/programs/programs/federal/medicare_savings/calculator.py index b3ef1177..0803e45f 100644 --- a/programs/programs/federal/medicare_savings/calculator.py +++ b/programs/programs/federal/medicare_savings/calculator.py @@ -3,18 +3,18 @@ class MedicareSavings(ProgramCalculator): - valid_insurance = ("none", "employer", "private", "medicare") + valid_insurance = ('none', 'employer', 'private', 'medicare') asset_limit = { - "single": 10_930, - "married": 17_130, + 'single': 10_930, + 'married': 17_130, } income_limit = { - "single": 1_715, - "married": 2_320, + 'single': 1_715, + 'married': 2_320, } min_age = 65 amount = 175 - dependencies = ["household_assets", "relationship", "income_frequency", "income_amount", "age"] + dependencies = ['household_assets', 'relationship', 'income_frequency', 'income_amount', 'age'] def eligible(self) -> Eligibility: e = Eligibility() @@ -22,19 +22,19 @@ def eligible(self) -> Eligibility: members = self.screen.household_members.all() def asset_limit(member): - status = "married" if member.is_married()["is_married"] else "single" + status = 'married' if member.is_married()['is_married'] else 'single' return self.screen.household_assets < MedicareSavings.asset_limit[status] def income_limit(member): is_married = member.is_married() - if not is_married["is_married"]: - status = "single" + if not is_married['is_married']: + status = 'single' spouse_income = 0 else: - status = "married" - spouse_income = is_married["married_to"].calc_gross_income("monthly", ("all",)) + status = 'married' + spouse_income = is_married['married_to'].calc_gross_income('monthly', ('all',)) max_income = MedicareSavings.income_limit[status] - income = member.calc_gross_income("monthly", ("all",)) + spouse_income + income = member.calc_gross_income('monthly', ('all',)) + spouse_income return income < max_income e.member_eligibility( @@ -43,11 +43,11 @@ def income_limit(member): (lambda m: m.age >= MedicareSavings.min_age, messages.older_than(MedicareSavings.min_age)), ( lambda m: m.insurance.has_insurance_types(MedicareSavings.valid_insurance), - messages.has_no_insurance(), + messages.has_no_insurance() ), (asset_limit, None), - (income_limit, None), - ], + (income_limit, None) + ] ) return e diff --git a/programs/programs/federal/pe/__init__.py b/programs/programs/federal/pe/__init__.py index bafc4afa..5416e2db 100644 --- a/programs/programs/federal/pe/__init__.py +++ b/programs/programs/federal/pe/__init__.py @@ -5,22 +5,22 @@ federal_member_calculators = { - "wic": member.Wic, - "pell_grant": member.PellGrant, - "ssi": member.Ssi, + 'wic': member.Wic, + 'pell_grant': member.PellGrant, + 'ssi': member.Ssi, } federal_spm_unit_calculators = { - "acp": spm.Acp, - "lifeline": spm.Lifeline, - "nslp": spm.SchoolLunch, - "snap": spm.Snap, - "tanf": spm.Tanf, + 'acp': spm.Acp, + 'lifeline': spm.Lifeline, + 'nslp': spm.SchoolLunch, + 'snap': spm.Snap, + 'tanf': spm.Tanf, } federal_tax_unit_calculators = { - "eitc": tax.Eitc, - "ctc": tax.Ctc, + 'eitc': tax.Eitc, + 'ctc': tax.Ctc, } federal_pe_calculators: dict[str, type[PolicyEngineCalulator]] = { @@ -28,3 +28,4 @@ **federal_spm_unit_calculators, **federal_tax_unit_calculators, } + diff --git a/programs/programs/federal/pe/member.py b/programs/programs/federal/pe/member.py index f335600a..09bc929c 100644 --- a/programs/programs/federal/pe/member.py +++ b/programs/programs/federal/pe/member.py @@ -4,14 +4,14 @@ class Wic(PolicyEngineMembersCalculator): wic_categories = { - "NONE": 0, - "INFANT": 130, - "CHILD": 74, + 'NONE': 0, + 'INFANT': 130, + 'CHILD': 74, "PREGNANT": 100, "POSTPARTUM": 100, "BREASTFEEDING": 100, } - pe_name = "wic" + pe_name = 'wic' pe_inputs = [ dependency.member.PregnancyDependency, dependency.member.AgeDependency, @@ -24,13 +24,13 @@ def value(self): for _, pvalue in self.get_data().items(): if pvalue[self.pe_name][self.pe_period] > 0: - total += self.wic_categories[pvalue["wic_category"][self.pe_period]] * 12 + total += self.wic_categories[pvalue['wic_category'][self.pe_period]] * 12 return total class Medicaid(PolicyEngineMembersCalculator): - pe_name = "medicaid" + pe_name = 'medicaid' pe_inputs = [ dependency.member.AgeDependency, dependency.member.PregnancyDependency, @@ -70,25 +70,23 @@ def value(self): if pvalue[self.pe_name][self.pe_period] <= 0: continue - total += self._value_by_age(pvalue["age"][self.pe_period]) + total += self._value_by_age(pvalue['age'][self.pe_period]) in_wic_demographic = False for member in self.screen.household_members.all(): if member.pregnant is True or member.age <= 5: in_wic_demographic = True if total == 0 and in_wic_demographic: - if ( - self.screen.has_benefit("medicaid") is True - or self.screen.has_benefit("tanf") is True - or self.screen.has_benefit("snap") is True - ): + if self.screen.has_benefit('medicaid') is True \ + or self.screen.has_benefit('tanf') is True \ + or self.screen.has_benefit('snap') is True: total = self.presumptive_amount return total class PellGrant(PolicyEngineMembersCalculator): - pe_name = "pell_grant" + pe_name = 'pell_grant' pe_inputs = [ dependency.member.PellGrantDependentAvailableIncomeDependency, dependency.member.PellGrantCountableAssetsDependency, @@ -104,7 +102,7 @@ class PellGrant(PolicyEngineMembersCalculator): class Ssi(PolicyEngineMembersCalculator): - pe_name = "ssi" + pe_name = 'ssi' pe_inputs = [ dependency.member.SsiCountableResourcesDependency, dependency.member.SsiReportedDependency, @@ -118,3 +116,4 @@ class Ssi(PolicyEngineMembersCalculator): dependency.member.TaxUnitDependentDependency, ] pe_outputs = [dependency.member.Ssi] + diff --git a/programs/programs/federal/pe/spm.py b/programs/programs/federal/pe/spm.py index 152e7657..ec430ff7 100644 --- a/programs/programs/federal/pe/spm.py +++ b/programs/programs/federal/pe/spm.py @@ -4,7 +4,7 @@ class Snap(PolicyEngineSpmCalulator): - pe_name = "snap" + pe_name = 'snap' pe_inputs = [ dependency.spm.SnapChildSupportDeductionDependency, dependency.spm.SnapGrossIncomeDependency, @@ -29,7 +29,7 @@ def value(self): class SchoolLunch(PolicyEngineSpmCalulator): - pe_name = "school_meal_daily_subsidy" + pe_name = 'school_meal_daily_subsidy' pe_inputs = dependency.school_lunch_income pe_outputs = [dependency.spm.SchoolMealDailySubsidy, dependency.spm.SchoolMealTier] @@ -40,14 +40,14 @@ def value(self): num_children = self.screen.num_children(3, 18) if self.get_data()[self.pe_name][self.pe_period] > 0 and num_children > 0: - if self.get_data()["school_meal_tier"][self.pe_period] != "PAID": + if self.get_data()['school_meal_tier'][self.pe_period] != 'PAID': total = SchoolLunch.amount * num_children return total class Tanf(PolicyEngineSpmCalulator): - pe_name = "co_tanf" + pe_name = 'co_tanf' pe_inputs = [ dependency.member.AgeDependency, dependency.member.PregnancyDependency, @@ -59,7 +59,7 @@ class Tanf(PolicyEngineSpmCalulator): class Acp(PolicyEngineSpmCalulator): - pe_name = "acp" + pe_name = 'acp' pe_inputs = [ dependency.spm.BroadbandCostDependency, *dependency.irs_gross_income, @@ -68,7 +68,7 @@ class Acp(PolicyEngineSpmCalulator): class Lifeline(PolicyEngineSpmCalulator): - pe_name = "lifeline" + pe_name = 'lifeline' pe_inputs = [ dependency.spm.BroadbandCostDependency, *dependency.irs_gross_income, diff --git a/programs/programs/federal/pe/tax.py b/programs/programs/federal/pe/tax.py index ceb6673e..b7e63e8c 100644 --- a/programs/programs/federal/pe/tax.py +++ b/programs/programs/federal/pe/tax.py @@ -3,7 +3,7 @@ class Eitc(PolicyEngineTaxUnitCalulator): - pe_name = "eitc" + pe_name = 'eitc' pe_inputs = [ dependency.member.AgeDependency, dependency.member.TaxUnitSpouseDependency, @@ -13,8 +13,9 @@ class Eitc(PolicyEngineTaxUnitCalulator): pe_outputs = [dependency.tax.Eitc] + class Ctc(PolicyEngineTaxUnitCalulator): - pe_name = "ctc" + pe_name = 'ctc' pe_inputs = [ dependency.member.AgeDependency, dependency.member.TaxUnitDependentDependency, @@ -22,3 +23,5 @@ class Ctc(PolicyEngineTaxUnitCalulator): *dependency.irs_gross_income, ] pe_outputs = [dependency.tax.Ctc] + + diff --git a/programs/programs/federal/ssdi/calculator.py b/programs/programs/federal/ssdi/calculator.py index b7472fb0..031e742f 100644 --- a/programs/programs/federal/ssdi/calculator.py +++ b/programs/programs/federal/ssdi/calculator.py @@ -7,7 +7,7 @@ class Ssdi(ProgramCalculator): income_limit = 1_550 income_limit_blind = 2_590 amount = 1_537 - dependencies = ["income_amount", "income_frequency", "household_size"] + dependencies = ['income_amount', 'income_frequency', 'household_size'] def eligible(self) -> Eligibility: e = Eligibility() @@ -20,7 +20,7 @@ def income_condition(member): nonlocal cat_eligibile income_limit = Ssdi.income_limit_blind if member.visually_impaired else Ssdi.income_limit - member_income = member.calc_gross_income("monthly", ("all",)) + member_income = member.calc_gross_income('monthly', ('all',)) if member_income < lowest_income: lowest_income = member_income @@ -30,7 +30,10 @@ def income_condition(member): e.member_eligibility( self.screen.household_members.all(), - [(lambda m: m.has_disability(), messages.has_disability()), (income_condition, None)], + [ + (lambda m: m.has_disability(), messages.has_disability()), + (income_condition, None) + ] ) if cat_eligibile > 0: diff --git a/programs/programs/messages.py b/programs/programs/messages.py index 0ab02d29..49f18f07 100644 --- a/programs/programs/messages.py +++ b/programs/programs/messages.py @@ -1,98 +1,118 @@ def translation(name, i, message): - return {"default_message": message, "label": f"eligibility_message.{name}-{i}"} + return { + 'default_message': message, + 'label': f'eligibility_message.{name}-{i}' + } def income(income, max_income): - """ + ''' Household makes ${income} per year which must be less than ${max_income} - """ + ''' return ( - translation("income", 0, "Household makes"), - f" ${round(income)} ", - translation("income", 1, "per year which must be less than"), - f" ${round(max_income)}", + translation('income', 0, 'Household makes'), + f' ${round(income)} ', + translation('income', 1, 'per year which must be less than'), + f' ${round(max_income)}' ) def assets(asset_limit): - """ + ''' Household resources must not exceed ${asset_limit} - """ - return (translation("assets", 0, "Household resources must not exceed"), f" ${round(asset_limit)}") + ''' + return ( + translation('assets', 0, 'Household resources must not exceed'), + f' ${round(asset_limit)}' + ) def child(min_age=0, max_age=18): - """ + ''' Must have a child between the ages of {min_age} and {max_age} - """ + ''' return ( - translation("child", 0, "Must have a child between the ages of"), - f" {min_age} ", - translation("child", 1, "and"), - f" {max_age}", + translation('child', 0, 'Must have a child between the ages of'), + f' {min_age} ', + translation('child', 1, 'and'), + f' {max_age}' ) def adult(min_age, max_age): - """ + ''' Someone in the household must be between the ages of {min_age} and {max_age} - """ + ''' return ( - translation("adult", 0, "Someone in the household must be between the ages of"), - f" {min_age} ", - translation("adult", 1, "and"), - f" {max_age}", + translation('adult', 0, 'Someone in the household must be between the ages of'), + f' {min_age} ', + translation('adult', 1, 'and'), + f' {max_age}' ) def older_than(min_age): - """ + ''' Someone in the household must be at least {min_age} years old - """ + ''' return ( - translation("older_than", 0, "Someone in the household must be at least"), - f" {min_age} ", - translation("older_than", 1, "years old"), + translation('older_than', 0, 'Someone in the household must be at least'), + f' {min_age} ', + translation('older_than', 1, 'years old') ) def must_have_benefit(benefit_name): - """ + ''' Household must have {benefit_name} - """ - return (translation("has_benefit", 0, "Household must have"), f" {benefit_name}") + ''' + return ( + translation('has_benefit', 0, 'Household must have'), + f' {benefit_name}' + ) def must_not_have_benefit(benefit_name): - """ + ''' Household must not have {benefit_name} - """ - return (translation("not_have_benefit", 0, "Household must not have"), f" {benefit_name}") + ''' + return ( + translation('not_have_benefit', 0, 'Household must not have'), + f' {benefit_name}' + ) def location(): - """ + ''' Must live in an eligible location - """ - return (translation("location", 0, "Must live in an eligible location"),) + ''' + return ( + translation('location', 0, 'Must live in an eligible location'), + ) def has_disability(): - """ + ''' Someone in the household must have a disability - """ - return (translation("disability", 0, "Someone in the household must have a disability"),) + ''' + return ( + translation('disability', 0, 'Someone in the household must have a disability'), + ) def has_no_insurance(): - """ + ''' Someone in the household must not have health insurance - """ - return (translation("no_insurance", 0, "Someone in the household must not have health insurance"),) + ''' + return ( + translation('no_insurance', 0, 'Someone in the household must not have health insurance'), + ) def is_pregnant(): - """ + ''' Someone in the household must be pregnant - """ - return (translation("pregnant", 0, "Someone in the household must be pregnant"),) + ''' + return ( + translation('pregnant', 0, 'Someone in the household must be pregnant'), + ) diff --git a/programs/programs/nc/pe/__init__.py b/programs/programs/nc/pe/__init__.py index 9a7fb52d..9d323c10 100644 --- a/programs/programs/nc/pe/__init__.py +++ b/programs/programs/nc/pe/__init__.py @@ -3,10 +3,11 @@ nc_member_calculators = { - "nc_medicaid": member.NcMedicaid, + 'nc_medicaid': member.NcMedicaid, } nc_pe_calculators: dict[str, type[PolicyEngineCalulator]] = { **nc_member_calculators, } + diff --git a/programs/programs/nc/pe/member.py b/programs/programs/nc/pe/member.py index 3c2d7c23..2db5e5e2 100644 --- a/programs/programs/nc/pe/member.py +++ b/programs/programs/nc/pe/member.py @@ -2,11 +2,12 @@ class NcMedicaid(Medicaid): - child_medicaid_average = 200 * 12 # TODO: NC specific average goes here - adult_medicaid_average = 310 * 12 # TODO: NC specific average goes here - aged_medicaid_average = 170 * 12 # TODO: NC specific average goes here + child_medicaid_average = 200 * 12 # TODO: NC specific average goes here + adult_medicaid_average = 310 * 12 # TODO: NC specific average goes here + aged_medicaid_average = 170 * 12 # TODO: NC specific average goes here # NOTE: You can also overide the methods on the parent Medicaid class # def value(self): # ... # return 500 + diff --git a/programs/programs/policyengine/calculators/__init__.py b/programs/programs/policyengine/calculators/__init__.py index 7adce32a..6ecf236c 100644 --- a/programs/programs/policyengine/calculators/__init__.py +++ b/programs/programs/policyengine/calculators/__init__.py @@ -1,16 +1,7 @@ -from programs.programs.federal.pe import ( - federal_member_calculators, - federal_spm_unit_calculators, - federal_tax_unit_calculators, -) +from programs.programs.federal.pe import federal_member_calculators, federal_spm_unit_calculators, federal_tax_unit_calculators from programs.programs.co.pe import co_member_calculators, co_tax_unit_calculators from programs.programs.nc.pe import nc_member_calculators -from .base import ( - PolicyEngineMembersCalculator, - PolicyEngineSpmCalulator, - PolicyEngineTaxUnitCalulator, - PolicyEngineCalulator, -) +from .base import PolicyEngineMembersCalculator, PolicyEngineSpmCalulator, PolicyEngineTaxUnitCalulator, PolicyEngineCalulator all_member_calculators: dict[str, type[PolicyEngineMembersCalculator]] = { @@ -35,3 +26,4 @@ } all_pe_programs = all_calculators.keys() + diff --git a/programs/programs/policyengine/calculators/base.py b/programs/programs/policyengine/calculators/base.py index e838ff07..fa95cb3c 100644 --- a/programs/programs/policyengine/calculators/base.py +++ b/programs/programs/policyengine/calculators/base.py @@ -7,16 +7,16 @@ class PolicyEngineCalulator(ProgramCalculator): - """ + ''' Base class for all Policy Engine programs - """ + ''' pe_inputs: List[type[PolicyEngineScreenInput]] = [] pe_outputs: List[type[PolicyEngineScreenInput]] = [] - pe_name = "" - pe_category = "" - pe_sub_category = "" + pe_name = '' + pe_category = '' + pe_sub_category = '' pe_period = YEAR def __init__(self, screen: Screen, pe_data): @@ -34,9 +34,9 @@ def value(self): return self.get_data()[self.pe_name][self.pe_period] def get_data(self): - """ + ''' Return Policy Engine dictionary of the program category and subcategory - """ + ''' return self.pe_data[self.pe_category][self.pe_sub_category] @classmethod @@ -47,21 +47,18 @@ def can_calc(cls, missing_dependencies: Dependencies): return True - class PolicyEngineTaxUnitCalulator(PolicyEngineCalulator): - pe_category = "tax_units" - pe_sub_category = "tax_unit" + pe_category = 'tax_units' + pe_sub_category = 'tax_unit' pe_period = PREVIOUS_YEAR - class PolicyEngineSpmCalulator(PolicyEngineCalulator): - pe_category = "spm_units" - pe_sub_category = "spm_unit" - + pe_category = 'spm_units' + pe_sub_category = 'spm_unit' class PolicyEngineMembersCalculator(PolicyEngineCalulator): tax_dependent = True - pe_category = "people" + pe_category = 'people' def value(self): total = 0 @@ -78,7 +75,8 @@ def value(self): return total def in_tax_unit(self, member_id) -> bool: - return str(member_id) in self.pe_data["tax_units"]["tax_unit"]["members"] + return str(member_id) in self.pe_data['tax_units']['tax_unit']['members'] def get_data(self): return self.pe_data[self.pe_category] + diff --git a/programs/programs/policyengine/calculators/constants.py b/programs/programs/policyengine/calculators/constants.py index 11af220f..2143bb25 100644 --- a/programs/programs/policyengine/calculators/constants.py +++ b/programs/programs/policyengine/calculators/constants.py @@ -2,6 +2,6 @@ # Medicaid # CHP+ -YEAR = "2024" -PREVIOUS_YEAR = "2023" -SNAP_PERIOD = "2024-01" +YEAR = '2024' +PREVIOUS_YEAR = '2023' +SNAP_PERIOD = '2024-01' diff --git a/programs/programs/policyengine/calculators/dependencies/base.py b/programs/programs/policyengine/calculators/dependencies/base.py index 03a962e2..11f9cd56 100644 --- a/programs/programs/policyengine/calculators/dependencies/base.py +++ b/programs/programs/policyengine/calculators/dependencies/base.py @@ -3,14 +3,14 @@ class PolicyEngineScreenInput: - """ + ''' Base class for all Policy Engine dependencies - """ + ''' member = False - unit = "" - sub_unit = "" - field = "" + unit = '' + sub_unit = '' + field = '' dependencies = tuple() def __init__(self, screen: Screen, members: List[HouseholdMember], relationship_map): @@ -19,36 +19,36 @@ def __init__(self, screen: Screen, members: List[HouseholdMember], relationship_ self.relationship_map = relationship_map def value(self): - """ + ''' Return the value to send to Policy Engine - """ + ''' return None class TaxUnit(PolicyEngineScreenInput): - """ + ''' Base class for all tax unit Policy Engine dependencies - """ + ''' - unit = "tax_units" - sub_unit = "tax_unit" + unit = 'tax_units' + sub_unit = 'tax_unit' class SpmUnit(PolicyEngineScreenInput): - """ + ''' Base class for all spm unit Policy Engine dependencies - """ + ''' - unit = "spm_units" - sub_unit = "spm_unit" + unit = 'spm_units' + sub_unit = 'spm_unit' class Member(PolicyEngineScreenInput): - """ + ''' Base class for all member unit Policy Engine dependencies - """ + ''' - unit = "people" + unit = 'people' member = True def __init__(self, screen: Screen, member: HouseholdMember, relationship_map): @@ -61,9 +61,9 @@ def value(self): class DependencyError(Exception): - """ + ''' Dependency conflict error - """ + ''' def __init__(self, field, value_1, value_2) -> None: - super().__init__(f"Confilcting Policy Engine Dependencies in {field}: {value_1} and {value_2}") + super().__init__(f'Confilcting Policy Engine Dependencies in {field}: {value_1} and {value_2}') diff --git a/programs/programs/policyengine/calculators/dependencies/member.py b/programs/programs/policyengine/calculators/dependencies/member.py index bc5e1d28..273e8263 100644 --- a/programs/programs/policyengine/calculators/dependencies/member.py +++ b/programs/programs/policyengine/calculators/dependencies/member.py @@ -2,50 +2,50 @@ class AgeDependency(Member): - field = "age" - dependencies = ("age",) + field = 'age' + dependencies = ('age',) def value(self): return self.member.age class PregnancyDependency(Member): - field = "is_pregnant" + field = 'is_pregnant' def value(self): return self.member.pregnant or False class FullTimeCollegeStudentDependency(Member): - field = "is_full_time_college_student" + field = 'is_full_time_college_student' def value(self): return self.member.student or False class TaxUnitHeadDependency(Member): - field = "is_tax_unit_head" - dependencies = ("relationship",) + field = 'is_tax_unit_head' + dependencies = ('relationship',) def value(self): return self.member.is_head() class TaxUnitSpouseDependency(Member): - field = "is_tax_unit_spouse" - dependencies = ("relationship",) + field = 'is_tax_unit_spouse' + dependencies = ('relationship',) def value(self): return self.member.is_spouse() class TaxUnitDependentDependency(Member): - field = "is_tax_unit_dependent" + field = 'is_tax_unit_dependent' dependencies = ( - "relationship", - "age", - "income_amount", - "income_frequency", + 'relationship', + 'age', + 'income_amount', + 'income_frequency', ) def value(self): @@ -53,37 +53,37 @@ def value(self): class WicCategory(Member): - field = "wic_category" + field = 'wic_category' class Wic(Member): - field = "wic" + field = 'wic' class Medicaid(Member): - field = "medicaid" + field = 'medicaid' class Ssi(Member): - field = "ssi" + field = 'ssi' class IsDisabledDependency(Member): - field = "is_disabled" + field = 'is_disabled' def value(self): return self.member.disabled or self.member.long_term_disability class IsBlindDependency(Member): - field = "is_blind" + field = 'is_blind' def value(self): return self.member.visually_impaired class SsiReportedDependency(Member): - field = "ssi_reported" + field = 'ssi_reported' def value(self): # Policy Eninge uses this value for is_ssi_disabled, but it does not apply to MFB @@ -91,10 +91,10 @@ def value(self): class SsiCountableResourcesDependency(Member): - field = "ssi_countable_resources" + field = 'ssi_countable_resources' dependencies = ( - "household_assets", - "age", + 'household_assets', + 'age', ) def value(self): @@ -106,102 +106,102 @@ def value(self): class SsiAmountIfEligible(Member): - field = "ssi_amount_if_eligible" + field = 'ssi_amount_if_eligible' class Andcs(Member): - field = "co_state_supplement" + field = 'co_state_supplement' class Oap(Member): - field = "co_oap" + field = 'co_oap' class PellGrant(Member): - field = "pell_grant" + field = 'pell_grant' class PellGrantDependentAvailableIncomeDependency(Member): - field = "pell_grant_dependent_available_income" + field = 'pell_grant_dependent_available_income' dependencies = ( - "income_type", - "income_amount", - "income_frequency", + 'income_type', + 'income_amount', + 'income_frequency', ) def value(self): - return int(self.member.calc_gross_income("yearly", ["all"])) + return int(self.member.calc_gross_income('yearly', ['all'])) class PellGrantCountableAssetsDependency(Member): - field = "pell_grant_countable_assets" - dependencies = ("household_assets",) + field = 'pell_grant_countable_assets' + dependencies = ('household_assets',) def value(self): return int(self.screen.household_assets) class CostOfAttendingCollegeDependency(Member): - field = "cost_of_attending_college" - dependencies = ("age",) + field = 'cost_of_attending_college' + dependencies = ('age',) def value(self): return 22_288 * (self.member.age >= 16 and self.member.student) class PellGrantMonthsInSchoolDependency(Member): - field = "pell_grant_months_in_school" + field = 'pell_grant_months_in_school' def value(self): return 9 class ChpEligible(Member): - field = "co_chp_eligible" + field = 'co_chp_eligible' class IncomeDependency(Member): dependencies = ( - "income_type", - "income_amount", - "income_frequency", + 'income_type', + 'income_amount', + 'income_frequency', ) income_types = [] def value(self): - return int(self.member.calc_gross_income("yearly", self.income_types)) + return int(self.member.calc_gross_income('yearly', self.income_types)) class EmploymentIncomeDependency(IncomeDependency): - field = "employment_income" - income_types = ["wages"] + field = 'employment_income' + income_types = ['wages'] class SelfEmploymentIncomeDependency(IncomeDependency): - field = "self_employment_income" - income_types = ["selfEmployment"] + field = 'self_employment_income' + income_types = ['selfEmployment'] class RentalIncomeDependency(IncomeDependency): - field = "rental_income" - income_types = ["rental"] + field = 'rental_income' + income_types = ['rental'] class PensionIncomeDependency(IncomeDependency): - field = "taxable_pension_income" - income_types = ["pension", "veteran"] + field = 'taxable_pension_income' + income_types = ['pension', 'veteran'] class SocialSecurityIncomeDependency(IncomeDependency): - field = "social_security" - income_types = ["sSDisability", "sSSurvivor", "sSRetirement", "sSDependent"] + field = 'social_security' + income_types = ['sSDisability', 'sSSurvivor', 'sSRetirement', 'sSDependent'] class SsiEarnedIncomeDependency(IncomeDependency): - field = "ssi_earned_income" - income_types = ["earned"] + field = 'ssi_earned_income' + income_types = ['earned'] class SsiUnearnedIncomeDependency(IncomeDependency): - field = "ssi_unearned_income" - income_types = ["unearned"] + field = 'ssi_unearned_income' + income_types = ['unearned'] diff --git a/programs/programs/policyengine/calculators/dependencies/spm.py b/programs/programs/policyengine/calculators/dependencies/spm.py index fa59adcd..ec142e8e 100644 --- a/programs/programs/policyengine/calculators/dependencies/spm.py +++ b/programs/programs/policyengine/calculators/dependencies/spm.py @@ -3,40 +3,40 @@ class SnapChildSupportDeductionDependency(SpmUnit): - field = "snap_child_support_deduction" + field = 'snap_child_support_deduction' def value(self): - return self.screen.calc_expenses("yearly", ["childSupport"]) + return self.screen.calc_expenses('yearly', ['childSupport']) class SnapDependentCareDeductionDependency(SpmUnit): - field = "childcare_expenses" + field = 'childcare_expenses' def value(self): - return self.screen.calc_expenses("yearly", ["childCare"]) + return self.screen.calc_expenses('yearly', ['childCare']) class SnapEarnedIncomeDependency(SpmUnit): - field = "snap_earned_income" + field = 'snap_earned_income' dependencies = ( - "income_type", - "income_amount", - "income_frequency", + 'income_type', + 'income_amount', + 'income_frequency', ) def value(self): - return self.screen.calc_gross_income("yearly", ["earned"]) + return self.screen.calc_gross_income('yearly', ['earned']) class HousingCostDependency(SpmUnit): - field = "housing_cost" + field = 'housing_cost' def value(self): - return int(self.screen.calc_expenses("yearly", ["rent", "mortgage"])) + return int(self.screen.calc_expenses('yearly', ['rent', 'mortgage'])) class SnapAssetsDependency(SpmUnit): - field = "snap_assets" + field = 'snap_assets' def value(self): assets = self.screen.household_assets or 0 @@ -44,145 +44,149 @@ def value(self): class SnapGrossIncomeDependency(SpmUnit): - field = "snap_gross_income" + field = 'snap_gross_income' dependencies = ( - "income_amount", - "income_frequency", + 'income_amount', + 'income_frequency', ) def value(self): - return int(self.screen.calc_gross_income("yearly", ["all"])) + return int(self.screen.calc_gross_income('yearly', ['all'])) class MeetsSnapGrossIncomeTestDependency(SpmUnit): - field = "meets_snap_gross_income_test" + field = 'meets_snap_gross_income_test' dependencies = ( - "income_amount", - "income_frequency", - "household_size", + 'income_amount', + 'income_frequency', + 'household_size', ) def value(self): - fpl = FederalPoveryLimit.objects.get(year="THIS YEAR").as_dict() - snap_gross_income = self.screen.calc_gross_income("yearly", ["all"]) + fpl = FederalPoveryLimit.objects.get(year='THIS YEAR').as_dict() + snap_gross_income = self.screen.calc_gross_income('yearly', ['all']) snap_gross_limit = 2 * fpl[self.screen.household_size] return snap_gross_income < snap_gross_limit class MeetsSnapAssetTestDependency(SpmUnit): - field = "meets_snap_asset_test" + field = 'meets_snap_asset_test' def value(self): return True class MeetsSnapCategoricalEligibilityDependency(SpmUnit): - field = "meets_snap_categorical_eligibility" + field = 'meets_snap_categorical_eligibility' def value(self): return False class HasHeatingCoolingExpenseDependency(SpmUnit): - field = "has_heating_cooling_expense" + field = 'has_heating_cooling_expense' def value(self): - return self.screen.has_expense(["heating", "cooling"]) + return self.screen.has_expense(['heating', 'cooling']) class HasPhoneExpenseDependency(SpmUnit): - field = "has_phone_expense" + field = 'has_phone_expense' def value(self): - return self.screen.has_expense(["telephone"]) + return self.screen.has_expense(['telephone']) class UtilityExpenseDependency(SpmUnit): - field = "utility_expense" + field = 'utility_expense' def value(self): - return int(self.screen.calc_expenses("yearly", ["otherUtilities", "heating", "cooling"])) + return int( + self.screen.calc_expenses( + 'yearly', ['otherUtilities', 'heating', 'cooling'] + ) + ) class HeatingCoolingExpenseDependency(SpmUnit): - field = "heating_cooling_expense" + field = 'heating_cooling_expense' def value(self): - return self.screen.calc_expenses("yearly", ["heating", "cooling"]) + return self.screen.calc_expenses('yearly', ['heating', 'cooling']) class PhoneExpenseDependency(SpmUnit): - field = "phone_expense" + field = 'phone_expense' def value(self): - return self.screen.calc_expenses("yearly", ["telephone"]) + return self.screen.calc_expenses('yearly', ['telephone']) class ElectricityExpenseDependency(SpmUnit): - field = "electricity_expense" + field = 'electricity_expense' def value(self): - return self.screen.calc_expenses("yearly", ["otherUtilities"]) + return self.screen.calc_expenses('yearly', ['otherUtilities']) class SnapEmergencyAllotmentDependency(SpmUnit): - field = "snap_emergency_allotment" + field = 'snap_emergency_allotment' def value(self): return 0 class Snap(SpmUnit): - field = "snap" + field = 'snap' class Acp(SpmUnit): - field = "acp" + field = 'acp' class SchoolMealDailySubsidy(SpmUnit): - field = "school_meal_daily_subsidy" + field = 'school_meal_daily_subsidy' class SchoolMealTier(SpmUnit): - field = "school_meal_tier" + field = 'school_meal_tier' class Lifeline(SpmUnit): - field = "lifeline" + field = 'lifeline' class TanfCountableGrossIncomeDependency(SpmUnit): - field = "co_tanf_countable_gross_earned_income" + field = 'co_tanf_countable_gross_earned_income' dependencies = ( - "income_type", - "income_amount", - "income_frequency", + 'income_type', + 'income_amount', + 'income_frequency', ) def value(self): - return int(self.screen.calc_gross_income("yearly", ["earned"])) + return int(self.screen.calc_gross_income('yearly', ['earned'])) class TanfCountableGrossUnearnedIncomeDependency(SpmUnit): - field = "co_tanf_countable_gross_unearned_income" + field = 'co_tanf_countable_gross_unearned_income' dependencies = ( - "income_type", - "income_amount", - "income_frequency", + 'income_type', + 'income_amount', + 'income_frequency', ) def value(self): - return int(self.screen.calc_gross_income("yearly", ["unearned"])) + return int(self.screen.calc_gross_income('yearly', ['unearned'])) class Tanf(SpmUnit): - field = "co_tanf" + field = 'co_tanf' class BroadbandCostDependency(SpmUnit): - field = "broadband_cost" + field = 'broadband_cost' def value(self): return 500 diff --git a/programs/programs/policyengine/calculators/dependencies/tax.py b/programs/programs/policyengine/calculators/dependencies/tax.py index 76007591..95edfce6 100644 --- a/programs/programs/policyengine/calculators/dependencies/tax.py +++ b/programs/programs/policyengine/calculators/dependencies/tax.py @@ -3,26 +3,26 @@ class Eitc(TaxUnit): - field = "eitc" + field = 'eitc' class Coeitc(TaxUnit): - field = "co_eitc" + field = 'co_eitc' class Ctc(TaxUnit): - field = "ctc" + field = 'ctc' class JointDependency(TaxUnit): - field = "tax_unit_is_joint" + field = 'tax_unit_is_joint' def value(self): return self.screen.is_joint() class PellGrantPrimaryIncomeDependency(TaxUnit): - field = "pell_grant_primary_income" + field = 'pell_grant_primary_income' def value(self): total = 0 @@ -30,14 +30,14 @@ def value(self): is_head = TaxUnitHeadDependency(self.screen, member, self.relationship_map).value() is_spouse = TaxUnitSpouseDependency(self.screen, member, self.relationship_map).value() if is_head or is_spouse: - total += int(member.calc_gross_income("yearly", ["all"])) + total += int(member.calc_gross_income('yearly', ['all'])) return total class PellGrantDependentsInCollegeDependency(TaxUnit): - field = "pell_grant_dependents_in_college" - dependencies = ("student",) + field = 'pell_grant_dependents_in_college' + dependencies = ('student',) def value(self): pell_grant_dependents_in_college = 0 diff --git a/programs/programs/policyengine/policy_engine.py b/programs/programs/policyengine/policy_engine.py index 4cee4f27..a724abf2 100644 --- a/programs/programs/policyengine/policy_engine.py +++ b/programs/programs/policyengine/policy_engine.py @@ -25,7 +25,7 @@ def calc_pe_eligibility(screen: Screen, missing_fields: Dependencies) -> dict[st if len(valid_programs.values()) == 0 or len(screen.household_members.all()) == 0: return {} - data = policy_engine_calculate(pe_input(screen, valid_programs.values()))["result"] + data = policy_engine_calculate(pe_input(screen, valid_programs.values()))['result'] all_eligibility: dict[str, Eligibility] = {} for name_abbr, Calculator in valid_programs.items(): @@ -40,15 +40,18 @@ def calc_pe_eligibility(screen: Screen, missing_fields: Dependencies) -> dict[st def policy_engine_calculate(data): - response = requests.post("https://api.policyengine.org/us/calculate", json=data) + response = requests.post( + "https://api.policyengine.org/us/calculate", + json=data + ) data = response.json() return data def pe_input(screen: Screen, programs: List[type[PolicyEngineCalulator]]): - """ + ''' Generate Policy Engine API request from the list of programs. - """ + ''' raw_input = { "household": { "people": {}, @@ -57,14 +60,23 @@ def pe_input(screen: Screen, programs: List[type[PolicyEngineCalulator]]): "members": [], } }, - "families": {"family": {"members": []}}, - "households": {"household": {"state_code_str": {YEAR: "CO", PREVIOUS_YEAR: "CO"}, "members": []}}, + "families": { + "family": { + "members": [] + } + }, + "households": { + "household": { + "state_code_str": {YEAR: "CO", PREVIOUS_YEAR: "CO"}, + "members": [] + } + }, "spm_units": { "spm_unit": { "members": [], } }, - "marital_units": {}, + "marital_units": {} } } members = screen.household_members.all() @@ -72,19 +84,19 @@ def pe_input(screen: Screen, programs: List[type[PolicyEngineCalulator]]): for member in members: member_id = str(member.id) - household = raw_input["household"] + household = raw_input['household'] - household["families"]["family"]["members"].append(member_id) - household["households"]["household"]["members"].append(member_id) - household["spm_units"]["spm_unit"]["members"].append(member_id) - household["people"][member_id] = {} + household['families']['family']['members'].append(member_id) + household['households']['household']['members'].append(member_id) + household['spm_units']['spm_unit']['members'].append(member_id) + household['people'][member_id] = {} is_tax_unit_head = TaxUnitHeadDependency(screen, member, relationship_map).value() is_tax_unit_spouse = TaxUnitSpouseDependency(screen, member, relationship_map).value() is_tax_unit_dependent = TaxUnitDependentDependency(screen, member, relationship_map).value() if is_tax_unit_head or is_tax_unit_spouse or is_tax_unit_dependent: - household["tax_units"]["tax_unit"]["members"].append(member_id) + household['tax_units']['tax_unit']['members'].append(member_id) already_added = set() for member_1, member_2 in relationship_map.items(): @@ -92,14 +104,14 @@ def pe_input(screen: Screen, programs: List[type[PolicyEngineCalulator]]): continue marital_unit = (str(member_1), str(member_2)) - raw_input["household"]["marital_units"]["-".join(marital_unit)] = {"members": marital_unit} + raw_input['household']['marital_units']['-'.join(marital_unit)] = {'members': marital_unit} already_added.add(member_1) already_added.add(member_2) for Program in programs: for Data in Program.pe_inputs + Program.pe_outputs: period = Program.pe_period - if hasattr(Program, "pe_output_period") and Data in Program.pe_outputs: + if hasattr(Program, 'pe_output_period') and Data in Program.pe_outputs: period = Program.pe_output_period if not Data.member: diff --git a/programs/programs/urgent_needs/urgent_need_functions.py b/programs/programs/urgent_needs/urgent_need_functions.py index 9f5ebce4..0cd44e0a 100644 --- a/programs/programs/urgent_needs/urgent_need_functions.py +++ b/programs/programs/urgent_needs/urgent_need_functions.py @@ -5,17 +5,17 @@ class UrgentNeedFunction: - """ + ''' Base class for all urgent need conditions - """ + ''' dependencies = [] @classmethod def calc(cls, screen: Screen, missing_dependencies: Dependencies): - """ + ''' Calculate if the urgent need can be calculated and if the condition is met - """ + ''' if not cls.can_calc(missing_dependencies): return False @@ -23,16 +23,16 @@ def calc(cls, screen: Screen, missing_dependencies: Dependencies): @classmethod def eligible(cls, screen: Screen): - """ + ''' Returns if the condition is met - """ + ''' return True @classmethod def can_calc(cls, missing_dependencies: Dependencies): - """ + ''' Returns if the condition can be calculated - """ + ''' if missing_dependencies.has(*cls.dependencies): return False @@ -40,97 +40,97 @@ def can_calc(cls, missing_dependencies: Dependencies): class LivesInDenver(UrgentNeedFunction): - dependencies = ["county"] + dependencies = ['county'] @classmethod def eligible(cls, screen: Screen): - """ + ''' Household lives in the Denver County - """ - return screen.county == "Denver County" + ''' + return screen.county == 'Denver County' class MealInCounties(UrgentNeedFunction): - dependencies = ["county"] + dependencies = ['county'] @classmethod def eligible(cls, screen: Screen): - """ + ''' Household lives in Denver or Jefferson County - """ - eligible_counties = ["Denver County", "Jefferson County"] + ''' + eligible_counties = ['Denver County', 'Jefferson County'] return screen.county in eligible_counties class HelpkitchenZipcode(UrgentNeedFunction): - dependencies = ["zipcode"] + dependencies = ['zipcode'] @classmethod def eligible(cls, screen: Screen): - """ + ''' Lives in a zipcode that is eligible for HelpKitchen - """ + ''' zipcodes = [ - "80010", - "80011", - "80012", - "80013", - "80014", - "80015", - "80016", - "80017", - "80018", - "80019", - "80045", - "80102", - "80112", - "80137", - "80138", - "80230", - "80231", - "80238", - "80247", - "80249", + '80010', + '80011', + '80012', + '80013', + '80014', + '80015', + '80016', + '80017', + '80018', + '80019', + '80045', + '80102', + '80112', + '80137', + '80138', + '80230', + '80231', + '80238', + '80247', + '80249', ] return screen.zipcode in zipcodes class Child(UrgentNeedFunction): - dependencies = ["age"] + dependencies = ['age'] @classmethod def eligible(cls, screen: Screen): - """ + ''' Return True if someone is younger than 18 - """ - return screen.num_children(child_relationship=["all"]) >= 1 + ''' + return screen.num_children(child_relationship=['all']) >= 1 class BiaFoodDelivery(UrgentNeedFunction): - dependencies = ["county"] + dependencies = ['county'] @classmethod def eligible(cls, screen: Screen): - """ + ''' Return True if in Adams, Arapahoe, Denver or Jefferson county - """ + ''' eligible_counties = [ - "Adams County", - "Arapahoe County", - "Denver County", - "Jefferson County", + 'Adams County', + 'Arapahoe County', + 'Denver County', + 'Jefferson County', ] return screen.county in eligible_counties class Trua(UrgentNeedFunction): - dependencies = ["household_size", "income_amount", "income_frequency"] + dependencies = ['household_size', 'income_amount', 'income_frequency'] @classmethod def eligible(cls, screen: Screen): - """ + ''' Return True if the household is below the income limit for their household size - """ + ''' income_limits = { 1: 66_300, 2: 75_750, @@ -141,19 +141,19 @@ def eligible(cls, screen: Screen): 7: 117_400, 8: 124_950, } - household_income = screen.calc_gross_income("yearly", ["all"]) + household_income = screen.calc_gross_income('yearly', ['all']) income_limit = income_limits[screen.household_size] return household_income <= income_limit class ForeclosureFinAssistProgram(UrgentNeedFunction): - dependencies = ["household_size", "income_amount", "income_frequency", "county"] + dependencies = ['household_size', 'income_amount', 'income_frequency', 'county'] @classmethod def eligible(cls, screen: Screen): - """ + ''' Return True if the household is at or below 80% the income limit for their household size & they live in Denver - """ + ''' income_limits = { 1: 66_300, 2: 75_750, @@ -164,9 +164,9 @@ def eligible(cls, screen: Screen): 7: 117_400, 8: 124_950, } - household_income = screen.calc_gross_income("yearly", ["all"]) + household_income = screen.calc_gross_income('yearly', ['all']) income_limit = income_limits[screen.household_size] - return household_income <= income_limit and screen.county == "Denver County" + return household_income <= income_limit and screen.county == 'Denver County' class EocIncomeLimitCache(GoogleSheetsCache): @@ -177,108 +177,113 @@ class EocIncomeLimitCache(GoogleSheetsCache): def update(self): data = super().update() - return {d[0].strip() + " County": [int(v.replace(",", "")) for v in d[1:]] for d in data} + return {d[0].strip() + ' County': [int(v.replace(',', '')) for v in d[1:]] for d in data} class Eoc(UrgentNeedFunction): limits_cache = EocIncomeLimitCache() - dependencies = ["income_amount", "income_frequency", "household_size", "county"] + dependencies = ['income_amount', 'income_frequency', 'household_size', 'county'] @classmethod def eligible(cls, screen: Screen): - """ + ''' Return True if the household is below the income limit for their county and household size - """ + ''' - income = int(screen.calc_gross_income("yearly", ["all"])) + income = int(screen.calc_gross_income('yearly', ['all'])) limits = Eoc.limits_cache.fetch() if screen.county not in limits: return False - income_limit = limits[screen.county][screen.household_size - 1] + income_limit = limits[screen.county][ + screen.household_size - 1 + ] return income < income_limit class CoLegalServices(UrgentNeedFunction): - dependencies = ["income_amount", "income_frequency", "household_size", "age"] + dependencies = ['income_amount', 'income_frequency', 'household_size', 'age'] @classmethod def eligible(cls, screen: Screen): - """ + ''' Return True if the household is has an income bellow 200% FPL or someone in the household is over 60 years old - """ - fpl = FederalPoveryLimit.objects.get(year="THIS YEAR").as_dict() - is_income_eligible = screen.calc_gross_income("yearly", ["all"]) < fpl[screen.household_size] + ''' + fpl = FederalPoveryLimit.objects.get(year='THIS YEAR').as_dict() + is_income_eligible = ( + screen.calc_gross_income('yearly', ['all']) < fpl[screen.household_size] + ) is_age_eligible = screen.num_adults(age_max=60) return is_income_eligible or is_age_eligible class CoEmergencyMortgageIncomeLimitCache(GoogleSheetsCache): default = {} - sheet_id = "1M_BQxs135UV4uO-CUpHtt9Xy89l1RmSufdP9c3nEh-M" + sheet_id = '1M_BQxs135UV4uO-CUpHtt9Xy89l1RmSufdP9c3nEh-M' range_name = "'100% AMI 2023'!A2:I65" def update(self): data = super().update() - return {d[0] + " County": [int(v.replace(",", "")) for v in d[1:]] for d in data} + return {d[0] + ' County': [int(v.replace(',', '')) for v in d[1:]] for d in data} class CoEmergencyMortgageAssistance(UrgentNeedFunction): limits_cache = CoEmergencyMortgageIncomeLimitCache() - dependencies = ["income_amount", "income_frequency", "household_size", "county"] + dependencies = ['income_amount', 'income_frequency', 'household_size', 'county'] @classmethod def eligible(cls, screen: Screen): - income = int(screen.calc_gross_income("yearly", ["all"])) + income = int(screen.calc_gross_income('yearly', ['all'])) limits = CoEmergencyMortgageAssistance.limits_cache.fetch() if screen.county not in limits: return False - income_limit = limits[screen.county][screen.household_size - 1] + income_limit = limits[screen.county][ + screen.household_size - 1 + ] return income < income_limit - class ChildFirst(UrgentNeedFunction): - dependencies = ["age", "county"] + dependencies = ['age', 'county'] @classmethod def eligible(cls, screen: Screen): - """ + ''' Return True if the household has a child aged 0-5 and lives in an eligible county - """ + ''' is_age_eligible = screen.num_children(age_max=5) eligible_counties = [ - "Adams County", - "Alamosa County", - "Arapahoe County", - "Bent County", - "Boulder County", - "Broomfield County", - "Chaffee County", - "Clear Creek County", - "Conejos County", - "Costilla County", - "Crowley County", - "Custer County", - "Douglas County", - "El Paso County", - "Fremont County", - "Gilpin County", - "Jefferson County", - "Lake County", - "Mineral County", - "Otero County", - "Rio Grand County", - "Routt County", - "Saguache County", - "Weld County", + 'Adams County', + 'Alamosa County', + 'Arapahoe County', + 'Bent County', + 'Boulder County', + 'Broomfield County', + 'Chaffee County', + 'Clear Creek County', + 'Conejos County', + 'Costilla County', + 'Crowley County', + 'Custer County', + 'Douglas County', + 'El Paso County', + 'Fremont County', + 'Gilpin County', + 'Jefferson County', + 'Lake County', + 'Mineral County', + 'Otero County', + 'Rio Grand County', + 'Routt County', + 'Saguache County', + 'Weld County', ] - return is_age_eligible and screen.county in eligible_counties + return is_age_eligible and screen.county in eligible_counties \ No newline at end of file diff --git a/programs/serializers.py b/programs/serializers.py index 14643e37..420f1335 100644 --- a/programs/serializers.py +++ b/programs/serializers.py @@ -5,16 +5,16 @@ class NavigatorAPISerializer(serializers.ModelSerializer): class Meta: model = Navigator - fields = "__all__" + fields = '__all__' class ProgramSerializer(serializers.ModelSerializer): class Meta: model = Program - fields = "__all__" + fields = '__all__' class UrgentNeedAPISerializer(serializers.ModelSerializer): class Meta: model = UrgentNeed - fields = "__all__" + fields = '__all__' diff --git a/programs/urls.py b/programs/urls.py index ddebede9..7d39e395 100644 --- a/programs/urls.py +++ b/programs/urls.py @@ -3,10 +3,12 @@ from . import views router = routers.DefaultRouter() -router.register(r"programs", views.ProgramViewSet) -router.register(r"navigators", views.NavigatorViewSet) -router.register(r"urgent-needs", views.UrgentNeedViewSet) +router.register(r'programs', views.ProgramViewSet) +router.register(r'navigators', views.NavigatorViewSet) +router.register(r'urgent-needs', views.UrgentNeedViewSet) # Wire up our API using automatic URL routing. # Additionally, we include login URLs for the browsable API. -urlpatterns = [path("", include(router.urls))] +urlpatterns = [ + path('', include(router.urls)) +] diff --git a/programs/views.py b/programs/views.py index 0c6adaeb..fbd38a66 100644 --- a/programs/views.py +++ b/programs/views.py @@ -4,32 +4,32 @@ from programs.serializers import ProgramSerializer, NavigatorAPISerializer, UrgentNeedAPISerializer -class ProgramViewSet(mixins.RetrieveModelMixin, viewsets.GenericViewSet): +class ProgramViewSet(mixins.RetrieveModelMixin, + viewsets.GenericViewSet): """ API endpoint that allows programs to be viewed or edited. """ - queryset = Program.objects.all() serializer_class = ProgramSerializer permission_classes = [permissions.IsAuthenticated] # filterset_fields = ['legal_status_required', 'value_type'] -class NavigatorViewSet(mixins.RetrieveModelMixin, viewsets.GenericViewSet): +class NavigatorViewSet(mixins.RetrieveModelMixin, + viewsets.GenericViewSet): """ API endpoint that allows programs to be viewed or edited. """ - queryset = Navigator.objects.all() serializer_class = NavigatorAPISerializer permission_classes = [permissions.IsAuthenticated] -class UrgentNeedViewSet(mixins.RetrieveModelMixin, viewsets.GenericViewSet): +class UrgentNeedViewSet(mixins.RetrieveModelMixin, + viewsets.GenericViewSet): """ API endpoint that allows programs to be viewed or edited. """ - queryset = UrgentNeed.objects.all() serializer_class = UrgentNeedAPISerializer permission_classes = [permissions.IsAuthenticated] diff --git a/screener/admin.py b/screener/admin.py index 82d4b7fd..e159b13a 100644 --- a/screener/admin.py +++ b/screener/admin.py @@ -7,9 +7,10 @@ class screenAdmin(admin.ModelAdmin): - search_fields = ("id",) + search_fields = ('id',) admin.site.register(Screen, screenAdmin) admin.site.register(Message) admin.site.register(IncomeStream) + diff --git a/screener/apps.py b/screener/apps.py index 1b0ed4d7..d2b31097 100644 --- a/screener/apps.py +++ b/screener/apps.py @@ -2,5 +2,5 @@ class ScreenerConfig(AppConfig): - default_auto_field = "django.db.models.BigAutoField" - name = "screener" + default_auto_field = 'django.db.models.BigAutoField' + name = 'screener' diff --git a/screener/management/commands/batch_snapshots.py b/screener/management/commands/batch_snapshots.py index d77f8bde..9efe1832 100644 --- a/screener/management/commands/batch_snapshots.py +++ b/screener/management/commands/batch_snapshots.py @@ -6,38 +6,44 @@ class Command(BaseCommand): - help = """ + help = ''' Creates snapshots for all users. Limit default is 1. Defaults to only creating snapshots for users with emails. - """ + ''' def add_arguments(self, parser): - parser.add_argument("--limit", default=1, type=int) - parser.add_argument("--all", default=False, type=bool) - parser.add_argument("--new", default=False, type=bool) + parser.add_argument('--limit', default=1, type=int) + parser.add_argument('--all', default=False, type=bool) + parser.add_argument('--new', default=False, type=bool) def handle(self, *args, **options): # Get the screens - screens = Screen.objects.filter(agree_to_tos=True, is_test=False, is_test_data=False, completed=True) - - if not options["all"]: + screens = Screen.objects.filter( + agree_to_tos=True, + is_test=False, + is_test_data=False, + completed=True + ) + + if not options['all']: screens = screens.exclude(user__isnull=True) - if options["new"]: + if options['new']: screens = screens.filter(eligibility_snapshots__isnull=True) # List[:None] is everything in the list - limit = None if options["limit"] == -1 else options["limit"] - screens = screens.order_by("-submission_date")[:limit] + limit = None if options['limit'] == -1 else options['limit'] + screens = screens.order_by('-submission_date')[:limit] # Calculate eligibility for each screen errors = [] - for i in trange(len(screens), desc="Screens"): + for i in trange(len(screens), desc='Screens'): try: eligibility_results(screens[i], batch=True) time.sleep(1) except Exception as e: - errors.append(str(screens[i].id) + ": " + str(e)) + errors.append(str(screens[i].id) + ': ' + str(e)) if len(errors): - self.stdout.write(self.style.ERROR("The following screens had errors:\n" + "\n".join(errors))) + self.stdout.write( + self.style.ERROR('The following screens had errors:\n' + '\n'.join(errors))) diff --git a/screener/management/commands/email_new_benefits.py b/screener/management/commands/email_new_benefits.py index c893cd3a..e6301a6e 100644 --- a/screener/management/commands/email_new_benefits.py +++ b/screener/management/commands/email_new_benefits.py @@ -5,24 +5,26 @@ class Command(BaseCommand): - help = """ + help = ''' Update number of new benefits and amount of new benefits in HubSpot - """ + ''' def add_arguments(self, parser): - parser.add_argument("--limit", default=1, type=int) + parser.add_argument('--limit', default=1, type=int) def handle(self, *args, **options): screens = Screen.objects.all().exclude(user__isnull=True) latest_snapshots = [] - limit = options["limit"] + limit = options['limit'] for screen in screens: try: - previous_snapshot = EligibilitySnapshot.objects.filter(is_batch=True, screen=screen).latest( - "submission_date" - ) + previous_snapshot = EligibilitySnapshot.objects \ + .filter(is_batch=True, screen=screen) \ + .latest('submission_date') except ObjectDoesNotExist: - self.stdout.write(self.style.WARNING(f"No snapshots for screen with id of {screen.id}")) + self.stdout.write( + self.style.WARNING(f'No snapshots for screen with id of {screen.id}') + ) continue latest_snapshots.append(previous_snapshot) @@ -46,7 +48,9 @@ def handle(self, *args, **options): limit -= 1 if not len(existing_users): - self.stdout.write(self.style.WARNING("No users in HubSpot. Make sure that you add users to HubSpot first")) + self.stdout.write( + self.style.WARNING('No users in HubSpot. Make sure that you add users to HubSpot first') + ) return hubspot.bulk_update(existing_users) diff --git a/screener/migrations/0001_initial.py b/screener/migrations/0001_initial.py index 5269a795..1cf4e8fd 100644 --- a/screener/migrations/0001_initial.py +++ b/screener/migrations/0001_initial.py @@ -5,44 +5,46 @@ class Migration(migrations.Migration): + initial = True - dependencies = [] + dependencies = [ + ] operations = [ migrations.CreateModel( - name="Screen", + name='Screen', fields=[ - ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), - ("submission_date", models.DateTimeField(auto_now=True)), - ("agree_to_tos", models.BooleanField()), - ("applicant_age", models.IntegerField()), - ("zipcode", models.CharField(max_length=5)), - ("student", models.BooleanField()), - ("student_full_time", models.BooleanField()), - ("pregnant", models.BooleanField()), - ("unemployed", models.BooleanField()), - ("worked_in_last_18_mos", models.BooleanField()), - ("visually_impaired", models.BooleanField()), - ("disabled", models.BooleanField()), - ("veteran", models.BooleanField()), - ("medicaid", models.BooleanField()), - ("disability_medicaid", models.BooleanField()), - ("has_income", models.BooleanField()), - ("has_expenses", models.BooleanField()), - ("household_size", models.IntegerField()), - ("household_assets", models.DecimalField(decimal_places=2, max_digits=10)), + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('submission_date', models.DateTimeField(auto_now=True)), + ('agree_to_tos', models.BooleanField()), + ('applicant_age', models.IntegerField()), + ('zipcode', models.CharField(max_length=5)), + ('student', models.BooleanField()), + ('student_full_time', models.BooleanField()), + ('pregnant', models.BooleanField()), + ('unemployed', models.BooleanField()), + ('worked_in_last_18_mos', models.BooleanField()), + ('visually_impaired', models.BooleanField()), + ('disabled', models.BooleanField()), + ('veteran', models.BooleanField()), + ('medicaid', models.BooleanField()), + ('disability_medicaid', models.BooleanField()), + ('has_income', models.BooleanField()), + ('has_expenses', models.BooleanField()), + ('household_size', models.IntegerField()), + ('household_assets', models.DecimalField(decimal_places=2, max_digits=10)), ], ), migrations.CreateModel( - name="incomeStream", + name='incomeStream', fields=[ - ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), - ("type", models.CharField(max_length=30)), - ("label", models.CharField(max_length=200)), - ("amount", models.DecimalField(decimal_places=2, max_digits=10)), - ("frequency", models.CharField(max_length=30)), - ("screen", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="screener.screen")), + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('type', models.CharField(max_length=30)), + ('label', models.CharField(max_length=200)), + ('amount', models.DecimalField(decimal_places=2, max_digits=10)), + ('frequency', models.CharField(max_length=30)), + ('screen', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='screener.screen')), ], ), ] diff --git a/screener/migrations/0002_screen_housing_situation_expense.py b/screener/migrations/0002_screen_housing_situation_expense.py index 296acba1..9c29bffa 100644 --- a/screener/migrations/0002_screen_housing_situation_expense.py +++ b/screener/migrations/0002_screen_housing_situation_expense.py @@ -5,25 +5,26 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0001_initial"), + ('screener', '0001_initial'), ] operations = [ migrations.AddField( - model_name="screen", - name="housing_situation", - field=models.CharField(default="rent", max_length=30), + model_name='screen', + name='housing_situation', + field=models.CharField(default='rent', max_length=30), preserve_default=False, ), migrations.CreateModel( - name="Expense", + name='Expense', fields=[ - ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), - ("name", models.CharField(max_length=30)), - ("amount", models.DecimalField(decimal_places=2, max_digits=10)), - ("frequency", models.CharField(max_length=30)), - ("screen", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="screener.screen")), + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=30)), + ('amount', models.DecimalField(decimal_places=2, max_digits=10)), + ('frequency', models.CharField(max_length=30)), + ('screen', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='screener.screen')), ], ), ] diff --git a/screener/migrations/0003_rename_type_incomestream_name.py b/screener/migrations/0003_rename_type_incomestream_name.py index 085cd9c4..493fe880 100644 --- a/screener/migrations/0003_rename_type_incomestream_name.py +++ b/screener/migrations/0003_rename_type_incomestream_name.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0002_screen_housing_situation_expense"), + ('screener', '0002_screen_housing_situation_expense'), ] operations = [ migrations.RenameField( - model_name="incomestream", - old_name="type", - new_name="name", + model_name='incomestream', + old_name='type', + new_name='name', ), ] diff --git a/screener/migrations/0004_remove_incomestream_label.py b/screener/migrations/0004_remove_incomestream_label.py index e8aebb8d..8f2f2dfa 100644 --- a/screener/migrations/0004_remove_incomestream_label.py +++ b/screener/migrations/0004_remove_incomestream_label.py @@ -4,13 +4,14 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0003_rename_type_incomestream_name"), + ('screener', '0003_rename_type_incomestream_name'), ] operations = [ migrations.RemoveField( - model_name="incomestream", - name="label", + model_name='incomestream', + name='label', ), ] diff --git a/screener/migrations/0005_alter_incomestream_screen.py b/screener/migrations/0005_alter_incomestream_screen.py index b36feb5b..f4d6f091 100644 --- a/screener/migrations/0005_alter_incomestream_screen.py +++ b/screener/migrations/0005_alter_incomestream_screen.py @@ -5,16 +5,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0004_remove_incomestream_label"), + ('screener', '0004_remove_incomestream_label'), ] operations = [ migrations.AlterField( - model_name="incomestream", - name="screen", - field=models.ForeignKey( - on_delete=django.db.models.deletion.CASCADE, related_name="incomestreams", to="screener.screen" - ), + model_name='incomestream', + name='screen', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='incomestreams', to='screener.screen'), ), ] diff --git a/screener/migrations/0006_rename_name_expense_type_and_more.py b/screener/migrations/0006_rename_name_expense_type_and_more.py index 7b62cdff..b592d8fe 100644 --- a/screener/migrations/0006_rename_name_expense_type_and_more.py +++ b/screener/migrations/0006_rename_name_expense_type_and_more.py @@ -5,26 +5,25 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0005_alter_incomestream_screen"), + ('screener', '0005_alter_incomestream_screen'), ] operations = [ migrations.RenameField( - model_name="expense", - old_name="name", - new_name="type", + model_name='expense', + old_name='name', + new_name='type', ), migrations.RenameField( - model_name="incomestream", - old_name="name", - new_name="type", + model_name='incomestream', + old_name='name', + new_name='type', ), migrations.AlterField( - model_name="expense", - name="screen", - field=models.ForeignKey( - on_delete=django.db.models.deletion.CASCADE, related_name="expenses", to="screener.screen" - ), + model_name='expense', + name='screen', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='expenses', to='screener.screen'), ), ] diff --git a/screener/migrations/0007_rename_applicant_age_screen_age.py b/screener/migrations/0007_rename_applicant_age_screen_age.py index 336ad346..b54fd4bc 100644 --- a/screener/migrations/0007_rename_applicant_age_screen_age.py +++ b/screener/migrations/0007_rename_applicant_age_screen_age.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0006_rename_name_expense_type_and_more"), + ('screener', '0006_rename_name_expense_type_and_more'), ] operations = [ migrations.RenameField( - model_name="screen", - old_name="applicant_age", - new_name="age", + model_name='screen', + old_name='applicant_age', + new_name='age', ), ] diff --git a/screener/migrations/0008_householdmember.py b/screener/migrations/0008_householdmember.py index d668e41e..a655842a 100644 --- a/screener/migrations/0008_householdmember.py +++ b/screener/migrations/0008_householdmember.py @@ -5,37 +5,31 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0007_rename_applicant_age_screen_age"), + ('screener', '0007_rename_applicant_age_screen_age'), ] operations = [ migrations.CreateModel( - name="HouseholdMember", + name='HouseholdMember', fields=[ - ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), - ("age", models.IntegerField()), - ("zipcode", models.CharField(max_length=5)), - ("student", models.BooleanField()), - ("student_full_time", models.BooleanField()), - ("pregnant", models.BooleanField()), - ("unemployed", models.BooleanField()), - ("worked_in_last_18_mos", models.BooleanField()), - ("visually_impaired", models.BooleanField()), - ("disabled", models.BooleanField()), - ("veteran", models.BooleanField()), - ("medicaid", models.BooleanField()), - ("disability_medicaid", models.BooleanField()), - ("has_income", models.BooleanField()), - ("has_expenses", models.BooleanField()), - ( - "screen", - models.ForeignKey( - on_delete=django.db.models.deletion.CASCADE, - related_name="householdmembers", - to="screener.screen", - ), - ), + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('age', models.IntegerField()), + ('zipcode', models.CharField(max_length=5)), + ('student', models.BooleanField()), + ('student_full_time', models.BooleanField()), + ('pregnant', models.BooleanField()), + ('unemployed', models.BooleanField()), + ('worked_in_last_18_mos', models.BooleanField()), + ('visually_impaired', models.BooleanField()), + ('disabled', models.BooleanField()), + ('veteran', models.BooleanField()), + ('medicaid', models.BooleanField()), + ('disability_medicaid', models.BooleanField()), + ('has_income', models.BooleanField()), + ('has_expenses', models.BooleanField()), + ('screen', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='householdmembers', to='screener.screen')), ], ), ] diff --git a/screener/migrations/0009_remove_householdmember_zipcode.py b/screener/migrations/0009_remove_householdmember_zipcode.py index 7ad698b1..ca828419 100644 --- a/screener/migrations/0009_remove_householdmember_zipcode.py +++ b/screener/migrations/0009_remove_householdmember_zipcode.py @@ -4,13 +4,14 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0008_householdmember"), + ('screener', '0008_householdmember'), ] operations = [ migrations.RemoveField( - model_name="householdmember", - name="zipcode", + model_name='householdmember', + name='zipcode', ), ] diff --git a/screener/migrations/0010_remove_screen_age_remove_screen_disability_medicaid_and_more.py b/screener/migrations/0010_remove_screen_age_remove_screen_disability_medicaid_and_more.py index 940dbabe..9167e3de 100644 --- a/screener/migrations/0010_remove_screen_age_remove_screen_disability_medicaid_and_more.py +++ b/screener/migrations/0010_remove_screen_age_remove_screen_disability_medicaid_and_more.py @@ -4,61 +4,62 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0009_remove_householdmember_zipcode"), + ('screener', '0009_remove_householdmember_zipcode'), ] operations = [ migrations.RemoveField( - model_name="screen", - name="age", + model_name='screen', + name='age', ), migrations.RemoveField( - model_name="screen", - name="disability_medicaid", + model_name='screen', + name='disability_medicaid', ), migrations.RemoveField( - model_name="screen", - name="disabled", + model_name='screen', + name='disabled', ), migrations.RemoveField( - model_name="screen", - name="has_expenses", + model_name='screen', + name='has_expenses', ), migrations.RemoveField( - model_name="screen", - name="has_income", + model_name='screen', + name='has_income', ), migrations.RemoveField( - model_name="screen", - name="medicaid", + model_name='screen', + name='medicaid', ), migrations.RemoveField( - model_name="screen", - name="pregnant", + model_name='screen', + name='pregnant', ), migrations.RemoveField( - model_name="screen", - name="student", + model_name='screen', + name='student', ), migrations.RemoveField( - model_name="screen", - name="student_full_time", + model_name='screen', + name='student_full_time', ), migrations.RemoveField( - model_name="screen", - name="unemployed", + model_name='screen', + name='unemployed', ), migrations.RemoveField( - model_name="screen", - name="veteran", + model_name='screen', + name='veteran', ), migrations.RemoveField( - model_name="screen", - name="visually_impaired", + model_name='screen', + name='visually_impaired', ), migrations.RemoveField( - model_name="screen", - name="worked_in_last_18_mos", + model_name='screen', + name='worked_in_last_18_mos', ), ] diff --git a/screener/migrations/0011_expense_household_member_and_more.py b/screener/migrations/0011_expense_household_member_and_more.py index c7edfe9d..38a0147d 100644 --- a/screener/migrations/0011_expense_household_member_and_more.py +++ b/screener/migrations/0011_expense_household_member_and_more.py @@ -5,31 +5,22 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0010_remove_screen_age_remove_screen_disability_medicaid_and_more"), + ('screener', '0010_remove_screen_age_remove_screen_disability_medicaid_and_more'), ] operations = [ migrations.AddField( - model_name="expense", - name="household_member", - field=models.ForeignKey( - default=1, - on_delete=django.db.models.deletion.CASCADE, - related_name="expenses", - to="screener.householdmember", - ), + model_name='expense', + name='household_member', + field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, related_name='expenses', to='screener.householdmember'), preserve_default=False, ), migrations.AddField( - model_name="incomestream", - name="household_member", - field=models.ForeignKey( - default=1, - on_delete=django.db.models.deletion.CASCADE, - related_name="incomestreams", - to="screener.householdmember", - ), + model_name='incomestream', + name='household_member', + field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, related_name='incomestreams', to='screener.householdmember'), preserve_default=False, ), ] diff --git a/screener/migrations/0012_alter_householdmember_screen_and_more.py b/screener/migrations/0012_alter_householdmember_screen_and_more.py index 0d480450..40dcc7ff 100644 --- a/screener/migrations/0012_alter_householdmember_screen_and_more.py +++ b/screener/migrations/0012_alter_householdmember_screen_and_more.py @@ -5,32 +5,25 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0011_expense_household_member_and_more"), + ('screener', '0011_expense_household_member_and_more'), ] operations = [ migrations.AlterField( - model_name="householdmember", - name="screen", - field=models.ForeignKey( - on_delete=django.db.models.deletion.CASCADE, related_name="household_members", to="screener.screen" - ), + model_name='householdmember', + name='screen', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='household_members', to='screener.screen'), ), migrations.AlterField( - model_name="incomestream", - name="household_member", - field=models.ForeignKey( - on_delete=django.db.models.deletion.CASCADE, - related_name="income_streams", - to="screener.householdmember", - ), + model_name='incomestream', + name='household_member', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='income_streams', to='screener.householdmember'), ), migrations.AlterField( - model_name="incomestream", - name="screen", - field=models.ForeignKey( - on_delete=django.db.models.deletion.CASCADE, related_name="income_streams", to="screener.screen" - ), + model_name='incomestream', + name='screen', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='income_streams', to='screener.screen'), ), ] diff --git a/screener/migrations/0013_householdmember_relationship.py b/screener/migrations/0013_householdmember_relationship.py index cd66da4e..3ba8336f 100644 --- a/screener/migrations/0013_householdmember_relationship.py +++ b/screener/migrations/0013_householdmember_relationship.py @@ -4,15 +4,16 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0012_alter_householdmember_screen_and_more"), + ('screener', '0012_alter_householdmember_screen_and_more'), ] operations = [ migrations.AddField( - model_name="householdmember", - name="relationship", - field=models.CharField(default="parent", max_length=30), + model_name='householdmember', + name='relationship', + field=models.CharField(default='parent', max_length=30), preserve_default=False, ), ] diff --git a/screener/migrations/0014_screen_cell_screen_email.py b/screener/migrations/0014_screen_cell_screen_email.py index 6f7bd68e..0dc0d7ed 100644 --- a/screener/migrations/0014_screen_cell_screen_email.py +++ b/screener/migrations/0014_screen_cell_screen_email.py @@ -5,19 +5,20 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0013_householdmember_relationship"), + ('screener', '0013_householdmember_relationship'), ] operations = [ migrations.AddField( - model_name="screen", - name="cell", + model_name='screen', + name='cell', field=phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, region=None), ), migrations.AddField( - model_name="screen", - name="email", + model_name='screen', + name='email', field=models.CharField(blank=True, max_length=320), ), ] diff --git a/screener/migrations/0015_remove_screen_cell.py b/screener/migrations/0015_remove_screen_cell.py index f2703086..ba186afd 100644 --- a/screener/migrations/0015_remove_screen_cell.py +++ b/screener/migrations/0015_remove_screen_cell.py @@ -4,13 +4,14 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0014_screen_cell_screen_email"), + ('screener', '0014_screen_cell_screen_email'), ] operations = [ migrations.RemoveField( - model_name="screen", - name="cell", + model_name='screen', + name='cell', ), ] diff --git a/screener/migrations/0016_remove_screen_email.py b/screener/migrations/0016_remove_screen_email.py index 6ecccab0..6456247b 100644 --- a/screener/migrations/0016_remove_screen_email.py +++ b/screener/migrations/0016_remove_screen_email.py @@ -4,13 +4,14 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0015_remove_screen_cell"), + ('screener', '0015_remove_screen_cell'), ] operations = [ migrations.RemoveField( - model_name="screen", - name="email", + model_name='screen', + name='email', ), ] diff --git a/screener/migrations/0017_screen_last_email_request_date.py b/screener/migrations/0017_screen_last_email_request_date.py index 5e69a6a8..2c15230d 100644 --- a/screener/migrations/0017_screen_last_email_request_date.py +++ b/screener/migrations/0017_screen_last_email_request_date.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0016_remove_screen_email"), + ('screener', '0016_remove_screen_email'), ] operations = [ migrations.AddField( - model_name="screen", - name="last_email_request_date", + model_name='screen', + name='last_email_request_date', field=models.DateTimeField(blank=True, null=True), ), ] diff --git a/screener/migrations/0018_screen_user.py b/screener/migrations/0018_screen_user.py index 03d0fc79..3509e95e 100644 --- a/screener/migrations/0018_screen_user.py +++ b/screener/migrations/0018_screen_user.py @@ -6,21 +6,16 @@ class Migration(migrations.Migration): + dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ("screener", "0017_screen_last_email_request_date"), + ('screener', '0017_screen_last_email_request_date'), ] operations = [ migrations.AddField( - model_name="screen", - name="user", - field=models.ForeignKey( - blank=True, - null=True, - on_delete=django.db.models.deletion.CASCADE, - related_name="screens", - to=settings.AUTH_USER_MODEL, - ), + model_name='screen', + name='user', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='screens', to=settings.AUTH_USER_MODEL), ), ] diff --git a/screener/migrations/0019_screen_start_date.py b/screener/migrations/0019_screen_start_date.py index b7e1a673..4bdb856b 100644 --- a/screener/migrations/0019_screen_start_date.py +++ b/screener/migrations/0019_screen_start_date.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0018_screen_user"), + ('screener', '0018_screen_user'), ] operations = [ migrations.AddField( - model_name="screen", - name="start_date", + model_name='screen', + name='start_date', field=models.DateTimeField(blank=True, null=True), ), ] diff --git a/screener/migrations/0020_screen_is_test.py b/screener/migrations/0020_screen_is_test.py index 5535a831..1bd1fb96 100644 --- a/screener/migrations/0020_screen_is_test.py +++ b/screener/migrations/0020_screen_is_test.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0019_screen_start_date"), + ('screener', '0019_screen_start_date'), ] operations = [ migrations.AddField( - model_name="screen", - name="is_test", + model_name='screen', + name='is_test', field=models.BooleanField(blank=True, default=False), ), ] diff --git a/screener/migrations/0021_messages.py b/screener/migrations/0021_messages.py index 9f3fb465..f8377f68 100644 --- a/screener/migrations/0021_messages.py +++ b/screener/migrations/0021_messages.py @@ -6,33 +6,21 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0020_screen_is_test"), + ('screener', '0020_screen_is_test'), ] operations = [ migrations.CreateModel( - name="Messages", + name='Messages', fields=[ - ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), - ("sent", models.DateTimeField(auto_now=True)), - ( - "cell", - phonenumber_field.modelfields.PhoneNumberField( - blank=True, max_length=128, null=True, region=None, unique=True - ), - ), - ( - "email", - models.EmailField(blank=True, max_length=254, null=True, unique=True, verbose_name="email address"), - ), - ("message", models.CharField(blank=True, max_length=320, null=True)), - ( - "screen", - models.ForeignKey( - on_delete=django.db.models.deletion.CASCADE, related_name="messages", to="screener.screen" - ), - ), + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('sent', models.DateTimeField(auto_now=True)), + ('cell', phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, null=True, region=None, unique=True)), + ('email', models.EmailField(blank=True, max_length=254, null=True, unique=True, verbose_name='email address')), + ('message', models.CharField(blank=True, max_length=320, null=True)), + ('screen', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='messages', to='screener.screen')), ], ), ] diff --git a/screener/migrations/0022_rename_messages_message.py b/screener/migrations/0022_rename_messages_message.py index bc9145c0..71f7f1e2 100644 --- a/screener/migrations/0022_rename_messages_message.py +++ b/screener/migrations/0022_rename_messages_message.py @@ -4,13 +4,14 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0021_messages"), + ('screener', '0021_messages'), ] operations = [ migrations.RenameModel( - old_name="Messages", - new_name="Message", + old_name='Messages', + new_name='Message', ), ] diff --git a/screener/migrations/0023_rename_message_message_content_message_type.py b/screener/migrations/0023_rename_message_message_content_message_type.py index b5d83512..87ed8481 100644 --- a/screener/migrations/0023_rename_message_message_content_message_type.py +++ b/screener/migrations/0023_rename_message_message_content_message_type.py @@ -4,20 +4,21 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0022_rename_messages_message"), + ('screener', '0022_rename_messages_message'), ] operations = [ migrations.RenameField( - model_name="message", - old_name="message", - new_name="content", + model_name='message', + old_name='message', + new_name='content', ), migrations.AddField( - model_name="message", - name="type", - field=models.CharField(default="", max_length=30), + model_name='message', + name='type', + field=models.CharField(default='', max_length=30), preserve_default=False, ), ] diff --git a/screener/migrations/0024_alter_message_cell_alter_message_email.py b/screener/migrations/0024_alter_message_cell_alter_message_email.py index 9ee9261b..263d9d29 100644 --- a/screener/migrations/0024_alter_message_cell_alter_message_email.py +++ b/screener/migrations/0024_alter_message_cell_alter_message_email.py @@ -5,19 +5,20 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0023_rename_message_message_content_message_type"), + ('screener', '0023_rename_message_message_content_message_type'), ] operations = [ migrations.AlterField( - model_name="message", - name="cell", + model_name='message', + name='cell', field=phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, null=True, region=None), ), migrations.AlterField( - model_name="message", - name="email", - field=models.EmailField(blank=True, max_length=254, null=True, verbose_name="email address"), + model_name='message', + name='email', + field=models.EmailField(blank=True, max_length=254, null=True, verbose_name='email address'), ), ] diff --git a/screener/migrations/0025_screen_external_id.py b/screener/migrations/0025_screen_external_id.py index 69083f2d..67bced38 100644 --- a/screener/migrations/0025_screen_external_id.py +++ b/screener/migrations/0025_screen_external_id.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0024_alter_message_cell_alter_message_email"), + ('screener', '0024_alter_message_cell_alter_message_email'), ] operations = [ migrations.AddField( - model_name="screen", - name="external_id", + model_name='screen', + name='external_id', field=models.CharField(blank=True, max_length=120, null=True), ), ] diff --git a/screener/migrations/0026_screen_filed_taxes.py b/screener/migrations/0026_screen_filed_taxes.py index e2d500fe..40b12481 100644 --- a/screener/migrations/0026_screen_filed_taxes.py +++ b/screener/migrations/0026_screen_filed_taxes.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0025_screen_external_id"), + ('screener', '0025_screen_external_id'), ] operations = [ migrations.AddField( - model_name="screen", - name="filed_taxes", + model_name='screen', + name='filed_taxes', field=models.BooleanField(blank=True, default=None, null=True), ), ] diff --git a/screener/migrations/0027_remove_screen_filed_taxes.py b/screener/migrations/0027_remove_screen_filed_taxes.py index 1b30d814..98c2743d 100644 --- a/screener/migrations/0027_remove_screen_filed_taxes.py +++ b/screener/migrations/0027_remove_screen_filed_taxes.py @@ -4,13 +4,14 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0026_screen_filed_taxes"), + ('screener', '0026_screen_filed_taxes'), ] operations = [ migrations.RemoveField( - model_name="screen", - name="filed_taxes", + model_name='screen', + name='filed_taxes', ), ] diff --git a/screener/migrations/0028_screen_last_tax_filing_year.py b/screener/migrations/0028_screen_last_tax_filing_year.py index 41f24c6d..7e602175 100644 --- a/screener/migrations/0028_screen_last_tax_filing_year.py +++ b/screener/migrations/0028_screen_last_tax_filing_year.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0027_remove_screen_filed_taxes"), + ('screener', '0027_remove_screen_filed_taxes'), ] operations = [ migrations.AddField( - model_name="screen", - name="last_tax_filing_year", + model_name='screen', + name='last_tax_filing_year', field=models.CharField(blank=True, default=None, max_length=120, null=True), ), ] diff --git a/screener/migrations/0029_alter_screen_housing_situation.py b/screener/migrations/0029_alter_screen_housing_situation.py index 20e71f1c..97fa7799 100644 --- a/screener/migrations/0029_alter_screen_housing_situation.py +++ b/screener/migrations/0029_alter_screen_housing_situation.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0028_screen_last_tax_filing_year"), + ('screener', '0028_screen_last_tax_filing_year'), ] operations = [ migrations.AlterField( - model_name="screen", - name="housing_situation", + model_name='screen', + name='housing_situation', field=models.CharField(blank=True, default=None, max_length=30, null=True), ), ] diff --git a/screener/migrations/0030_screen_has_acp_screen_has_ccb_screen_has_cccap_and_more.py b/screener/migrations/0030_screen_has_acp_screen_has_ccb_screen_has_cccap_and_more.py index bd2b3276..24cf05f0 100644 --- a/screener/migrations/0030_screen_has_acp_screen_has_ccb_screen_has_cccap_and_more.py +++ b/screener/migrations/0030_screen_has_acp_screen_has_ccb_screen_has_cccap_and_more.py @@ -4,84 +4,85 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0029_alter_screen_housing_situation"), + ('screener', '0029_alter_screen_housing_situation'), ] operations = [ migrations.AddField( - model_name="screen", - name="has_acp", + model_name='screen', + name='has_acp', field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name="screen", - name="has_ccb", + model_name='screen', + name='has_ccb', field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name="screen", - name="has_cccap", + model_name='screen', + name='has_cccap', field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name="screen", - name="has_chp", + model_name='screen', + name='has_chp', field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name="screen", - name="has_coeitc", + model_name='screen', + name='has_coeitc', field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name="screen", - name="has_ctc", + model_name='screen', + name='has_ctc', field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name="screen", - name="has_eitc", + model_name='screen', + name='has_eitc', field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name="screen", - name="has_lifeline", + model_name='screen', + name='has_lifeline', field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name="screen", - name="has_medicaid", + model_name='screen', + name='has_medicaid', field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name="screen", - name="has_mydenver", + model_name='screen', + name='has_mydenver', field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name="screen", - name="has_nslp", + model_name='screen', + name='has_nslp', field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name="screen", - name="has_rtdlive", + model_name='screen', + name='has_rtdlive', field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name="screen", - name="has_snap", + model_name='screen', + name='has_snap', field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name="screen", - name="has_tanf", + model_name='screen', + name='has_tanf', field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name="screen", - name="has_wic", + model_name='screen', + name='has_wic', field=models.BooleanField(blank=True, default=False, null=True), ), ] diff --git a/screener/migrations/0031_alter_householdmember_disability_medicaid_and_more.py b/screener/migrations/0031_alter_householdmember_disability_medicaid_and_more.py index d80cc09e..4b1dd9c4 100644 --- a/screener/migrations/0031_alter_householdmember_disability_medicaid_and_more.py +++ b/screener/migrations/0031_alter_householdmember_disability_medicaid_and_more.py @@ -4,19 +4,20 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0030_screen_has_acp_screen_has_ccb_screen_has_cccap_and_more"), + ('screener', '0030_screen_has_acp_screen_has_ccb_screen_has_cccap_and_more'), ] operations = [ migrations.AlterField( - model_name="householdmember", - name="disability_medicaid", + model_name='householdmember', + name='disability_medicaid', field=models.BooleanField(blank=True, null=True), ), migrations.AlterField( - model_name="householdmember", - name="medicaid", + model_name='householdmember', + name='medicaid', field=models.BooleanField(blank=True, null=True), ), ] diff --git a/screener/migrations/0032_message_uid.py b/screener/migrations/0032_message_uid.py index d0010baa..14ad42c9 100644 --- a/screener/migrations/0032_message_uid.py +++ b/screener/migrations/0032_message_uid.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0031_alter_householdmember_disability_medicaid_and_more"), + ('screener', '0031_alter_householdmember_disability_medicaid_and_more'), ] operations = [ migrations.AddField( - model_name="message", - name="uid", + model_name='message', + name='uid', field=models.IntegerField(blank=True, null=True), ), ] diff --git a/screener/migrations/0033_screen_referral_source.py b/screener/migrations/0033_screen_referral_source.py index 486aeeed..92c783e3 100644 --- a/screener/migrations/0033_screen_referral_source.py +++ b/screener/migrations/0033_screen_referral_source.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0032_message_uid"), + ('screener', '0032_message_uid'), ] operations = [ migrations.AddField( - model_name="screen", - name="referral_source", + model_name='screen', + name='referral_source', field=models.CharField(blank=True, default=None, max_length=320, null=True), ), ] diff --git a/screener/migrations/0034_alter_screen_household_assets.py b/screener/migrations/0034_alter_screen_household_assets.py index e586bbab..83bff2c4 100644 --- a/screener/migrations/0034_alter_screen_household_assets.py +++ b/screener/migrations/0034_alter_screen_household_assets.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0033_screen_referral_source"), + ('screener', '0033_screen_referral_source'), ] operations = [ migrations.AlterField( - model_name="screen", - name="household_assets", + model_name='screen', + name='household_assets', field=models.DecimalField(blank=True, decimal_places=2, default=None, max_digits=10, null=True), ), ] diff --git a/screener/migrations/0035_screen_county.py b/screener/migrations/0035_screen_county.py index 4fc78071..e1717eb8 100644 --- a/screener/migrations/0035_screen_county.py +++ b/screener/migrations/0035_screen_county.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0034_alter_screen_household_assets"), + ('screener', '0034_alter_screen_household_assets'), ] operations = [ migrations.AddField( - model_name="screen", - name="county", + model_name='screen', + name='county', field=models.CharField(blank=True, default=None, max_length=120, null=True), ), ] diff --git a/screener/migrations/0036_screen_request_language_code.py b/screener/migrations/0036_screen_request_language_code.py index 571c1a5d..a56c4cb9 100644 --- a/screener/migrations/0036_screen_request_language_code.py +++ b/screener/migrations/0036_screen_request_language_code.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0035_screen_county"), + ('screener', '0035_screen_county'), ] operations = [ migrations.AddField( - model_name="screen", - name="request_language_code", + model_name='screen', + name='request_language_code', field=models.CharField(blank=True, max_length=12, null=True), ), ] diff --git a/screener/migrations/0037_eligibilitysnapshot_programeligibilitysnapshot.py b/screener/migrations/0037_eligibilitysnapshot_programeligibilitysnapshot.py index a026c130..89028830 100644 --- a/screener/migrations/0037_eligibilitysnapshot_programeligibilitysnapshot.py +++ b/screener/migrations/0037_eligibilitysnapshot_programeligibilitysnapshot.py @@ -5,48 +5,35 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0036_screen_request_language_code"), + ('screener', '0036_screen_request_language_code'), ] operations = [ migrations.CreateModel( - name="EligibilitySnapshot", + name='EligibilitySnapshot', fields=[ - ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), - ("submission_date", models.DateTimeField(auto_now=True)), - ( - "screen", - models.ForeignKey( - on_delete=django.db.models.deletion.CASCADE, - related_name="eligibility_snapshots", - to="screener.screen", - ), - ), + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('submission_date', models.DateTimeField(auto_now=True)), + ('screen', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='eligibility_snapshots', to='screener.screen')), ], ), migrations.CreateModel( - name="ProgramEligibilitySnapshot", + name='ProgramEligibilitySnapshot', fields=[ - ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), - ("name", models.CharField(max_length=320)), - ("name_abbreviated", models.CharField(max_length=32)), - ("value_type", models.CharField(max_length=120)), - ("estimated_value", models.DecimalField(decimal_places=2, max_digits=10)), - ("estimated_delivery_time", models.CharField(max_length=120)), - ("estimated_application_time", models.CharField(max_length=120)), - ("legal_status_required", models.CharField(max_length=120)), - ("eligible", models.BooleanField()), - ("failed_tests", models.JSONField()), - ("passed_tests", models.JSONField()), - ( - "eligibility_snapshot", - models.ForeignKey( - on_delete=django.db.models.deletion.CASCADE, - related_name="program_snapshots", - to="screener.eligibilitysnapshot", - ), - ), + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=320)), + ('name_abbreviated', models.CharField(max_length=32)), + ('value_type', models.CharField(max_length=120)), + ('estimated_value', models.DecimalField(decimal_places=2, max_digits=10)), + ('estimated_delivery_time', models.CharField(max_length=120)), + ('estimated_application_time', models.CharField(max_length=120)), + ('legal_status_required', models.CharField(max_length=120)), + ('eligible', models.BooleanField()), + ('failed_tests', models.JSONField()), + ('passed_tests', models.JSONField()), + ('eligibility_snapshot', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='program_snapshots', to='screener.eligibilitysnapshot')), ], ), ] diff --git a/screener/migrations/0038_alter_programeligibilitysnapshot_estimated_application_time_and_more.py b/screener/migrations/0038_alter_programeligibilitysnapshot_estimated_application_time_and_more.py index d8a24e8c..18bafb77 100644 --- a/screener/migrations/0038_alter_programeligibilitysnapshot_estimated_application_time_and_more.py +++ b/screener/migrations/0038_alter_programeligibilitysnapshot_estimated_application_time_and_more.py @@ -4,34 +4,35 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0037_eligibilitysnapshot_programeligibilitysnapshot"), + ('screener', '0037_eligibilitysnapshot_programeligibilitysnapshot'), ] operations = [ migrations.AlterField( - model_name="programeligibilitysnapshot", - name="estimated_application_time", + model_name='programeligibilitysnapshot', + name='estimated_application_time', field=models.CharField(blank=True, max_length=120, null=True), ), migrations.AlterField( - model_name="programeligibilitysnapshot", - name="estimated_delivery_time", + model_name='programeligibilitysnapshot', + name='estimated_delivery_time', field=models.CharField(blank=True, max_length=120, null=True), ), migrations.AlterField( - model_name="programeligibilitysnapshot", - name="failed_tests", + model_name='programeligibilitysnapshot', + name='failed_tests', field=models.JSONField(blank=True, null=True), ), migrations.AlterField( - model_name="programeligibilitysnapshot", - name="legal_status_required", + model_name='programeligibilitysnapshot', + name='legal_status_required', field=models.CharField(blank=True, max_length=120, null=True), ), migrations.AlterField( - model_name="programeligibilitysnapshot", - name="passed_tests", + model_name='programeligibilitysnapshot', + name='passed_tests', field=models.JSONField(blank=True, null=True), ), ] diff --git a/screener/migrations/0039_screen_has_ssi.py b/screener/migrations/0039_screen_has_ssi.py index 84aa63e9..116f4e23 100644 --- a/screener/migrations/0039_screen_has_ssi.py +++ b/screener/migrations/0039_screen_has_ssi.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0038_alter_programeligibilitysnapshot_estimated_application_time_and_more"), + ('screener', '0038_alter_programeligibilitysnapshot_estimated_application_time_and_more'), ] operations = [ migrations.AddField( - model_name="screen", - name="has_ssi", + model_name='screen', + name='has_ssi', field=models.BooleanField(blank=True, default=False, null=True), ), ] diff --git a/screener/migrations/0040_screen_has_chp_hi_screen_has_employer_hi_and_more.py b/screener/migrations/0040_screen_has_chp_hi_screen_has_employer_hi_and_more.py index b52afd91..d5f205d5 100644 --- a/screener/migrations/0040_screen_has_chp_hi_screen_has_employer_hi_and_more.py +++ b/screener/migrations/0040_screen_has_chp_hi_screen_has_employer_hi_and_more.py @@ -4,34 +4,35 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0039_screen_has_ssi"), + ('screener', '0039_screen_has_ssi'), ] operations = [ migrations.AddField( - model_name="screen", - name="has_chp_hi", + model_name='screen', + name='has_chp_hi', field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name="screen", - name="has_employer_hi", + model_name='screen', + name='has_employer_hi', field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name="screen", - name="has_medicaid_hi", + model_name='screen', + name='has_medicaid_hi', field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name="screen", - name="has_no_hi", + model_name='screen', + name='has_no_hi', field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name="screen", - name="has_private_hi", + model_name='screen', + name='has_private_hi', field=models.BooleanField(blank=True, default=False, null=True), ), ] diff --git a/screener/migrations/0041_screen_referrer_code.py b/screener/migrations/0041_screen_referrer_code.py index bfcb342b..8cdcb3cd 100644 --- a/screener/migrations/0041_screen_referrer_code.py +++ b/screener/migrations/0041_screen_referrer_code.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0040_screen_has_chp_hi_screen_has_employer_hi_and_more"), + ('screener', '0040_screen_has_chp_hi_screen_has_employer_hi_and_more'), ] operations = [ migrations.AddField( - model_name="screen", - name="referrer_code", + model_name='screen', + name='referrer_code', field=models.CharField(blank=True, default=None, max_length=320, null=True), ), ] diff --git a/screener/migrations/0042_screen_needs_baby_supplies_and_more.py b/screener/migrations/0042_screen_needs_baby_supplies_and_more.py index 4e6a039a..e1c1808f 100644 --- a/screener/migrations/0042_screen_needs_baby_supplies_and_more.py +++ b/screener/migrations/0042_screen_needs_baby_supplies_and_more.py @@ -4,39 +4,40 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0041_screen_referrer_code"), + ('screener', '0041_screen_referrer_code'), ] operations = [ migrations.AddField( - model_name="screen", - name="needs_baby_supplies", + model_name='screen', + name='needs_baby_supplies', field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name="screen", - name="needs_child_dev_help", + model_name='screen', + name='needs_child_dev_help', field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name="screen", - name="needs_food", + model_name='screen', + name='needs_food', field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name="screen", - name="needs_funeral_help", + model_name='screen', + name='needs_funeral_help', field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name="screen", - name="needs_housing_help", + model_name='screen', + name='needs_housing_help', field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name="screen", - name="needs_mental_health_help", + model_name='screen', + name='needs_mental_health_help', field=models.BooleanField(blank=True, default=False, null=True), ), ] diff --git a/screener/migrations/0043_screen_has_medicare_hi.py b/screener/migrations/0043_screen_has_medicare_hi.py index e5babd3d..e4e6f54e 100644 --- a/screener/migrations/0043_screen_has_medicare_hi.py +++ b/screener/migrations/0043_screen_has_medicare_hi.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0042_screen_needs_baby_supplies_and_more"), + ('screener', '0042_screen_needs_baby_supplies_and_more'), ] operations = [ migrations.AddField( - model_name="screen", - name="has_medicare_hi", + model_name='screen', + name='has_medicare_hi', field=models.BooleanField(blank=True, default=False, null=True), ), ] diff --git a/screener/migrations/0044_screen_is_verified.py b/screener/migrations/0044_screen_is_verified.py index 65b0ce57..b0ce051f 100644 --- a/screener/migrations/0044_screen_is_verified.py +++ b/screener/migrations/0044_screen_is_verified.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0043_screen_has_medicare_hi"), + ('screener', '0043_screen_has_medicare_hi'), ] operations = [ migrations.AddField( - model_name="screen", - name="is_verified", + model_name='screen', + name='is_verified', field=models.BooleanField(blank=True, default=False), ), ] diff --git a/screener/migrations/0045_screen_uuid.py b/screener/migrations/0045_screen_uuid.py index 11d1d653..efa0f356 100644 --- a/screener/migrations/0045_screen_uuid.py +++ b/screener/migrations/0045_screen_uuid.py @@ -5,14 +5,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0044_screen_is_verified"), + ('screener', '0044_screen_is_verified'), ] operations = [ migrations.AddField( - model_name="screen", - name="uuid", + model_name='screen', + name='uuid', field=models.UUIDField(default=uuid.uuid4, editable=False), ), ] diff --git a/screener/migrations/0046_alter_screen_uuid.py b/screener/migrations/0046_alter_screen_uuid.py index 5e8d3853..55eeae10 100644 --- a/screener/migrations/0046_alter_screen_uuid.py +++ b/screener/migrations/0046_alter_screen_uuid.py @@ -5,14 +5,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0045_screen_uuid"), + ('screener', '0045_screen_uuid'), ] operations = [ migrations.AlterField( - model_name="screen", - name="uuid", + model_name='screen', + name='uuid', field=models.UUIDField(default=uuid.uuid4), ), ] diff --git a/screener/migrations/0047_incomestream_hours_worked.py b/screener/migrations/0047_incomestream_hours_worked.py index 9cd2edd9..144f8eb7 100644 --- a/screener/migrations/0047_incomestream_hours_worked.py +++ b/screener/migrations/0047_incomestream_hours_worked.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0046_alter_screen_uuid"), + ('screener', '0046_alter_screen_uuid'), ] operations = [ migrations.AddField( - model_name="incomestream", - name="hours_worked", + model_name='incomestream', + name='hours_worked', field=models.IntegerField(null=True), ), ] diff --git a/screener/migrations/0048_screen_needs_family_planning_help.py b/screener/migrations/0048_screen_needs_family_planning_help.py index 2a7f76eb..ebc5c318 100644 --- a/screener/migrations/0048_screen_needs_family_planning_help.py +++ b/screener/migrations/0048_screen_needs_family_planning_help.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0047_incomestream_hours_worked"), + ('screener', '0047_incomestream_hours_worked'), ] operations = [ migrations.AddField( - model_name="screen", - name="needs_family_planning_help", + model_name='screen', + name='needs_family_planning_help', field=models.BooleanField(blank=True, default=False, null=True), ), ] diff --git a/screener/migrations/0049_eligibilitysnapshot_batch.py b/screener/migrations/0049_eligibilitysnapshot_batch.py index 4c3142eb..00664c9c 100644 --- a/screener/migrations/0049_eligibilitysnapshot_batch.py +++ b/screener/migrations/0049_eligibilitysnapshot_batch.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0048_screen_needs_family_planning_help"), + ('screener', '0048_screen_needs_family_planning_help'), ] operations = [ migrations.AddField( - model_name="eligibilitysnapshot", - name="batch", + model_name='eligibilitysnapshot', + name='batch', field=models.BooleanField(default=False), ), ] diff --git a/screener/migrations/0050_rename_batch_eligibilitysnapshot_is_batch.py b/screener/migrations/0050_rename_batch_eligibilitysnapshot_is_batch.py index 84ba7698..65329ee0 100644 --- a/screener/migrations/0050_rename_batch_eligibilitysnapshot_is_batch.py +++ b/screener/migrations/0050_rename_batch_eligibilitysnapshot_is_batch.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0049_eligibilitysnapshot_batch"), + ('screener', '0049_eligibilitysnapshot_batch'), ] operations = [ migrations.RenameField( - model_name="eligibilitysnapshot", - old_name="batch", - new_name="is_batch", + model_name='eligibilitysnapshot', + old_name='batch', + new_name='is_batch', ), ] diff --git a/screener/migrations/0051_programeligibilitysnapshot_new.py b/screener/migrations/0051_programeligibilitysnapshot_new.py index aed99351..fe09c847 100644 --- a/screener/migrations/0051_programeligibilitysnapshot_new.py +++ b/screener/migrations/0051_programeligibilitysnapshot_new.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0050_rename_batch_eligibilitysnapshot_is_batch"), + ('screener', '0050_rename_batch_eligibilitysnapshot_is_batch'), ] operations = [ migrations.AddField( - model_name="programeligibilitysnapshot", - name="new", + model_name='programeligibilitysnapshot', + name='new', field=models.BooleanField(default=False), ), ] diff --git a/screener/migrations/0052_alter_expense_household_member.py b/screener/migrations/0052_alter_expense_household_member.py index 63d6119a..b9230f44 100644 --- a/screener/migrations/0052_alter_expense_household_member.py +++ b/screener/migrations/0052_alter_expense_household_member.py @@ -5,19 +5,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0051_programeligibilitysnapshot_new"), + ('screener', '0051_programeligibilitysnapshot_new'), ] operations = [ migrations.AlterField( - model_name="expense", - name="household_member", - field=models.ForeignKey( - null=True, - on_delete=django.db.models.deletion.CASCADE, - related_name="expenses", - to="screener.householdmember", - ), + model_name='expense', + name='household_member', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='expenses', to='screener.householdmember'), ), ] diff --git a/screener/migrations/0053_alter_householdmember_has_expenses_and_more.py b/screener/migrations/0053_alter_householdmember_has_expenses_and_more.py index 7cef8bbb..f80325bb 100644 --- a/screener/migrations/0053_alter_householdmember_has_expenses_and_more.py +++ b/screener/migrations/0053_alter_householdmember_has_expenses_and_more.py @@ -4,19 +4,20 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0052_alter_expense_household_member"), + ('screener', '0052_alter_expense_household_member'), ] operations = [ migrations.AlterField( - model_name="householdmember", - name="has_expenses", + model_name='householdmember', + name='has_expenses', field=models.BooleanField(null=True), ), migrations.AlterField( - model_name="householdmember", - name="has_income", + model_name='householdmember', + name='has_income', field=models.BooleanField(null=True), ), ] diff --git a/screener/migrations/0054_alter_expense_amount_alter_expense_frequency_and_more.py b/screener/migrations/0054_alter_expense_amount_alter_expense_frequency_and_more.py index f2044965..d7bb9d19 100644 --- a/screener/migrations/0054_alter_expense_amount_alter_expense_frequency_and_more.py +++ b/screener/migrations/0054_alter_expense_amount_alter_expense_frequency_and_more.py @@ -4,124 +4,125 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0053_alter_householdmember_has_expenses_and_more"), + ('screener', '0053_alter_householdmember_has_expenses_and_more'), ] operations = [ migrations.AlterField( - model_name="expense", - name="amount", + model_name='expense', + name='amount', field=models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True), ), migrations.AlterField( - model_name="expense", - name="frequency", + model_name='expense', + name='frequency', field=models.CharField(blank=True, max_length=30, null=True), ), migrations.AlterField( - model_name="expense", - name="type", + model_name='expense', + name='type', field=models.CharField(blank=True, max_length=30, null=True), ), migrations.AlterField( - model_name="householdmember", - name="age", + model_name='householdmember', + name='age', field=models.IntegerField(blank=True, null=True), ), migrations.AlterField( - model_name="householdmember", - name="disabled", + model_name='householdmember', + name='disabled', field=models.BooleanField(blank=True, null=True), ), migrations.AlterField( - model_name="householdmember", - name="has_expenses", + model_name='householdmember', + name='has_expenses', field=models.BooleanField(blank=True, null=True), ), migrations.AlterField( - model_name="householdmember", - name="has_income", + model_name='householdmember', + name='has_income', field=models.BooleanField(blank=True, null=True), ), migrations.AlterField( - model_name="householdmember", - name="pregnant", + model_name='householdmember', + name='pregnant', field=models.BooleanField(blank=True, null=True), ), migrations.AlterField( - model_name="householdmember", - name="relationship", + model_name='householdmember', + name='relationship', field=models.CharField(blank=True, max_length=30, null=True), ), migrations.AlterField( - model_name="householdmember", - name="student", + model_name='householdmember', + name='student', field=models.BooleanField(blank=True, null=True), ), migrations.AlterField( - model_name="householdmember", - name="student_full_time", + model_name='householdmember', + name='student_full_time', field=models.BooleanField(blank=True, null=True), ), migrations.AlterField( - model_name="householdmember", - name="unemployed", + model_name='householdmember', + name='unemployed', field=models.BooleanField(blank=True, null=True), ), migrations.AlterField( - model_name="householdmember", - name="veteran", + model_name='householdmember', + name='veteran', field=models.BooleanField(blank=True, null=True), ), migrations.AlterField( - model_name="householdmember", - name="visually_impaired", + model_name='householdmember', + name='visually_impaired', field=models.BooleanField(blank=True, null=True), ), migrations.AlterField( - model_name="householdmember", - name="worked_in_last_18_mos", + model_name='householdmember', + name='worked_in_last_18_mos', field=models.BooleanField(blank=True, null=True), ), migrations.AlterField( - model_name="incomestream", - name="amount", + model_name='incomestream', + name='amount', field=models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True), ), migrations.AlterField( - model_name="incomestream", - name="frequency", + model_name='incomestream', + name='frequency', field=models.CharField(blank=True, max_length=30, null=True), ), migrations.AlterField( - model_name="incomestream", - name="hours_worked", + model_name='incomestream', + name='hours_worked', field=models.IntegerField(blank=True, null=True), ), migrations.AlterField( - model_name="incomestream", - name="type", + model_name='incomestream', + name='type', field=models.CharField(blank=True, max_length=30, null=True), ), migrations.AlterField( - model_name="screen", - name="agree_to_tos", + model_name='screen', + name='agree_to_tos', field=models.BooleanField(blank=True, null=True), ), migrations.AlterField( - model_name="screen", - name="household_size", + model_name='screen', + name='household_size', field=models.IntegerField(blank=True, null=True), ), migrations.AlterField( - model_name="screen", - name="submission_date", + model_name='screen', + name='submission_date', field=models.DateTimeField(blank=True, null=True), ), migrations.AlterField( - model_name="screen", - name="zipcode", + model_name='screen', + name='zipcode', field=models.CharField(blank=True, max_length=5, null=True), ), ] diff --git a/screener/migrations/0055_screen_has_andcs_screen_has_benefits_and_more.py b/screener/migrations/0055_screen_has_andcs_screen_has_benefits_and_more.py index 0499cd39..07b3a853 100644 --- a/screener/migrations/0055_screen_has_andcs_screen_has_benefits_and_more.py +++ b/screener/migrations/0055_screen_has_andcs_screen_has_benefits_and_more.py @@ -4,59 +4,60 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0054_alter_expense_amount_alter_expense_frequency_and_more"), + ('screener', '0054_alter_expense_amount_alter_expense_frequency_and_more'), ] operations = [ migrations.AddField( - model_name="screen", - name="has_andcs", + model_name='screen', + name='has_andcs', field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name="screen", - name="has_benefits", - field=models.CharField(blank=True, default="preferNotToAnswer", max_length=32, null=True), + model_name='screen', + name='has_benefits', + field=models.CharField(blank=True, default='preferNotToAnswer', max_length=32, null=True), ), migrations.AddField( - model_name="screen", - name="has_cdhcs", + model_name='screen', + name='has_cdhcs', field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name="screen", - name="has_chs", + model_name='screen', + name='has_chs', field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name="screen", - name="has_cpcr", + model_name='screen', + name='has_cpcr', field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name="screen", - name="has_dpp", + model_name='screen', + name='has_dpp', field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name="screen", - name="has_ede", + model_name='screen', + name='has_ede', field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name="screen", - name="has_erc", + model_name='screen', + name='has_erc', field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name="screen", - name="has_leap", + model_name='screen', + name='has_leap', field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name="screen", - name="has_oap", + model_name='screen', + name='has_oap', field=models.BooleanField(blank=True, default=False, null=True), ), ] diff --git a/screener/migrations/0056_screen_completed.py b/screener/migrations/0056_screen_completed.py index e2ed6944..38f8afa1 100644 --- a/screener/migrations/0056_screen_completed.py +++ b/screener/migrations/0056_screen_completed.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0055_screen_has_andcs_screen_has_benefits_and_more"), + ('screener', '0055_screen_has_andcs_screen_has_benefits_and_more'), ] operations = [ migrations.AddField( - model_name="screen", - name="completed", + model_name='screen', + name='completed', field=models.BooleanField(default=True), preserve_default=False, ), diff --git a/screener/migrations/0057_screen_has_coctc_screen_has_upk.py b/screener/migrations/0057_screen_has_coctc_screen_has_upk.py index c31e431e..5df00262 100644 --- a/screener/migrations/0057_screen_has_coctc_screen_has_upk.py +++ b/screener/migrations/0057_screen_has_coctc_screen_has_upk.py @@ -4,19 +4,20 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0056_screen_completed"), + ('screener', '0056_screen_completed'), ] operations = [ migrations.AddField( - model_name="screen", - name="has_coctc", + model_name='screen', + name='has_coctc', field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name="screen", - name="has_upk", + model_name='screen', + name='has_upk', field=models.BooleanField(blank=True, default=False, null=True), ), ] diff --git a/screener/migrations/0058_webhookfunctions_webhooks_webhookstranslation.py b/screener/migrations/0058_webhookfunctions_webhooks_webhookstranslation.py index 9535fb58..d0b6c4f7 100644 --- a/screener/migrations/0058_webhookfunctions_webhooks_webhookstranslation.py +++ b/screener/migrations/0058_webhookfunctions_webhooks_webhookstranslation.py @@ -7,54 +7,46 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0057_screen_has_coctc_screen_has_upk"), + ('screener', '0057_screen_has_coctc_screen_has_upk'), ] operations = [ migrations.CreateModel( - name="WebHookFunctions", + name='WebHookFunctions', fields=[ - ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), - ("name", models.CharField(max_length=64)), + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=64)), ], ), migrations.CreateModel( - name="WebHooks", + name='WebHooks', fields=[ - ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), - ("referrer_code", models.CharField(max_length=120)), - ("url", models.CharField(max_length=320)), + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('referrer_code', models.CharField(max_length=120)), + ('url', models.CharField(max_length=320)), ], options={ - "abstract": False, + 'abstract': False, }, bases=(parler.models.TranslatableModelMixin, models.Model), ), migrations.CreateModel( - name="WebHooksTranslation", + name='WebHooksTranslation', fields=[ - ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), - ("language_code", models.CharField(db_index=True, max_length=15, verbose_name="Language")), - ("consent_text", models.TextField()), - ( - "master", - parler.fields.TranslationsForeignKey( - editable=False, - null=True, - on_delete=django.db.models.deletion.CASCADE, - related_name="translations", - to="screener.webhooks", - ), - ), + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('language_code', models.CharField(db_index=True, max_length=15, verbose_name='Language')), + ('consent_text', models.TextField()), + ('master', parler.fields.TranslationsForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='screener.webhooks')), ], options={ - "verbose_name": "web hooks Translation", - "db_table": "screener_webhooks_translation", - "db_tablespace": "", - "managed": True, - "default_permissions": (), - "unique_together": {("language_code", "master")}, + 'verbose_name': 'web hooks Translation', + 'db_table': 'screener_webhooks_translation', + 'db_tablespace': '', + 'managed': True, + 'default_permissions': (), + 'unique_together': {('language_code', 'master')}, }, bases=(parler.models.TranslatedFieldsModelMixin, models.Model), ), diff --git a/screener/migrations/0059_webhook_webhookfunction_webhooktranslation_and_more.py b/screener/migrations/0059_webhook_webhookfunction_webhooktranslation_and_more.py index ace290bc..936b95c4 100644 --- a/screener/migrations/0059_webhook_webhookfunction_webhooktranslation_and_more.py +++ b/screener/migrations/0059_webhook_webhookfunction_webhooktranslation_and_more.py @@ -7,77 +7,69 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0058_webhookfunctions_webhooks_webhookstranslation"), + ('screener', '0058_webhookfunctions_webhooks_webhookstranslation'), ] operations = [ migrations.CreateModel( - name="WebHook", + name='WebHook', fields=[ - ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), - ("referrer_code", models.CharField(max_length=120)), - ("url", models.CharField(max_length=320)), + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('referrer_code', models.CharField(max_length=120)), + ('url', models.CharField(max_length=320)), ], options={ - "abstract": False, + 'abstract': False, }, bases=(parler.models.TranslatableModelMixin, models.Model), ), migrations.CreateModel( - name="WebHookFunction", + name='WebHookFunction', fields=[ - ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), - ("name", models.CharField(max_length=64)), + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=64)), ], ), migrations.CreateModel( - name="WebHookTranslation", + name='WebHookTranslation', fields=[ - ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), - ("language_code", models.CharField(db_index=True, max_length=15, verbose_name="Language")), - ("consent_text", models.TextField()), - ( - "master", - parler.fields.TranslationsForeignKey( - editable=False, - null=True, - on_delete=django.db.models.deletion.CASCADE, - related_name="translations", - to="screener.webhook", - ), - ), + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('language_code', models.CharField(db_index=True, max_length=15, verbose_name='Language')), + ('consent_text', models.TextField()), + ('master', parler.fields.TranslationsForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='screener.webhook')), ], options={ - "verbose_name": "web hook Translation", - "db_table": "screener_webhook_translation", - "db_tablespace": "", - "managed": True, - "default_permissions": (), - "unique_together": {("language_code", "master")}, + 'verbose_name': 'web hook Translation', + 'db_table': 'screener_webhook_translation', + 'db_tablespace': '', + 'managed': True, + 'default_permissions': (), + 'unique_together': {('language_code', 'master')}, }, bases=(parler.models.TranslatedFieldsModelMixin, models.Model), ), migrations.DeleteModel( - name="WebHookFunctions", + name='WebHookFunctions', ), migrations.AlterUniqueTogether( - name="webhookstranslation", + name='webhookstranslation', unique_together=None, ), migrations.RemoveField( - model_name="webhookstranslation", - name="master", + model_name='webhookstranslation', + name='master', ), migrations.DeleteModel( - name="WebHooks", + name='WebHooks', ), migrations.DeleteModel( - name="WebHooksTranslation", + name='WebHooksTranslation', ), migrations.AddField( - model_name="webhook", - name="functions", - field=models.ManyToManyField(related_name="function", to="screener.webhookfunction"), + model_name='webhook', + name='functions', + field=models.ManyToManyField(related_name='function', to='screener.webhookfunction'), ), ] diff --git a/screener/migrations/0060_screen_is_test_data.py b/screener/migrations/0060_screen_is_test_data.py index 77b681cf..95e95ddf 100644 --- a/screener/migrations/0060_screen_is_test_data.py +++ b/screener/migrations/0060_screen_is_test_data.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0059_webhook_webhookfunction_webhooktranslation_and_more"), + ('screener', '0059_webhook_webhookfunction_webhooktranslation_and_more'), ] operations = [ migrations.AddField( - model_name="screen", - name="is_test_data", + model_name='screen', + name='is_test_data', field=models.BooleanField(blank=True, default=False), ), ] diff --git a/screener/migrations/0061_alter_screen_is_test_data.py b/screener/migrations/0061_alter_screen_is_test_data.py index 65e46c3b..809b2542 100644 --- a/screener/migrations/0061_alter_screen_is_test_data.py +++ b/screener/migrations/0061_alter_screen_is_test_data.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0060_screen_is_test_data"), + ('screener', '0060_screen_is_test_data'), ] operations = [ migrations.AlterField( - model_name="screen", - name="is_test_data", + model_name='screen', + name='is_test_data', field=models.BooleanField(blank=True), ), ] diff --git a/screener/migrations/0062_alter_screen_is_test_data.py b/screener/migrations/0062_alter_screen_is_test_data.py index 8d5e8b56..22abc76a 100644 --- a/screener/migrations/0062_alter_screen_is_test_data.py +++ b/screener/migrations/0062_alter_screen_is_test_data.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0061_alter_screen_is_test_data"), + ('screener', '0061_alter_screen_is_test_data'), ] operations = [ migrations.AlterField( - model_name="screen", - name="is_test_data", + model_name='screen', + name='is_test_data', field=models.BooleanField(blank=True, null=True), ), ] diff --git a/screener/migrations/0063_alter_webhooktranslation_unique_together_and_more.py b/screener/migrations/0063_alter_webhooktranslation_unique_together_and_more.py index eb14c3ad..1bceb48f 100644 --- a/screener/migrations/0063_alter_webhooktranslation_unique_together_and_more.py +++ b/screener/migrations/0063_alter_webhooktranslation_unique_together_and_more.py @@ -4,26 +4,27 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0062_alter_screen_is_test_data"), + ('screener', '0062_alter_screen_is_test_data'), ] operations = [ migrations.AlterUniqueTogether( - name="webhooktranslation", + name='webhooktranslation', unique_together=None, ), migrations.RemoveField( - model_name="webhooktranslation", - name="master", + model_name='webhooktranslation', + name='master', ), migrations.DeleteModel( - name="WebHook", + name='WebHook', ), migrations.DeleteModel( - name="WebHookFunction", + name='WebHookFunction', ), migrations.DeleteModel( - name="WebHookTranslation", + name='WebHookTranslation', ), ] diff --git a/screener/migrations/0064_screen_needs_dental_care_help_and_more.py b/screener/migrations/0064_screen_needs_dental_care_help_and_more.py index 9d483c51..6f41d27f 100644 --- a/screener/migrations/0064_screen_needs_dental_care_help_and_more.py +++ b/screener/migrations/0064_screen_needs_dental_care_help_and_more.py @@ -4,24 +4,25 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0063_alter_webhooktranslation_unique_together_and_more"), + ('screener', '0063_alter_webhooktranslation_unique_together_and_more'), ] operations = [ migrations.AddField( - model_name="screen", - name="needs_dental_care_help", + model_name='screen', + name='needs_dental_care_help', field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name="screen", - name="needs_job_resources", + model_name='screen', + name='needs_job_resources', field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name="screen", - name="needs_legal_services", + model_name='screen', + name='needs_legal_services', field=models.BooleanField(blank=True, default=False, null=True), ), ] diff --git a/screener/migrations/0065_rename_needs_dental_care_help_screen_needs_dental_care.py b/screener/migrations/0065_rename_needs_dental_care_help_screen_needs_dental_care.py index 10ee521d..72b4b84a 100644 --- a/screener/migrations/0065_rename_needs_dental_care_help_screen_needs_dental_care.py +++ b/screener/migrations/0065_rename_needs_dental_care_help_screen_needs_dental_care.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0064_screen_needs_dental_care_help_and_more"), + ('screener', '0064_screen_needs_dental_care_help_and_more'), ] operations = [ migrations.RenameField( - model_name="screen", - old_name="needs_dental_care_help", - new_name="needs_dental_care", + model_name='screen', + old_name='needs_dental_care_help', + new_name='needs_dental_care', ), ] diff --git a/screener/migrations/0066_screen_is_13_or_older.py b/screener/migrations/0066_screen_is_13_or_older.py index f48e87c7..d4b9553c 100644 --- a/screener/migrations/0066_screen_is_13_or_older.py +++ b/screener/migrations/0066_screen_is_13_or_older.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0065_rename_needs_dental_care_help_screen_needs_dental_care"), + ('screener', '0065_rename_needs_dental_care_help_screen_needs_dental_care'), ] operations = [ migrations.AddField( - model_name="screen", - name="is_13_or_older", + model_name='screen', + name='is_13_or_older', field=models.BooleanField(blank=True, null=True), ), ] diff --git a/screener/migrations/0067_alter_expense_household_member_alter_screen_user.py b/screener/migrations/0067_alter_expense_household_member_alter_screen_user.py index 4f5c1320..b0efdc35 100644 --- a/screener/migrations/0067_alter_expense_household_member_alter_screen_user.py +++ b/screener/migrations/0067_alter_expense_household_member_alter_screen_user.py @@ -6,31 +6,21 @@ class Migration(migrations.Migration): + dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ("screener", "0066_screen_is_13_or_older"), + ('screener', '0066_screen_is_13_or_older'), ] operations = [ migrations.AlterField( - model_name="expense", - name="household_member", - field=models.ForeignKey( - null=True, - on_delete=django.db.models.deletion.SET_NULL, - related_name="expenses", - to="screener.householdmember", - ), + model_name='expense', + name='household_member', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='expenses', to='screener.householdmember'), ), migrations.AlterField( - model_name="screen", - name="user", - field=models.ForeignKey( - blank=True, - null=True, - on_delete=django.db.models.deletion.SET_NULL, - related_name="screens", - to=settings.AUTH_USER_MODEL, - ), + model_name='screen', + name='user', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='screens', to=settings.AUTH_USER_MODEL), ), ] diff --git a/screener/migrations/0068_householdmember_insurance.py b/screener/migrations/0068_householdmember_insurance.py index eabbbba4..9d1d2106 100644 --- a/screener/migrations/0068_householdmember_insurance.py +++ b/screener/migrations/0068_householdmember_insurance.py @@ -4,28 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0067_alter_expense_household_member_alter_screen_user"), + ('screener', '0067_alter_expense_household_member_alter_screen_user'), ] operations = [ migrations.AddField( - model_name="householdmember", - name="insurance", - field=models.CharField( - choices=[ - ("dont_know", "Dont Know"), - ("none", "None"), - ("employer", "Employer"), - ("private", "Private"), - ("chp", "Chp"), - ("medicaid", "Medicaid"), - ("medicare", "Medicare"), - ("emergency_medicaid", "Emergency Medicaid"), - ("family_planning", "Family Planning"), - ], - default="dont_know", - max_length=64, - ), + model_name='householdmember', + name='insurance', + field=models.CharField(choices=[('dont_know', 'Dont Know'), ('none', 'None'), ('employer', 'Employer'), ('private', 'Private'), ('chp', 'Chp'), ('medicaid', 'Medicaid'), ('medicare', 'Medicare'), ('emergency_medicaid', 'Emergency Medicaid'), ('family_planning', 'Family Planning')], default='dont_know', max_length=64), ), ] diff --git a/screener/migrations/0069_alter_screen_has_chp_hi_alter_screen_has_employer_hi_and_more.py b/screener/migrations/0069_alter_screen_has_chp_hi_alter_screen_has_employer_hi_and_more.py index 17c16f92..27ab9d63 100644 --- a/screener/migrations/0069_alter_screen_has_chp_hi_alter_screen_has_employer_hi_and_more.py +++ b/screener/migrations/0069_alter_screen_has_chp_hi_alter_screen_has_employer_hi_and_more.py @@ -4,39 +4,40 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0068_householdmember_insurance"), + ('screener', '0068_householdmember_insurance'), ] operations = [ migrations.AlterField( - model_name="screen", - name="has_chp_hi", + model_name='screen', + name='has_chp_hi', field=models.BooleanField(blank=True, default=None, null=True), ), migrations.AlterField( - model_name="screen", - name="has_employer_hi", + model_name='screen', + name='has_employer_hi', field=models.BooleanField(blank=True, default=None, null=True), ), migrations.AlterField( - model_name="screen", - name="has_medicaid_hi", + model_name='screen', + name='has_medicaid_hi', field=models.BooleanField(blank=True, default=None, null=True), ), migrations.AlterField( - model_name="screen", - name="has_medicare_hi", + model_name='screen', + name='has_medicare_hi', field=models.BooleanField(blank=True, default=None, null=True), ), migrations.AlterField( - model_name="screen", - name="has_no_hi", + model_name='screen', + name='has_no_hi', field=models.BooleanField(blank=True, default=None, null=True), ), migrations.AlterField( - model_name="screen", - name="has_private_hi", + model_name='screen', + name='has_private_hi', field=models.BooleanField(blank=True, default=None, null=True), ), ] diff --git a/screener/migrations/0070_remove_programeligibilitysnapshot_legal_status_required.py b/screener/migrations/0070_remove_programeligibilitysnapshot_legal_status_required.py index be878856..7735ee07 100644 --- a/screener/migrations/0070_remove_programeligibilitysnapshot_legal_status_required.py +++ b/screener/migrations/0070_remove_programeligibilitysnapshot_legal_status_required.py @@ -4,13 +4,14 @@ class Migration(migrations.Migration): + dependencies = [ - ("screener", "0069_alter_screen_has_chp_hi_alter_screen_has_employer_hi_and_more"), + ('screener', '0069_alter_screen_has_chp_hi_alter_screen_has_employer_hi_and_more'), ] operations = [ migrations.RemoveField( - model_name="programeligibilitysnapshot", - name="legal_status_required", + model_name='programeligibilitysnapshot', + name='legal_status_required', ), ] diff --git a/screener/migrations/0074_alter_screen_household_assets.py b/screener/migrations/0074_alter_screen_household_assets.py index 534b039c..00a2cb39 100644 --- a/screener/migrations/0074_alter_screen_household_assets.py +++ b/screener/migrations/0074_alter_screen_household_assets.py @@ -12,6 +12,8 @@ class Migration(migrations.Migration): migrations.AlterField( model_name="screen", name="household_assets", - field=models.DecimalField(blank=True, decimal_places=2, default=0, max_digits=10, null=True), + field=models.DecimalField( + blank=True, decimal_places=2, default=0, max_digits=10, null=True + ), ), ] diff --git a/screener/migrations/0075_alter_screen_household_assets.py b/screener/migrations/0075_alter_screen_household_assets.py index 51896937..045f3d6e 100644 --- a/screener/migrations/0075_alter_screen_household_assets.py +++ b/screener/migrations/0075_alter_screen_household_assets.py @@ -12,6 +12,8 @@ class Migration(migrations.Migration): migrations.AlterField( model_name="screen", name="household_assets", - field=models.DecimalField(blank=True, decimal_places=2, default=None, max_digits=10, null=True), + field=models.DecimalField( + blank=True, decimal_places=2, default=None, max_digits=10, null=True + ), ), ] diff --git a/screener/models.py b/screener/models.py index 0f25cd14..93420b75 100644 --- a/screener/models.py +++ b/screener/models.py @@ -30,10 +30,10 @@ class Screen(models.Model): is_test = models.BooleanField(default=False, blank=True) is_test_data = models.BooleanField(blank=True, null=True) is_verified = models.BooleanField(default=False, blank=True) - user = models.ForeignKey(User, related_name="screens", on_delete=models.SET_NULL, blank=True, null=True) + user = models.ForeignKey(User, related_name='screens', on_delete=models.SET_NULL, blank=True, null=True) external_id = models.CharField(max_length=120, blank=True, null=True) request_language_code = models.CharField(max_length=12, blank=True, null=True) - has_benefits = models.CharField(max_length=32, default="preferNotToAnswer", blank=True, null=True) + has_benefits = models.CharField(max_length=32, default='preferNotToAnswer', blank=True, null=True) has_tanf = models.BooleanField(default=False, blank=True, null=True) has_wic = models.BooleanField(default=False, blank=True, null=True) has_snap = models.BooleanField(default=False, blank=True, null=True) @@ -115,13 +115,15 @@ def has_expense(self, expense_types): return True return False - def num_children(self, age_min=0, age_max=18, include_pregnant=False, child_relationship=["all"]): + def num_children(self, age_min=0, age_max=18, include_pregnant=False, child_relationship=['all']): children = 0 household_members = self.household_members.all() for household_member in household_members: - has_child_relationship = household_member.relationship in child_relationship or "all" in child_relationship - if household_member.age >= age_min and household_member.age <= age_max and has_child_relationship: + has_child_relationship = household_member.relationship in child_relationship or 'all' in child_relationship + if household_member.age >= age_min and \ + household_member.age <= age_max and \ + has_child_relationship: children += 1 if household_member.pregnant and include_pregnant: children += 1 @@ -138,15 +140,15 @@ def num_adults(self, age_max=19): def num_guardians(self): parents = 0 - child_relationship = ["child", "fosterChild"] - guardian_relationship = ["parent", "fosterParent"] + child_relationship = ['child', 'fosterChild'] + guardian_relationship = ['parent', 'fosterParent'] hoh_child_exists = False household_members = self.household_members.all() for household_member in household_members: if household_member.relationship in child_relationship: hoh_child_exists = True - elif household_member.relationship == "headOfHousehold": + elif household_member.relationship == 'headOfHousehold': if household_member.pregnant: hoh_child_exists = True elif household_member.pregnant: @@ -155,9 +157,9 @@ def num_guardians(self): parents += 1 for household_member in household_members: - if hoh_child_exists and household_member.relationship == "spouse": + if hoh_child_exists and household_member.relationship == 'spouse': parents += 1 - elif hoh_child_exists and household_member.relationship == "headOfHousehold": + elif hoh_child_exists and household_member.relationship == 'headOfHousehold': parents += 1 return parents @@ -166,7 +168,7 @@ def is_joint(self): is_joint = False household_members = self.household_members.all() for household_member in household_members: - if household_member.relationship == "spouse": + if household_member.relationship == 'spouse': is_joint = True return is_joint @@ -184,38 +186,35 @@ def relationship_map(self): all_members = self.household_members.values() for member in all_members: - if member["id"] in relationship_map and relationship_map[member["id"]] is not None: + if member['id'] in relationship_map and relationship_map[member['id']] is not None: continue - relationship = member["relationship"] + relationship = member['relationship'] probable_spouse = None - if relationship == "headOfHousehold": + if relationship == 'headOfHousehold': for other_member in all_members: - if ( - other_member["relationship"] in ("spouse", "domesticPartner") - and other_member["id"] not in relationship_map - ): - probable_spouse = other_member["id"] + if other_member['relationship'] in ('spouse', 'domesticPartner') and\ + other_member['id'] not in relationship_map: + probable_spouse = other_member['id'] break - elif relationship in ("spouse", "domesticPartner"): + elif relationship in ('spouse', 'domesticPartner'): for other_member in all_members: - if other_member["relationship"] == "headOfHousehold" and other_member["id"] not in relationship_map: - probable_spouse = other_member["id"] + if other_member['relationship'] == 'headOfHousehold' and\ + other_member['id'] not in relationship_map: + probable_spouse = other_member['id'] break - elif relationship in ("parent", "fosterParent", "stepParent", "grandParent"): + elif relationship in ('parent', 'fosterParent', 'stepParent', 'grandParent'): for other_member in all_members: - if ( - other_member["relationship"] == relationship - and other_member["id"] != member["id"] - and other_member["id"] not in relationship_map - ): - probable_spouse = other_member["id"] + if other_member['relationship'] == relationship and\ + other_member['id'] != member['id'] and\ + other_member['id'] not in relationship_map: + probable_spouse = other_member['id'] break - relationship_map[member["id"]] = probable_spouse + relationship_map[member['id']] = probable_spouse if probable_spouse is not None: - relationship_map[probable_spouse] = member["id"] + relationship_map[probable_spouse] = member['id'] return relationship_map @@ -228,40 +227,40 @@ def has_insurance_types(self, types, strict=True): def has_benefit(self, name_abbreviated): name_map = { - "tanf": self.has_tanf, - "wic": self.has_wic, - "snap": self.has_snap, - "lifeline": self.has_lifeline, - "acp": self.has_acp, - "eitc": self.has_eitc, - "coeitc": self.has_coeitc, - "nslp": self.has_nslp, - "ctc": self.has_ctc, - "rtdlive": self.has_rtdlive, - "cccap": self.has_cccap, - "mydenver": self.has_mydenver, - "ccb": self.has_ccb, - "ssi": self.has_ssi or self.calc_gross_income("yearly", ("sSI",)) > 0, - "andcs": self.has_andcs, - "chs": self.has_chs, - "cpcr": self.has_cpcr, - "cdhcs": self.has_cdhcs, - "dpp": self.has_dpp, - "ede": self.has_ede, - "erc": self.has_erc, - "leap": self.has_leap, - "oap": self.has_oap, - "coctc": self.has_coctc, - "upk": self.has_upk, - "ssdi": self.has_ssdi or self.calc_gross_income("yearly", ("sSDisability",)) > 0, - "pell_grant": self.has_pell_grant, - "rag": self.has_rag, - "cowap": self.has_cowap, - "ubp": self.has_ubp, - "medicaid": self.has_medicaid or self.has_medicaid_hi, - "medicare": self.has_medicare_hi, - "chp": self.has_chp or self.has_chp_hi, - "va": self.has_va, + 'tanf': self.has_tanf, + 'wic': self.has_wic, + 'snap': self.has_snap, + 'lifeline': self.has_lifeline, + 'acp': self.has_acp, + 'eitc': self.has_eitc, + 'coeitc': self.has_coeitc, + 'nslp': self.has_nslp, + 'ctc': self.has_ctc, + 'rtdlive': self.has_rtdlive, + 'cccap': self.has_cccap, + 'mydenver': self.has_mydenver, + 'ccb': self.has_ccb, + 'ssi': self.has_ssi or self.calc_gross_income('yearly', ('sSI',)) > 0, + 'andcs': self.has_andcs, + 'chs': self.has_chs, + 'cpcr': self.has_cpcr, + 'cdhcs': self.has_cdhcs, + 'dpp': self.has_dpp, + 'ede': self.has_ede, + 'erc': self.has_erc, + 'leap': self.has_leap, + 'oap': self.has_oap, + 'coctc': self.has_coctc, + 'upk': self.has_upk, + 'ssdi': self.has_ssdi or self.calc_gross_income('yearly', ('sSDisability',)) > 0, + 'pell_grant': self.has_pell_grant, + 'rag': self.has_rag, + 'cowap': self.has_cowap, + 'ubp': self.has_ubp, + 'medicaid': self.has_medicaid or self.has_medicaid_hi, + 'medicare': self.has_medicare_hi, + 'chp': self.has_chp or self.has_chp_hi, + 'va': self.has_va, } has_insurance = self.has_insurance_types((name_abbreviated,), strict=False) @@ -274,21 +273,19 @@ def has_benefit(self, name_abbreviated): return has_insurance or has_benefit def set_screen_is_test(self): - referral_source_tests = ["testorprospect", "test"] + referral_source_tests = ['testorprospect', 'test'] - self.is_test_data = ( - self.is_test - or (self.referral_source is not None and self.referral_source.lower() in referral_source_tests) - or (self.referrer_code is not None and self.referrer_code.lower() in referral_source_tests) - ) + self.is_test_data = self.is_test or \ + (self.referral_source is not None and self.referral_source.lower() in referral_source_tests) or \ + (self.referrer_code is not None and self.referrer_code.lower() in referral_source_tests) self.save() def get_head(self): for member in self.household_members.all(): - if member.relationship == "headOfHousehold": + if member.relationship == 'headOfHousehold': return member - raise Exception("No head of household") + raise Exception('No head of household') def get_language_code(self): language_code = settings.LANGUAGE_CODE @@ -299,7 +296,7 @@ def get_language_code(self): return language_code def missing_fields(self): - screen_fields = ("zipcode", "county", "household_size", "household_assets") + screen_fields = ('zipcode', 'county', 'household_size', 'household_assets') missing_fields = Dependencies() @@ -320,7 +317,7 @@ def missing_fields(self): class Message(models.Model): sent = models.DateTimeField(auto_now=True) type = models.CharField(max_length=30) - screen = models.ForeignKey(Screen, related_name="messages", on_delete=models.CASCADE) + screen = models.ForeignKey(Screen, related_name='messages', on_delete=models.CASCADE) content = models.CharField(max_length=320, blank=True, null=True) uid = models.IntegerField(blank=True, null=True) @@ -328,7 +325,7 @@ class Message(models.Model): # Table of fields specific to individual household members. Parent model is the # Screen class HouseholdMember(models.Model): - screen = models.ForeignKey(Screen, related_name="household_members", on_delete=models.CASCADE) + screen = models.ForeignKey(Screen, related_name='household_members', on_delete=models.CASCADE) relationship = models.CharField(max_length=30, blank=True, null=True) age = models.IntegerField(blank=True, null=True) student = models.BooleanField(blank=True, null=True) @@ -384,13 +381,13 @@ def calc_net_income(self, frequency, income_types, expense_types): return float(net_income) def is_married(self): - if self.relationship in ("spouse", "domesticPartner"): - head_of_house = HouseholdMember.objects.all().filter(screen=self.screen, relationship="headOfHousehold")[0] + if self.relationship in ('spouse', 'domesticPartner'): + head_of_house = HouseholdMember.objects.all().filter(screen=self.screen, relationship='headOfHousehold')[0] return {"is_married": True, "married_to": head_of_house} - if self.relationship == "headOfHousehold": + if self.relationship == 'headOfHousehold': all_household_members = HouseholdMember.objects.all().filter(screen=self.screen) for member in all_household_members: - if member.relationship in ("spouse", "domesticPartner"): + if member.relationship in ('spouse', 'domesticPartner'): return {"is_married": True, "married_to": member} return {"is_married": False} @@ -398,7 +395,7 @@ def has_disability(self): return self.disabled or self.visually_impaired or self.long_term_disability def is_head(self): - return self.relationship == "headOfHousehold" + return self.relationship == 'headOfHousehold' def is_spouse(self): return self.screen.relationship_map()[self.screen.get_head().id] == self.id @@ -407,8 +404,15 @@ def is_dependent(self): is_tax_unit_spouse = self.is_spouse() is_tax_unit_head = self.is_head() is_tax_unit_dependent = ( - (self.age <= 18 or (self.student and self.age <= 23) or self.has_disability()) - and (self.calc_gross_income("yearly", ["all"]) <= self.screen.calc_gross_income("yearly", ["all"]) / 2) + ( + self.age <= 18 + or (self.student and self.age <= 23) + or self.has_disability() + ) + and ( + self.calc_gross_income('yearly', ['all']) + <= self.screen.calc_gross_income('yearly', ['all']) / 2 + ) and (not (is_tax_unit_head or is_tax_unit_spouse)) ) @@ -419,14 +423,14 @@ def is_in_household(self): def missing_fields(self): member_fields = ( - "relationship", - "age", - "student", - "pregnant", - "visually_impaired", - "disabled", - "long_term_disability", - "insurance", + 'relationship', + 'age', + 'student', + 'pregnant', + 'visually_impaired', + 'disabled', + 'long_term_disability', + 'insurance' ) missing_fields = Dependencies() @@ -443,8 +447,8 @@ def missing_fields(self): # HouseholdMember income streams class IncomeStream(models.Model): - screen = models.ForeignKey(Screen, related_name="income_streams", on_delete=models.CASCADE) - household_member = models.ForeignKey(HouseholdMember, related_name="income_streams", on_delete=models.CASCADE) + screen = models.ForeignKey(Screen, related_name='income_streams', on_delete=models.CASCADE) + household_member = models.ForeignKey(HouseholdMember, related_name='income_streams', on_delete=models.CASCADE) type = models.CharField(max_length=30, blank=True, null=True) amount = models.DecimalField(decimal_places=2, max_digits=10, blank=True, null=True) frequency = models.CharField(max_length=30, blank=True, null=True) @@ -486,24 +490,20 @@ def _hour_to_month(self): return self.amount * self.hours_worked * Decimal(4.35) def missing_fields(self): - income_fields = ( - "type", - "amount", - "frequency", - ) + income_fields = ('type', 'amount', 'frequency',) missing_fields = Dependencies() for field in income_fields: if getattr(self, field) is None: - missing_fields.add("income_" + field) + missing_fields.add('income_' + field) return missing_fields # HouseholdMember expenses class Expense(models.Model): - screen = models.ForeignKey(Screen, related_name="expenses", on_delete=models.CASCADE) - household_member = models.ForeignKey(HouseholdMember, related_name="expenses", on_delete=models.SET_NULL, null=True) + screen = models.ForeignKey(Screen, related_name='expenses', on_delete=models.CASCADE) + household_member = models.ForeignKey(HouseholdMember, related_name='expenses', on_delete=models.SET_NULL, null=True) type = models.CharField(max_length=30, blank=True, null=True) amount = models.DecimalField(decimal_places=2, max_digits=10, blank=True, null=True) frequency = models.CharField(max_length=30, blank=True, null=True) @@ -536,20 +536,23 @@ def yearly(self): return yearly def missing_fields(self): - expense_fields = ("type", "amount") + expense_fields = ('type', 'amount') missing_fields = Dependencies() for field in expense_fields: if getattr(self, field) is None: - missing_fields.add("expense_" + field) + missing_fields.add('expense_' + field) return missing_fields class Insurance(models.Model): household_member = models.OneToOneField( - HouseholdMember, related_name="insurance", null=False, on_delete=models.CASCADE + HouseholdMember, + related_name='insurance', + null=False, + on_delete=models.CASCADE ) dont_know = models.BooleanField(default=False) none = models.BooleanField(default=True) @@ -563,14 +566,14 @@ class Insurance(models.Model): va = models.BooleanField(default=False) def has_insurance_types(self, types, strict=True): - if "none" in types: - types = (*types, "dont_know") + if 'none' in types: + types = (*types, 'dont_know') insurance = self.insurance_map() for hi_type in types: if hi_type not in insurance: if strict: - raise KeyError(f"{hi_type} not in insurance types") + raise KeyError(f'{hi_type} not in insurance types') continue if insurance[hi_type]: @@ -580,16 +583,16 @@ def has_insurance_types(self, types, strict=True): def insurance_map(self): return { - "dont_know": self.dont_know, - "none": self.none, - "employer": self.employer, - "private": self.private, - "chp": self.chp, - "medicaid": self.medicaid, - "medicare": self.medicare, - "emergency_medicaid": self.emergency_medicaid, - "family_planning": self.family_planning, - "va": self.va, + 'dont_know': self.dont_know, + 'none': self.none, + 'employer': self.employer, + 'private': self.private, + 'chp': self.chp, + 'medicaid': self.medicaid, + 'medicare': self.medicare, + 'emergency_medicaid': self.emergency_medicaid, + 'family_planning': self.family_planning, + 'va': self.va, } @@ -597,7 +600,7 @@ def insurance_map(self): # for a completed screen. This table is currently used primarily for analytics # but will eventually drive new benefit update notifications class EligibilitySnapshot(models.Model): - screen = models.ForeignKey(Screen, related_name="eligibility_snapshots", on_delete=models.CASCADE) + screen = models.ForeignKey(Screen, related_name='eligibility_snapshots', on_delete=models.CASCADE) submission_date = models.DateTimeField(auto_now=True) is_batch = models.BooleanField(default=False) @@ -605,9 +608,7 @@ class EligibilitySnapshot(models.Model): # Eligibility results for each specific program per screen. These are # aggregated per screen using the EligibilitySnapshot id class ProgramEligibilitySnapshot(models.Model): - eligibility_snapshot = models.ForeignKey( - EligibilitySnapshot, related_name="program_snapshots", on_delete=models.CASCADE - ) + eligibility_snapshot = models.ForeignKey(EligibilitySnapshot, related_name='program_snapshots', on_delete=models.CASCADE) new = models.BooleanField(default=False) name = models.CharField(max_length=320) name_abbreviated = models.CharField(max_length=32) diff --git a/screener/one_time_scripts.py b/screener/one_time_scripts.py index 8cbbcf61..8ad8f55d 100644 --- a/screener/one_time_scripts.py +++ b/screener/one_time_scripts.py @@ -11,119 +11,18 @@ def generate_bwf_snapshots(): - bwf_ids = [ - "123", - "121001", - "119201", - "119151", - "118901", - "119001", - "118751", - "118301", - "118001", - "117651", - "117501", - "117451", - "116601", - "116551", - "116351", - "116151", - "115851", - "115801", - "114751", - "114501", - "114401", - "114201", - "114001", - "113901", - "113651", - "113501", - "113451", - "111301", - "108751", - "108151", - "107101", - "106551", - "106201", - "101901", - "101701", - "100451", - "100201", - "95051", - "93801", - "82751", - "82701", - "77151", - "71851", - "71051", - "70851", - "70751", - "70701", - "70351", - "70301", - "70201", - "68651", - "67401", - "67001", - "66651", - "66601", - "66301", - "65851", - "65101", - "65001", - "64951", - "64801", - "64751", - "62951", - "59051", - "59001", - "58801", - "58201", - "57851", - "57651", - "57601", - "56801", - "56351", - "56101", - "55901", - "55801", - "55501", - "55451", - "55051", - "54951", - "54801", - "54751", - "54551", - "76501", - "54151", - "53351", - "53051", - "52701", - "52351", - "52301", - "52151", - "51601", - "51151", - "51001", - "49901", - "49851", - "49551", - "49251", - "48901", - "48701", - "48551", - "48501", - "48401", - "47751", - "46951", - "46751", - "46151", - "46001", - "41201", - "40701", - "40101", - ] - screens = Screen.objects.filter(external_id__in=bwf_ids).order_by("-submission_date") + bwf_ids = ['123', '121001', '119201', '119151', '118901', '119001', '118751', '118301', '118001', '117651', + '117501', '117451', '116601', '116551', '116351', '116151', '115851', '115801', '114751', '114501', + '114401', '114201', '114001', '113901', '113651', '113501', '113451', '111301', '108751', '108151', + '107101', '106551', '106201', '101901', '101701', '100451', '100201', '95051', '93801', '82751', + '82701', '77151', '71851', '71051', '70851', '70751', '70701', '70351', '70301', '70201', '68651', + '67401', '67001', '66651', '66601', '66301', '65851', '65101', '65001', '64951', '64801', '64751', + '62951', '59051', '59001', '58801', '58201', '57851', '57651', '57601', '56801', '56351', '56101', + '55901', '55801', '55501', '55451', '55051', '54951', '54801', '54751', '54551', '76501', '54151', + '53351', '53051', '52701', '52351', '52301', '52151', '51601', '51151', '51001', '49901', '49851', + '49551', '49251', '48901', '48701', '48551', '48501', '48401', '47751', '46951', '46751', '46151', + '46001', '41201', '40701', '40101'] + screens = Screen.objects.filter(external_id__in=bwf_ids).order_by('-submission_date') total_screens = screens.count() print("Total BWF Screens found: " + str(total_screens)) @@ -143,58 +42,13 @@ def generate_bwf_snapshots(): eligibility_snapshot.save() eligibility_snapshot.generate_program_snapshots() count += 1 - print( - "Snapshot " - + str(count) - + "/" - + str(total_screens_without_snapshots) - + " generated for " - + str(screen.external_id) - ) + print("Snapshot " + str(count) + "/" + str(total_screens_without_snapshots) + " generated for " + str(screen.external_id)) def generate_nav_snapshots(): - nav_ids = [ - "3171", - "3183", - "3200", - "3230", - "3233", - "3243", - "3245", - "3248", - "3260", - "3373", - "3374", - "3375", - "3376", - "3377", - "3300", - "3301", - "3310", - "3312", - "3313", - "3316", - "3343", - "3363", - "3364", - "3365", - "3368", - "3397", - "3398", - "3399", - "2686", - "2693", - "2690", - "2688", - "2694", - "2707", - "2715", - "2710", - "2711", - "2709", - "2713", - ] + nav_ids = ['3171', '3183', '3200', '3230', '3233', '3243', '3245', '3248', '3260', '3373', '3374', '3375', '3376', + '3377', '3300', '3301', '3310', '3312', '3313', '3316', '3343', '3363', '3364', '3365', '3368', '3397', + '3398', '3399', '2686', '2693', '2690', '2688', '2694', '2707', '2715', '2710', '2711', '2709', '2713'] screens = Screen.objects.filter(id__in=nav_ids) total_screens = screens.count() @@ -208,7 +62,7 @@ def generate_nav_snapshots(): def generate_bia_sample_snapshot(): - nav_ids = ["4097", "4147", "4148", "4149"] + nav_ids = ['4097', '4147', '4148', '4149'] screens = Screen.objects.filter(id__in=nav_ids) total_screens = screens.count() @@ -222,36 +76,40 @@ def generate_bia_sample_snapshot(): def add_from_json(new_json_str): - """ + ''' Add json string from screen endpoint as parameter. Use triple quotes if in shell - """ + ''' new_json = json.loads(new_json_str) screen = Screen.objects.create( - **{k: v for k, v in new_json.items() if k not in ("household_members", "id", "uuid", "user", "expenses")}, - ) + **{k: v for k, v in new_json.items() if k not in ('household_members', 'id', 'uuid', 'user', 'expenses')}, + ) members = [] incomes = [] expenses = [] - for member in new_json["household_members"]: - household_member = {k: v for k, v in member.items() if k not in ("income_streams", "expenses", "screen", "id")} + for member in new_json['household_members']: + household_member = {k: v for k, v in member.items() if k not in ('income_streams', 'expenses', 'screen', 'id')} member_model = HouseholdMember(**household_member, screen=screen) members.append(member_model) - for income in member["income_streams"]: - income = {k: v for k, v in income.items() if k not in ("household_member", "screen", "id")} - incomes.append(IncomeStream(**income, screen=screen, household_member=member_model)) - for expense in new_json["expenses"]: - expense = {k: v for k, v in expense.items() if k not in ("household_member", "screen", "id")} - expenses.append(Expense(**expense, screen=screen, household_member=member_model)) + for income in member['income_streams']: + income = {k: v for k, v in income.items() if k not in ('household_member', 'screen', 'id')} + incomes.append(IncomeStream(**income, + screen=screen, + household_member=member_model)) + for expense in new_json['expenses']: + expense = {k: v for k, v in expense.items() if k not in ('household_member', 'screen', 'id')} + expenses.append(Expense(**expense, + screen=screen, + household_member=member_model)) HouseholdMember.objects.bulk_create(members) IncomeStream.objects.bulk_create(incomes) Expense.objects.bulk_create(expenses) - print("id:", screen.id) - print("uuid:", screen.uuid) + print('id:', screen.id) + print('uuid:', screen.uuid) def uniqueUUIDs(): @@ -260,12 +118,12 @@ def uniqueUUIDs(): currentUUIDs = [] for screen in screens: if screen.uuid in currentUUIDs: - print(screen.uuid, "was replaced") + print(screen.uuid, 'was replaced') screen.uuid = uuid.uuid4() screen.save() currentUUIDs.append(screen.uuid) - print("done") + print('done') def update_is_test_data(): @@ -274,7 +132,7 @@ def update_is_test_data(): for screen in screens: screen.set_screen_is_test() - print("done") + print('done') def fix_insurance(): @@ -290,4 +148,4 @@ def fix_insurance(): member.insurance = Insurance.objects.create(household_member=member) member.save() - print("done") + print('done') diff --git a/screener/serializers.py b/screener/serializers.py index fe0bbdda..e6186af5 100644 --- a/screener/serializers.py +++ b/screener/serializers.py @@ -8,7 +8,7 @@ class MessageSerializer(serializers.ModelSerializer): class Meta: model = Message - fields = "__all__" + fields = '__all__' class InsuranceSerializer(serializers.ModelSerializer): @@ -16,8 +16,8 @@ class InsuranceSerializer(serializers.ModelSerializer): class Meta: model = Insurance - fields = "__all__" - read_only_fields = ("household_member",) + fields = '__all__' + read_only_fields = ('household_member',) class IncomeStreamSerializer(serializers.ModelSerializer): @@ -25,8 +25,8 @@ class IncomeStreamSerializer(serializers.ModelSerializer): class Meta: model = IncomeStream - fields = "__all__" - read_only_fields = ("screen", "household_member", "id") + fields = '__all__' + read_only_fields = ('screen', 'household_member', 'id') class ExpenseSerializer(serializers.ModelSerializer): @@ -34,8 +34,8 @@ class ExpenseSerializer(serializers.ModelSerializer): class Meta: model = Expense - fields = "__all__" - read_only_fields = ("screen", "household_member", "id") + fields = '__all__' + read_only_fields = ('screen', 'household_member', 'id') class HouseholdMemberSerializer(serializers.ModelSerializer): @@ -45,26 +45,26 @@ class HouseholdMemberSerializer(serializers.ModelSerializer): class Meta: model = HouseholdMember fields = ( - "id", - "screen", - "relationship", - "age", - "student", - "student_full_time", - "pregnant", - "unemployed", - "worked_in_last_18_mos", - "visually_impaired", - "disabled", - "long_term_disability", - "veteran", - "medicaid", - "disability_medicaid", - "has_income", - "income_streams", - "insurance", + 'id', + 'screen', + 'relationship', + 'age', + 'student', + 'student_full_time', + 'pregnant', + 'unemployed', + 'worked_in_last_18_mos', + 'visually_impaired', + 'disabled', + 'long_term_disability', + 'veteran', + 'medicaid', + 'disability_medicaid', + 'has_income', + 'income_streams', + 'insurance', ) - read_only_fields = ("screen", "id") + read_only_fields = ('screen', 'id') class ScreenSerializer(serializers.ModelSerializer): @@ -75,98 +75,98 @@ class ScreenSerializer(serializers.ModelSerializer): class Meta: model = Screen fields = ( - "id", - "uuid", - "completed", - "is_test", - "is_test_data", - "start_date", - "submission_date", - "agree_to_tos", - "is_13_or_older", - "zipcode", - "county", - "referral_source", - "referrer_code", - "household_size", - "household_assets", - "housing_situation", - "household_members", - "last_email_request_date", - "last_tax_filing_year", - "expenses", - "user", - "external_id", - "request_language_code", - "has_benefits", - "has_tanf", - "has_wic", - "has_snap", - "has_lifeline", - "has_acp", - "has_eitc", - "has_coeitc", - "has_nslp", - "has_ctc", - "has_medicaid", - "has_rtdlive", - "has_cccap", - "has_mydenver", - "has_chp", - "has_ccb", - "has_ssi", - "has_andcs", - "has_chs", - "has_cpcr", - "has_cdhcs", - "has_dpp", - "has_ede", - "has_erc", - "has_leap", - "has_oap", - "has_coctc", - "has_upk", - "has_ssdi", - "has_cowap", - "has_ubp", - "has_pell_grant", - "has_rag", - "has_employer_hi", - "has_private_hi", - "has_medicaid_hi", - "has_medicare_hi", - "has_chp_hi", - "has_no_hi", - "has_va", - "needs_food", - "needs_baby_supplies", - "needs_housing_help", - "needs_mental_health_help", - "needs_child_dev_help", - "needs_funeral_help", - "needs_family_planning_help", - "needs_job_resources", - "needs_dental_care", - "needs_legal_services", + 'id', + 'uuid', + 'completed', + 'is_test', + 'is_test_data', + 'start_date', + 'submission_date', + 'agree_to_tos', + 'is_13_or_older', + 'zipcode', + 'county', + 'referral_source', + 'referrer_code', + 'household_size', + 'household_assets', + 'housing_situation', + 'household_members', + 'last_email_request_date', + 'last_tax_filing_year', + 'expenses', + 'user', + 'external_id', + 'request_language_code', + 'has_benefits', + 'has_tanf', + 'has_wic', + 'has_snap', + 'has_lifeline', + 'has_acp', + 'has_eitc', + 'has_coeitc', + 'has_nslp', + 'has_ctc', + 'has_medicaid', + 'has_rtdlive', + 'has_cccap', + 'has_mydenver', + 'has_chp', + 'has_ccb', + 'has_ssi', + 'has_andcs', + 'has_chs', + 'has_cpcr', + 'has_cdhcs', + 'has_dpp', + 'has_ede', + 'has_erc', + 'has_leap', + 'has_oap', + 'has_coctc', + 'has_upk', + 'has_ssdi', + 'has_cowap', + 'has_ubp', + 'has_pell_grant', + 'has_rag', + 'has_employer_hi', + 'has_private_hi', + 'has_medicaid_hi', + 'has_medicare_hi', + 'has_chp_hi', + 'has_no_hi', + 'has_va', + 'needs_food', + 'needs_baby_supplies', + 'needs_housing_help', + 'needs_mental_health_help', + 'needs_child_dev_help', + 'needs_funeral_help', + 'needs_family_planning_help', + 'needs_job_resources', + 'needs_dental_care', + 'needs_legal_services' ) read_only_fields = ( - "id", - "uuid", - "submision_date", - "last_email_request_date", - "completed", - "user", - "is_test_data", + 'id', + 'uuid', + 'submision_date', + 'last_email_request_date', + 'completed', + 'user', + 'is_test_data' ) def create(self, validated_data): - household_members = validated_data.pop("household_members") - expenses = validated_data.pop("expenses") + household_members = validated_data.pop('household_members') + expenses = validated_data.pop('expenses') screen = Screen.objects.create(**validated_data, completed=False) screen.set_screen_is_test() for member in household_members: - incomes = member.pop("income_streams") - insurance = member.pop("insurance") + incomes = member.pop('income_streams') + insurance = member.pop('insurance') household_member = HouseholdMember.objects.create(**member, screen=screen) for income in incomes: IncomeStream.objects.create(**income, screen=screen, household_member=household_member) @@ -176,14 +176,14 @@ def create(self, validated_data): return screen def update(self, instance, validated_data): - household_members = validated_data.pop("household_members") - expenses = validated_data.pop("expenses") + household_members = validated_data.pop('household_members') + expenses = validated_data.pop('expenses') Screen.objects.filter(pk=instance.id).update(**validated_data) HouseholdMember.objects.filter(screen=instance).delete() Expense.objects.filter(screen=instance).delete() for member in household_members: - incomes = member.pop("income_streams") - insurance = member.pop("insurance") + incomes = member.pop('income_streams') + insurance = member.pop('insurance') household_member = HouseholdMember.objects.create(**member, screen=instance) for income in incomes: IncomeStream.objects.create(**income, screen=instance, household_member=household_member) @@ -236,14 +236,14 @@ class EligibilitySerializer(serializers.Serializer): documents = DocumentSerializer(many=True) class Meta: - fields = "__all__" + fields = '__all__' class EligibilityTranslationSerializer(serializers.Serializer): translations = serializers.DictField() class Meta: - fields = ("translations",) + fields = ('translations',) class UrgentNeedSerializer(serializers.Serializer): diff --git a/screener/tests.py b/screener/tests.py index 17958a59..013defb8 100644 --- a/screener/tests.py +++ b/screener/tests.py @@ -8,7 +8,7 @@ def test_create_single_parent_two_children_household(self): self.assertTrue(isinstance(screen, Screen)) -def create_default_household_member(screen, relationship="headOfHousehold", age=25): +def create_default_household_member(screen, relationship='headOfHousehold', age=25): default = screen.household_members.create( relationship=relationship, age=age, @@ -23,7 +23,7 @@ def create_default_household_member(screen, relationship="headOfHousehold", age= medicaid=False, disability_medicaid=False, has_income=True, - has_expenses=True, + has_expenses=True ) return default @@ -34,16 +34,16 @@ def create_default_household_member(screen, relationship="headOfHousehold", age= # 1900 in monthly expenses between childcare and rent # no assets def create_single_parent_two_children_household(annual_income): - screen = Screen.objects.create( - household_assets=0, household_size=3, zipcode="80204", agree_to_tos=True, housing_situation="renting" - ) + screen = Screen.objects.create(household_assets=0, household_size=3, + zipcode='80204', agree_to_tos=True, + housing_situation='renting') parent = create_default_household_member(screen) - parent.expenses.create(type="rent", amount="1200", frequency="monthly", screen=screen) - parent.expenses.create(type="childCare", amount="700", frequency="monthly", screen=screen) - parent.income_streams.create(type="wages", amount=annual_income, frequency="yearly", screen=screen) + parent.expenses.create(type='rent', amount='1200', frequency='monthly', screen=screen) + parent.expenses.create(type='childCare', amount='700', frequency='monthly', screen=screen) + parent.income_streams.create(type='wages', amount=annual_income, frequency='yearly', screen=screen) - create_default_household_member(screen, relationship="child", age=4) - create_default_household_member(screen, relationship="child", age=6) + create_default_household_member(screen, relationship='child', age=4) + create_default_household_member(screen, relationship='child', age=6) return screen diff --git a/screener/urls.py b/screener/urls.py index 04edf7c5..a91e6c6c 100644 --- a/screener/urls.py +++ b/screener/urls.py @@ -3,12 +3,13 @@ from . import views router = routers.DefaultRouter() -router.register(r"screens", views.ScreenViewSet) -router.register(r"messages", views.MessageViewSet) +router.register(r'screens', views.ScreenViewSet) +router.register(r'messages', views.MessageViewSet) urlpatterns = [ - path("", views.index, name="index"), - path("", include(router.urls)), - path("api-auth/", include("rest_framework.urls", namespace="rest_framework")), - path("eligibility/", views.EligibilityTranslationView.as_view(), name="translated screen eligibility endpoint"), + path('', views.index, name='index'), + path('', include(router.urls)), + path('api-auth/', include('rest_framework.urls', namespace='rest_framework')), + path('eligibility/', views.EligibilityTranslationView.as_view(), + name='translated screen eligibility endpoint') ] diff --git a/screener/views.py b/screener/views.py index 36718831..1f4080c2 100644 --- a/screener/views.py +++ b/screener/views.py @@ -50,12 +50,12 @@ class ScreenViewSet( API endpoint that allows screens to be viewed or edited. """ - queryset = Screen.objects.all().order_by("-submission_date") + queryset = Screen.objects.all().order_by('-submission_date') serializer_class = ScreenSerializer permission_classes = [permissions.DjangoModelPermissions] - filterset_fields = ["agree_to_tos", "is_test"] + filterset_fields = ['agree_to_tos', 'is_test'] paginate_by = 10 - paginate_by_param = "page_size" + paginate_by_param = 'page_size' max_paginate_by = 100 def retrieve(self, request, pk=None): @@ -82,7 +82,7 @@ class HouseholdMemberViewSet(viewsets.ModelViewSet): queryset = HouseholdMember.objects.all() serializer_class = HouseholdMemberSerializer permission_classes = [permissions.DjangoModelPermissions] - filterset_fields = ["has_income"] + filterset_fields = ['has_income'] class IncomeStreamViewSet(viewsets.ModelViewSet): @@ -93,7 +93,7 @@ class IncomeStreamViewSet(viewsets.ModelViewSet): queryset = IncomeStream.objects.all() serializer_class = IncomeStreamSerializer permission_classes = [permissions.DjangoModelPermissions] - filterset_fields = ["screen"] + filterset_fields = ['screen'] class ExpenseViewSet(viewsets.ModelViewSet): @@ -104,10 +104,11 @@ class ExpenseViewSet(viewsets.ModelViewSet): queryset = Expense.objects.all() serializer_class = ExpenseSerializer permission_classes = [permissions.DjangoModelPermissions] - filterset_fields = ["screen"] + filterset_fields = ['screen'] class EligibilityView(views.APIView): + def get(self, request, id): data = eligibility_results(id) results = EligibilitySerializer(data, many=True).data @@ -115,6 +116,7 @@ def get(self, request, id): class EligibilityTranslationView(views.APIView): + @swagger_auto_schema(responses={200: ResultsSerializer()}) def get(self, request, id): screen = Screen.objects.get(uuid=id) @@ -144,19 +146,19 @@ class MessageViewSet(mixins.CreateModelMixin, viewsets.GenericViewSet): API endpoint that logs messages sent. """ - queryset = Message.objects.all().order_by("-sent") + queryset = Message.objects.all().order_by('-sent') serializer_class = MessageSerializer permission_classes = [permissions.DjangoModelPermissions] def create(self, request): body = json.loads(request.body.decode()) - screen = Screen.objects.get(uuid=body["screen"]) + screen = Screen.objects.get(uuid=body['screen']) message = MessageUser(screen, screen.get_language_code()) - if "email" in body: - message.email(body["email"], send_tests=True) - if "phone" in body: - message.text("+1" + body["phone"], send_tests=True) + if 'email' in body: + message.email(body['email'], send_tests=True) + if 'phone' in body: + message.text('+1' + body['phone'], send_tests=True) return Response({}, status=status.HTTP_201_CREATED) @@ -169,16 +171,22 @@ def eligibility_results(screen, batch=False): excluded_programs = [] if referrer is not None: - excluded_programs = referrer.remove_programs.values("id") + excluded_programs = referrer.remove_programs.values('id') all_programs = Program.objects.exclude(id__in=excluded_programs).prefetch_related( - "legal_status_required", "documents" + 'legal_status_required', 'documents' ) data = [] try: - previous_snapshot = EligibilitySnapshot.objects.filter(is_batch=False, screen=screen).latest("submission_date") - previous_results = None if previous_snapshot is None else previous_snapshot.program_snapshots.all() + previous_snapshot = EligibilitySnapshot.objects.filter( + is_batch=False, screen=screen + ).latest('submission_date') + previous_results = ( + None + if previous_snapshot is None + else previous_snapshot.program_snapshots.all() + ) except ObjectDoesNotExist: previous_snapshot = None snapshot = EligibilitySnapshot.objects.create(screen=screen, is_batch=batch) @@ -190,7 +198,7 @@ def eligibility_results(screen, batch=False): pe_programs = all_pe_programs def sort_first(program): - calc_first = ("tanf", "ssi", "medicaid", "nslp", "leap") + calc_first = ('tanf', 'ssi', 'medicaid', 'nslp', 'leap') if program.name_abbreviated in calc_first: return 0 @@ -217,21 +225,23 @@ def sort_first(program): eligibility = pe_eligibility[program.name_abbreviated] - all_navigators = program.navigator.all().prefetch_related("counties") + all_navigators = program.navigator.all().prefetch_related('counties') county_navigators = [] for nav in all_navigators: counties = nav.counties.all() - if len(counties) == 0 or ( - screen.county is not None and any(screen.county in county.name for county in counties) - ): + if len(counties) == 0 or (screen.county is not None and any( + screen.county in county.name for county in counties + )): county_navigators.append(nav) if referrer is None: navigators = county_navigators else: primary_navigators = referrer.primary_navigators.all() - referrer_navigators = [nav for nav in primary_navigators if nav in county_navigators] + referrer_navigators = [ + nav for nav in primary_navigators if nav in county_navigators + ] if len(referrer_navigators) == 0: navigators = county_navigators else: @@ -242,14 +252,16 @@ def sort_first(program): for previous_snapshot in previous_results: if ( previous_snapshot.name_abbreviated == program.name_abbreviated - and eligibility["eligible"] == previous_snapshot.eligible + and eligibility['eligible'] == previous_snapshot.eligible ): new = False else: new = False if not skip and program.active: - legal_status = [status.status for status in program.legal_status_required.all()] + legal_status = [ + status.status for status in program.legal_status_required.all() + ] ProgramEligibilitySnapshot.objects.create( eligibility_snapshot=snapshot, name=program.name.text, @@ -269,8 +281,12 @@ def sort_first(program): "name": default_message(program.name), "name_abbreviated": program.name_abbreviated, "estimated_value": eligibility["estimated_value"], - "estimated_delivery_time": default_message(program.estimated_delivery_time), - "estimated_application_time": default_message(program.estimated_application_time), + "estimated_delivery_time": default_message( + program.estimated_delivery_time + ), + "estimated_application_time": default_message( + program.estimated_application_time + ), "description_short": default_message(program.description_short), "short_name": program.name_abbreviated, "description": default_message(program.description), @@ -283,18 +299,22 @@ def sort_first(program): "eligible": eligibility["eligible"], "failed_tests": eligibility["failed"], "passed_tests": eligibility["passed"], - "navigators": [serialized_navigator(navigator) for navigator in navigators], + "navigators": [ + serialized_navigator(navigator) for navigator in navigators + ], "already_has": screen.has_benefit(program.name_abbreviated), "new": new, "low_confidence": program.low_confidence, - "documents": [default_message(d.text) for d in program.documents.all()], + "documents": [ + default_message(d.text) for d in program.documents.all() + ], } ) eligible_programs = [] for program in data: clean_program = program - clean_program["estimated_value"] = math.trunc(clean_program["estimated_value"]) + clean_program['estimated_value'] = math.trunc(clean_program['estimated_value']) eligible_programs.append(clean_program) return eligible_programs, missing_programs @@ -302,7 +322,7 @@ def sort_first(program): def default_message(translation): translation.set_current_language(settings.LANGUAGE_CODE) - return {"default_message": translation.text, "label": translation.label} + return {'default_message': translation.text, 'label': translation.label} def serialized_navigator(navigator): @@ -319,32 +339,44 @@ def serialized_navigator(navigator): def urgent_need_results(screen): possible_needs = { - "food": screen.needs_food, - "baby supplies": screen.needs_baby_supplies, - "housing": screen.needs_housing_help, - "mental health": screen.needs_mental_health_help, - "child dev": screen.needs_child_dev_help, - "funeral": screen.needs_funeral_help, - "family planning": screen.needs_family_planning_help, - "job resources": screen.needs_job_resources, - "dental care": screen.needs_dental_care, - "legal services": screen.needs_legal_services, + 'food': screen.needs_food, + 'baby supplies': screen.needs_baby_supplies, + 'housing': screen.needs_housing_help, + 'mental health': screen.needs_mental_health_help, + 'child dev': screen.needs_child_dev_help, + 'funeral': screen.needs_funeral_help, + 'family planning': screen.needs_family_planning_help, + 'job resources': screen.needs_job_resources, + 'dental care': screen.needs_dental_care, + 'legal services': screen.needs_legal_services, } missing_dependencies = screen.missing_fields() need_functions = { - "denver": urgent_need_functions.LivesInDenver.calc(screen, missing_dependencies), - "meal": urgent_need_functions.MealInCounties.calc(screen, missing_dependencies), - "helpkitchen_zipcode": urgent_need_functions.HelpkitchenZipcode.calc(screen, missing_dependencies), - "child": urgent_need_functions.Child.calc(screen, missing_dependencies), - "bia_food_delivery": urgent_need_functions.BiaFoodDelivery.calc(screen, missing_dependencies), - "trua": urgent_need_functions.Trua.calc(screen, missing_dependencies), - "ffap": urgent_need_functions.ForeclosureFinAssistProgram.calc(screen, missing_dependencies), - "eoc": urgent_need_functions.Eoc.calc(screen, missing_dependencies), - "co_legal_services": urgent_need_functions.CoLegalServices.calc(screen, missing_dependencies), - "co_emergency_mortgage": urgent_need_functions.CoEmergencyMortgageAssistance.calc(screen, missing_dependencies), - "child_first": urgent_need_functions.ChildFirst.calc(screen, missing_dependencies), + 'denver': urgent_need_functions.LivesInDenver.calc( + screen, missing_dependencies + ), + 'meal': urgent_need_functions.MealInCounties.calc( + screen, missing_dependencies + ), + 'helpkitchen_zipcode': urgent_need_functions.HelpkitchenZipcode.calc( + screen, missing_dependencies + ), + 'child': urgent_need_functions.Child.calc(screen, missing_dependencies), + 'bia_food_delivery': urgent_need_functions.BiaFoodDelivery.calc( + screen, missing_dependencies + ), + 'trua': urgent_need_functions.Trua.calc(screen, missing_dependencies), + 'ffap': urgent_need_functions.ForeclosureFinAssistProgram.calc(screen, missing_dependencies), + 'eoc': urgent_need_functions.Eoc.calc(screen, missing_dependencies), + 'co_legal_services': urgent_need_functions.CoLegalServices.calc( + screen, missing_dependencies + ), + 'co_emergency_mortgage': urgent_need_functions.CoEmergencyMortgageAssistance.calc( + screen, missing_dependencies + ), + 'child_first': urgent_need_functions.ChildFirst.calc(screen, missing_dependencies), } list_of_needs = [] @@ -352,7 +384,9 @@ def urgent_need_results(screen): if has_need: list_of_needs.append(need) - urgent_need_resources = UrgentNeed.objects.filter(type_short__name__in=list_of_needs, active=True).distinct() + urgent_need_resources = UrgentNeed.objects.filter( + type_short__name__in=list_of_needs, active=True + ).distinct() eligible_urgent_needs = [] for need in urgent_need_resources: diff --git a/screener/webhooks.py b/screener/webhooks.py index c8cf12dd..624c99e1 100644 --- a/screener/webhooks.py +++ b/screener/webhooks.py @@ -4,7 +4,7 @@ import requests -class Hook: +class Hook(): def __init__(self, hook: Referrer): self.hook = hook self.functions = [func.name for func in hook.webhook_functions.all()] @@ -12,11 +12,11 @@ def __init__(self, hook: Referrer): def send(self, screen: Screen, results: dict): if screen.completed: return - request_data = {"external_id": screen.external_id} - if "send_screen" in self.functions: + request_data = {'external_id': screen.external_id} + if 'send_screen' in self.functions: key, value = self.screen_data(screen) request_data[key] = value - if "send_results" in self.functions: + if 'send_results' in self.functions: key, value = self.send_eligibility(results) request_data[key] = value @@ -28,10 +28,10 @@ def send(self, screen: Screen, results: dict): def screen_data(self, screen: Screen): screen_dict = ScreenSerializer(screen).data - return "screen", screen_dict + return 'screen', screen_dict def send_eligibility(self, results: dict): - return "eligibility", results + return 'eligibility', results def eligibility_hooks(): diff --git a/translations/admin.py b/translations/admin.py index 63f1c69c..e9bcd3a5 100644 --- a/translations/admin.py +++ b/translations/admin.py @@ -4,7 +4,7 @@ class TranslationAdmin(TranslatableAdmin): - search_fields = ("label",) + search_fields = ('label',) admin.site.register(Translation, TranslatableAdmin) diff --git a/translations/apps.py b/translations/apps.py index f21c6589..cfd4a9e5 100644 --- a/translations/apps.py +++ b/translations/apps.py @@ -2,5 +2,5 @@ class TranslationsConfig(AppConfig): - default_auto_field = "django.db.models.BigAutoField" - name = "translations" + default_auto_field = 'django.db.models.BigAutoField' + name = 'translations' diff --git a/translations/bulk_import_translations.py b/translations/bulk_import_translations.py index 95de7137..65b16bc1 100644 --- a/translations/bulk_import_translations.py +++ b/translations/bulk_import_translations.py @@ -9,8 +9,8 @@ @transaction.atomic def bulk_add(translations): - if config("ALLOW_TRANSLATION_IMPORT", "False") != "True": - raise Exception("Translation import not allowed") + if config('ALLOW_TRANSLATION_IMPORT', 'False') != 'True': + raise Exception('Translation import not allowed') protected_translation_ids = [] Translation.objects.select_for_update().all() @@ -28,16 +28,19 @@ def bulk_add(translations): Translation.objects.exclude(id__in=protected_translation_ids).delete() translations_data = list(translations.items()) - for i in trange(len(translations_data), desc="Translations"): + for i in trange(len(translations_data), desc='Translations'): label, details = translations_data[i] translation = Translation.objects.add_translation( - label, details["langs"][settings.LANGUAGE_CODE][0], active=details["active"], no_auto=details["no_auto"] + label, + details['langs'][settings.LANGUAGE_CODE][0], + active=details['active'], + no_auto=details['no_auto'] ) - del details["langs"][settings.LANGUAGE_CODE] + del details['langs'][settings.LANGUAGE_CODE] - if details["reference"] is not False: - ref = details["reference"] - if ref[0] == "programs_program": + if details['reference'] is not False: + ref = details['reference'] + if ref[0] == 'programs_program': try: obj = Program.objects.get(external_name=ref[1]) obj.active = True @@ -45,14 +48,14 @@ def bulk_add(translations): obj = Program.objects.new_program(ref[1]) obj.external_name = ref[1] obj.save() - elif ref[0] == "programs_navigator": + elif ref[0] == 'programs_navigator': try: obj = Navigator.objects.get(external_name=ref[1]) except ObjectDoesNotExist: obj = Navigator.objects.new_navigator(ref[1], None) obj.external_name = ref[1] obj.save() - elif ref[0] == "programs_urgentneed": + elif ref[0] == 'programs_urgentneed': try: obj = UrgentNeed.objects.get(external_name=ref[1]) obj.active = True @@ -60,7 +63,7 @@ def bulk_add(translations): obj = UrgentNeed.objects.new_urgent_need(ref[1], None) obj.external_name = ref[1] obj.save() - elif ref[0] == "programs_document": + elif ref[0] == 'programs_document': try: obj = Document.objects.get(external_name=ref[1]) except ObjectDoesNotExist: @@ -68,8 +71,13 @@ def bulk_add(translations): getattr(translation, ref[2]).set([obj]) - for lang, message in details["langs"].items(): - Translation.objects.edit_translation_by_id(translation.id, lang, message[0], manual=message[1]) + for lang, message in details['langs'].items(): + Translation.objects.edit_translation_by_id( + translation.id, + lang, + message[0], + manual=message[1] + ) def translation_ids(model): diff --git a/translations/management/commands/bulk_export.py b/translations/management/commands/bulk_export.py index fc852287..af39210e 100644 --- a/translations/management/commands/bulk_export.py +++ b/translations/management/commands/bulk_export.py @@ -4,10 +4,10 @@ class Command(BaseCommand): - help = """ + help = ''' Get translation export - """ + ''' def handle(self, *args, **options) -> str: - self.stdout.reconfigure(encoding="utf-8") + self.stdout.reconfigure(encoding='utf-8') return json.dumps(Translation.objects.export_translations(), ensure_ascii=False) diff --git a/translations/management/commands/bulk_import.py b/translations/management/commands/bulk_import.py index 66abce57..b338e70c 100644 --- a/translations/management/commands/bulk_import.py +++ b/translations/management/commands/bulk_import.py @@ -6,24 +6,21 @@ class Command(BaseCommand): - """ + ''' Run on heroku: `heroku run --no-tty -a [HEROKU APP NAME] manage.py bulk_import < [PATH TO FILE]` - """ + ''' - help = """ + help = ''' Get translation export - """ + ''' def add_arguments(self, parser): parser.add_argument( - "data", - nargs="?", - type=argparse.FileType("r", encoding="utf-8"), - default=stdin, + 'data', nargs='?', type=argparse.FileType('r', encoding='utf-8'), default=stdin, ) def handle(self, *args, **options): - data = json.load(options["data"]) + data = json.load(options['data']) bulk_add(data) diff --git a/translations/management/commands/bulk_translate.py b/translations/management/commands/bulk_translate.py index 0d4cca8d..e5c23a63 100644 --- a/translations/management/commands/bulk_translate.py +++ b/translations/management/commands/bulk_translate.py @@ -5,24 +5,24 @@ class Command(BaseCommand): - help = """ + help = ''' Get translation export - """ + ''' def add_arguments(self, parser): - parser.add_argument("--limit", default=1, type=int) - parser.add_argument("--all", default=False, type=bool) - parser.add_argument("--lang", default=settings.LANGUAGE_CODE, type=str) + parser.add_argument('--limit', default=1, type=int) + parser.add_argument('--all', default=False, type=bool) + parser.add_argument('--lang', default=settings.LANGUAGE_CODE, type=str) def handle(self, *args, **options): - limit = 10_000 if options["all"] else min(10_000, options["limit"]) + limit = 10_000 if options['all'] else min(10_000, options['limit']) max_batch_size = 128 char_limit = 5_000 - lang = options["lang"] + lang = options['lang'] translate = Translate() - translations = Translation.objects.prefetch_related("translations").language(settings.LANGUAGE_CODE).all() + translations = Translation.objects.prefetch_related('translations').language(settings.LANGUAGE_CODE).all() total_count = 0 temp_chars = 0 diff --git a/translations/migrations/0001_initial.py b/translations/migrations/0001_initial.py index 1d53c90f..f6231ca7 100644 --- a/translations/migrations/0001_initial.py +++ b/translations/migrations/0001_initial.py @@ -7,47 +7,40 @@ class Migration(migrations.Migration): + initial = True - dependencies = [] + dependencies = [ + ] operations = [ migrations.CreateModel( - name="Translation", + name='Translation', fields=[ - ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), - ("label", models.CharField(max_length=128, unique=True)), + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('label', models.CharField(max_length=128, unique=True)), ], options={ - "abstract": False, + 'abstract': False, }, bases=(parler.models.TranslatableModelMixin, models.Model), ), migrations.CreateModel( - name="TranslationTranslation", + name='TranslationTranslation', fields=[ - ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), - ("language_code", models.CharField(db_index=True, max_length=15, verbose_name="Language")), - ("text", models.TextField(blank=True, null=True)), - ("edited", models.BooleanField(default=False)), - ( - "master", - parler.fields.TranslationsForeignKey( - editable=False, - null=True, - on_delete=django.db.models.deletion.CASCADE, - related_name="translations", - to="translations.translation", - ), - ), + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('language_code', models.CharField(db_index=True, max_length=15, verbose_name='Language')), + ('text', models.TextField(blank=True, null=True)), + ('edited', models.BooleanField(default=False)), + ('master', parler.fields.TranslationsForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='translations.translation')), ], options={ - "verbose_name": "translation Translation", - "db_table": "translations_translation_translation", - "db_tablespace": "", - "managed": True, - "default_permissions": (), - "unique_together": {("language_code", "master")}, + 'verbose_name': 'translation Translation', + 'db_table': 'translations_translation_translation', + 'db_tablespace': '', + 'managed': True, + 'default_permissions': (), + 'unique_together': {('language_code', 'master')}, }, bases=(parler.models.TranslatedFieldsModelMixin, models.Model), ), diff --git a/translations/migrations/0002_translation_active.py b/translations/migrations/0002_translation_active.py index bcb759be..af090adf 100644 --- a/translations/migrations/0002_translation_active.py +++ b/translations/migrations/0002_translation_active.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("translations", "0001_initial"), + ('translations', '0001_initial'), ] operations = [ migrations.AddField( - model_name="translation", - name="active", + model_name='translation', + name='active', field=models.BooleanField(default=True), ), ] diff --git a/translations/migrations/0003_alter_translation_managers.py b/translations/migrations/0003_alter_translation_managers.py index e3ae1db4..264b0024 100644 --- a/translations/migrations/0003_alter_translation_managers.py +++ b/translations/migrations/0003_alter_translation_managers.py @@ -5,15 +5,16 @@ class Migration(migrations.Migration): + dependencies = [ - ("translations", "0002_translation_active"), + ('translations', '0002_translation_active'), ] operations = [ migrations.AlterModelManagers( - name="translation", + name='translation', managers=[ - ("objects", translations.models.TranslationManager()), + ('objects', translations.models.TranslationManager()), ], ), ] diff --git a/translations/migrations/0004_translation_no_auto.py b/translations/migrations/0004_translation_no_auto.py index 7113a986..7af1943b 100644 --- a/translations/migrations/0004_translation_no_auto.py +++ b/translations/migrations/0004_translation_no_auto.py @@ -4,14 +4,15 @@ class Migration(migrations.Migration): + dependencies = [ - ("translations", "0003_alter_translation_managers"), + ('translations', '0003_alter_translation_managers'), ] operations = [ migrations.AddField( - model_name="translation", - name="no_auto", + model_name='translation', + name='no_auto', field=models.BooleanField(default=False), ), ] diff --git a/translations/models.py b/translations/models.py index 81bcc3c9..a94e3900 100644 --- a/translations/models.py +++ b/translations/models.py @@ -8,7 +8,7 @@ class TranslationManager(TranslatableManager): def add_translation(self, label, default_message, active=True, no_auto=False): default_lang = settings.LANGUAGE_CODE - parent = self.get_or_create(label=label, defaults={"active": active, "no_auto": no_auto})[0] + parent = self.get_or_create(label=label, defaults={'active': active, 'no_auto': no_auto})[0] if parent.active != active or parent.active != no_auto: parent.active = active parent.no_auto = no_auto @@ -21,7 +21,7 @@ def edit_translation(self, label, lang, translation, manual=True): parent = self.language(lang).get(label=label) lang_trans = parent.get_lang(lang) - is_edited = lang_trans is not None and lang_trans.edited is True and lang_trans.text != "" + is_edited = lang_trans is not None and lang_trans.edited is True and lang_trans.text != '' if manual is False and (is_edited or parent.no_auto): return parent @@ -31,10 +31,10 @@ def edit_translation(self, label, lang, translation, manual=True): return parent def edit_translation_by_id(self, id, lang, translation, manual=True): - parent = self.prefetch_related("translations").language(lang).get(pk=id) + parent = self.prefetch_related('translations').language(lang).get(pk=id) lang_trans = parent.get_lang(lang) - is_edited = lang_trans is not None and lang_trans.edited is True and lang_trans.text != "" + is_edited = lang_trans is not None and lang_trans.edited is True and lang_trans.text != '' if manual is False and (is_edited or parent.no_auto): return parent @@ -43,8 +43,8 @@ def edit_translation_by_id(self, id, lang, translation, manual=True): parent.save() return parent - def all_translations(self, langs=[lang["code"] for lang in settings.PARLER_LANGUAGES[None]]): - translations = self.prefetch_related("translations") + def all_translations(self, langs=[lang['code'] for lang in settings.PARLER_LANGUAGES[None]]): + translations = self.prefetch_related('translations') translations_dict = {} for lang in langs: lang_translations = {} @@ -57,7 +57,7 @@ def all_translations(self, langs=[lang["code"] for lang in settings.PARLER_LANGU def export_translations(self): all_langs = settings.PARLER_LANGUAGES[None] - translations = self.prefetch_related("translations") + translations = self.prefetch_related('translations') translations_export = {} for translation in translations: @@ -67,22 +67,23 @@ def export_translations(self): continue translations_export[translation.label] = { - "active": translation.active, - "no_auto": translation.no_auto, - "langs": {}, - "reference": reference, + 'active': translation.active, + 'no_auto': translation.no_auto, + 'langs': {}, + 'reference': reference, } for lang in all_langs: - translation.set_current_language(lang["code"]) - translations_export[translation.label]["langs"][lang["code"]] = (translation.text, translation.edited) + translation.set_current_language(lang['code']) + translations_export[translation.label]['langs'][lang['code']] = (translation.text, translation.edited) return translations_export class Translation(TranslatableModel): translations = TranslatedFields( - text=models.TextField(null=True, blank=True), edited=models.BooleanField(default=False, null=False) + text=models.TextField(null=True, blank=True), + edited=models.BooleanField(default=False, null=False) ) active = models.BooleanField(default=True, null=False) no_auto = models.BooleanField(default=False, null=False) @@ -98,7 +99,7 @@ def in_program(self): # https://stackoverflow.com/questions/54711671/django-how-to-determine-if-an-object-is-referenced-by-any-other-object has_relationship = False for reverse in (f for f in self._meta.get_fields() if f.auto_created and not f.concrete): - if reverse.related_name == "translations": + if reverse.related_name == 'translations': continue name = reverse.get_accessor_name() has_reverse_other = getattr(self, name).count() diff --git a/translations/urls.py b/translations/urls.py index 4ef097cc..62e42591 100644 --- a/translations/urls.py +++ b/translations/urls.py @@ -3,27 +3,27 @@ urlpatterns = [ - path("", views.TranslationView.as_view()), - path("admin", views.admin_view), - path("admin/filter", views.filter_view), - path("admin/create", views.create_translation_view), - path("admin/programs", views.programs_view), - path("admin/programs/filter", views.programs_filter_view), - path("admin/programs/create", views.create_program_view), - path("admin/programs/", views.program_view), - path("admin/navigators", views.navigators_view), - path("admin/navigators/filter", views.navigator_filter_view), - path("admin/navigators/create", views.create_navigator_view), - path("admin/navigators/", views.navigator_view), - path("admin/documents", views.documents_view), - path("admin/documents/filter", views.document_filter_view), - path("admin/documents/create", views.create_document_view), - path("admin/documents/", views.document_view), - path("admin/urgent_needs", views.urgent_needs_view), - path("admin/urgent_needs/filter", views.urgent_need_filter_view), - path("admin/urgent_needs/create", views.create_urgent_need_view), - path("admin/urgent_needs/", views.urgent_need_view), - path("admin/", views.translation_view), - path("admin//", views.edit_translation), - path("admin///auto", views.auto_translate), + path('', views.TranslationView.as_view()), + path('admin', views.admin_view), + path('admin/filter', views.filter_view), + path('admin/create', views.create_translation_view), + path('admin/programs', views.programs_view), + path('admin/programs/filter', views.programs_filter_view), + path('admin/programs/create', views.create_program_view), + path('admin/programs/', views.program_view), + path('admin/navigators', views.navigators_view), + path('admin/navigators/filter', views.navigator_filter_view), + path('admin/navigators/create', views.create_navigator_view), + path('admin/navigators/', views.navigator_view), + path('admin/documents', views.documents_view), + path('admin/documents/filter', views.document_filter_view), + path('admin/documents/create', views.create_document_view), + path('admin/documents/', views.document_view), + path('admin/urgent_needs', views.urgent_needs_view), + path('admin/urgent_needs/filter', views.urgent_need_filter_view), + path('admin/urgent_needs/create', views.create_urgent_need_view), + path('admin/urgent_needs/', views.urgent_need_view), + path('admin/', views.translation_view), + path('admin//', views.edit_translation), + path('admin///auto', views.auto_translate), ] diff --git a/translations/views.py b/translations/views.py index b3e0db6a..049ba724 100644 --- a/translations/views.py +++ b/translations/views.py @@ -14,9 +14,10 @@ class TranslationView(views.APIView): + def get(self, request): - language = request.query_params.get("lang") - all_langs = [lang["code"] for lang in settings.PARLER_LANGUAGES[None]] + language = request.query_params.get('lang') + all_langs = [lang['code'] for lang in settings.PARLER_LANGUAGES[None]] if language in all_langs: translations = Translation.objects.all_translations([language]) @@ -28,27 +29,27 @@ def get(self, request): class NewTranslationForm(forms.Form): label = forms.CharField(max_length=128) - default_message = forms.CharField(widget=forms.Textarea(attrs={"name": "text", "rows": 3, "cols": 50})) + default_message = forms.CharField(widget=forms.Textarea(attrs={'name': 'text', 'rows': 3, 'cols': 50})) -@login_required(login_url="/admin/login") +@login_required(login_url='/admin/login') @staff_member_required def admin_view(request): - if request.method == "GET": + if request.method == 'GET': translations = Translation.objects.all() context = { - "translations": translations, + 'translations': translations, } return render(request, "main.html", context) - elif request.method == "POST": + elif request.method == 'POST': form = NewTranslationForm(request.POST) if form.is_valid(): - text = form["default_message"].value() - translation = Translation.objects.add_translation(form["label"].value(), text) + text = form['default_message'].value() + translation = Translation.objects.add_translation(form['label'].value(), text) - auto_translations = Translate().bulk_translate(["__all__"], [text])[text] + auto_translations = Translate().bulk_translate(['__all__'], [text])[text] for [language, auto_text] in auto_translations.items(): Translation.objects.edit_translation_by_id(translation.id, language, auto_text, False) @@ -58,28 +59,33 @@ def admin_view(request): return response -@login_required(login_url="/admin/login") +@login_required(login_url='/admin/login') @staff_member_required def create_translation_view(request): - context = {"form": NewTranslationForm(), "route": "/api/translations/admin"} + context = { + 'form': NewTranslationForm(), + 'route': '/api/translations/admin' + } return render(request, "util/create_form.html", context) -@login_required(login_url="/admin/login") +@login_required(login_url='/admin/login') @staff_member_required def filter_view(request): - translations = Translation.objects.filter(label__contains=request.GET.get("label", "")).translated( - text__contains=request.GET.get("text", "") - ) + translations = Translation.objects \ + .filter(label__contains=request.GET.get('label', '')) \ + .translated(text__contains=request.GET.get('text', '')) - context = {"translations": translations} + context = { + 'translations': translations + } return render(request, "translations.html", context) class TranslationForm(forms.Form): - text = forms.CharField(widget=forms.Textarea(attrs={"name": "text", "rows": 3, "cols": 50}), required=False) + text = forms.CharField(widget=forms.Textarea(attrs={'name': 'text', 'rows': 3, 'cols': 50}), required=False) class LabelForm(forms.Form): @@ -88,87 +94,89 @@ class LabelForm(forms.Form): no_auto = forms.BooleanField(required=False) -@login_required(login_url="/admin/login") +@login_required(login_url='/admin/login') @staff_member_required def translation_view(request, id=0): - if request.method == "GET": - translation = Translation.objects.prefetch_related("translations").get(pk=id) - langs = [lang["code"] for lang in settings.PARLER_LANGUAGES[None]] + if request.method == 'GET': + translation = Translation.objects.prefetch_related('translations').get(pk=id) + langs = [lang['code'] for lang in settings.PARLER_LANGUAGES[None]] - translations = {t.language_code: TranslationForm({"text": t.text}) for t in translation.translations.all()} + translations = {t.language_code: TranslationForm({'text': t.text}) for t in translation.translations.all()} for lang in langs: if lang not in translations: translations[lang] = TranslationForm() context = { - "translation": translation, - "langs": translations, - "label_form": LabelForm( - {"label": translation.label, "active": translation.active, "no_auto": translation.no_auto} - ), + 'translation': translation, + 'langs': translations, + 'label_form': LabelForm({ + 'label': translation.label, + 'active': translation.active, + 'no_auto': translation.no_auto + }) } return render(request, "edit/main.html", context) - elif request.method == "POST": + elif request.method == 'POST': form = LabelForm(request.POST) if form.is_valid(): translation = Translation.objects.get(pk=id) - translation.label = form["label"].value() - translation.active = form["active"].value() - translation.no_auto = form["no_auto"].value() + translation.label = form['label'].value() + translation.active = form['active'].value() + translation.no_auto = form['no_auto'].value() translation.save() context = { - "form": LabelForm( - {"label": translation.label, "active": translation.active, "no_auto": translation.no_auto} - ) + 'form': LabelForm({ + 'label': translation.label, + 'active': translation.active, + 'no_auto': translation.no_auto + }) } return render(request, "edit/form.html", context) - elif request.method == "DELETE": + elif request.method == 'DELETE': try: Translation.objects.get(pk=id).delete() except ProtectedError: return render( request, - "error.html", - { - "error_message": "Please delete the program that this translation is attached to if you want to delete this translation" - }, + 'error.html', + {"error_message": "Please delete the program that this translation is attached to if you want to delete this translation"} ) response = HttpResponse() response.headers["HX-Redirect"] = "/api/translations/admin" return response -@login_required(login_url="/admin/login") +@login_required(login_url='/admin/login') @staff_member_required -def edit_translation(request, id=0, lang="en-us"): - if request.method == "POST": +def edit_translation(request, id=0, lang='en-us'): + if request.method == 'POST': form = TranslationForm(request.POST) if form.is_valid(): - text = form["text"].value() + text = form['text'].value() translation = Translation.objects.edit_translation_by_id(id, lang, text) if lang == settings.LANGUAGE_CODE: - translations = Translate().bulk_translate(["__all__"], [text])[text] + translations = Translate().bulk_translate(['__all__'], [text])[text] for [language, translation] in translations.items(): Translation.objects.edit_translation_by_id(id, language, translation, False) parent = Translation.objects.get(pk=id) - forms = {t.language_code: TranslationForm({"text": t.text}) for t in parent.translations.all()} + forms = {t.language_code: TranslationForm({'text': t.text}) for t in parent.translations.all()} context = { - "translation": parent, - "langs": forms, + 'translation': parent, + 'langs': forms, } return render(request, "edit/langs.html", context) -@login_required(login_url="/admin/login") +@login_required(login_url='/admin/login') @staff_member_required -def auto_translate(request, id=0, lang="en-us"): - if request.method == "POST": +def auto_translate(request, id=0, lang='en-us'): + if request.method == 'POST': translation = Translation.objects.language(settings.LANGUAGE_CODE).get(pk=id) auto = Translate().translate(lang, translation.text) @@ -179,9 +187,9 @@ def auto_translate(request, id=0, lang="en-us"): new_translation.save() context = { - "form": TranslationForm({"text": new_translation.text}), - "lang": lang, - "translation": translation, + 'form': TranslationForm({'text': new_translation.text}), + 'lang': lang, + 'translation': translation, } return render(request, "edit/lang_form.html", context) @@ -190,55 +198,64 @@ class NewProgramForm(forms.Form): name_abbreviated = forms.CharField(max_length=120) -@login_required(login_url="/admin/login") +@login_required(login_url='/admin/login') @staff_member_required def programs_view(request): - if request.method == "GET": + if request.method == 'GET': programs = Program.objects.all() - context = {"programs": programs} + context = { + 'programs': programs + } - return render(request, "programs/main.html", context) - elif request.method == "POST": + return render(request, 'programs/main.html', context) + elif request.method == 'POST': form = NewProgramForm(request.POST) if form.is_valid(): program = Program.objects.new_program( - form["name_abbreviated"].value(), + form['name_abbreviated'].value(), ) response = HttpResponse() response.headers["HX-Redirect"] = f"/api/translations/admin/programs/{program.id}" return response -@login_required(login_url="/admin/login") +@login_required(login_url='/admin/login') @staff_member_required def create_program_view(request): - if request.method == "GET": - context = {"form": NewProgramForm(), "route": "/api/translations/admin/programs"} + if request.method == 'GET': + context = { + 'form': NewProgramForm(), + 'route': '/api/translations/admin/programs' + } - return render(request, "util/create_form.html", context) + return render(request, 'util/create_form.html', context) -@login_required(login_url="/admin/login") +@login_required(login_url='/admin/login') @staff_member_required def program_view(request, id=0): - if request.method == "GET": + if request.method == 'GET': program = Program.objects.get(pk=id) - context = {"program": program} + context = { + 'program': program + } - return render(request, "programs/program.html", context) + return render(request, 'programs/program.html', context) -@login_required(login_url="/admin/login") +@login_required(login_url='/admin/login') @staff_member_required def programs_filter_view(request): - if request.method == "GET": + if request.method == 'GET': programs = Program.objects.all() - query = request.GET.get("name", "") + query = request.GET.get('name', '') programs = filter(lambda p: query in p.name.text, programs) - context = {"programs": programs} + context = { + 'programs': programs + } - return render(request, "programs/list.html", context) + return render(request, 'programs/list.html', context) class NewNavigatorForm(forms.Form): @@ -246,57 +263,66 @@ class NewNavigatorForm(forms.Form): phone_number = PhoneNumberField(required=False) -@login_required(login_url="/admin/login") +@login_required(login_url='/admin/login') @staff_member_required def navigators_view(request): - if request.method == "GET": + if request.method == 'GET': navigators = Navigator.objects.all() - context = {"navigators": navigators} + context = { + 'navigators': navigators + } - return render(request, "navigators/main.html", context) - if request.method == "POST": + return render(request, 'navigators/main.html', context) + if request.method == 'POST': form = NewNavigatorForm(request.POST) if form.is_valid(): navigator = Navigator.objects.new_navigator( - form["label"].value(), - form["phone_number"].value(), + form['label'].value(), + form['phone_number'].value(), ) response = HttpResponse() response.headers["HX-Redirect"] = f"/api/translations/admin/navigators/{navigator.id}" return response -@login_required(login_url="/admin/login") +@login_required(login_url='/admin/login') @staff_member_required def create_navigator_view(request): - if request.method == "GET": - context = {"form": NewNavigatorForm(), "route": "/api/translations/admin/navigators"} + if request.method == 'GET': + context = { + 'form': NewNavigatorForm(), + 'route': '/api/translations/admin/navigators' + } - return render(request, "util/create_form.html", context) + return render(request, 'util/create_form.html', context) -@login_required(login_url="/admin/login") +@login_required(login_url='/admin/login') @staff_member_required def navigator_view(request, id=0): - if request.method == "GET": + if request.method == 'GET': navigator = Navigator.objects.get(pk=id) - context = {"navigator": navigator} + context = { + 'navigator': navigator + } - return render(request, "navigators/navigator.html", context) + return render(request, 'navigators/navigator.html', context) -@login_required(login_url="/admin/login") +@login_required(login_url='/admin/login') @staff_member_required def navigator_filter_view(request): - if request.method == "GET": + if request.method == 'GET': navigators = Navigator.objects.all() - query = request.GET.get("name", "") + query = request.GET.get('name', '') navigators = filter(lambda p: query in p.name.text, navigators) - context = {"navigators": navigators} + context = { + 'navigators': navigators + } - return render(request, "navigators/list.html", context) + return render(request, 'navigators/list.html', context) class NewUrgentNeedForm(forms.Form): @@ -304,107 +330,125 @@ class NewUrgentNeedForm(forms.Form): phone_number = PhoneNumberField(required=False) -@login_required(login_url="/admin/login") +@login_required(login_url='/admin/login') @staff_member_required def urgent_needs_view(request): - if request.method == "GET": + if request.method == 'GET': urgent_needs = UrgentNeed.objects.all() - context = {"urgent_needs": urgent_needs} + context = { + 'urgent_needs': urgent_needs + } - return render(request, "urgent_needs/main.html", context) - if request.method == "POST": + return render(request, 'urgent_needs/main.html', context) + if request.method == 'POST': form = NewUrgentNeedForm(request.POST) if form.is_valid(): urgent_need = UrgentNeed.objects.new_urgent_need( - form["label"].value(), - form["phone_number"].value(), + form['label'].value(), + form['phone_number'].value(), ) response = HttpResponse() response.headers["HX-Redirect"] = f"/api/translations/admin/urgent_needs/{urgent_need.id}" return response -@login_required(login_url="/admin/login") +@login_required(login_url='/admin/login') @staff_member_required def create_urgent_need_view(request): - if request.method == "GET": - context = {"form": NewUrgentNeedForm(), "route": "/api/translations/admin/urgent_needs"} + if request.method == 'GET': + context = { + 'form': NewUrgentNeedForm(), + 'route': '/api/translations/admin/urgent_needs' + } - return render(request, "util/create_form.html", context) + return render(request, 'util/create_form.html', context) -@login_required(login_url="/admin/login") +@login_required(login_url='/admin/login') @staff_member_required def urgent_need_view(request, id=0): - if request.method == "GET": + if request.method == 'GET': urgent_need = UrgentNeed.objects.get(pk=id) - context = {"urgent_need": urgent_need} + context = { + 'urgent_need': urgent_need + } - return render(request, "urgent_needs/urgent_need.html", context) + return render(request, 'urgent_needs/urgent_need.html', context) -@login_required(login_url="/admin/login") +@login_required(login_url='/admin/login') @staff_member_required def urgent_need_filter_view(request): - if request.method == "GET": + if request.method == 'GET': urgent_needs = UrgentNeed.objects.all() - query = request.GET.get("name", "") + query = request.GET.get('name', '') urgent_needs = filter(lambda p: query in p.name.text, urgent_needs) - context = {"urgent_needs": urgent_needs} + context = { + 'urgent_needs': urgent_needs + } - return render(request, "urgent_needs/list.html", context) + return render(request, 'urgent_needs/list.html', context) class NewDocumentForm(forms.Form): external_name = forms.CharField(max_length=120) -@login_required(login_url="/admin/login") +@login_required(login_url='/admin/login') @staff_member_required def documents_view(request): - if request.method == "GET": + if request.method == 'GET': documents = Document.objects.all() - context = {"documents": documents} + context = { + 'documents': documents + } - return render(request, "documents/main.html", context) - if request.method == "POST": + return render(request, 'documents/main.html', context) + if request.method == 'POST': form = NewDocumentForm(request.POST) if form.is_valid(): - document = Document.objects.new_document(form["external_name"].value()) + document = Document.objects.new_document(form['external_name'].value()) response = HttpResponse() response.headers["HX-Redirect"] = f"/api/translations/admin/documents/{document.id}" return response -@login_required(login_url="/admin/login") +@login_required(login_url='/admin/login') @staff_member_required def create_document_view(request): - if request.method == "GET": - context = {"form": NewDocumentForm(), "route": "/api/translations/admin/documents"} + if request.method == 'GET': + context = { + 'form': NewDocumentForm(), + 'route': '/api/translations/admin/documents' + } - return render(request, "util/create_form.html", context) + return render(request, 'util/create_form.html', context) -@login_required(login_url="/admin/login") +@login_required(login_url='/admin/login') @staff_member_required def document_view(request, id=0): - if request.method == "GET": + if request.method == 'GET': document = Document.objects.get(pk=id) - context = {"document": document} + context = { + 'document': document + } - return render(request, "documents/document.html", context) + return render(request, 'documents/document.html', context) -@login_required(login_url="/admin/login") +@login_required(login_url='/admin/login') @staff_member_required def document_filter_view(request): - if request.method == "GET": - query = request.GET.get("name", "") + if request.method == 'GET': + query = request.GET.get('name', '') documents = Document.objects.filter(external_name__contains=query) - context = {"documents": documents} + context = { + 'documents': documents + } - return render(request, "documents/list.html", context) + return render(request, 'documents/list.html', context) From ad73406e0a1dd9a65fc0c74d7f41bf1dbcad1b2b Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 28 May 2024 11:39:43 -0600 Subject: [PATCH 9/9] format --- authentication/admin.py | 9 +- authentication/apps.py | 4 +- authentication/migrations/0001_initial.py | 90 +- ...e_user_cell_user_email_or_cell_and_more.py | 27 +- authentication/migrations/0003_user_screen.py | 17 +- .../migrations/0004_user_tcpa_consent.py | 7 +- ...cell_alter_user_email_alter_user_screen.py | 23 +- .../migrations/0006_remove_user_screen.py | 7 +- .../0007_alter_user_cell_alter_user_email.py | 17 +- ...0008_user_send_offers_user_send_updates.py | 11 +- ...er_user_first_name_alter_user_last_name.py | 11 +- .../migrations/0010_user_language_code.py | 7 +- .../migrations/0011_alter_user_managers.py | 8 +- .../migrations/0012_user_external_id.py | 7 +- authentication/models.py | 20 +- authentication/serializers.py | 50 +- authentication/urls.py | 6 +- benefits/asgi.py | 2 +- benefits/settings.py | 208 +- benefits/urls.py | 36 +- benefits/views.py | 10 +- benefits/wsgi.py | 2 +- configuration/admin.py | 2 +- .../management/commands/add_config.py | 2587 ++++++++++++++++- configuration/models.py | 5 +- configuration/serializers.py | 3 +- configuration/urls.py | 4 +- configuration/views.py | 4 +- integrations/apps.py | 2 +- .../management/commands/hubspotsync.py | 50 +- .../services/communications/__init__.py | 1 - .../services/communications/message.py | 20 +- .../services/google_translate/integration.py | 28 +- integrations/services/sheets/sheets.py | 31 +- manage.py | 4 +- programs/admin.py | 34 +- programs/apps.py | 4 +- programs/co_county_zips.py | 4 +- programs/management/commands/add_history.py | 65 +- programs/management/commands/diff_history.py | 32 +- programs/management/commands/quick_start.py | 198 +- .../management/commands/rm_latest_history.py | 10 +- programs/migrations/0001_initial.py | 27 +- .../0002_program_programnameshort.py | 9 +- ...link_program_apply_button_link_and_more.py | 57 +- ...gram_snapshot_program_description_short.py | 9 +- .../0005_rename_program_name_program_name.py | 9 +- ...escription_program_description_and_more.py | 15 +- ...7_alter_program_estimated_delivery_time.py | 7 +- ...008_alter_program_legal_status_required.py | 7 +- .../migrations/0009_program_value_type.py | 9 +- ...ink_program__apply_button_link_and_more.py | 63 +- .../migrations/0011_add_translation_model.py | 52 +- .../0012_migrate_translatable_fields.py | 30 +- ...ove_program__apply_button_link_and_more.py | 43 +- ...mtranslation_estimated_application_time.py | 7 +- .../0015_programtranslation_active.py | 7 +- .../0016_alter_programtranslation_active.py | 7 +- .../0017_navigator_navigatortranslation.py | 53 +- .../0018_alter_navigatortranslation_cell.py | 7 +- ...igatortranslation_phone_number_and_more.py | 15 +- ...020_remove_navigatortranslation_program.py | 7 +- .../0021_navigatortranslation_program.py | 9 +- ...tortranslation_assistance_link_and_more.py | 35 +- .../0023_navigator_assistance_link.py | 7 +- ...move_navigator_assistance_link_and_more.py | 29 +- ...igatortranslation_phone_number_and_more.py | 11 +- ..._remove_navigator_phone_number_and_more.py | 11 +- ...igatortranslation_phone_number_and_more.py | 11 +- .../0028_alter_navigator_phone_number.py | 7 +- .../0029_programtranslation_catagory.py | 9 +- ...me_catagory_programtranslation_category.py | 9 +- .../0031_urgentneed_urgentneedtranslation.py | 55 +- ...urgentneedfunction_urgentneed_functions.py | 15 +- .../0033_alter_urgentneed_functions.py | 9 +- .../0034_alter_urgentneedtranslation_link.py | 7 +- .../migrations/0035_federalpoverylimit.py | 25 +- ...ederalpoverylimit_has_2_people_and_more.py | 45 +- .../0037_alter_federalpoverylimit_year.py | 7 +- programs/migrations/0038_program_fpl.py | 15 +- ...okfunction_referrer_referrertranslation.py | 68 +- ...alter_referrer_white_label_css_and_more.py | 31 +- ...emove_referrer_white_label_css_and_more.py | 117 +- .../migrations/0042_auto_20230905_1620.py | 54 +- .../migrations/0043_auto_20230906_0938.py | 35 +- ...rogram_legal_status_required_1_and_more.py | 11 +- .../migrations/0045_auto_20230906_0951.py | 17 +- .../0046_delete_programtranslation.py | 5 +- .../0047_alter_program_active_1_and_more.py | 99 +- ...rename_active_1_program_active_and_more.py | 75 +- ...link_1_navigator_description_1_and_more.py | 189 +- .../migrations/0050_auto_20230906_1427.py | 53 +- ...eedtranslation_unique_together_and_more.py | 13 +- ...er_navigator_assistance_link_1_and_more.py | 85 +- ...nk_1_navigator_assistance_link_and_more.py | 51 +- ...nal_name_program_external_name_and_more.py | 15 +- ..._alter_navigator_external_name_and_more.py | 15 +- ...y_remove_urgentneed_type_short_and_more.py | 19 +- ...ter_urgentneedcategory_options_and_more.py | 34 +- .../0058_program_legal_status_required.py | 9 +- ...059_alter_program_legal_status_required.py | 9 +- .../0060_alter_navigator_program.py | 4 +- .../0061_referrer_remove_programs.py | 4 +- .../0062_document_program_documents.py | 4 +- ...62_navigatorcounties_navigator_counties.py | 4 +- ...ounty_delete_navigatorcounties_and_more.py | 4 +- .../migrations/0066_auto_20240130_1146.py | 12 +- .../migrations/0070_auto_20240506_1817.py | 6 +- programs/models.py | 60 +- programs/programs/__init__.py | 5 +- programs/programs/calc.py | 50 +- programs/programs/co/__init__.py | 57 +- .../co/basic_cash_assistance/calculator.py | 4 +- programs/programs/co/cash_back/calculator.py | 2 +- .../co/child_care_assistance/calculator.py | 45 +- .../co/connect_for_health/calculator.py | 23 +- .../programs/co/connect_for_health/tests.py | 12 +- .../dental_health_care_seniors/calculator.py | 15 +- .../co/dental_health_care_seniors/tests.py | 14 +- .../co/denver_preschool_program/calculator.py | 8 +- .../co/denver_preschool_program/tests.py | 9 +- .../emergency_rental_assistance/calculator.py | 11 +- .../co/energy_assistance/calculator.py | 19 +- .../co/energy_resource_center/calculator.py | 16 +- .../co/energy_resource_center/tests.py | 13 +- .../programs/co/every_day_eats/calculator.py | 4 +- programs/programs/co/every_day_eats/tests.py | 12 +- .../co/low_wage_covid_relief/calculator.py | 10 +- .../adult_with_disability/calculator.py | 37 +- .../child_with_disability/calculator.py | 31 +- .../family_planning_services/calculator.py | 13 +- .../family_planning_services/tests.py | 19 +- programs/programs/co/my_spark/calculator.py | 12 +- programs/programs/co/mydenver/calculator.py | 10 +- programs/programs/co/nfp/calculator.py | 21 +- .../co/nurse_family_partnership/calculator.py | 24 +- programs/programs/co/omnisalud/calculator.py | 4 +- programs/programs/co/omnisalud/tests.py | 14 +- programs/programs/co/pe/__init__.py | 13 +- programs/programs/co/pe/member.py | 12 +- programs/programs/co/pe/tax.py | 18 +- .../co/property_credit_rebate/calculator.py | 20 +- .../co/property_credit_rebate/tests.py | 16 +- .../co/rental_assistance_grant/calculator.py | 9 +- .../co/reproductive_health_care/calculator.py | 4 +- .../co/reproductive_health_care/tests.py | 8 +- programs/programs/co/rtdlive/calculator.py | 20 +- programs/programs/co/tabor/calculator.py | 6 +- programs/programs/co/trua/calculator.py | 6 +- .../co/universal_preschool/calculator.py | 25 +- .../co/utility_bill_pay/calculator.py | 6 +- .../weatherization_assistance/calculator.py | 6 +- programs/programs/federal/__init__.py | 6 +- .../programs/federal/head_start/calculator.py | 14 +- .../federal/head_start/eligible_zipcodes.py | 76 +- programs/programs/federal/head_start/tests.py | 18 +- .../federal/medicare_savings/calculator.py | 30 +- programs/programs/federal/pe/__init__.py | 21 +- programs/programs/federal/pe/member.py | 27 +- programs/programs/federal/pe/spm.py | 12 +- programs/programs/federal/pe/tax.py | 7 +- programs/programs/federal/ssdi/calculator.py | 9 +- programs/programs/messages.py | 110 +- programs/programs/nc/pe/__init__.py | 3 +- programs/programs/nc/pe/member.py | 9 +- .../policyengine/calculators/__init__.py | 14 +- .../programs/policyengine/calculators/base.py | 27 +- .../policyengine/calculators/constants.py | 6 +- .../calculators/dependencies/base.py | 50 +- .../calculators/dependencies/household.py | 10 +- .../calculators/dependencies/member.py | 112 +- .../calculators/dependencies/spm.py | 112 +- .../calculators/dependencies/tax.py | 16 +- .../urgent_needs/urgent_need_functions.py | 318 +- programs/urls.py | 10 +- screener/admin.py | 2 +- screener/apps.py | 4 +- .../management/commands/batch_snapshots.py | 34 +- .../management/commands/email_new_benefits.py | 22 +- screener/migrations/0001_initial.py | 58 +- .../0002_screen_housing_situation_expense.py | 21 +- .../0003_rename_type_incomestream_name.py | 9 +- .../0004_remove_incomestream_label.py | 7 +- .../0005_alter_incomestream_screen.py | 11 +- .../0006_rename_name_expense_type_and_more.py | 23 +- .../0007_rename_applicant_age_screen_age.py | 9 +- screener/migrations/0008_householdmember.py | 44 +- .../0009_remove_householdmember_zipcode.py | 7 +- ...ove_screen_disability_medicaid_and_more.py | 55 +- .../0011_expense_household_member_and_more.py | 25 +- ...2_alter_householdmember_screen_and_more.py | 29 +- .../0013_householdmember_relationship.py | 9 +- .../0014_screen_cell_screen_email.py | 11 +- .../migrations/0015_remove_screen_cell.py | 7 +- .../migrations/0016_remove_screen_email.py | 7 +- .../0017_screen_last_email_request_date.py | 7 +- screener/migrations/0018_screen_user.py | 15 +- screener/migrations/0019_screen_start_date.py | 7 +- screener/migrations/0020_screen_is_test.py | 7 +- screener/migrations/0021_messages.py | 30 +- .../0022_rename_messages_message.py | 7 +- ...me_message_message_content_message_type.py | 15 +- ..._alter_message_cell_alter_message_email.py | 13 +- .../migrations/0025_screen_external_id.py | 7 +- .../migrations/0026_screen_filed_taxes.py | 7 +- .../0027_remove_screen_filed_taxes.py | 7 +- .../0028_screen_last_tax_filing_year.py | 7 +- .../0029_alter_screen_housing_situation.py | 7 +- ...creen_has_ccb_screen_has_cccap_and_more.py | 63 +- ...holdmember_disability_medicaid_and_more.py | 11 +- screener/migrations/0032_message_uid.py | 7 +- .../migrations/0033_screen_referral_source.py | 7 +- .../0034_alter_screen_household_assets.py | 7 +- screener/migrations/0035_screen_county.py | 7 +- .../0036_screen_request_language_code.py | 7 +- ...litysnapshot_programeligibilitysnapshot.py | 51 +- ...hot_estimated_application_time_and_more.py | 23 +- screener/migrations/0039_screen_has_ssi.py | 7 +- ..._chp_hi_screen_has_employer_hi_and_more.py | 23 +- .../migrations/0041_screen_referrer_code.py | 7 +- ...042_screen_needs_baby_supplies_and_more.py | 27 +- .../migrations/0043_screen_has_medicare_hi.py | 7 +- .../migrations/0044_screen_is_verified.py | 7 +- screener/migrations/0045_screen_uuid.py | 7 +- screener/migrations/0046_alter_screen_uuid.py | 7 +- .../0047_incomestream_hours_worked.py | 7 +- .../0048_screen_needs_family_planning_help.py | 7 +- .../0049_eligibilitysnapshot_batch.py | 7 +- ...name_batch_eligibilitysnapshot_is_batch.py | 9 +- .../0051_programeligibilitysnapshot_new.py | 7 +- .../0052_alter_expense_household_member.py | 14 +- ...r_householdmember_has_expenses_and_more.py | 11 +- ...amount_alter_expense_frequency_and_more.py | 95 +- ..._has_andcs_screen_has_benefits_and_more.py | 45 +- screener/migrations/0056_screen_completed.py | 7 +- .../0057_screen_has_coctc_screen_has_upk.py | 11 +- ...kfunctions_webhooks_webhookstranslation.py | 50 +- ...ookfunction_webhooktranslation_and_more.py | 68 +- .../migrations/0060_screen_is_test_data.py | 7 +- .../0061_alter_screen_is_test_data.py | 7 +- .../0062_alter_screen_is_test_data.py | 7 +- ...ooktranslation_unique_together_and_more.py | 15 +- ..._screen_needs_dental_care_help_and_more.py | 15 +- ...ntal_care_help_screen_needs_dental_care.py | 9 +- .../migrations/0066_screen_is_13_or_older.py | 7 +- ...ense_household_member_alter_screen_user.py | 26 +- .../0068_householdmember_insurance.py | 23 +- ...i_alter_screen_has_employer_hi_and_more.py | 27 +- ...igibilitysnapshot_legal_status_required.py | 7 +- .../0074_alter_screen_household_assets.py | 4 +- .../0075_alter_screen_household_assets.py | 4 +- screener/models.py | 249 +- screener/one_time_scripts.py | 220 +- screener/serializers.py | 232 +- screener/tests.py | 20 +- screener/urls.py | 13 +- screener/views.py | 150 +- screener/webhooks.py | 12 +- translations/admin.py | 13 +- translations/apps.py | 4 +- translations/bulk_import_translations.py | 34 +- .../management/commands/bulk_export.py | 6 +- .../management/commands/bulk_import.py | 15 +- .../management/commands/bulk_translate.py | 16 +- translations/migrations/0001_initial.py | 45 +- .../migrations/0002_translation_active.py | 7 +- .../0003_alter_translation_managers.py | 7 +- .../migrations/0004_translation_no_auto.py | 7 +- translations/models.py | 42 +- translations/urls.py | 46 +- translations/views.py | 436 ++- 271 files changed, 6394 insertions(+), 3706 deletions(-) diff --git a/authentication/admin.py b/authentication/admin.py index 5714dc1c..f5feb1ea 100644 --- a/authentication/admin.py +++ b/authentication/admin.py @@ -9,18 +9,21 @@ class CustomUserAdmin(ModelAdmin): search_fields = ("email",) - ordering = ('email_or_cell', 'email') + ordering = ("email_or_cell", "email") + + list_display = ("email_or_cell", "is_staff") - list_display = ('email_or_cell', 'is_staff') class CustomGroupAdmin(ModelAdmin, GroupAdmin): pass + class CustomTokenAdmin(ModelAdmin, TokenAdmin): pass + admin.site.register(User, CustomUserAdmin) admin.site.unregister(Group) admin.site.register(Group, CustomGroupAdmin) admin.site.unregister(TokenProxy) -admin.site.register(TokenProxy, CustomTokenAdmin) \ No newline at end of file +admin.site.register(TokenProxy, CustomTokenAdmin) diff --git a/authentication/apps.py b/authentication/apps.py index ead97686..7b90ca12 100644 --- a/authentication/apps.py +++ b/authentication/apps.py @@ -2,5 +2,5 @@ class AuthConfig(AppConfig): - default_auto_field = 'django.db.models.BigAutoField' - name = 'authentication' + default_auto_field = "django.db.models.BigAutoField" + name = "authentication" diff --git a/authentication/migrations/0001_initial.py b/authentication/migrations/0001_initial.py index dc1b18f1..8b950326 100644 --- a/authentication/migrations/0001_initial.py +++ b/authentication/migrations/0001_initial.py @@ -7,38 +7,88 @@ class Migration(migrations.Migration): - initial = True dependencies = [ - ('auth', '0012_alter_user_first_name_max_length'), + ("auth", "0012_alter_user_first_name_max_length"), ] operations = [ migrations.CreateModel( - name='User', + name="User", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('password', models.CharField(max_length=128, verbose_name='password')), - ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')), - ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')), - ('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')), - ('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')), - ('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')), - ('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')), - ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')), - ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')), - ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')), - ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.group', verbose_name='groups')), - ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.permission', verbose_name='user permissions')), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("password", models.CharField(max_length=128, verbose_name="password")), + ("last_login", models.DateTimeField(blank=True, null=True, verbose_name="last login")), + ( + "is_superuser", + models.BooleanField( + default=False, + help_text="Designates that this user has all permissions without explicitly assigning them.", + verbose_name="superuser status", + ), + ), + ( + "username", + models.CharField( + error_messages={"unique": "A user with that username already exists."}, + help_text="Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.", + max_length=150, + unique=True, + validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], + verbose_name="username", + ), + ), + ("first_name", models.CharField(blank=True, max_length=150, verbose_name="first name")), + ("last_name", models.CharField(blank=True, max_length=150, verbose_name="last name")), + ("email", models.EmailField(blank=True, max_length=254, verbose_name="email address")), + ( + "is_staff", + models.BooleanField( + default=False, + help_text="Designates whether the user can log into this admin site.", + verbose_name="staff status", + ), + ), + ( + "is_active", + models.BooleanField( + default=True, + help_text="Designates whether this user should be treated as active. Unselect this instead of deleting accounts.", + verbose_name="active", + ), + ), + ("date_joined", models.DateTimeField(default=django.utils.timezone.now, verbose_name="date joined")), + ( + "groups", + models.ManyToManyField( + blank=True, + help_text="The groups this user belongs to. A user will get all permissions granted to each of their groups.", + related_name="user_set", + related_query_name="user", + to="auth.group", + verbose_name="groups", + ), + ), + ( + "user_permissions", + models.ManyToManyField( + blank=True, + help_text="Specific permissions for this user.", + related_name="user_set", + related_query_name="user", + to="auth.permission", + verbose_name="user permissions", + ), + ), ], options={ - 'verbose_name': 'user', - 'verbose_name_plural': 'users', - 'abstract': False, + "verbose_name": "user", + "verbose_name_plural": "users", + "abstract": False, }, managers=[ - ('objects', django.contrib.auth.models.UserManager()), + ("objects", django.contrib.auth.models.UserManager()), ], ), ] diff --git a/authentication/migrations/0002_remove_user_username_user_cell_user_email_or_cell_and_more.py b/authentication/migrations/0002_remove_user_username_user_cell_user_email_or_cell_and_more.py index 3de50bff..aaef7d13 100644 --- a/authentication/migrations/0002_remove_user_username_user_cell_user_email_or_cell_and_more.py +++ b/authentication/migrations/0002_remove_user_username_user_cell_user_email_or_cell_and_more.py @@ -5,31 +5,32 @@ class Migration(migrations.Migration): - dependencies = [ - ('authentication', '0001_initial'), + ("authentication", "0001_initial"), ] operations = [ migrations.RemoveField( - model_name='user', - name='username', + model_name="user", + name="username", ), migrations.AddField( - model_name='user', - name='cell', - field=phonenumber_field.modelfields.PhoneNumberField(default='+17202373591', max_length=128, region=None, unique=True), + model_name="user", + name="cell", + field=phonenumber_field.modelfields.PhoneNumberField( + default="+17202373591", max_length=128, region=None, unique=True + ), preserve_default=False, ), migrations.AddField( - model_name='user', - name='email_or_cell', - field=models.CharField(default='bhiatt@garycommunity.org', max_length=320, unique=True), + model_name="user", + name="email_or_cell", + field=models.CharField(default="bhiatt@garycommunity.org", max_length=320, unique=True), preserve_default=False, ), migrations.AlterField( - model_name='user', - name='email', - field=models.EmailField(max_length=254, unique=True, verbose_name='email address'), + model_name="user", + name="email", + field=models.EmailField(max_length=254, unique=True, verbose_name="email address"), ), ] diff --git a/authentication/migrations/0003_user_screen.py b/authentication/migrations/0003_user_screen.py index 07047841..85a6e3bf 100644 --- a/authentication/migrations/0003_user_screen.py +++ b/authentication/migrations/0003_user_screen.py @@ -5,17 +5,22 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0016_remove_screen_email'), - ('authentication', '0002_remove_user_username_user_cell_user_email_or_cell_and_more'), + ("screener", "0016_remove_screen_email"), + ("authentication", "0002_remove_user_username_user_cell_user_email_or_cell_and_more"), ] operations = [ migrations.AddField( - model_name='user', - name='screen', - field=models.ForeignKey(blank=True, default=1, on_delete=django.db.models.deletion.CASCADE, related_name='screen', to='screener.screen'), + model_name="user", + name="screen", + field=models.ForeignKey( + blank=True, + default=1, + on_delete=django.db.models.deletion.CASCADE, + related_name="screen", + to="screener.screen", + ), preserve_default=False, ), ] diff --git a/authentication/migrations/0004_user_tcpa_consent.py b/authentication/migrations/0004_user_tcpa_consent.py index c4cbf267..0558880e 100644 --- a/authentication/migrations/0004_user_tcpa_consent.py +++ b/authentication/migrations/0004_user_tcpa_consent.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('authentication', '0003_user_screen'), + ("authentication", "0003_user_screen"), ] operations = [ migrations.AddField( - model_name='user', - name='tcpa_consent', + model_name="user", + name="tcpa_consent", field=models.BooleanField(default=False), preserve_default=False, ), diff --git a/authentication/migrations/0005_alter_user_cell_alter_user_email_alter_user_screen.py b/authentication/migrations/0005_alter_user_cell_alter_user_email_alter_user_screen.py index 85b1efa5..c75960cb 100644 --- a/authentication/migrations/0005_alter_user_cell_alter_user_email_alter_user_screen.py +++ b/authentication/migrations/0005_alter_user_cell_alter_user_email_alter_user_screen.py @@ -6,26 +6,27 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0017_screen_last_email_request_date'), - ('authentication', '0004_user_tcpa_consent'), + ("screener", "0017_screen_last_email_request_date"), + ("authentication", "0004_user_tcpa_consent"), ] operations = [ migrations.AlterField( - model_name='user', - name='cell', + model_name="user", + name="cell", field=phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, region=None, unique=True), ), migrations.AlterField( - model_name='user', - name='email', - field=models.EmailField(blank=True, max_length=254, unique=True, verbose_name='email address'), + model_name="user", + name="email", + field=models.EmailField(blank=True, max_length=254, unique=True, verbose_name="email address"), ), migrations.AlterField( - model_name='user', - name='screen', - field=models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, related_name='users', to='screener.screen'), + model_name="user", + name="screen", + field=models.ForeignKey( + blank=True, on_delete=django.db.models.deletion.CASCADE, related_name="users", to="screener.screen" + ), ), ] diff --git a/authentication/migrations/0006_remove_user_screen.py b/authentication/migrations/0006_remove_user_screen.py index 9f9d471e..0cde4425 100644 --- a/authentication/migrations/0006_remove_user_screen.py +++ b/authentication/migrations/0006_remove_user_screen.py @@ -4,14 +4,13 @@ class Migration(migrations.Migration): - dependencies = [ - ('authentication', '0005_alter_user_cell_alter_user_email_alter_user_screen'), + ("authentication", "0005_alter_user_cell_alter_user_email_alter_user_screen"), ] operations = [ migrations.RemoveField( - model_name='user', - name='screen', + model_name="user", + name="screen", ), ] diff --git a/authentication/migrations/0007_alter_user_cell_alter_user_email.py b/authentication/migrations/0007_alter_user_cell_alter_user_email.py index 62269fb8..23e4f715 100644 --- a/authentication/migrations/0007_alter_user_cell_alter_user_email.py +++ b/authentication/migrations/0007_alter_user_cell_alter_user_email.py @@ -5,20 +5,21 @@ class Migration(migrations.Migration): - dependencies = [ - ('authentication', '0006_remove_user_screen'), + ("authentication", "0006_remove_user_screen"), ] operations = [ migrations.AlterField( - model_name='user', - name='cell', - field=phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, null=True, region=None, unique=True), + model_name="user", + name="cell", + field=phonenumber_field.modelfields.PhoneNumberField( + blank=True, max_length=128, null=True, region=None, unique=True + ), ), migrations.AlterField( - model_name='user', - name='email', - field=models.EmailField(blank=True, max_length=254, null=True, unique=True, verbose_name='email address'), + model_name="user", + name="email", + field=models.EmailField(blank=True, max_length=254, null=True, unique=True, verbose_name="email address"), ), ] diff --git a/authentication/migrations/0008_user_send_offers_user_send_updates.py b/authentication/migrations/0008_user_send_offers_user_send_updates.py index 139f8ed8..00018186 100644 --- a/authentication/migrations/0008_user_send_offers_user_send_updates.py +++ b/authentication/migrations/0008_user_send_offers_user_send_updates.py @@ -4,20 +4,19 @@ class Migration(migrations.Migration): - dependencies = [ - ('authentication', '0007_alter_user_cell_alter_user_email'), + ("authentication", "0007_alter_user_cell_alter_user_email"), ] operations = [ migrations.AddField( - model_name='user', - name='send_offers', + model_name="user", + name="send_offers", field=models.BooleanField(default=False), ), migrations.AddField( - model_name='user', - name='send_updates', + model_name="user", + name="send_updates", field=models.BooleanField(default=False), ), ] diff --git a/authentication/migrations/0009_alter_user_first_name_alter_user_last_name.py b/authentication/migrations/0009_alter_user_first_name_alter_user_last_name.py index 6766c753..1a19ce8f 100644 --- a/authentication/migrations/0009_alter_user_first_name_alter_user_last_name.py +++ b/authentication/migrations/0009_alter_user_first_name_alter_user_last_name.py @@ -4,20 +4,19 @@ class Migration(migrations.Migration): - dependencies = [ - ('authentication', '0008_user_send_offers_user_send_updates'), + ("authentication", "0008_user_send_offers_user_send_updates"), ] operations = [ migrations.AlterField( - model_name='user', - name='first_name', + model_name="user", + name="first_name", field=models.CharField(blank=True, max_length=320, null=True), ), migrations.AlterField( - model_name='user', - name='last_name', + model_name="user", + name="last_name", field=models.CharField(blank=True, max_length=320, null=True), ), ] diff --git a/authentication/migrations/0010_user_language_code.py b/authentication/migrations/0010_user_language_code.py index 369c56a5..6522d847 100644 --- a/authentication/migrations/0010_user_language_code.py +++ b/authentication/migrations/0010_user_language_code.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('authentication', '0009_alter_user_first_name_alter_user_last_name'), + ("authentication", "0009_alter_user_first_name_alter_user_last_name"), ] operations = [ migrations.AddField( - model_name='user', - name='language_code', + model_name="user", + name="language_code", field=models.CharField(blank=True, max_length=12, null=True), ), ] diff --git a/authentication/migrations/0011_alter_user_managers.py b/authentication/migrations/0011_alter_user_managers.py index 5371c3ef..db9c6959 100644 --- a/authentication/migrations/0011_alter_user_managers.py +++ b/authentication/migrations/0011_alter_user_managers.py @@ -4,15 +4,13 @@ class Migration(migrations.Migration): - dependencies = [ - ('authentication', '0010_user_language_code'), + ("authentication", "0010_user_language_code"), ] operations = [ migrations.AlterModelManagers( - name='user', - managers=[ - ], + name="user", + managers=[], ), ] diff --git a/authentication/migrations/0012_user_external_id.py b/authentication/migrations/0012_user_external_id.py index 9713bd33..90a0380f 100644 --- a/authentication/migrations/0012_user_external_id.py +++ b/authentication/migrations/0012_user_external_id.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('authentication', '0011_alter_user_managers'), + ("authentication", "0011_alter_user_managers"), ] operations = [ migrations.AddField( - model_name='user', - name='external_id', + model_name="user", + name="external_id", field=models.CharField(blank=True, max_length=320, null=True), ), ] diff --git a/authentication/models.py b/authentication/models.py index fb734b6e..4facb483 100644 --- a/authentication/models.py +++ b/authentication/models.py @@ -10,12 +10,9 @@ def create_user(self, email_or_cell, tcpa_consent, password=None): Creates and saves a User with the given email or cell and password. """ if not email_or_cell: - raise ValueError('Users must have an email address or cell phone number') + raise ValueError("Users must have an email address or cell phone number") - user = self.model( - email_or_cell=email_or_cell, - tcpa_consent=tcpa_consent - ) + user = self.model(email_or_cell=email_or_cell, tcpa_consent=tcpa_consent) user.set_password(password) user.save(using=self._db) @@ -26,17 +23,14 @@ def create_superuser(self, email_or_cell, tcpa_consent, password=None): Creates and saves a superuser with the given email, date of birth and password. """ - user = self.create_user( - email_or_cell=email_or_cell, - password=password, - tcpa_consent=tcpa_consent - ) + user = self.create_user(email_or_cell=email_or_cell, password=password, tcpa_consent=tcpa_consent) user.is_admin = True user.is_superuser = True user.is_staff = True user.save(using=self._db) return user + # Users are created by the screener when someone signs up to provide feedback # or be notified of future benefits that are available to them. The unique id # can be either a cell phone number or email address. @@ -44,7 +38,7 @@ class User(AbstractUser): username = None email_or_cell = models.CharField(max_length=320, unique=True) cell = PhoneNumberField(unique=True, blank=True, null=True) - email = models.EmailField(_('email address'), unique=True, blank=True, null=True) + email = models.EmailField(_("email address"), unique=True, blank=True, null=True) first_name = models.CharField(max_length=320, blank=True, null=True) last_name = models.CharField(max_length=320, blank=True, null=True) language_code = models.CharField(max_length=12, blank=True, null=True) @@ -55,8 +49,8 @@ class User(AbstractUser): objects = UserManager() - USERNAME_FIELD = 'email_or_cell' - REQUIRED_FIELDS = ['tcpa_consent'] + USERNAME_FIELD = "email_or_cell" + REQUIRED_FIELDS = ["tcpa_consent"] def save(self, **kwargs): self.cell = self.cell or None diff --git a/authentication/serializers.py b/authentication/serializers.py index 13c1d838..6c9c143b 100644 --- a/authentication/serializers.py +++ b/authentication/serializers.py @@ -8,30 +8,30 @@ class UserSerializer(serializers.ModelSerializer): class Meta: model = User fields = ( - 'id', - 'date_joined', - 'last_login', - 'cell', - 'email', - 'first_name', - 'last_name', - 'email_or_cell', - 'language_code', - 'tcpa_consent', - 'send_offers', - 'send_updates' + "id", + "date_joined", + "last_login", + "cell", + "email", + "first_name", + "last_name", + "email_or_cell", + "language_code", + "tcpa_consent", + "send_offers", + "send_updates", ) create_only_fields = ( - 'id', - 'date_joined', - 'last_login', - 'cell', - 'email', - 'first_name', - 'last_name', - 'email_or_cell', - 'language_code', - 'tcpa_consent', + "id", + "date_joined", + "last_login", + "cell", + "email", + "first_name", + "last_name", + "email_or_cell", + "language_code", + "tcpa_consent", ) @@ -40,8 +40,4 @@ class UserOffersSerializer(serializers.ModelSerializer): class Meta: model = User - fields = ( - 'id', - 'send_offers', - 'send_updates' - ) + fields = ("id", "send_offers", "send_updates") diff --git a/authentication/urls.py b/authentication/urls.py index ca03f0d0..ebab708d 100644 --- a/authentication/urls.py +++ b/authentication/urls.py @@ -3,10 +3,8 @@ from . import views router = routers.DefaultRouter() -router.register(r'users', views.UserViewSet) +router.register(r"users", views.UserViewSet) # Wire up our API using automatic URL routing. # Additionally, we include login URLs for the browsable API. -urlpatterns = [ - path('', include(router.urls)) -] +urlpatterns = [path("", include(router.urls))] diff --git a/benefits/asgi.py b/benefits/asgi.py index 9c3d038c..9d278da0 100644 --- a/benefits/asgi.py +++ b/benefits/asgi.py @@ -11,6 +11,6 @@ from django.core.asgi import get_asgi_application -os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'benefits.settings') +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "benefits.settings") application = get_asgi_application() diff --git a/benefits/settings.py b/benefits/settings.py index e4ba34ed..ef1658e8 100644 --- a/benefits/settings.py +++ b/benefits/settings.py @@ -23,25 +23,25 @@ # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent -MEDIA_ROOT = os.path.join(BASE_DIR, 'media') -MEDIA_URL = '/media/' +MEDIA_ROOT = os.path.join(BASE_DIR, "media") +MEDIA_URL = "/media/" LOCALE_PATHS = [ - os.path.join(BASE_DIR, 'locale'), + os.path.join(BASE_DIR, "locale"), ] # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = config('SECRET_KEY') +SECRET_KEY = config("SECRET_KEY") # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = config('DJANGO_DEBUG', 'False') == 'True' +DEBUG = config("DJANGO_DEBUG", "False") == "True" -ALLOWED_HOSTS = ['*'] +ALLOWED_HOSTS = ["*"] -AUTH_USER_MODEL = 'authentication.User' +AUTH_USER_MODEL = "authentication.User" AUTHENTICATION_BACKENDS = [ "django.contrib.auth.backends.ModelBackend", @@ -49,13 +49,13 @@ ] REST_FRAMEWORK = { - 'DEFAULT_FILTER_BACKENDS': ['django_filters.rest_framework.DjangoFilterBackend'], - 'DEFAULT_AUTHENTICATION_CLASSES': [ - 'rest_framework.authentication.SessionAuthentication', - 'rest_framework.authentication.TokenAuthentication', + "DEFAULT_FILTER_BACKENDS": ["django_filters.rest_framework.DjangoFilterBackend"], + "DEFAULT_AUTHENTICATION_CLASSES": [ + "rest_framework.authentication.SessionAuthentication", + "rest_framework.authentication.TokenAuthentication", ], - 'DEFAULT_PERMISSION_CLASSES': ['rest_framework.permissions.IsAuthenticated'], - 'EXCEPTION_HANDLER': 'benefits.views.drf_exception_handler', + "DEFAULT_PERMISSION_CLASSES": ["rest_framework.permissions.IsAuthenticated"], + "EXCEPTION_HANDLER": "benefits.views.drf_exception_handler", } CORS_ALLOW_ALL_ORIGINS = True @@ -70,71 +70,71 @@ "unfold.contrib.guardian", # optional, if django-guardian package is used # optional, if django-simple-history package is used "unfold.contrib.simple_history", - 'authentication.apps.AuthConfig', - 'corsheaders', - 'screener.apps.ScreenerConfig', - 'programs.apps.ProgramsConfig', - 'configuration.apps.ConfigurationConfig', - 'integrations.apps.IntegrationsConfig', - 'translations.apps.TranslationsConfig', - 'rest_framework', - 'rest_framework.authtoken', - 'phonenumber_field', - 'parler', - 'django_filters', - 'django.contrib.admin', - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.sessions', - 'django.contrib.messages', - 'django.contrib.staticfiles', - 'drf_yasg', + "authentication.apps.AuthConfig", + "corsheaders", + "screener.apps.ScreenerConfig", + "programs.apps.ProgramsConfig", + "configuration.apps.ConfigurationConfig", + "integrations.apps.IntegrationsConfig", + "translations.apps.TranslationsConfig", + "rest_framework", + "rest_framework.authtoken", + "phonenumber_field", + "parler", + "django_filters", + "django.contrib.admin", + "django.contrib.auth", + "django.contrib.contenttypes", + "django.contrib.sessions", + "django.contrib.messages", + "django.contrib.staticfiles", + "drf_yasg", ] MIDDLEWARE = [ - 'django.middleware.security.SecurityMiddleware', - 'whitenoise.middleware.WhiteNoiseMiddleware', - 'django.contrib.sessions.middleware.SessionMiddleware', - 'corsheaders.middleware.CorsMiddleware', - 'django.middleware.common.CommonMiddleware', - 'django.middleware.csrf.CsrfViewMiddleware', - 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.contrib.messages.middleware.MessageMiddleware', - 'django.middleware.clickjacking.XFrameOptionsMiddleware', - 'django.middleware.locale.LocaleMiddleware', + "django.middleware.security.SecurityMiddleware", + "whitenoise.middleware.WhiteNoiseMiddleware", + "django.contrib.sessions.middleware.SessionMiddleware", + "corsheaders.middleware.CorsMiddleware", + "django.middleware.common.CommonMiddleware", + "django.middleware.csrf.CsrfViewMiddleware", + "django.contrib.auth.middleware.AuthenticationMiddleware", + "django.contrib.messages.middleware.MessageMiddleware", + "django.middleware.clickjacking.XFrameOptionsMiddleware", + "django.middleware.locale.LocaleMiddleware", ] -ROOT_URLCONF = 'benefits.urls' +ROOT_URLCONF = "benefits.urls" TEMPLATES = [ { - 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [os.path.join(BASE_DIR, 'templates')], - 'APP_DIRS': True, - 'OPTIONS': { - 'context_processors': [ - 'django.template.context_processors.debug', - 'django.template.context_processors.request', - 'django.contrib.auth.context_processors.auth', - 'django.contrib.messages.context_processors.messages', + "BACKEND": "django.template.backends.django.DjangoTemplates", + "DIRS": [os.path.join(BASE_DIR, "templates")], + "APP_DIRS": True, + "OPTIONS": { + "context_processors": [ + "django.template.context_processors.debug", + "django.template.context_processors.request", + "django.contrib.auth.context_processors.auth", + "django.contrib.messages.context_processors.messages", ], }, }, ] -WSGI_APPLICATION = 'benefits.wsgi.application' +WSGI_APPLICATION = "benefits.wsgi.application" # Database # https://docs.djangoproject.com/en/3.2/ref/settings/#databases DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.postgresql', - 'NAME': config('DB_NAME'), - 'USER': config('DB_USER'), - 'PASSWORD': config('DB_PASS'), - 'HOST': config('DB_HOST', 'localhost'), + "default": { + "ENGINE": "django.db.backends.postgresql", + "NAME": config("DB_NAME"), + "USER": config("DB_USER"), + "PASSWORD": config("DB_PASS"), + "HOST": config("DB_HOST", "localhost"), } } @@ -144,16 +144,16 @@ AUTH_PASSWORD_VALIDATORS = [ { - 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator", }, { - 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator", }, { - 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator", }, { - 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator", }, ] @@ -161,23 +161,23 @@ # Internationalization # https://docs.djangoproject.com/en/3.2/topics/i18n/ -LANGUAGE_CODE = 'en-us' +LANGUAGE_CODE = "en-us" LANGUAGES = ( - ('en-us', _("US English")), - ('es', _('Spanish')), - ('vi', _('Vietnamese')), - ('fr', _('French')), - ('am', _('Amharic')), - ('so', _('Somali')), - ('ru', _('Russian')), - ('ne', _('Nepali')), - ('my', _('Burmese')), - ('zh', _('Chinese')), - ('ar', _('Arabic')), + ("en-us", _("US English")), + ("es", _("Spanish")), + ("vi", _("Vietnamese")), + ("fr", _("French")), + ("am", _("Amharic")), + ("so", _("Somali")), + ("ru", _("Russian")), + ("ne", _("Nepali")), + ("my", _("Burmese")), + ("zh", _("Chinese")), + ("ar", _("Arabic")), ) -TIME_ZONE = 'UTC' +TIME_ZONE = "UTC" USE_I18N = True @@ -187,46 +187,46 @@ PARLER_DEFAULT_ACTIVATE = True PARLER_LANGUAGES = { None: ( - {'code': 'en-us'}, - {'code': 'es'}, - {'code': 'vi'}, - {'code': 'fr'}, - {'code': 'am'}, - {'code': 'so'}, - {'code': 'ru'}, - {'code': 'ne'}, - {'code': 'my'}, - {'code': 'zh'}, - {'code': 'ar'}, + {"code": "en-us"}, + {"code": "es"}, + {"code": "vi"}, + {"code": "fr"}, + {"code": "am"}, + {"code": "so"}, + {"code": "ru"}, + {"code": "ne"}, + {"code": "my"}, + {"code": "zh"}, + {"code": "ar"}, ), - 'default': { - 'fallbacks': ['en-us'], # defaults to PARLER_DEFAULT_LANGUAGE_CODE + "default": { + "fallbacks": ["en-us"], # defaults to PARLER_DEFAULT_LANGUAGE_CODE # the default; let .active_translations() return fallbacks too. - 'hide_untranslated': True, + "hide_untranslated": True, }, } # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/3.2/howto/static-files/ -STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') -STATIC_URL = '/static/' -STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' +STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles") +STATIC_URL = "/static/" +STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage" # Default primary key field type # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field -DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' -CSRF_FAILURE_VIEW = 'benefits.views.catch_403_view' +DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" +CSRF_FAILURE_VIEW = "benefits.views.catch_403_view" -SWAGGER_SETTINGS = {'SUPPORTED_SUBMIT_METHODS': ('get',)} +SWAGGER_SETTINGS = {"SUPPORTED_SUBMIT_METHODS": ("get",)} # Enable logging with Sentry if it is enabled -if config('SENTRY_DSN', None) is not None: +if config("SENTRY_DSN", None) is not None: sentry_sdk.init( - dsn=config('SENTRY_DSN'), + dsn=config("SENTRY_DSN"), integrations=[DjangoIntegration()], - environment='dev' if DEBUG else 'production', + environment="dev" if DEBUG else "production", ) django_heroku.settings(locals()) @@ -236,9 +236,9 @@ UNFOLD = { "SITE_HEADER": _("MFB Admin"), "SITE_TITLE": _("MFB Admin"), - 'APP_NAME': 'Benefits', - 'APP_VERSION': '1.0.0', - 'APP_DESCRIPTION': 'Benefits is a Django application that helps people find and apply for benefits.', + "APP_NAME": "Benefits", + "APP_VERSION": "1.0.0", + "APP_DESCRIPTION": "Benefits is a Django application that helps people find and apply for benefits.", "SIDEBAR": { "show_search": True, "show_all_applications": True, @@ -271,7 +271,7 @@ "icon": "translate", "link": reverse_lazy("admin:translations_translation_changelist"), }, - ] + ], }, { "separator": True, @@ -304,5 +304,5 @@ ], }, ], - } + }, } diff --git a/benefits/urls.py b/benefits/urls.py index 0cf296a6..0caf97f5 100644 --- a/benefits/urls.py +++ b/benefits/urls.py @@ -1,4 +1,4 @@ -'''benefits URL Configuration +"""benefits URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.2/topics/http/urls/ @@ -12,22 +12,22 @@ Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) -''' +""" from django.contrib import admin from django.urls import include, path from sesame.views import LoginView from drf_yasg.views import get_schema_view from drf_yasg import openapi -handler403 = 'benefits.views.catch_403_view' -handler400 = 'benefits.views.catch_400_view' +handler403 = "benefits.views.catch_403_view" +handler400 = "benefits.views.catch_400_view" schema_view = get_schema_view( openapi.Info( - default_version='v1', - title='Colorado Open Benefits API', - description='API calculates eligibility across over 40 benefit programs in Colorado', - version='0.0.1', + default_version="v1", + title="Colorado Open Benefits API", + description="API calculates eligibility across over 40 benefit programs in Colorado", + version="0.0.1", ), public=True, permission_classes=[], @@ -35,16 +35,16 @@ ) urlpatterns = [ - path('api/', include('configuration.urls')), - path('api/', include('screener.urls')), - path('api/', include('programs.urls')), - path('api/', include('authentication.urls')), - path('api/translations/', include('translations.urls')), - path('admin/', admin.site.urls), - path('sesame/login/', LoginView.as_view(), name='sesame-login'), + path("api/", include("configuration.urls")), + path("api/", include("screener.urls")), + path("api/", include("programs.urls")), + path("api/", include("authentication.urls")), + path("api/translations/", include("translations.urls")), + path("admin/", admin.site.urls), + path("sesame/login/", LoginView.as_view(), name="sesame-login"), path( - 'api/documentation/', - schema_view.with_ui('swagger', cache_timeout=0), - name='schema-swagger-ui', + "api/documentation/", + schema_view.with_ui("swagger", cache_timeout=0), + name="schema-swagger-ui", ), ] diff --git a/benefits/views.py b/benefits/views.py index 4be4d2c6..f0321de6 100644 --- a/benefits/views.py +++ b/benefits/views.py @@ -4,15 +4,15 @@ def catch_403_view(*args, **kwargs): - capture_message('Unauthorized', level='warning') + capture_message("Unauthorized", level="warning") - return HttpResponseForbidden('Forbidden') + return HttpResponseForbidden("Forbidden") def catch_400_view(*args, **kwargs): - capture_message('Bad Request', level='warning') + capture_message("Bad Request", level="warning") - return HttpResponseBadRequest('Bad Request') + return HttpResponseBadRequest("Bad Request") def drf_exception_handler(exc, context): @@ -23,7 +23,7 @@ def drf_exception_handler(exc, context): capture_message( response.reason_phrase, - level='warning', + level="warning", ) return response diff --git a/benefits/wsgi.py b/benefits/wsgi.py index f5d67b28..3ef70567 100644 --- a/benefits/wsgi.py +++ b/benefits/wsgi.py @@ -11,6 +11,6 @@ from django.core.wsgi import get_wsgi_application -os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'benefits.settings') +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "benefits.settings") application = get_wsgi_application() diff --git a/configuration/admin.py b/configuration/admin.py index 8db196be..64d648ed 100644 --- a/configuration/admin.py +++ b/configuration/admin.py @@ -4,7 +4,7 @@ class ConfigurationAdmin(ModelAdmin): - search_fields = ('name',) + search_fields = ("name",) admin.site.register(Configuration, ConfigurationAdmin) diff --git a/configuration/management/commands/add_config.py b/configuration/management/commands/add_config.py index 92900bdc..8e12c15a 100644 --- a/configuration/management/commands/add_config.py +++ b/configuration/management/commands/add_config.py @@ -1,41 +1,2588 @@ from django.core.management.base import BaseCommand from configuration.models import ( - Configuration, + Configuration, ) class Command(BaseCommand): - help = ( - 'Create and add config data to database' - ) + help = "Create and add config data to database" - acute_condition_options = {"food": {"icon": {"_name": "Food", "_classname": "option-card-icon"}, "_label": "acuteConditionOptions.food", "_default_message": "Food or groceries"}, "housing": {"icon": {"_name": "Housing", "_classname": "option-card-icon"}, "_label": "acuteConditionOptions.housing", "_default_message": "Help with managing your mortgage, rent, or utilities"}, "support": {"icon": {"_name": "Support", "_classname": "option-card-icon"}, "_label": "acuteConditionOptions.support", "_default_message": "A challenge you or your child would like to talk about"}, "dentalCare": {"icon": {"_name": "Dental_care", "_classname": "option-card-icon"}, "_label": "acuteConditionOptions.dentalCare", "_default_message": "Low-cost dental care"}, "babySupplies": {"icon": {"_name": "Baby_supplies", "_classname": "option-card-icon"}, "_label": "acuteConditionOptions.babySupplies", "_default_message": "Diapers and other baby supplies"}, "jobResources": {"icon": {"_name": "Job_resources", "_classname": "option-card-icon"}, "_label": "acuteConditionOptions.jobResources", "_default_message": "Finding a job"}, "legalServices": {"icon": {"_name": "Legal_services", "_classname": "option-card-icon"}, "_label": "acuteConditionOptions.legalServices", "_default_message": "Free or low-cost help with civil legal needs"}, "familyPlanning": {"icon": {"_name": "Family_planning", "_classname": "option-card-icon"}, "_label": "acuteConditionOptions.familyPlanning", "_default_message": "Family planning or birth control"}, "childDevelopment": {"icon": {"_name": "Child_development", "_classname": "option-card-icon"}, "_label": "acuteConditionOptions.childDevelopment", "_default_message": "Concern about your baby or toddler's development"}} + acute_condition_options = { + "food": { + "icon": {"_name": "Food", "_classname": "option-card-icon"}, + "_label": "acuteConditionOptions.food", + "_default_message": "Food or groceries", + }, + "housing": { + "icon": {"_name": "Housing", "_classname": "option-card-icon"}, + "_label": "acuteConditionOptions.housing", + "_default_message": "Help with managing your mortgage, rent, or utilities", + }, + "support": { + "icon": {"_name": "Support", "_classname": "option-card-icon"}, + "_label": "acuteConditionOptions.support", + "_default_message": "A challenge you or your child would like to talk about", + }, + "dentalCare": { + "icon": {"_name": "Dental_care", "_classname": "option-card-icon"}, + "_label": "acuteConditionOptions.dentalCare", + "_default_message": "Low-cost dental care", + }, + "babySupplies": { + "icon": {"_name": "Baby_supplies", "_classname": "option-card-icon"}, + "_label": "acuteConditionOptions.babySupplies", + "_default_message": "Diapers and other baby supplies", + }, + "jobResources": { + "icon": {"_name": "Job_resources", "_classname": "option-card-icon"}, + "_label": "acuteConditionOptions.jobResources", + "_default_message": "Finding a job", + }, + "legalServices": { + "icon": {"_name": "Legal_services", "_classname": "option-card-icon"}, + "_label": "acuteConditionOptions.legalServices", + "_default_message": "Free or low-cost help with civil legal needs", + }, + "familyPlanning": { + "icon": {"_name": "Family_planning", "_classname": "option-card-icon"}, + "_label": "acuteConditionOptions.familyPlanning", + "_default_message": "Family planning or birth control", + }, + "childDevelopment": { + "icon": {"_name": "Child_development", "_classname": "option-card-icon"}, + "_label": "acuteConditionOptions.childDevelopment", + "_default_message": "Concern about your baby or toddler's development", + }, + } - sign_up_options = {"sendOffers": {"_label": "signUpOptions.sendOffers", "_default_message": "Please notify me when there are paid opportunities to provide feedback on MyFriendBen."}, "sendUpdates": {"_label": "signUpOptions.sendUpdates", "_default_message": "Please notify me when new benefits become available to me that I am likely eligible for based on the information I have provided."}} + sign_up_options = { + "sendOffers": { + "_label": "signUpOptions.sendOffers", + "_default_message": "Please notify me when there are paid opportunities to provide feedback on MyFriendBen.", + }, + "sendUpdates": { + "_label": "signUpOptions.sendUpdates", + "_default_message": "Please notify me when new benefits become available to me that I am likely eligible for based on the information I have provided.", + }, + } - relationship_options = {"child": {"_label": "relationshipOptions.child", "_default_message": "Child"}, "parent": {"_label": "relationshipOptions.parent", "_default_message": "Parent"}, "spouse": {"_label": "relationshipOptions.spouse", "_default_message": "Spouse"}, "stepChild": {"_label": "relationshipOptions.stepChild", "_default_message": "Step-child"}, "unrelated": {"_label": "relationshipOptions.unrelated", "_default_message": "Unrelated"}, "grandChild": {"_label": "relationshipOptions.grandChild", "_default_message": "Grandchild"}, "stepParent": {"_label": "relationshipOptions.stepParent", "_default_message": "Step-parent"}, "fosterChild": {"_label": "relationshipOptions.fosterChildOrKinshipChild", "_default_message": "Foster Child / Kinship Care"}, "grandParent": {"_label": "relationshipOptions.grandParent", "_default_message": "Grandparent"}, "fosterParent": {"_label": "relationshipOptions.fosterParent", "_default_message": "Foster Parent"}, "relatedOther": {"_label": "relationshipOptions.relatedOther", "_default_message": "Related in some other way"}, "domesticPartner": {"_label": "relationshipOptions.domesticPartner", "_default_message": "Domestic Partner"}, "sisterOrBrother": {"_label": "relationshipOptions.sisterOrBrother", "_default_message": "Sister/Brother"}, "stepSisterOrBrother": {"_label": "relationshipOptions.stepSisterOrBrother", "_default_message": "Step-sister/Step-brother"}, "boyfriendOrGirlfriend": {"_label": "relationshipOptions.boyfriendOrGirlfriend", "_default_message": "Boyfriend/Girlfriend"}} + relationship_options = { + "child": {"_label": "relationshipOptions.child", "_default_message": "Child"}, + "parent": {"_label": "relationshipOptions.parent", "_default_message": "Parent"}, + "spouse": {"_label": "relationshipOptions.spouse", "_default_message": "Spouse"}, + "stepChild": {"_label": "relationshipOptions.stepChild", "_default_message": "Step-child"}, + "unrelated": {"_label": "relationshipOptions.unrelated", "_default_message": "Unrelated"}, + "grandChild": {"_label": "relationshipOptions.grandChild", "_default_message": "Grandchild"}, + "stepParent": {"_label": "relationshipOptions.stepParent", "_default_message": "Step-parent"}, + "fosterChild": { + "_label": "relationshipOptions.fosterChildOrKinshipChild", + "_default_message": "Foster Child / Kinship Care", + }, + "grandParent": {"_label": "relationshipOptions.grandParent", "_default_message": "Grandparent"}, + "fosterParent": {"_label": "relationshipOptions.fosterParent", "_default_message": "Foster Parent"}, + "relatedOther": {"_label": "relationshipOptions.relatedOther", "_default_message": "Related in some other way"}, + "domesticPartner": {"_label": "relationshipOptions.domesticPartner", "_default_message": "Domestic Partner"}, + "sisterOrBrother": {"_label": "relationshipOptions.sisterOrBrother", "_default_message": "Sister/Brother"}, + "stepSisterOrBrother": { + "_label": "relationshipOptions.stepSisterOrBrother", + "_default_message": "Step-sister/Step-brother", + }, + "boyfriendOrGirlfriend": { + "_label": "relationshipOptions.boyfriendOrGirlfriend", + "_default_message": "Boyfriend/Girlfriend", + }, + } - referral_options = {"bia": "Benefits in Action", "cch": "Colorado Coalition for the Homeless", "gac": "Get Ahead Colorado", "lgs": "Let's Get Set", "cedp": "Community Economic Defense Project (CEDP)", "frca": "Family Resource Center Association", "211co": "2-1-1 Colorado", "other": {"_label": "referralOptions.other", "_default_message": "Other"}, "jeffcoHS": "Jeffco Human Services", "socialMedia": {"_label": "referralOptions.socialMedia", "_default_message": "Social Media"}, "searchEngine": {"_label": "referralOptions.searchEngine", "_default_message": "Google or other search engine"}, "testOrProspect": {"_label": "referralOptions.testOrProspect", "_default_message": "Test / Prospective Partner"}, "villageExchange": "Village Exchange", "taxAssistanceSite": {"_label": "referralOptions.taxAssistanceSite", "_default_message": "Tax Assistance Site (VITA/Tax Help Colorado)"}} + referral_options = { + "bia": "Benefits in Action", + "cch": "Colorado Coalition for the Homeless", + "gac": "Get Ahead Colorado", + "lgs": "Let's Get Set", + "cedp": "Community Economic Defense Project (CEDP)", + "frca": "Family Resource Center Association", + "211co": "2-1-1 Colorado", + "other": {"_label": "referralOptions.other", "_default_message": "Other"}, + "jeffcoHS": "Jeffco Human Services", + "socialMedia": {"_label": "referralOptions.socialMedia", "_default_message": "Social Media"}, + "searchEngine": {"_label": "referralOptions.searchEngine", "_default_message": "Google or other search engine"}, + "testOrProspect": { + "_label": "referralOptions.testOrProspect", + "_default_message": "Test / Prospective Partner", + }, + "villageExchange": "Village Exchange", + "taxAssistanceSite": { + "_label": "referralOptions.taxAssistanceSite", + "_default_message": "Tax Assistance Site (VITA/Tax Help Colorado)", + }, + } - language_options = {"am": "አማርኛ", "es": "Español", "fr": "Français", "my": "မြန်မာဘာသာစကား", "ne": "नेपाली", "ru": "Русский", "so": "Soomaali", "vi": "Tiếng Việt", "zh": "汉语", "en-us": "English"} + language_options = { + "am": "አማርኛ", + "es": "Español", + "fr": "Français", + "my": "မြန်မာဘာသာစကား", + "ne": "नेपाली", + "ru": "Русский", + "so": "Soomaali", + "vi": "Tiếng Việt", + "zh": "汉语", + "en-us": "English", + } - income_options = {"sSI": {"_label": "incomeOptions.sSI", "_default_message": "Supplemental Security Income (SSI)"}, "gifts": {"_label": "incomeOptions.gifts", "_default_message": "Gifts/Contributions (Received)"}, "wages": {"_label": "incomeOptions.wages", "_default_message": "Wages, salaries, tips"}, "rental": {"_label": "incomeOptions.rental", "_default_message": "Rental Income"}, "alimony": {"_label": "incomeOptions.alimony", "_default_message": "Alimony (Received)"}, "boarder": {"_label": "incomeOptions.boarder", "_default_message": "Boarder or Lodger"}, "pension": {"_label": "incomeOptions.pension", "_default_message": "Military, Government, or Private Pension"}, "veteran": {"_label": "incomeOptions.veteran", "_default_message": "Veteran's Pension or Benefits"}, "investment": {"_label": "incomeOptions.investment", "_default_message": "Investment Income (interest, dividends, and profit from selling stocks)"}, "sSSurvivor": {"_label": "incomeOptions.sSSurvivor", "_default_message": "Social Security Survivor's Benefits (Widow/Widower)"}, "sSDependent": {"_label": "incomeOptions.sSDependent", "_default_message": "Social Security Dependent Benefits (retirement, disability, or survivors)"}, "workersComp": {"_label": "incomeOptions.workersComp", "_default_message": "Worker's Compensation"}, "childSupport": {"_label": "incomeOptions.childSupport", "_default_message": "Child Support (Received)"}, "deferredComp": {"_label": "incomeOptions.deferredComp", "_default_message": "Withdrawals from Deferred Compensation (IRA, Keogh, etc.)"}, "sSDisability": {"_label": "incomeOptions.sSDisability", "_default_message": "Social Security Disability Benefits"}, "sSRetirement": {"_label": "incomeOptions.sSRetirement", "_default_message": "Social Security Retirement Benefits"}, "unemployment": {"_label": "incomeOptions.unemployment", "_default_message": "Unemployment Benefits"}, "cOSDisability": {"_label": "incomeOptions.cOSDisability", "_default_message": "Colorado State Disability Benefits"}, "cashAssistance": {"_label": "incomeOptions.cashAssistance", "_default_message": "Cash Assistance Grant"}, "selfEmployment": {"_label": "incomeOptions.selfEmployment", "_default_message": "Income from freelance, independent contractor, or self-employment work"}} + income_options = { + "sSI": {"_label": "incomeOptions.sSI", "_default_message": "Supplemental Security Income (SSI)"}, + "gifts": {"_label": "incomeOptions.gifts", "_default_message": "Gifts/Contributions (Received)"}, + "wages": {"_label": "incomeOptions.wages", "_default_message": "Wages, salaries, tips"}, + "rental": {"_label": "incomeOptions.rental", "_default_message": "Rental Income"}, + "alimony": {"_label": "incomeOptions.alimony", "_default_message": "Alimony (Received)"}, + "boarder": {"_label": "incomeOptions.boarder", "_default_message": "Boarder or Lodger"}, + "pension": {"_label": "incomeOptions.pension", "_default_message": "Military, Government, or Private Pension"}, + "veteran": {"_label": "incomeOptions.veteran", "_default_message": "Veteran's Pension or Benefits"}, + "investment": { + "_label": "incomeOptions.investment", + "_default_message": "Investment Income (interest, dividends, and profit from selling stocks)", + }, + "sSSurvivor": { + "_label": "incomeOptions.sSSurvivor", + "_default_message": "Social Security Survivor's Benefits (Widow/Widower)", + }, + "sSDependent": { + "_label": "incomeOptions.sSDependent", + "_default_message": "Social Security Dependent Benefits (retirement, disability, or survivors)", + }, + "workersComp": {"_label": "incomeOptions.workersComp", "_default_message": "Worker's Compensation"}, + "childSupport": {"_label": "incomeOptions.childSupport", "_default_message": "Child Support (Received)"}, + "deferredComp": { + "_label": "incomeOptions.deferredComp", + "_default_message": "Withdrawals from Deferred Compensation (IRA, Keogh, etc.)", + }, + "sSDisability": { + "_label": "incomeOptions.sSDisability", + "_default_message": "Social Security Disability Benefits", + }, + "sSRetirement": { + "_label": "incomeOptions.sSRetirement", + "_default_message": "Social Security Retirement Benefits", + }, + "unemployment": {"_label": "incomeOptions.unemployment", "_default_message": "Unemployment Benefits"}, + "cOSDisability": { + "_label": "incomeOptions.cOSDisability", + "_default_message": "Colorado State Disability Benefits", + }, + "cashAssistance": {"_label": "incomeOptions.cashAssistance", "_default_message": "Cash Assistance Grant"}, + "selfEmployment": { + "_label": "incomeOptions.selfEmployment", + "_default_message": "Income from freelance, independent contractor, or self-employment work", + }, + } - health_insurance_options = {"you": {"chp": {"icon": {"_name": "Chp", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.chp", "_default_message": "Child Health Plan Plus (CHP+)"}, "none": {"icon": {"_name": "None", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.none-I", "_default_message": "I do not have health insurance"}, "private": {"icon": {"_name": "PrivateInsurance", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.private", "_default_message": "Private (non-employer) health insurance"}, "employer": {"icon": {"_name": "Employer", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.employer", "_default_message": "Employer-provided health insurance"}, "medicaid": {"icon": {"_name": "Medicaid", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.medicaid", "_default_message": "Health First Colorado (Full Medicaid)"}, "medicare": {"icon": {"_name": "Medicare", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.medicare", "_default_message": "Medicare"}, "dont_know": {"icon": {"_name": "Dont_know", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.dont_know", "_default_message": "Don't Know"}, "family_planning": {"icon": {"_name": "Family_planning", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.family_planning", "_default_message": "Family Planning Limited Medicaid"}, "emergency_medicaid": {"icon": {"_name": "Emergency_medicaid", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.emergency_medicaid", "_default_message": "Emergency Medicaid / Reproductive Health"}}, "them": {"chp": {"icon": {"_name": "Chp", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.chp", "_default_message": "Child Health Plan Plus (CHP+)"}, "none": {"icon": {"_name": "None", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.none-they", "_default_message": "They do not have health insurance"}, "private": {"icon": {"_name": "PrivateInsurance", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.private", "_default_message": "Private (non-employer) health insurance"}, "employer": {"icon": {"_name": "Employer", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.employer", "_default_message": "Employer-provided health insurance"}, "medicaid": {"icon": {"_name": "Medicaid", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.medicaid", "_default_message": "Health First Colorado (Full Medicaid)"}, "medicare": {"icon": {"_name": "Medicare", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.medicare", "_default_message": "Medicare"}, "dont_know": {"icon": {"_name": "Dont_know", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.dont_know", "_default_message": "Don't Know"}, "family_planning": {"icon": {"_name": "Family_planning", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.family_planning", "_default_message": "Family Planning Limited Medicaid"}, "emergency_medicaid": {"icon": {"_name": "Emergency_medicaid", "_classname": "option-card-icon"}, "_label": "healthInsuranceOptions.emergency_medicaid", "_default_message": "Emergency Medicaid / Reproductive Health"}}} + health_insurance_options = { + "you": { + "chp": { + "icon": {"_name": "Chp", "_classname": "option-card-icon"}, + "_label": "healthInsuranceOptions.chp", + "_default_message": "Child Health Plan Plus (CHP+)", + }, + "none": { + "icon": {"_name": "None", "_classname": "option-card-icon"}, + "_label": "healthInsuranceOptions.none-I", + "_default_message": "I do not have health insurance", + }, + "private": { + "icon": {"_name": "PrivateInsurance", "_classname": "option-card-icon"}, + "_label": "healthInsuranceOptions.private", + "_default_message": "Private (non-employer) health insurance", + }, + "employer": { + "icon": {"_name": "Employer", "_classname": "option-card-icon"}, + "_label": "healthInsuranceOptions.employer", + "_default_message": "Employer-provided health insurance", + }, + "medicaid": { + "icon": {"_name": "Medicaid", "_classname": "option-card-icon"}, + "_label": "healthInsuranceOptions.medicaid", + "_default_message": "Health First Colorado (Full Medicaid)", + }, + "medicare": { + "icon": {"_name": "Medicare", "_classname": "option-card-icon"}, + "_label": "healthInsuranceOptions.medicare", + "_default_message": "Medicare", + }, + "dont_know": { + "icon": {"_name": "Dont_know", "_classname": "option-card-icon"}, + "_label": "healthInsuranceOptions.dont_know", + "_default_message": "Don't Know", + }, + "family_planning": { + "icon": {"_name": "Family_planning", "_classname": "option-card-icon"}, + "_label": "healthInsuranceOptions.family_planning", + "_default_message": "Family Planning Limited Medicaid", + }, + "emergency_medicaid": { + "icon": {"_name": "Emergency_medicaid", "_classname": "option-card-icon"}, + "_label": "healthInsuranceOptions.emergency_medicaid", + "_default_message": "Emergency Medicaid / Reproductive Health", + }, + }, + "them": { + "chp": { + "icon": {"_name": "Chp", "_classname": "option-card-icon"}, + "_label": "healthInsuranceOptions.chp", + "_default_message": "Child Health Plan Plus (CHP+)", + }, + "none": { + "icon": {"_name": "None", "_classname": "option-card-icon"}, + "_label": "healthInsuranceOptions.none-they", + "_default_message": "They do not have health insurance", + }, + "private": { + "icon": {"_name": "PrivateInsurance", "_classname": "option-card-icon"}, + "_label": "healthInsuranceOptions.private", + "_default_message": "Private (non-employer) health insurance", + }, + "employer": { + "icon": {"_name": "Employer", "_classname": "option-card-icon"}, + "_label": "healthInsuranceOptions.employer", + "_default_message": "Employer-provided health insurance", + }, + "medicaid": { + "icon": {"_name": "Medicaid", "_classname": "option-card-icon"}, + "_label": "healthInsuranceOptions.medicaid", + "_default_message": "Health First Colorado (Full Medicaid)", + }, + "medicare": { + "icon": {"_name": "Medicare", "_classname": "option-card-icon"}, + "_label": "healthInsuranceOptions.medicare", + "_default_message": "Medicare", + }, + "dont_know": { + "icon": {"_name": "Dont_know", "_classname": "option-card-icon"}, + "_label": "healthInsuranceOptions.dont_know", + "_default_message": "Don't Know", + }, + "family_planning": { + "icon": {"_name": "Family_planning", "_classname": "option-card-icon"}, + "_label": "healthInsuranceOptions.family_planning", + "_default_message": "Family Planning Limited Medicaid", + }, + "emergency_medicaid": { + "icon": {"_name": "Emergency_medicaid", "_classname": "option-card-icon"}, + "_label": "healthInsuranceOptions.emergency_medicaid", + "_default_message": "Emergency Medicaid / Reproductive Health", + }, + }, + } - housing_options = {"hotel": {"_label": "housingOptions.hotel", "_default_message": "In a hotel"}, "owner": {"_label": "housingOptions.owner", "_default_message": "You or a household member owns the home or apartment"}, "renting": {"_label": "housingOptions.renting", "_default_message": "Renting"}, "shelter": {"_label": "housingOptions.shelter", "_default_message": "In a shelter or homeless"}, "preferNotToSay": {"_label": "housingOptions.preferNotToSay", "_default_message": "Prefer not to say"}, "stayingWithFriend": {"_label": "housingOptions.stayingWithFriend", "_default_message": "Staying with friend"}} + housing_options = { + "hotel": {"_label": "housingOptions.hotel", "_default_message": "In a hotel"}, + "owner": { + "_label": "housingOptions.owner", + "_default_message": "You or a household member owns the home or apartment", + }, + "renting": {"_label": "housingOptions.renting", "_default_message": "Renting"}, + "shelter": {"_label": "housingOptions.shelter", "_default_message": "In a shelter or homeless"}, + "preferNotToSay": {"_label": "housingOptions.preferNotToSay", "_default_message": "Prefer not to say"}, + "stayingWithFriend": {"_label": "housingOptions.stayingWithFriend", "_default_message": "Staying with friend"}, + } - frequency_options = {"hourly": {"_label": "frequencyOptions.hourly", "_default_message": "hourly"}, "weekly": {"_label": "frequencyOptions.weekly", "_default_message": "every week"}, "monthly": {"_label": "frequencyOptions.monthly", "_default_message": "every month"}, "biweekly": {"_label": "frequencyOptions.biweekly", "_default_message": "every 2 weeks"}} + frequency_options = { + "hourly": {"_label": "frequencyOptions.hourly", "_default_message": "hourly"}, + "weekly": {"_label": "frequencyOptions.weekly", "_default_message": "every week"}, + "monthly": {"_label": "frequencyOptions.monthly", "_default_message": "every month"}, + "biweekly": {"_label": "frequencyOptions.biweekly", "_default_message": "every 2 weeks"}, + } - expense_options = {"auto": {"_label": "expenseOptions.auto", "_default_message": "Auto Insurance Premium &/or Payment"}, "rent": {"_label": "expenseOptions.rent", "_default_message": "Rent"}, "cooling": {"_label": "expenseOptions.cooling", "_default_message": "Cooling"}, "heating": {"_label": "expenseOptions.heating", "_default_message": "Heating"}, "medical": {"_label": "expenseOptions.medical", "_default_message": "Medical Insurance Premium &/or Bills"}, "internet": {"_label": "expenseOptions.internet", "_default_message": "Internet"}, "mortgage": {"_label": "expenseOptions.mortgage", "_default_message": "Mortgage"}, "childCare": {"_label": "expenseOptions.childCare", "_default_message": "Child Care"}, "telephone": {"_label": "expenseOptions.telephone", "_default_message": "Telephone"}, "creditCard": {"_label": "expenseOptions.creditCard", "_default_message": "Credit Card Debt"}, "childSupport": {"_label": "expenseOptions.childSupport", "_default_message": "Child Support (Paid)"}, "personalLoan": {"_label": "expenseOptions.personalLoan", "_default_message": "Personal Loan"}, "studentLoans": {"_label": "expenseOptions.studentLoans", "_default_message": "Student Loans"}, "dependentCare": {"_label": "expenseOptions.dependentCare", "_default_message": "Dependent Care"}, "otherUtilities": {"_label": "expenseOptions.otherUtilities", "_default_message": "Other Utilities"}} + expense_options = { + "auto": {"_label": "expenseOptions.auto", "_default_message": "Auto Insurance Premium &/or Payment"}, + "rent": {"_label": "expenseOptions.rent", "_default_message": "Rent"}, + "cooling": {"_label": "expenseOptions.cooling", "_default_message": "Cooling"}, + "heating": {"_label": "expenseOptions.heating", "_default_message": "Heating"}, + "medical": {"_label": "expenseOptions.medical", "_default_message": "Medical Insurance Premium &/or Bills"}, + "internet": {"_label": "expenseOptions.internet", "_default_message": "Internet"}, + "mortgage": {"_label": "expenseOptions.mortgage", "_default_message": "Mortgage"}, + "childCare": {"_label": "expenseOptions.childCare", "_default_message": "Child Care"}, + "telephone": {"_label": "expenseOptions.telephone", "_default_message": "Telephone"}, + "creditCard": {"_label": "expenseOptions.creditCard", "_default_message": "Credit Card Debt"}, + "childSupport": {"_label": "expenseOptions.childSupport", "_default_message": "Child Support (Paid)"}, + "personalLoan": {"_label": "expenseOptions.personalLoan", "_default_message": "Personal Loan"}, + "studentLoans": {"_label": "expenseOptions.studentLoans", "_default_message": "Student Loans"}, + "dependentCare": {"_label": "expenseOptions.dependentCare", "_default_message": "Dependent Care"}, + "otherUtilities": {"_label": "expenseOptions.otherUtilities", "_default_message": "Other Utilities"}, + } - condition_options = {"you": {"student": {"icon": {"_name": "Student", "_classname": "option-card-icon"}, "_label": "conditionOptions.student", "_default_message": "Student at a college, university, or other post-secondary institution like a job-training program"}, "disabled": {"icon": {"_name": "Disabled", "_classname": "option-card-icon"}, "_label": "conditionOptions.disabled", "_default_message": "Have any disabilities that make you unable to work now or in the future"}, "pregnant": {"icon": {"_name": "Pregnant", "_classname": "option-card-icon"}, "_label": "conditionOptions.pregnant", "_default_message": "Pregnant"}, "longTermDisability": {"icon": {"_name": "LongTermDisability", "_classname": "option-card-icon"}, "_label": "conditionOptions.longTermDisability", "_default_message": "Any medical or developmental condition that has lasted, or is expected to last, more than 12 months"}, "blindOrVisuallyImpaired": {"icon": {"_name": "BlindOrVisuallyImpaired", "_classname": "option-card-icon"}, "_label": "conditionOptions.blindOrVisuallyImpaired", "_default_message": "Blind or visually impaired"}}, "them": {"student": {"icon": {"_name": "Student", "_classname": "option-card-icon"}, "_label": "conditionOptions.student", "_default_message": "Student at a college, university, or other post-secondary institution like a job-training program"}, "disabled": {"icon": {"_name": "Disabled", "_classname": "option-card-icon"}, "_label": "conditionOptions.disabled-them", "_default_message": "Have any disabilities that make them unable to work now or in the future"}, "pregnant": {"icon": {"_name": "Pregnant", "_classname": "option-card-icon"}, "_label": "conditionOptions.pregnant", "_default_message": "Pregnant"}, "longTermDisability": {"icon": {"_name": "LongTermDisability", "_classname": "option-card-icon"}, "_label": "conditionOptions.longTermDisability", "_default_message": "Any medical or developmental condition that has lasted, or is expected to last, more than 12 months"}, "blindOrVisuallyImpaired": {"icon": {"_name": "BlindOrVisuallyImpaired", "_classname": "option-card-icon"}, "_label": "conditionOptions.blindOrVisuallyImpaired", "_default_message": "Blind or visually impaired"}}} + condition_options = { + "you": { + "student": { + "icon": {"_name": "Student", "_classname": "option-card-icon"}, + "_label": "conditionOptions.student", + "_default_message": "Student at a college, university, or other post-secondary institution like a job-training program", + }, + "disabled": { + "icon": {"_name": "Disabled", "_classname": "option-card-icon"}, + "_label": "conditionOptions.disabled", + "_default_message": "Have any disabilities that make you unable to work now or in the future", + }, + "pregnant": { + "icon": {"_name": "Pregnant", "_classname": "option-card-icon"}, + "_label": "conditionOptions.pregnant", + "_default_message": "Pregnant", + }, + "longTermDisability": { + "icon": {"_name": "LongTermDisability", "_classname": "option-card-icon"}, + "_label": "conditionOptions.longTermDisability", + "_default_message": "Any medical or developmental condition that has lasted, or is expected to last, more than 12 months", + }, + "blindOrVisuallyImpaired": { + "icon": {"_name": "BlindOrVisuallyImpaired", "_classname": "option-card-icon"}, + "_label": "conditionOptions.blindOrVisuallyImpaired", + "_default_message": "Blind or visually impaired", + }, + }, + "them": { + "student": { + "icon": {"_name": "Student", "_classname": "option-card-icon"}, + "_label": "conditionOptions.student", + "_default_message": "Student at a college, university, or other post-secondary institution like a job-training program", + }, + "disabled": { + "icon": {"_name": "Disabled", "_classname": "option-card-icon"}, + "_label": "conditionOptions.disabled-them", + "_default_message": "Have any disabilities that make them unable to work now or in the future", + }, + "pregnant": { + "icon": {"_name": "Pregnant", "_classname": "option-card-icon"}, + "_label": "conditionOptions.pregnant", + "_default_message": "Pregnant", + }, + "longTermDisability": { + "icon": {"_name": "LongTermDisability", "_classname": "option-card-icon"}, + "_label": "conditionOptions.longTermDisability", + "_default_message": "Any medical or developmental condition that has lasted, or is expected to last, more than 12 months", + }, + "blindOrVisuallyImpaired": { + "icon": {"_name": "BlindOrVisuallyImpaired", "_classname": "option-card-icon"}, + "_label": "conditionOptions.blindOrVisuallyImpaired", + "_default_message": "Blind or visually impaired", + }, + }, + } - co_zipcodes = {"80001": "80001", "80002": "80002", "80003": "80003", "80004": "80004", "80005": "80005", "80006": "80006", "80007": "80007", "80010": "80010", "80011": "80011", "80012": "80012", "80013": "80013", "80014": "80014", "80015": "80015", "80016": "80016", "80017": "80017", "80018": "80018", "80019": "80019", "80020": "80020", "80021": "80021", "80022": "80022", "80023": "80023", "80024": "80024", "80025": "80025", "80026": "80026", "80027": "80027", "80028": "80028", "80030": "80030", "80031": "80031", "80033": "80033", "80034": "80034", "80035": "80035", "80036": "80036", "80037": "80037", "80038": "80038", "80040": "80040", "80041": "80041", "80042": "80042", "80044": "80044", "80045": "80045", "80046": "80046", "80047": "80047", "80101": "80101", "80102": "80102", "80103": "80103", "80104": "80104", "80105": "80105", "80106": "80106", "80107": "80107", "80108": "80108", "80109": "80109", "80110": "80110", "80111": "80111", "80112": "80112", "80113": "80113", "80116": "80116", "80117": "80117", "80118": "80118", "80120": "80120", "80121": "80121", "80122": "80122", "80123": "80123", "80124": "80124", "80125": "80125", "80126": "80126", "80127": "80127", "80128": "80128", "80129": "80129", "80130": "80130", "80131": "80131", "80132": "80132", "80133": "80133", "80134": "80134", "80135": "80135", "80136": "80136", "80137": "80137", "80138": "80138", "80150": "80150", "80151": "80151", "80155": "80155", "80160": "80160", "80161": "80161", "80162": "80162", "80163": "80163", "80165": "80165", "80166": "80166", "80201": "80201", "80202": "80202", "80203": "80203", "80204": "80204", "80205": "80205", "80206": "80206", "80207": "80207", "80208": "80208", "80209": "80209", "80210": "80210", "80211": "80211", "80212": "80212", "80214": "80214", "80215": "80215", "80216": "80216", "80217": "80217", "80218": "80218", "80219": "80219", "80220": "80220", "80221": "80221", "80222": "80222", "80223": "80223", "80224": "80224", "80225": "80225", "80226": "80226", "80227": "80227", "80228": "80228", "80229": "80229", "80230": "80230", "80231": "80231", "80232": "80232", "80233": "80233", "80234": "80234", "80235": "80235", "80236": "80236", "80237": "80237", "80238": "80238", "80239": "80239", "80241": "80241", "80243": "80243", "80244": "80244", "80246": "80246", "80247": "80247", "80248": "80248", "80249": "80249", "80250": "80250", "80251": "80251", "80252": "80252", "80256": "80256", "80257": "80257", "80259": "80259", "80260": "80260", "80261": "80261", "80262": "80262", "80263": "80263", "80264": "80264", "80265": "80265", "80266": "80266", "80271": "80271", "80273": "80273", "80274": "80274", "80279": "80279", "80280": "80280", "80281": "80281", "80290": "80290", "80291": "80291", "80293": "80293", "80294": "80294", "80295": "80295", "80299": "80299", "80301": "80301", "80302": "80302", "80303": "80303", "80304": "80304", "80305": "80305", "80306": "80306", "80307": "80307", "80308": "80308", "80309": "80309", "80310": "80310", "80314": "80314", "80321": "80321", "80322": "80322", "80323": "80323", "80328": "80328", "80329": "80329", "80401": "80401", "80402": "80402", "80403": "80403", "80419": "80419", "80420": "80420", "80421": "80421", "80422": "80422", "80423": "80423", "80424": "80424", "80425": "80425", "80426": "80426", "80427": "80427", "80428": "80428", "80429": "80429", "80430": "80430", "80432": "80432", "80433": "80433", "80434": "80434", "80435": "80435", "80436": "80436", "80437": "80437", "80438": "80438", "80439": "80439", "80440": "80440", "80442": "80442", "80443": "80443", "80444": "80444", "80446": "80446", "80447": "80447", "80448": "80448", "80449": "80449", "80451": "80451", "80452": "80452", "80453": "80453", "80454": "80454", "80455": "80455", "80456": "80456", "80457": "80457", "80459": "80459", "80461": "80461", "80463": "80463", "80465": "80465", "80466": "80466", "80467": "80467", "80468": "80468", "80469": "80469", "80470": "80470", "80471": "80471", "80473": "80473", "80474": "80474", "80475": "80475", "80476": "80476", "80477": "80477", "80478": "80478", "80479": "80479", "80480": "80480", "80481": "80481", "80482": "80482", "80483": "80483", "80487": "80487", "80488": "80488", "80497": "80497", "80498": "80498", "80501": "80501", "80502": "80502", "80503": "80503", "80504": "80504", "80510": "80510", "80511": "80511", "80512": "80512", "80513": "80513", "80514": "80514", "80515": "80515", "80516": "80516", "80517": "80517", "80520": "80520", "80521": "80521", "80522": "80522", "80523": "80523", "80524": "80524", "80525": "80525", "80526": "80526", "80527": "80527", "80528": "80528", "80530": "80530", "80532": "80532", "80533": "80533", "80534": "80534", "80535": "80535", "80536": "80536", "80537": "80537", "80538": "80538", "80539": "80539", "80540": "80540", "80541": "80541", "80542": "80542", "80543": "80543", "80544": "80544", "80545": "80545", "80546": "80546", "80547": "80547", "80549": "80549", "80550": "80550", "80551": "80551", "80553": "80553", "80601": "80601", "80602": "80602", "80603": "80603", "80610": "80610", "80611": "80611", "80612": "80612", "80614": "80614", "80615": "80615", "80620": "80620", "80621": "80621", "80622": "80622", "80623": "80623", "80624": "80624", "80631": "80631", "80632": "80632", "80633": "80633", "80634": "80634", "80638": "80638", "80639": "80639", "80640": "80640", "80642": "80642", "80643": "80643", "80644": "80644", "80645": "80645", "80646": "80646", "80648": "80648", "80649": "80649", "80650": "80650", "80651": "80651", "80652": "80652", "80653": "80653", "80654": "80654", "80701": "80701", "80705": "80705", "80720": "80720", "80721": "80721", "80722": "80722", "80723": "80723", "80726": "80726", "80727": "80727", "80728": "80728", "80729": "80729", "80731": "80731", "80732": "80732", "80733": "80733", "80734": "80734", "80735": "80735", "80736": "80736", "80737": "80737", "80740": "80740", "80741": "80741", "80742": "80742", "80743": "80743", "80744": "80744", "80745": "80745", "80746": "80746", "80747": "80747", "80749": "80749", "80750": "80750", "80751": "80751", "80754": "80754", "80755": "80755", "80757": "80757", "80758": "80758", "80759": "80759", "80801": "80801", "80802": "80802", "80804": "80804", "80805": "80805", "80807": "80807", "80808": "80808", "80809": "80809", "80810": "80810", "80812": "80812", "80813": "80813", "80814": "80814", "80815": "80815", "80816": "80816", "80817": "80817", "80818": "80818", "80819": "80819", "80820": "80820", "80821": "80821", "80822": "80822", "80823": "80823", "80824": "80824", "80825": "80825", "80826": "80826", "80827": "80827", "80828": "80828", "80829": "80829", "80830": "80830", "80831": "80831", "80832": "80832", "80833": "80833", "80834": "80834", "80835": "80835", "80836": "80836", "80840": "80840", "80841": "80841", "80860": "80860", "80861": "80861", "80862": "80862", "80863": "80863", "80864": "80864", "80866": "80866", "80901": "80901", "80902": "80902", "80903": "80903", "80904": "80904", "80905": "80905", "80906": "80906", "80907": "80907", "80908": "80908", "80909": "80909", "80910": "80910", "80911": "80911", "80912": "80912", "80913": "80913", "80914": "80914", "80915": "80915", "80916": "80916", "80917": "80917", "80918": "80918", "80919": "80919", "80920": "80920", "80921": "80921", "80922": "80922", "80923": "80923", "80924": "80924", "80925": "80925", "80926": "80926", "80927": "80927", "80928": "80928", "80929": "80929", "80930": "80930", "80931": "80931", "80932": "80932", "80933": "80933", "80934": "80934", "80935": "80935", "80936": "80936", "80937": "80937", "80938": "80938", "80939": "80939", "80940": "80940", "80941": "80941", "80942": "80942", "80943": "80943", "80944": "80944", "80945": "80945", "80946": "80946", "80947": "80947", "80949": "80949", "80950": "80950", "80951": "80951", "80960": "80960", "80962": "80962", "80970": "80970", "80977": "80977", "80995": "80995", "80997": "80997", "81001": "81001", "81002": "81002", "81003": "81003", "81004": "81004", "81005": "81005", "81006": "81006", "81007": "81007", "81008": "81008", "81009": "81009", "81010": "81010", "81011": "81011", "81012": "81012", "81019": "81019", "81020": "81020", "81021": "81021", "81022": "81022", "81023": "81023", "81024": "81024", "81025": "81025", "81027": "81027", "81029": "81029", "81030": "81030", "81033": "81033", "81034": "81034", "81036": "81036", "81038": "81038", "81039": "81039", "81040": "81040", "81041": "81041", "81043": "81043", "81044": "81044", "81045": "81045", "81046": "81046", "81047": "81047", "81049": "81049", "81050": "81050", "81052": "81052", "81054": "81054", "81055": "81055", "81057": "81057", "81058": "81058", "81059": "81059", "81062": "81062", "81063": "81063", "81064": "81064", "81067": "81067", "81069": "81069", "81071": "81071", "81073": "81073", "81075": "81075", "81076": "81076", "81077": "81077", "81081": "81081", "81082": "81082", "81084": "81084", "81087": "81087", "81089": "81089", "81090": "81090", "81091": "81091", "81092": "81092", "81101": "81101", "81102": "81102", "81120": "81120", "81121": "81121", "81122": "81122", "81123": "81123", "81124": "81124", "81125": "81125", "81126": "81126", "81127": "81127", "81128": "81128", "81129": "81129", "81130": "81130", "81131": "81131", "81132": "81132", "81133": "81133", "81134": "81134", "81135": "81135", "81136": "81136", "81137": "81137", "81138": "81138", "81140": "81140", "81141": "81141", "81143": "81143", "81144": "81144", "81146": "81146", "81147": "81147", "81148": "81148", "81149": "81149", "81151": "81151", "81152": "81152", "81153": "81153", "81154": "81154", "81155": "81155", "81157": "81157", "81201": "81201", "81210": "81210", "81211": "81211", "81212": "81212", "81215": "81215", "81220": "81220", "81221": "81221", "81222": "81222", "81223": "81223", "81224": "81224", "81225": "81225", "81226": "81226", "81227": "81227", "81228": "81228", "81230": "81230", "81231": "81231", "81232": "81232", "81233": "81233", "81235": "81235", "81236": "81236", "81237": "81237", "81239": "81239", "81240": "81240", "81241": "81241", "81242": "81242", "81243": "81243", "81244": "81244", "81247": "81247", "81248": "81248", "81251": "81251", "81252": "81252", "81253": "81253", "81290": "81290", "81301": "81301", "81302": "81302", "81303": "81303", "81320": "81320", "81321": "81321", "81323": "81323", "81324": "81324", "81325": "81325", "81326": "81326", "81327": "81327", "81328": "81328", "81329": "81329", "81330": "81330", "81331": "81331", "81332": "81332", "81334": "81334", "81335": "81335", "81401": "81401", "81402": "81402", "81403": "81403", "81410": "81410", "81411": "81411", "81413": "81413", "81414": "81414", "81415": "81415", "81416": "81416", "81418": "81418", "81419": "81419", "81420": "81420", "81422": "81422", "81423": "81423", "81424": "81424", "81425": "81425", "81426": "81426", "81427": "81427", "81428": "81428", "81429": "81429", "81430": "81430", "81431": "81431", "81432": "81432", "81433": "81433", "81434": "81434", "81435": "81435", "81501": "81501", "81502": "81502", "81503": "81503", "81504": "81504", "81505": "81505", "81506": "81506", "81507": "81507", "81520": "81520", "81521": "81521", "81522": "81522", "81523": "81523", "81524": "81524", "81525": "81525", "81526": "81526", "81527": "81527", "81601": "81601", "81602": "81602", "81610": "81610", "81611": "81611", "81612": "81612", "81615": "81615", "81620": "81620", "81621": "81621", "81623": "81623", "81624": "81624", "81625": "81625", "81626": "81626", "81630": "81630", "81631": "81631", "81632": "81632", "81633": "81633", "81635": "81635", "81636": "81636", "81637": "81637", "81638": "81638", "81639": "81639", "81640": "81640", "81641": "81641", "81642": "81642", "81643": "81643", "81645": "81645", "81646": "81646", "81647": "81647", "81648": "81648", "81649": "81649", "81650": "81650", "81652": "81652", "81653": "81653", "81654": "81654", "81655": "81655", "81656": "81656", "81657": "81657", "81658": "81658"} - - counties_by_zipcode = {"80002": {"Adams County": "Adams County", "Denver County": "Denver County", "Jefferson County": "Jefferson County"}, "80003": {"Adams County": "Adams County", "Jefferson County": "Jefferson County"}, "80004": {"Jefferson County": "Jefferson County"}, "80005": {"Jefferson County": "Jefferson County", "Broomfield County": "Broomfield County"}, "80007": {"Boulder County": "Boulder County", "Jefferson County": "Jefferson County", "Broomfield County": "Broomfield County"}, "80010": {"Adams County": "Adams County", "Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80011": {"Adams County": "Adams County", "Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80012": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80013": {"Arapahoe County": "Arapahoe County"}, "80014": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80015": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80016": {"Denver County": "Denver County", "Elbert County": "Elbert County", "Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, "80017": {"Arapahoe County": "Arapahoe County"}, "80018": {"Adams County": "Adams County", "Arapahoe County": "Arapahoe County"}, "80019": {"Adams County": "Adams County", "Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80020": {"Adams County": "Adams County", "Boulder County": "Boulder County", "Jefferson County": "Jefferson County", "Broomfield County": "Broomfield County"}, "80021": {"Boulder County": "Boulder County", "Jefferson County": "Jefferson County", "Broomfield County": "Broomfield County"}, "80022": {"Adams County": "Adams County", "Denver County": "Denver County"}, "80023": {"Weld County": "Weld County", "Adams County": "Adams County", "Boulder County": "Boulder County", "Broomfield County": "Broomfield County"}, "80024": {"Adams County": "Adams County"}, "80025": {"Boulder County": "Boulder County", "Jefferson County": "Jefferson County"}, "80026": {"Weld County": "Weld County", "Boulder County": "Boulder County", "Broomfield County": "Broomfield County"}, "80027": {"Boulder County": "Boulder County", "Jefferson County": "Jefferson County", "Broomfield County": "Broomfield County"}, "80030": {"Adams County": "Adams County", "Jefferson County": "Jefferson County"}, "80031": {"Adams County": "Adams County", "Jefferson County": "Jefferson County", "Broomfield County": "Broomfield County"}, "80033": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, "80045": {"Adams County": "Adams County", "Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80101": {"Elbert County": "Elbert County", "Arapahoe County": "Arapahoe County"}, "80102": {"Weld County": "Weld County", "Adams County": "Adams County", "Elbert County": "Elbert County", "Arapahoe County": "Arapahoe County"}, "80103": {"Adams County": "Adams County", "Elbert County": "Elbert County", "Morgan County": "Morgan County", "Arapahoe County": "Arapahoe County"}, "80104": {"Douglas County": "Douglas County"}, "80105": {"Adams County": "Adams County", "Elbert County": "Elbert County", "Lincoln County": "Lincoln County", "Arapahoe County": "Arapahoe County", "Washington County": "Washington County"}, "80106": {"Elbert County": "Elbert County", "Douglas County": "Douglas County", "El Paso County": "El Paso County"}, "80107": {"Elbert County": "Elbert County", "Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, "80108": {"Douglas County": "Douglas County"}, "80109": {"Douglas County": "Douglas County"}, "80110": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80111": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80112": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, "80113": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80116": {"Elbert County": "Elbert County", "Douglas County": "Douglas County"}, "80117": {"Elbert County": "Elbert County"}, "80118": {"Elbert County": "Elbert County", "Douglas County": "Douglas County", "El Paso County": "El Paso County"}, "80120": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, "80121": {"Arapahoe County": "Arapahoe County"}, "80122": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, "80123": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County", "Jefferson County": "Jefferson County"}, "80124": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, "80125": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County", "Jefferson County": "Jefferson County"}, "80126": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, "80127": {"Denver County": "Denver County", "Douglas County": "Douglas County", "Jefferson County": "Jefferson County"}, "80128": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County", "Jefferson County": "Jefferson County"}, "80129": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, "80130": {"Douglas County": "Douglas County"}, "80131": {"Douglas County": "Douglas County"}, "80132": {"Douglas County": "Douglas County", "El Paso County": "El Paso County"}, "80133": {"Teller County": "Teller County", "Douglas County": "Douglas County", "El Paso County": "El Paso County"}, "80134": {"Elbert County": "Elbert County", "Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, "80135": {"Park County": "Park County", "Teller County": "Teller County", "Douglas County": "Douglas County", "El Paso County": "El Paso County", "Jefferson County": "Jefferson County"}, "80136": {"Weld County": "Weld County", "Adams County": "Adams County", "Elbert County": "Elbert County", "Arapahoe County": "Arapahoe County"}, "80137": {"Adams County": "Adams County", "Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80138": {"Elbert County": "Elbert County", "Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, "80202": {"Denver County": "Denver County"}, "80203": {"Denver County": "Denver County"}, "80204": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, "80205": {"Denver County": "Denver County"}, "80206": {"Denver County": "Denver County"}, "80207": {"Denver County": "Denver County"}, "80209": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80210": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80211": {"Denver County": "Denver County"}, "80212": {"Adams County": "Adams County", "Denver County": "Denver County", "Jefferson County": "Jefferson County"}, "80214": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, "80215": {"Jefferson County": "Jefferson County"}, "80216": {"Adams County": "Adams County", "Denver County": "Denver County"}, "80218": {"Denver County": "Denver County"}, "80219": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County", "Jefferson County": "Jefferson County"}, "80220": {"Adams County": "Adams County", "Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80221": {"Adams County": "Adams County", "Denver County": "Denver County"}, "80222": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80223": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80224": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80226": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, "80227": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, "80228": {"Jefferson County": "Jefferson County"}, "80229": {"Adams County": "Adams County"}, "80230": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80231": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80232": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, "80233": {"Adams County": "Adams County"}, "80234": {"Adams County": "Adams County", "Broomfield County": "Broomfield County"}, "80235": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, "80236": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County", "Jefferson County": "Jefferson County"}, "80237": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80238": {"Adams County": "Adams County", "Denver County": "Denver County"}, "80239": {"Adams County": "Adams County", "Denver County": "Denver County"}, "80241": {"Adams County": "Adams County"}, "80246": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80247": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, "80249": {"Adams County": "Adams County", "Denver County": "Denver County"}, "80260": {"Adams County": "Adams County"}, "80264": {"Denver County": "Denver County"}, "80290": {"Denver County": "Denver County"}, "80293": {"Denver County": "Denver County"}, "80294": {"Denver County": "Denver County"}, "80301": {"Boulder County": "Boulder County"}, "80302": {"Boulder County": "Boulder County"}, "80303": {"Boulder County": "Boulder County", "Jefferson County": "Jefferson County"}, "80304": {"Boulder County": "Boulder County"}, "80305": {"Boulder County": "Boulder County"}, "80310": {"Boulder County": "Boulder County"}, "80401": {"Jefferson County": "Jefferson County"}, "80403": {"Gilpin County": "Gilpin County", "Boulder County": "Boulder County", "Jefferson County": "Jefferson County", "Clear Creek County": "Clear Creek County"}, "80419": {"Jefferson County": "Jefferson County"}, "80420": {"Lake County": "Lake County", "Park County": "Park County", "Summit County": "Summit County"}, "80421": {"Park County": "Park County", "Jefferson County": "Jefferson County", "Clear Creek County": "Clear Creek County"}, "80422": {"Grand County": "Grand County", "Gilpin County": "Gilpin County", "Boulder County": "Boulder County", "Jefferson County": "Jefferson County", "Clear Creek County": "Clear Creek County"}, "80423": {"Eagle County": "Eagle County", "Grand County": "Grand County", "Routt County": "Routt County", "Summit County": "Summit County"}, "80424": {"Lake County": "Lake County", "Park County": "Park County", "Summit County": "Summit County"}, "80425": {"Douglas County": "Douglas County", "Jefferson County": "Jefferson County"}, "80426": {"Eagle County": "Eagle County", "Routt County": "Routt County", "Garfield County": "Garfield County"}, "80427": {"Gilpin County": "Gilpin County", "Jefferson County": "Jefferson County", "Clear Creek County": "Clear Creek County"}, "80428": {"Routt County": "Routt County", "Jackson County": "Jackson County"}, "80432": {"Park County": "Park County"}, "80433": {"Park County": "Park County", "Douglas County": "Douglas County", "Jefferson County": "Jefferson County"}, "80434": {"Jackson County": "Jackson County"}, "80435": {"Park County": "Park County", "Summit County": "Summit County", "Clear Creek County": "Clear Creek County"}, "80436": {"Grand County": "Grand County", "Clear Creek County": "Clear Creek County"}, "80438": {"Grand County": "Grand County", "Clear Creek County": "Clear Creek County"}, "80439": {"Park County": "Park County", "Gilpin County": "Gilpin County", "Jefferson County": "Jefferson County", "Clear Creek County": "Clear Creek County"}, "80440": {"Lake County": "Lake County", "Park County": "Park County", "Summit County": "Summit County"}, "80442": {"Grand County": "Grand County"}, "80443": {"Lake County": "Lake County", "Park County": "Park County", "Eagle County": "Eagle County", "Summit County": "Summit County"}, "80444": {"Park County": "Park County", "Summit County": "Summit County", "Clear Creek County": "Clear Creek County"}, "80446": {"Grand County": "Grand County", "Boulder County": "Boulder County", "Jackson County": "Jackson County"}, "80447": {"Grand County": "Grand County", "Boulder County": "Boulder County", "Jackson County": "Jackson County", "Larimer County": "Larimer County"}, "80448": {"Park County": "Park County", "Summit County": "Summit County", "Jefferson County": "Jefferson County", "Clear Creek County": "Clear Creek County"}, "80449": {"Lake County": "Lake County", "Park County": "Park County", "Chaffee County": "Chaffee County", "Fremont County": "Fremont County"}, "80451": {"Grand County": "Grand County"}, "80452": {"Park County": "Park County", "Grand County": "Grand County", "Gilpin County": "Gilpin County", "Clear Creek County": "Clear Creek County"}, "80453": {"Jefferson County": "Jefferson County"}, "80454": {"Jefferson County": "Jefferson County"}, "80455": {"Boulder County": "Boulder County"}, "80456": {"Park County": "Park County", "Summit County": "Summit County", "Jefferson County": "Jefferson County"}, "80457": {"Jefferson County": "Jefferson County"}, "80459": {"Eagle County": "Eagle County", "Grand County": "Grand County", "Routt County": "Routt County", "Summit County": "Summit County", "Jackson County": "Jackson County"}, "80461": {"Lake County": "Lake County", "Park County": "Park County", "Eagle County": "Eagle County", "Pitkin County": "Pitkin County", "Summit County": "Summit County", "Chaffee County": "Chaffee County"}, "80463": {"Eagle County": "Eagle County", "Grand County": "Grand County", "Routt County": "Routt County"}, "80465": {"Jefferson County": "Jefferson County"}, "80466": {"Grand County": "Grand County", "Gilpin County": "Gilpin County", "Boulder County": "Boulder County"}, "80467": {"Grand County": "Grand County", "Routt County": "Routt County", "Rio Blanco County": "Rio Blanco County"}, "80468": {"Grand County": "Grand County", "Summit County": "Summit County", "Clear Creek County": "Clear Creek County"}, "80469": {"Routt County": "Routt County", "Rio Blanco County": "Rio Blanco County"}, "80470": {"Park County": "Park County", "Jefferson County": "Jefferson County", "Clear Creek County": "Clear Creek County"}, "80471": {"Gilpin County": "Gilpin County", "Boulder County": "Boulder County"}, "80473": {"Grand County": "Grand County", "Jackson County": "Jackson County"}, "80475": {"Park County": "Park County"}, "80476": {"Grand County": "Grand County", "Summit County": "Summit County", "Clear Creek County": "Clear Creek County"}, "80477": {"Routt County": "Routt County"}, "80478": {"Grand County": "Grand County"}, "80479": {"Eagle County": "Eagle County", "Routt County": "Routt County"}, "80480": {"Grand County": "Grand County", "Routt County": "Routt County", "Jackson County": "Jackson County", "Larimer County": "Larimer County"}, "80481": {"Grand County": "Grand County", "Boulder County": "Boulder County"}, "80482": {"Grand County": "Grand County", "Gilpin County": "Gilpin County", "Boulder County": "Boulder County", "Clear Creek County": "Clear Creek County"}, "80483": {"Routt County": "Routt County", "Garfield County": "Garfield County", "Rio Blanco County": "Rio Blanco County"}, "80487": {"Grand County": "Grand County", "Routt County": "Routt County", "Jackson County": "Jackson County"}, "80488": {"Routt County": "Routt County"}, "80497": {"Grand County": "Grand County", "Summit County": "Summit County", "Clear Creek County": "Clear Creek County"}, "80498": {"Eagle County": "Eagle County", "Grand County": "Grand County", "Summit County": "Summit County"}, "80501": {"Weld County": "Weld County", "Boulder County": "Boulder County"}, "80503": {"Boulder County": "Boulder County", "Larimer County": "Larimer County"}, "80504": {"Weld County": "Weld County", "Boulder County": "Boulder County", "Larimer County": "Larimer County"}, "80510": {"Grand County": "Grand County", "Boulder County": "Boulder County", "Larimer County": "Larimer County"}, "80511": {"Larimer County": "Larimer County"}, "80512": {"Grand County": "Grand County", "Jackson County": "Jackson County", "Larimer County": "Larimer County"}, "80513": {"Weld County": "Weld County", "Boulder County": "Boulder County", "Larimer County": "Larimer County"}, "80514": {"Weld County": "Weld County", "Broomfield County": "Broomfield County"}, "80515": {"Larimer County": "Larimer County"}, "80516": {"Weld County": "Weld County", "Adams County": "Adams County", "Boulder County": "Boulder County", "Broomfield County": "Broomfield County"}, "80517": {"Grand County": "Grand County", "Boulder County": "Boulder County", "Larimer County": "Larimer County"}, "80520": {"Weld County": "Weld County"}, "80521": {"Larimer County": "Larimer County"}, "80524": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, "80525": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, "80526": {"Larimer County": "Larimer County"}, "80528": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, "80530": {"Weld County": "Weld County"}, "80532": {"Larimer County": "Larimer County"}, "80534": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, "80535": {"Larimer County": "Larimer County"}, "80536": {"Larimer County": "Larimer County"}, "80537": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, "80538": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, "80540": {"Boulder County": "Boulder County", "Larimer County": "Larimer County"}, "80542": {"Weld County": "Weld County"}, "80543": {"Weld County": "Weld County"}, "80544": {"Boulder County": "Boulder County"}, "80545": {"Larimer County": "Larimer County"}, "80546": {"Weld County": "Weld County"}, "80547": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, "80549": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, "80550": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, "80601": {"Weld County": "Weld County", "Adams County": "Adams County"}, "80602": {"Weld County": "Weld County", "Adams County": "Adams County", "Broomfield County": "Broomfield County"}, "80603": {"Weld County": "Weld County", "Adams County": "Adams County", "Denver County": "Denver County", "Broomfield County": "Broomfield County"}, "80610": {"Weld County": "Weld County"}, "80611": {"Weld County": "Weld County", "Morgan County": "Morgan County"}, "80612": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, "80615": {"Weld County": "Weld County"}, "80620": {"Weld County": "Weld County"}, "80621": {"Weld County": "Weld County"}, "80622": {"Weld County": "Weld County"}, "80623": {"Weld County": "Weld County"}, "80624": {"Weld County": "Weld County"}, "80631": {"Weld County": "Weld County"}, "80634": {"Weld County": "Weld County"}, "80640": {"Adams County": "Adams County"}, "80642": {"Weld County": "Weld County", "Adams County": "Adams County", "Denver County": "Denver County"}, "80643": {"Weld County": "Weld County", "Adams County": "Adams County"}, "80644": {"Weld County": "Weld County"}, "80645": {"Weld County": "Weld County"}, "80648": {"Weld County": "Weld County"}, "80649": {"Weld County": "Weld County", "Morgan County": "Morgan County"}, "80650": {"Weld County": "Weld County"}, "80651": {"Weld County": "Weld County"}, "80652": {"Weld County": "Weld County", "Adams County": "Adams County", "Morgan County": "Morgan County"}, "80653": {"Morgan County": "Morgan County"}, "80654": {"Weld County": "Weld County", "Adams County": "Adams County", "Morgan County": "Morgan County"}, "80701": {"Weld County": "Weld County", "Adams County": "Adams County", "Morgan County": "Morgan County", "Washington County": "Washington County"}, "80705": {"Morgan County": "Morgan County"}, "80720": {"Yuma County": "Yuma County", "Logan County": "Logan County", "Morgan County": "Morgan County", "Washington County": "Washington County"}, "80721": {"Phillips County": "Phillips County", "Sedgwick County": "Sedgwick County"}, "80722": {"Logan County": "Logan County", "Washington County": "Washington County"}, "80723": {"Morgan County": "Morgan County", "Washington County": "Washington County"}, "80726": {"Logan County": "Logan County", "Sedgwick County": "Sedgwick County"}, "80727": {"Yuma County": "Yuma County"}, "80728": {"Logan County": "Logan County", "Sedgwick County": "Sedgwick County", "Washington County": "Washington County"}, "80729": {"Weld County": "Weld County"}, "80731": {"Yuma County": "Yuma County", "Logan County": "Logan County", "Phillips County": "Phillips County", "Sedgwick County": "Sedgwick County", "Washington County": "Washington County"}, "80733": {"Logan County": "Logan County", "Morgan County": "Morgan County", "Washington County": "Washington County"}, "80734": {"Yuma County": "Yuma County", "Phillips County": "Phillips County", "Sedgwick County": "Sedgwick County"}, "80735": {"Yuma County": "Yuma County", "Kit Carson County": "Kit Carson County"}, "80736": {"Logan County": "Logan County"}, "80737": {"Phillips County": "Phillips County", "Sedgwick County": "Sedgwick County"}, "80740": {"Lincoln County": "Lincoln County", "Washington County": "Washington County"}, "80741": {"Weld County": "Weld County", "Logan County": "Logan County", "Morgan County": "Morgan County", "Washington County": "Washington County"}, "80742": {"Weld County": "Weld County", "Logan County": "Logan County", "Morgan County": "Morgan County"}, "80743": {"Yuma County": "Yuma County", "Logan County": "Logan County", "Washington County": "Washington County"}, "80744": {"Phillips County": "Phillips County", "Sedgwick County": "Sedgwick County"}, "80745": {"Weld County": "Weld County", "Logan County": "Logan County"}, "80746": {"Phillips County": "Phillips County"}, "80747": {"Logan County": "Logan County"}, "80749": {"Logan County": "Logan County", "Phillips County": "Phillips County", "Sedgwick County": "Sedgwick County"}, "80750": {"Weld County": "Weld County", "Logan County": "Logan County", "Morgan County": "Morgan County", "Washington County": "Washington County"}, "80751": {"Logan County": "Logan County", "Washington County": "Washington County"}, "80754": {"Weld County": "Weld County", "Logan County": "Logan County", "Morgan County": "Morgan County"}, "80755": {"Yuma County": "Yuma County"}, "80757": {"Adams County": "Adams County", "Morgan County": "Morgan County", "Lincoln County": "Lincoln County", "Arapahoe County": "Arapahoe County", "Washington County": "Washington County"}, "80758": {"Yuma County": "Yuma County", "Phillips County": "Phillips County"}, "80759": {"Yuma County": "Yuma County", "Logan County": "Logan County", "Phillips County": "Phillips County", "Washington County": "Washington County"}, "80801": {"Washington County": "Washington County"}, "80802": {"Kiowa County": "Kiowa County", "Cheyenne County": "Cheyenne County", "Kit Carson County": "Kit Carson County"}, "80804": {"Lincoln County": "Lincoln County", "Kit Carson County": "Kit Carson County", "Washington County": "Washington County"}, "80805": {"Yuma County": "Yuma County", "Cheyenne County": "Cheyenne County", "Kit Carson County": "Kit Carson County"}, "80807": {"Yuma County": "Yuma County", "Cheyenne County": "Cheyenne County", "Kit Carson County": "Kit Carson County"}, "80808": {"Elbert County": "Elbert County", "El Paso County": "El Paso County"}, "80809": {"Teller County": "Teller County", "El Paso County": "El Paso County"}, "80810": {"Kiowa County": "Kiowa County", "Cheyenne County": "Cheyenne County", "Kit Carson County": "Kit Carson County"}, "80812": {"Yuma County": "Yuma County", "Kit Carson County": "Kit Carson County", "Washington County": "Washington County"}, "80813": {"Teller County": "Teller County", "El Paso County": "El Paso County", "Fremont County": "Fremont County"}, "80814": {"Teller County": "Teller County"}, "80815": {"Lincoln County": "Lincoln County", "Cheyenne County": "Cheyenne County", "Kit Carson County": "Kit Carson County", "Washington County": "Washington County"}, "80816": {"Park County": "Park County", "Teller County": "Teller County", "Fremont County": "Fremont County"}, "80817": {"Pueblo County": "Pueblo County", "El Paso County": "El Paso County"}, "80818": {"Lincoln County": "Lincoln County", "Washington County": "Washington County"}, "80819": {"Teller County": "Teller County", "El Paso County": "El Paso County"}, "80820": {"Park County": "Park County", "Teller County": "Teller County", "Fremont County": "Fremont County"}, "80821": {"Elbert County": "Elbert County", "Lincoln County": "Lincoln County", "Cheyenne County": "Cheyenne County", "Kit Carson County": "Kit Carson County"}, "80822": {"Yuma County": "Yuma County", "Kit Carson County": "Kit Carson County", "Washington County": "Washington County"}, "80823": {"Kiowa County": "Kiowa County", "Crowley County": "Crowley County", "Lincoln County": "Lincoln County", "Cheyenne County": "Cheyenne County"}, "80824": {"Yuma County": "Yuma County", "Kit Carson County": "Kit Carson County"}, "80825": {"Kiowa County": "Kiowa County", "Lincoln County": "Lincoln County", "Cheyenne County": "Cheyenne County", "Kit Carson County": "Kit Carson County"}, "80827": {"Park County": "Park County", "Teller County": "Teller County", "Douglas County": "Douglas County", "Jefferson County": "Jefferson County"}, "80828": {"Elbert County": "Elbert County", "Lincoln County": "Lincoln County", "Arapahoe County": "Arapahoe County", "Washington County": "Washington County"}, "80829": {"Teller County": "Teller County", "El Paso County": "El Paso County"}, "80830": {"Elbert County": "Elbert County", "El Paso County": "El Paso County", "Lincoln County": "Lincoln County"}, "80831": {"Elbert County": "Elbert County", "El Paso County": "El Paso County"}, "80832": {"Elbert County": "Elbert County", "El Paso County": "El Paso County", "Lincoln County": "Lincoln County"}, "80833": {"Elbert County": "Elbert County", "Pueblo County": "Pueblo County", "Crowley County": "Crowley County", "El Paso County": "El Paso County", "Lincoln County": "Lincoln County"}, "80834": {"Cheyenne County": "Cheyenne County", "Kit Carson County": "Kit Carson County", "Washington County": "Washington County"}, "80835": {"Elbert County": "Elbert County", "El Paso County": "El Paso County"}, "80836": {"Yuma County": "Yuma County", "Cheyenne County": "Cheyenne County", "Kit Carson County": "Kit Carson County"}, "80840": {"El Paso County": "El Paso County"}, "80860": {"Teller County": "Teller County", "El Paso County": "El Paso County", "Fremont County": "Fremont County"}, "80861": {"Yuma County": "Yuma County", "Cheyenne County": "Cheyenne County", "Kit Carson County": "Kit Carson County", "Washington County": "Washington County"}, "80862": {"Lincoln County": "Lincoln County", "Cheyenne County": "Cheyenne County", "Kit Carson County": "Kit Carson County"}, "80863": {"Teller County": "Teller County", "Douglas County": "Douglas County", "El Paso County": "El Paso County"}, "80864": {"Pueblo County": "Pueblo County", "Crowley County": "Crowley County", "El Paso County": "El Paso County", "Lincoln County": "Lincoln County"}, "80902": {"El Paso County": "El Paso County"}, "80903": {"El Paso County": "El Paso County"}, "80904": {"El Paso County": "El Paso County"}, "80905": {"El Paso County": "El Paso County"}, "80906": {"Teller County": "Teller County", "El Paso County": "El Paso County"}, "80907": {"El Paso County": "El Paso County"}, "80908": {"Elbert County": "Elbert County", "Douglas County": "Douglas County", "El Paso County": "El Paso County"}, "80909": {"El Paso County": "El Paso County"}, "80910": {"El Paso County": "El Paso County"}, "80911": {"El Paso County": "El Paso County"}, "80913": {"El Paso County": "El Paso County"}, "80914": {"El Paso County": "El Paso County"}, "80915": {"El Paso County": "El Paso County"}, "80916": {"El Paso County": "El Paso County"}, "80917": {"El Paso County": "El Paso County"}, "80918": {"El Paso County": "El Paso County"}, "80919": {"El Paso County": "El Paso County"}, "80920": {"El Paso County": "El Paso County"}, "80921": {"Teller County": "Teller County", "El Paso County": "El Paso County"}, "80922": {"El Paso County": "El Paso County"}, "80923": {"El Paso County": "El Paso County"}, "80924": {"El Paso County": "El Paso County"}, "80925": {"El Paso County": "El Paso County"}, "80926": {"Teller County": "Teller County", "El Paso County": "El Paso County", "Fremont County": "Fremont County"}, "80927": {"El Paso County": "El Paso County"}, "80928": {"Pueblo County": "Pueblo County", "El Paso County": "El Paso County"}, "80929": {"El Paso County": "El Paso County"}, "80930": {"El Paso County": "El Paso County"}, "80938": {"El Paso County": "El Paso County"}, "80939": {"El Paso County": "El Paso County"}, "80951": {"El Paso County": "El Paso County"}, "81001": {"Pueblo County": "Pueblo County"}, "81003": {"Pueblo County": "Pueblo County"}, "81004": {"Pueblo County": "Pueblo County"}, "81005": {"Custer County": "Custer County", "Pueblo County": "Pueblo County", "Fremont County": "Fremont County"}, "81006": {"Pueblo County": "Pueblo County"}, "81007": {"Pueblo County": "Pueblo County", "Fremont County": "Fremont County"}, "81008": {"Pueblo County": "Pueblo County", "El Paso County": "El Paso County"}, "81019": {"Pueblo County": "Pueblo County"}, "81020": {"Pueblo County": "Pueblo County", "Huerfano County": "Huerfano County", "Las Animas County": "Las Animas County"}, "81021": {"Bent County": "Bent County", "Kiowa County": "Kiowa County", "Otero County": "Otero County", "Crowley County": "Crowley County", "Lincoln County": "Lincoln County"}, "81022": {"Pueblo County": "Pueblo County", "Huerfano County": "Huerfano County"}, "81023": {"Custer County": "Custer County", "Pueblo County": "Pueblo County"}, "81024": {"Las Animas County": "Las Animas County"}, "81025": {"Pueblo County": "Pueblo County", "Crowley County": "Crowley County", "El Paso County": "El Paso County", "Lincoln County": "Lincoln County"}, "81027": {"Las Animas County": "Las Animas County"}, "81029": {"Baca County": "Baca County"}, "81030": {"Otero County": "Otero County"}, "81033": {"Crowley County": "Crowley County"}, "81036": {"Bent County": "Bent County", "Kiowa County": "Kiowa County", "Prowers County": "Prowers County", "Cheyenne County": "Cheyenne County"}, "81038": {"Bent County": "Bent County"}, "81039": {"Otero County": "Otero County", "Pueblo County": "Pueblo County", "Crowley County": "Crowley County", "Huerfano County": "Huerfano County", "Las Animas County": "Las Animas County"}, "81040": {"Custer County": "Custer County", "Pueblo County": "Pueblo County", "Alamosa County": "Alamosa County", "Costilla County": "Costilla County", "Huerfano County": "Huerfano County", "Saguache County": "Saguache County"}, "81041": {"Baca County": "Baca County", "Prowers County": "Prowers County"}, "81043": {"Prowers County": "Prowers County"}, "81044": {"Baca County": "Baca County", "Bent County": "Bent County"}, "81045": {"Kiowa County": "Kiowa County", "Lincoln County": "Lincoln County", "Cheyenne County": "Cheyenne County"}, "81047": {"Baca County": "Baca County", "Kiowa County": "Kiowa County", "Prowers County": "Prowers County"}, "81049": {"Baca County": "Baca County", "Bent County": "Bent County", "Otero County": "Otero County", "Las Animas County": "Las Animas County"}, "81050": {"Bent County": "Bent County", "Kiowa County": "Kiowa County", "Otero County": "Otero County", "Crowley County": "Crowley County", "Las Animas County": "Las Animas County"}, "81052": {"Baca County": "Baca County", "Bent County": "Bent County", "Kiowa County": "Kiowa County", "Prowers County": "Prowers County"}, "81054": {"Baca County": "Baca County", "Bent County": "Bent County", "Kiowa County": "Kiowa County", "Otero County": "Otero County", "Las Animas County": "Las Animas County"}, "81055": {"Costilla County": "Costilla County", "Huerfano County": "Huerfano County", "Las Animas County": "Las Animas County"}, "81057": {"Bent County": "Bent County"}, "81058": {"Otero County": "Otero County", "Crowley County": "Crowley County"}, "81059": {"Otero County": "Otero County", "Pueblo County": "Pueblo County", "Las Animas County": "Las Animas County"}, "81062": {"Otero County": "Otero County", "Pueblo County": "Pueblo County", "Crowley County": "Crowley County", "El Paso County": "El Paso County", "Lincoln County": "Lincoln County"}, "81063": {"Otero County": "Otero County", "Crowley County": "Crowley County", "Lincoln County": "Lincoln County"}, "81064": {"Baca County": "Baca County", "Las Animas County": "Las Animas County"}, "81067": {"Otero County": "Otero County", "Pueblo County": "Pueblo County", "Crowley County": "Crowley County", "Las Animas County": "Las Animas County"}, "81069": {"Custer County": "Custer County", "Pueblo County": "Pueblo County", "Huerfano County": "Huerfano County"}, "81071": {"Kiowa County": "Kiowa County", "Prowers County": "Prowers County", "Cheyenne County": "Cheyenne County"}, "81073": {"Baca County": "Baca County", "Bent County": "Bent County", "Prowers County": "Prowers County", "Las Animas County": "Las Animas County"}, "81076": {"Kiowa County": "Kiowa County", "Otero County": "Otero County", "Crowley County": "Crowley County", "Lincoln County": "Lincoln County"}, "81077": {"Otero County": "Otero County"}, "81081": {"Las Animas County": "Las Animas County"}, "81082": {"Las Animas County": "Las Animas County"}, "81084": {"Baca County": "Baca County", "Prowers County": "Prowers County"}, "81087": {"Baca County": "Baca County"}, "81089": {"Pueblo County": "Pueblo County", "Huerfano County": "Huerfano County", "Las Animas County": "Las Animas County"}, "81090": {"Baca County": "Baca County", "Prowers County": "Prowers County"}, "81091": {"Costilla County": "Costilla County", "Huerfano County": "Huerfano County", "Las Animas County": "Las Animas County"}, "81092": {"Bent County": "Bent County", "Kiowa County": "Kiowa County", "Prowers County": "Prowers County"}, "81101": {"Alamosa County": "Alamosa County", "Conejos County": "Conejos County", "Costilla County": "Costilla County", "Rio Grande County": "Rio Grande County"}, "81120": {"Conejos County": "Conejos County", "Costilla County": "Costilla County", "Archuleta County": "Archuleta County", "Rio Grande County": "Rio Grande County"}, "81121": {"La Plata County": "La Plata County", "Archuleta County": "Archuleta County"}, "81122": {"Hinsdale County": "Hinsdale County", "La Plata County": "La Plata County", "San Juan County": "San Juan County", "Archuleta County": "Archuleta County"}, "81123": {"Alamosa County": "Alamosa County", "Conejos County": "Conejos County", "Costilla County": "Costilla County", "Huerfano County": "Huerfano County"}, "81124": {"Conejos County": "Conejos County"}, "81125": {"Alamosa County": "Alamosa County", "Saguache County": "Saguache County", "Rio Grande County": "Rio Grande County"}, "81126": {"Costilla County": "Costilla County"}, "81128": {"Conejos County": "Conejos County", "Archuleta County": "Archuleta County"}, "81129": {"Conejos County": "Conejos County"}, "81130": {"Mineral County": "Mineral County", "Hinsdale County": "Hinsdale County", "Saguache County": "Saguache County", "San Juan County": "San Juan County", "Archuleta County": "Archuleta County", "Rio Grande County": "Rio Grande County"}, "81131": {"Custer County": "Custer County", "Alamosa County": "Alamosa County", "Huerfano County": "Huerfano County", "Saguache County": "Saguache County"}, "81132": {"Conejos County": "Conejos County", "Mineral County": "Mineral County", "Saguache County": "Saguache County", "Rio Grande County": "Rio Grande County"}, "81133": {"Costilla County": "Costilla County", "Huerfano County": "Huerfano County"}, "81136": {"Alamosa County": "Alamosa County", "Saguache County": "Saguache County"}, "81137": {"La Plata County": "La Plata County", "Archuleta County": "Archuleta County"}, "81138": {"Costilla County": "Costilla County"}, "81140": {"Alamosa County": "Alamosa County", "Conejos County": "Conejos County", "Rio Grande County": "Rio Grande County"}, "81141": {"Conejos County": "Conejos County", "Costilla County": "Costilla County"}, "81143": {"Custer County": "Custer County", "Saguache County": "Saguache County"}, "81144": {"Alamosa County": "Alamosa County", "Conejos County": "Conejos County", "Rio Grande County": "Rio Grande County"}, "81146": {"Alamosa County": "Alamosa County", "Costilla County": "Costilla County", "Huerfano County": "Huerfano County", "Saguache County": "Saguache County"}, "81147": {"Conejos County": "Conejos County", "Mineral County": "Mineral County", "Hinsdale County": "Hinsdale County", "La Plata County": "La Plata County", "San Juan County": "San Juan County", "Archuleta County": "Archuleta County", "Rio Grande County": "Rio Grande County"}, "81148": {"Conejos County": "Conejos County"}, "81149": {"Mineral County": "Mineral County", "Saguache County": "Saguache County"}, "81151": {"Alamosa County": "Alamosa County", "Conejos County": "Conejos County", "Costilla County": "Costilla County"}, "81152": {"Conejos County": "Conejos County", "Costilla County": "Costilla County", "Huerfano County": "Huerfano County", "Las Animas County": "Las Animas County"}, "81154": {"Conejos County": "Conejos County", "Mineral County": "Mineral County", "Archuleta County": "Archuleta County", "Rio Grande County": "Rio Grande County"}, "81155": {"Custer County": "Custer County", "Chaffee County": "Chaffee County", "Fremont County": "Fremont County", "Saguache County": "Saguache County"}, "81201": {"Park County": "Park County", "Chaffee County": "Chaffee County", "Fremont County": "Fremont County", "Gunnison County": "Gunnison County", "Saguache County": "Saguache County"}, "81210": {"Pitkin County": "Pitkin County", "Chaffee County": "Chaffee County", "Gunnison County": "Gunnison County"}, "81211": {"Lake County": "Lake County", "Park County": "Park County", "Pitkin County": "Pitkin County", "Chaffee County": "Chaffee County", "Gunnison County": "Gunnison County"}, "81212": {"Park County": "Park County", "Custer County": "Custer County", "Teller County": "Teller County", "Fremont County": "Fremont County"}, "81220": {"Ouray County": "Ouray County", "Gunnison County": "Gunnison County", "Hinsdale County": "Hinsdale County", "Montrose County": "Montrose County"}, "81221": {"Fremont County": "Fremont County"}, "81222": {"Fremont County": "Fremont County", "Saguache County": "Saguache County"}, "81223": {"Custer County": "Custer County", "Fremont County": "Fremont County", "Saguache County": "Saguache County"}, "81224": {"Pitkin County": "Pitkin County", "Gunnison County": "Gunnison County"}, "81225": {"Pitkin County": "Pitkin County", "Gunnison County": "Gunnison County"}, "81226": {"Custer County": "Custer County", "Fremont County": "Fremont County"}, "81227": {"Chaffee County": "Chaffee County"}, "81230": {"Delta County": "Delta County", "Mineral County": "Mineral County", "Gunnison County": "Gunnison County", "Hinsdale County": "Hinsdale County", "Montrose County": "Montrose County", "Saguache County": "Saguache County"}, "81231": {"Gunnison County": "Gunnison County"}, "81232": {"Custer County": "Custer County", "Fremont County": "Fremont County"}, "81233": {"Fremont County": "Fremont County", "Saguache County": "Saguache County"}, "81235": {"Ouray County": "Ouray County", "Mineral County": "Mineral County", "Gunnison County": "Gunnison County", "Hinsdale County": "Hinsdale County", "Saguache County": "Saguache County", "San Juan County": "San Juan County"}, "81236": {"Chaffee County": "Chaffee County", "Gunnison County": "Gunnison County"}, "81237": {"Gunnison County": "Gunnison County"}, "81239": {"Gunnison County": "Gunnison County", "Saguache County": "Saguache County"}, "81240": {"Pueblo County": "Pueblo County", "Teller County": "Teller County", "El Paso County": "El Paso County", "Fremont County": "Fremont County"}, "81241": {"Gunnison County": "Gunnison County"}, "81242": {"Chaffee County": "Chaffee County"}, "81243": {"Gunnison County": "Gunnison County", "Hinsdale County": "Hinsdale County", "Saguache County": "Saguache County"}, "81244": {"Fremont County": "Fremont County"}, "81248": {"Chaffee County": "Chaffee County", "Gunnison County": "Gunnison County", "Saguache County": "Saguache County"}, "81251": {"Lake County": "Lake County", "Pitkin County": "Pitkin County", "Chaffee County": "Chaffee County"}, "81252": {"Custer County": "Custer County", "Fremont County": "Fremont County", "Huerfano County": "Huerfano County", "Saguache County": "Saguache County"}, "81253": {"Custer County": "Custer County", "Pueblo County": "Pueblo County", "Fremont County": "Fremont County"}, "81301": {"Dolores County": "Dolores County", "La Plata County": "La Plata County", "San Juan County": "San Juan County", "Montezuma County": "Montezuma County", "San Miguel County": "San Miguel County"}, "81303": {"La Plata County": "La Plata County"}, "81320": {"Dolores County": "Dolores County", "Montezuma County": "Montezuma County", "San Miguel County": "San Miguel County"}, "81321": {"Montezuma County": "Montezuma County"}, "81323": {"Dolores County": "Dolores County", "La Plata County": "La Plata County", "San Juan County": "San Juan County", "Montezuma County": "Montezuma County", "San Miguel County": "San Miguel County"}, "81324": {"Dolores County": "Dolores County", "Montezuma County": "Montezuma County", "San Miguel County": "San Miguel County"}, "81325": {"Dolores County": "Dolores County", "Montrose County": "Montrose County", "Montezuma County": "Montezuma County", "San Miguel County": "San Miguel County"}, "81326": {"La Plata County": "La Plata County", "Montezuma County": "Montezuma County"}, "81327": {"Montezuma County": "Montezuma County"}, "81328": {"La Plata County": "La Plata County", "Montezuma County": "Montezuma County"}, "81330": {"Montezuma County": "Montezuma County"}, "81331": {"Dolores County": "Dolores County", "Montezuma County": "Montezuma County"}, "81332": {"Dolores County": "Dolores County", "La Plata County": "La Plata County", "San Juan County": "San Juan County", "Montezuma County": "Montezuma County", "San Miguel County": "San Miguel County"}, "81334": {"La Plata County": "La Plata County", "Montezuma County": "Montezuma County"}, "81335": {"Montezuma County": "Montezuma County"}, "81401": {"Delta County": "Delta County", "Ouray County": "Ouray County", "Gunnison County": "Gunnison County", "Montrose County": "Montrose County"}, "81403": {"Ouray County": "Ouray County", "Gunnison County": "Gunnison County", "Montrose County": "Montrose County", "San Miguel County": "San Miguel County"}, "81410": {"Delta County": "Delta County"}, "81411": {"Montrose County": "Montrose County", "San Miguel County": "San Miguel County"}, "81413": {"Mesa County": "Mesa County", "Delta County": "Delta County"}, "81415": {"Delta County": "Delta County", "Gunnison County": "Gunnison County", "Montrose County": "Montrose County"}, "81416": {"Mesa County": "Mesa County", "Delta County": "Delta County", "Montrose County": "Montrose County"}, "81418": {"Delta County": "Delta County"}, "81419": {"Mesa County": "Mesa County", "Delta County": "Delta County"}, "81422": {"Mesa County": "Mesa County", "Montrose County": "Montrose County", "San Miguel County": "San Miguel County"}, "81423": {"Dolores County": "Dolores County", "Montrose County": "Montrose County", "San Miguel County": "San Miguel County"}, "81424": {"Montrose County": "Montrose County"}, "81425": {"Mesa County": "Mesa County", "Delta County": "Delta County", "Montrose County": "Montrose County"}, "81426": {"Dolores County": "Dolores County", "San Juan County": "San Juan County", "San Miguel County": "San Miguel County"}, "81427": {"Ouray County": "Ouray County", "Hinsdale County": "Hinsdale County", "San Juan County": "San Juan County", "San Miguel County": "San Miguel County"}, "81428": {"Mesa County": "Mesa County", "Delta County": "Delta County", "Gunnison County": "Gunnison County"}, "81429": {"Montrose County": "Montrose County", "San Miguel County": "San Miguel County"}, "81430": {"Ouray County": "Ouray County", "Dolores County": "Dolores County", "Montrose County": "Montrose County", "San Miguel County": "San Miguel County"}, "81431": {"Montrose County": "Montrose County", "San Miguel County": "San Miguel County"}, "81432": {"Ouray County": "Ouray County", "Gunnison County": "Gunnison County", "Hinsdale County": "Hinsdale County", "Montrose County": "Montrose County", "San Miguel County": "San Miguel County"}, "81433": {"Ouray County": "Ouray County", "Hinsdale County": "Hinsdale County", "La Plata County": "La Plata County", "San Juan County": "San Juan County", "San Miguel County": "San Miguel County"}, "81434": {"Mesa County": "Mesa County", "Delta County": "Delta County", "Pitkin County": "Pitkin County", "Gunnison County": "Gunnison County"}, "81435": {"Ouray County": "Ouray County", "Dolores County": "Dolores County", "San Juan County": "San Juan County", "San Miguel County": "San Miguel County"}, "81501": {"Mesa County": "Mesa County"}, "81503": {"Mesa County": "Mesa County"}, "81504": {"Mesa County": "Mesa County"}, "81505": {"Mesa County": "Mesa County"}, "81506": {"Mesa County": "Mesa County"}, "81507": {"Mesa County": "Mesa County"}, "81520": {"Mesa County": "Mesa County"}, "81521": {"Mesa County": "Mesa County"}, "81522": {"Mesa County": "Mesa County", "Montrose County": "Montrose County"}, "81523": {"Mesa County": "Mesa County"}, "81524": {"Mesa County": "Mesa County", "Garfield County": "Garfield County"}, "81525": {"Mesa County": "Mesa County", "Garfield County": "Garfield County"}, "81526": {"Mesa County": "Mesa County"}, "81527": {"Mesa County": "Mesa County", "Delta County": "Delta County", "Montrose County": "Montrose County"}, "81601": {"Eagle County": "Eagle County", "Pitkin County": "Pitkin County", "Garfield County": "Garfield County"}, "81610": {"Moffat County": "Moffat County", "Rio Blanco County": "Rio Blanco County"}, "81611": {"Lake County": "Lake County", "Pitkin County": "Pitkin County", "Chaffee County": "Chaffee County", "Gunnison County": "Gunnison County"}, "81612": {"Pitkin County": "Pitkin County"}, "81615": {"Pitkin County": "Pitkin County"}, "81620": {"Eagle County": "Eagle County"}, "81621": {"Eagle County": "Eagle County", "Pitkin County": "Pitkin County", "Garfield County": "Garfield County"}, "81623": {"Mesa County": "Mesa County", "Eagle County": "Eagle County", "Pitkin County": "Pitkin County", "Garfield County": "Garfield County", "Gunnison County": "Gunnison County"}, "81624": {"Mesa County": "Mesa County", "Delta County": "Delta County", "Pitkin County": "Pitkin County", "Garfield County": "Garfield County", "Gunnison County": "Gunnison County"}, "81625": {"Routt County": "Routt County", "Moffat County": "Moffat County"}, "81630": {"Mesa County": "Mesa County", "Garfield County": "Garfield County", "Rio Blanco County": "Rio Blanco County"}, "81631": {"Eagle County": "Eagle County"}, "81632": {"Eagle County": "Eagle County"}, "81633": {"Moffat County": "Moffat County", "Rio Blanco County": "Rio Blanco County"}, "81635": {"Mesa County": "Mesa County", "Garfield County": "Garfield County", "Rio Blanco County": "Rio Blanco County"}, "81637": {"Eagle County": "Eagle County", "Routt County": "Routt County", "Garfield County": "Garfield County", "Rio Blanco County": "Rio Blanco County"}, "81638": {"Routt County": "Routt County", "Moffat County": "Moffat County", "Rio Blanco County": "Rio Blanco County"}, "81639": {"Routt County": "Routt County", "Moffat County": "Moffat County", "Rio Blanco County": "Rio Blanco County"}, "81640": {"Moffat County": "Moffat County", "Rio Blanco County": "Rio Blanco County"}, "81641": {"Routt County": "Routt County", "Moffat County": "Moffat County", "Garfield County": "Garfield County", "Rio Blanco County": "Rio Blanco County"}, "81642": {"Lake County": "Lake County", "Eagle County": "Eagle County", "Pitkin County": "Pitkin County"}, "81643": {"Mesa County": "Mesa County", "Delta County": "Delta County"}, "81645": {"Lake County": "Lake County", "Eagle County": "Eagle County", "Pitkin County": "Pitkin County", "Summit County": "Summit County"}, "81646": {"Mesa County": "Mesa County", "Delta County": "Delta County"}, "81647": {"Mesa County": "Mesa County", "Pitkin County": "Pitkin County", "Garfield County": "Garfield County", "Rio Blanco County": "Rio Blanco County"}, "81648": {"Moffat County": "Moffat County", "Garfield County": "Garfield County", "Rio Blanco County": "Rio Blanco County"}, "81649": {"Eagle County": "Eagle County", "Summit County": "Summit County"}, "81650": {"Mesa County": "Mesa County", "Garfield County": "Garfield County", "Rio Blanco County": "Rio Blanco County"}, "81652": {"Mesa County": "Mesa County", "Garfield County": "Garfield County"}, "81653": {"Routt County": "Routt County", "Moffat County": "Moffat County"}, "81654": {"Pitkin County": "Pitkin County", "Gunnison County": "Gunnison County"}, "81655": {"Eagle County": "Eagle County", "Summit County": "Summit County"}, "81656": {"Pitkin County": "Pitkin County"}, "81657": {"Eagle County": "Eagle County", "Summit County": "Summit County"}, "82063": {"Jackson County": "Jackson County", "Larimer County": "Larimer County"}} + co_zipcodes = { + "80001": "80001", + "80002": "80002", + "80003": "80003", + "80004": "80004", + "80005": "80005", + "80006": "80006", + "80007": "80007", + "80010": "80010", + "80011": "80011", + "80012": "80012", + "80013": "80013", + "80014": "80014", + "80015": "80015", + "80016": "80016", + "80017": "80017", + "80018": "80018", + "80019": "80019", + "80020": "80020", + "80021": "80021", + "80022": "80022", + "80023": "80023", + "80024": "80024", + "80025": "80025", + "80026": "80026", + "80027": "80027", + "80028": "80028", + "80030": "80030", + "80031": "80031", + "80033": "80033", + "80034": "80034", + "80035": "80035", + "80036": "80036", + "80037": "80037", + "80038": "80038", + "80040": "80040", + "80041": "80041", + "80042": "80042", + "80044": "80044", + "80045": "80045", + "80046": "80046", + "80047": "80047", + "80101": "80101", + "80102": "80102", + "80103": "80103", + "80104": "80104", + "80105": "80105", + "80106": "80106", + "80107": "80107", + "80108": "80108", + "80109": "80109", + "80110": "80110", + "80111": "80111", + "80112": "80112", + "80113": "80113", + "80116": "80116", + "80117": "80117", + "80118": "80118", + "80120": "80120", + "80121": "80121", + "80122": "80122", + "80123": "80123", + "80124": "80124", + "80125": "80125", + "80126": "80126", + "80127": "80127", + "80128": "80128", + "80129": "80129", + "80130": "80130", + "80131": "80131", + "80132": "80132", + "80133": "80133", + "80134": "80134", + "80135": "80135", + "80136": "80136", + "80137": "80137", + "80138": "80138", + "80150": "80150", + "80151": "80151", + "80155": "80155", + "80160": "80160", + "80161": "80161", + "80162": "80162", + "80163": "80163", + "80165": "80165", + "80166": "80166", + "80201": "80201", + "80202": "80202", + "80203": "80203", + "80204": "80204", + "80205": "80205", + "80206": "80206", + "80207": "80207", + "80208": "80208", + "80209": "80209", + "80210": "80210", + "80211": "80211", + "80212": "80212", + "80214": "80214", + "80215": "80215", + "80216": "80216", + "80217": "80217", + "80218": "80218", + "80219": "80219", + "80220": "80220", + "80221": "80221", + "80222": "80222", + "80223": "80223", + "80224": "80224", + "80225": "80225", + "80226": "80226", + "80227": "80227", + "80228": "80228", + "80229": "80229", + "80230": "80230", + "80231": "80231", + "80232": "80232", + "80233": "80233", + "80234": "80234", + "80235": "80235", + "80236": "80236", + "80237": "80237", + "80238": "80238", + "80239": "80239", + "80241": "80241", + "80243": "80243", + "80244": "80244", + "80246": "80246", + "80247": "80247", + "80248": "80248", + "80249": "80249", + "80250": "80250", + "80251": "80251", + "80252": "80252", + "80256": "80256", + "80257": "80257", + "80259": "80259", + "80260": "80260", + "80261": "80261", + "80262": "80262", + "80263": "80263", + "80264": "80264", + "80265": "80265", + "80266": "80266", + "80271": "80271", + "80273": "80273", + "80274": "80274", + "80279": "80279", + "80280": "80280", + "80281": "80281", + "80290": "80290", + "80291": "80291", + "80293": "80293", + "80294": "80294", + "80295": "80295", + "80299": "80299", + "80301": "80301", + "80302": "80302", + "80303": "80303", + "80304": "80304", + "80305": "80305", + "80306": "80306", + "80307": "80307", + "80308": "80308", + "80309": "80309", + "80310": "80310", + "80314": "80314", + "80321": "80321", + "80322": "80322", + "80323": "80323", + "80328": "80328", + "80329": "80329", + "80401": "80401", + "80402": "80402", + "80403": "80403", + "80419": "80419", + "80420": "80420", + "80421": "80421", + "80422": "80422", + "80423": "80423", + "80424": "80424", + "80425": "80425", + "80426": "80426", + "80427": "80427", + "80428": "80428", + "80429": "80429", + "80430": "80430", + "80432": "80432", + "80433": "80433", + "80434": "80434", + "80435": "80435", + "80436": "80436", + "80437": "80437", + "80438": "80438", + "80439": "80439", + "80440": "80440", + "80442": "80442", + "80443": "80443", + "80444": "80444", + "80446": "80446", + "80447": "80447", + "80448": "80448", + "80449": "80449", + "80451": "80451", + "80452": "80452", + "80453": "80453", + "80454": "80454", + "80455": "80455", + "80456": "80456", + "80457": "80457", + "80459": "80459", + "80461": "80461", + "80463": "80463", + "80465": "80465", + "80466": "80466", + "80467": "80467", + "80468": "80468", + "80469": "80469", + "80470": "80470", + "80471": "80471", + "80473": "80473", + "80474": "80474", + "80475": "80475", + "80476": "80476", + "80477": "80477", + "80478": "80478", + "80479": "80479", + "80480": "80480", + "80481": "80481", + "80482": "80482", + "80483": "80483", + "80487": "80487", + "80488": "80488", + "80497": "80497", + "80498": "80498", + "80501": "80501", + "80502": "80502", + "80503": "80503", + "80504": "80504", + "80510": "80510", + "80511": "80511", + "80512": "80512", + "80513": "80513", + "80514": "80514", + "80515": "80515", + "80516": "80516", + "80517": "80517", + "80520": "80520", + "80521": "80521", + "80522": "80522", + "80523": "80523", + "80524": "80524", + "80525": "80525", + "80526": "80526", + "80527": "80527", + "80528": "80528", + "80530": "80530", + "80532": "80532", + "80533": "80533", + "80534": "80534", + "80535": "80535", + "80536": "80536", + "80537": "80537", + "80538": "80538", + "80539": "80539", + "80540": "80540", + "80541": "80541", + "80542": "80542", + "80543": "80543", + "80544": "80544", + "80545": "80545", + "80546": "80546", + "80547": "80547", + "80549": "80549", + "80550": "80550", + "80551": "80551", + "80553": "80553", + "80601": "80601", + "80602": "80602", + "80603": "80603", + "80610": "80610", + "80611": "80611", + "80612": "80612", + "80614": "80614", + "80615": "80615", + "80620": "80620", + "80621": "80621", + "80622": "80622", + "80623": "80623", + "80624": "80624", + "80631": "80631", + "80632": "80632", + "80633": "80633", + "80634": "80634", + "80638": "80638", + "80639": "80639", + "80640": "80640", + "80642": "80642", + "80643": "80643", + "80644": "80644", + "80645": "80645", + "80646": "80646", + "80648": "80648", + "80649": "80649", + "80650": "80650", + "80651": "80651", + "80652": "80652", + "80653": "80653", + "80654": "80654", + "80701": "80701", + "80705": "80705", + "80720": "80720", + "80721": "80721", + "80722": "80722", + "80723": "80723", + "80726": "80726", + "80727": "80727", + "80728": "80728", + "80729": "80729", + "80731": "80731", + "80732": "80732", + "80733": "80733", + "80734": "80734", + "80735": "80735", + "80736": "80736", + "80737": "80737", + "80740": "80740", + "80741": "80741", + "80742": "80742", + "80743": "80743", + "80744": "80744", + "80745": "80745", + "80746": "80746", + "80747": "80747", + "80749": "80749", + "80750": "80750", + "80751": "80751", + "80754": "80754", + "80755": "80755", + "80757": "80757", + "80758": "80758", + "80759": "80759", + "80801": "80801", + "80802": "80802", + "80804": "80804", + "80805": "80805", + "80807": "80807", + "80808": "80808", + "80809": "80809", + "80810": "80810", + "80812": "80812", + "80813": "80813", + "80814": "80814", + "80815": "80815", + "80816": "80816", + "80817": "80817", + "80818": "80818", + "80819": "80819", + "80820": "80820", + "80821": "80821", + "80822": "80822", + "80823": "80823", + "80824": "80824", + "80825": "80825", + "80826": "80826", + "80827": "80827", + "80828": "80828", + "80829": "80829", + "80830": "80830", + "80831": "80831", + "80832": "80832", + "80833": "80833", + "80834": "80834", + "80835": "80835", + "80836": "80836", + "80840": "80840", + "80841": "80841", + "80860": "80860", + "80861": "80861", + "80862": "80862", + "80863": "80863", + "80864": "80864", + "80866": "80866", + "80901": "80901", + "80902": "80902", + "80903": "80903", + "80904": "80904", + "80905": "80905", + "80906": "80906", + "80907": "80907", + "80908": "80908", + "80909": "80909", + "80910": "80910", + "80911": "80911", + "80912": "80912", + "80913": "80913", + "80914": "80914", + "80915": "80915", + "80916": "80916", + "80917": "80917", + "80918": "80918", + "80919": "80919", + "80920": "80920", + "80921": "80921", + "80922": "80922", + "80923": "80923", + "80924": "80924", + "80925": "80925", + "80926": "80926", + "80927": "80927", + "80928": "80928", + "80929": "80929", + "80930": "80930", + "80931": "80931", + "80932": "80932", + "80933": "80933", + "80934": "80934", + "80935": "80935", + "80936": "80936", + "80937": "80937", + "80938": "80938", + "80939": "80939", + "80940": "80940", + "80941": "80941", + "80942": "80942", + "80943": "80943", + "80944": "80944", + "80945": "80945", + "80946": "80946", + "80947": "80947", + "80949": "80949", + "80950": "80950", + "80951": "80951", + "80960": "80960", + "80962": "80962", + "80970": "80970", + "80977": "80977", + "80995": "80995", + "80997": "80997", + "81001": "81001", + "81002": "81002", + "81003": "81003", + "81004": "81004", + "81005": "81005", + "81006": "81006", + "81007": "81007", + "81008": "81008", + "81009": "81009", + "81010": "81010", + "81011": "81011", + "81012": "81012", + "81019": "81019", + "81020": "81020", + "81021": "81021", + "81022": "81022", + "81023": "81023", + "81024": "81024", + "81025": "81025", + "81027": "81027", + "81029": "81029", + "81030": "81030", + "81033": "81033", + "81034": "81034", + "81036": "81036", + "81038": "81038", + "81039": "81039", + "81040": "81040", + "81041": "81041", + "81043": "81043", + "81044": "81044", + "81045": "81045", + "81046": "81046", + "81047": "81047", + "81049": "81049", + "81050": "81050", + "81052": "81052", + "81054": "81054", + "81055": "81055", + "81057": "81057", + "81058": "81058", + "81059": "81059", + "81062": "81062", + "81063": "81063", + "81064": "81064", + "81067": "81067", + "81069": "81069", + "81071": "81071", + "81073": "81073", + "81075": "81075", + "81076": "81076", + "81077": "81077", + "81081": "81081", + "81082": "81082", + "81084": "81084", + "81087": "81087", + "81089": "81089", + "81090": "81090", + "81091": "81091", + "81092": "81092", + "81101": "81101", + "81102": "81102", + "81120": "81120", + "81121": "81121", + "81122": "81122", + "81123": "81123", + "81124": "81124", + "81125": "81125", + "81126": "81126", + "81127": "81127", + "81128": "81128", + "81129": "81129", + "81130": "81130", + "81131": "81131", + "81132": "81132", + "81133": "81133", + "81134": "81134", + "81135": "81135", + "81136": "81136", + "81137": "81137", + "81138": "81138", + "81140": "81140", + "81141": "81141", + "81143": "81143", + "81144": "81144", + "81146": "81146", + "81147": "81147", + "81148": "81148", + "81149": "81149", + "81151": "81151", + "81152": "81152", + "81153": "81153", + "81154": "81154", + "81155": "81155", + "81157": "81157", + "81201": "81201", + "81210": "81210", + "81211": "81211", + "81212": "81212", + "81215": "81215", + "81220": "81220", + "81221": "81221", + "81222": "81222", + "81223": "81223", + "81224": "81224", + "81225": "81225", + "81226": "81226", + "81227": "81227", + "81228": "81228", + "81230": "81230", + "81231": "81231", + "81232": "81232", + "81233": "81233", + "81235": "81235", + "81236": "81236", + "81237": "81237", + "81239": "81239", + "81240": "81240", + "81241": "81241", + "81242": "81242", + "81243": "81243", + "81244": "81244", + "81247": "81247", + "81248": "81248", + "81251": "81251", + "81252": "81252", + "81253": "81253", + "81290": "81290", + "81301": "81301", + "81302": "81302", + "81303": "81303", + "81320": "81320", + "81321": "81321", + "81323": "81323", + "81324": "81324", + "81325": "81325", + "81326": "81326", + "81327": "81327", + "81328": "81328", + "81329": "81329", + "81330": "81330", + "81331": "81331", + "81332": "81332", + "81334": "81334", + "81335": "81335", + "81401": "81401", + "81402": "81402", + "81403": "81403", + "81410": "81410", + "81411": "81411", + "81413": "81413", + "81414": "81414", + "81415": "81415", + "81416": "81416", + "81418": "81418", + "81419": "81419", + "81420": "81420", + "81422": "81422", + "81423": "81423", + "81424": "81424", + "81425": "81425", + "81426": "81426", + "81427": "81427", + "81428": "81428", + "81429": "81429", + "81430": "81430", + "81431": "81431", + "81432": "81432", + "81433": "81433", + "81434": "81434", + "81435": "81435", + "81501": "81501", + "81502": "81502", + "81503": "81503", + "81504": "81504", + "81505": "81505", + "81506": "81506", + "81507": "81507", + "81520": "81520", + "81521": "81521", + "81522": "81522", + "81523": "81523", + "81524": "81524", + "81525": "81525", + "81526": "81526", + "81527": "81527", + "81601": "81601", + "81602": "81602", + "81610": "81610", + "81611": "81611", + "81612": "81612", + "81615": "81615", + "81620": "81620", + "81621": "81621", + "81623": "81623", + "81624": "81624", + "81625": "81625", + "81626": "81626", + "81630": "81630", + "81631": "81631", + "81632": "81632", + "81633": "81633", + "81635": "81635", + "81636": "81636", + "81637": "81637", + "81638": "81638", + "81639": "81639", + "81640": "81640", + "81641": "81641", + "81642": "81642", + "81643": "81643", + "81645": "81645", + "81646": "81646", + "81647": "81647", + "81648": "81648", + "81649": "81649", + "81650": "81650", + "81652": "81652", + "81653": "81653", + "81654": "81654", + "81655": "81655", + "81656": "81656", + "81657": "81657", + "81658": "81658", + } - category_benefits = {"cash": {"benefits": {"oap": {"_label": "cashAssistanceBenefits.oap", "_default_message": "State cash assistance for individuals 60 years of age or older (Old Age Pension/OAP)"}, "ssi": {"_label": "cashAssistanceBenefits.ssi", "_default_message": "Federal cash assistance for individuals who are disabled, blind, or 65 years of age or older (Supplemental Security Income/SSI)"}, "ssdi": {"_label": "cashAssistanceBenefits.ssdi", "_default_message": "Social security benefit for people with disabilities (Social Security Disability Insurance/SSDI)"}, "tanf": {"_label": "cashAssistanceBenefits.tanf", "_default_message": "Cash assistance and work support (Temporary Assistance for Needy Families (TANF/Colorado Works))"}, "andcs": {"_label": "cashAssistanceBenefits.andcs", "_default_message": "State cash assistance for individuals who are disabled and receiving SSI (Aid to the Needy Disabled - Colorado Supplement/AND-CS)"}}, "category_name": "Cash Assistance"}, "childCare": {"benefits": {"upk": {"_label": "childCareBenefits.univpresc", "_default_message": "Free preschool (Universal Preschool Colorado)"}, "pell": {"_label": "childCareBenefits.pell", "_default_message": "Federal grant to finance college costs (Pell Grant)"}, "cccap": {"_label": "childCareBenefits.cccap", "_default_message": "Help with child care costs (Colorado Child Care Assistance Program/CCCAP)"}, "mydenver": {"_label": "childCareBenefits.mydenver", "_default_message": "Reduced-cost youth programs (MY Denver Card)"}, "coheadstart": {"_label": "childCareBenefits.coheadstart", "_default_message": "Free early child care and preschool (Colorado Head Start)"}, "denverpresc": {"_label": "childCareBenefits.denverpresc", "_default_message": "Tuition credits for Denver preschoolers (Denver Preschool Program)"}}, "category_name": "Child Care, Youth, and Education"}, "healthCare": {"benefits": {"dentallowincseniors": {"_label": "healthCareBenefits.dentallowincseniors", "_default_message": "Low-cost dental care for people 60 years of age or older (Colorado Dental Health Program for Low-Income Seniors)"}}, "category_name": "Health Care"}, "taxCredits": {"benefits": {"ctc": {"_label": "taxCreditBenefits.ctc", "_default_message": "Federal tax credit: child tax credit (Child Tax Credit)"}, "eitc": {"_label": "taxCreditBenefits.eitc", "_default_message": "Federal tax credit: earned income (Earned Income Tax Credit)"}, "coctc": {"_label": "taxCreditBenefits.coctc", "_default_message": "State tax credit: Colorado child tax credit"}, "coeitc": {"_label": "taxCreditBenefits.coeitc", "_default_message": "State tax credit: earned income (Colorado Earned Income Tax Credit/Expanded Earned Income Tax Credit)"}}, "category_name": "Tax Credits"}, "transportation": {"benefits": {"rtdlive": {"_label": "transportationBenefits.rtdlive", "_default_message": "Discounted RTD fares (RTD LiVE)"}}, "category_name": "Transportation"}, "foodAndNutrition": {"benefits": {"ede": {"_label": "foodAndNutritionBenefits.ede", "_default_message": "Food support for people 60 years of age or older (Everyday Eats)"}, "wic": {"_label": "foodAndNutritionBenefits.wic", "_default_message": "Food and breastfeeding assistance (Special Supplemental Nutrition Program for Women, Infants, and Children/WIC)"}, "nslp": {"_label": "foodAndNutritionBenefits.nslp", "_default_message": "Free school meals (National School Lunch Program)"}, "snap": {"_label": "foodAndNutritionBenefits.snap", "_default_message": "Food assistance (Supplemental Nutrition Assistance Program/SNAP)"}}, "category_name": "Food and Nutrition"}, "housingAndUtilities": {"benefits": {"acp": {"_label": "housingAndUtilities.acp", "_default_message": "Home internet discount (Affordable Connectivity Program)"}, "ubp": {"_label": "housingAndUtilities.ubp", "_default_message": "Help paying utility bills (Colorado Utility Bill Help Program)"}, "leap": {"_label": "housingAndUtilities.leap", "_default_message": "Help with winter heating bills (Low-Income Energy Assistance Program/LEAP)"}, "cowap": {"_label": "housingAndUtilities.cowap", "_default_message": "Free home energy upgrades (Weatherization Assistance Program)"}, "lifeline": {"_label": "housingAndUtilities.lifeline", "_default_message": "Phone or internet discount (Lifeline Phone/Internet Service)"}, "coPropTaxRentHeatCreditRebate": {"_label": "cashAssistanceBenefits.coPropTaxRentHeatCreditRebate", "_default_message": "Cash to pay property tax, rent, and heat bills (Colorado Property Tax/Rent/Heat Credit Rebate)"}}, "category_name": "Housing and Utilities"}} + counties_by_zipcode = { + "80002": { + "Adams County": "Adams County", + "Denver County": "Denver County", + "Jefferson County": "Jefferson County", + }, + "80003": {"Adams County": "Adams County", "Jefferson County": "Jefferson County"}, + "80004": {"Jefferson County": "Jefferson County"}, + "80005": {"Jefferson County": "Jefferson County", "Broomfield County": "Broomfield County"}, + "80007": { + "Boulder County": "Boulder County", + "Jefferson County": "Jefferson County", + "Broomfield County": "Broomfield County", + }, + "80010": { + "Adams County": "Adams County", + "Denver County": "Denver County", + "Arapahoe County": "Arapahoe County", + }, + "80011": { + "Adams County": "Adams County", + "Denver County": "Denver County", + "Arapahoe County": "Arapahoe County", + }, + "80012": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, + "80013": {"Arapahoe County": "Arapahoe County"}, + "80014": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, + "80015": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, + "80016": { + "Denver County": "Denver County", + "Elbert County": "Elbert County", + "Douglas County": "Douglas County", + "Arapahoe County": "Arapahoe County", + }, + "80017": {"Arapahoe County": "Arapahoe County"}, + "80018": {"Adams County": "Adams County", "Arapahoe County": "Arapahoe County"}, + "80019": { + "Adams County": "Adams County", + "Denver County": "Denver County", + "Arapahoe County": "Arapahoe County", + }, + "80020": { + "Adams County": "Adams County", + "Boulder County": "Boulder County", + "Jefferson County": "Jefferson County", + "Broomfield County": "Broomfield County", + }, + "80021": { + "Boulder County": "Boulder County", + "Jefferson County": "Jefferson County", + "Broomfield County": "Broomfield County", + }, + "80022": {"Adams County": "Adams County", "Denver County": "Denver County"}, + "80023": { + "Weld County": "Weld County", + "Adams County": "Adams County", + "Boulder County": "Boulder County", + "Broomfield County": "Broomfield County", + }, + "80024": {"Adams County": "Adams County"}, + "80025": {"Boulder County": "Boulder County", "Jefferson County": "Jefferson County"}, + "80026": { + "Weld County": "Weld County", + "Boulder County": "Boulder County", + "Broomfield County": "Broomfield County", + }, + "80027": { + "Boulder County": "Boulder County", + "Jefferson County": "Jefferson County", + "Broomfield County": "Broomfield County", + }, + "80030": {"Adams County": "Adams County", "Jefferson County": "Jefferson County"}, + "80031": { + "Adams County": "Adams County", + "Jefferson County": "Jefferson County", + "Broomfield County": "Broomfield County", + }, + "80033": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, + "80045": { + "Adams County": "Adams County", + "Denver County": "Denver County", + "Arapahoe County": "Arapahoe County", + }, + "80101": {"Elbert County": "Elbert County", "Arapahoe County": "Arapahoe County"}, + "80102": { + "Weld County": "Weld County", + "Adams County": "Adams County", + "Elbert County": "Elbert County", + "Arapahoe County": "Arapahoe County", + }, + "80103": { + "Adams County": "Adams County", + "Elbert County": "Elbert County", + "Morgan County": "Morgan County", + "Arapahoe County": "Arapahoe County", + }, + "80104": {"Douglas County": "Douglas County"}, + "80105": { + "Adams County": "Adams County", + "Elbert County": "Elbert County", + "Lincoln County": "Lincoln County", + "Arapahoe County": "Arapahoe County", + "Washington County": "Washington County", + }, + "80106": { + "Elbert County": "Elbert County", + "Douglas County": "Douglas County", + "El Paso County": "El Paso County", + }, + "80107": { + "Elbert County": "Elbert County", + "Douglas County": "Douglas County", + "Arapahoe County": "Arapahoe County", + }, + "80108": {"Douglas County": "Douglas County"}, + "80109": {"Douglas County": "Douglas County"}, + "80110": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, + "80111": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, + "80112": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, + "80113": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, + "80116": {"Elbert County": "Elbert County", "Douglas County": "Douglas County"}, + "80117": {"Elbert County": "Elbert County"}, + "80118": { + "Elbert County": "Elbert County", + "Douglas County": "Douglas County", + "El Paso County": "El Paso County", + }, + "80120": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, + "80121": {"Arapahoe County": "Arapahoe County"}, + "80122": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, + "80123": { + "Denver County": "Denver County", + "Arapahoe County": "Arapahoe County", + "Jefferson County": "Jefferson County", + }, + "80124": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, + "80125": { + "Douglas County": "Douglas County", + "Arapahoe County": "Arapahoe County", + "Jefferson County": "Jefferson County", + }, + "80126": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, + "80127": { + "Denver County": "Denver County", + "Douglas County": "Douglas County", + "Jefferson County": "Jefferson County", + }, + "80128": { + "Douglas County": "Douglas County", + "Arapahoe County": "Arapahoe County", + "Jefferson County": "Jefferson County", + }, + "80129": {"Douglas County": "Douglas County", "Arapahoe County": "Arapahoe County"}, + "80130": {"Douglas County": "Douglas County"}, + "80131": {"Douglas County": "Douglas County"}, + "80132": {"Douglas County": "Douglas County", "El Paso County": "El Paso County"}, + "80133": { + "Teller County": "Teller County", + "Douglas County": "Douglas County", + "El Paso County": "El Paso County", + }, + "80134": { + "Elbert County": "Elbert County", + "Douglas County": "Douglas County", + "Arapahoe County": "Arapahoe County", + }, + "80135": { + "Park County": "Park County", + "Teller County": "Teller County", + "Douglas County": "Douglas County", + "El Paso County": "El Paso County", + "Jefferson County": "Jefferson County", + }, + "80136": { + "Weld County": "Weld County", + "Adams County": "Adams County", + "Elbert County": "Elbert County", + "Arapahoe County": "Arapahoe County", + }, + "80137": { + "Adams County": "Adams County", + "Denver County": "Denver County", + "Arapahoe County": "Arapahoe County", + }, + "80138": { + "Elbert County": "Elbert County", + "Douglas County": "Douglas County", + "Arapahoe County": "Arapahoe County", + }, + "80202": {"Denver County": "Denver County"}, + "80203": {"Denver County": "Denver County"}, + "80204": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, + "80205": {"Denver County": "Denver County"}, + "80206": {"Denver County": "Denver County"}, + "80207": {"Denver County": "Denver County"}, + "80209": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, + "80210": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, + "80211": {"Denver County": "Denver County"}, + "80212": { + "Adams County": "Adams County", + "Denver County": "Denver County", + "Jefferson County": "Jefferson County", + }, + "80214": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, + "80215": {"Jefferson County": "Jefferson County"}, + "80216": {"Adams County": "Adams County", "Denver County": "Denver County"}, + "80218": {"Denver County": "Denver County"}, + "80219": { + "Denver County": "Denver County", + "Arapahoe County": "Arapahoe County", + "Jefferson County": "Jefferson County", + }, + "80220": { + "Adams County": "Adams County", + "Denver County": "Denver County", + "Arapahoe County": "Arapahoe County", + }, + "80221": {"Adams County": "Adams County", "Denver County": "Denver County"}, + "80222": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, + "80223": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, + "80224": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, + "80226": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, + "80227": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, + "80228": {"Jefferson County": "Jefferson County"}, + "80229": {"Adams County": "Adams County"}, + "80230": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, + "80231": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, + "80232": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, + "80233": {"Adams County": "Adams County"}, + "80234": {"Adams County": "Adams County", "Broomfield County": "Broomfield County"}, + "80235": {"Denver County": "Denver County", "Jefferson County": "Jefferson County"}, + "80236": { + "Denver County": "Denver County", + "Arapahoe County": "Arapahoe County", + "Jefferson County": "Jefferson County", + }, + "80237": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, + "80238": {"Adams County": "Adams County", "Denver County": "Denver County"}, + "80239": {"Adams County": "Adams County", "Denver County": "Denver County"}, + "80241": {"Adams County": "Adams County"}, + "80246": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, + "80247": {"Denver County": "Denver County", "Arapahoe County": "Arapahoe County"}, + "80249": {"Adams County": "Adams County", "Denver County": "Denver County"}, + "80260": {"Adams County": "Adams County"}, + "80264": {"Denver County": "Denver County"}, + "80290": {"Denver County": "Denver County"}, + "80293": {"Denver County": "Denver County"}, + "80294": {"Denver County": "Denver County"}, + "80301": {"Boulder County": "Boulder County"}, + "80302": {"Boulder County": "Boulder County"}, + "80303": {"Boulder County": "Boulder County", "Jefferson County": "Jefferson County"}, + "80304": {"Boulder County": "Boulder County"}, + "80305": {"Boulder County": "Boulder County"}, + "80310": {"Boulder County": "Boulder County"}, + "80401": {"Jefferson County": "Jefferson County"}, + "80403": { + "Gilpin County": "Gilpin County", + "Boulder County": "Boulder County", + "Jefferson County": "Jefferson County", + "Clear Creek County": "Clear Creek County", + }, + "80419": {"Jefferson County": "Jefferson County"}, + "80420": {"Lake County": "Lake County", "Park County": "Park County", "Summit County": "Summit County"}, + "80421": { + "Park County": "Park County", + "Jefferson County": "Jefferson County", + "Clear Creek County": "Clear Creek County", + }, + "80422": { + "Grand County": "Grand County", + "Gilpin County": "Gilpin County", + "Boulder County": "Boulder County", + "Jefferson County": "Jefferson County", + "Clear Creek County": "Clear Creek County", + }, + "80423": { + "Eagle County": "Eagle County", + "Grand County": "Grand County", + "Routt County": "Routt County", + "Summit County": "Summit County", + }, + "80424": {"Lake County": "Lake County", "Park County": "Park County", "Summit County": "Summit County"}, + "80425": {"Douglas County": "Douglas County", "Jefferson County": "Jefferson County"}, + "80426": {"Eagle County": "Eagle County", "Routt County": "Routt County", "Garfield County": "Garfield County"}, + "80427": { + "Gilpin County": "Gilpin County", + "Jefferson County": "Jefferson County", + "Clear Creek County": "Clear Creek County", + }, + "80428": {"Routt County": "Routt County", "Jackson County": "Jackson County"}, + "80432": {"Park County": "Park County"}, + "80433": { + "Park County": "Park County", + "Douglas County": "Douglas County", + "Jefferson County": "Jefferson County", + }, + "80434": {"Jackson County": "Jackson County"}, + "80435": { + "Park County": "Park County", + "Summit County": "Summit County", + "Clear Creek County": "Clear Creek County", + }, + "80436": {"Grand County": "Grand County", "Clear Creek County": "Clear Creek County"}, + "80438": {"Grand County": "Grand County", "Clear Creek County": "Clear Creek County"}, + "80439": { + "Park County": "Park County", + "Gilpin County": "Gilpin County", + "Jefferson County": "Jefferson County", + "Clear Creek County": "Clear Creek County", + }, + "80440": {"Lake County": "Lake County", "Park County": "Park County", "Summit County": "Summit County"}, + "80442": {"Grand County": "Grand County"}, + "80443": { + "Lake County": "Lake County", + "Park County": "Park County", + "Eagle County": "Eagle County", + "Summit County": "Summit County", + }, + "80444": { + "Park County": "Park County", + "Summit County": "Summit County", + "Clear Creek County": "Clear Creek County", + }, + "80446": { + "Grand County": "Grand County", + "Boulder County": "Boulder County", + "Jackson County": "Jackson County", + }, + "80447": { + "Grand County": "Grand County", + "Boulder County": "Boulder County", + "Jackson County": "Jackson County", + "Larimer County": "Larimer County", + }, + "80448": { + "Park County": "Park County", + "Summit County": "Summit County", + "Jefferson County": "Jefferson County", + "Clear Creek County": "Clear Creek County", + }, + "80449": { + "Lake County": "Lake County", + "Park County": "Park County", + "Chaffee County": "Chaffee County", + "Fremont County": "Fremont County", + }, + "80451": {"Grand County": "Grand County"}, + "80452": { + "Park County": "Park County", + "Grand County": "Grand County", + "Gilpin County": "Gilpin County", + "Clear Creek County": "Clear Creek County", + }, + "80453": {"Jefferson County": "Jefferson County"}, + "80454": {"Jefferson County": "Jefferson County"}, + "80455": {"Boulder County": "Boulder County"}, + "80456": { + "Park County": "Park County", + "Summit County": "Summit County", + "Jefferson County": "Jefferson County", + }, + "80457": {"Jefferson County": "Jefferson County"}, + "80459": { + "Eagle County": "Eagle County", + "Grand County": "Grand County", + "Routt County": "Routt County", + "Summit County": "Summit County", + "Jackson County": "Jackson County", + }, + "80461": { + "Lake County": "Lake County", + "Park County": "Park County", + "Eagle County": "Eagle County", + "Pitkin County": "Pitkin County", + "Summit County": "Summit County", + "Chaffee County": "Chaffee County", + }, + "80463": {"Eagle County": "Eagle County", "Grand County": "Grand County", "Routt County": "Routt County"}, + "80465": {"Jefferson County": "Jefferson County"}, + "80466": {"Grand County": "Grand County", "Gilpin County": "Gilpin County", "Boulder County": "Boulder County"}, + "80467": { + "Grand County": "Grand County", + "Routt County": "Routt County", + "Rio Blanco County": "Rio Blanco County", + }, + "80468": { + "Grand County": "Grand County", + "Summit County": "Summit County", + "Clear Creek County": "Clear Creek County", + }, + "80469": {"Routt County": "Routt County", "Rio Blanco County": "Rio Blanco County"}, + "80470": { + "Park County": "Park County", + "Jefferson County": "Jefferson County", + "Clear Creek County": "Clear Creek County", + }, + "80471": {"Gilpin County": "Gilpin County", "Boulder County": "Boulder County"}, + "80473": {"Grand County": "Grand County", "Jackson County": "Jackson County"}, + "80475": {"Park County": "Park County"}, + "80476": { + "Grand County": "Grand County", + "Summit County": "Summit County", + "Clear Creek County": "Clear Creek County", + }, + "80477": {"Routt County": "Routt County"}, + "80478": {"Grand County": "Grand County"}, + "80479": {"Eagle County": "Eagle County", "Routt County": "Routt County"}, + "80480": { + "Grand County": "Grand County", + "Routt County": "Routt County", + "Jackson County": "Jackson County", + "Larimer County": "Larimer County", + }, + "80481": {"Grand County": "Grand County", "Boulder County": "Boulder County"}, + "80482": { + "Grand County": "Grand County", + "Gilpin County": "Gilpin County", + "Boulder County": "Boulder County", + "Clear Creek County": "Clear Creek County", + }, + "80483": { + "Routt County": "Routt County", + "Garfield County": "Garfield County", + "Rio Blanco County": "Rio Blanco County", + }, + "80487": {"Grand County": "Grand County", "Routt County": "Routt County", "Jackson County": "Jackson County"}, + "80488": {"Routt County": "Routt County"}, + "80497": { + "Grand County": "Grand County", + "Summit County": "Summit County", + "Clear Creek County": "Clear Creek County", + }, + "80498": {"Eagle County": "Eagle County", "Grand County": "Grand County", "Summit County": "Summit County"}, + "80501": {"Weld County": "Weld County", "Boulder County": "Boulder County"}, + "80503": {"Boulder County": "Boulder County", "Larimer County": "Larimer County"}, + "80504": {"Weld County": "Weld County", "Boulder County": "Boulder County", "Larimer County": "Larimer County"}, + "80510": { + "Grand County": "Grand County", + "Boulder County": "Boulder County", + "Larimer County": "Larimer County", + }, + "80511": {"Larimer County": "Larimer County"}, + "80512": { + "Grand County": "Grand County", + "Jackson County": "Jackson County", + "Larimer County": "Larimer County", + }, + "80513": {"Weld County": "Weld County", "Boulder County": "Boulder County", "Larimer County": "Larimer County"}, + "80514": {"Weld County": "Weld County", "Broomfield County": "Broomfield County"}, + "80515": {"Larimer County": "Larimer County"}, + "80516": { + "Weld County": "Weld County", + "Adams County": "Adams County", + "Boulder County": "Boulder County", + "Broomfield County": "Broomfield County", + }, + "80517": { + "Grand County": "Grand County", + "Boulder County": "Boulder County", + "Larimer County": "Larimer County", + }, + "80520": {"Weld County": "Weld County"}, + "80521": {"Larimer County": "Larimer County"}, + "80524": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, + "80525": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, + "80526": {"Larimer County": "Larimer County"}, + "80528": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, + "80530": {"Weld County": "Weld County"}, + "80532": {"Larimer County": "Larimer County"}, + "80534": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, + "80535": {"Larimer County": "Larimer County"}, + "80536": {"Larimer County": "Larimer County"}, + "80537": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, + "80538": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, + "80540": {"Boulder County": "Boulder County", "Larimer County": "Larimer County"}, + "80542": {"Weld County": "Weld County"}, + "80543": {"Weld County": "Weld County"}, + "80544": {"Boulder County": "Boulder County"}, + "80545": {"Larimer County": "Larimer County"}, + "80546": {"Weld County": "Weld County"}, + "80547": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, + "80549": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, + "80550": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, + "80601": {"Weld County": "Weld County", "Adams County": "Adams County"}, + "80602": { + "Weld County": "Weld County", + "Adams County": "Adams County", + "Broomfield County": "Broomfield County", + }, + "80603": { + "Weld County": "Weld County", + "Adams County": "Adams County", + "Denver County": "Denver County", + "Broomfield County": "Broomfield County", + }, + "80610": {"Weld County": "Weld County"}, + "80611": {"Weld County": "Weld County", "Morgan County": "Morgan County"}, + "80612": {"Weld County": "Weld County", "Larimer County": "Larimer County"}, + "80615": {"Weld County": "Weld County"}, + "80620": {"Weld County": "Weld County"}, + "80621": {"Weld County": "Weld County"}, + "80622": {"Weld County": "Weld County"}, + "80623": {"Weld County": "Weld County"}, + "80624": {"Weld County": "Weld County"}, + "80631": {"Weld County": "Weld County"}, + "80634": {"Weld County": "Weld County"}, + "80640": {"Adams County": "Adams County"}, + "80642": {"Weld County": "Weld County", "Adams County": "Adams County", "Denver County": "Denver County"}, + "80643": {"Weld County": "Weld County", "Adams County": "Adams County"}, + "80644": {"Weld County": "Weld County"}, + "80645": {"Weld County": "Weld County"}, + "80648": {"Weld County": "Weld County"}, + "80649": {"Weld County": "Weld County", "Morgan County": "Morgan County"}, + "80650": {"Weld County": "Weld County"}, + "80651": {"Weld County": "Weld County"}, + "80652": {"Weld County": "Weld County", "Adams County": "Adams County", "Morgan County": "Morgan County"}, + "80653": {"Morgan County": "Morgan County"}, + "80654": {"Weld County": "Weld County", "Adams County": "Adams County", "Morgan County": "Morgan County"}, + "80701": { + "Weld County": "Weld County", + "Adams County": "Adams County", + "Morgan County": "Morgan County", + "Washington County": "Washington County", + }, + "80705": {"Morgan County": "Morgan County"}, + "80720": { + "Yuma County": "Yuma County", + "Logan County": "Logan County", + "Morgan County": "Morgan County", + "Washington County": "Washington County", + }, + "80721": {"Phillips County": "Phillips County", "Sedgwick County": "Sedgwick County"}, + "80722": {"Logan County": "Logan County", "Washington County": "Washington County"}, + "80723": {"Morgan County": "Morgan County", "Washington County": "Washington County"}, + "80726": {"Logan County": "Logan County", "Sedgwick County": "Sedgwick County"}, + "80727": {"Yuma County": "Yuma County"}, + "80728": { + "Logan County": "Logan County", + "Sedgwick County": "Sedgwick County", + "Washington County": "Washington County", + }, + "80729": {"Weld County": "Weld County"}, + "80731": { + "Yuma County": "Yuma County", + "Logan County": "Logan County", + "Phillips County": "Phillips County", + "Sedgwick County": "Sedgwick County", + "Washington County": "Washington County", + }, + "80733": { + "Logan County": "Logan County", + "Morgan County": "Morgan County", + "Washington County": "Washington County", + }, + "80734": { + "Yuma County": "Yuma County", + "Phillips County": "Phillips County", + "Sedgwick County": "Sedgwick County", + }, + "80735": {"Yuma County": "Yuma County", "Kit Carson County": "Kit Carson County"}, + "80736": {"Logan County": "Logan County"}, + "80737": {"Phillips County": "Phillips County", "Sedgwick County": "Sedgwick County"}, + "80740": {"Lincoln County": "Lincoln County", "Washington County": "Washington County"}, + "80741": { + "Weld County": "Weld County", + "Logan County": "Logan County", + "Morgan County": "Morgan County", + "Washington County": "Washington County", + }, + "80742": {"Weld County": "Weld County", "Logan County": "Logan County", "Morgan County": "Morgan County"}, + "80743": { + "Yuma County": "Yuma County", + "Logan County": "Logan County", + "Washington County": "Washington County", + }, + "80744": {"Phillips County": "Phillips County", "Sedgwick County": "Sedgwick County"}, + "80745": {"Weld County": "Weld County", "Logan County": "Logan County"}, + "80746": {"Phillips County": "Phillips County"}, + "80747": {"Logan County": "Logan County"}, + "80749": { + "Logan County": "Logan County", + "Phillips County": "Phillips County", + "Sedgwick County": "Sedgwick County", + }, + "80750": { + "Weld County": "Weld County", + "Logan County": "Logan County", + "Morgan County": "Morgan County", + "Washington County": "Washington County", + }, + "80751": {"Logan County": "Logan County", "Washington County": "Washington County"}, + "80754": {"Weld County": "Weld County", "Logan County": "Logan County", "Morgan County": "Morgan County"}, + "80755": {"Yuma County": "Yuma County"}, + "80757": { + "Adams County": "Adams County", + "Morgan County": "Morgan County", + "Lincoln County": "Lincoln County", + "Arapahoe County": "Arapahoe County", + "Washington County": "Washington County", + }, + "80758": {"Yuma County": "Yuma County", "Phillips County": "Phillips County"}, + "80759": { + "Yuma County": "Yuma County", + "Logan County": "Logan County", + "Phillips County": "Phillips County", + "Washington County": "Washington County", + }, + "80801": {"Washington County": "Washington County"}, + "80802": { + "Kiowa County": "Kiowa County", + "Cheyenne County": "Cheyenne County", + "Kit Carson County": "Kit Carson County", + }, + "80804": { + "Lincoln County": "Lincoln County", + "Kit Carson County": "Kit Carson County", + "Washington County": "Washington County", + }, + "80805": { + "Yuma County": "Yuma County", + "Cheyenne County": "Cheyenne County", + "Kit Carson County": "Kit Carson County", + }, + "80807": { + "Yuma County": "Yuma County", + "Cheyenne County": "Cheyenne County", + "Kit Carson County": "Kit Carson County", + }, + "80808": {"Elbert County": "Elbert County", "El Paso County": "El Paso County"}, + "80809": {"Teller County": "Teller County", "El Paso County": "El Paso County"}, + "80810": { + "Kiowa County": "Kiowa County", + "Cheyenne County": "Cheyenne County", + "Kit Carson County": "Kit Carson County", + }, + "80812": { + "Yuma County": "Yuma County", + "Kit Carson County": "Kit Carson County", + "Washington County": "Washington County", + }, + "80813": { + "Teller County": "Teller County", + "El Paso County": "El Paso County", + "Fremont County": "Fremont County", + }, + "80814": {"Teller County": "Teller County"}, + "80815": { + "Lincoln County": "Lincoln County", + "Cheyenne County": "Cheyenne County", + "Kit Carson County": "Kit Carson County", + "Washington County": "Washington County", + }, + "80816": {"Park County": "Park County", "Teller County": "Teller County", "Fremont County": "Fremont County"}, + "80817": {"Pueblo County": "Pueblo County", "El Paso County": "El Paso County"}, + "80818": {"Lincoln County": "Lincoln County", "Washington County": "Washington County"}, + "80819": {"Teller County": "Teller County", "El Paso County": "El Paso County"}, + "80820": {"Park County": "Park County", "Teller County": "Teller County", "Fremont County": "Fremont County"}, + "80821": { + "Elbert County": "Elbert County", + "Lincoln County": "Lincoln County", + "Cheyenne County": "Cheyenne County", + "Kit Carson County": "Kit Carson County", + }, + "80822": { + "Yuma County": "Yuma County", + "Kit Carson County": "Kit Carson County", + "Washington County": "Washington County", + }, + "80823": { + "Kiowa County": "Kiowa County", + "Crowley County": "Crowley County", + "Lincoln County": "Lincoln County", + "Cheyenne County": "Cheyenne County", + }, + "80824": {"Yuma County": "Yuma County", "Kit Carson County": "Kit Carson County"}, + "80825": { + "Kiowa County": "Kiowa County", + "Lincoln County": "Lincoln County", + "Cheyenne County": "Cheyenne County", + "Kit Carson County": "Kit Carson County", + }, + "80827": { + "Park County": "Park County", + "Teller County": "Teller County", + "Douglas County": "Douglas County", + "Jefferson County": "Jefferson County", + }, + "80828": { + "Elbert County": "Elbert County", + "Lincoln County": "Lincoln County", + "Arapahoe County": "Arapahoe County", + "Washington County": "Washington County", + }, + "80829": {"Teller County": "Teller County", "El Paso County": "El Paso County"}, + "80830": { + "Elbert County": "Elbert County", + "El Paso County": "El Paso County", + "Lincoln County": "Lincoln County", + }, + "80831": {"Elbert County": "Elbert County", "El Paso County": "El Paso County"}, + "80832": { + "Elbert County": "Elbert County", + "El Paso County": "El Paso County", + "Lincoln County": "Lincoln County", + }, + "80833": { + "Elbert County": "Elbert County", + "Pueblo County": "Pueblo County", + "Crowley County": "Crowley County", + "El Paso County": "El Paso County", + "Lincoln County": "Lincoln County", + }, + "80834": { + "Cheyenne County": "Cheyenne County", + "Kit Carson County": "Kit Carson County", + "Washington County": "Washington County", + }, + "80835": {"Elbert County": "Elbert County", "El Paso County": "El Paso County"}, + "80836": { + "Yuma County": "Yuma County", + "Cheyenne County": "Cheyenne County", + "Kit Carson County": "Kit Carson County", + }, + "80840": {"El Paso County": "El Paso County"}, + "80860": { + "Teller County": "Teller County", + "El Paso County": "El Paso County", + "Fremont County": "Fremont County", + }, + "80861": { + "Yuma County": "Yuma County", + "Cheyenne County": "Cheyenne County", + "Kit Carson County": "Kit Carson County", + "Washington County": "Washington County", + }, + "80862": { + "Lincoln County": "Lincoln County", + "Cheyenne County": "Cheyenne County", + "Kit Carson County": "Kit Carson County", + }, + "80863": { + "Teller County": "Teller County", + "Douglas County": "Douglas County", + "El Paso County": "El Paso County", + }, + "80864": { + "Pueblo County": "Pueblo County", + "Crowley County": "Crowley County", + "El Paso County": "El Paso County", + "Lincoln County": "Lincoln County", + }, + "80902": {"El Paso County": "El Paso County"}, + "80903": {"El Paso County": "El Paso County"}, + "80904": {"El Paso County": "El Paso County"}, + "80905": {"El Paso County": "El Paso County"}, + "80906": {"Teller County": "Teller County", "El Paso County": "El Paso County"}, + "80907": {"El Paso County": "El Paso County"}, + "80908": { + "Elbert County": "Elbert County", + "Douglas County": "Douglas County", + "El Paso County": "El Paso County", + }, + "80909": {"El Paso County": "El Paso County"}, + "80910": {"El Paso County": "El Paso County"}, + "80911": {"El Paso County": "El Paso County"}, + "80913": {"El Paso County": "El Paso County"}, + "80914": {"El Paso County": "El Paso County"}, + "80915": {"El Paso County": "El Paso County"}, + "80916": {"El Paso County": "El Paso County"}, + "80917": {"El Paso County": "El Paso County"}, + "80918": {"El Paso County": "El Paso County"}, + "80919": {"El Paso County": "El Paso County"}, + "80920": {"El Paso County": "El Paso County"}, + "80921": {"Teller County": "Teller County", "El Paso County": "El Paso County"}, + "80922": {"El Paso County": "El Paso County"}, + "80923": {"El Paso County": "El Paso County"}, + "80924": {"El Paso County": "El Paso County"}, + "80925": {"El Paso County": "El Paso County"}, + "80926": { + "Teller County": "Teller County", + "El Paso County": "El Paso County", + "Fremont County": "Fremont County", + }, + "80927": {"El Paso County": "El Paso County"}, + "80928": {"Pueblo County": "Pueblo County", "El Paso County": "El Paso County"}, + "80929": {"El Paso County": "El Paso County"}, + "80930": {"El Paso County": "El Paso County"}, + "80938": {"El Paso County": "El Paso County"}, + "80939": {"El Paso County": "El Paso County"}, + "80951": {"El Paso County": "El Paso County"}, + "81001": {"Pueblo County": "Pueblo County"}, + "81003": {"Pueblo County": "Pueblo County"}, + "81004": {"Pueblo County": "Pueblo County"}, + "81005": { + "Custer County": "Custer County", + "Pueblo County": "Pueblo County", + "Fremont County": "Fremont County", + }, + "81006": {"Pueblo County": "Pueblo County"}, + "81007": {"Pueblo County": "Pueblo County", "Fremont County": "Fremont County"}, + "81008": {"Pueblo County": "Pueblo County", "El Paso County": "El Paso County"}, + "81019": {"Pueblo County": "Pueblo County"}, + "81020": { + "Pueblo County": "Pueblo County", + "Huerfano County": "Huerfano County", + "Las Animas County": "Las Animas County", + }, + "81021": { + "Bent County": "Bent County", + "Kiowa County": "Kiowa County", + "Otero County": "Otero County", + "Crowley County": "Crowley County", + "Lincoln County": "Lincoln County", + }, + "81022": {"Pueblo County": "Pueblo County", "Huerfano County": "Huerfano County"}, + "81023": {"Custer County": "Custer County", "Pueblo County": "Pueblo County"}, + "81024": {"Las Animas County": "Las Animas County"}, + "81025": { + "Pueblo County": "Pueblo County", + "Crowley County": "Crowley County", + "El Paso County": "El Paso County", + "Lincoln County": "Lincoln County", + }, + "81027": {"Las Animas County": "Las Animas County"}, + "81029": {"Baca County": "Baca County"}, + "81030": {"Otero County": "Otero County"}, + "81033": {"Crowley County": "Crowley County"}, + "81036": { + "Bent County": "Bent County", + "Kiowa County": "Kiowa County", + "Prowers County": "Prowers County", + "Cheyenne County": "Cheyenne County", + }, + "81038": {"Bent County": "Bent County"}, + "81039": { + "Otero County": "Otero County", + "Pueblo County": "Pueblo County", + "Crowley County": "Crowley County", + "Huerfano County": "Huerfano County", + "Las Animas County": "Las Animas County", + }, + "81040": { + "Custer County": "Custer County", + "Pueblo County": "Pueblo County", + "Alamosa County": "Alamosa County", + "Costilla County": "Costilla County", + "Huerfano County": "Huerfano County", + "Saguache County": "Saguache County", + }, + "81041": {"Baca County": "Baca County", "Prowers County": "Prowers County"}, + "81043": {"Prowers County": "Prowers County"}, + "81044": {"Baca County": "Baca County", "Bent County": "Bent County"}, + "81045": { + "Kiowa County": "Kiowa County", + "Lincoln County": "Lincoln County", + "Cheyenne County": "Cheyenne County", + }, + "81047": {"Baca County": "Baca County", "Kiowa County": "Kiowa County", "Prowers County": "Prowers County"}, + "81049": { + "Baca County": "Baca County", + "Bent County": "Bent County", + "Otero County": "Otero County", + "Las Animas County": "Las Animas County", + }, + "81050": { + "Bent County": "Bent County", + "Kiowa County": "Kiowa County", + "Otero County": "Otero County", + "Crowley County": "Crowley County", + "Las Animas County": "Las Animas County", + }, + "81052": { + "Baca County": "Baca County", + "Bent County": "Bent County", + "Kiowa County": "Kiowa County", + "Prowers County": "Prowers County", + }, + "81054": { + "Baca County": "Baca County", + "Bent County": "Bent County", + "Kiowa County": "Kiowa County", + "Otero County": "Otero County", + "Las Animas County": "Las Animas County", + }, + "81055": { + "Costilla County": "Costilla County", + "Huerfano County": "Huerfano County", + "Las Animas County": "Las Animas County", + }, + "81057": {"Bent County": "Bent County"}, + "81058": {"Otero County": "Otero County", "Crowley County": "Crowley County"}, + "81059": { + "Otero County": "Otero County", + "Pueblo County": "Pueblo County", + "Las Animas County": "Las Animas County", + }, + "81062": { + "Otero County": "Otero County", + "Pueblo County": "Pueblo County", + "Crowley County": "Crowley County", + "El Paso County": "El Paso County", + "Lincoln County": "Lincoln County", + }, + "81063": { + "Otero County": "Otero County", + "Crowley County": "Crowley County", + "Lincoln County": "Lincoln County", + }, + "81064": {"Baca County": "Baca County", "Las Animas County": "Las Animas County"}, + "81067": { + "Otero County": "Otero County", + "Pueblo County": "Pueblo County", + "Crowley County": "Crowley County", + "Las Animas County": "Las Animas County", + }, + "81069": { + "Custer County": "Custer County", + "Pueblo County": "Pueblo County", + "Huerfano County": "Huerfano County", + }, + "81071": { + "Kiowa County": "Kiowa County", + "Prowers County": "Prowers County", + "Cheyenne County": "Cheyenne County", + }, + "81073": { + "Baca County": "Baca County", + "Bent County": "Bent County", + "Prowers County": "Prowers County", + "Las Animas County": "Las Animas County", + }, + "81076": { + "Kiowa County": "Kiowa County", + "Otero County": "Otero County", + "Crowley County": "Crowley County", + "Lincoln County": "Lincoln County", + }, + "81077": {"Otero County": "Otero County"}, + "81081": {"Las Animas County": "Las Animas County"}, + "81082": {"Las Animas County": "Las Animas County"}, + "81084": {"Baca County": "Baca County", "Prowers County": "Prowers County"}, + "81087": {"Baca County": "Baca County"}, + "81089": { + "Pueblo County": "Pueblo County", + "Huerfano County": "Huerfano County", + "Las Animas County": "Las Animas County", + }, + "81090": {"Baca County": "Baca County", "Prowers County": "Prowers County"}, + "81091": { + "Costilla County": "Costilla County", + "Huerfano County": "Huerfano County", + "Las Animas County": "Las Animas County", + }, + "81092": {"Bent County": "Bent County", "Kiowa County": "Kiowa County", "Prowers County": "Prowers County"}, + "81101": { + "Alamosa County": "Alamosa County", + "Conejos County": "Conejos County", + "Costilla County": "Costilla County", + "Rio Grande County": "Rio Grande County", + }, + "81120": { + "Conejos County": "Conejos County", + "Costilla County": "Costilla County", + "Archuleta County": "Archuleta County", + "Rio Grande County": "Rio Grande County", + }, + "81121": {"La Plata County": "La Plata County", "Archuleta County": "Archuleta County"}, + "81122": { + "Hinsdale County": "Hinsdale County", + "La Plata County": "La Plata County", + "San Juan County": "San Juan County", + "Archuleta County": "Archuleta County", + }, + "81123": { + "Alamosa County": "Alamosa County", + "Conejos County": "Conejos County", + "Costilla County": "Costilla County", + "Huerfano County": "Huerfano County", + }, + "81124": {"Conejos County": "Conejos County"}, + "81125": { + "Alamosa County": "Alamosa County", + "Saguache County": "Saguache County", + "Rio Grande County": "Rio Grande County", + }, + "81126": {"Costilla County": "Costilla County"}, + "81128": {"Conejos County": "Conejos County", "Archuleta County": "Archuleta County"}, + "81129": {"Conejos County": "Conejos County"}, + "81130": { + "Mineral County": "Mineral County", + "Hinsdale County": "Hinsdale County", + "Saguache County": "Saguache County", + "San Juan County": "San Juan County", + "Archuleta County": "Archuleta County", + "Rio Grande County": "Rio Grande County", + }, + "81131": { + "Custer County": "Custer County", + "Alamosa County": "Alamosa County", + "Huerfano County": "Huerfano County", + "Saguache County": "Saguache County", + }, + "81132": { + "Conejos County": "Conejos County", + "Mineral County": "Mineral County", + "Saguache County": "Saguache County", + "Rio Grande County": "Rio Grande County", + }, + "81133": {"Costilla County": "Costilla County", "Huerfano County": "Huerfano County"}, + "81136": {"Alamosa County": "Alamosa County", "Saguache County": "Saguache County"}, + "81137": {"La Plata County": "La Plata County", "Archuleta County": "Archuleta County"}, + "81138": {"Costilla County": "Costilla County"}, + "81140": { + "Alamosa County": "Alamosa County", + "Conejos County": "Conejos County", + "Rio Grande County": "Rio Grande County", + }, + "81141": {"Conejos County": "Conejos County", "Costilla County": "Costilla County"}, + "81143": {"Custer County": "Custer County", "Saguache County": "Saguache County"}, + "81144": { + "Alamosa County": "Alamosa County", + "Conejos County": "Conejos County", + "Rio Grande County": "Rio Grande County", + }, + "81146": { + "Alamosa County": "Alamosa County", + "Costilla County": "Costilla County", + "Huerfano County": "Huerfano County", + "Saguache County": "Saguache County", + }, + "81147": { + "Conejos County": "Conejos County", + "Mineral County": "Mineral County", + "Hinsdale County": "Hinsdale County", + "La Plata County": "La Plata County", + "San Juan County": "San Juan County", + "Archuleta County": "Archuleta County", + "Rio Grande County": "Rio Grande County", + }, + "81148": {"Conejos County": "Conejos County"}, + "81149": {"Mineral County": "Mineral County", "Saguache County": "Saguache County"}, + "81151": { + "Alamosa County": "Alamosa County", + "Conejos County": "Conejos County", + "Costilla County": "Costilla County", + }, + "81152": { + "Conejos County": "Conejos County", + "Costilla County": "Costilla County", + "Huerfano County": "Huerfano County", + "Las Animas County": "Las Animas County", + }, + "81154": { + "Conejos County": "Conejos County", + "Mineral County": "Mineral County", + "Archuleta County": "Archuleta County", + "Rio Grande County": "Rio Grande County", + }, + "81155": { + "Custer County": "Custer County", + "Chaffee County": "Chaffee County", + "Fremont County": "Fremont County", + "Saguache County": "Saguache County", + }, + "81201": { + "Park County": "Park County", + "Chaffee County": "Chaffee County", + "Fremont County": "Fremont County", + "Gunnison County": "Gunnison County", + "Saguache County": "Saguache County", + }, + "81210": { + "Pitkin County": "Pitkin County", + "Chaffee County": "Chaffee County", + "Gunnison County": "Gunnison County", + }, + "81211": { + "Lake County": "Lake County", + "Park County": "Park County", + "Pitkin County": "Pitkin County", + "Chaffee County": "Chaffee County", + "Gunnison County": "Gunnison County", + }, + "81212": { + "Park County": "Park County", + "Custer County": "Custer County", + "Teller County": "Teller County", + "Fremont County": "Fremont County", + }, + "81220": { + "Ouray County": "Ouray County", + "Gunnison County": "Gunnison County", + "Hinsdale County": "Hinsdale County", + "Montrose County": "Montrose County", + }, + "81221": {"Fremont County": "Fremont County"}, + "81222": {"Fremont County": "Fremont County", "Saguache County": "Saguache County"}, + "81223": { + "Custer County": "Custer County", + "Fremont County": "Fremont County", + "Saguache County": "Saguache County", + }, + "81224": {"Pitkin County": "Pitkin County", "Gunnison County": "Gunnison County"}, + "81225": {"Pitkin County": "Pitkin County", "Gunnison County": "Gunnison County"}, + "81226": {"Custer County": "Custer County", "Fremont County": "Fremont County"}, + "81227": {"Chaffee County": "Chaffee County"}, + "81230": { + "Delta County": "Delta County", + "Mineral County": "Mineral County", + "Gunnison County": "Gunnison County", + "Hinsdale County": "Hinsdale County", + "Montrose County": "Montrose County", + "Saguache County": "Saguache County", + }, + "81231": {"Gunnison County": "Gunnison County"}, + "81232": {"Custer County": "Custer County", "Fremont County": "Fremont County"}, + "81233": {"Fremont County": "Fremont County", "Saguache County": "Saguache County"}, + "81235": { + "Ouray County": "Ouray County", + "Mineral County": "Mineral County", + "Gunnison County": "Gunnison County", + "Hinsdale County": "Hinsdale County", + "Saguache County": "Saguache County", + "San Juan County": "San Juan County", + }, + "81236": {"Chaffee County": "Chaffee County", "Gunnison County": "Gunnison County"}, + "81237": {"Gunnison County": "Gunnison County"}, + "81239": {"Gunnison County": "Gunnison County", "Saguache County": "Saguache County"}, + "81240": { + "Pueblo County": "Pueblo County", + "Teller County": "Teller County", + "El Paso County": "El Paso County", + "Fremont County": "Fremont County", + }, + "81241": {"Gunnison County": "Gunnison County"}, + "81242": {"Chaffee County": "Chaffee County"}, + "81243": { + "Gunnison County": "Gunnison County", + "Hinsdale County": "Hinsdale County", + "Saguache County": "Saguache County", + }, + "81244": {"Fremont County": "Fremont County"}, + "81248": { + "Chaffee County": "Chaffee County", + "Gunnison County": "Gunnison County", + "Saguache County": "Saguache County", + }, + "81251": {"Lake County": "Lake County", "Pitkin County": "Pitkin County", "Chaffee County": "Chaffee County"}, + "81252": { + "Custer County": "Custer County", + "Fremont County": "Fremont County", + "Huerfano County": "Huerfano County", + "Saguache County": "Saguache County", + }, + "81253": { + "Custer County": "Custer County", + "Pueblo County": "Pueblo County", + "Fremont County": "Fremont County", + }, + "81301": { + "Dolores County": "Dolores County", + "La Plata County": "La Plata County", + "San Juan County": "San Juan County", + "Montezuma County": "Montezuma County", + "San Miguel County": "San Miguel County", + }, + "81303": {"La Plata County": "La Plata County"}, + "81320": { + "Dolores County": "Dolores County", + "Montezuma County": "Montezuma County", + "San Miguel County": "San Miguel County", + }, + "81321": {"Montezuma County": "Montezuma County"}, + "81323": { + "Dolores County": "Dolores County", + "La Plata County": "La Plata County", + "San Juan County": "San Juan County", + "Montezuma County": "Montezuma County", + "San Miguel County": "San Miguel County", + }, + "81324": { + "Dolores County": "Dolores County", + "Montezuma County": "Montezuma County", + "San Miguel County": "San Miguel County", + }, + "81325": { + "Dolores County": "Dolores County", + "Montrose County": "Montrose County", + "Montezuma County": "Montezuma County", + "San Miguel County": "San Miguel County", + }, + "81326": {"La Plata County": "La Plata County", "Montezuma County": "Montezuma County"}, + "81327": {"Montezuma County": "Montezuma County"}, + "81328": {"La Plata County": "La Plata County", "Montezuma County": "Montezuma County"}, + "81330": {"Montezuma County": "Montezuma County"}, + "81331": {"Dolores County": "Dolores County", "Montezuma County": "Montezuma County"}, + "81332": { + "Dolores County": "Dolores County", + "La Plata County": "La Plata County", + "San Juan County": "San Juan County", + "Montezuma County": "Montezuma County", + "San Miguel County": "San Miguel County", + }, + "81334": {"La Plata County": "La Plata County", "Montezuma County": "Montezuma County"}, + "81335": {"Montezuma County": "Montezuma County"}, + "81401": { + "Delta County": "Delta County", + "Ouray County": "Ouray County", + "Gunnison County": "Gunnison County", + "Montrose County": "Montrose County", + }, + "81403": { + "Ouray County": "Ouray County", + "Gunnison County": "Gunnison County", + "Montrose County": "Montrose County", + "San Miguel County": "San Miguel County", + }, + "81410": {"Delta County": "Delta County"}, + "81411": {"Montrose County": "Montrose County", "San Miguel County": "San Miguel County"}, + "81413": {"Mesa County": "Mesa County", "Delta County": "Delta County"}, + "81415": { + "Delta County": "Delta County", + "Gunnison County": "Gunnison County", + "Montrose County": "Montrose County", + }, + "81416": {"Mesa County": "Mesa County", "Delta County": "Delta County", "Montrose County": "Montrose County"}, + "81418": {"Delta County": "Delta County"}, + "81419": {"Mesa County": "Mesa County", "Delta County": "Delta County"}, + "81422": { + "Mesa County": "Mesa County", + "Montrose County": "Montrose County", + "San Miguel County": "San Miguel County", + }, + "81423": { + "Dolores County": "Dolores County", + "Montrose County": "Montrose County", + "San Miguel County": "San Miguel County", + }, + "81424": {"Montrose County": "Montrose County"}, + "81425": {"Mesa County": "Mesa County", "Delta County": "Delta County", "Montrose County": "Montrose County"}, + "81426": { + "Dolores County": "Dolores County", + "San Juan County": "San Juan County", + "San Miguel County": "San Miguel County", + }, + "81427": { + "Ouray County": "Ouray County", + "Hinsdale County": "Hinsdale County", + "San Juan County": "San Juan County", + "San Miguel County": "San Miguel County", + }, + "81428": {"Mesa County": "Mesa County", "Delta County": "Delta County", "Gunnison County": "Gunnison County"}, + "81429": {"Montrose County": "Montrose County", "San Miguel County": "San Miguel County"}, + "81430": { + "Ouray County": "Ouray County", + "Dolores County": "Dolores County", + "Montrose County": "Montrose County", + "San Miguel County": "San Miguel County", + }, + "81431": {"Montrose County": "Montrose County", "San Miguel County": "San Miguel County"}, + "81432": { + "Ouray County": "Ouray County", + "Gunnison County": "Gunnison County", + "Hinsdale County": "Hinsdale County", + "Montrose County": "Montrose County", + "San Miguel County": "San Miguel County", + }, + "81433": { + "Ouray County": "Ouray County", + "Hinsdale County": "Hinsdale County", + "La Plata County": "La Plata County", + "San Juan County": "San Juan County", + "San Miguel County": "San Miguel County", + }, + "81434": { + "Mesa County": "Mesa County", + "Delta County": "Delta County", + "Pitkin County": "Pitkin County", + "Gunnison County": "Gunnison County", + }, + "81435": { + "Ouray County": "Ouray County", + "Dolores County": "Dolores County", + "San Juan County": "San Juan County", + "San Miguel County": "San Miguel County", + }, + "81501": {"Mesa County": "Mesa County"}, + "81503": {"Mesa County": "Mesa County"}, + "81504": {"Mesa County": "Mesa County"}, + "81505": {"Mesa County": "Mesa County"}, + "81506": {"Mesa County": "Mesa County"}, + "81507": {"Mesa County": "Mesa County"}, + "81520": {"Mesa County": "Mesa County"}, + "81521": {"Mesa County": "Mesa County"}, + "81522": {"Mesa County": "Mesa County", "Montrose County": "Montrose County"}, + "81523": {"Mesa County": "Mesa County"}, + "81524": {"Mesa County": "Mesa County", "Garfield County": "Garfield County"}, + "81525": {"Mesa County": "Mesa County", "Garfield County": "Garfield County"}, + "81526": {"Mesa County": "Mesa County"}, + "81527": {"Mesa County": "Mesa County", "Delta County": "Delta County", "Montrose County": "Montrose County"}, + "81601": { + "Eagle County": "Eagle County", + "Pitkin County": "Pitkin County", + "Garfield County": "Garfield County", + }, + "81610": {"Moffat County": "Moffat County", "Rio Blanco County": "Rio Blanco County"}, + "81611": { + "Lake County": "Lake County", + "Pitkin County": "Pitkin County", + "Chaffee County": "Chaffee County", + "Gunnison County": "Gunnison County", + }, + "81612": {"Pitkin County": "Pitkin County"}, + "81615": {"Pitkin County": "Pitkin County"}, + "81620": {"Eagle County": "Eagle County"}, + "81621": { + "Eagle County": "Eagle County", + "Pitkin County": "Pitkin County", + "Garfield County": "Garfield County", + }, + "81623": { + "Mesa County": "Mesa County", + "Eagle County": "Eagle County", + "Pitkin County": "Pitkin County", + "Garfield County": "Garfield County", + "Gunnison County": "Gunnison County", + }, + "81624": { + "Mesa County": "Mesa County", + "Delta County": "Delta County", + "Pitkin County": "Pitkin County", + "Garfield County": "Garfield County", + "Gunnison County": "Gunnison County", + }, + "81625": {"Routt County": "Routt County", "Moffat County": "Moffat County"}, + "81630": { + "Mesa County": "Mesa County", + "Garfield County": "Garfield County", + "Rio Blanco County": "Rio Blanco County", + }, + "81631": {"Eagle County": "Eagle County"}, + "81632": {"Eagle County": "Eagle County"}, + "81633": {"Moffat County": "Moffat County", "Rio Blanco County": "Rio Blanco County"}, + "81635": { + "Mesa County": "Mesa County", + "Garfield County": "Garfield County", + "Rio Blanco County": "Rio Blanco County", + }, + "81637": { + "Eagle County": "Eagle County", + "Routt County": "Routt County", + "Garfield County": "Garfield County", + "Rio Blanco County": "Rio Blanco County", + }, + "81638": { + "Routt County": "Routt County", + "Moffat County": "Moffat County", + "Rio Blanco County": "Rio Blanco County", + }, + "81639": { + "Routt County": "Routt County", + "Moffat County": "Moffat County", + "Rio Blanco County": "Rio Blanco County", + }, + "81640": {"Moffat County": "Moffat County", "Rio Blanco County": "Rio Blanco County"}, + "81641": { + "Routt County": "Routt County", + "Moffat County": "Moffat County", + "Garfield County": "Garfield County", + "Rio Blanco County": "Rio Blanco County", + }, + "81642": {"Lake County": "Lake County", "Eagle County": "Eagle County", "Pitkin County": "Pitkin County"}, + "81643": {"Mesa County": "Mesa County", "Delta County": "Delta County"}, + "81645": { + "Lake County": "Lake County", + "Eagle County": "Eagle County", + "Pitkin County": "Pitkin County", + "Summit County": "Summit County", + }, + "81646": {"Mesa County": "Mesa County", "Delta County": "Delta County"}, + "81647": { + "Mesa County": "Mesa County", + "Pitkin County": "Pitkin County", + "Garfield County": "Garfield County", + "Rio Blanco County": "Rio Blanco County", + }, + "81648": { + "Moffat County": "Moffat County", + "Garfield County": "Garfield County", + "Rio Blanco County": "Rio Blanco County", + }, + "81649": {"Eagle County": "Eagle County", "Summit County": "Summit County"}, + "81650": { + "Mesa County": "Mesa County", + "Garfield County": "Garfield County", + "Rio Blanco County": "Rio Blanco County", + }, + "81652": {"Mesa County": "Mesa County", "Garfield County": "Garfield County"}, + "81653": {"Routt County": "Routt County", "Moffat County": "Moffat County"}, + "81654": {"Pitkin County": "Pitkin County", "Gunnison County": "Gunnison County"}, + "81655": {"Eagle County": "Eagle County", "Summit County": "Summit County"}, + "81656": {"Pitkin County": "Pitkin County"}, + "81657": {"Eagle County": "Eagle County", "Summit County": "Summit County"}, + "82063": {"Jackson County": "Jackson County", "Larimer County": "Larimer County"}, + } + + category_benefits = { + "cash": { + "benefits": { + "oap": { + "_label": "cashAssistanceBenefits.oap", + "_default_message": "State cash assistance for individuals 60 years of age or older (Old Age Pension/OAP)", + }, + "ssi": { + "_label": "cashAssistanceBenefits.ssi", + "_default_message": "Federal cash assistance for individuals who are disabled, blind, or 65 years of age or older (Supplemental Security Income/SSI)", + }, + "ssdi": { + "_label": "cashAssistanceBenefits.ssdi", + "_default_message": "Social security benefit for people with disabilities (Social Security Disability Insurance/SSDI)", + }, + "tanf": { + "_label": "cashAssistanceBenefits.tanf", + "_default_message": "Cash assistance and work support (Temporary Assistance for Needy Families (TANF/Colorado Works))", + }, + "andcs": { + "_label": "cashAssistanceBenefits.andcs", + "_default_message": "State cash assistance for individuals who are disabled and receiving SSI (Aid to the Needy Disabled - Colorado Supplement/AND-CS)", + }, + }, + "category_name": "Cash Assistance", + }, + "childCare": { + "benefits": { + "upk": { + "_label": "childCareBenefits.univpresc", + "_default_message": "Free preschool (Universal Preschool Colorado)", + }, + "pell": { + "_label": "childCareBenefits.pell", + "_default_message": "Federal grant to finance college costs (Pell Grant)", + }, + "cccap": { + "_label": "childCareBenefits.cccap", + "_default_message": "Help with child care costs (Colorado Child Care Assistance Program/CCCAP)", + }, + "mydenver": { + "_label": "childCareBenefits.mydenver", + "_default_message": "Reduced-cost youth programs (MY Denver Card)", + }, + "coheadstart": { + "_label": "childCareBenefits.coheadstart", + "_default_message": "Free early child care and preschool (Colorado Head Start)", + }, + "denverpresc": { + "_label": "childCareBenefits.denverpresc", + "_default_message": "Tuition credits for Denver preschoolers (Denver Preschool Program)", + }, + }, + "category_name": "Child Care, Youth, and Education", + }, + "healthCare": { + "benefits": { + "dentallowincseniors": { + "_label": "healthCareBenefits.dentallowincseniors", + "_default_message": "Low-cost dental care for people 60 years of age or older (Colorado Dental Health Program for Low-Income Seniors)", + } + }, + "category_name": "Health Care", + }, + "taxCredits": { + "benefits": { + "ctc": { + "_label": "taxCreditBenefits.ctc", + "_default_message": "Federal tax credit: child tax credit (Child Tax Credit)", + }, + "eitc": { + "_label": "taxCreditBenefits.eitc", + "_default_message": "Federal tax credit: earned income (Earned Income Tax Credit)", + }, + "coctc": { + "_label": "taxCreditBenefits.coctc", + "_default_message": "State tax credit: Colorado child tax credit", + }, + "coeitc": { + "_label": "taxCreditBenefits.coeitc", + "_default_message": "State tax credit: earned income (Colorado Earned Income Tax Credit/Expanded Earned Income Tax Credit)", + }, + }, + "category_name": "Tax Credits", + }, + "transportation": { + "benefits": { + "rtdlive": { + "_label": "transportationBenefits.rtdlive", + "_default_message": "Discounted RTD fares (RTD LiVE)", + } + }, + "category_name": "Transportation", + }, + "foodAndNutrition": { + "benefits": { + "ede": { + "_label": "foodAndNutritionBenefits.ede", + "_default_message": "Food support for people 60 years of age or older (Everyday Eats)", + }, + "wic": { + "_label": "foodAndNutritionBenefits.wic", + "_default_message": "Food and breastfeeding assistance (Special Supplemental Nutrition Program for Women, Infants, and Children/WIC)", + }, + "nslp": { + "_label": "foodAndNutritionBenefits.nslp", + "_default_message": "Free school meals (National School Lunch Program)", + }, + "snap": { + "_label": "foodAndNutritionBenefits.snap", + "_default_message": "Food assistance (Supplemental Nutrition Assistance Program/SNAP)", + }, + }, + "category_name": "Food and Nutrition", + }, + "housingAndUtilities": { + "benefits": { + "acp": { + "_label": "housingAndUtilities.acp", + "_default_message": "Home internet discount (Affordable Connectivity Program)", + }, + "ubp": { + "_label": "housingAndUtilities.ubp", + "_default_message": "Help paying utility bills (Colorado Utility Bill Help Program)", + }, + "leap": { + "_label": "housingAndUtilities.leap", + "_default_message": "Help with winter heating bills (Low-Income Energy Assistance Program/LEAP)", + }, + "cowap": { + "_label": "housingAndUtilities.cowap", + "_default_message": "Free home energy upgrades (Weatherization Assistance Program)", + }, + "lifeline": { + "_label": "housingAndUtilities.lifeline", + "_default_message": "Phone or internet discount (Lifeline Phone/Internet Service)", + }, + "coPropTaxRentHeatCreditRebate": { + "_label": "cashAssistanceBenefits.coPropTaxRentHeatCreditRebate", + "_default_message": "Cash to pay property tax, rent, and heat bills (Colorado Property Tax/Rent/Heat Credit Rebate)", + }, + }, + "category_name": "Housing and Utilities", + }, + } def handle(self, *args, **options): # Save acute_condition_options to database @@ -78,4 +2625,4 @@ def handle(self, *args, **options): Configuration.objects.create(name="counties_by_zipcode", data=self.counties_by_zipcode, active=True) # Save category_benefits to database - Configuration.objects.create(name="category_benefits", data=self.category_benefits, active=True) \ No newline at end of file + Configuration.objects.create(name="category_benefits", data=self.category_benefits, active=True) diff --git a/configuration/models.py b/configuration/models.py index 381fc791..9a78753f 100644 --- a/configuration/models.py +++ b/configuration/models.py @@ -1,9 +1,10 @@ from django.db import models + class Configuration(models.Model): name = models.CharField(max_length=320) data = models.JSONField(default=dict) active = models.BooleanField() - + def __str__(self): - return self.name \ No newline at end of file + return self.name diff --git a/configuration/serializers.py b/configuration/serializers.py index 8e767be6..6fedd161 100644 --- a/configuration/serializers.py +++ b/configuration/serializers.py @@ -1,9 +1,10 @@ from configuration.models import Configuration from rest_framework import serializers + class ConfigurationSerializer(serializers.ModelSerializer): id = serializers.ReadOnlyField() class Meta: model = Configuration - fields = '__all__' \ No newline at end of file + fields = "__all__" diff --git a/configuration/urls.py b/configuration/urls.py index 0e786d1a..b97f2c6a 100644 --- a/configuration/urls.py +++ b/configuration/urls.py @@ -3,8 +3,8 @@ from . import views router = routers.DefaultRouter() -router.register(r'configuration', views.ConfigurationView) +router.register(r"configuration", views.ConfigurationView) urlpatterns = [ - path('', include(router.urls)), + path("", include(router.urls)), ] diff --git a/configuration/views.py b/configuration/views.py index fcbed50e..9da1b1aa 100644 --- a/configuration/views.py +++ b/configuration/views.py @@ -10,13 +10,13 @@ class ConfigurationView(viewsets.ReadOnlyModelViewSet): """ API endpoint that allows configurations to be viewed. """ + queryset = Configuration.objects.filter(active=True) serializer_class = ConfigurationSerializer permission_classes = [permissions.DjangoModelPermissions] - def retrieve(self, request, pk=None): configuration = get_object_or_404(self.queryset, name=pk) serializer = ConfigurationSerializer(configuration) - return Response(serializer.data) \ No newline at end of file + return Response(serializer.data) diff --git a/integrations/apps.py b/integrations/apps.py index bb57e755..f50c67a6 100644 --- a/integrations/apps.py +++ b/integrations/apps.py @@ -2,4 +2,4 @@ class IntegrationsConfig(AppConfig): - name = 'integrations' + name = "integrations" diff --git a/integrations/management/commands/hubspotsync.py b/integrations/management/commands/hubspotsync.py index 0b408c44..7fb95061 100644 --- a/integrations/management/commands/hubspotsync.py +++ b/integrations/management/commands/hubspotsync.py @@ -8,26 +8,26 @@ class Command(BaseCommand): - help = 'Syncs new users to Hubspot and clears PII from local records' + help = "Syncs new users to Hubspot and clears PII from local records" def add_arguments(self, parser): - parser.add_argument('limit', nargs='?', default='1', type=int) + parser.add_argument("limit", nargs="?", default="1", type=int) def handle(self, *args, **options): - limit = options['limit'] + limit = options["limit"] status = self.sync_mfb_hubspot_users(limit) - if len(status['completed']) > 0: - self.stdout.write( - self.style.SUCCESS('Successfully synced %s users.' % len(status['completed']))) - for message in status['completed']: + if len(status["completed"]) > 0: + self.stdout.write(self.style.SUCCESS("Successfully synced %s users." % len(status["completed"]))) + for message in status["completed"]: self.stdout.write( - self.style.SUCCESS('Successfully synced user %s with contact %s.' % (message[0], message[1]))) - if len(status['failed']) > 0: - self.stdout.write( - self.style.WARNING('Failed to sync %s users.' % len(status['failed']))) - for message in status['failed']: + self.style.SUCCESS("Successfully synced user %s with contact %s." % (message[0], message[1])) + ) + if len(status["failed"]) > 0: + self.stdout.write(self.style.WARNING("Failed to sync %s users." % len(status["failed"]))) + for message in status["failed"]: self.stdout.write( - self.style.SUCCESS('Successfully synced user %s with contact %s.' % (message[0], message[1]))) + self.style.SUCCESS("Successfully synced user %s with contact %s." % (message[0], message[1])) + ) # MFB allows users to sign up to receive benefits updates or offers. If they do # so PII is temporarily stored against their user record. This cron function @@ -35,23 +35,21 @@ def handle(self, *args, **options): # hubspot, and then clears the PII on the user record in favor of storing the # external id. This separates PII from household demographic. def sync_mfb_hubspot_users(self, limit): - status = { - 'processed': 0, - 'completed': [], - 'failed': [] - } + status = {"processed": 0, "completed": [], "failed": []} screen = None processed = 0 # for now, we only sync users to hubspot who have signed up for offers or # updates and given TCPA consent - unsynced = User.objects.filter(Q(send_offers=True) | Q(send_updates=True))\ - .filter(external_id__isnull=True)\ + unsynced = ( + User.objects.filter(Q(send_offers=True) | Q(send_updates=True)) + .filter(external_id__isnull=True) .filter(tcpa_consent=True) + ) for user in unsynced: if processed < limit: - user_screens = Screen.objects.filter(user_id=user.id).order_by('-submission_date') + user_screens = Screen.objects.filter(user_id=user.id).order_by("-submission_date") if user_screens: screen = user_screens.first() else: @@ -59,19 +57,19 @@ def sync_mfb_hubspot_users(self, limit): hubspot_id = upsert_user_hubspot(user, screen) if hubspot_id: self.replace_pii_with_hubspot_id(hubspot_id, user) - status['completed'].append((user.id, hubspot_id)) + status["completed"].append((user.id, hubspot_id)) else: - status['failed'].append((user.id, hubspot_id)) + status["failed"].append((user.id, hubspot_id)) # Delay to prevent hitting rate limit of 100 req per 10 seconds - time.sleep(.2) + time.sleep(0.2) processed += 1 return status # stores an external id from hubspot and then clears all of the PII def replace_pii_with_hubspot_id(self, hubspot_id, user): - random_id = str(uuid.uuid4()).replace('-', '') + random_id = str(uuid.uuid4()).replace("-", "") user.external_id = hubspot_id - user.email_or_cell = f'{hubspot_id}+{random_id}@myfriendben.org' + user.email_or_cell = f"{hubspot_id}+{random_id}@myfriendben.org" user.first_name = None user.last_name = None user.cell = None diff --git a/integrations/services/communications/__init__.py b/integrations/services/communications/__init__.py index 18608ce6..10f4b18e 100644 --- a/integrations/services/communications/__init__.py +++ b/integrations/services/communications/__init__.py @@ -1,2 +1 @@ from .message import MessageUser - diff --git a/integrations/services/communications/message.py b/integrations/services/communications/message.py index c709261b..45a84103 100644 --- a/integrations/services/communications/message.py +++ b/integrations/services/communications/message.py @@ -16,8 +16,8 @@ class MessageUser: cell_auth_token = config("TWILIO_TOKEN") cell_from_phone_number = config("TWILIO_PHONE_NUMBER") - email_from = 'screener@myfriendben.org' - email_api_key = config('SENDGRID') + email_from = "screener@myfriendben.org" + email_api_key = config("SENDGRID") def __init__(self, screen: Screen, lang: str) -> None: self.screen = screen @@ -45,16 +45,16 @@ def email(self, email: str, send_tests=False): sg.client.mail.send.post(request_body=mail.get()) - self.log('emailScreen') + self.log("emailScreen") def _email_client(self): return sendgrid.SendGridAPIClient(api_key=self.email_api_key) def _email_subject(self): - return Translation.objects.get(label='sendResults.email-subject').get_lang(self.lang).text + return Translation.objects.get(label="sendResults.email-subject").get_lang(self.lang).text def _email_body(self): - words = Translation.objects.get(label='sendResults.email').get_lang(self.lang).text + words = Translation.objects.get(label="sendResults.email").get_lang(self.lang).text url = self._generate_link() return words + f' {url}' @@ -69,22 +69,21 @@ def text(self, cell: str, send_tests=False): to=cell, ) - self.log('textScreen') + self.log("textScreen") def _text_body(self): - words = Translation.objects.get(label='sendResults.email').get_lang(self.lang).text + words = Translation.objects.get(label="sendResults.email").get_lang(self.lang).text url = self._generate_link() - return f'{words} {url}' + return f"{words} {url}" def _cell_client(self): return Client(self.cell_account_sid, self.cell_auth_token) - def _generate_link(self): return f"{self.front_end_domain}/{self.screen.uuid}/results" - def log(self, type: Literal['emailScreen', 'textScreen']): + def log(self, type: Literal["emailScreen", "textScreen"]): self.screen.last_email_request_date = timezone.now() self.screen.save() @@ -92,4 +91,3 @@ def log(self, type: Literal['emailScreen', 'textScreen']): type=type, screen=self.screen, ) - diff --git a/integrations/services/google_translate/integration.py b/integrations/services/google_translate/integration.py index 7405f47c..29a1eb02 100644 --- a/integrations/services/google_translate/integration.py +++ b/integrations/services/google_translate/integration.py @@ -6,50 +6,50 @@ import html -class Translate(): +class Translate: main_language: str = settings.LANGUAGE_CODE languages: list[str] = [ - lang['code'] for lang in settings.PARLER_LANGUAGES[None] if lang['code'] != settings.LANGUAGE_CODE + lang["code"] for lang in settings.PARLER_LANGUAGES[None] if lang["code"] != settings.LANGUAGE_CODE ] def __init__(self): - info = json.loads(config('GOOGLE_APPLICATION_CREDENTIALS')) + info = json.loads(config("GOOGLE_APPLICATION_CREDENTIALS")) creds = service_account.Credentials.from_service_account_info(info) self.client = translate.Client(credentials=creds) def translate(self, lang: str, text: str): - ''' + """ Translates the text from the default language to the lang param language. - ''' + """ if lang not in Translate.languages: - raise Exception(f'{lang} is not configured in settings, or is the default language') + raise Exception(f"{lang} is not configured in settings, or is the default language") result = self.client.translate(text, target_language=lang, source_language=Translate.main_language) return self.format_text(result) def bulk_translate(self, langs: list[str], texts: list[str]): - ''' + """ Translates all of the texts to the target langs. Include __all__ in langs to tranlsate to all languages. - ''' - if '__all__' in langs: + """ + if "__all__" in langs: langs = Translate.languages translations = {text: {} for text in texts} for lang in langs: if lang not in Translate.languages: - raise Exception(f'{lang} is not configured in settings, or is the default language') + raise Exception(f"{lang} is not configured in settings, or is the default language") results = self.client.translate(texts, target_language=lang, source_language=Translate.main_language) for result in results: - translations[result['input']][lang] = self.format_text(result) + translations[result["input"]][lang] = self.format_text(result) return translations def format_text(self, result): - leading_spaces = len(result['input']) - len(result['input'].lstrip(' ')) - trailing_spaces = len(result['input']) - len(result['input'].rstrip(' ')) + leading_spaces = len(result["input"]) - len(result["input"].lstrip(" ")) + trailing_spaces = len(result["input"]) - len(result["input"].rstrip(" ")) - return ' ' * leading_spaces + html.unescape(result['translatedText']) + ' ' * trailing_spaces + return " " * leading_spaces + html.unescape(result["translatedText"]) + " " * trailing_spaces diff --git a/integrations/services/sheets/sheets.py b/integrations/services/sheets/sheets.py index 4f6dc1c8..a09e46a6 100644 --- a/integrations/services/sheets/sheets.py +++ b/integrations/services/sheets/sheets.py @@ -6,9 +6,9 @@ class GoogleSheets: - info = json.loads(config('GOOGLE_APPLICATION_CREDENTIALS')) + info = json.loads(config("GOOGLE_APPLICATION_CREDENTIALS")) creds = service_account.Credentials.from_service_account_info(info) - service = build('sheets', 'v4', credentials=creds) + service = build("sheets", "v4", credentials=creds) sheet = service.spreadsheets() class ColumnDoesNotExist(Exception): @@ -19,20 +19,18 @@ def __init__(self, spreadsheet_id: str, cell_range: str) -> None: self.cell_range = cell_range def data(self) -> list[list[any]]: - ''' + """ return a list of rows in the cell range - ''' - result = self.sheet.values().get( - spreadsheetId=self.spreadsheet_id, range=self.cell_range - ).execute() - values = result.get('values', []) + """ + result = self.sheet.values().get(spreadsheetId=self.spreadsheet_id, range=self.cell_range).execute() + values = result.get("values", []) return values def data_by_column(self, *column_names: str) -> list[dict[str, any]]: - ''' + """ return an array of dictionaries containing the column names and their values - ''' + """ data = self.data() raw_column_names = data[0] @@ -61,20 +59,20 @@ def data_by_column(self, *column_names: str) -> list[dict[str, any]]: return organized_data def print_raw_column_names(self): - ''' + """ print the column names of the spreadsheet WARN: this should only be used during development - ''' + """ raw_column_names = self.data()[0] for name in raw_column_names: print(repr(name)) def _raise_missing_columns(self, needed_columns: list[str], existing_columns: list[str]): - ''' + """ raise an exception with the column names from needed_columns that are not in existing_columns - ''' + """ missing_columns = [] for column in needed_columns: @@ -88,11 +86,10 @@ class GoogleSheetsCache(Cache): expire_time = 60 * 60 * 24 default = [] - sheet_id = '' - range_name = '' + sheet_id = "" + range_name = "" def update(self): sheet_values = GoogleSheets(self.sheet_id, self.range_name).data() return sheet_values - diff --git a/manage.py b/manage.py index 2dd7eb2e..cec8e4c5 100755 --- a/manage.py +++ b/manage.py @@ -6,7 +6,7 @@ def main(): """Run administrative tasks.""" - os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'benefits.settings') + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "benefits.settings") try: from django.core.management import execute_from_command_line except ImportError as exc: @@ -18,5 +18,5 @@ def main(): execute_from_command_line(sys.argv) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/programs/admin.py b/programs/admin.py index 77d63c3d..d1e250c0 100644 --- a/programs/admin.py +++ b/programs/admin.py @@ -20,10 +20,13 @@ class ProgramAdmin(ModelAdmin): search_fields = ("name__translations__text",) list_display = ["get_str", "name_abbreviated", "active", "action_buttons"] - filter_horizontal = ('legal_status_required', 'documents',) + filter_horizontal = ( + "legal_status_required", + "documents", + ) def get_str(self, obj): - return str(obj) if str(obj).strip() else 'unnamed' + return str(obj) if str(obj).strip() else "unnamed" get_str.admin_order_field = "name" get_str.short_description = "Program" @@ -66,10 +69,8 @@ def action_buttons(self, obj): reverse("translation_admin_url", args=[category.id]), reverse("translation_admin_url", args=[learn_more_link.id]), reverse("translation_admin_url", args=[apply_button_link.id]), - reverse("translation_admin_url", args=[ - estimated_delivery_time.id]), - reverse("translation_admin_url", args=[ - estimated_application_time.id]), + reverse("translation_admin_url", args=[estimated_delivery_time.id]), + reverse("translation_admin_url", args=[estimated_application_time.id]), reverse("translation_admin_url", args=[value_type.id]), reverse("translation_admin_url", args=[warning.id]), reverse("translation_admin_url", args=[website_description.id]), @@ -90,10 +91,13 @@ class NavigatorCountiesAdmin(ModelAdmin): class NavigatorAdmin(ModelAdmin): search_fields = ("name__translations__text",) list_display = ["get_str", "external_name", "action_buttons"] - filter_horizontal = ('program', 'counties',) + filter_horizontal = ( + "program", + "counties", + ) def get_str(self, obj): - return str(obj) if str(obj).strip() else 'unnamed' + return str(obj) if str(obj).strip() else "unnamed" get_str.admin_order_field = "name" get_str.short_description = "Navigator" @@ -129,10 +133,13 @@ def action_buttons(self, obj): class UrgentNeedAdmin(ModelAdmin): search_fields = ("name__translations__text",) list_display = ["get_str", "external_name", "active", "action_buttons"] - filter_horizontal = ('type_short', 'functions',) + filter_horizontal = ( + "type_short", + "functions", + ) def get_str(self, obj): - return str(obj) if str(obj).strip() else 'unnamed' + return str(obj) if str(obj).strip() else "unnamed" get_str.admin_order_field = "name" get_str.short_description = "Urgent Need" @@ -191,8 +198,11 @@ class DocumentAdmin(ModelAdmin): class ReferrerAdmin(ModelAdmin): search_fields = ("referrer_code",) - filter_horizontal = ('webhook_functions', - 'primary_navigators', 'remove_programs',) + filter_horizontal = ( + "webhook_functions", + "primary_navigators", + "remove_programs", + ) class WebHookFunctionsAdmin(ModelAdmin): diff --git a/programs/apps.py b/programs/apps.py index 8d5355c3..34c4c1e7 100644 --- a/programs/apps.py +++ b/programs/apps.py @@ -2,5 +2,5 @@ class ProgramsConfig(AppConfig): - default_auto_field = 'django.db.models.BigAutoField' - name = 'programs' + default_auto_field = "django.db.models.BigAutoField" + name = "programs" diff --git a/programs/co_county_zips.py b/programs/co_county_zips.py index 78746a10..bcb3f762 100644 --- a/programs/co_county_zips.py +++ b/programs/co_county_zips.py @@ -1,4 +1,3 @@ - def counties_from_zip(lookup_zip): matches = [] @@ -911,8 +910,7 @@ def counties_from_zip(lookup_zip): "81416", "81521", ], - "Mineral County": [ - "81230", "81149", "81147", "81154", "81235", "81132", "81130"], + "Mineral County": ["81230", "81149", "81147", "81154", "81235", "81132", "81130"], "Moffat County": [ "81648", "81638", diff --git a/programs/management/commands/add_history.py b/programs/management/commands/add_history.py index 8edaeaae..5a1faa94 100644 --- a/programs/management/commands/add_history.py +++ b/programs/management/commands/add_history.py @@ -8,38 +8,33 @@ class Command(BaseCommand): - help = 'Adds a new program eligibility snapshot to the history yaml file for all screens' + help = "Adds a new program eligibility snapshot to the history yaml file for all screens" def create_screen(self, path): - with open(path, 'r') as file: + with open(path, "r") as file: screen_dict = yaml.safe_load(file) screen = Screen.objects.create( - **{key: value for key, value in screen_dict.items() if key != 'household_members'}, + **{key: value for key, value in screen_dict.items() if key != "household_members"}, agree_to_tos=True, completed=False, is_test=True - ) + ) members = [] incomes = [] expenses = [] - for member in screen_dict['household_members']: - has_income = len(member['incomes']) >= 1 - has_expense = len(member['expenses']) >= 1 - household_member = {key: value for key, value in member.items() if key not in ('incomes', 'expenses')} - member_model = HouseholdMember(**household_member, - has_income=has_income, - has_expenses=has_expense, - screen=screen) + for member in screen_dict["household_members"]: + has_income = len(member["incomes"]) >= 1 + has_expense = len(member["expenses"]) >= 1 + household_member = {key: value for key, value in member.items() if key not in ("incomes", "expenses")} + member_model = HouseholdMember( + **household_member, has_income=has_income, has_expenses=has_expense, screen=screen + ) members.append(member_model) - for income in member['incomes']: - incomes.append(IncomeStream(**income, - screen=screen, - household_member=member_model)) - for expense in member['expenses']: - expenses.append(Expense(**expense, - screen=screen, - household_member=member_model)) + for income in member["incomes"]: + incomes.append(IncomeStream(**income, screen=screen, household_member=member_model)) + for expense in member["expenses"]: + expenses.append(Expense(**expense, screen=screen, household_member=member_model)) HouseholdMember.objects.bulk_create(members) IncomeStream.objects.bulk_create(incomes) @@ -50,32 +45,32 @@ def create_screen(self, path): def eligibility(self, screen): eligibility = {} for benefit, calculator in calculators.items(): - raw_result = calculator(screen, [ - {'name_abbreviated': 'medicaid', 'eligible': False if benefit == 'cfhc' else True}, - {'name_abbreviated': 'tanf', 'eligible': False} - ]) - eligibility[benefit] = { - 'eligibility': raw_result['eligibility']['eligible'], - 'value': raw_result['value'] - } + raw_result = calculator( + screen, + [ + {"name_abbreviated": "medicaid", "eligible": False if benefit == "cfhc" else True}, + {"name_abbreviated": "tanf", "eligible": False}, + ], + ) + eligibility[benefit] = {"eligibility": raw_result["eligibility"]["eligible"], "value": raw_result["value"]} return eligibility def update_history(seld, eligibility, path, date): - with open(path, 'r') as file: + with open(path, "r") as file: history = yaml.safe_load(file) - with open(path, 'w') as file: + with open(path, "w") as file: if history is None: - yaml.dump([{'date': date, 'eligibility': eligibility}], file) + yaml.dump([{"date": date, "eligibility": eligibility}], file) else: - history.append({'date': date, 'eligibility': eligibility}) + history.append({"date": date, "eligibility": eligibility}) yaml.dump(history, file) def handle(self, *args, **options): - base_path = os.path.join(settings.BASE_DIR, 'programs', 'program_history') + base_path = os.path.join(settings.BASE_DIR, "programs", "program_history") date = datetime.now().strftime("%m/%d/%Y %H:%M:%S") for directory in os.listdir(base_path): print(directory) - screen = self.create_screen(os.path.join(base_path, directory, 'screen.yaml')) + screen = self.create_screen(os.path.join(base_path, directory, "screen.yaml")) eligibility = self.eligibility(screen) - self.update_history(eligibility, os.path.join(base_path, directory, 'history.yaml'), date) + self.update_history(eligibility, os.path.join(base_path, directory, "history.yaml"), date) diff --git a/programs/management/commands/diff_history.py b/programs/management/commands/diff_history.py index 9698fe98..3fd8006f 100644 --- a/programs/management/commands/diff_history.py +++ b/programs/management/commands/diff_history.py @@ -5,42 +5,42 @@ class Command(BaseCommand): - help = 'Checks history for changes' + help = "Checks history for changes" def compare(self, file): - with open(file, 'r') as file: + with open(file, "r") as file: history = yaml.safe_load(file) try: - latest = history[-1]['eligibility'] - second_latest = history[-2]['eligibility'] + latest = history[-1]["eligibility"] + second_latest = history[-2]["eligibility"] except IndexError: - print('nothing to compare') + print("nothing to compare") return for key in latest: try: - new_eligible = latest[key]['eligibility'] + new_eligible = latest[key]["eligibility"] except KeyError: - print(key, 'was deleted') + print(key, "was deleted") continue try: - old_eligible = second_latest[key]['eligibility'] + old_eligible = second_latest[key]["eligibility"] except KeyError: - print(key, 'was added') + print(key, "was added") continue if new_eligible != old_eligible: - print(f' {key}: {old_eligible} => {new_eligible}') + print(f" {key}: {old_eligible} => {new_eligible}") - new_value = latest[key]['value'] - old_value = second_latest[key]['value'] + new_value = latest[key]["value"] + old_value = second_latest[key]["value"] if new_value != old_value: - print(f' {key}: {old_value} => {new_value}') + print(f" {key}: {old_value} => {new_value}") def handle(self, *args, **options): - base_path = os.path.join(settings.BASE_DIR, 'programs', 'program_history') + base_path = os.path.join(settings.BASE_DIR, "programs", "program_history") for directory in os.listdir(base_path): - print(directory+':') - self.compare(os.path.join(base_path, directory, 'history.yaml')) + print(directory + ":") + self.compare(os.path.join(base_path, directory, "history.yaml")) diff --git a/programs/management/commands/quick_start.py b/programs/management/commands/quick_start.py index 3f89859f..7c2460f4 100644 --- a/programs/management/commands/quick_start.py +++ b/programs/management/commands/quick_start.py @@ -12,9 +12,7 @@ class Command(BaseCommand): - help = ( - 'create programs, navigators, urgent needs, and other starting database stuff' - ) + help = "create programs, navigators, urgent needs, and other starting database stuff" fpl = { 1: 13_590, @@ -27,116 +25,116 @@ class Command(BaseCommand): 8: 41_910, } legal_statuses = [ - 'gc_under18_no5', - 'gc_18plus_no5', - 'gc_5plus', - 'refugee', - 'green_card', - 'non_citizen', - 'citizen', - 'other', - 'otherHealthCarePregnant', - 'otherHealthCareUnder19', - 'otherWithWorkPermission', + "gc_under18_no5", + "gc_18plus_no5", + "gc_5plus", + "refugee", + "green_card", + "non_citizen", + "citizen", + "other", + "otherHealthCarePregnant", + "otherHealthCareUnder19", + "otherWithWorkPermission", ] urgent_need_categories = [ - 'legal services', - 'dental care', - 'job resources', - 'family planning', - 'funeral', - 'child dev', - 'mental health', - 'housing', - 'baby supplies', - 'food', + "legal services", + "dental care", + "job resources", + "family planning", + "funeral", + "child dev", + "mental health", + "housing", + "baby supplies", + "food", ] urgent_need_functions = [ - 'co_legal_services', - 'eoc', - 'trua', - 'bia_food_delivery', - 'child', - 'helpkitchen_zipcode', - 'denver', + "co_legal_services", + "eoc", + "trua", + "bia_food_delivery", + "child", + "helpkitchen_zipcode", + "denver", ] programs = [ - {'abbr': 'cwd_medicaid', 'external': 'cwd_medicaid'}, - {'abbr': 'awd_medicaid', 'external': 'awd_medivaid'}, - {'abbr': 'emergency_medicaid', 'external': 'emergency_medicaid'}, - {'abbr': 'medicare_savings', 'external': 'medicare_savings'}, - {'abbr': 'ssi', 'external': 'ssi'}, - {'abbr': 'trua', 'external': 'trua'}, - {'abbr': 'rhc', 'external': 'rhc'}, - {'abbr': 'wic', 'external': 'wic'}, - {'abbr': 'omnisalud', 'external': 'omnisalud'}, - {'abbr': 'dpp', 'external': 'dpp'}, - {'abbr': 'lwcr', 'external': 'lwcr'}, - {'abbr': 'lifeline', 'external': 'lifeline'}, - {'abbr': 'fps', 'external': 'fps'}, - {'abbr': 'leap', 'external': 'leap'}, - {'abbr': 'pell_grant', 'external': 'pell_grant'}, - {'abbr': 'mydenver', 'external': 'mydenver'}, - {'abbr': 'ede', 'external': 'ede'}, - {'abbr': 'cdhcs', 'external': 'cdhcs'}, - {'abbr': 'nslp', 'external': 'nslp'}, - {'abbr': 'erc', 'external': 'erc'}, - {'abbr': 'chs', 'external': 'chs'}, - {'abbr': 'cccap', 'external': 'cccap'}, - {'abbr': 'chp', 'external': 'chp'}, - {'abbr': 'coeitc', 'external': 'coexeitc'}, - {'abbr': 'acp', 'external': 'acp'}, - {'abbr': 'rtdlive', 'external': 'rtdlive'}, - {'abbr': 'coctc', 'external': 'coctc'}, - {'abbr': 'ssdi', 'external': 'ssdi'}, - {'abbr': 'tanf', 'external': 'tanf'}, - {'abbr': 'coeitc', 'external': 'coeitc'}, - {'abbr': 'cpcr', 'external': 'cpcr'}, - {'abbr': 'eitc', 'external': 'eitc'}, - {'abbr': 'cfhc', 'external': 'cfhc'}, - {'abbr': 'myspark', 'external': 'myspark'}, - {'abbr': 'snap', 'external': 'snap'}, - {'abbr': 'ctc', 'external': 'ctc'}, - {'abbr': 'medicaid', 'external': 'medicaid'}, - {'abbr': 'andcs', 'external': 'andcs'}, - {'abbr': 'oap', 'external': 'oap'}, - {'abbr': 'upk', 'external': 'upk'}, + {"abbr": "cwd_medicaid", "external": "cwd_medicaid"}, + {"abbr": "awd_medicaid", "external": "awd_medivaid"}, + {"abbr": "emergency_medicaid", "external": "emergency_medicaid"}, + {"abbr": "medicare_savings", "external": "medicare_savings"}, + {"abbr": "ssi", "external": "ssi"}, + {"abbr": "trua", "external": "trua"}, + {"abbr": "rhc", "external": "rhc"}, + {"abbr": "wic", "external": "wic"}, + {"abbr": "omnisalud", "external": "omnisalud"}, + {"abbr": "dpp", "external": "dpp"}, + {"abbr": "lwcr", "external": "lwcr"}, + {"abbr": "lifeline", "external": "lifeline"}, + {"abbr": "fps", "external": "fps"}, + {"abbr": "leap", "external": "leap"}, + {"abbr": "pell_grant", "external": "pell_grant"}, + {"abbr": "mydenver", "external": "mydenver"}, + {"abbr": "ede", "external": "ede"}, + {"abbr": "cdhcs", "external": "cdhcs"}, + {"abbr": "nslp", "external": "nslp"}, + {"abbr": "erc", "external": "erc"}, + {"abbr": "chs", "external": "chs"}, + {"abbr": "cccap", "external": "cccap"}, + {"abbr": "chp", "external": "chp"}, + {"abbr": "coeitc", "external": "coexeitc"}, + {"abbr": "acp", "external": "acp"}, + {"abbr": "rtdlive", "external": "rtdlive"}, + {"abbr": "coctc", "external": "coctc"}, + {"abbr": "ssdi", "external": "ssdi"}, + {"abbr": "tanf", "external": "tanf"}, + {"abbr": "coeitc", "external": "coeitc"}, + {"abbr": "cpcr", "external": "cpcr"}, + {"abbr": "eitc", "external": "eitc"}, + {"abbr": "cfhc", "external": "cfhc"}, + {"abbr": "myspark", "external": "myspark"}, + {"abbr": "snap", "external": "snap"}, + {"abbr": "ctc", "external": "ctc"}, + {"abbr": "medicaid", "external": "medicaid"}, + {"abbr": "andcs", "external": "andcs"}, + {"abbr": "oap", "external": "oap"}, + {"abbr": "upk", "external": "upk"}, ] urgent_needs = [ - 'bia_food', - 'coemap', - 'dbap', - 'plentiful', - 'eic', - 'ccs', - 'ndbn', - 'hfc', - 'rhc', - 'fps', - 'better_offer', - 'cedp', - 'chc', - 'cda', - 'eocbpa', - 'cls', - 'trua', - 'imatter', + "bia_food", + "coemap", + "dbap", + "plentiful", + "eic", + "ccs", + "ndbn", + "hfc", + "rhc", + "fps", + "better_offer", + "cedp", + "chc", + "cda", + "eocbpa", + "cls", + "trua", + "imatter", ] navigators = [ - 'gac', - 'bia', - 'bdt', - 'acc', - 'mhuw', - 'dpp', - 'uph', - 'cowicc', + "gac", + "bia", + "bdt", + "acc", + "mhuw", + "dpp", + "uph", + "cowicc", ] def handle(self, *args, **options): # create FPL fpl = FederalPoveryLimit.objects.create( - year='THIS YEAR', + year="THIS YEAR", has_1_person=self.fpl[1], has_2_people=self.fpl[2], has_3_people=self.fpl[3], @@ -164,8 +162,8 @@ def handle(self, *args, **options): # create programs programs = [] for program in self.programs: - new_program = Program.objects.new_program(program['abbr']) - new_program.external_name = program['external'] + new_program = Program.objects.new_program(program["abbr"]) + new_program.external_name = program["external"] new_program.fpl = fpl for status in statuses: # set all legal statuses for each program diff --git a/programs/management/commands/rm_latest_history.py b/programs/management/commands/rm_latest_history.py index c52b25bb..762a36dc 100644 --- a/programs/management/commands/rm_latest_history.py +++ b/programs/management/commands/rm_latest_history.py @@ -5,19 +5,19 @@ class Command(BaseCommand): - help = 'Checks history for changes' + help = "Checks history for changes" def remove_latest(self, path): - with open(path, 'r') as file: + with open(path, "r") as file: history = yaml.safe_load(file) history = history[:-1] - with open(path, 'w') as file: + with open(path, "w") as file: yaml.dump(history, file) def handle(self, *args, **options): - base_path = os.path.join(settings.BASE_DIR, 'programs', 'program_history') + base_path = os.path.join(settings.BASE_DIR, "programs", "program_history") for directory in os.listdir(base_path): print(directory) - self.remove_latest(os.path.join(base_path, directory, 'history.yaml')) + self.remove_latest(os.path.join(base_path, directory, "history.yaml")) diff --git a/programs/migrations/0001_initial.py b/programs/migrations/0001_initial.py index 94d27846..258f33b7 100644 --- a/programs/migrations/0001_initial.py +++ b/programs/migrations/0001_initial.py @@ -4,27 +4,26 @@ import parler.fields import parler.models -class Migration(migrations.Migration): +class Migration(migrations.Migration): initial = True - dependencies = [ - ] + dependencies = [] operations = [ migrations.CreateModel( - name='Program', + name="Program", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('programSnapshot', models.TextField()), - ('programName', models.CharField(max_length=120)), - ('programDescription', models.TextField()), - ('learnMoreLink', models.CharField(max_length=320)), - ('applyButtonLink', models.CharField(max_length=320)), - ('dollarValue', models.IntegerField()), - ('estimatedDeliveryTime', models.CharField(max_length=120)), - ('legalStatusRequired', models.BooleanField()), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("programSnapshot", models.TextField()), + ("programName", models.CharField(max_length=120)), + ("programDescription", models.TextField()), + ("learnMoreLink", models.CharField(max_length=320)), + ("applyButtonLink", models.CharField(max_length=320)), + ("dollarValue", models.IntegerField()), + ("estimatedDeliveryTime", models.CharField(max_length=120)), + ("legalStatusRequired", models.BooleanField()), ], - bases=(parler.models.TranslatableModelMixin, models.Model) + bases=(parler.models.TranslatableModelMixin, models.Model), ), ] diff --git a/programs/migrations/0002_program_programnameshort.py b/programs/migrations/0002_program_programnameshort.py index fa128a4a..056d7300 100644 --- a/programs/migrations/0002_program_programnameshort.py +++ b/programs/migrations/0002_program_programnameshort.py @@ -4,16 +4,15 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0001_initial'), + ("programs", "0001_initial"), ] operations = [ migrations.AddField( - model_name='program', - name='programNameShort', - field=models.CharField(default='snap', max_length=120), + model_name="program", + name="programNameShort", + field=models.CharField(default="snap", max_length=120), preserve_default=False, ), ] diff --git a/programs/migrations/0003_rename_applybuttonlink_program_apply_button_link_and_more.py b/programs/migrations/0003_rename_applybuttonlink_program_apply_button_link_and_more.py index 55be7831..ff041972 100644 --- a/programs/migrations/0003_rename_applybuttonlink_program_apply_button_link_and_more.py +++ b/programs/migrations/0003_rename_applybuttonlink_program_apply_button_link_and_more.py @@ -4,55 +4,54 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0002_program_programnameshort'), + ("programs", "0002_program_programnameshort"), ] operations = [ migrations.RenameField( - model_name='program', - old_name='applyButtonLink', - new_name='apply_button_link', + model_name="program", + old_name="applyButtonLink", + new_name="apply_button_link", ), migrations.RenameField( - model_name='program', - old_name='dollarValue', - new_name='dollar_value', + model_name="program", + old_name="dollarValue", + new_name="dollar_value", ), migrations.RenameField( - model_name='program', - old_name='estimatedDeliveryTime', - new_name='estimated_delivery_time', + model_name="program", + old_name="estimatedDeliveryTime", + new_name="estimated_delivery_time", ), migrations.RenameField( - model_name='program', - old_name='learnMoreLink', - new_name='learn_more_link', + model_name="program", + old_name="learnMoreLink", + new_name="learn_more_link", ), migrations.RenameField( - model_name='program', - old_name='legalStatusRequired', - new_name='legal_status_required', + model_name="program", + old_name="legalStatusRequired", + new_name="legal_status_required", ), migrations.RenameField( - model_name='program', - old_name='programDescription', - new_name='program_description', + model_name="program", + old_name="programDescription", + new_name="program_description", ), migrations.RenameField( - model_name='program', - old_name='programName', - new_name='program_name', + model_name="program", + old_name="programName", + new_name="program_name", ), migrations.RenameField( - model_name='program', - old_name='programNameShort', - new_name='program_name_short', + model_name="program", + old_name="programNameShort", + new_name="program_name_short", ), migrations.RenameField( - model_name='program', - old_name='programSnapshot', - new_name='program_snapshot', + model_name="program", + old_name="programSnapshot", + new_name="program_snapshot", ), ] diff --git a/programs/migrations/0004_rename_program_snapshot_program_description_short.py b/programs/migrations/0004_rename_program_snapshot_program_description_short.py index 290e77ac..0d9564e7 100644 --- a/programs/migrations/0004_rename_program_snapshot_program_description_short.py +++ b/programs/migrations/0004_rename_program_snapshot_program_description_short.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0003_rename_applybuttonlink_program_apply_button_link_and_more'), + ("programs", "0003_rename_applybuttonlink_program_apply_button_link_and_more"), ] operations = [ migrations.RenameField( - model_name='program', - old_name='program_snapshot', - new_name='description_short', + model_name="program", + old_name="program_snapshot", + new_name="description_short", ), ] diff --git a/programs/migrations/0005_rename_program_name_program_name.py b/programs/migrations/0005_rename_program_name_program_name.py index e45319c6..6a020db9 100644 --- a/programs/migrations/0005_rename_program_name_program_name.py +++ b/programs/migrations/0005_rename_program_name_program_name.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0004_rename_program_snapshot_program_description_short'), + ("programs", "0004_rename_program_snapshot_program_description_short"), ] operations = [ migrations.RenameField( - model_name='program', - old_name='program_name', - new_name='name', + model_name="program", + old_name="program_name", + new_name="name", ), ] diff --git a/programs/migrations/0006_rename_program_description_program_description_and_more.py b/programs/migrations/0006_rename_program_description_program_description_and_more.py index e6001367..1846cf8f 100644 --- a/programs/migrations/0006_rename_program_description_program_description_and_more.py +++ b/programs/migrations/0006_rename_program_description_program_description_and_more.py @@ -4,20 +4,19 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0005_rename_program_name_program_name'), + ("programs", "0005_rename_program_name_program_name"), ] operations = [ migrations.RenameField( - model_name='program', - old_name='program_description', - new_name='description', + model_name="program", + old_name="program_description", + new_name="description", ), migrations.RenameField( - model_name='program', - old_name='program_name_short', - new_name='name_abbreviated', + model_name="program", + old_name="program_name_short", + new_name="name_abbreviated", ), ] diff --git a/programs/migrations/0007_alter_program_estimated_delivery_time.py b/programs/migrations/0007_alter_program_estimated_delivery_time.py index c8b21efd..4a1a6bd8 100644 --- a/programs/migrations/0007_alter_program_estimated_delivery_time.py +++ b/programs/migrations/0007_alter_program_estimated_delivery_time.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0006_rename_program_description_program_description_and_more'), + ("programs", "0006_rename_program_description_program_description_and_more"), ] operations = [ migrations.AlterField( - model_name='program', - name='estimated_delivery_time', + model_name="program", + name="estimated_delivery_time", field=models.CharField(max_length=320), ), ] diff --git a/programs/migrations/0008_alter_program_legal_status_required.py b/programs/migrations/0008_alter_program_legal_status_required.py index 36454bce..bcdd2a87 100644 --- a/programs/migrations/0008_alter_program_legal_status_required.py +++ b/programs/migrations/0008_alter_program_legal_status_required.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0007_alter_program_estimated_delivery_time'), + ("programs", "0007_alter_program_estimated_delivery_time"), ] operations = [ migrations.AlterField( - model_name='program', - name='legal_status_required', + model_name="program", + name="legal_status_required", field=models.CharField(max_length=120), ), ] diff --git a/programs/migrations/0009_program_value_type.py b/programs/migrations/0009_program_value_type.py index 6d127a49..e2f61b6f 100644 --- a/programs/migrations/0009_program_value_type.py +++ b/programs/migrations/0009_program_value_type.py @@ -4,16 +4,15 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0008_alter_program_legal_status_required'), + ("programs", "0008_alter_program_legal_status_required"), ] operations = [ migrations.AddField( - model_name='program', - name='value_type', - field=models.CharField(default='non-discretionary', max_length=120), + model_name="program", + name="value_type", + field=models.CharField(default="non-discretionary", max_length=120), preserve_default=False, ), ] diff --git a/programs/migrations/0010_rename_apply_button_link_program__apply_button_link_and_more.py b/programs/migrations/0010_rename_apply_button_link_program__apply_button_link_and_more.py index 3f94cdbd..2a7ffbc2 100644 --- a/programs/migrations/0010_rename_apply_button_link_program__apply_button_link_and_more.py +++ b/programs/migrations/0010_rename_apply_button_link_program__apply_button_link_and_more.py @@ -4,60 +4,59 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0009_program_value_type'), + ("programs", "0009_program_value_type"), ] operations = [ migrations.RenameField( - model_name='program', - old_name='apply_button_link', - new_name='_apply_button_link', + model_name="program", + old_name="apply_button_link", + new_name="_apply_button_link", ), migrations.RenameField( - model_name='program', - old_name='description', - new_name='_description', + model_name="program", + old_name="description", + new_name="_description", ), migrations.RenameField( - model_name='program', - old_name='description_short', - new_name='_description_short', + model_name="program", + old_name="description_short", + new_name="_description_short", ), migrations.RenameField( - model_name='program', - old_name='dollar_value', - new_name='_dollar_value', + model_name="program", + old_name="dollar_value", + new_name="_dollar_value", ), migrations.RenameField( - model_name='program', - old_name='estimated_delivery_time', - new_name='_estimated_delivery_time', + model_name="program", + old_name="estimated_delivery_time", + new_name="_estimated_delivery_time", ), migrations.RenameField( - model_name='program', - old_name='learn_more_link', - new_name='_learn_more_link', + model_name="program", + old_name="learn_more_link", + new_name="_learn_more_link", ), migrations.RenameField( - model_name='program', - old_name='legal_status_required', - new_name='_legal_status_required', + model_name="program", + old_name="legal_status_required", + new_name="_legal_status_required", ), migrations.RenameField( - model_name='program', - old_name='name', - new_name='_name', + model_name="program", + old_name="name", + new_name="_name", ), migrations.RenameField( - model_name='program', - old_name='name_abbreviated', - new_name='_name_abbreviated', + model_name="program", + old_name="name_abbreviated", + new_name="_name_abbreviated", ), migrations.RenameField( - model_name='program', - old_name='value_type', - new_name='_value_type', + model_name="program", + old_name="value_type", + new_name="_value_type", ), ] diff --git a/programs/migrations/0011_add_translation_model.py b/programs/migrations/0011_add_translation_model.py index c7318de7..0a807c4e 100644 --- a/programs/migrations/0011_add_translation_model.py +++ b/programs/migrations/0011_add_translation_model.py @@ -7,36 +7,44 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0010_rename_apply_button_link_program__apply_button_link_and_more'), + ("programs", "0010_rename_apply_button_link_program__apply_button_link_and_more"), ] operations = [ migrations.CreateModel( - name='ProgramTranslation', + name="ProgramTranslation", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('language_code', models.CharField(db_index=True, max_length=15, verbose_name='Language')), - ('description_short', models.TextField()), - ('name', models.CharField(max_length=120)), - ('name_abbreviated', models.CharField(max_length=120)), - ('description', models.TextField()), - ('learn_more_link', models.CharField(max_length=320)), - ('apply_button_link', models.CharField(max_length=320)), - ('dollar_value', models.IntegerField()), - ('value_type', models.CharField(max_length=120)), - ('estimated_delivery_time', models.CharField(max_length=320)), - ('legal_status_required', models.CharField(max_length=120)), - ('master', parler.fields.TranslationsForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='programs.program')), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("language_code", models.CharField(db_index=True, max_length=15, verbose_name="Language")), + ("description_short", models.TextField()), + ("name", models.CharField(max_length=120)), + ("name_abbreviated", models.CharField(max_length=120)), + ("description", models.TextField()), + ("learn_more_link", models.CharField(max_length=320)), + ("apply_button_link", models.CharField(max_length=320)), + ("dollar_value", models.IntegerField()), + ("value_type", models.CharField(max_length=120)), + ("estimated_delivery_time", models.CharField(max_length=320)), + ("legal_status_required", models.CharField(max_length=120)), + ( + "master", + parler.fields.TranslationsForeignKey( + editable=False, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="translations", + to="programs.program", + ), + ), ], options={ - 'verbose_name': 'program Translation', - 'db_table': 'programs_program_translation', - 'db_tablespace': '', - 'managed': True, - 'default_permissions': (), - 'unique_together': {('language_code', 'master')}, + "verbose_name": "program Translation", + "db_table": "programs_program_translation", + "db_tablespace": "", + "managed": True, + "default_permissions": (), + "unique_together": {("language_code", "master")}, }, bases=(parler.models.TranslatedFieldsModelMixin, models.Model), ), diff --git a/programs/migrations/0012_migrate_translatable_fields.py b/programs/migrations/0012_migrate_translatable_fields.py index e34f5246..cde7cc50 100644 --- a/programs/migrations/0012_migrate_translatable_fields.py +++ b/programs/migrations/0012_migrate_translatable_fields.py @@ -4,31 +4,31 @@ def forwards_func(apps, schema_editor): - Program = apps.get_model('programs', 'Program') - ProgramTranslation = apps.get_model('programs', 'ProgramTranslation') + Program = apps.get_model("programs", "Program") + ProgramTranslation = apps.get_model("programs", "ProgramTranslation") for object in Program.objects.all(): ProgramTranslation.objects.create( master_id=object.pk, language_code=settings.LANGUAGE_CODE, - description_short = object._description_short, - name = object._name, - name_abbreviated = object._name_abbreviated, - description = object._description, - learn_more_link = object._learn_more_link, - apply_button_link = object._apply_button_link, - dollar_value = object._dollar_value, - value_type = object._value_type, - estimated_delivery_time = object._estimated_delivery_time, - legal_status_required = object._legal_status_required + description_short=object._description_short, + name=object._name, + name_abbreviated=object._name_abbreviated, + description=object._description, + learn_more_link=object._learn_more_link, + apply_button_link=object._apply_button_link, + dollar_value=object._dollar_value, + value_type=object._value_type, + estimated_delivery_time=object._estimated_delivery_time, + legal_status_required=object._legal_status_required, ) -class Migration(migrations.Migration): +class Migration(migrations.Migration): dependencies = [ - ('programs', '0011_add_translation_model'), + ("programs", "0011_add_translation_model"), ] operations = [ migrations.RunPython(forwards_func), - ] \ No newline at end of file + ] diff --git a/programs/migrations/0013_remove_program__apply_button_link_and_more.py b/programs/migrations/0013_remove_program__apply_button_link_and_more.py index 28dd2663..8af02cab 100644 --- a/programs/migrations/0013_remove_program__apply_button_link_and_more.py +++ b/programs/migrations/0013_remove_program__apply_button_link_and_more.py @@ -4,50 +4,49 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0012_migrate_translatable_fields'), + ("programs", "0012_migrate_translatable_fields"), ] operations = [ migrations.RemoveField( - model_name='program', - name='_apply_button_link', + model_name="program", + name="_apply_button_link", ), migrations.RemoveField( - model_name='program', - name='_description', + model_name="program", + name="_description", ), migrations.RemoveField( - model_name='program', - name='_description_short', + model_name="program", + name="_description_short", ), migrations.RemoveField( - model_name='program', - name='_dollar_value', + model_name="program", + name="_dollar_value", ), migrations.RemoveField( - model_name='program', - name='_estimated_delivery_time', + model_name="program", + name="_estimated_delivery_time", ), migrations.RemoveField( - model_name='program', - name='_learn_more_link', + model_name="program", + name="_learn_more_link", ), migrations.RemoveField( - model_name='program', - name='_legal_status_required', + model_name="program", + name="_legal_status_required", ), migrations.RemoveField( - model_name='program', - name='_name', + model_name="program", + name="_name", ), migrations.RemoveField( - model_name='program', - name='_name_abbreviated', + model_name="program", + name="_name_abbreviated", ), migrations.RemoveField( - model_name='program', - name='_value_type', + model_name="program", + name="_value_type", ), ] diff --git a/programs/migrations/0014_programtranslation_estimated_application_time.py b/programs/migrations/0014_programtranslation_estimated_application_time.py index 00125414..87bfbd17 100644 --- a/programs/migrations/0014_programtranslation_estimated_application_time.py +++ b/programs/migrations/0014_programtranslation_estimated_application_time.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0013_remove_program__apply_button_link_and_more'), + ("programs", "0013_remove_program__apply_button_link_and_more"), ] operations = [ migrations.AddField( - model_name='programtranslation', - name='estimated_application_time', + model_name="programtranslation", + name="estimated_application_time", field=models.CharField(blank=True, default=None, max_length=320, null=True), ), ] diff --git a/programs/migrations/0015_programtranslation_active.py b/programs/migrations/0015_programtranslation_active.py index c603b279..b2fa6244 100644 --- a/programs/migrations/0015_programtranslation_active.py +++ b/programs/migrations/0015_programtranslation_active.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0014_programtranslation_estimated_application_time'), + ("programs", "0014_programtranslation_estimated_application_time"), ] operations = [ migrations.AddField( - model_name='programtranslation', - name='active', + model_name="programtranslation", + name="active", field=models.BooleanField(blank=True, default=False), ), ] diff --git a/programs/migrations/0016_alter_programtranslation_active.py b/programs/migrations/0016_alter_programtranslation_active.py index dff7dddb..405e51a9 100644 --- a/programs/migrations/0016_alter_programtranslation_active.py +++ b/programs/migrations/0016_alter_programtranslation_active.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0015_programtranslation_active'), + ("programs", "0015_programtranslation_active"), ] operations = [ migrations.AlterField( - model_name='programtranslation', - name='active', + model_name="programtranslation", + name="active", field=models.BooleanField(blank=True, default=True), ), ] diff --git a/programs/migrations/0017_navigator_navigatortranslation.py b/programs/migrations/0017_navigator_navigatortranslation.py index 2b6bffcc..816a8dac 100644 --- a/programs/migrations/0017_navigator_navigatortranslation.py +++ b/programs/migrations/0017_navigator_navigatortranslation.py @@ -8,42 +8,53 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0016_alter_programtranslation_active'), + ("programs", "0016_alter_programtranslation_active"), ] operations = [ migrations.CreateModel( - name='Navigator', + name="Navigator", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), ], options={ - 'abstract': False, + "abstract": False, }, bases=(parler.models.TranslatableModelMixin, models.Model), ), migrations.CreateModel( - name='NavigatorTranslation', + name="NavigatorTranslation", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('language_code', models.CharField(db_index=True, max_length=15, verbose_name='Language')), - ('name', models.CharField(max_length=120)), - ('cell', phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, null=True, region=None)), - ('email', models.EmailField(blank=True, max_length=254, null=True, verbose_name='email address')), - ('assistance_link', models.CharField(blank=True, max_length=320)), - ('description', models.TextField()), - ('master', parler.fields.TranslationsForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='programs.navigator')), - ('program', models.ManyToManyField(to='programs.program')), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("language_code", models.CharField(db_index=True, max_length=15, verbose_name="Language")), + ("name", models.CharField(max_length=120)), + ( + "cell", + phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, null=True, region=None), + ), + ("email", models.EmailField(blank=True, max_length=254, null=True, verbose_name="email address")), + ("assistance_link", models.CharField(blank=True, max_length=320)), + ("description", models.TextField()), + ( + "master", + parler.fields.TranslationsForeignKey( + editable=False, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="translations", + to="programs.navigator", + ), + ), + ("program", models.ManyToManyField(to="programs.program")), ], options={ - 'verbose_name': 'navigator Translation', - 'db_table': 'programs_navigator_translation', - 'db_tablespace': '', - 'managed': True, - 'default_permissions': (), - 'unique_together': {('language_code', 'master')}, + "verbose_name": "navigator Translation", + "db_table": "programs_navigator_translation", + "db_tablespace": "", + "managed": True, + "default_permissions": (), + "unique_together": {("language_code", "master")}, }, bases=(parler.models.TranslatedFieldsModelMixin, models.Model), ), diff --git a/programs/migrations/0018_alter_navigatortranslation_cell.py b/programs/migrations/0018_alter_navigatortranslation_cell.py index 3eb7fa8c..e6e872bc 100644 --- a/programs/migrations/0018_alter_navigatortranslation_cell.py +++ b/programs/migrations/0018_alter_navigatortranslation_cell.py @@ -5,15 +5,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0017_navigator_navigatortranslation'), + ("programs", "0017_navigator_navigatortranslation"), ] operations = [ migrations.AlterField( - model_name='navigatortranslation', - name='cell', + model_name="navigatortranslation", + name="cell", field=phonenumber_field.modelfields.PhoneNumberField(max_length=128, region=None), ), ] diff --git a/programs/migrations/0019_rename_cell_navigatortranslation_phone_number_and_more.py b/programs/migrations/0019_rename_cell_navigatortranslation_phone_number_and_more.py index d4f3441e..b9fdb878 100644 --- a/programs/migrations/0019_rename_cell_navigatortranslation_phone_number_and_more.py +++ b/programs/migrations/0019_rename_cell_navigatortranslation_phone_number_and_more.py @@ -4,20 +4,19 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0018_alter_navigatortranslation_cell'), + ("programs", "0018_alter_navigatortranslation_cell"), ] operations = [ migrations.RenameField( - model_name='navigatortranslation', - old_name='cell', - new_name='phone_number', + model_name="navigatortranslation", + old_name="cell", + new_name="phone_number", ), migrations.AlterField( - model_name='navigatortranslation', - name='program', - field=models.ManyToManyField(related_name='navigator', to='programs.program'), + model_name="navigatortranslation", + name="program", + field=models.ManyToManyField(related_name="navigator", to="programs.program"), ), ] diff --git a/programs/migrations/0020_remove_navigatortranslation_program.py b/programs/migrations/0020_remove_navigatortranslation_program.py index b1207a4e..9f588613 100644 --- a/programs/migrations/0020_remove_navigatortranslation_program.py +++ b/programs/migrations/0020_remove_navigatortranslation_program.py @@ -4,14 +4,13 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0019_rename_cell_navigatortranslation_phone_number_and_more'), + ("programs", "0019_rename_cell_navigatortranslation_phone_number_and_more"), ] operations = [ migrations.RemoveField( - model_name='navigatortranslation', - name='program', + model_name="navigatortranslation", + name="program", ), ] diff --git a/programs/migrations/0021_navigatortranslation_program.py b/programs/migrations/0021_navigatortranslation_program.py index 5d221ac3..39d84b79 100644 --- a/programs/migrations/0021_navigatortranslation_program.py +++ b/programs/migrations/0021_navigatortranslation_program.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0020_remove_navigatortranslation_program'), + ("programs", "0020_remove_navigatortranslation_program"), ] operations = [ migrations.AddField( - model_name='navigatortranslation', - name='program', - field=models.ManyToManyField(related_name='navigator', to='programs.program'), + model_name="navigatortranslation", + name="program", + field=models.ManyToManyField(related_name="navigator", to="programs.program"), ), ] diff --git a/programs/migrations/0022_remove_navigatortranslation_assistance_link_and_more.py b/programs/migrations/0022_remove_navigatortranslation_assistance_link_and_more.py index 1f5f1573..00f47829 100644 --- a/programs/migrations/0022_remove_navigatortranslation_assistance_link_and_more.py +++ b/programs/migrations/0022_remove_navigatortranslation_assistance_link_and_more.py @@ -5,42 +5,41 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0021_navigatortranslation_program'), + ("programs", "0021_navigatortranslation_program"), ] operations = [ migrations.RemoveField( - model_name='navigatortranslation', - name='assistance_link', + model_name="navigatortranslation", + name="assistance_link", ), migrations.RemoveField( - model_name='navigatortranslation', - name='email', + model_name="navigatortranslation", + name="email", ), migrations.RemoveField( - model_name='navigatortranslation', - name='phone_number', + model_name="navigatortranslation", + name="phone_number", ), migrations.RemoveField( - model_name='navigatortranslation', - name='program', + model_name="navigatortranslation", + name="program", ), migrations.AddField( - model_name='navigator', - name='email', - field=models.EmailField(blank=True, max_length=254, null=True, verbose_name='email address'), + model_name="navigator", + name="email", + field=models.EmailField(blank=True, max_length=254, null=True, verbose_name="email address"), ), migrations.AddField( - model_name='navigator', - name='phone_number', + model_name="navigator", + name="phone_number", field=phonenumber_field.modelfields.PhoneNumberField(default=0, max_length=128, region=None), preserve_default=False, ), migrations.AddField( - model_name='navigator', - name='program', - field=models.ManyToManyField(related_name='navigator', to='programs.program'), + model_name="navigator", + name="program", + field=models.ManyToManyField(related_name="navigator", to="programs.program"), ), ] diff --git a/programs/migrations/0023_navigator_assistance_link.py b/programs/migrations/0023_navigator_assistance_link.py index 7d1cf337..df4d1479 100644 --- a/programs/migrations/0023_navigator_assistance_link.py +++ b/programs/migrations/0023_navigator_assistance_link.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0022_remove_navigatortranslation_assistance_link_and_more'), + ("programs", "0022_remove_navigatortranslation_assistance_link_and_more"), ] operations = [ migrations.AddField( - model_name='navigator', - name='assistance_link', + model_name="navigator", + name="assistance_link", field=models.CharField(blank=True, max_length=320), ), ] diff --git a/programs/migrations/0024_remove_navigator_assistance_link_and_more.py b/programs/migrations/0024_remove_navigator_assistance_link_and_more.py index 7bc05b95..7d151426 100644 --- a/programs/migrations/0024_remove_navigator_assistance_link_and_more.py +++ b/programs/migrations/0024_remove_navigator_assistance_link_and_more.py @@ -5,37 +5,36 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0023_navigator_assistance_link'), + ("programs", "0023_navigator_assistance_link"), ] operations = [ migrations.RemoveField( - model_name='navigator', - name='assistance_link', + model_name="navigator", + name="assistance_link", ), migrations.RemoveField( - model_name='navigator', - name='email', + model_name="navigator", + name="email", ), migrations.RemoveField( - model_name='navigator', - name='phone_number', + model_name="navigator", + name="phone_number", ), migrations.AddField( - model_name='navigatortranslation', - name='assistance_link', + model_name="navigatortranslation", + name="assistance_link", field=models.CharField(blank=True, max_length=320), ), migrations.AddField( - model_name='navigatortranslation', - name='email', - field=models.EmailField(blank=True, max_length=254, null=True, verbose_name='email address'), + model_name="navigatortranslation", + name="email", + field=models.EmailField(blank=True, max_length=254, null=True, verbose_name="email address"), ), migrations.AddField( - model_name='navigatortranslation', - name='phone_number', + model_name="navigatortranslation", + name="phone_number", field=phonenumber_field.modelfields.PhoneNumberField(default=0, max_length=128, region=None), preserve_default=False, ), diff --git a/programs/migrations/0025_remove_navigatortranslation_phone_number_and_more.py b/programs/migrations/0025_remove_navigatortranslation_phone_number_and_more.py index 2953c949..6fdcabe2 100644 --- a/programs/migrations/0025_remove_navigatortranslation_phone_number_and_more.py +++ b/programs/migrations/0025_remove_navigatortranslation_phone_number_and_more.py @@ -5,19 +5,18 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0024_remove_navigator_assistance_link_and_more'), + ("programs", "0024_remove_navigator_assistance_link_and_more"), ] operations = [ migrations.RemoveField( - model_name='navigatortranslation', - name='phone_number', + model_name="navigatortranslation", + name="phone_number", ), migrations.AddField( - model_name='navigator', - name='phone_number', + model_name="navigator", + name="phone_number", field=phonenumber_field.modelfields.PhoneNumberField(default=0, max_length=128, region=None), preserve_default=False, ), diff --git a/programs/migrations/0026_remove_navigator_phone_number_and_more.py b/programs/migrations/0026_remove_navigator_phone_number_and_more.py index 32797317..4e89bcb4 100644 --- a/programs/migrations/0026_remove_navigator_phone_number_and_more.py +++ b/programs/migrations/0026_remove_navigator_phone_number_and_more.py @@ -5,19 +5,18 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0025_remove_navigatortranslation_phone_number_and_more'), + ("programs", "0025_remove_navigatortranslation_phone_number_and_more"), ] operations = [ migrations.RemoveField( - model_name='navigator', - name='phone_number', + model_name="navigator", + name="phone_number", ), migrations.AddField( - model_name='navigatortranslation', - name='phone_number', + model_name="navigatortranslation", + name="phone_number", field=phonenumber_field.modelfields.PhoneNumberField(default=0, max_length=128, region=None), preserve_default=False, ), diff --git a/programs/migrations/0027_remove_navigatortranslation_phone_number_and_more.py b/programs/migrations/0027_remove_navigatortranslation_phone_number_and_more.py index 955e8e1e..a1bd4920 100644 --- a/programs/migrations/0027_remove_navigatortranslation_phone_number_and_more.py +++ b/programs/migrations/0027_remove_navigatortranslation_phone_number_and_more.py @@ -5,19 +5,18 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0026_remove_navigator_phone_number_and_more'), + ("programs", "0026_remove_navigator_phone_number_and_more"), ] operations = [ migrations.RemoveField( - model_name='navigatortranslation', - name='phone_number', + model_name="navigatortranslation", + name="phone_number", ), migrations.AddField( - model_name='navigator', - name='phone_number', + model_name="navigator", + name="phone_number", field=phonenumber_field.modelfields.PhoneNumberField(default=0, max_length=128, region=None), preserve_default=False, ), diff --git a/programs/migrations/0028_alter_navigator_phone_number.py b/programs/migrations/0028_alter_navigator_phone_number.py index 7b057179..193f4ab6 100644 --- a/programs/migrations/0028_alter_navigator_phone_number.py +++ b/programs/migrations/0028_alter_navigator_phone_number.py @@ -5,15 +5,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0027_remove_navigatortranslation_phone_number_and_more'), + ("programs", "0027_remove_navigatortranslation_phone_number_and_more"), ] operations = [ migrations.AlterField( - model_name='navigator', - name='phone_number', + model_name="navigator", + name="phone_number", field=phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, null=True, region=None), ), ] diff --git a/programs/migrations/0029_programtranslation_catagory.py b/programs/migrations/0029_programtranslation_catagory.py index fdfd2b8e..7a222abd 100644 --- a/programs/migrations/0029_programtranslation_catagory.py +++ b/programs/migrations/0029_programtranslation_catagory.py @@ -4,16 +4,15 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0028_alter_navigator_phone_number'), + ("programs", "0028_alter_navigator_phone_number"), ] operations = [ migrations.AddField( - model_name='programtranslation', - name='catagory', - field=models.CharField(default='no category', max_length=120), + model_name="programtranslation", + name="catagory", + field=models.CharField(default="no category", max_length=120), preserve_default=False, ), ] diff --git a/programs/migrations/0030_rename_catagory_programtranslation_category.py b/programs/migrations/0030_rename_catagory_programtranslation_category.py index a8209894..92ff0fc3 100644 --- a/programs/migrations/0030_rename_catagory_programtranslation_category.py +++ b/programs/migrations/0030_rename_catagory_programtranslation_category.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0029_programtranslation_catagory'), + ("programs", "0029_programtranslation_catagory"), ] operations = [ migrations.RenameField( - model_name='programtranslation', - old_name='catagory', - new_name='category', + model_name="programtranslation", + old_name="catagory", + new_name="category", ), ] diff --git a/programs/migrations/0031_urgentneed_urgentneedtranslation.py b/programs/migrations/0031_urgentneed_urgentneedtranslation.py index c60f6554..f73c9765 100644 --- a/programs/migrations/0031_urgentneed_urgentneedtranslation.py +++ b/programs/migrations/0031_urgentneed_urgentneedtranslation.py @@ -8,43 +8,54 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0030_rename_catagory_programtranslation_category'), + ("programs", "0030_rename_catagory_programtranslation_category"), ] operations = [ migrations.CreateModel( - name='UrgentNeed', + name="UrgentNeed", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('phone_number', phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, null=True, region=None)), - ('type_short', models.CharField(max_length=120)), - ('active', models.BooleanField(blank=True, default=True)), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ( + "phone_number", + phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, null=True, region=None), + ), + ("type_short", models.CharField(max_length=120)), + ("active", models.BooleanField(blank=True, default=True)), ], options={ - 'abstract': False, + "abstract": False, }, bases=(parler.models.TranslatableModelMixin, models.Model), ), migrations.CreateModel( - name='UrgentNeedTranslation', + name="UrgentNeedTranslation", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('language_code', models.CharField(db_index=True, max_length=15, verbose_name='Language')), - ('name', models.CharField(max_length=120)), - ('description', models.TextField()), - ('link', models.CharField(max_length=320)), - ('type', models.CharField(max_length=120)), - ('master', parler.fields.TranslationsForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='programs.urgentneed')), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("language_code", models.CharField(db_index=True, max_length=15, verbose_name="Language")), + ("name", models.CharField(max_length=120)), + ("description", models.TextField()), + ("link", models.CharField(max_length=320)), + ("type", models.CharField(max_length=120)), + ( + "master", + parler.fields.TranslationsForeignKey( + editable=False, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="translations", + to="programs.urgentneed", + ), + ), ], options={ - 'verbose_name': 'urgent need Translation', - 'db_table': 'programs_urgentneed_translation', - 'db_tablespace': '', - 'managed': True, - 'default_permissions': (), - 'unique_together': {('language_code', 'master')}, + "verbose_name": "urgent need Translation", + "db_table": "programs_urgentneed_translation", + "db_tablespace": "", + "managed": True, + "default_permissions": (), + "unique_together": {("language_code", "master")}, }, bases=(parler.models.TranslatedFieldsModelMixin, models.Model), ), diff --git a/programs/migrations/0032_urgentneedfunction_urgentneed_functions.py b/programs/migrations/0032_urgentneedfunction_urgentneed_functions.py index 93264c67..4716ef84 100644 --- a/programs/migrations/0032_urgentneedfunction_urgentneed_functions.py +++ b/programs/migrations/0032_urgentneedfunction_urgentneed_functions.py @@ -4,22 +4,21 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0031_urgentneed_urgentneedtranslation'), + ("programs", "0031_urgentneed_urgentneedtranslation"), ] operations = [ migrations.CreateModel( - name='UrgentNeedFunction', + name="UrgentNeedFunction", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=32)), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("name", models.CharField(max_length=32)), ], ), migrations.AddField( - model_name='urgentneed', - name='functions', - field=models.ManyToManyField(related_name='function', to='programs.urgentneedfunction'), + model_name="urgentneed", + name="functions", + field=models.ManyToManyField(related_name="function", to="programs.urgentneedfunction"), ), ] diff --git a/programs/migrations/0033_alter_urgentneed_functions.py b/programs/migrations/0033_alter_urgentneed_functions.py index 660b3551..529a8d9c 100644 --- a/programs/migrations/0033_alter_urgentneed_functions.py +++ b/programs/migrations/0033_alter_urgentneed_functions.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0032_urgentneedfunction_urgentneed_functions'), + ("programs", "0032_urgentneedfunction_urgentneed_functions"), ] operations = [ migrations.AlterField( - model_name='urgentneed', - name='functions', - field=models.ManyToManyField(blank=True, related_name='function', to='programs.urgentneedfunction'), + model_name="urgentneed", + name="functions", + field=models.ManyToManyField(blank=True, related_name="function", to="programs.urgentneedfunction"), ), ] diff --git a/programs/migrations/0034_alter_urgentneedtranslation_link.py b/programs/migrations/0034_alter_urgentneedtranslation_link.py index f4f4c6b2..a0e64eb4 100644 --- a/programs/migrations/0034_alter_urgentneedtranslation_link.py +++ b/programs/migrations/0034_alter_urgentneedtranslation_link.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0033_alter_urgentneed_functions'), + ("programs", "0033_alter_urgentneed_functions"), ] operations = [ migrations.AlterField( - model_name='urgentneedtranslation', - name='link', + model_name="urgentneedtranslation", + name="link", field=models.CharField(blank=True, max_length=320, null=True), ), ] diff --git a/programs/migrations/0035_federalpoverylimit.py b/programs/migrations/0035_federalpoverylimit.py index 3b2dd758..7e2ae4af 100644 --- a/programs/migrations/0035_federalpoverylimit.py +++ b/programs/migrations/0035_federalpoverylimit.py @@ -4,25 +4,24 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0034_alter_urgentneedtranslation_link'), + ("programs", "0034_alter_urgentneedtranslation_link"), ] operations = [ migrations.CreateModel( - name='FederalPoveryLimit', + name="FederalPoveryLimit", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('year', models.CharField(max_length=32)), - ('has_1_person', models.IntegerField()), - ('has_2_person', models.IntegerField()), - ('has_3_person', models.IntegerField()), - ('has_4_person', models.IntegerField()), - ('has_5_person', models.IntegerField()), - ('has_6_person', models.IntegerField()), - ('has_7_person', models.IntegerField()), - ('has_8_person', models.IntegerField()), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("year", models.CharField(max_length=32)), + ("has_1_person", models.IntegerField()), + ("has_2_person", models.IntegerField()), + ("has_3_person", models.IntegerField()), + ("has_4_person", models.IntegerField()), + ("has_5_person", models.IntegerField()), + ("has_6_person", models.IntegerField()), + ("has_7_person", models.IntegerField()), + ("has_8_person", models.IntegerField()), ], ), ] diff --git a/programs/migrations/0036_rename_has_2_person_federalpoverylimit_has_2_people_and_more.py b/programs/migrations/0036_rename_has_2_person_federalpoverylimit_has_2_people_and_more.py index 0e6ced24..4b797788 100644 --- a/programs/migrations/0036_rename_has_2_person_federalpoverylimit_has_2_people_and_more.py +++ b/programs/migrations/0036_rename_has_2_person_federalpoverylimit_has_2_people_and_more.py @@ -4,45 +4,44 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0035_federalpoverylimit'), + ("programs", "0035_federalpoverylimit"), ] operations = [ migrations.RenameField( - model_name='federalpoverylimit', - old_name='has_2_person', - new_name='has_2_people', + model_name="federalpoverylimit", + old_name="has_2_person", + new_name="has_2_people", ), migrations.RenameField( - model_name='federalpoverylimit', - old_name='has_3_person', - new_name='has_3_people', + model_name="federalpoverylimit", + old_name="has_3_person", + new_name="has_3_people", ), migrations.RenameField( - model_name='federalpoverylimit', - old_name='has_4_person', - new_name='has_4_people', + model_name="federalpoverylimit", + old_name="has_4_person", + new_name="has_4_people", ), migrations.RenameField( - model_name='federalpoverylimit', - old_name='has_5_person', - new_name='has_5_people', + model_name="federalpoverylimit", + old_name="has_5_person", + new_name="has_5_people", ), migrations.RenameField( - model_name='federalpoverylimit', - old_name='has_6_person', - new_name='has_6_people', + model_name="federalpoverylimit", + old_name="has_6_person", + new_name="has_6_people", ), migrations.RenameField( - model_name='federalpoverylimit', - old_name='has_7_person', - new_name='has_7_people', + model_name="federalpoverylimit", + old_name="has_7_person", + new_name="has_7_people", ), migrations.RenameField( - model_name='federalpoverylimit', - old_name='has_8_person', - new_name='has_8_people', + model_name="federalpoverylimit", + old_name="has_8_person", + new_name="has_8_people", ), ] diff --git a/programs/migrations/0037_alter_federalpoverylimit_year.py b/programs/migrations/0037_alter_federalpoverylimit_year.py index 6ea0c297..c1b848a8 100644 --- a/programs/migrations/0037_alter_federalpoverylimit_year.py +++ b/programs/migrations/0037_alter_federalpoverylimit_year.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0036_rename_has_2_person_federalpoverylimit_has_2_people_and_more'), + ("programs", "0036_rename_has_2_person_federalpoverylimit_has_2_people_and_more"), ] operations = [ migrations.AlterField( - model_name='federalpoverylimit', - name='year', + model_name="federalpoverylimit", + name="year", field=models.CharField(max_length=32, unique=True), ), ] diff --git a/programs/migrations/0038_program_fpl.py b/programs/migrations/0038_program_fpl.py index 41bc791c..d55276b2 100644 --- a/programs/migrations/0038_program_fpl.py +++ b/programs/migrations/0038_program_fpl.py @@ -5,15 +5,20 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0037_alter_federalpoverylimit_year'), + ("programs", "0037_alter_federalpoverylimit_year"), ] operations = [ migrations.AddField( - model_name='program', - name='fpl', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='fpl', to='programs.federalpoverylimit'), + model_name="program", + name="fpl", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name="fpl", + to="programs.federalpoverylimit", + ), ), ] diff --git a/programs/migrations/0039_webhookfunction_referrer_referrertranslation.py b/programs/migrations/0039_webhookfunction_referrer_referrertranslation.py index 22f38634..94de0c56 100644 --- a/programs/migrations/0039_webhookfunction_referrer_referrertranslation.py +++ b/programs/migrations/0039_webhookfunction_referrer_referrertranslation.py @@ -7,52 +7,66 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0038_program_fpl'), + ("programs", "0038_program_fpl"), ] operations = [ migrations.CreateModel( - name='WebHookFunction', + name="WebHookFunction", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=64)), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("name", models.CharField(max_length=64)), ], ), migrations.CreateModel( - name='Referrer', + name="Referrer", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('referrer_code', models.CharField(max_length=64, unique=True)), - ('webhook_url', models.CharField(blank=True, max_length=320, null=True)), - ('logo', models.ImageField(upload_to='')), - ('white_label_css', models.FileField(upload_to='')), - ('primary_navigators', models.ManyToManyField(blank=True, related_name='primary_navigators', to='programs.navigator')), - ('webhook_functions', models.ManyToManyField(blank=True, related_name='web_hook', to='programs.webhookfunction')), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("referrer_code", models.CharField(max_length=64, unique=True)), + ("webhook_url", models.CharField(blank=True, max_length=320, null=True)), + ("logo", models.ImageField(upload_to="")), + ("white_label_css", models.FileField(upload_to="")), + ( + "primary_navigators", + models.ManyToManyField(blank=True, related_name="primary_navigators", to="programs.navigator"), + ), + ( + "webhook_functions", + models.ManyToManyField(blank=True, related_name="web_hook", to="programs.webhookfunction"), + ), ], options={ - 'abstract': False, + "abstract": False, }, bases=(parler.models.TranslatableModelMixin, models.Model), ), migrations.CreateModel( - name='ReferrerTranslation', + name="ReferrerTranslation", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('language_code', models.CharField(db_index=True, max_length=15, verbose_name='Language')), - ('header_html', models.FileField(upload_to='')), - ('footer_html', models.FileField(upload_to='')), - ('consent_text', models.TextField()), - ('master', parler.fields.TranslationsForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='programs.referrer')), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("language_code", models.CharField(db_index=True, max_length=15, verbose_name="Language")), + ("header_html", models.FileField(upload_to="")), + ("footer_html", models.FileField(upload_to="")), + ("consent_text", models.TextField()), + ( + "master", + parler.fields.TranslationsForeignKey( + editable=False, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="translations", + to="programs.referrer", + ), + ), ], options={ - 'verbose_name': 'referrer Translation', - 'db_table': 'programs_referrer_translation', - 'db_tablespace': '', - 'managed': True, - 'default_permissions': (), - 'unique_together': {('language_code', 'master')}, + "verbose_name": "referrer Translation", + "db_table": "programs_referrer_translation", + "db_tablespace": "", + "managed": True, + "default_permissions": (), + "unique_together": {("language_code", "master")}, }, bases=(parler.models.TranslatedFieldsModelMixin, models.Model), ), diff --git a/programs/migrations/0040_alter_referrer_logo_alter_referrer_white_label_css_and_more.py b/programs/migrations/0040_alter_referrer_logo_alter_referrer_white_label_css_and_more.py index 2994a8ab..2042297b 100644 --- a/programs/migrations/0040_alter_referrer_logo_alter_referrer_white_label_css_and_more.py +++ b/programs/migrations/0040_alter_referrer_logo_alter_referrer_white_label_css_and_more.py @@ -4,35 +4,34 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0039_webhookfunction_referrer_referrertranslation'), + ("programs", "0039_webhookfunction_referrer_referrertranslation"), ] operations = [ migrations.AlterField( - model_name='referrer', - name='logo', - field=models.ImageField(blank=True, null=True, upload_to=''), + model_name="referrer", + name="logo", + field=models.ImageField(blank=True, null=True, upload_to=""), ), migrations.AlterField( - model_name='referrer', - name='white_label_css', - field=models.FileField(blank=True, null=True, upload_to=''), + model_name="referrer", + name="white_label_css", + field=models.FileField(blank=True, null=True, upload_to=""), ), migrations.AlterField( - model_name='referrertranslation', - name='consent_text', + model_name="referrertranslation", + name="consent_text", field=models.TextField(blank=True, null=True), ), migrations.AlterField( - model_name='referrertranslation', - name='footer_html', - field=models.FileField(blank=True, null=True, upload_to=''), + model_name="referrertranslation", + name="footer_html", + field=models.FileField(blank=True, null=True, upload_to=""), ), migrations.AlterField( - model_name='referrertranslation', - name='header_html', - field=models.FileField(blank=True, null=True, upload_to=''), + model_name="referrertranslation", + name="header_html", + field=models.FileField(blank=True, null=True, upload_to=""), ), ] diff --git a/programs/migrations/0041_remove_referrer_logo_remove_referrer_white_label_css_and_more.py b/programs/migrations/0041_remove_referrer_logo_remove_referrer_white_label_css_and_more.py index 430d2054..5790c472 100644 --- a/programs/migrations/0041_remove_referrer_logo_remove_referrer_white_label_css_and_more.py +++ b/programs/migrations/0041_remove_referrer_logo_remove_referrer_white_label_css_and_more.py @@ -6,70 +6,115 @@ class Migration(migrations.Migration): dependencies = [ - ('translations', '0002_translation_active'), - ('programs', '0040_alter_referrer_logo_alter_referrer_white_label_css_and_more'), + ("translations", "0002_translation_active"), + ("programs", "0040_alter_referrer_logo_alter_referrer_white_label_css_and_more"), ] operations = [ migrations.RemoveField( - model_name='referrer', - name='logo', + model_name="referrer", + name="logo", ), migrations.RemoveField( - model_name='referrer', - name='white_label_css', + model_name="referrer", + name="white_label_css", ), migrations.AddField( - model_name='program', - name='active_1', + model_name="program", + name="active_1", field=models.BooleanField(blank=True, default=True, null=True), ), migrations.AddField( - model_name='program', - name='apply_button_link_1', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='apply_button_link', to='translations.translation'), + model_name="program", + name="apply_button_link_1", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="apply_button_link", + to="translations.translation", + ), ), migrations.AddField( - model_name='program', - name='category_1', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='category', to='translations.translation'), + model_name="program", + name="category_1", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="category", + to="translations.translation", + ), ), migrations.AddField( - model_name='program', - name='description_1', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='description', to='translations.translation'), + model_name="program", + name="description_1", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="description", + to="translations.translation", + ), ), migrations.AddField( - model_name='program', - name='description_short_1', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='description_short', to='translations.translation'), + model_name="program", + name="description_short_1", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="description_short", + to="translations.translation", + ), ), migrations.AddField( - model_name='program', - name='estimated_application_time_1', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='estimated_application_time', to='translations.translation'), + model_name="program", + name="estimated_application_time_1", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="estimated_application_time", + to="translations.translation", + ), ), migrations.AddField( - model_name='program', - name='estimated_delivery_time_1', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='estimated_delivery_time', to='translations.translation'), + model_name="program", + name="estimated_delivery_time_1", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="estimated_delivery_time", + to="translations.translation", + ), ), migrations.AddField( - model_name='program', - name='learn_more_link_1', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='learn_more_link', to='translations.translation'), + model_name="program", + name="learn_more_link_1", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="learn_more_link", + to="translations.translation", + ), ), migrations.AddField( - model_name='program', - name='name_1', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='name', to='translations.translation'), + model_name="program", + name="name_1", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="name", + to="translations.translation", + ), ), migrations.AddField( - model_name='program', - name='value_type_1', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='value_type', to='translations.translation'), + model_name="program", + name="value_type_1", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="value_type", + to="translations.translation", + ), ), migrations.DeleteModel( - name='ReferrerTranslation', + name="ReferrerTranslation", ), ] diff --git a/programs/migrations/0042_auto_20230905_1620.py b/programs/migrations/0042_auto_20230905_1620.py index c18ce108..30638b97 100644 --- a/programs/migrations/0042_auto_20230905_1620.py +++ b/programs/migrations/0042_auto_20230905_1620.py @@ -5,44 +5,44 @@ def migrate_translations(apps, schema_editor): - Program = apps.get_model('programs', 'Program') - Translation = apps.get_model('translations', 'Translation') + Program = apps.get_model("programs", "Program") + Translation = apps.get_model("translations", "Translation") translated_fields = ( - 'description_short', - 'name', - 'description', - 'learn_more_link', - 'apply_button_link', - 'value_type', - 'estimated_delivery_time', - 'estimated_application_time', - 'category', - ) - non_translated_fields = ( - 'active', - 'legal_status_required', - 'name_abbreviated' + "description_short", + "name", + "description", + "learn_more_link", + "apply_button_link", + "value_type", + "estimated_delivery_time", + "estimated_application_time", + "category", ) + non_translated_fields = ("active", "legal_status_required", "name_abbreviated") for program in Program.objects.all(): for field in translated_fields: - translation = Translation.objects.add_translation(f'program.{program.name_abbreviated}_{program.id}-{field}', getattr(program, field)) - setattr(program, field + '_1', translation) + translation = Translation.objects.add_translation( + f"program.{program.name_abbreviated}_{program.id}-{field}", getattr(program, field) + ) + setattr(program, field + "_1", translation) for lang in settings.PARLER_LANGUAGES[None]: - program.set_current_language(lang['code']) - Translation.objects.edit_translation(f'program.{program.name_abbreviated}_{program.id}-{field}', lang['code'], getattr(program, field), True) + program.set_current_language(lang["code"]) + Translation.objects.edit_translation( + f"program.{program.name_abbreviated}_{program.id}-{field}", + lang["code"], + getattr(program, field), + True, + ) for field in non_translated_fields: - setattr(program, field + '_1', getattr(program, field)) + setattr(program, field + "_1", getattr(program, field)) program.save() class Migration(migrations.Migration): - dependencies = [ - ('programs', '0041_remove_referrer_logo_remove_referrer_white_label_css_and_more'), - ('translations', '0003_alter_translation_managers'), + ("programs", "0041_remove_referrer_logo_remove_referrer_white_label_css_and_more"), + ("translations", "0003_alter_translation_managers"), ] - operations = [ - migrations.RunPython(migrate_translations) - ] + operations = [migrations.RunPython(migrate_translations)] diff --git a/programs/migrations/0043_auto_20230906_0938.py b/programs/migrations/0043_auto_20230906_0938.py index 9360c94f..7d90d3d9 100644 --- a/programs/migrations/0043_auto_20230906_0938.py +++ b/programs/migrations/0043_auto_20230906_0938.py @@ -4,34 +4,31 @@ def connect_translations(apps, schema_editor): - Program = apps.get_model('programs', 'Program') - Translation = apps.get_model('translations', 'Translation') + Program = apps.get_model("programs", "Program") + Translation = apps.get_model("translations", "Translation") translated_fields = ( - 'description_short', - 'name', - 'description', - 'learn_more_link', - 'apply_button_link', - 'value_type', - 'estimated_delivery_time', - 'estimated_application_time', - 'category', + "description_short", + "name", + "description", + "learn_more_link", + "apply_button_link", + "value_type", + "estimated_delivery_time", + "estimated_application_time", + "category", ) for program in Program.objects.all(): for field in translated_fields: - translation = Translation.objects.get(label=f'program.{program.name_abbreviated}_{program.id}-{field}') - setattr(program, field + '_1', translation) + translation = Translation.objects.get(label=f"program.{program.name_abbreviated}_{program.id}-{field}") + setattr(program, field + "_1", translation) program.save() class Migration(migrations.Migration): - dependencies = [ - ('programs', '0042_auto_20230905_1620'), - ('translations', '0003_alter_translation_managers'), + ("programs", "0042_auto_20230905_1620"), + ("translations", "0003_alter_translation_managers"), ] - operations = [ - migrations.RunPython(connect_translations) - ] + operations = [migrations.RunPython(connect_translations)] diff --git a/programs/migrations/0044_program_legal_status_required_1_and_more.py b/programs/migrations/0044_program_legal_status_required_1_and_more.py index 962a0610..2a6dfc61 100644 --- a/programs/migrations/0044_program_legal_status_required_1_and_more.py +++ b/programs/migrations/0044_program_legal_status_required_1_and_more.py @@ -4,20 +4,19 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0043_auto_20230906_0938'), + ("programs", "0043_auto_20230906_0938"), ] operations = [ migrations.AddField( - model_name='program', - name='legal_status_required_1', + model_name="program", + name="legal_status_required_1", field=models.CharField(max_length=120, null=True), ), migrations.AddField( - model_name='program', - name='name_abbreviated_1', + model_name="program", + name="name_abbreviated_1", field=models.CharField(max_length=120, null=True), ), ] diff --git a/programs/migrations/0045_auto_20230906_0951.py b/programs/migrations/0045_auto_20230906_0951.py index 8fe3bc9a..7b670181 100644 --- a/programs/migrations/0045_auto_20230906_0951.py +++ b/programs/migrations/0045_auto_20230906_0951.py @@ -4,25 +4,18 @@ def other_data_migrations(apps, _): - Program = apps.get_model('programs', 'Program') + Program = apps.get_model("programs", "Program") - non_translated_fields = ( - 'active', - 'legal_status_required', - 'name_abbreviated' - ) + non_translated_fields = ("active", "legal_status_required", "name_abbreviated") for program in Program.objects.all(): for field in non_translated_fields: - setattr(program, field + '_1', getattr(program, field)) + setattr(program, field + "_1", getattr(program, field)) program.save() class Migration(migrations.Migration): - dependencies = [ - ('programs', '0044_program_legal_status_required_1_and_more'), + ("programs", "0044_program_legal_status_required_1_and_more"), ] - operations = [ - migrations.RunPython(other_data_migrations) - ] + operations = [migrations.RunPython(other_data_migrations)] diff --git a/programs/migrations/0046_delete_programtranslation.py b/programs/migrations/0046_delete_programtranslation.py index 7b925bd8..d72732d6 100644 --- a/programs/migrations/0046_delete_programtranslation.py +++ b/programs/migrations/0046_delete_programtranslation.py @@ -4,13 +4,12 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0045_auto_20230906_0951'), + ("programs", "0045_auto_20230906_0951"), ] operations = [ migrations.DeleteModel( - name='ProgramTranslation', + name="ProgramTranslation", ), ] diff --git a/programs/migrations/0047_alter_program_active_1_and_more.py b/programs/migrations/0047_alter_program_active_1_and_more.py index 2fc46273..c1312984 100644 --- a/programs/migrations/0047_alter_program_active_1_and_more.py +++ b/programs/migrations/0047_alter_program_active_1_and_more.py @@ -5,71 +5,98 @@ class Migration(migrations.Migration): - dependencies = [ - ('translations', '0003_alter_translation_managers'), - ('programs', '0046_delete_programtranslation'), + ("translations", "0003_alter_translation_managers"), + ("programs", "0046_delete_programtranslation"), ] operations = [ migrations.AlterField( - model_name='program', - name='active_1', + model_name="program", + name="active_1", field=models.BooleanField(blank=True, default=True), ), migrations.AlterField( - model_name='program', - name='apply_button_link_1', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='apply_button_link', to='translations.translation'), + model_name="program", + name="apply_button_link_1", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="apply_button_link", + to="translations.translation", + ), ), migrations.AlterField( - model_name='program', - name='category_1', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='category', to='translations.translation'), + model_name="program", + name="category_1", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, related_name="category", to="translations.translation" + ), ), migrations.AlterField( - model_name='program', - name='description_1', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='description', to='translations.translation'), + model_name="program", + name="description_1", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, related_name="description", to="translations.translation" + ), ), migrations.AlterField( - model_name='program', - name='description_short_1', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='description_short', to='translations.translation'), + model_name="program", + name="description_short_1", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="description_short", + to="translations.translation", + ), ), migrations.AlterField( - model_name='program', - name='estimated_application_time_1', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='estimated_application_time', to='translations.translation'), + model_name="program", + name="estimated_application_time_1", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="estimated_application_time", + to="translations.translation", + ), ), migrations.AlterField( - model_name='program', - name='estimated_delivery_time_1', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='estimated_delivery_time', to='translations.translation'), + model_name="program", + name="estimated_delivery_time_1", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="estimated_delivery_time", + to="translations.translation", + ), ), migrations.AlterField( - model_name='program', - name='learn_more_link_1', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='learn_more_link', to='translations.translation'), + model_name="program", + name="learn_more_link_1", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="learn_more_link", + to="translations.translation", + ), ), migrations.AlterField( - model_name='program', - name='legal_status_required_1', + model_name="program", + name="legal_status_required_1", field=models.CharField(max_length=120), ), migrations.AlterField( - model_name='program', - name='name_1', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='name', to='translations.translation'), + model_name="program", + name="name_1", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, related_name="name", to="translations.translation" + ), ), migrations.AlterField( - model_name='program', - name='name_abbreviated_1', + model_name="program", + name="name_abbreviated_1", field=models.CharField(max_length=120), ), migrations.AlterField( - model_name='program', - name='value_type_1', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='value_type', to='translations.translation'), + model_name="program", + name="value_type_1", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, related_name="value_type", to="translations.translation" + ), ), ] diff --git a/programs/migrations/0048_rename_active_1_program_active_and_more.py b/programs/migrations/0048_rename_active_1_program_active_and_more.py index 7bec3c84..fd66ea2b 100644 --- a/programs/migrations/0048_rename_active_1_program_active_and_more.py +++ b/programs/migrations/0048_rename_active_1_program_active_and_more.py @@ -4,70 +4,69 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0047_alter_program_active_1_and_more'), + ("programs", "0047_alter_program_active_1_and_more"), ] operations = [ migrations.RenameField( - model_name='program', - old_name='active_1', - new_name='active', + model_name="program", + old_name="active_1", + new_name="active", ), migrations.RenameField( - model_name='program', - old_name='apply_button_link_1', - new_name='apply_button_link', + model_name="program", + old_name="apply_button_link_1", + new_name="apply_button_link", ), migrations.RenameField( - model_name='program', - old_name='category_1', - new_name='category', + model_name="program", + old_name="category_1", + new_name="category", ), migrations.RenameField( - model_name='program', - old_name='description_1', - new_name='description', + model_name="program", + old_name="description_1", + new_name="description", ), migrations.RenameField( - model_name='program', - old_name='description_short_1', - new_name='description_short', + model_name="program", + old_name="description_short_1", + new_name="description_short", ), migrations.RenameField( - model_name='program', - old_name='estimated_application_time_1', - new_name='estimated_application_time', + model_name="program", + old_name="estimated_application_time_1", + new_name="estimated_application_time", ), migrations.RenameField( - model_name='program', - old_name='estimated_delivery_time_1', - new_name='estimated_delivery_time', + model_name="program", + old_name="estimated_delivery_time_1", + new_name="estimated_delivery_time", ), migrations.RenameField( - model_name='program', - old_name='learn_more_link_1', - new_name='learn_more_link', + model_name="program", + old_name="learn_more_link_1", + new_name="learn_more_link", ), migrations.RenameField( - model_name='program', - old_name='legal_status_required_1', - new_name='legal_status_required', + model_name="program", + old_name="legal_status_required_1", + new_name="legal_status_required", ), migrations.RenameField( - model_name='program', - old_name='name_1', - new_name='name', + model_name="program", + old_name="name_1", + new_name="name", ), migrations.RenameField( - model_name='program', - old_name='name_abbreviated_1', - new_name='name_abbreviated', + model_name="program", + old_name="name_abbreviated_1", + new_name="name_abbreviated", ), migrations.RenameField( - model_name='program', - old_name='value_type_1', - new_name='value_type', + model_name="program", + old_name="value_type_1", + new_name="value_type", ), ] diff --git a/programs/migrations/0049_navigator_assistance_link_1_navigator_description_1_and_more.py b/programs/migrations/0049_navigator_assistance_link_1_navigator_description_1_and_more.py index 206e9e9d..c6550838 100644 --- a/programs/migrations/0049_navigator_assistance_link_1_navigator_description_1_and_more.py +++ b/programs/migrations/0049_navigator_assistance_link_1_navigator_description_1_and_more.py @@ -5,96 +5,177 @@ class Migration(migrations.Migration): - dependencies = [ - ('translations', '0003_alter_translation_managers'), - ('programs', '0048_rename_active_1_program_active_and_more'), + ("translations", "0003_alter_translation_managers"), + ("programs", "0048_rename_active_1_program_active_and_more"), ] operations = [ migrations.AddField( - model_name='navigator', - name='assistance_link_1', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='navigator_assistance_link', to='translations.translation'), + model_name="navigator", + name="assistance_link_1", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="navigator_assistance_link", + to="translations.translation", + ), ), migrations.AddField( - model_name='navigator', - name='description_1', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='navigator_name_description', to='translations.translation'), + model_name="navigator", + name="description_1", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="navigator_name_description", + to="translations.translation", + ), ), migrations.AddField( - model_name='navigator', - name='email_1', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='navigator_email', to='translations.translation'), + model_name="navigator", + name="email_1", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="navigator_email", + to="translations.translation", + ), ), migrations.AddField( - model_name='navigator', - name='name_1', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='navigator_name', to='translations.translation'), + model_name="navigator", + name="name_1", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="navigator_name", + to="translations.translation", + ), ), migrations.AddField( - model_name='urgentneed', - name='description_1', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='urgent_need_description', to='translations.translation'), + model_name="urgentneed", + name="description_1", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="urgent_need_description", + to="translations.translation", + ), ), migrations.AddField( - model_name='urgentneed', - name='link_1', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='urgent_need_link', to='translations.translation'), + model_name="urgentneed", + name="link_1", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="urgent_need_link", + to="translations.translation", + ), ), migrations.AddField( - model_name='urgentneed', - name='name_1', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='urgent_need_name', to='translations.translation'), + model_name="urgentneed", + name="name_1", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="urgent_need_name", + to="translations.translation", + ), ), migrations.AddField( - model_name='urgentneed', - name='type_1', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='urgent_need_type', to='translations.translation'), + model_name="urgentneed", + name="type_1", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="urgent_need_type", + to="translations.translation", + ), ), migrations.AlterField( - model_name='program', - name='apply_button_link', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='program_apply_button_link', to='translations.translation'), + model_name="program", + name="apply_button_link", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="program_apply_button_link", + to="translations.translation", + ), ), migrations.AlterField( - model_name='program', - name='category', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='program_category', to='translations.translation'), + model_name="program", + name="category", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="program_category", + to="translations.translation", + ), ), migrations.AlterField( - model_name='program', - name='description', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='program_description', to='translations.translation'), + model_name="program", + name="description", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="program_description", + to="translations.translation", + ), ), migrations.AlterField( - model_name='program', - name='description_short', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='program_description_short', to='translations.translation'), + model_name="program", + name="description_short", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="program_description_short", + to="translations.translation", + ), ), migrations.AlterField( - model_name='program', - name='estimated_application_time', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='program_estimated_application_time', to='translations.translation'), + model_name="program", + name="estimated_application_time", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="program_estimated_application_time", + to="translations.translation", + ), ), migrations.AlterField( - model_name='program', - name='estimated_delivery_time', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='program_estimated_delivery_time', to='translations.translation'), + model_name="program", + name="estimated_delivery_time", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="program_estimated_delivery_time", + to="translations.translation", + ), ), migrations.AlterField( - model_name='program', - name='learn_more_link', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='program_learn_more_link', to='translations.translation'), + model_name="program", + name="learn_more_link", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="program_learn_more_link", + to="translations.translation", + ), ), migrations.AlterField( - model_name='program', - name='name', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='program_name', to='translations.translation'), + model_name="program", + name="name", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, related_name="program_name", to="translations.translation" + ), ), migrations.AlterField( - model_name='program', - name='value_type', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='program_value_type', to='translations.translation'), + model_name="program", + name="value_type", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="program_value_type", + to="translations.translation", + ), ), ] diff --git a/programs/migrations/0050_auto_20230906_1427.py b/programs/migrations/0050_auto_20230906_1427.py index 6a7e0494..f753e67e 100644 --- a/programs/migrations/0050_auto_20230906_1427.py +++ b/programs/migrations/0050_auto_20230906_1427.py @@ -5,52 +5,59 @@ def urgent_need_migrations(apps, _): - UrgentNeed = apps.get_model('programs', 'UrgentNeed') - Translation = apps.get_model('translations', 'Translation') + UrgentNeed = apps.get_model("programs", "UrgentNeed") + Translation = apps.get_model("translations", "Translation") translated_fields = ( - 'name', - 'description', - 'link', - 'type', + "name", + "description", + "link", + "type", ) for urgent_need in UrgentNeed.objects.all(): main_name = urgent_need.name for field in translated_fields: - translation = Translation.objects.add_translation(f'urgent_need.{main_name}_{urgent_need.id}-{field}', getattr(urgent_need, field)) - setattr(urgent_need, field + '_1', translation) + translation = Translation.objects.add_translation( + f"urgent_need.{main_name}_{urgent_need.id}-{field}", getattr(urgent_need, field) + ) + setattr(urgent_need, field + "_1", translation) for lang in settings.PARLER_LANGUAGES[None]: - urgent_need.set_current_language(lang['code']) - Translation.objects.edit_translation(f'urgent_need.{main_name}_{urgent_need.id}-{field}', lang['code'], getattr(urgent_need, field), True) + urgent_need.set_current_language(lang["code"]) + Translation.objects.edit_translation( + f"urgent_need.{main_name}_{urgent_need.id}-{field}", lang["code"], getattr(urgent_need, field), True + ) urgent_need.save() def navigator_migrations(apps, _): - Navigator = apps.get_model('programs', 'Navigator') - Translation = apps.get_model('translations', 'Translation') + Navigator = apps.get_model("programs", "Navigator") + Translation = apps.get_model("translations", "Translation") translated_fields = ( - 'name', - 'email', - 'assistance_link', - 'description', + "name", + "email", + "assistance_link", + "description", ) for navigator in Navigator.objects.all(): main_name = navigator.name for field in translated_fields: - translation = Translation.objects.add_translation(f'navigator.{main_name}_{navigator.id}-{field}', getattr(navigator, field)) - setattr(navigator, field + '_1', translation) + translation = Translation.objects.add_translation( + f"navigator.{main_name}_{navigator.id}-{field}", getattr(navigator, field) + ) + setattr(navigator, field + "_1", translation) for lang in settings.PARLER_LANGUAGES[None]: - navigator.set_current_language(lang['code']) - Translation.objects.edit_translation(f'navigator.{main_name}_{navigator.id}-{field}', lang['code'], getattr(navigator, field), True) + navigator.set_current_language(lang["code"]) + Translation.objects.edit_translation( + f"navigator.{main_name}_{navigator.id}-{field}", lang["code"], getattr(navigator, field), True + ) navigator.save() class Migration(migrations.Migration): - dependencies = [ - ('programs', '0049_navigator_assistance_link_1_navigator_description_1_and_more'), - ('translations', '0003_alter_translation_managers'), + ("programs", "0049_navigator_assistance_link_1_navigator_description_1_and_more"), + ("translations", "0003_alter_translation_managers"), ] operations = [ diff --git a/programs/migrations/0051_alter_urgentneedtranslation_unique_together_and_more.py b/programs/migrations/0051_alter_urgentneedtranslation_unique_together_and_more.py index c00907f1..bc62b8c7 100644 --- a/programs/migrations/0051_alter_urgentneedtranslation_unique_together_and_more.py +++ b/programs/migrations/0051_alter_urgentneedtranslation_unique_together_and_more.py @@ -4,24 +4,23 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0050_auto_20230906_1427'), + ("programs", "0050_auto_20230906_1427"), ] operations = [ migrations.AlterUniqueTogether( - name='urgentneedtranslation', + name="urgentneedtranslation", unique_together=None, ), migrations.RemoveField( - model_name='urgentneedtranslation', - name='master', + model_name="urgentneedtranslation", + name="master", ), migrations.DeleteModel( - name='NavigatorTranslation', + name="NavigatorTranslation", ), migrations.DeleteModel( - name='UrgentNeedTranslation', + name="UrgentNeedTranslation", ), ] diff --git a/programs/migrations/0052_alter_navigator_assistance_link_1_and_more.py b/programs/migrations/0052_alter_navigator_assistance_link_1_and_more.py index 865c43c9..73e8c3ee 100644 --- a/programs/migrations/0052_alter_navigator_assistance_link_1_and_more.py +++ b/programs/migrations/0052_alter_navigator_assistance_link_1_and_more.py @@ -5,51 +5,82 @@ class Migration(migrations.Migration): - dependencies = [ - ('translations', '0003_alter_translation_managers'), - ('programs', '0051_alter_urgentneedtranslation_unique_together_and_more'), + ("translations", "0003_alter_translation_managers"), + ("programs", "0051_alter_urgentneedtranslation_unique_together_and_more"), ] operations = [ migrations.AlterField( - model_name='navigator', - name='assistance_link_1', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='navigator_assistance_link', to='translations.translation'), + model_name="navigator", + name="assistance_link_1", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="navigator_assistance_link", + to="translations.translation", + ), ), migrations.AlterField( - model_name='navigator', - name='description_1', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='navigator_name_description', to='translations.translation'), + model_name="navigator", + name="description_1", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="navigator_name_description", + to="translations.translation", + ), ), migrations.AlterField( - model_name='navigator', - name='email_1', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='navigator_email', to='translations.translation'), + model_name="navigator", + name="email_1", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="navigator_email", + to="translations.translation", + ), ), migrations.AlterField( - model_name='navigator', - name='name_1', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='navigator_name', to='translations.translation'), + model_name="navigator", + name="name_1", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="navigator_name", + to="translations.translation", + ), ), migrations.AlterField( - model_name='urgentneed', - name='description_1', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='urgent_need_description', to='translations.translation'), + model_name="urgentneed", + name="description_1", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="urgent_need_description", + to="translations.translation", + ), ), migrations.AlterField( - model_name='urgentneed', - name='link_1', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='urgent_need_link', to='translations.translation'), + model_name="urgentneed", + name="link_1", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="urgent_need_link", + to="translations.translation", + ), ), migrations.AlterField( - model_name='urgentneed', - name='name_1', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='urgent_need_name', to='translations.translation'), + model_name="urgentneed", + name="name_1", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="urgent_need_name", + to="translations.translation", + ), ), migrations.AlterField( - model_name='urgentneed', - name='type_1', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='urgent_need_type', to='translations.translation'), + model_name="urgentneed", + name="type_1", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + related_name="urgent_need_type", + to="translations.translation", + ), ), ] diff --git a/programs/migrations/0053_rename_assistance_link_1_navigator_assistance_link_and_more.py b/programs/migrations/0053_rename_assistance_link_1_navigator_assistance_link_and_more.py index cb2bd7bc..3595687a 100644 --- a/programs/migrations/0053_rename_assistance_link_1_navigator_assistance_link_and_more.py +++ b/programs/migrations/0053_rename_assistance_link_1_navigator_assistance_link_and_more.py @@ -4,50 +4,49 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0052_alter_navigator_assistance_link_1_and_more'), + ("programs", "0052_alter_navigator_assistance_link_1_and_more"), ] operations = [ migrations.RenameField( - model_name='navigator', - old_name='assistance_link_1', - new_name='assistance_link', + model_name="navigator", + old_name="assistance_link_1", + new_name="assistance_link", ), migrations.RenameField( - model_name='navigator', - old_name='description_1', - new_name='description', + model_name="navigator", + old_name="description_1", + new_name="description", ), migrations.RenameField( - model_name='navigator', - old_name='email_1', - new_name='email', + model_name="navigator", + old_name="email_1", + new_name="email", ), migrations.RenameField( - model_name='navigator', - old_name='name_1', - new_name='name', + model_name="navigator", + old_name="name_1", + new_name="name", ), migrations.RenameField( - model_name='urgentneed', - old_name='description_1', - new_name='description', + model_name="urgentneed", + old_name="description_1", + new_name="description", ), migrations.RenameField( - model_name='urgentneed', - old_name='link_1', - new_name='link', + model_name="urgentneed", + old_name="link_1", + new_name="link", ), migrations.RenameField( - model_name='urgentneed', - old_name='name_1', - new_name='name', + model_name="urgentneed", + old_name="name_1", + new_name="name", ), migrations.RenameField( - model_name='urgentneed', - old_name='type_1', - new_name='type', + model_name="urgentneed", + old_name="type_1", + new_name="type", ), ] diff --git a/programs/migrations/0054_navigator_external_name_program_external_name_and_more.py b/programs/migrations/0054_navigator_external_name_program_external_name_and_more.py index a76fd8d9..2900d027 100644 --- a/programs/migrations/0054_navigator_external_name_program_external_name_and_more.py +++ b/programs/migrations/0054_navigator_external_name_program_external_name_and_more.py @@ -4,25 +4,24 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0053_rename_assistance_link_1_navigator_assistance_link_and_more'), + ("programs", "0053_rename_assistance_link_1_navigator_assistance_link_and_more"), ] operations = [ migrations.AddField( - model_name='navigator', - name='external_name', + model_name="navigator", + name="external_name", field=models.CharField(max_length=120, null=True, unique=True), ), migrations.AddField( - model_name='program', - name='external_name', + model_name="program", + name="external_name", field=models.CharField(max_length=120, null=True, unique=True), ), migrations.AddField( - model_name='urgentneed', - name='external_name', + model_name="urgentneed", + name="external_name", field=models.CharField(max_length=120, null=True, unique=True), ), ] diff --git a/programs/migrations/0055_alter_navigator_external_name_and_more.py b/programs/migrations/0055_alter_navigator_external_name_and_more.py index 941c9468..56bc4415 100644 --- a/programs/migrations/0055_alter_navigator_external_name_and_more.py +++ b/programs/migrations/0055_alter_navigator_external_name_and_more.py @@ -4,25 +4,24 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0054_navigator_external_name_program_external_name_and_more'), + ("programs", "0054_navigator_external_name_program_external_name_and_more"), ] operations = [ migrations.AlterField( - model_name='navigator', - name='external_name', + model_name="navigator", + name="external_name", field=models.CharField(blank=True, max_length=120, null=True, unique=True), ), migrations.AlterField( - model_name='program', - name='external_name', + model_name="program", + name="external_name", field=models.CharField(blank=True, max_length=120, null=True, unique=True), ), migrations.AlterField( - model_name='urgentneed', - name='external_name', + model_name="urgentneed", + name="external_name", field=models.CharField(blank=True, max_length=120, null=True, unique=True), ), ] diff --git a/programs/migrations/0056_urgentneedcategory_remove_urgentneed_type_short_and_more.py b/programs/migrations/0056_urgentneedcategory_remove_urgentneed_type_short_and_more.py index 9f7f540b..79f7af3d 100644 --- a/programs/migrations/0056_urgentneedcategory_remove_urgentneed_type_short_and_more.py +++ b/programs/migrations/0056_urgentneedcategory_remove_urgentneed_type_short_and_more.py @@ -4,26 +4,25 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0055_alter_navigator_external_name_and_more'), + ("programs", "0055_alter_navigator_external_name_and_more"), ] operations = [ migrations.CreateModel( - name='UrgentNeedCategory', + name="UrgentNeedCategory", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=120)), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("name", models.CharField(max_length=120)), ], ), migrations.RemoveField( - model_name='urgentneed', - name='type_short', + model_name="urgentneed", + name="type_short", ), migrations.AddField( - model_name='urgentneed', - name='type_short', - field=models.ManyToManyField(related_name='type_short', to='programs.urgentneedcategory'), + model_name="urgentneed", + name="type_short", + field=models.ManyToManyField(related_name="type_short", to="programs.urgentneedcategory"), ), ] diff --git a/programs/migrations/0057_alter_urgentneedcategory_options_and_more.py b/programs/migrations/0057_alter_urgentneedcategory_options_and_more.py index ce202af1..5dc54ad4 100644 --- a/programs/migrations/0057_alter_urgentneedcategory_options_and_more.py +++ b/programs/migrations/0057_alter_urgentneedcategory_options_and_more.py @@ -5,31 +5,39 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0056_urgentneedcategory_remove_urgentneed_type_short_and_more'), + ("programs", "0056_urgentneedcategory_remove_urgentneed_type_short_and_more"), ] operations = [ migrations.AlterModelOptions( - name='urgentneedcategory', - options={'verbose_name_plural': 'Urgent Need Categories'}, + name="urgentneedcategory", + options={"verbose_name_plural": "Urgent Need Categories"}, ), migrations.RemoveField( - model_name='program', - name='legal_status_required', + model_name="program", + name="legal_status_required", ), migrations.AlterField( - model_name='urgentneed', - name='type_short', - field=models.ManyToManyField(related_name='urgent_needs', to='programs.urgentneedcategory'), + model_name="urgentneed", + name="type_short", + field=models.ManyToManyField(related_name="urgent_needs", to="programs.urgentneedcategory"), ), migrations.CreateModel( - name='LegalStatus', + name="LegalStatus", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('status', models.CharField(max_length=256)), - ('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='children', to='programs.legalstatus')), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("status", models.CharField(max_length=256)), + ( + "parent", + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name="children", + to="programs.legalstatus", + ), + ), ], ), ] diff --git a/programs/migrations/0058_program_legal_status_required.py b/programs/migrations/0058_program_legal_status_required.py index 16b01d6b..5653cdbb 100644 --- a/programs/migrations/0058_program_legal_status_required.py +++ b/programs/migrations/0058_program_legal_status_required.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0057_alter_urgentneedcategory_options_and_more'), + ("programs", "0057_alter_urgentneedcategory_options_and_more"), ] operations = [ migrations.AddField( - model_name='program', - name='legal_status_required', - field=models.ManyToManyField(related_name='programs', to='programs.legalstatus'), + model_name="program", + name="legal_status_required", + field=models.ManyToManyField(related_name="programs", to="programs.legalstatus"), ), ] diff --git a/programs/migrations/0059_alter_program_legal_status_required.py b/programs/migrations/0059_alter_program_legal_status_required.py index 7513d4f5..81f1e4e1 100644 --- a/programs/migrations/0059_alter_program_legal_status_required.py +++ b/programs/migrations/0059_alter_program_legal_status_required.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('programs', '0058_program_legal_status_required'), + ("programs", "0058_program_legal_status_required"), ] operations = [ migrations.AlterField( - model_name='program', - name='legal_status_required', - field=models.ManyToManyField(blank=True, related_name='programs', to='programs.legalstatus'), + model_name="program", + name="legal_status_required", + field=models.ManyToManyField(blank=True, related_name="programs", to="programs.legalstatus"), ), ] diff --git a/programs/migrations/0060_alter_navigator_program.py b/programs/migrations/0060_alter_navigator_program.py index bf16d611..d2790a19 100644 --- a/programs/migrations/0060_alter_navigator_program.py +++ b/programs/migrations/0060_alter_navigator_program.py @@ -12,8 +12,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name="navigator", name="program", - field=models.ManyToManyField( - blank=True, related_name="navigator", to="programs.program" - ), + field=models.ManyToManyField(blank=True, related_name="navigator", to="programs.program"), ), ] diff --git a/programs/migrations/0061_referrer_remove_programs.py b/programs/migrations/0061_referrer_remove_programs.py index fd76f695..8fd80118 100644 --- a/programs/migrations/0061_referrer_remove_programs.py +++ b/programs/migrations/0061_referrer_remove_programs.py @@ -12,8 +12,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name="referrer", name="remove_programs", - field=models.ManyToManyField( - blank=True, related_name="removed_programs", to="programs.program" - ), + field=models.ManyToManyField(blank=True, related_name="removed_programs", to="programs.program"), ), ] diff --git a/programs/migrations/0062_document_program_documents.py b/programs/migrations/0062_document_program_documents.py index f62a9659..217a5457 100644 --- a/programs/migrations/0062_document_program_documents.py +++ b/programs/migrations/0062_document_program_documents.py @@ -37,8 +37,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name="program", name="documents", - field=models.ManyToManyField( - blank=True, related_name="program_documents", to="programs.document" - ), + field=models.ManyToManyField(blank=True, related_name="program_documents", to="programs.document"), ), ] diff --git a/programs/migrations/0062_navigatorcounties_navigator_counties.py b/programs/migrations/0062_navigatorcounties_navigator_counties.py index b0212add..df2da244 100644 --- a/programs/migrations/0062_navigatorcounties_navigator_counties.py +++ b/programs/migrations/0062_navigatorcounties_navigator_counties.py @@ -27,8 +27,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name="navigator", name="counties", - field=models.ManyToManyField( - blank=True, related_name="navigator", to="programs.navigatorcounties" - ), + field=models.ManyToManyField(blank=True, related_name="navigator", to="programs.navigatorcounties"), ), ] diff --git a/programs/migrations/0063_navigatorcounty_delete_navigatorcounties_and_more.py b/programs/migrations/0063_navigatorcounty_delete_navigatorcounties_and_more.py index dcf1a554..1f146ef6 100644 --- a/programs/migrations/0063_navigatorcounty_delete_navigatorcounties_and_more.py +++ b/programs/migrations/0063_navigatorcounty_delete_navigatorcounties_and_more.py @@ -30,8 +30,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name="navigator", name="counties", - field=models.ManyToManyField( - blank=True, related_name="navigator", to="programs.navigatorcounty" - ), + field=models.ManyToManyField(blank=True, related_name="navigator", to="programs.navigatorcounty"), ), ] diff --git a/programs/migrations/0066_auto_20240130_1146.py b/programs/migrations/0066_auto_20240130_1146.py index fde4ea86..7ff778d7 100644 --- a/programs/migrations/0066_auto_20240130_1146.py +++ b/programs/migrations/0066_auto_20240130_1146.py @@ -4,19 +4,17 @@ def add_warning(apps, schema_editor): - Program = apps.get_model('programs', 'Program') - UrgentNeed = apps.get_model('programs', 'UrgentNeed') - Translation = apps.get_model('translations', 'Translation') + Program = apps.get_model("programs", "Program") + UrgentNeed = apps.get_model("programs", "UrgentNeed") + Translation = apps.get_model("translations", "Translation") for need in UrgentNeed.objects.all(): - translation = Translation.objects.add_translation( - f'urgent_need.{need.name.text}-{need.id}_warning', '' - ) + translation = Translation.objects.add_translation(f"urgent_need.{need.name.text}-{need.id}_warning", "") UrgentNeed.objects.filter(pk=need.id).update(warning=translation.id) for program in Program.objects.all(): translation = Translation.objects.add_translation( - f'programs.{program.name_abbreviated}-{program.id}_warning', '' + f"programs.{program.name_abbreviated}-{program.id}_warning", "" ) Program.objects.filter(pk=program.id).update(warning=translation.id) diff --git a/programs/migrations/0070_auto_20240506_1817.py b/programs/migrations/0070_auto_20240506_1817.py index de348500..f292b117 100644 --- a/programs/migrations/0070_auto_20240506_1817.py +++ b/programs/migrations/0070_auto_20240506_1817.py @@ -3,12 +3,12 @@ def add_estimated_value(apps, schema_editor): - Program = apps.get_model('programs', 'Program') - Translation = apps.get_model('translations', 'Translation') + Program = apps.get_model("programs", "Program") + Translation = apps.get_model("translations", "Translation") for program in Program.objects.all(): translation = Translation.objects.add_translation( - f'programs.{program.name_abbreviated}-{program.id}_estimated_value', '' + f"programs.{program.name_abbreviated}-{program.id}_estimated_value", "" ) Program.objects.filter(pk=program.id).update(estimated_value=translation.id) diff --git a/programs/models.py b/programs/models.py index ed553084..4e2a9c3c 100644 --- a/programs/models.py +++ b/programs/models.py @@ -34,8 +34,7 @@ def __str__(self): class LegalStatus(models.Model): status = models.CharField(max_length=256) - parent = models.ForeignKey( - "self", related_name="children", blank=True, null=True, on_delete=models.SET_NULL) + parent = models.ForeignKey("self", related_name="children", blank=True, null=True, on_delete=models.SET_NULL) def __str__(self): return self.status @@ -45,8 +44,7 @@ class DocumentManager(models.Manager): translated_fields = ("text",) def new_document(self, external_name): - translation = Translation.objects.add_translation( - f"document.{external_name}_temporary_key") + translation = Translation.objects.add_translation(f"document.{external_name}_temporary_key") document = self.create(external_name=external_name, text=translation) @@ -57,10 +55,8 @@ def new_document(self, external_name): class Document(models.Model): - external_name = models.CharField( - max_length=120, blank=True, null=True, unique=True) - text = models.ForeignKey(Translation, related_name="documents", - blank=False, null=False, on_delete=models.PROTECT) + external_name = models.CharField(max_length=120, blank=True, null=True, unique=True) + text = models.ForeignKey(Translation, related_name="documents", blank=False, null=False, on_delete=models.PROTECT) objects = DocumentManager() @@ -92,8 +88,7 @@ def new_program(self, name_abbreviated): ) # try to set the external_name to the name_abbreviated - external_name_exists = self.filter( - external_name=name_abbreviated).count() > 0 + external_name_exists = self.filter(external_name=name_abbreviated).count() > 0 program = self.create( name_abbreviated=name_abbreviated, @@ -116,16 +111,12 @@ def new_program(self, name_abbreviated): # logic for eligibility and value is stored. class Program(models.Model): name_abbreviated = models.CharField(max_length=120) - external_name = models.CharField( - max_length=120, blank=True, null=True, unique=True) - legal_status_required = models.ManyToManyField( - LegalStatus, related_name="programs", blank=True) - documents = models.ManyToManyField( - Document, related_name="program_documents", blank=True) + external_name = models.CharField(max_length=120, blank=True, null=True, unique=True) + legal_status_required = models.ManyToManyField(LegalStatus, related_name="programs", blank=True) + documents = models.ManyToManyField(Document, related_name="program_documents", blank=True) active = models.BooleanField(blank=True, default=True) low_confidence = models.BooleanField(blank=True, null=False, default=False) - fpl = models.ForeignKey(FederalPoveryLimit, related_name="fpl", - blank=True, null=True, on_delete=models.SET_NULL) + fpl = models.ForeignKey(FederalPoveryLimit, related_name="fpl", blank=True, null=True, on_delete=models.SET_NULL) description_short = models.ForeignKey( Translation, related_name="program_description_short", blank=False, null=False, on_delete=models.PROTECT @@ -241,8 +232,7 @@ class UrgentNeedManager(models.Manager): def new_urgent_need(self, name, phone_number): translations = {} for field in self.translated_fields: - translations[field] = Translation.objects.add_translation( - f"urgent_need.{name}_temporary_key-{field}") + translations[field] = Translation.objects.add_translation(f"urgent_need.{name}_temporary_key-{field}") # try to set the external_name to the name external_name_exists = self.filter(external_name=name).count() > 0 @@ -263,15 +253,12 @@ def new_urgent_need(self, name, phone_number): class UrgentNeed(models.Model): - external_name = models.CharField( - max_length=120, blank=True, null=True, unique=True) + external_name = models.CharField(max_length=120, blank=True, null=True, unique=True) phone_number = PhoneNumberField(blank=True, null=True) - type_short = models.ManyToManyField( - UrgentNeedCategory, related_name="urgent_needs") + type_short = models.ManyToManyField(UrgentNeedCategory, related_name="urgent_needs") active = models.BooleanField(blank=True, null=False, default=True) low_confidence = models.BooleanField(blank=True, null=False, default=False) - functions = models.ManyToManyField( - UrgentNeedFunction, related_name="function", blank=True) + functions = models.ManyToManyField(UrgentNeedFunction, related_name="function", blank=True) name = models.ForeignKey( Translation, related_name="urgent_need_name", blank=False, null=False, on_delete=models.PROTECT @@ -316,8 +303,7 @@ class NavigatorManager(models.Manager): def new_navigator(self, name, phone_number): translations = {} for field in self.translated_fields: - translations[field] = Translation.objects.add_translation( - f"navigator.{name}_temporary_key-{field}") + translations[field] = Translation.objects.add_translation(f"navigator.{name}_temporary_key-{field}") # try to set the external_name to the name external_name_exists = self.filter(external_name=name).count() > 0 @@ -336,13 +322,10 @@ def new_navigator(self, name, phone_number): class Navigator(models.Model): - program = models.ManyToManyField( - Program, related_name="navigator", blank=True) - external_name = models.CharField( - max_length=120, blank=True, null=True, unique=True) + program = models.ManyToManyField(Program, related_name="navigator", blank=True) + external_name = models.CharField(max_length=120, blank=True, null=True, unique=True) phone_number = PhoneNumberField(blank=True, null=True) - counties = models.ManyToManyField( - NavigatorCounty, related_name="navigator", blank=True) + counties = models.ManyToManyField(NavigatorCounty, related_name="navigator", blank=True) name = models.ForeignKey( Translation, related_name="navigator_name", blank=False, null=False, on_delete=models.PROTECT @@ -373,12 +356,9 @@ def __str__(self): class Referrer(models.Model): referrer_code = models.CharField(max_length=64, unique=True) webhook_url = models.CharField(max_length=320, blank=True, null=True) - webhook_functions = models.ManyToManyField( - WebHookFunction, related_name="web_hook", blank=True) - primary_navigators = models.ManyToManyField( - Navigator, related_name="primary_navigators", blank=True) - remove_programs = models.ManyToManyField( - Program, related_name="removed_programs", blank=True) + webhook_functions = models.ManyToManyField(WebHookFunction, related_name="web_hook", blank=True) + primary_navigators = models.ManyToManyField(Navigator, related_name="primary_navigators", blank=True) + remove_programs = models.ManyToManyField(Program, related_name="removed_programs", blank=True) def __str__(self): return self.referrer_code diff --git a/programs/programs/__init__.py b/programs/programs/__init__.py index f2f2c433..13e75b6d 100644 --- a/programs/programs/__init__.py +++ b/programs/programs/__init__.py @@ -2,7 +2,4 @@ from .federal import federal_calculators from .calc import ProgramCalculator -calculators: dict[str, type[ProgramCalculator]] = { - **co_calculators, - **federal_calculators -} +calculators: dict[str, type[ProgramCalculator]] = {**co_calculators, **federal_calculators} diff --git a/programs/programs/calc.py b/programs/programs/calc.py index 41975bea..0498b0c2 100644 --- a/programs/programs/calc.py +++ b/programs/programs/calc.py @@ -1,6 +1,7 @@ from screener.models import Screen from programs.util import Dependencies from typing import TYPE_CHECKING + if TYPE_CHECKING: from programs.models import Program @@ -15,9 +16,9 @@ def __init__(self): self.multiple_tax_units = False def condition(self, passed: bool, message=None): - ''' + """ Uses a condition to update the pass fail messages and eligibility. - ''' + """ if message is None: if not passed: @@ -30,22 +31,22 @@ def condition(self, passed: bool, message=None): self.failed(message) def failed(self, msg): - ''' + """ Mark eligibility as failed and add a message to `fail_messages` - ''' + """ self.eligible = False self.fail_messages.append(msg) def passed(self, msg): - ''' + """ Add a message to `pass_messages` - ''' + """ self.pass_messages.append(msg) def member_eligibility(self, members, conditions): - ''' + """ Filter out members that do not meet the condition and make eligibility messages - ''' + """ if len(conditions) <= 0: self.eligible_member_count = len(members) return members @@ -61,46 +62,47 @@ def member_eligibility(self, members, conditions): return self.member_eligibility(eligible_members, conditions) def to_dict(self): - ''' + """ Return the eligibility as a dictionary - ''' + """ return { - 'eligible': self.eligible, - 'passed': self.pass_messages, - 'failed': self.fail_messages, - 'estimated_value': self.value if self.eligible else 0, - 'multiple_tax_units': self.multiple_tax_units, + "eligible": self.eligible, + "passed": self.pass_messages, + "failed": self.fail_messages, + "estimated_value": self.value if self.eligible else 0, + "multiple_tax_units": self.multiple_tax_units, } class ProgramCalculator: - ''' + """ Base class for all Programs - ''' + """ + dependencies = tuple() amount = 0 tax_unit_dependent = False - def __init__(self, screen: Screen, program: 'Program', data): + def __init__(self, screen: Screen, program: "Program", data): self.screen = screen self.program = program self.data = data def eligible(self) -> Eligibility: - ''' + """ Returns the `Eligibility` object with whether or not the program is eligible - ''' + """ return Eligibility() def value(self, eligible_members: int): - ''' + """ Return the value of the program - ''' + """ return self.amount @classmethod def can_calc(cls, missing_dependencies: Dependencies): - ''' + """ Returns whether or not the program can be calculated with the missing dependencies - ''' + """ return not missing_dependencies.has(*cls.dependencies) diff --git a/programs/programs/co/__init__.py b/programs/programs/co/__init__.py index 9113689f..356a3523 100644 --- a/programs/programs/co/__init__.py +++ b/programs/programs/co/__init__.py @@ -30,33 +30,32 @@ co_calculators: dict[str, type[ProgramCalculator]] = { - 'rtdlive': RtdLive, - 'cccap': ChildCareAssistance, - 'mydenver': MyDenver, - 'cocb': CashBack, - 'leap': EnergyAssistance, - 'erc': EnergyResourceCenter, - 'omnisalud': OmniSalud, - 'cdhcs': DentalHealthCareSeniors, - 'rhc': ReproductiveHealthCare, - 'cfhc': ConnectForHealth, - 'fps': FamilyPlanningServices, - 'dpp': DenverPreschoolProgram, - 'ede': EveryDayEats, - 'cpcr': PropertyCreditRebate, - 'upk': UniversalPreschool, - 'myspark': MySpark, - 'lwcr': LowWageCovidRelief, - 'cwd_medicaid': MedicaidChildWithDisability, - 'awd_medicaid': MedicaidAdultWithDisability, - 'emergency_medicaid': EmergencyMedicaid, - 'bca': BasicCashAssistance, - 'cowap': WeatherizationAssistance, - 'tabor': Tabor, - 'trua': Trua, - 'ubp': UtilityBillPay, - 'rag': RentalAssistanceGrant, - 'erap': EmergencyRentalAssistance, - 'nfp': NurseFamilyPartnership, + "rtdlive": RtdLive, + "cccap": ChildCareAssistance, + "mydenver": MyDenver, + "cocb": CashBack, + "leap": EnergyAssistance, + "erc": EnergyResourceCenter, + "omnisalud": OmniSalud, + "cdhcs": DentalHealthCareSeniors, + "rhc": ReproductiveHealthCare, + "cfhc": ConnectForHealth, + "fps": FamilyPlanningServices, + "dpp": DenverPreschoolProgram, + "ede": EveryDayEats, + "cpcr": PropertyCreditRebate, + "upk": UniversalPreschool, + "myspark": MySpark, + "lwcr": LowWageCovidRelief, + "cwd_medicaid": MedicaidChildWithDisability, + "awd_medicaid": MedicaidAdultWithDisability, + "emergency_medicaid": EmergencyMedicaid, + "bca": BasicCashAssistance, + "cowap": WeatherizationAssistance, + "tabor": Tabor, + "trua": Trua, + "ubp": UtilityBillPay, + "rag": RentalAssistanceGrant, + "erap": EmergencyRentalAssistance, + "nfp": NurseFamilyPartnership, } - diff --git a/programs/programs/co/basic_cash_assistance/calculator.py b/programs/programs/co/basic_cash_assistance/calculator.py index f86dcf38..6d8e0710 100644 --- a/programs/programs/co/basic_cash_assistance/calculator.py +++ b/programs/programs/co/basic_cash_assistance/calculator.py @@ -5,8 +5,8 @@ class BasicCashAssistance(ProgramCalculator): amount = 1_000 - county = 'Denver County' - dependencies = ['zipcode', 'age'] + county = "Denver County" + dependencies = ["zipcode", "age"] def eligible(self) -> Eligibility: e = Eligibility() diff --git a/programs/programs/co/cash_back/calculator.py b/programs/programs/co/cash_back/calculator.py index 320321ff..7c4fd16c 100644 --- a/programs/programs/co/cash_back/calculator.py +++ b/programs/programs/co/cash_back/calculator.py @@ -4,7 +4,7 @@ class CashBack(ProgramCalculator): amount = 750 - dependencies = ['age'] + dependencies = ["age"] def eligible(self) -> Eligibility: e = Eligibility() diff --git a/programs/programs/co/child_care_assistance/calculator.py b/programs/programs/co/child_care_assistance/calculator.py index b5b4f9b6..991c651c 100644 --- a/programs/programs/co/child_care_assistance/calculator.py +++ b/programs/programs/co/child_care_assistance/calculator.py @@ -6,8 +6,8 @@ class CCCAPCache(GoogleSheetsCache): - sheet_id = '1WzobLnLoxGbN_JfTuw3jUCZV5N7IA_0uvwEkIoMt3Wk' - range_name = 'Sheet1!A14:J78' + sheet_id = "1WzobLnLoxGbN_JfTuw3jUCZV5N7IA_0uvwEkIoMt3Wk" + range_name = "Sheet1!A14:J78" class ChildCareAssistance(ProgramCalculator): @@ -16,7 +16,7 @@ class ChildCareAssistance(ProgramCalculator): max_age_preschool = 4 max_age_afterschool = 13 max_age_afterschool_disabled = 19 - dependencies = ['age', 'income_amount', 'income_frequency', 'zipcode', 'household_size'] + dependencies = ["age", "income_amount", "income_frequency", "zipcode", "household_size"] county_values = CCCAPCache() def eligible(self) -> Eligibility: @@ -34,8 +34,8 @@ def eligible(self) -> Eligibility: e.condition(bool(cccap_county_data), messages.location()) # income - frequency = 'yearly' - income_types = ['all'] + frequency = "yearly" + income_types = ["all"] gross_income = self.screen.calc_gross_income(frequency, income_types) if cccap_county_data: income_limit = cccap_county_data[self.screen.household_size] * 12 @@ -54,9 +54,11 @@ def value(self, eligible_members: int): value += ChildCareAssistance.preschool_value elif household_member.age < ChildCareAssistance.max_age_afterschool: value += ChildCareAssistance.afterschool_value - elif household_member.age >= ChildCareAssistance.max_age_afterschool and \ - household_member.age <= ChildCareAssistance.max_age_afterschool_disabled and \ - household_member.has_disability(): + elif ( + household_member.age >= ChildCareAssistance.max_age_afterschool + and household_member.age <= ChildCareAssistance.max_age_afterschool_disabled + and household_member.has_disability() + ): value += ChildCareAssistance.afterschool_value return value @@ -68,9 +70,11 @@ def _num_cccap_children(self): for household_member in household_members: if household_member.age < ChildCareAssistance.max_age_afterschool: children += 1 - elif household_member.age >= ChildCareAssistance.max_age_afterschool and \ - household_member.age <= ChildCareAssistance.max_age_afterschool_disabled and \ - household_member.has_disability(): + elif ( + household_member.age >= ChildCareAssistance.max_age_afterschool + and household_member.age <= ChildCareAssistance.max_age_afterschool_disabled + and household_member.has_disability() + ): children += 1 return children @@ -80,21 +84,20 @@ def _cccap_county_values(self, county_name): sheet_values = self.county_values.fetch() cccap_county_name = county_name.replace(" County", "") - non_decimal = re.compile(r'[^\d.]+') + non_decimal = re.compile(r"[^\d.]+") for row in sheet_values: if row[0] == cccap_county_name: match = { 1: -1, - 2: float(non_decimal.sub('', row[2])), - 3: float(non_decimal.sub('', row[3])), - 4: float(non_decimal.sub('', row[4])), - 5: float(non_decimal.sub('', row[5])), - 6: float(non_decimal.sub('', row[6])), - 7: float(non_decimal.sub('', row[7])), - 8: float(non_decimal.sub('', row[8])), - 9: float(non_decimal.sub('', row[9])) + 2: float(non_decimal.sub("", row[2])), + 3: float(non_decimal.sub("", row[3])), + 4: float(non_decimal.sub("", row[4])), + 5: float(non_decimal.sub("", row[5])), + 6: float(non_decimal.sub("", row[6])), + 7: float(non_decimal.sub("", row[7])), + 8: float(non_decimal.sub("", row[8])), + 9: float(non_decimal.sub("", row[9])), } return match - diff --git a/programs/programs/co/connect_for_health/calculator.py b/programs/programs/co/connect_for_health/calculator.py index 6f654422..6b90307a 100644 --- a/programs/programs/co/connect_for_health/calculator.py +++ b/programs/programs/co/connect_for_health/calculator.py @@ -6,51 +6,44 @@ class CFHCache(GoogleSheetsCache): default = {} - sheet_id = '1SuOhwX5psXsipMS_G5DE_f9jLS2qWxf6temxY445EQg' + sheet_id = "1SuOhwX5psXsipMS_G5DE_f9jLS2qWxf6temxY445EQg" range_name = "'2023 report'!A2:B65" def update(self): data = super().update() - return {d[0].strip() + ' County': float(d[1].replace(',', '')) for d in data} + return {d[0].strip() + " County": float(d[1].replace(",", "")) for d in data} class ConnectForHealth(ProgramCalculator): percent_of_fpl = 4 - dependencies = ['insurance', 'income_amount', 'income_frequency', 'county', 'household_size'] + dependencies = ["insurance", "income_amount", "income_frequency", "county", "household_size"] county_values = CFHCache() def eligible(self) -> Eligibility: e = Eligibility() # Medicade eligibility - e.condition(not medicaid_eligible(self.data), messages.must_not_have_benefit('Medicaid')) + e.condition(not medicaid_eligible(self.data), messages.must_not_have_benefit("Medicaid")) # Someone has no health insurance - has_no_hi = self.screen.has_insurance_types(('none', 'private')) + has_no_hi = self.screen.has_insurance_types(("none", "private")) e.condition(has_no_hi, messages.has_no_insurance()) # HH member has no va insurance e.member_eligibility( self.screen.household_members.all(), - [ - ( - lambda m: not m.insurance.has_insurance_types(('va', 'private')), - messages.must_not_have_benefit('VA') - ) - ] + [(lambda m: not m.insurance.has_insurance_types(("va", "private")), messages.must_not_have_benefit("VA"))], ) # Income fpl = self.program.fpl.as_dict() income_band = int(fpl[self.screen.household_size] / 12 * ConnectForHealth.percent_of_fpl) - gross_income = int(self.screen.calc_gross_income('yearly', ('all',)) / 12) - e.condition(gross_income < income_band, - messages.income(gross_income, income_band)) + gross_income = int(self.screen.calc_gross_income("yearly", ("all",)) / 12) + e.condition(gross_income < income_band, messages.income(gross_income, income_band)) return e def value(self, eligible_members: int): values = self.county_values.fetch() return values[self.screen.county] * 12 - diff --git a/programs/programs/co/connect_for_health/tests.py b/programs/programs/co/connect_for_health/tests.py index c963e90c..10d99cb7 100644 --- a/programs/programs/co/connect_for_health/tests.py +++ b/programs/programs/co/connect_for_health/tests.py @@ -7,8 +7,8 @@ class TestConnectForHealth(TestCase): def setUp(self): self.screen1 = Screen.objects.create( agree_to_tos=True, - zipcode='80205', - county='Denver County', + zipcode="80205", + county="Denver County", household_size=1, household_assets=0, has_employer_hi=True, @@ -19,7 +19,7 @@ def setUp(self): ) self.person1 = HouseholdMember.objects.create( screen=self.screen1, - relationship='headOfHousehold', + relationship="headOfHousehold", age=60, student=False, student_full_time=False, @@ -43,11 +43,7 @@ def test_health_insurance_failed_all_conditions(self): self.screen1.has_no_hi = False self.screen1.save() income = IncomeStream.objects.create( - screen=self.screen1, - household_member=self.person1, - type='wages', - amount=5800, - frequency='monthly' + screen=self.screen1, household_member=self.person1, type="wages", amount=5800, frequency="monthly" ) cfhc = ConnectForHealth(self.screen1) diff --git a/programs/programs/co/dental_health_care_seniors/calculator.py b/programs/programs/co/dental_health_care_seniors/calculator.py index f1ce6dfa..d6f26352 100644 --- a/programs/programs/co/dental_health_care_seniors/calculator.py +++ b/programs/programs/co/dental_health_care_seniors/calculator.py @@ -6,7 +6,7 @@ class DentalHealthCareSeniors(ProgramCalculator): amount = 80 min_age = 60 percent_of_fpl = 2.5 - dependencies = ['age', 'income_amount', 'income_frequency', 'insurance', 'household_size'] + dependencies = ["age", "income_amount", "income_frequency", "insurance", "household_size"] def eligible(self) -> Eligibility: e = Eligibility() @@ -14,22 +14,21 @@ def eligible(self) -> Eligibility: self.screen.household_members.all(), [ ( - lambda m: m.insurance.has_insurance_types(('medicaid', 'private')), - messages.must_not_have_benefit('Medicaid') + lambda m: m.insurance.has_insurance_types(("medicaid", "private")), + messages.must_not_have_benefit("Medicaid"), ), ( lambda m: m.age > DentalHealthCareSeniors.min_age, - messages.older_than(DentalHealthCareSeniors.min_age) - ) - ] + messages.older_than(DentalHealthCareSeniors.min_age), + ), + ], ) # Income test fpl = self.program.fpl.as_dict() gross_income = int(self.screen.calc_gross_income("monthly", ["all"])) income_band = int(DentalHealthCareSeniors.percent_of_fpl * fpl[self.screen.household_size] / 12) - e.condition(gross_income <= income_band, - messages.income(gross_income, income_band)) + e.condition(gross_income <= income_band, messages.income(gross_income, income_band)) return e diff --git a/programs/programs/co/dental_health_care_seniors/tests.py b/programs/programs/co/dental_health_care_seniors/tests.py index d6bd2319..44bc1672 100644 --- a/programs/programs/co/dental_health_care_seniors/tests.py +++ b/programs/programs/co/dental_health_care_seniors/tests.py @@ -7,15 +7,15 @@ class TestDentalHealthCareSeniorsPension(TestCase): def setUp(self): self.screen1 = Screen.objects.create( agree_to_tos=True, - zipcode='80205', - county='Denver County', + zipcode="80205", + county="Denver County", household_size=1, household_assets=0, - has_no_hi=True + has_no_hi=True, ) self.person1 = HouseholdMember.objects.create( screen=self.screen1, - relationship='headOfHousehold', + relationship="headOfHousehold", age=60, student=False, student_full_time=False, @@ -41,11 +41,7 @@ def test_dental_health_care_seniors_failed_all_conditions(self): self.screen1.has_medicaid = True self.screen1.save() IncomeStream.objects.create( - screen=self.screen1, - household_member=self.person1, - type='wages', - amount=3000, - frequency='monthly' + screen=self.screen1, household_member=self.person1, type="wages", amount=3000, frequency="monthly" ) cdhcs = DentalHealthCareSeniors(self.screen1) diff --git a/programs/programs/co/denver_preschool_program/calculator.py b/programs/programs/co/denver_preschool_program/calculator.py index bc19c482..4fcb9a8e 100644 --- a/programs/programs/co/denver_preschool_program/calculator.py +++ b/programs/programs/co/denver_preschool_program/calculator.py @@ -8,7 +8,7 @@ class DenverPreschoolProgram(ProgramCalculator): min_age = 3 max_age = 4 county = "Denver County" - dependencies = ['age', 'zipcode'] + dependencies = ["age", "zipcode"] def eligible(self) -> Eligibility: e = Eligibility() @@ -18,8 +18,7 @@ def eligible(self) -> Eligibility: age_min=DenverPreschoolProgram.min_age, age_max=DenverPreschoolProgram.max_age ) - e.condition(num_children >= 1, - messages.child(DenverPreschoolProgram.min_age, DenverPreschoolProgram.max_age)) + e.condition(num_children >= 1, messages.child(DenverPreschoolProgram.min_age, DenverPreschoolProgram.max_age)) if self.screen.county is not None: counties = [self.screen.county] @@ -27,7 +26,6 @@ def eligible(self) -> Eligibility: counties = counties_from_zip(self.screen.zipcode) # Lives in Denver - e.condition(DenverPreschoolProgram.county in counties, - messages.location()) + e.condition(DenverPreschoolProgram.county in counties, messages.location()) return e diff --git a/programs/programs/co/denver_preschool_program/tests.py b/programs/programs/co/denver_preschool_program/tests.py index 916018ab..08ebf51c 100644 --- a/programs/programs/co/denver_preschool_program/tests.py +++ b/programs/programs/co/denver_preschool_program/tests.py @@ -6,14 +6,11 @@ class TestDenverPreschoolProgram(TestCase): def setUp(self): self.screen1 = Screen.objects.create( - agree_to_tos=True, - zipcode='80205', - county='Denver County', - household_size=2 + agree_to_tos=True, zipcode="80205", county="Denver County", household_size=2 ) self.person1 = HouseholdMember.objects.create( screen=self.screen1, - relationship='headOfHousehold', + relationship="headOfHousehold", age=30, student=False, student_full_time=False, @@ -28,7 +25,7 @@ def setUp(self): ) self.person2 = HouseholdMember.objects.create( screen=self.screen1, - relationship='child', + relationship="child", age=3, student=False, student_full_time=False, diff --git a/programs/programs/co/emergency_rental_assistance/calculator.py b/programs/programs/co/emergency_rental_assistance/calculator.py index 18ccfda9..dc79d697 100644 --- a/programs/programs/co/emergency_rental_assistance/calculator.py +++ b/programs/programs/co/emergency_rental_assistance/calculator.py @@ -6,18 +6,18 @@ class EmergencyRentalAssistanceIncomeLimitsCache(GoogleSheetsCache): default = {} - sheet_id = '1QHb-ZT0Y2oWjFMoeP_wy8ClveslINWdehb-CXhB8WSE' + sheet_id = "1QHb-ZT0Y2oWjFMoeP_wy8ClveslINWdehb-CXhB8WSE" range_name = "'2022 80% AMI'!A2:I" def update(self): data = super().update() - return {d[0].strip() + ' County': [int(v.replace(',', '')) for v in d[1:]] for d in data} + return {d[0].strip() + " County": [int(v.replace(",", "")) for v in d[1:]] for d in data} class EmergencyRentalAssistance(ProgramCalculator): amount = 13_848 - dependencies = ['income_amount', 'income_frequency', 'household_size', 'zipcode'] + dependencies = ["income_amount", "income_frequency", "household_size", "zipcode"] income_cache = EmergencyRentalAssistanceIncomeLimitsCache() def eligible(self) -> Eligibility: @@ -27,11 +27,10 @@ def eligible(self) -> Eligibility: counties = counties_from_zip(self.screen.zipcode) county_name = self.screen.county if self.screen.county is not None else counties[0] - income = self.screen.calc_gross_income('yearly', ['all']) - income_limits = EmergencyRentalAssistance.income_cache.fetch() + income = self.screen.calc_gross_income("yearly", ["all"]) + income_limits = EmergencyRentalAssistance.income_cache.fetch() # NOTE: 80% to income is already applied in the sheet. income_limit = income_limits[county_name][self.screen.household_size - 1] e.condition(income < income_limit, messages.income(income, income_limit)) return e - diff --git a/programs/programs/co/energy_assistance/calculator.py b/programs/programs/co/energy_assistance/calculator.py index 0ade8cce..e774b3b3 100644 --- a/programs/programs/co/energy_assistance/calculator.py +++ b/programs/programs/co/energy_assistance/calculator.py @@ -9,10 +9,10 @@ class LeapValueCache(Cache): expire_time = 60 * 60 * 24 default = [] - sheet_id = '1W8WbJsb5Mgb4CUkte2SCuDnqigqkmaO3LC0KSfhEdGg' + sheet_id = "1W8WbJsb5Mgb4CUkte2SCuDnqigqkmaO3LC0KSfhEdGg" range_name = "'FFY 2024'!A1:G65" - county_column = '2023/2024 Season\nUpdated: \n4/30/2024' - average_column = 'Average Benefit' + county_column = "2023/2024 Season\nUpdated: \n4/30/2024" + average_column = "Average Benefit" def update(self): data = GoogleSheets(self.sheet_id, self.range_name).data_by_column(self.county_column, self.average_column) @@ -31,7 +31,7 @@ class EnergyAssistance(ProgramCalculator): 7: 8_001, 8: 8_179, } - dependencies = ['income_frequency', 'income_amount', 'zipcode', 'household_size'] + dependencies = ["income_frequency", "income_amount", "zipcode", "household_size"] county_values = LeapValueCache() def eligible(self) -> Eligibility: @@ -39,13 +39,11 @@ def eligible(self) -> Eligibility: # income frequency = "monthly" - income_types = ['all'] + income_types = ["all"] income_limit = EnergyAssistance.income_bands[self.screen.household_size] leap_income = self.screen.calc_gross_income(frequency, income_types) - e.condition( - leap_income < income_limit, messages.income(leap_income, income_limit) - ) + e.condition(leap_income < income_limit, messages.income(leap_income, income_limit)) return e @@ -60,9 +58,9 @@ def value(self, eligible_members: int): values = [] for row in data: - county = row[0].strip().replace('Application County: ', '') + ' County' + county = row[0].strip().replace("Application County: ", "") + " County" if county in counties: - values.append(int(float(row[1].replace('$', '')))) + values.append(int(float(row[1].replace("$", "")))) value = 362 lowest = math.inf @@ -74,4 +72,3 @@ def value(self, eligible_members: int): lowest = possible_value return value - diff --git a/programs/programs/co/energy_resource_center/calculator.py b/programs/programs/co/energy_resource_center/calculator.py index 57ad3e14..89470343 100644 --- a/programs/programs/co/energy_resource_center/calculator.py +++ b/programs/programs/co/energy_resource_center/calculator.py @@ -4,17 +4,8 @@ class EnergyResourceCenter(ProgramCalculator): amount = 4000 - income_bands = { - 1: 2880, - 2: 3766, - 3: 4652, - 4: 5539, - 5: 6425, - 6: 7311, - 7: 7477, - 8: 7644 - } - dependencies = ['household_size', 'income_amount', 'income_frequency'] + income_bands = {1: 2880, 2: 3766, 3: 4652, 4: 5539, 5: 6425, 6: 7311, 7: 7477, 8: 7644} + dependencies = ["household_size", "income_amount", "income_frequency"] def eligible(self) -> Eligibility: e = Eligibility() @@ -22,7 +13,6 @@ def eligible(self) -> Eligibility: # income gross_income = self.screen.calc_gross_income("monthly", ["all"]) income_band = EnergyResourceCenter.income_bands[self.screen.household_size] - e.condition(gross_income <= income_band, - messages.income(gross_income, income_band)) + e.condition(gross_income <= income_band, messages.income(gross_income, income_band)) return e diff --git a/programs/programs/co/energy_resource_center/tests.py b/programs/programs/co/energy_resource_center/tests.py index 3821af10..49610c97 100644 --- a/programs/programs/co/energy_resource_center/tests.py +++ b/programs/programs/co/energy_resource_center/tests.py @@ -7,14 +7,14 @@ class TestEnergyResourceCenterPension(TestCase): def setUp(self): self.screen1 = Screen.objects.create( agree_to_tos=True, - zipcode='80205', - county='Denver County', + zipcode="80205", + county="Denver County", household_size=1, household_assets=0, ) self.person1 = HouseholdMember.objects.create( screen=self.screen1, - relationship='headOfHousehold', + relationship="headOfHousehold", age=60, student=False, student_full_time=False, @@ -36,14 +36,9 @@ def test_energy_resource_center_visually_impaired_is_eligible(self): def test_energy_resource_center_failed_income_condition(self): income = IncomeStream.objects.create( - screen=self.screen1, - household_member=self.person1, - type='wages', - amount=3000, - frequency='monthly' + screen=self.screen1, household_member=self.person1, type="wages", amount=3000, frequency="monthly" ) erc = EnergyResourceCenter(self.screen1) eligibility = erc.eligibility self.assertFalse(eligibility["eligible"]) - diff --git a/programs/programs/co/every_day_eats/calculator.py b/programs/programs/co/every_day_eats/calculator.py index 4dbc585c..fec2df6a 100644 --- a/programs/programs/co/every_day_eats/calculator.py +++ b/programs/programs/co/every_day_eats/calculator.py @@ -6,7 +6,7 @@ class EveryDayEats(ProgramCalculator): amount = 600 min_age = 60 percent_of_fpl = 1.3 - dependencies = ['age', 'income_amount', 'income_frequency', 'household_size'] + dependencies = ["age", "income_amount", "income_frequency", "household_size"] def eligible(self) -> Eligibility: e = Eligibility() @@ -18,7 +18,7 @@ def eligible(self) -> Eligibility: # Income fpl = self.program.fpl.as_dict() income_limit = EveryDayEats.percent_of_fpl * fpl[self.screen.household_size] - gross_income = self.screen.calc_gross_income('yearly', ['all']) + gross_income = self.screen.calc_gross_income("yearly", ["all"]) e.condition(gross_income < income_limit, messages.income(gross_income, income_limit)) diff --git a/programs/programs/co/every_day_eats/tests.py b/programs/programs/co/every_day_eats/tests.py index 01fc093f..03606c18 100644 --- a/programs/programs/co/every_day_eats/tests.py +++ b/programs/programs/co/every_day_eats/tests.py @@ -7,14 +7,14 @@ class TestEveryDayEatsPension(TestCase): def setUp(self): self.screen1 = Screen.objects.create( agree_to_tos=True, - zipcode='80205', - county='Denver County', + zipcode="80205", + county="Denver County", household_size=1, household_assets=0, ) self.person1 = HouseholdMember.objects.create( screen=self.screen1, - relationship='headOfHousehold', + relationship="headOfHousehold", age=60, student=False, student_full_time=False, @@ -36,11 +36,7 @@ def test_every_day_eats_visually_impaired_is_eligible(self): def test_every_day_eats_failed_all_conditions(self): income = IncomeStream.objects.create( - screen=self.screen1, - household_member=self.person1, - type='wages', - amount=3000, - frequency='monthly' + screen=self.screen1, household_member=self.person1, type="wages", amount=3000, frequency="monthly" ) self.person1.age = 30 self.person1.save() diff --git a/programs/programs/co/low_wage_covid_relief/calculator.py b/programs/programs/co/low_wage_covid_relief/calculator.py index c09ed3c0..92d8653f 100644 --- a/programs/programs/co/low_wage_covid_relief/calculator.py +++ b/programs/programs/co/low_wage_covid_relief/calculator.py @@ -7,7 +7,7 @@ class LowWageCovidRelief(ProgramCalculator): amount = 1_500 - auto_eligible_benefits = (*STATE_MEDICAID_OPTIONS, 'tanf', 'snap', 'wic', 'leap') + auto_eligible_benefits = (*STATE_MEDICAID_OPTIONS, "tanf", "snap", "wic", "leap") income_limits = { 1: -math.inf, 2: 3_266.25, @@ -18,8 +18,8 @@ class LowWageCovidRelief(ProgramCalculator): 7: 7_522.50, 8: 8_373.75, } - county = 'Adams County' - dependencies = ['zipode', 'household_size', 'income_amount', 'income_frequency'] + county = "Adams County" + dependencies = ["zipode", "household_size", "income_amount", "income_frequency"] def eligible(self) -> Eligibility: e = Eligibility() @@ -38,13 +38,13 @@ def eligible(self) -> Eligibility: has_benefit = self.screen.has_benefit(benefit) for benefit in self.data: - if benefit['name_abbreviated'] in LowWageCovidRelief.auto_eligible_benefits and benefit['eligible']: + if benefit["name_abbreviated"] in LowWageCovidRelief.auto_eligible_benefits and benefit["eligible"]: has_benefit = True break # meets income limit income_limit = LowWageCovidRelief.income_limits[self.screen.household_size] - income = self.screen.calc_gross_income('monthly', ['all']) + income = self.screen.calc_gross_income("monthly", ["all"]) meets_income_limit = income <= income_limit if not (meets_income_limit or has_benefit): diff --git a/programs/programs/co/medicaid/adult_with_disability/calculator.py b/programs/programs/co/medicaid/adult_with_disability/calculator.py index 3d461bff..18e3ed1f 100644 --- a/programs/programs/co/medicaid/adult_with_disability/calculator.py +++ b/programs/programs/co/medicaid/adult_with_disability/calculator.py @@ -7,40 +7,43 @@ class MedicaidAdultWithDisability(ProgramCalculator): min_age = 16 max_income_percent = 4.5 earned_deduction = 65 - earned_percent = .5 + earned_percent = 0.5 amount = 310 unearned_deduction = 20 min_age = 16 - insurance_types = ('employer', 'private', 'none') - dependencies = ['insurance', 'age', 'household_size', 'income_type', 'income_amount', 'income_frequency'] + insurance_types = ("employer", "private", "none") + dependencies = ["insurance", "age", "household_size", "income_type", "income_amount", "income_frequency"] def eligible(self) -> Eligibility: e = Eligibility() # Does not qualify for Medicaid - e.condition(not medicaid_eligible(self.data), messages.must_not_have_benefit('Medicaid')) + e.condition(not medicaid_eligible(self.data), messages.must_not_have_benefit("Medicaid")) def income_eligible(member): fpl = self.program.fpl.as_dict() income_limit = fpl[self.screen.household_size] * MedicaidAdultWithDisability.max_income_percent earned_deduction = MedicaidAdultWithDisability.earned_deduction earned_percent = MedicaidAdultWithDisability.earned_percent - earned = max(0, int( - (int(member.calc_gross_income('yearly', ['earned'])) - earned_deduction) * earned_percent - )) + earned = max( + 0, int((int(member.calc_gross_income("yearly", ["earned"])) - earned_deduction) * earned_percent) + ) unearned_deduction = MedicaidAdultWithDisability.unearned_deduction - unearned = int(member.calc_gross_income('yearly', ['unearned'])) - unearned_deduction + unearned = int(member.calc_gross_income("yearly", ["unearned"])) - unearned_deduction return earned + unearned <= income_limit - e.member_eligibility(self.screen.household_members.all(), [ - ( - lambda m: m.age >= MedicaidAdultWithDisability.min_age, - messages.older_than(min_age=MedicaidAdultWithDisability.min_age) - ), - (lambda m: m.long_term_disability or m.visually_impaired, messages.has_disability()), - (lambda m: m.insurance.has_insurance_types(MedicaidAdultWithDisability.insurance_types), None), - (income_eligible, None) - ]) + e.member_eligibility( + self.screen.household_members.all(), + [ + ( + lambda m: m.age >= MedicaidAdultWithDisability.min_age, + messages.older_than(min_age=MedicaidAdultWithDisability.min_age), + ), + (lambda m: m.long_term_disability or m.visually_impaired, messages.has_disability()), + (lambda m: m.insurance.has_insurance_types(MedicaidAdultWithDisability.insurance_types), None), + (income_eligible, None), + ], + ) return e diff --git a/programs/programs/co/medicaid/child_with_disability/calculator.py b/programs/programs/co/medicaid/child_with_disability/calculator.py index 7b83f7e3..3a189af1 100644 --- a/programs/programs/co/medicaid/child_with_disability/calculator.py +++ b/programs/programs/co/medicaid/child_with_disability/calculator.py @@ -7,32 +7,35 @@ class MedicaidChildWithDisability(ProgramCalculator): max_age = 18 max_income_percent = 3 earned_deduction = 90 - income_percent = 1 - .33 - insurance_types = ('employer', 'private', 'none') + income_percent = 1 - 0.33 + insurance_types = ("employer", "private", "none") amount = 200 - dependencies = ['insurance', 'age', 'household_size', 'income_type', 'income_amount', 'income_frequency'] + dependencies = ["insurance", "age", "household_size", "income_type", "income_amount", "income_frequency"] def eligible(self) -> Eligibility: e = Eligibility() # Does not qualify for Medicaid - e.condition(not medicaid_eligible(self.data), messages.must_not_have_benefit('Medicaid')) + e.condition(not medicaid_eligible(self.data), messages.must_not_have_benefit("Medicaid")) fpl = self.program.fpl.as_dict() income_limit = fpl[self.screen.household_size] * MedicaidChildWithDisability.max_income_percent - earned = max(0, int( - self.screen.calc_gross_income('yearly', ['earned']) - MedicaidChildWithDisability.earned_deduction - )) - unearned = self.screen.calc_gross_income('yearly', ['unearned']) + earned = max( + 0, int(self.screen.calc_gross_income("yearly", ["earned"]) - MedicaidChildWithDisability.earned_deduction) + ) + unearned = self.screen.calc_gross_income("yearly", ["unearned"]) income = (earned + unearned) * MedicaidChildWithDisability.income_percent e.condition(income <= income_limit, messages.income(income, income_limit)) - e.member_eligibility(self.screen.household_members.all(), [ - (lambda m: m.age <= MedicaidChildWithDisability.max_age, messages.child()), - (lambda m: m.long_term_disability or m.visually_impaired, messages.has_disability()), - (lambda m: m.insurance.has_insurance_types(MedicaidChildWithDisability.insurance_types), None), - (lambda m: not (m.calc_gross_income('yearly', ['earned']) >= 0 and m.age >= 16), None), - ]) + e.member_eligibility( + self.screen.household_members.all(), + [ + (lambda m: m.age <= MedicaidChildWithDisability.max_age, messages.child()), + (lambda m: m.long_term_disability or m.visually_impaired, messages.has_disability()), + (lambda m: m.insurance.has_insurance_types(MedicaidChildWithDisability.insurance_types), None), + (lambda m: not (m.calc_gross_income("yearly", ["earned"]) >= 0 and m.age >= 16), None), + ], + ) return e diff --git a/programs/programs/co/medicaid/family_planning_services/calculator.py b/programs/programs/co/medicaid/family_planning_services/calculator.py index 9b9e448a..029bd8ed 100644 --- a/programs/programs/co/medicaid/family_planning_services/calculator.py +++ b/programs/programs/co/medicaid/family_planning_services/calculator.py @@ -7,7 +7,7 @@ class FamilyPlanningServices(ProgramCalculator): amount = 404 min_age = 12 fpl_percent = 2.6 - dependencies = ['age', 'insurance', 'income_frequency', 'income_amount', 'household_size'] + dependencies = ["age", "insurance", "income_frequency", "income_amount", "household_size"] def eligible(self) -> Eligibility: e = Eligibility() @@ -15,24 +15,21 @@ def eligible(self) -> Eligibility: # Does not have insurance has_no_insurance = False for member in self.screen.household_members.all(): - has_no_insurance = member.insurance.has_insurance_types(('none',)) or has_no_insurance + has_no_insurance = member.insurance.has_insurance_types(("none",)) or has_no_insurance e.condition(has_no_insurance, messages.has_no_insurance()) # Not Medicaid eligible - e.condition(not medicaid_eligible(self.data), messages.must_not_have_benefit('Medicaid')) + e.condition(not medicaid_eligible(self.data), messages.must_not_have_benefit("Medicaid")) e.member_eligibility( self.screen.household_members.all(), - [ - (lambda m: not m.pregnant, None), - (lambda m: m.age >= FamilyPlanningServices.min_age, None) - ] + [(lambda m: not m.pregnant, None), (lambda m: m.age >= FamilyPlanningServices.min_age, None)], ) # Income fpl = self.program.fpl.as_dict() income_limit = int(FamilyPlanningServices.fpl_percent * fpl[self.screen.household_size]) - gross_income = int(self.screen.calc_gross_income('yearly', ['all'])) + gross_income = int(self.screen.calc_gross_income("yearly", ["all"])) e.condition(gross_income < income_limit, messages.income(gross_income, income_limit)) diff --git a/programs/programs/co/medicaid/family_planning_services/tests.py b/programs/programs/co/medicaid/family_planning_services/tests.py index e8b466a4..a9ea43ea 100644 --- a/programs/programs/co/medicaid/family_planning_services/tests.py +++ b/programs/programs/co/medicaid/family_planning_services/tests.py @@ -7,14 +7,14 @@ class TestFamilyPlanningServicesPension(TestCase): def setUp(self): self.screen1 = Screen.objects.create( agree_to_tos=True, - zipcode='80205', - county='Denver County', + zipcode="80205", + county="Denver County", household_size=2, household_assets=0, ) self.person1 = HouseholdMember.objects.create( screen=self.screen1, - relationship='headOfHousehold', + relationship="headOfHousehold", age=60, student=False, student_full_time=False, @@ -29,7 +29,7 @@ def setUp(self): ) self.person2 = HouseholdMember.objects.create( screen=self.screen1, - relationship='child', + relationship="child", age=10, student=True, student_full_time=False, @@ -44,7 +44,7 @@ def setUp(self): ) def test_family_planning_services_pass_all_conditions(self): - fps = FamilyPlanningServices(self.screen1, [{"name_abbreviated": 'medicaid', "eligible": False}]) + fps = FamilyPlanningServices(self.screen1, [{"name_abbreviated": "medicaid", "eligible": False}]) eligibility = fps.eligibility self.assertTrue(eligibility["eligible"]) @@ -53,15 +53,10 @@ def test_family_planning_services_failed_all_conditions(self): self.person2.age = 20 self.person2.save() IncomeStream.objects.create( - screen=self.screen1, - household_member=self.person1, - type='wages', - amount=4000, - frequency='monthly' + screen=self.screen1, household_member=self.person1, type="wages", amount=4000, frequency="monthly" ) - fps = FamilyPlanningServices(self.screen1, - [{"name_abbreviated": 'medicaid', "eligible": True}]) + fps = FamilyPlanningServices(self.screen1, [{"name_abbreviated": "medicaid", "eligible": True}]) eligibility = fps.eligibility self.assertFalse(eligibility["eligible"]) diff --git a/programs/programs/co/my_spark/calculator.py b/programs/programs/co/my_spark/calculator.py index 5b0c9204..9b8bd989 100644 --- a/programs/programs/co/my_spark/calculator.py +++ b/programs/programs/co/my_spark/calculator.py @@ -7,8 +7,8 @@ class MySpark(ProgramCalculator): amount_per_child = 1_000 max_age = 14 min_age = 11 - county = 'Denver County' - dependencies = ['age', 'zipcode'] + county = "Denver County" + dependencies = ["age", "zipcode"] def eligible(self) -> Eligibility: e = Eligibility() @@ -16,10 +16,10 @@ def eligible(self) -> Eligibility: # Qualify for FRL is_frl_eligible = False for benefit in self.data: - if benefit["name_abbreviated"] == 'nslp': + if benefit["name_abbreviated"] == "nslp": is_frl_eligible = benefit["eligible"] break - e.condition(is_frl_eligible, messages.must_have_benefit('Free or Reduced Lunch')) + e.condition(is_frl_eligible, messages.must_have_benefit("Free or Reduced Lunch")) if self.screen.county is not None: counties = [self.screen.county] @@ -35,9 +35,9 @@ def eligible(self) -> Eligibility: [ ( lambda m: m.age >= MySpark.min_age and m.age <= MySpark.max_age, - messages.child(MySpark.min_age, MySpark.max_age) + messages.child(MySpark.min_age, MySpark.max_age), ) - ] + ], ) return e diff --git a/programs/programs/co/mydenver/calculator.py b/programs/programs/co/mydenver/calculator.py index ad87dd15..7985e7a4 100644 --- a/programs/programs/co/mydenver/calculator.py +++ b/programs/programs/co/mydenver/calculator.py @@ -4,11 +4,11 @@ class MyDenver(ProgramCalculator): - eligible_counties = ['Denver County'] + eligible_counties = ["Denver County"] child_age_min = 5 child_age_max = 18 - child_relationship = ['child', 'fosterChild', 'stepChild', 'grandChild', 'relatedOther', 'headOfHousehold'] - dependencies = ['age', 'zipcode', 'relationship'] + child_relationship = ["child", "fosterChild", "stepChild", "grandChild", "relatedOther", "headOfHousehold"] + dependencies = ["age", "zipcode", "relationship"] def eligible(self) -> Eligibility: e = Eligibility() @@ -30,7 +30,7 @@ def eligible(self) -> Eligibility: children = self.screen.num_children( age_max=MyDenver.child_age_max, age_min=MyDenver.child_age_min, - child_relationship=MyDenver.child_relationship + child_relationship=MyDenver.child_relationship, ) e.condition(children > 0, messages.child(min_age=5)) @@ -41,7 +41,7 @@ def value(self, eligible_members: int): children = self.screen.num_children( age_max=MyDenver.child_age_max, age_min=MyDenver.child_age_min, - child_relationship=MyDenver.child_relationship + child_relationship=MyDenver.child_relationship, ) return children * 150 diff --git a/programs/programs/co/nfp/calculator.py b/programs/programs/co/nfp/calculator.py index e01a6b21..d71adeef 100644 --- a/programs/programs/co/nfp/calculator.py +++ b/programs/programs/co/nfp/calculator.py @@ -6,21 +6,13 @@ def calculate_nfp(screen, data, program): eligibility = eligibility_nfp(screen, program) value = value_nfp(screen) - calculation = { - 'eligibility': eligibility, - 'value': value - } + calculation = {"eligibility": eligibility, "value": value} return calculation def eligibility_nfp(screen, program): - - eligibility = { - "eligible": True, - "passed": [], - "failed": [] - } + eligibility = {"eligible": True, "passed": [], "failed": []} frequency = "yearly" @@ -36,10 +28,12 @@ def eligibility_nfp(screen, program): eligibility["eligible"] = False eligibility["failed"].append( _("Calculated income of ") - + str(math.trunc(gross_income)) + _(" for a household with ") + + str(math.trunc(gross_income)) + + _(" for a household with ") + str(screen.household_size) + _(" members is above the income limit of ") - + str(income_limit)) + + str(income_limit) + ) else: eligibility["passed"].append( _("Calculated income of ") @@ -47,7 +41,8 @@ def eligibility_nfp(screen, program): + _(" for a household with ") + str(screen.household_size) + _(" members is below the income limit of ") - + str(income_limit)) + + str(income_limit) + ) return eligibility diff --git a/programs/programs/co/nurse_family_partnership/calculator.py b/programs/programs/co/nurse_family_partnership/calculator.py index 644e5d31..5740c368 100644 --- a/programs/programs/co/nurse_family_partnership/calculator.py +++ b/programs/programs/co/nurse_family_partnership/calculator.py @@ -5,46 +5,42 @@ class NurseFamilyPartnership(ProgramCalculator): fpl_percent = 2 - child_relationships = ['child', 'grandChild'] + child_relationships = ["child", "grandChild"] amount = 15_000 dependencies = [ - 'relationship', - 'income_frequency', - 'income_amount', - 'age', - 'pregnant', + "relationship", + "income_frequency", + "income_amount", + "age", + "pregnant", ] def eligible(self) -> Eligibility: e = Eligibility() # no other children - e.condition( - self.screen.num_children(child_relationship=NurseFamilyPartnership.child_relationships) == 0 - ) + e.condition(self.screen.num_children(child_relationship=NurseFamilyPartnership.child_relationships) == 0) def income_eligible(member: HouseholdMember): income_limit = self.program.fpl.as_dict()[2] * NurseFamilyPartnership.fpl_percent - income = member.calc_gross_income('yearly', ['all']) + income = member.calc_gross_income("yearly", ["all"]) is_income_eligible = income <= income_limit insurance: Insurance = member.insurance has_medicaid = insurance.medicaid or insurance.emergency_medicaid - has_wic = self.screen.has_benefit('wic') + has_wic = self.screen.has_benefit("wic") return is_income_eligible or has_medicaid or has_wic - e.member_eligibility( self.screen.household_members.all(), [ (lambda m: m.pregnant, messages.is_pregnant()), (income_eligible, None), - ] + ], ) return e - diff --git a/programs/programs/co/omnisalud/calculator.py b/programs/programs/co/omnisalud/calculator.py index d6b5145d..b8d22887 100644 --- a/programs/programs/co/omnisalud/calculator.py +++ b/programs/programs/co/omnisalud/calculator.py @@ -6,7 +6,7 @@ class OmniSalud(ProgramCalculator): individual_limit = 1699 family_4_limit = 3469 amount = 610 - dependencies = ['income_amount', 'income_frequency', 'household_size', 'age', 'insurance'] + dependencies = ["income_amount", "income_frequency", "household_size", "age", "insurance"] def eligible(self) -> Eligibility: e = Eligibility() @@ -17,7 +17,7 @@ def eligible(self) -> Eligibility: e.condition(gross_income <= income_band, messages.income(gross_income, income_band)) # No health insurance - has_no_hi = self.screen.has_insurance_types(('none',)) + has_no_hi = self.screen.has_insurance_types(("none",)) e.condition(has_no_hi, messages.has_no_insurance()) return e diff --git a/programs/programs/co/omnisalud/tests.py b/programs/programs/co/omnisalud/tests.py index 0078afd0..23845a1a 100644 --- a/programs/programs/co/omnisalud/tests.py +++ b/programs/programs/co/omnisalud/tests.py @@ -7,15 +7,15 @@ class TestOmniSaludPension(TestCase): def setUp(self): self.screen1 = Screen.objects.create( agree_to_tos=True, - zipcode='80205', - county='Denver County', + zipcode="80205", + county="Denver County", household_size=1, household_assets=0, - has_no_hi=True + has_no_hi=True, ) self.person1 = HouseholdMember.objects.create( screen=self.screen1, - relationship='headOfHousehold', + relationship="headOfHousehold", age=20, student=False, student_full_time=False, @@ -39,11 +39,7 @@ def test_omnisalud_failed_all_conditions(self): self.screen1.has_no_hi = False self.screen1.save() IncomeStream.objects.create( - screen=self.screen1, - household_member=self.person1, - type='wages', - amount=2000, - frequency='monthly' + screen=self.screen1, household_member=self.person1, type="wages", amount=2000, frequency="monthly" ) omnisalud = OmniSalud(self.screen1) diff --git a/programs/programs/co/pe/__init__.py b/programs/programs/co/pe/__init__.py index 871fc89a..a43da0d8 100644 --- a/programs/programs/co/pe/__init__.py +++ b/programs/programs/co/pe/__init__.py @@ -4,19 +4,18 @@ co_member_calculators = { - 'co_medicaid': member.CoMedicaid, - 'andcs': member.AidToTheNeedyAndDisabled, - 'oap': member.OldAgePension, - 'chp': member.Chp, + "co_medicaid": member.CoMedicaid, + "andcs": member.AidToTheNeedyAndDisabled, + "oap": member.OldAgePension, + "chp": member.Chp, } co_tax_unit_calculators = { - 'coeitc': tax.Coeitc, - 'coctc': tax.Coctc, + "coeitc": tax.Coeitc, + "coctc": tax.Coctc, } co_pe_calculators: dict[str, type[PolicyEngineCalulator]] = { **co_member_calculators, **co_tax_unit_calculators, } - diff --git a/programs/programs/co/pe/member.py b/programs/programs/co/pe/member.py index f1276202..1866b10d 100644 --- a/programs/programs/co/pe/member.py +++ b/programs/programs/co/pe/member.py @@ -8,13 +8,13 @@ class CoMedicaid(Medicaid): adult_medicaid_average = 310 * 12 aged_medicaid_average = 170 * 12 pe_inputs = [ - *Medicaid.pe_inputs, + *Medicaid.pe_inputs, dependency.household.CoStateCode, ] class AidToTheNeedyAndDisabled(PolicyEngineMembersCalculator): - pe_name = 'co_state_supplement' + pe_name = "co_state_supplement" pe_inputs = [ dependency.member.SsiCountableResourcesDependency, dependency.member.SsiReportedDependency, @@ -32,7 +32,7 @@ class AidToTheNeedyAndDisabled(PolicyEngineMembersCalculator): class OldAgePension(PolicyEngineMembersCalculator): - pe_name = 'co_oap' + pe_name = "co_oap" pe_inputs = [ dependency.member.SsiCountableResourcesDependency, dependency.member.SsiEarnedIncomeDependency, @@ -47,7 +47,7 @@ class OldAgePension(PolicyEngineMembersCalculator): class Chp(PolicyEngineMembersCalculator): - pe_name = 'co_chp' + pe_name = "co_chp" pe_inputs = [ dependency.member.AgeDependency, dependency.member.PregnancyDependency, @@ -65,8 +65,8 @@ def value(self): if not self.in_tax_unit(member.id): continue - chp_eligible = self.sim.value(self.pe_category, str(member.id), 'co_chp_eligible', self.pe_period) > 0 - if chp_eligible and self.screen.has_insurance_types(('none',)): + chp_eligible = self.sim.value(self.pe_category, str(member.id), "co_chp_eligible", self.pe_period) > 0 + if chp_eligible and self.screen.has_insurance_types(("none",)): total += self.amount return total diff --git a/programs/programs/co/pe/tax.py b/programs/programs/co/pe/tax.py index 53e4aa62..4e84992f 100644 --- a/programs/programs/co/pe/tax.py +++ b/programs/programs/co/pe/tax.py @@ -4,16 +4,16 @@ class Coeitc(PolicyEngineTaxUnitCalulator): - pe_name = 'co_eitc' + pe_name = "co_eitc" pe_inputs = [ - *Eitc.pe_inputs, + *Eitc.pe_inputs, dependency.household.CoStateCode, ] pe_outputs = [dependency.tax.Coeitc] class Coctc(PolicyEngineTaxUnitCalulator): - pe_name = 'ctc' + pe_name = "ctc" pe_inputs = [ dependency.member.AgeDependency, dependency.member.TaxUnitDependentDependency, @@ -24,18 +24,18 @@ class Coctc(PolicyEngineTaxUnitCalulator): pe_outputs = [dependency.tax.Ctc] income_bands = { - "single": [{"max": 25000, "percent": .6}, {"max": 50000, "percent": .3}, {"max": 75000, "percent": .1}], - "maried": [{"max": 35000, "percent": .6}, {"max": 60000, "percent": .3}, {"max": 85000, "percent": .1}] + "single": [{"max": 25000, "percent": 0.6}, {"max": 50000, "percent": 0.3}, {"max": 75000, "percent": 0.1}], + "maried": [{"max": 35000, "percent": 0.6}, {"max": 60000, "percent": 0.3}, {"max": 85000, "percent": 0.1}], } def value(self): - income = self.screen.calc_gross_income('yearly', ['all']) - relationship_status = 'maried' if self.screen.is_joint() else 'single' + income = self.screen.calc_gross_income("yearly", ["all"]) + relationship_status = "maried" if self.screen.is_joint() else "single" multiplier = 0 for band in self.income_bands[relationship_status]: # if the income is less than the band then set the multiplier and break out of the loop - if income <= band['max']: - multiplier = band['percent'] + if income <= band["max"]: + multiplier = band["percent"] break return self.get_variable() * multiplier diff --git a/programs/programs/co/property_credit_rebate/calculator.py b/programs/programs/co/property_credit_rebate/calculator.py index 274271c3..7165047d 100644 --- a/programs/programs/co/property_credit_rebate/calculator.py +++ b/programs/programs/co/property_credit_rebate/calculator.py @@ -7,7 +7,7 @@ class PropertyCreditRebate(ProgramCalculator): min_age = 65 disabled_min_age = 18 income_limit = {"single": 18_026, "married": 23_345} - dependencies = ['age', 'income_frequency', 'income_amount', 'relationship'] + dependencies = ["age", "income_frequency", "income_amount", "relationship"] def eligible(self) -> Eligibility: e = Eligibility() @@ -22,20 +22,20 @@ def eligible(self) -> Eligibility: # Someone is old enough someone_old_enough = self.screen.num_adults(age_max=PropertyCreditRebate.min_age) >= 1 - e.condition(someone_disabled or someone_old_enough, - messages.has_disability()) + e.condition(someone_disabled or someone_old_enough, messages.has_disability()) - e.condition(someone_disabled or someone_old_enough, - messages.older_than(PropertyCreditRebate.min_age)) + e.condition(someone_disabled or someone_old_enough, messages.older_than(PropertyCreditRebate.min_age)) # Income test - relationship_status = 'single' + relationship_status = "single" for member_id, married_to in self.screen.relationship_map().items(): if married_to is not None: - relationship_status = 'married' + relationship_status = "married" - gross_income = self.screen.calc_gross_income('yearly', ['all']) - e.condition(gross_income <= PropertyCreditRebate.income_limit[relationship_status], - messages.income(gross_income, PropertyCreditRebate.income_limit[relationship_status])) + gross_income = self.screen.calc_gross_income("yearly", ["all"]) + e.condition( + gross_income <= PropertyCreditRebate.income_limit[relationship_status], + messages.income(gross_income, PropertyCreditRebate.income_limit[relationship_status]), + ) return e diff --git a/programs/programs/co/property_credit_rebate/tests.py b/programs/programs/co/property_credit_rebate/tests.py index 849bbfea..3cb476ab 100644 --- a/programs/programs/co/property_credit_rebate/tests.py +++ b/programs/programs/co/property_credit_rebate/tests.py @@ -7,16 +7,16 @@ class TestPropertyCreditRebatePension(TestCase): def setUp(self): self.screen1 = Screen.objects.create( agree_to_tos=True, - zipcode='80205', - county='Denver County', + zipcode="80205", + county="Denver County", household_size=2, household_assets=0, has_tanf=False, - has_ssi=False + has_ssi=False, ) self.person1 = HouseholdMember.objects.create( screen=self.screen1, - relationship='headOfHousehold', + relationship="headOfHousehold", age=65, student=False, student_full_time=False, @@ -45,12 +45,8 @@ def test_property_credit_rebate_failed_all_conditions(self): self.person1.disabled = False self.person1.save() income = IncomeStream.objects.create( - screen=self.screen1, - household_member=self.person1, - type='wages', - amount=2000, - frequency='monthly' - ) + screen=self.screen1, household_member=self.person1, type="wages", amount=2000, frequency="monthly" + ) cpcr = PropertyCreditRebate(self.screen1) eligibility = cpcr.eligibility diff --git a/programs/programs/co/rental_assistance_grant/calculator.py b/programs/programs/co/rental_assistance_grant/calculator.py index 20e7c02f..a0fd0af3 100644 --- a/programs/programs/co/rental_assistance_grant/calculator.py +++ b/programs/programs/co/rental_assistance_grant/calculator.py @@ -6,18 +6,18 @@ class RAGCache(GoogleSheetsCache): default = {} - sheet_id = '1DntpIXZfUY2yTy1_rAhaGLUH4PUAfpTSAn-j2tf2tts' + sheet_id = "1DntpIXZfUY2yTy1_rAhaGLUH4PUAfpTSAn-j2tf2tts" range_name = "'2023 80% AMI'!A2:I65" def update(self): data = super().update() - return {d[0].strip() + ' County': [int(v.replace(',', '')) for v in d[1:]] for d in data} + return {d[0].strip() + " County": [int(v.replace(",", "")) for v in d[1:]] for d in data} class RentalAssistanceGrant(ProgramCalculator): amount = 10_000 - dependencies = ['income_amount', 'income_frequency', 'household_size', 'zipcode'] + dependencies = ["income_amount", "income_frequency", "household_size", "zipcode"] income_limits = RAGCache() def eligible(self) -> Eligibility: @@ -28,7 +28,7 @@ def eligible(self) -> Eligibility: county_name = self.screen.county if self.screen.county is not None else counties[0] # income - gross_income = int(self.screen.calc_gross_income('yearly', ['all'])) + gross_income = int(self.screen.calc_gross_income("yearly", ["all"])) limits = self.income_limits.fetch() @@ -40,4 +40,3 @@ def eligible(self) -> Eligibility: e.condition(gross_income <= income_limit, messages.income(gross_income, income_limit)) return e - diff --git a/programs/programs/co/reproductive_health_care/calculator.py b/programs/programs/co/reproductive_health_care/calculator.py index a8383ee8..c9933222 100644 --- a/programs/programs/co/reproductive_health_care/calculator.py +++ b/programs/programs/co/reproductive_health_care/calculator.py @@ -5,13 +5,13 @@ class ReproductiveHealthCare(ProgramCalculator): amount = 268 - dependencies = ['insurance'] + dependencies = ["insurance"] def eligible(self) -> Eligibility: e = Eligibility() # No health insurance - has_no_hi = self.screen.has_insurance_types(('none',)) + has_no_hi = self.screen.has_insurance_types(("none",)) e.condition(has_no_hi, messages.has_no_insurance()) # Medicade eligibility diff --git a/programs/programs/co/reproductive_health_care/tests.py b/programs/programs/co/reproductive_health_care/tests.py index 10fd1ad3..76ee25a5 100644 --- a/programs/programs/co/reproductive_health_care/tests.py +++ b/programs/programs/co/reproductive_health_care/tests.py @@ -30,9 +30,7 @@ def setUp(self): ) def test_reproductive_health_care_pass_all_conditions(self): - rhc = ReproductiveHealthCare( - self.screen1, [{"name_abbreviated": "medicaid", "eligible": True}] - ) + rhc = ReproductiveHealthCare(self.screen1, [{"name_abbreviated": "medicaid", "eligible": True}]) eligibility = rhc.eligibility self.assertTrue(eligibility["eligible"]) @@ -41,9 +39,7 @@ def test_reproductive_health_care_failed_all_conditions(self): self.person1.has_no_hi = False self.person1.save() - rhc = ReproductiveHealthCare( - self.screen1, [{"name_abbreviated": "medicaid", "eligible": False}] - ) + rhc = ReproductiveHealthCare(self.screen1, [{"name_abbreviated": "medicaid", "eligible": False}]) eligibility = rhc.eligibility self.assertFalse(eligibility["eligible"]) diff --git a/programs/programs/co/rtdlive/calculator.py b/programs/programs/co/rtdlive/calculator.py index d7e43ee3..b8be8c4b 100644 --- a/programs/programs/co/rtdlive/calculator.py +++ b/programs/programs/co/rtdlive/calculator.py @@ -6,20 +6,20 @@ class RtdLive(ProgramCalculator): eligible_counties = [ - 'Adams County', - 'Arapahoe County', - 'Boulder County', - 'Broomfield County', - 'Denver County', - 'Douglas County', - 'Jefferson County' + "Adams County", + "Arapahoe County", + "Boulder County", + "Broomfield County", + "Denver County", + "Douglas County", + "Jefferson County", ] min_age = 20 max_age = 64 percent_of_fpl = 2.5 tax_unit_dependent = True amount = 732 - dependencies = ['age', 'income_amount', 'income_frequency', 'zipcode', 'household_size'] + dependencies = ["age", "income_amount", "income_frequency", "zipcode", "household_size"] def eligible(self) -> Eligibility: e = Eligibility() @@ -30,7 +30,7 @@ def eligible(self) -> Eligibility: # income frequency = "yearly" - income_types = ['all'] + income_types = ["all"] fpl = self.program.fpl.as_dict() income_limit = RtdLive.percent_of_fpl * fpl[len(members)] @@ -48,7 +48,7 @@ def eligible(self) -> Eligibility: lambda m: m.age >= RtdLive.min_age and m.age <= RtdLive.max_age, messages.adult(RtdLive.min_age, RtdLive.max_age), ), - ] + ], ) # geography diff --git a/programs/programs/co/tabor/calculator.py b/programs/programs/co/tabor/calculator.py index fbacb075..ea1e4006 100644 --- a/programs/programs/co/tabor/calculator.py +++ b/programs/programs/co/tabor/calculator.py @@ -5,16 +5,14 @@ class Tabor(ProgramCalculator): min_age = 18 amount = 800 - dependencies = ['age'] + dependencies = ["age"] def eligible(self) -> Eligibility: e = Eligibility() e.member_eligibility( self.screen.household_members.all(), - [ - (lambda m: m.age >= Tabor.min_age, messages.older_than(Tabor.min_age)) - ] + [(lambda m: m.age >= Tabor.min_age, messages.older_than(Tabor.min_age))], ) return e diff --git a/programs/programs/co/trua/calculator.py b/programs/programs/co/trua/calculator.py index 33057c53..396dbfcf 100644 --- a/programs/programs/co/trua/calculator.py +++ b/programs/programs/co/trua/calculator.py @@ -15,16 +15,16 @@ class Trua(ProgramCalculator): 8: 124_950, } - county = 'Denver County' + county = "Denver County" amount = 6_500 - dependencies = ['income_amount', 'income_frequency', 'household_size', 'zipcode'] + dependencies = ["income_amount", "income_frequency", "household_size", "zipcode"] def eligible(self) -> Eligibility: e = Eligibility() # Income test gross_income = int(self.screen.calc_gross_income("monthly", ["all"])) - income_limit = int(Trua.income_limit[self.screen.household_size]/12) + income_limit = int(Trua.income_limit[self.screen.household_size] / 12) # Location test zipcode = self.screen.zipcode diff --git a/programs/programs/co/universal_preschool/calculator.py b/programs/programs/co/universal_preschool/calculator.py index 0916f97e..5e1241a6 100644 --- a/programs/programs/co/universal_preschool/calculator.py +++ b/programs/programs/co/universal_preschool/calculator.py @@ -6,12 +6,8 @@ class UniversalPreschool(ProgramCalculator): qualifying_age = 3 age = 4 percent_of_fpl = 2.7 - amount = { - '10_hours': 4_837, - '15_hours': 6_044, - '30_hours': 10_655 - } - dependencies = ['age', 'income_amount', 'income_frequency', 'relationship', 'household_size'] + amount = {"10_hours": 4_837, "15_hours": 6_044, "30_hours": 10_655} + dependencies = ["age", "income_amount", "income_frequency", "relationship", "household_size"] def eligible(self) -> Eligibility: e = Eligibility() @@ -19,7 +15,7 @@ def eligible(self) -> Eligibility: foster_children = self.screen.num_children( age_min=UniversalPreschool.qualifying_age, age_max=UniversalPreschool.age, - child_relationship=['fosterChild'] + child_relationship=["fosterChild"], ) income_requirement = self._meets_income_requirement() @@ -28,15 +24,14 @@ def eligible(self) -> Eligibility: # Has child children = self.screen.num_children(age_min=UniversalPreschool.age, age_max=UniversalPreschool.age) qualifying_children = self.screen.num_children( - age_min=UniversalPreschool.qualifying_age, - age_max=UniversalPreschool.age + age_min=UniversalPreschool.qualifying_age, age_max=UniversalPreschool.age ) min_age = UniversalPreschool.qualifying_age if other_factors else UniversalPreschool.age e.condition( children >= 1 or (qualifying_children >= 1 and other_factors), - messages.child(min_age, UniversalPreschool.age) + messages.child(min_age, UniversalPreschool.age), ) return e @@ -48,17 +43,17 @@ def value(self, eligible_members: int): for child in self.screen.household_members.filter( age__range=(UniversalPreschool.qualifying_age, UniversalPreschool.age) ): - if child.relationship == 'fosterChild' or income_requirement: + if child.relationship == "fosterChild" or income_requirement: if child.age == 3: - value += UniversalPreschool.amount['10_hours'] + value += UniversalPreschool.amount["10_hours"] else: - value += UniversalPreschool.amount['30_hours'] + value += UniversalPreschool.amount["30_hours"] else: - value += UniversalPreschool.amount['15_hours'] + value += UniversalPreschool.amount["15_hours"] return value def _meets_income_requirement(self): fpl = self.program.fpl.as_dict() income_limit = int(UniversalPreschool.percent_of_fpl * fpl[self.screen.household_size]) - return self.screen.calc_gross_income('yearly', ['all']) < income_limit + return self.screen.calc_gross_income("yearly", ["all"]) < income_limit diff --git a/programs/programs/co/utility_bill_pay/calculator.py b/programs/programs/co/utility_bill_pay/calculator.py index e93169bd..f47b513c 100644 --- a/programs/programs/co/utility_bill_pay/calculator.py +++ b/programs/programs/co/utility_bill_pay/calculator.py @@ -13,9 +13,9 @@ class UtilityBillPay(ProgramCalculator): 96_014, 101_120, ) - presumptive_eligibility = ('snap', 'ssi', 'andcs', 'tanf', 'wic') + presumptive_eligibility = ("snap", "ssi", "andcs", "tanf", "wic") amount = 350 - dependencies = ['household_size', 'income_amount', 'income_frequency'] + dependencies = ["household_size", "income_amount", "income_frequency"] def eligible(self) -> Eligibility: e = Eligibility() @@ -27,7 +27,7 @@ def eligible(self) -> Eligibility: presumptive_eligible = True # income - income = int(self.screen.calc_gross_income('yearly', ['all'])) + income = int(self.screen.calc_gross_income("yearly", ["all"])) income_limit = UtilityBillPay.income_limits[self.screen.household_size - 1] e.condition(income < income_limit or presumptive_eligible, messages.income(income, income_limit)) diff --git a/programs/programs/co/weatherization_assistance/calculator.py b/programs/programs/co/weatherization_assistance/calculator.py index 596d2b48..2f8190dc 100644 --- a/programs/programs/co/weatherization_assistance/calculator.py +++ b/programs/programs/co/weatherization_assistance/calculator.py @@ -13,16 +13,16 @@ class WeatherizationAssistance(ProgramCalculator): 96_014, 101_120, ) - presumptive_eligibility = ('andcs', 'ssi', 'snap', 'leap', 'tanf') + presumptive_eligibility = ("andcs", "ssi", "snap", "leap", "tanf") amount = 350 - dependencies = ['household_size', 'income_amount', 'income_frequency'] + dependencies = ["household_size", "income_amount", "income_frequency"] def eligible(self) -> Eligibility: e = Eligibility() # income condition income_limit = WeatherizationAssistance.income_limits[self.screen.household_size - 1] - income = int(self.screen.calc_gross_income('yearly', ['all'])) + income = int(self.screen.calc_gross_income("yearly", ["all"])) income_eligible = income <= income_limit # categorical eligibility diff --git a/programs/programs/federal/__init__.py b/programs/programs/federal/__init__.py index b8f23164..60fd00ab 100644 --- a/programs/programs/federal/__init__.py +++ b/programs/programs/federal/__init__.py @@ -4,7 +4,7 @@ from ..calc import ProgramCalculator federal_calculators: dict[str, type[ProgramCalculator]] = { - 'ssdi': Ssdi, - 'chs': HeadStart, - 'medicare_savings': MedicareSavings, + "ssdi": Ssdi, + "chs": HeadStart, + "medicare_savings": MedicareSavings, } diff --git a/programs/programs/federal/head_start/calculator.py b/programs/programs/federal/head_start/calculator.py index 2e343d80..d9f5dec9 100644 --- a/programs/programs/federal/head_start/calculator.py +++ b/programs/programs/federal/head_start/calculator.py @@ -8,9 +8,9 @@ class HeadStart(ProgramCalculator): amount = 10655 max_age = 5 min_age = 3 - adams_percent_of_fpl = 1.3 # Adams County uses 130% FPL instead of 100% FPL - adams_county = 'Adams County' - dependencies = ['age', 'household_size', 'income_frequency', 'income_amount', 'zipcode'] + adams_percent_of_fpl = 1.3 # Adams County uses 130% FPL instead of 100% FPL + adams_county = "Adams County" + dependencies = ["age", "household_size", "income_frequency", "income_amount", "zipcode"] def eligible(self) -> Eligibility: e = Eligibility() @@ -33,17 +33,19 @@ def eligible(self) -> Eligibility: break e.condition(in_eligible_county, messages.location()) - + in_adams = HeadStart.adams_county in counties # income fpl = self.program.fpl.as_dict() income_limit = int(fpl[self.screen.household_size] / 12) income_limit_adams_county = int(fpl[self.screen.household_size] / 12 * HeadStart.adams_percent_of_fpl) - gross_income = int(self.screen.calc_gross_income('monthly', ['all'])) + gross_income = int(self.screen.calc_gross_income("monthly", ["all"])) if in_adams: - e.condition(gross_income < income_limit_adams_county, messages.income(gross_income, income_limit_adams_county)) + e.condition( + gross_income < income_limit_adams_county, messages.income(gross_income, income_limit_adams_county) + ) else: e.condition(gross_income < income_limit, messages.income(gross_income, income_limit)) diff --git a/programs/programs/federal/head_start/eligible_zipcodes.py b/programs/programs/federal/head_start/eligible_zipcodes.py index 1b643547..d24b33c5 100644 --- a/programs/programs/federal/head_start/eligible_zipcodes.py +++ b/programs/programs/federal/head_start/eligible_zipcodes.py @@ -1,40 +1,40 @@ eligible_zipcode = [ - 'Adams County', - 'Alamosa County', - 'Arapahoe County', - 'Archuleta County', - 'Bent County', - 'Boulder County', - 'Chaffee County', - 'Conejos County', - 'Costilla County', - 'Delta County', - 'Denver County', - 'Eagle County', - 'El Paso County', - 'Fremont County', - 'Garfield County', - 'Huerfano County', - 'Jefferson County', - 'La Plata County', - 'Lake County', - 'Larimer County', - 'Las Animas County', - 'Lincoln County', - 'Logan County', - 'Mesa County', - 'Moffat County', - 'Montezuma County', - 'Montrose County', - 'Morgan County', - 'Otero County', - 'Prowers County', - 'Pueblo County', - 'Rio Grande County', - 'Saguache County', - 'Summit County', - 'Teller County', - 'Washington County', - 'Weld County', - 'Yuma County', + "Adams County", + "Alamosa County", + "Arapahoe County", + "Archuleta County", + "Bent County", + "Boulder County", + "Chaffee County", + "Conejos County", + "Costilla County", + "Delta County", + "Denver County", + "Eagle County", + "El Paso County", + "Fremont County", + "Garfield County", + "Huerfano County", + "Jefferson County", + "La Plata County", + "Lake County", + "Larimer County", + "Las Animas County", + "Lincoln County", + "Logan County", + "Mesa County", + "Moffat County", + "Montezuma County", + "Montrose County", + "Morgan County", + "Otero County", + "Prowers County", + "Pueblo County", + "Rio Grande County", + "Saguache County", + "Summit County", + "Teller County", + "Washington County", + "Weld County", + "Yuma County", ] diff --git a/programs/programs/federal/head_start/tests.py b/programs/programs/federal/head_start/tests.py index 89c7866c..0e8ce00b 100644 --- a/programs/programs/federal/head_start/tests.py +++ b/programs/programs/federal/head_start/tests.py @@ -7,14 +7,14 @@ class TestHeadStartPension(TestCase): def setUp(self): self.screen1 = Screen.objects.create( agree_to_tos=True, - zipcode='80205', - county='Denver County', + zipcode="80205", + county="Denver County", household_size=2, household_assets=0, ) self.person1 = HouseholdMember.objects.create( screen=self.screen1, - relationship='headOfHousehold', + relationship="headOfHousehold", age=30, student=False, student_full_time=False, @@ -29,7 +29,7 @@ def setUp(self): ) self.person2 = HouseholdMember.objects.create( screen=self.screen1, - relationship='child', + relationship="child", age=4, student=False, student_full_time=False, @@ -51,17 +51,13 @@ def test_head_start_visually_impaired_is_eligible(self): def test_head_start_failed_all_conditions(self): income = IncomeStream.objects.create( - screen=self.screen1, - household_member=self.person1, - type='wages', - amount=2000, - frequency='monthly' + screen=self.screen1, household_member=self.person1, type="wages", amount=2000, frequency="monthly" ) self.screen1.save() - self.person2.age=6 + self.person2.age = 6 self.person2.save() chs = HeadStart(self.screen1) eligibility = chs.eligibility - self.assertFalse(eligibility["eligible"]) \ No newline at end of file + self.assertFalse(eligibility["eligible"]) diff --git a/programs/programs/federal/medicare_savings/calculator.py b/programs/programs/federal/medicare_savings/calculator.py index 0803e45f..b3ef1177 100644 --- a/programs/programs/federal/medicare_savings/calculator.py +++ b/programs/programs/federal/medicare_savings/calculator.py @@ -3,18 +3,18 @@ class MedicareSavings(ProgramCalculator): - valid_insurance = ('none', 'employer', 'private', 'medicare') + valid_insurance = ("none", "employer", "private", "medicare") asset_limit = { - 'single': 10_930, - 'married': 17_130, + "single": 10_930, + "married": 17_130, } income_limit = { - 'single': 1_715, - 'married': 2_320, + "single": 1_715, + "married": 2_320, } min_age = 65 amount = 175 - dependencies = ['household_assets', 'relationship', 'income_frequency', 'income_amount', 'age'] + dependencies = ["household_assets", "relationship", "income_frequency", "income_amount", "age"] def eligible(self) -> Eligibility: e = Eligibility() @@ -22,19 +22,19 @@ def eligible(self) -> Eligibility: members = self.screen.household_members.all() def asset_limit(member): - status = 'married' if member.is_married()['is_married'] else 'single' + status = "married" if member.is_married()["is_married"] else "single" return self.screen.household_assets < MedicareSavings.asset_limit[status] def income_limit(member): is_married = member.is_married() - if not is_married['is_married']: - status = 'single' + if not is_married["is_married"]: + status = "single" spouse_income = 0 else: - status = 'married' - spouse_income = is_married['married_to'].calc_gross_income('monthly', ('all',)) + status = "married" + spouse_income = is_married["married_to"].calc_gross_income("monthly", ("all",)) max_income = MedicareSavings.income_limit[status] - income = member.calc_gross_income('monthly', ('all',)) + spouse_income + income = member.calc_gross_income("monthly", ("all",)) + spouse_income return income < max_income e.member_eligibility( @@ -43,11 +43,11 @@ def income_limit(member): (lambda m: m.age >= MedicareSavings.min_age, messages.older_than(MedicareSavings.min_age)), ( lambda m: m.insurance.has_insurance_types(MedicareSavings.valid_insurance), - messages.has_no_insurance() + messages.has_no_insurance(), ), (asset_limit, None), - (income_limit, None) - ] + (income_limit, None), + ], ) return e diff --git a/programs/programs/federal/pe/__init__.py b/programs/programs/federal/pe/__init__.py index 5416e2db..bafc4afa 100644 --- a/programs/programs/federal/pe/__init__.py +++ b/programs/programs/federal/pe/__init__.py @@ -5,22 +5,22 @@ federal_member_calculators = { - 'wic': member.Wic, - 'pell_grant': member.PellGrant, - 'ssi': member.Ssi, + "wic": member.Wic, + "pell_grant": member.PellGrant, + "ssi": member.Ssi, } federal_spm_unit_calculators = { - 'acp': spm.Acp, - 'lifeline': spm.Lifeline, - 'nslp': spm.SchoolLunch, - 'snap': spm.Snap, - 'tanf': spm.Tanf, + "acp": spm.Acp, + "lifeline": spm.Lifeline, + "nslp": spm.SchoolLunch, + "snap": spm.Snap, + "tanf": spm.Tanf, } federal_tax_unit_calculators = { - 'eitc': tax.Eitc, - 'ctc': tax.Ctc, + "eitc": tax.Eitc, + "ctc": tax.Ctc, } federal_pe_calculators: dict[str, type[PolicyEngineCalulator]] = { @@ -28,4 +28,3 @@ **federal_spm_unit_calculators, **federal_tax_unit_calculators, } - diff --git a/programs/programs/federal/pe/member.py b/programs/programs/federal/pe/member.py index e6d842fb..7bd6141d 100644 --- a/programs/programs/federal/pe/member.py +++ b/programs/programs/federal/pe/member.py @@ -4,14 +4,14 @@ class Wic(PolicyEngineMembersCalculator): wic_categories = { - 'NONE': 0, - 'INFANT': 130, - 'CHILD': 74, + "NONE": 0, + "INFANT": 130, + "CHILD": 74, "PREGNANT": 100, "POSTPARTUM": 100, "BREASTFEEDING": 100, } - pe_name = 'wic' + pe_name = "wic" pe_inputs = [ dependency.member.PregnancyDependency, dependency.member.AgeDependency, @@ -25,14 +25,14 @@ def value(self): for member in self.screen.household_members.all(): if self.get_member_variable(member.id) > 0: - wic_category = self.sim.value('people', str(member.id), 'wic_category', self.pe_period) + wic_category = self.sim.value("people", str(member.id), "wic_category", self.pe_period) total += self.wic_categories[wic_category] * 12 return total class Medicaid(PolicyEngineMembersCalculator): - pe_name = 'medicaid' + pe_name = "medicaid" pe_inputs = [ dependency.member.AgeDependency, dependency.member.PregnancyDependency, @@ -94,19 +94,21 @@ def value(self): if member.pregnant is True or member.age <= 5: in_wic_demographic = True if total == 0 and in_wic_demographic: - if self.screen.has_benefit('medicaid') is True \ - or self.screen.has_benefit('tanf') is True \ - or self.screen.has_benefit('snap') is True: + if ( + self.screen.has_benefit("medicaid") is True + or self.screen.has_benefit("tanf") is True + or self.screen.has_benefit("snap") is True + ): total = self.presumptive_amount return total def _get_age(self, member_id: int) -> int: - return self.sim.value(self.pe_category, str(member_id), 'age', self.pe_period) + return self.sim.value(self.pe_category, str(member_id), "age", self.pe_period) class PellGrant(PolicyEngineMembersCalculator): - pe_name = 'pell_grant' + pe_name = "pell_grant" pe_inputs = [ dependency.member.PellGrantDependentAvailableIncomeDependency, dependency.member.PellGrantCountableAssetsDependency, @@ -122,7 +124,7 @@ class PellGrant(PolicyEngineMembersCalculator): class Ssi(PolicyEngineMembersCalculator): - pe_name = 'ssi' + pe_name = "ssi" pe_inputs = [ dependency.member.SsiCountableResourcesDependency, dependency.member.SsiReportedDependency, @@ -136,4 +138,3 @@ class Ssi(PolicyEngineMembersCalculator): dependency.member.TaxUnitDependentDependency, ] pe_outputs = [dependency.member.Ssi] - diff --git a/programs/programs/federal/pe/spm.py b/programs/programs/federal/pe/spm.py index c312d267..b55f229f 100644 --- a/programs/programs/federal/pe/spm.py +++ b/programs/programs/federal/pe/spm.py @@ -4,7 +4,7 @@ class Snap(PolicyEngineSpmCalulator): - pe_name = 'snap' + pe_name = "snap" pe_inputs = [ dependency.spm.SnapChildSupportDeductionDependency, dependency.spm.SnapGrossIncomeDependency, @@ -29,7 +29,7 @@ def value(self): class SchoolLunch(PolicyEngineSpmCalulator): - pe_name = 'school_meal_daily_subsidy' + pe_name = "school_meal_daily_subsidy" pe_inputs = dependency.school_lunch_income pe_outputs = [dependency.spm.SchoolMealDailySubsidy, dependency.spm.SchoolMealTier] @@ -40,14 +40,14 @@ def value(self): num_children = self.screen.num_children(3, 18) if self.get_variable() > 0 and num_children > 0: - if self.sim.value(self.pe_category, self.pe_sub_category, 'school_meal_tier', self.pe_period) != 'PAID': + if self.sim.value(self.pe_category, self.pe_sub_category, "school_meal_tier", self.pe_period) != "PAID": total = SchoolLunch.amount * num_children return total class Tanf(PolicyEngineSpmCalulator): - pe_name = 'co_tanf' + pe_name = "co_tanf" pe_inputs = [ dependency.member.AgeDependency, dependency.member.PregnancyDependency, @@ -59,7 +59,7 @@ class Tanf(PolicyEngineSpmCalulator): class Acp(PolicyEngineSpmCalulator): - pe_name = 'acp' + pe_name = "acp" pe_inputs = [ dependency.spm.BroadbandCostDependency, *dependency.irs_gross_income, @@ -68,7 +68,7 @@ class Acp(PolicyEngineSpmCalulator): class Lifeline(PolicyEngineSpmCalulator): - pe_name = 'lifeline' + pe_name = "lifeline" pe_inputs = [ dependency.spm.BroadbandCostDependency, *dependency.irs_gross_income, diff --git a/programs/programs/federal/pe/tax.py b/programs/programs/federal/pe/tax.py index b7e63e8c..ceb6673e 100644 --- a/programs/programs/federal/pe/tax.py +++ b/programs/programs/federal/pe/tax.py @@ -3,7 +3,7 @@ class Eitc(PolicyEngineTaxUnitCalulator): - pe_name = 'eitc' + pe_name = "eitc" pe_inputs = [ dependency.member.AgeDependency, dependency.member.TaxUnitSpouseDependency, @@ -13,9 +13,8 @@ class Eitc(PolicyEngineTaxUnitCalulator): pe_outputs = [dependency.tax.Eitc] - class Ctc(PolicyEngineTaxUnitCalulator): - pe_name = 'ctc' + pe_name = "ctc" pe_inputs = [ dependency.member.AgeDependency, dependency.member.TaxUnitDependentDependency, @@ -23,5 +22,3 @@ class Ctc(PolicyEngineTaxUnitCalulator): *dependency.irs_gross_income, ] pe_outputs = [dependency.tax.Ctc] - - diff --git a/programs/programs/federal/ssdi/calculator.py b/programs/programs/federal/ssdi/calculator.py index 031e742f..b7472fb0 100644 --- a/programs/programs/federal/ssdi/calculator.py +++ b/programs/programs/federal/ssdi/calculator.py @@ -7,7 +7,7 @@ class Ssdi(ProgramCalculator): income_limit = 1_550 income_limit_blind = 2_590 amount = 1_537 - dependencies = ['income_amount', 'income_frequency', 'household_size'] + dependencies = ["income_amount", "income_frequency", "household_size"] def eligible(self) -> Eligibility: e = Eligibility() @@ -20,7 +20,7 @@ def income_condition(member): nonlocal cat_eligibile income_limit = Ssdi.income_limit_blind if member.visually_impaired else Ssdi.income_limit - member_income = member.calc_gross_income('monthly', ('all',)) + member_income = member.calc_gross_income("monthly", ("all",)) if member_income < lowest_income: lowest_income = member_income @@ -30,10 +30,7 @@ def income_condition(member): e.member_eligibility( self.screen.household_members.all(), - [ - (lambda m: m.has_disability(), messages.has_disability()), - (income_condition, None) - ] + [(lambda m: m.has_disability(), messages.has_disability()), (income_condition, None)], ) if cat_eligibile > 0: diff --git a/programs/programs/messages.py b/programs/programs/messages.py index 49f18f07..0ab02d29 100644 --- a/programs/programs/messages.py +++ b/programs/programs/messages.py @@ -1,118 +1,98 @@ def translation(name, i, message): - return { - 'default_message': message, - 'label': f'eligibility_message.{name}-{i}' - } + return {"default_message": message, "label": f"eligibility_message.{name}-{i}"} def income(income, max_income): - ''' + """ Household makes ${income} per year which must be less than ${max_income} - ''' + """ return ( - translation('income', 0, 'Household makes'), - f' ${round(income)} ', - translation('income', 1, 'per year which must be less than'), - f' ${round(max_income)}' + translation("income", 0, "Household makes"), + f" ${round(income)} ", + translation("income", 1, "per year which must be less than"), + f" ${round(max_income)}", ) def assets(asset_limit): - ''' + """ Household resources must not exceed ${asset_limit} - ''' - return ( - translation('assets', 0, 'Household resources must not exceed'), - f' ${round(asset_limit)}' - ) + """ + return (translation("assets", 0, "Household resources must not exceed"), f" ${round(asset_limit)}") def child(min_age=0, max_age=18): - ''' + """ Must have a child between the ages of {min_age} and {max_age} - ''' + """ return ( - translation('child', 0, 'Must have a child between the ages of'), - f' {min_age} ', - translation('child', 1, 'and'), - f' {max_age}' + translation("child", 0, "Must have a child between the ages of"), + f" {min_age} ", + translation("child", 1, "and"), + f" {max_age}", ) def adult(min_age, max_age): - ''' + """ Someone in the household must be between the ages of {min_age} and {max_age} - ''' + """ return ( - translation('adult', 0, 'Someone in the household must be between the ages of'), - f' {min_age} ', - translation('adult', 1, 'and'), - f' {max_age}' + translation("adult", 0, "Someone in the household must be between the ages of"), + f" {min_age} ", + translation("adult", 1, "and"), + f" {max_age}", ) def older_than(min_age): - ''' + """ Someone in the household must be at least {min_age} years old - ''' + """ return ( - translation('older_than', 0, 'Someone in the household must be at least'), - f' {min_age} ', - translation('older_than', 1, 'years old') + translation("older_than", 0, "Someone in the household must be at least"), + f" {min_age} ", + translation("older_than", 1, "years old"), ) def must_have_benefit(benefit_name): - ''' + """ Household must have {benefit_name} - ''' - return ( - translation('has_benefit', 0, 'Household must have'), - f' {benefit_name}' - ) + """ + return (translation("has_benefit", 0, "Household must have"), f" {benefit_name}") def must_not_have_benefit(benefit_name): - ''' + """ Household must not have {benefit_name} - ''' - return ( - translation('not_have_benefit', 0, 'Household must not have'), - f' {benefit_name}' - ) + """ + return (translation("not_have_benefit", 0, "Household must not have"), f" {benefit_name}") def location(): - ''' + """ Must live in an eligible location - ''' - return ( - translation('location', 0, 'Must live in an eligible location'), - ) + """ + return (translation("location", 0, "Must live in an eligible location"),) def has_disability(): - ''' + """ Someone in the household must have a disability - ''' - return ( - translation('disability', 0, 'Someone in the household must have a disability'), - ) + """ + return (translation("disability", 0, "Someone in the household must have a disability"),) def has_no_insurance(): - ''' + """ Someone in the household must not have health insurance - ''' - return ( - translation('no_insurance', 0, 'Someone in the household must not have health insurance'), - ) + """ + return (translation("no_insurance", 0, "Someone in the household must not have health insurance"),) def is_pregnant(): - ''' + """ Someone in the household must be pregnant - ''' - return ( - translation('pregnant', 0, 'Someone in the household must be pregnant'), - ) + """ + return (translation("pregnant", 0, "Someone in the household must be pregnant"),) diff --git a/programs/programs/nc/pe/__init__.py b/programs/programs/nc/pe/__init__.py index 9d323c10..9a7fb52d 100644 --- a/programs/programs/nc/pe/__init__.py +++ b/programs/programs/nc/pe/__init__.py @@ -3,11 +3,10 @@ nc_member_calculators = { - 'nc_medicaid': member.NcMedicaid, + "nc_medicaid": member.NcMedicaid, } nc_pe_calculators: dict[str, type[PolicyEngineCalulator]] = { **nc_member_calculators, } - diff --git a/programs/programs/nc/pe/member.py b/programs/programs/nc/pe/member.py index b9e9ddf9..053e0b5a 100644 --- a/programs/programs/nc/pe/member.py +++ b/programs/programs/nc/pe/member.py @@ -3,11 +3,11 @@ class NcMedicaid(Medicaid): - child_medicaid_average = 200 * 12 # TODO: NC specific average goes here - adult_medicaid_average = 310 * 12 # TODO: NC specific average goes here - aged_medicaid_average = 170 * 12 # TODO: NC specific average goes here + child_medicaid_average = 200 * 12 # TODO: NC specific average goes here + adult_medicaid_average = 310 * 12 # TODO: NC specific average goes here + aged_medicaid_average = 170 * 12 # TODO: NC specific average goes here pe_inputs = [ - *Medicaid.pe_inputs, + *Medicaid.pe_inputs, dependency.household.NcStateCode, ] @@ -15,4 +15,3 @@ class NcMedicaid(Medicaid): # def value(self): # ... # return 500 - diff --git a/programs/programs/policyengine/calculators/__init__.py b/programs/programs/policyengine/calculators/__init__.py index 6ecf236c..7adce32a 100644 --- a/programs/programs/policyengine/calculators/__init__.py +++ b/programs/programs/policyengine/calculators/__init__.py @@ -1,7 +1,16 @@ -from programs.programs.federal.pe import federal_member_calculators, federal_spm_unit_calculators, federal_tax_unit_calculators +from programs.programs.federal.pe import ( + federal_member_calculators, + federal_spm_unit_calculators, + federal_tax_unit_calculators, +) from programs.programs.co.pe import co_member_calculators, co_tax_unit_calculators from programs.programs.nc.pe import nc_member_calculators -from .base import PolicyEngineMembersCalculator, PolicyEngineSpmCalulator, PolicyEngineTaxUnitCalulator, PolicyEngineCalulator +from .base import ( + PolicyEngineMembersCalculator, + PolicyEngineSpmCalulator, + PolicyEngineTaxUnitCalulator, + PolicyEngineCalulator, +) all_member_calculators: dict[str, type[PolicyEngineMembersCalculator]] = { @@ -26,4 +35,3 @@ } all_pe_programs = all_calculators.keys() - diff --git a/programs/programs/policyengine/calculators/base.py b/programs/programs/policyengine/calculators/base.py index 1eaea971..3754aafb 100644 --- a/programs/programs/policyengine/calculators/base.py +++ b/programs/programs/policyengine/calculators/base.py @@ -8,16 +8,16 @@ class PolicyEngineCalulator(ProgramCalculator): - ''' + """ Base class for all Policy Engine programs - ''' + """ pe_inputs: List[type[PolicyEngineScreenInput]] = [] pe_outputs: List[type[PolicyEngineScreenInput]] = [] - pe_name = '' - pe_category = '' - pe_sub_category = '' + pe_name = "" + pe_category = "" + pe_sub_category = "" pe_period = YEAR def __init__(self, screen: Screen, sim: Sim): @@ -35,9 +35,9 @@ def value(self): return int(self.get_variable()) def get_variable(self): - ''' + """ Return value of the default variable - ''' + """ return self.sim.value(self.pe_category, self.pe_sub_category, self.pe_name, self.pe_period) @classmethod @@ -50,20 +50,20 @@ def can_calc(cls, missing_dependencies: Dependencies): class PolicyEngineTaxUnitCalulator(PolicyEngineCalulator): - pe_category = 'tax_units' - pe_sub_category = 'tax_unit' + pe_category = "tax_units" + pe_sub_category = "tax_unit" tax_unit_dependent = True pe_period = PREVIOUS_YEAR class PolicyEngineSpmCalulator(PolicyEngineCalulator): - pe_category = 'spm_units' - pe_sub_category = 'spm_unit' + pe_category = "spm_units" + pe_sub_category = "spm_unit" class PolicyEngineMembersCalculator(PolicyEngineCalulator): tax_unit_dependent = True - pe_category = 'people' + pe_category = "people" def value(self): total = 0 @@ -80,8 +80,7 @@ def value(self): return total def in_tax_unit(self, member_id: int) -> bool: - return str(member_id) in self.sim.members('tax_units', 'tax_unit') + return str(member_id) in self.sim.members("tax_units", "tax_unit") def get_member_variable(self, member_id: int): return self.sim.value(self.pe_category, str(member_id), self.pe_name, self.pe_period) - diff --git a/programs/programs/policyengine/calculators/constants.py b/programs/programs/policyengine/calculators/constants.py index 2143bb25..11af220f 100644 --- a/programs/programs/policyengine/calculators/constants.py +++ b/programs/programs/policyengine/calculators/constants.py @@ -2,6 +2,6 @@ # Medicaid # CHP+ -YEAR = '2024' -PREVIOUS_YEAR = '2023' -SNAP_PERIOD = '2024-01' +YEAR = "2024" +PREVIOUS_YEAR = "2023" +SNAP_PERIOD = "2024-01" diff --git a/programs/programs/policyengine/calculators/dependencies/base.py b/programs/programs/policyengine/calculators/dependencies/base.py index 7c571fec..ca8536ca 100644 --- a/programs/programs/policyengine/calculators/dependencies/base.py +++ b/programs/programs/policyengine/calculators/dependencies/base.py @@ -3,14 +3,14 @@ class PolicyEngineScreenInput: - ''' + """ Base class for all Policy Engine dependencies - ''' + """ member = False - unit = '' - sub_unit = '' - field = '' + unit = "" + sub_unit = "" + field = "" dependencies = tuple() def __init__(self, screen: Screen, members: List[HouseholdMember], relationship_map): @@ -19,45 +19,45 @@ def __init__(self, screen: Screen, members: List[HouseholdMember], relationship_ self.relationship_map = relationship_map def value(self): - ''' + """ Return the value to send to Policy Engine - ''' + """ return None class Household(PolicyEngineScreenInput): - ''' + """ Base class for all household unit Policy Engine dependencies - ''' + """ - unit = 'households' - sub_unit = 'household' + unit = "households" + sub_unit = "household" class TaxUnit(PolicyEngineScreenInput): - ''' + """ Base class for all tax unit Policy Engine dependencies - ''' + """ - unit = 'tax_units' - sub_unit = 'tax_unit' + unit = "tax_units" + sub_unit = "tax_unit" class SpmUnit(PolicyEngineScreenInput): - ''' + """ Base class for all spm unit Policy Engine dependencies - ''' + """ - unit = 'spm_units' - sub_unit = 'spm_unit' + unit = "spm_units" + sub_unit = "spm_unit" class Member(PolicyEngineScreenInput): - ''' + """ Base class for all member unit Policy Engine dependencies - ''' + """ - unit = 'people' + unit = "people" member = True def __init__(self, screen: Screen, member: HouseholdMember, relationship_map): @@ -70,9 +70,9 @@ def value(self): class DependencyError(Exception): - ''' + """ Dependency conflict error - ''' + """ def __init__(self, field, value_1, value_2) -> None: - super().__init__(f'Confilcting Policy Engine Dependencies in {field}: {value_1} and {value_2}') + super().__init__(f"Confilcting Policy Engine Dependencies in {field}: {value_1} and {value_2}") diff --git a/programs/programs/policyengine/calculators/dependencies/household.py b/programs/programs/policyengine/calculators/dependencies/household.py index 4b3e3149..be221dd0 100644 --- a/programs/programs/policyengine/calculators/dependencies/household.py +++ b/programs/programs/policyengine/calculators/dependencies/household.py @@ -2,17 +2,17 @@ class StateCode(Household): - field = 'state_code' + field = "state_code" - state = '' + state = "" def value(self): return self.state class CoStateCode(StateCode): - state = 'CO' + state = "CO" -class NcStateCode(StateCode): - state = 'NC' +class NcStateCode(StateCode): + state = "NC" diff --git a/programs/programs/policyengine/calculators/dependencies/member.py b/programs/programs/policyengine/calculators/dependencies/member.py index 273e8263..bc5e1d28 100644 --- a/programs/programs/policyengine/calculators/dependencies/member.py +++ b/programs/programs/policyengine/calculators/dependencies/member.py @@ -2,50 +2,50 @@ class AgeDependency(Member): - field = 'age' - dependencies = ('age',) + field = "age" + dependencies = ("age",) def value(self): return self.member.age class PregnancyDependency(Member): - field = 'is_pregnant' + field = "is_pregnant" def value(self): return self.member.pregnant or False class FullTimeCollegeStudentDependency(Member): - field = 'is_full_time_college_student' + field = "is_full_time_college_student" def value(self): return self.member.student or False class TaxUnitHeadDependency(Member): - field = 'is_tax_unit_head' - dependencies = ('relationship',) + field = "is_tax_unit_head" + dependencies = ("relationship",) def value(self): return self.member.is_head() class TaxUnitSpouseDependency(Member): - field = 'is_tax_unit_spouse' - dependencies = ('relationship',) + field = "is_tax_unit_spouse" + dependencies = ("relationship",) def value(self): return self.member.is_spouse() class TaxUnitDependentDependency(Member): - field = 'is_tax_unit_dependent' + field = "is_tax_unit_dependent" dependencies = ( - 'relationship', - 'age', - 'income_amount', - 'income_frequency', + "relationship", + "age", + "income_amount", + "income_frequency", ) def value(self): @@ -53,37 +53,37 @@ def value(self): class WicCategory(Member): - field = 'wic_category' + field = "wic_category" class Wic(Member): - field = 'wic' + field = "wic" class Medicaid(Member): - field = 'medicaid' + field = "medicaid" class Ssi(Member): - field = 'ssi' + field = "ssi" class IsDisabledDependency(Member): - field = 'is_disabled' + field = "is_disabled" def value(self): return self.member.disabled or self.member.long_term_disability class IsBlindDependency(Member): - field = 'is_blind' + field = "is_blind" def value(self): return self.member.visually_impaired class SsiReportedDependency(Member): - field = 'ssi_reported' + field = "ssi_reported" def value(self): # Policy Eninge uses this value for is_ssi_disabled, but it does not apply to MFB @@ -91,10 +91,10 @@ def value(self): class SsiCountableResourcesDependency(Member): - field = 'ssi_countable_resources' + field = "ssi_countable_resources" dependencies = ( - 'household_assets', - 'age', + "household_assets", + "age", ) def value(self): @@ -106,102 +106,102 @@ def value(self): class SsiAmountIfEligible(Member): - field = 'ssi_amount_if_eligible' + field = "ssi_amount_if_eligible" class Andcs(Member): - field = 'co_state_supplement' + field = "co_state_supplement" class Oap(Member): - field = 'co_oap' + field = "co_oap" class PellGrant(Member): - field = 'pell_grant' + field = "pell_grant" class PellGrantDependentAvailableIncomeDependency(Member): - field = 'pell_grant_dependent_available_income' + field = "pell_grant_dependent_available_income" dependencies = ( - 'income_type', - 'income_amount', - 'income_frequency', + "income_type", + "income_amount", + "income_frequency", ) def value(self): - return int(self.member.calc_gross_income('yearly', ['all'])) + return int(self.member.calc_gross_income("yearly", ["all"])) class PellGrantCountableAssetsDependency(Member): - field = 'pell_grant_countable_assets' - dependencies = ('household_assets',) + field = "pell_grant_countable_assets" + dependencies = ("household_assets",) def value(self): return int(self.screen.household_assets) class CostOfAttendingCollegeDependency(Member): - field = 'cost_of_attending_college' - dependencies = ('age',) + field = "cost_of_attending_college" + dependencies = ("age",) def value(self): return 22_288 * (self.member.age >= 16 and self.member.student) class PellGrantMonthsInSchoolDependency(Member): - field = 'pell_grant_months_in_school' + field = "pell_grant_months_in_school" def value(self): return 9 class ChpEligible(Member): - field = 'co_chp_eligible' + field = "co_chp_eligible" class IncomeDependency(Member): dependencies = ( - 'income_type', - 'income_amount', - 'income_frequency', + "income_type", + "income_amount", + "income_frequency", ) income_types = [] def value(self): - return int(self.member.calc_gross_income('yearly', self.income_types)) + return int(self.member.calc_gross_income("yearly", self.income_types)) class EmploymentIncomeDependency(IncomeDependency): - field = 'employment_income' - income_types = ['wages'] + field = "employment_income" + income_types = ["wages"] class SelfEmploymentIncomeDependency(IncomeDependency): - field = 'self_employment_income' - income_types = ['selfEmployment'] + field = "self_employment_income" + income_types = ["selfEmployment"] class RentalIncomeDependency(IncomeDependency): - field = 'rental_income' - income_types = ['rental'] + field = "rental_income" + income_types = ["rental"] class PensionIncomeDependency(IncomeDependency): - field = 'taxable_pension_income' - income_types = ['pension', 'veteran'] + field = "taxable_pension_income" + income_types = ["pension", "veteran"] class SocialSecurityIncomeDependency(IncomeDependency): - field = 'social_security' - income_types = ['sSDisability', 'sSSurvivor', 'sSRetirement', 'sSDependent'] + field = "social_security" + income_types = ["sSDisability", "sSSurvivor", "sSRetirement", "sSDependent"] class SsiEarnedIncomeDependency(IncomeDependency): - field = 'ssi_earned_income' - income_types = ['earned'] + field = "ssi_earned_income" + income_types = ["earned"] class SsiUnearnedIncomeDependency(IncomeDependency): - field = 'ssi_unearned_income' - income_types = ['unearned'] + field = "ssi_unearned_income" + income_types = ["unearned"] diff --git a/programs/programs/policyengine/calculators/dependencies/spm.py b/programs/programs/policyengine/calculators/dependencies/spm.py index ec142e8e..fa59adcd 100644 --- a/programs/programs/policyengine/calculators/dependencies/spm.py +++ b/programs/programs/policyengine/calculators/dependencies/spm.py @@ -3,40 +3,40 @@ class SnapChildSupportDeductionDependency(SpmUnit): - field = 'snap_child_support_deduction' + field = "snap_child_support_deduction" def value(self): - return self.screen.calc_expenses('yearly', ['childSupport']) + return self.screen.calc_expenses("yearly", ["childSupport"]) class SnapDependentCareDeductionDependency(SpmUnit): - field = 'childcare_expenses' + field = "childcare_expenses" def value(self): - return self.screen.calc_expenses('yearly', ['childCare']) + return self.screen.calc_expenses("yearly", ["childCare"]) class SnapEarnedIncomeDependency(SpmUnit): - field = 'snap_earned_income' + field = "snap_earned_income" dependencies = ( - 'income_type', - 'income_amount', - 'income_frequency', + "income_type", + "income_amount", + "income_frequency", ) def value(self): - return self.screen.calc_gross_income('yearly', ['earned']) + return self.screen.calc_gross_income("yearly", ["earned"]) class HousingCostDependency(SpmUnit): - field = 'housing_cost' + field = "housing_cost" def value(self): - return int(self.screen.calc_expenses('yearly', ['rent', 'mortgage'])) + return int(self.screen.calc_expenses("yearly", ["rent", "mortgage"])) class SnapAssetsDependency(SpmUnit): - field = 'snap_assets' + field = "snap_assets" def value(self): assets = self.screen.household_assets or 0 @@ -44,149 +44,145 @@ def value(self): class SnapGrossIncomeDependency(SpmUnit): - field = 'snap_gross_income' + field = "snap_gross_income" dependencies = ( - 'income_amount', - 'income_frequency', + "income_amount", + "income_frequency", ) def value(self): - return int(self.screen.calc_gross_income('yearly', ['all'])) + return int(self.screen.calc_gross_income("yearly", ["all"])) class MeetsSnapGrossIncomeTestDependency(SpmUnit): - field = 'meets_snap_gross_income_test' + field = "meets_snap_gross_income_test" dependencies = ( - 'income_amount', - 'income_frequency', - 'household_size', + "income_amount", + "income_frequency", + "household_size", ) def value(self): - fpl = FederalPoveryLimit.objects.get(year='THIS YEAR').as_dict() - snap_gross_income = self.screen.calc_gross_income('yearly', ['all']) + fpl = FederalPoveryLimit.objects.get(year="THIS YEAR").as_dict() + snap_gross_income = self.screen.calc_gross_income("yearly", ["all"]) snap_gross_limit = 2 * fpl[self.screen.household_size] return snap_gross_income < snap_gross_limit class MeetsSnapAssetTestDependency(SpmUnit): - field = 'meets_snap_asset_test' + field = "meets_snap_asset_test" def value(self): return True class MeetsSnapCategoricalEligibilityDependency(SpmUnit): - field = 'meets_snap_categorical_eligibility' + field = "meets_snap_categorical_eligibility" def value(self): return False class HasHeatingCoolingExpenseDependency(SpmUnit): - field = 'has_heating_cooling_expense' + field = "has_heating_cooling_expense" def value(self): - return self.screen.has_expense(['heating', 'cooling']) + return self.screen.has_expense(["heating", "cooling"]) class HasPhoneExpenseDependency(SpmUnit): - field = 'has_phone_expense' + field = "has_phone_expense" def value(self): - return self.screen.has_expense(['telephone']) + return self.screen.has_expense(["telephone"]) class UtilityExpenseDependency(SpmUnit): - field = 'utility_expense' + field = "utility_expense" def value(self): - return int( - self.screen.calc_expenses( - 'yearly', ['otherUtilities', 'heating', 'cooling'] - ) - ) + return int(self.screen.calc_expenses("yearly", ["otherUtilities", "heating", "cooling"])) class HeatingCoolingExpenseDependency(SpmUnit): - field = 'heating_cooling_expense' + field = "heating_cooling_expense" def value(self): - return self.screen.calc_expenses('yearly', ['heating', 'cooling']) + return self.screen.calc_expenses("yearly", ["heating", "cooling"]) class PhoneExpenseDependency(SpmUnit): - field = 'phone_expense' + field = "phone_expense" def value(self): - return self.screen.calc_expenses('yearly', ['telephone']) + return self.screen.calc_expenses("yearly", ["telephone"]) class ElectricityExpenseDependency(SpmUnit): - field = 'electricity_expense' + field = "electricity_expense" def value(self): - return self.screen.calc_expenses('yearly', ['otherUtilities']) + return self.screen.calc_expenses("yearly", ["otherUtilities"]) class SnapEmergencyAllotmentDependency(SpmUnit): - field = 'snap_emergency_allotment' + field = "snap_emergency_allotment" def value(self): return 0 class Snap(SpmUnit): - field = 'snap' + field = "snap" class Acp(SpmUnit): - field = 'acp' + field = "acp" class SchoolMealDailySubsidy(SpmUnit): - field = 'school_meal_daily_subsidy' + field = "school_meal_daily_subsidy" class SchoolMealTier(SpmUnit): - field = 'school_meal_tier' + field = "school_meal_tier" class Lifeline(SpmUnit): - field = 'lifeline' + field = "lifeline" class TanfCountableGrossIncomeDependency(SpmUnit): - field = 'co_tanf_countable_gross_earned_income' + field = "co_tanf_countable_gross_earned_income" dependencies = ( - 'income_type', - 'income_amount', - 'income_frequency', + "income_type", + "income_amount", + "income_frequency", ) def value(self): - return int(self.screen.calc_gross_income('yearly', ['earned'])) + return int(self.screen.calc_gross_income("yearly", ["earned"])) class TanfCountableGrossUnearnedIncomeDependency(SpmUnit): - field = 'co_tanf_countable_gross_unearned_income' + field = "co_tanf_countable_gross_unearned_income" dependencies = ( - 'income_type', - 'income_amount', - 'income_frequency', + "income_type", + "income_amount", + "income_frequency", ) def value(self): - return int(self.screen.calc_gross_income('yearly', ['unearned'])) + return int(self.screen.calc_gross_income("yearly", ["unearned"])) class Tanf(SpmUnit): - field = 'co_tanf' + field = "co_tanf" class BroadbandCostDependency(SpmUnit): - field = 'broadband_cost' + field = "broadband_cost" def value(self): return 500 diff --git a/programs/programs/policyengine/calculators/dependencies/tax.py b/programs/programs/policyengine/calculators/dependencies/tax.py index 95edfce6..76007591 100644 --- a/programs/programs/policyengine/calculators/dependencies/tax.py +++ b/programs/programs/policyengine/calculators/dependencies/tax.py @@ -3,26 +3,26 @@ class Eitc(TaxUnit): - field = 'eitc' + field = "eitc" class Coeitc(TaxUnit): - field = 'co_eitc' + field = "co_eitc" class Ctc(TaxUnit): - field = 'ctc' + field = "ctc" class JointDependency(TaxUnit): - field = 'tax_unit_is_joint' + field = "tax_unit_is_joint" def value(self): return self.screen.is_joint() class PellGrantPrimaryIncomeDependency(TaxUnit): - field = 'pell_grant_primary_income' + field = "pell_grant_primary_income" def value(self): total = 0 @@ -30,14 +30,14 @@ def value(self): is_head = TaxUnitHeadDependency(self.screen, member, self.relationship_map).value() is_spouse = TaxUnitSpouseDependency(self.screen, member, self.relationship_map).value() if is_head or is_spouse: - total += int(member.calc_gross_income('yearly', ['all'])) + total += int(member.calc_gross_income("yearly", ["all"])) return total class PellGrantDependentsInCollegeDependency(TaxUnit): - field = 'pell_grant_dependents_in_college' - dependencies = ('student',) + field = "pell_grant_dependents_in_college" + dependencies = ("student",) def value(self): pell_grant_dependents_in_college = 0 diff --git a/programs/programs/urgent_needs/urgent_need_functions.py b/programs/programs/urgent_needs/urgent_need_functions.py index 65c9a0a4..4db1c793 100644 --- a/programs/programs/urgent_needs/urgent_need_functions.py +++ b/programs/programs/urgent_needs/urgent_need_functions.py @@ -5,17 +5,17 @@ class UrgentNeedFunction: - ''' + """ Base class for all urgent need conditions - ''' + """ dependencies = [] @classmethod def calc(cls, screen: Screen, missing_dependencies: Dependencies): - ''' + """ Calculate if the urgent need can be calculated and if the condition is met - ''' + """ if not cls.can_calc(missing_dependencies): return False @@ -23,16 +23,16 @@ def calc(cls, screen: Screen, missing_dependencies: Dependencies): @classmethod def eligible(cls, screen: Screen): - ''' + """ Returns if the condition is met - ''' + """ return True @classmethod def can_calc(cls, missing_dependencies: Dependencies): - ''' + """ Returns if the condition can be calculated - ''' + """ if missing_dependencies.has(*cls.dependencies): return False @@ -40,97 +40,97 @@ def can_calc(cls, missing_dependencies: Dependencies): class LivesInDenver(UrgentNeedFunction): - dependencies = ['county'] + dependencies = ["county"] @classmethod def eligible(cls, screen: Screen): - ''' + """ Household lives in the Denver County - ''' - return screen.county == 'Denver County' + """ + return screen.county == "Denver County" class MealInCounties(UrgentNeedFunction): - dependencies = ['county'] + dependencies = ["county"] @classmethod def eligible(cls, screen: Screen): - ''' + """ Household lives in Denver or Jefferson County - ''' - eligible_counties = ['Denver County', 'Jefferson County'] + """ + eligible_counties = ["Denver County", "Jefferson County"] return screen.county in eligible_counties class HelpkitchenZipcode(UrgentNeedFunction): - dependencies = ['zipcode'] + dependencies = ["zipcode"] @classmethod def eligible(cls, screen: Screen): - ''' + """ Lives in a zipcode that is eligible for HelpKitchen - ''' + """ zipcodes = [ - '80010', - '80011', - '80012', - '80013', - '80014', - '80015', - '80016', - '80017', - '80018', - '80019', - '80045', - '80102', - '80112', - '80137', - '80138', - '80230', - '80231', - '80238', - '80247', - '80249', + "80010", + "80011", + "80012", + "80013", + "80014", + "80015", + "80016", + "80017", + "80018", + "80019", + "80045", + "80102", + "80112", + "80137", + "80138", + "80230", + "80231", + "80238", + "80247", + "80249", ] return screen.zipcode in zipcodes class Child(UrgentNeedFunction): - dependencies = ['age'] + dependencies = ["age"] @classmethod def eligible(cls, screen: Screen): - ''' + """ Return True if someone is younger than 18 - ''' - return screen.num_children(child_relationship=['all']) > 0 + """ + return screen.num_children(child_relationship=["all"]) > 0 class BiaFoodDelivery(UrgentNeedFunction): - dependencies = ['county'] + dependencies = ["county"] @classmethod def eligible(cls, screen: Screen): - ''' + """ Return True if in Adams, Arapahoe, Denver or Jefferson county - ''' + """ eligible_counties = [ - 'Adams County', - 'Arapahoe County', - 'Denver County', - 'Jefferson County', + "Adams County", + "Arapahoe County", + "Denver County", + "Jefferson County", ] return screen.county in eligible_counties class Trua(UrgentNeedFunction): - dependencies = ['household_size', 'income_amount', 'income_frequency'] + dependencies = ["household_size", "income_amount", "income_frequency"] @classmethod def eligible(cls, screen: Screen): - ''' + """ Return True if the household is below the income limit for their household size - ''' + """ income_limits = { 1: 66_300, 2: 75_750, @@ -141,19 +141,19 @@ def eligible(cls, screen: Screen): 7: 117_400, 8: 124_950, } - household_income = screen.calc_gross_income('yearly', ['all']) + household_income = screen.calc_gross_income("yearly", ["all"]) income_limit = income_limits[screen.household_size] return household_income <= income_limit class ForeclosureFinAssistProgram(UrgentNeedFunction): - dependencies = ['household_size', 'income_amount', 'income_frequency', 'county'] + dependencies = ["household_size", "income_amount", "income_frequency", "county"] @classmethod def eligible(cls, screen: Screen): - ''' + """ Return True if the household is at or below 80% the income limit for their household size & they live in Denver - ''' + """ income_limits = { 1: 66_300, 2: 75_750, @@ -164,9 +164,9 @@ def eligible(cls, screen: Screen): 7: 117_400, 8: 124_950, } - household_income = screen.calc_gross_income('yearly', ['all']) + household_income = screen.calc_gross_income("yearly", ["all"]) income_limit = income_limits[screen.household_size] - return household_income <= income_limit and screen.county == 'Denver County' + return household_income <= income_limit and screen.county == "Denver County" class EocIncomeLimitCache(GoogleSheetsCache): @@ -177,155 +177,150 @@ class EocIncomeLimitCache(GoogleSheetsCache): def update(self): data = super().update() - return {d[0].strip() + ' County': [int(v.replace(',', '')) for v in d[1:]] for d in data} + return {d[0].strip() + " County": [int(v.replace(",", "")) for v in d[1:]] for d in data} class Eoc(UrgentNeedFunction): limits_cache = EocIncomeLimitCache() - dependencies = ['income_amount', 'income_frequency', 'household_size', 'county'] + dependencies = ["income_amount", "income_frequency", "household_size", "county"] @classmethod def eligible(cls, screen: Screen): - ''' + """ Return True if the household is below the income limit for their county and household size - ''' + """ - income = int(screen.calc_gross_income('yearly', ['all'])) + income = int(screen.calc_gross_income("yearly", ["all"])) limits = Eoc.limits_cache.fetch() if screen.county not in limits: return False - income_limit = limits[screen.county][ - screen.household_size - 1 - ] + income_limit = limits[screen.county][screen.household_size - 1] return income < income_limit class CoLegalServices(UrgentNeedFunction): - dependencies = ['income_amount', 'income_frequency', 'household_size', 'age'] + dependencies = ["income_amount", "income_frequency", "household_size", "age"] @classmethod def eligible(cls, screen: Screen): - ''' + """ Return True if the household is has an income bellow 200% FPL or someone in the household is over 60 years old - ''' - fpl = FederalPoveryLimit.objects.get(year='THIS YEAR').as_dict() - is_income_eligible = ( - screen.calc_gross_income('yearly', ['all']) < fpl[screen.household_size] - ) + """ + fpl = FederalPoveryLimit.objects.get(year="THIS YEAR").as_dict() + is_income_eligible = screen.calc_gross_income("yearly", ["all"]) < fpl[screen.household_size] is_age_eligible = screen.num_adults(age_max=60) > 0 return is_income_eligible or is_age_eligible class CoEmergencyMortgageIncomeLimitCache(GoogleSheetsCache): default = {} - sheet_id = '1M_BQxs135UV4uO-CUpHtt9Xy89l1RmSufdP9c3nEh-M' + sheet_id = "1M_BQxs135UV4uO-CUpHtt9Xy89l1RmSufdP9c3nEh-M" range_name = "'100% AMI 2023'!A2:I65" def update(self): data = super().update() - return {d[0] + ' County': [int(v.replace(',', '')) for v in d[1:]] for d in data} + return {d[0] + " County": [int(v.replace(",", "")) for v in d[1:]] for d in data} class CoEmergencyMortgageAssistance(UrgentNeedFunction): limits_cache = CoEmergencyMortgageIncomeLimitCache() - dependencies = ['income_amount', 'income_frequency', 'household_size', 'county'] + dependencies = ["income_amount", "income_frequency", "household_size", "county"] @classmethod def eligible(cls, screen: Screen): - income = int(screen.calc_gross_income('yearly', ['all'])) + income = int(screen.calc_gross_income("yearly", ["all"])) limits = CoEmergencyMortgageAssistance.limits_cache.fetch() if screen.county not in limits: return False - income_limit = limits[screen.county][ - screen.household_size - 1 - ] + income_limit = limits[screen.county][screen.household_size - 1] return income < income_limit + class ChildFirst(UrgentNeedFunction): - dependencies = ['age', 'county'] + dependencies = ["age", "county"] @classmethod def eligible(cls, screen: Screen): - ''' + """ Return True if the household has a child aged 0-5 and lives in an eligible county - ''' + """ is_age_eligible = screen.num_children(age_max=5) > 0 eligible_counties = [ - 'Adams County', - 'Alamosa County', - 'Arapahoe County', - 'Bent County', - 'Boulder County', - 'Broomfield County', - 'Chaffee County', - 'Clear Creek County', - 'Conejos County', - 'Costilla County', - 'Crowley County', - 'Custer County', - 'Douglas County', - 'El Paso County', - 'Fremont County', - 'Gilpin County', - 'Jefferson County', - 'Lake County', - 'Mineral County', - 'Otero County', - 'Rio Grand County', - 'Routt County', - 'Saguache County', - 'Weld County', + "Adams County", + "Alamosa County", + "Arapahoe County", + "Bent County", + "Boulder County", + "Broomfield County", + "Chaffee County", + "Clear Creek County", + "Conejos County", + "Costilla County", + "Crowley County", + "Custer County", + "Douglas County", + "El Paso County", + "Fremont County", + "Gilpin County", + "Jefferson County", + "Lake County", + "Mineral County", + "Otero County", + "Rio Grand County", + "Routt County", + "Saguache County", + "Weld County", ] return is_age_eligible and screen.county in eligible_counties class EarlyChildhoodMentalHealthSupport(UrgentNeedFunction): - dependencies = ['age'] + dependencies = ["age"] max_age = 5 @classmethod def eligible(cls, screen: Screen): - ''' + """ Return True if the householdh as a child aged 0-5 - ''' + """ return screen.num_children(age_max=cls.max_age) > 0 class ParentsOfPreschoolYoungsters(UrgentNeedFunction): - dependencies = ['age', 'county'] + dependencies = ["age", "county"] counties = [ - 'Adams County', - 'Alamosa County', - 'Arapahoe County', - 'Costilla County', - 'Crowley County', - 'Denver County', - 'Dolores County', - 'Jefferson County', - 'Montezuma County', - 'Otero County', - 'Pueblo County', - 'Saguache County', - 'Weld County', + "Adams County", + "Alamosa County", + "Arapahoe County", + "Costilla County", + "Crowley County", + "Denver County", + "Dolores County", + "Jefferson County", + "Montezuma County", + "Otero County", + "Pueblo County", + "Saguache County", + "Weld County", ] min_age = 2 max_age = 5 @classmethod def eligible(cls, screen: Screen): - ''' + """ Return True if a child is between 2 and 5 and lives in an eligible county - ''' + """ age_eligible = screen.num_children(age_min=cls.min_age, age_max=cls.max_age) > 0 county_eligible = screen.county in cls.counties @@ -333,49 +328,48 @@ def eligible(cls, screen: Screen): class ParentsAsTeacher(UrgentNeedFunction): - dependencies = ['age', 'county'] + dependencies = ["age", "county"] counties = [ - 'Adams County', - 'Alamosa County', - 'Arapahoe County', - 'Bent County', - 'Boulder County', - 'Conejos County', - 'Costilla County', - 'Crowley County', - 'Delta County', - 'Denver County', - 'Dolores County', - 'El Paso County', - 'Fremont County', - 'Gunnison County', - 'Huerfano County', - 'Jefferson County', - 'La Plata County', - 'Larimer County', - 'Las Animas County', - 'Mesa County', - 'Montezuma County', - 'Montrose County', - 'Morgan County', - 'Otero County', - 'Ouray County', - 'Park County', - 'Pueblo County', - 'Routt County', - 'Saguache County', - 'San Miguel County', - 'Teller County', + "Adams County", + "Alamosa County", + "Arapahoe County", + "Bent County", + "Boulder County", + "Conejos County", + "Costilla County", + "Crowley County", + "Delta County", + "Denver County", + "Dolores County", + "El Paso County", + "Fremont County", + "Gunnison County", + "Huerfano County", + "Jefferson County", + "La Plata County", + "Larimer County", + "Las Animas County", + "Mesa County", + "Montezuma County", + "Montrose County", + "Morgan County", + "Otero County", + "Ouray County", + "Park County", + "Pueblo County", + "Routt County", + "Saguache County", + "San Miguel County", + "Teller County", ] max_age = 5 @classmethod def eligible(cls, screen: Screen): - ''' + """ Return True if there is a child younger than 5 and lives in an eligible county - ''' + """ age_eligible = screen.num_children(age_max=cls.max_age) > 0 county_eligible = screen.county in cls.counties return age_eligible and county_eligible - diff --git a/programs/urls.py b/programs/urls.py index 7d39e395..ddebede9 100644 --- a/programs/urls.py +++ b/programs/urls.py @@ -3,12 +3,10 @@ from . import views router = routers.DefaultRouter() -router.register(r'programs', views.ProgramViewSet) -router.register(r'navigators', views.NavigatorViewSet) -router.register(r'urgent-needs', views.UrgentNeedViewSet) +router.register(r"programs", views.ProgramViewSet) +router.register(r"navigators", views.NavigatorViewSet) +router.register(r"urgent-needs", views.UrgentNeedViewSet) # Wire up our API using automatic URL routing. # Additionally, we include login URLs for the browsable API. -urlpatterns = [ - path('', include(router.urls)) -] +urlpatterns = [path("", include(router.urls))] diff --git a/screener/admin.py b/screener/admin.py index dd553bd2..6741e7e5 100644 --- a/screener/admin.py +++ b/screener/admin.py @@ -9,7 +9,7 @@ class screenAdmin(ModelAdmin): - search_fields = ('id',) + search_fields = ("id",) class CustomMessageAdmin(ModelAdmin): diff --git a/screener/apps.py b/screener/apps.py index d2b31097..1b0ed4d7 100644 --- a/screener/apps.py +++ b/screener/apps.py @@ -2,5 +2,5 @@ class ScreenerConfig(AppConfig): - default_auto_field = 'django.db.models.BigAutoField' - name = 'screener' + default_auto_field = "django.db.models.BigAutoField" + name = "screener" diff --git a/screener/management/commands/batch_snapshots.py b/screener/management/commands/batch_snapshots.py index 9efe1832..d77f8bde 100644 --- a/screener/management/commands/batch_snapshots.py +++ b/screener/management/commands/batch_snapshots.py @@ -6,44 +6,38 @@ class Command(BaseCommand): - help = ''' + help = """ Creates snapshots for all users. Limit default is 1. Defaults to only creating snapshots for users with emails. - ''' + """ def add_arguments(self, parser): - parser.add_argument('--limit', default=1, type=int) - parser.add_argument('--all', default=False, type=bool) - parser.add_argument('--new', default=False, type=bool) + parser.add_argument("--limit", default=1, type=int) + parser.add_argument("--all", default=False, type=bool) + parser.add_argument("--new", default=False, type=bool) def handle(self, *args, **options): # Get the screens - screens = Screen.objects.filter( - agree_to_tos=True, - is_test=False, - is_test_data=False, - completed=True - ) - - if not options['all']: + screens = Screen.objects.filter(agree_to_tos=True, is_test=False, is_test_data=False, completed=True) + + if not options["all"]: screens = screens.exclude(user__isnull=True) - if options['new']: + if options["new"]: screens = screens.filter(eligibility_snapshots__isnull=True) # List[:None] is everything in the list - limit = None if options['limit'] == -1 else options['limit'] - screens = screens.order_by('-submission_date')[:limit] + limit = None if options["limit"] == -1 else options["limit"] + screens = screens.order_by("-submission_date")[:limit] # Calculate eligibility for each screen errors = [] - for i in trange(len(screens), desc='Screens'): + for i in trange(len(screens), desc="Screens"): try: eligibility_results(screens[i], batch=True) time.sleep(1) except Exception as e: - errors.append(str(screens[i].id) + ': ' + str(e)) + errors.append(str(screens[i].id) + ": " + str(e)) if len(errors): - self.stdout.write( - self.style.ERROR('The following screens had errors:\n' + '\n'.join(errors))) + self.stdout.write(self.style.ERROR("The following screens had errors:\n" + "\n".join(errors))) diff --git a/screener/management/commands/email_new_benefits.py b/screener/management/commands/email_new_benefits.py index e6301a6e..c893cd3a 100644 --- a/screener/management/commands/email_new_benefits.py +++ b/screener/management/commands/email_new_benefits.py @@ -5,26 +5,24 @@ class Command(BaseCommand): - help = ''' + help = """ Update number of new benefits and amount of new benefits in HubSpot - ''' + """ def add_arguments(self, parser): - parser.add_argument('--limit', default=1, type=int) + parser.add_argument("--limit", default=1, type=int) def handle(self, *args, **options): screens = Screen.objects.all().exclude(user__isnull=True) latest_snapshots = [] - limit = options['limit'] + limit = options["limit"] for screen in screens: try: - previous_snapshot = EligibilitySnapshot.objects \ - .filter(is_batch=True, screen=screen) \ - .latest('submission_date') - except ObjectDoesNotExist: - self.stdout.write( - self.style.WARNING(f'No snapshots for screen with id of {screen.id}') + previous_snapshot = EligibilitySnapshot.objects.filter(is_batch=True, screen=screen).latest( + "submission_date" ) + except ObjectDoesNotExist: + self.stdout.write(self.style.WARNING(f"No snapshots for screen with id of {screen.id}")) continue latest_snapshots.append(previous_snapshot) @@ -48,9 +46,7 @@ def handle(self, *args, **options): limit -= 1 if not len(existing_users): - self.stdout.write( - self.style.WARNING('No users in HubSpot. Make sure that you add users to HubSpot first') - ) + self.stdout.write(self.style.WARNING("No users in HubSpot. Make sure that you add users to HubSpot first")) return hubspot.bulk_update(existing_users) diff --git a/screener/migrations/0001_initial.py b/screener/migrations/0001_initial.py index 1cf4e8fd..5269a795 100644 --- a/screener/migrations/0001_initial.py +++ b/screener/migrations/0001_initial.py @@ -5,46 +5,44 @@ class Migration(migrations.Migration): - initial = True - dependencies = [ - ] + dependencies = [] operations = [ migrations.CreateModel( - name='Screen', + name="Screen", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('submission_date', models.DateTimeField(auto_now=True)), - ('agree_to_tos', models.BooleanField()), - ('applicant_age', models.IntegerField()), - ('zipcode', models.CharField(max_length=5)), - ('student', models.BooleanField()), - ('student_full_time', models.BooleanField()), - ('pregnant', models.BooleanField()), - ('unemployed', models.BooleanField()), - ('worked_in_last_18_mos', models.BooleanField()), - ('visually_impaired', models.BooleanField()), - ('disabled', models.BooleanField()), - ('veteran', models.BooleanField()), - ('medicaid', models.BooleanField()), - ('disability_medicaid', models.BooleanField()), - ('has_income', models.BooleanField()), - ('has_expenses', models.BooleanField()), - ('household_size', models.IntegerField()), - ('household_assets', models.DecimalField(decimal_places=2, max_digits=10)), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("submission_date", models.DateTimeField(auto_now=True)), + ("agree_to_tos", models.BooleanField()), + ("applicant_age", models.IntegerField()), + ("zipcode", models.CharField(max_length=5)), + ("student", models.BooleanField()), + ("student_full_time", models.BooleanField()), + ("pregnant", models.BooleanField()), + ("unemployed", models.BooleanField()), + ("worked_in_last_18_mos", models.BooleanField()), + ("visually_impaired", models.BooleanField()), + ("disabled", models.BooleanField()), + ("veteran", models.BooleanField()), + ("medicaid", models.BooleanField()), + ("disability_medicaid", models.BooleanField()), + ("has_income", models.BooleanField()), + ("has_expenses", models.BooleanField()), + ("household_size", models.IntegerField()), + ("household_assets", models.DecimalField(decimal_places=2, max_digits=10)), ], ), migrations.CreateModel( - name='incomeStream', + name="incomeStream", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('type', models.CharField(max_length=30)), - ('label', models.CharField(max_length=200)), - ('amount', models.DecimalField(decimal_places=2, max_digits=10)), - ('frequency', models.CharField(max_length=30)), - ('screen', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='screener.screen')), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("type", models.CharField(max_length=30)), + ("label", models.CharField(max_length=200)), + ("amount", models.DecimalField(decimal_places=2, max_digits=10)), + ("frequency", models.CharField(max_length=30)), + ("screen", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="screener.screen")), ], ), ] diff --git a/screener/migrations/0002_screen_housing_situation_expense.py b/screener/migrations/0002_screen_housing_situation_expense.py index 9c29bffa..296acba1 100644 --- a/screener/migrations/0002_screen_housing_situation_expense.py +++ b/screener/migrations/0002_screen_housing_situation_expense.py @@ -5,26 +5,25 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0001_initial'), + ("screener", "0001_initial"), ] operations = [ migrations.AddField( - model_name='screen', - name='housing_situation', - field=models.CharField(default='rent', max_length=30), + model_name="screen", + name="housing_situation", + field=models.CharField(default="rent", max_length=30), preserve_default=False, ), migrations.CreateModel( - name='Expense', + name="Expense", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=30)), - ('amount', models.DecimalField(decimal_places=2, max_digits=10)), - ('frequency', models.CharField(max_length=30)), - ('screen', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='screener.screen')), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("name", models.CharField(max_length=30)), + ("amount", models.DecimalField(decimal_places=2, max_digits=10)), + ("frequency", models.CharField(max_length=30)), + ("screen", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="screener.screen")), ], ), ] diff --git a/screener/migrations/0003_rename_type_incomestream_name.py b/screener/migrations/0003_rename_type_incomestream_name.py index 493fe880..085cd9c4 100644 --- a/screener/migrations/0003_rename_type_incomestream_name.py +++ b/screener/migrations/0003_rename_type_incomestream_name.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0002_screen_housing_situation_expense'), + ("screener", "0002_screen_housing_situation_expense"), ] operations = [ migrations.RenameField( - model_name='incomestream', - old_name='type', - new_name='name', + model_name="incomestream", + old_name="type", + new_name="name", ), ] diff --git a/screener/migrations/0004_remove_incomestream_label.py b/screener/migrations/0004_remove_incomestream_label.py index 8f2f2dfa..e8aebb8d 100644 --- a/screener/migrations/0004_remove_incomestream_label.py +++ b/screener/migrations/0004_remove_incomestream_label.py @@ -4,14 +4,13 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0003_rename_type_incomestream_name'), + ("screener", "0003_rename_type_incomestream_name"), ] operations = [ migrations.RemoveField( - model_name='incomestream', - name='label', + model_name="incomestream", + name="label", ), ] diff --git a/screener/migrations/0005_alter_incomestream_screen.py b/screener/migrations/0005_alter_incomestream_screen.py index f4d6f091..b36feb5b 100644 --- a/screener/migrations/0005_alter_incomestream_screen.py +++ b/screener/migrations/0005_alter_incomestream_screen.py @@ -5,15 +5,16 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0004_remove_incomestream_label'), + ("screener", "0004_remove_incomestream_label"), ] operations = [ migrations.AlterField( - model_name='incomestream', - name='screen', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='incomestreams', to='screener.screen'), + model_name="incomestream", + name="screen", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name="incomestreams", to="screener.screen" + ), ), ] diff --git a/screener/migrations/0006_rename_name_expense_type_and_more.py b/screener/migrations/0006_rename_name_expense_type_and_more.py index b592d8fe..7b62cdff 100644 --- a/screener/migrations/0006_rename_name_expense_type_and_more.py +++ b/screener/migrations/0006_rename_name_expense_type_and_more.py @@ -5,25 +5,26 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0005_alter_incomestream_screen'), + ("screener", "0005_alter_incomestream_screen"), ] operations = [ migrations.RenameField( - model_name='expense', - old_name='name', - new_name='type', + model_name="expense", + old_name="name", + new_name="type", ), migrations.RenameField( - model_name='incomestream', - old_name='name', - new_name='type', + model_name="incomestream", + old_name="name", + new_name="type", ), migrations.AlterField( - model_name='expense', - name='screen', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='expenses', to='screener.screen'), + model_name="expense", + name="screen", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name="expenses", to="screener.screen" + ), ), ] diff --git a/screener/migrations/0007_rename_applicant_age_screen_age.py b/screener/migrations/0007_rename_applicant_age_screen_age.py index b54fd4bc..336ad346 100644 --- a/screener/migrations/0007_rename_applicant_age_screen_age.py +++ b/screener/migrations/0007_rename_applicant_age_screen_age.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0006_rename_name_expense_type_and_more'), + ("screener", "0006_rename_name_expense_type_and_more"), ] operations = [ migrations.RenameField( - model_name='screen', - old_name='applicant_age', - new_name='age', + model_name="screen", + old_name="applicant_age", + new_name="age", ), ] diff --git a/screener/migrations/0008_householdmember.py b/screener/migrations/0008_householdmember.py index a655842a..d668e41e 100644 --- a/screener/migrations/0008_householdmember.py +++ b/screener/migrations/0008_householdmember.py @@ -5,31 +5,37 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0007_rename_applicant_age_screen_age'), + ("screener", "0007_rename_applicant_age_screen_age"), ] operations = [ migrations.CreateModel( - name='HouseholdMember', + name="HouseholdMember", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('age', models.IntegerField()), - ('zipcode', models.CharField(max_length=5)), - ('student', models.BooleanField()), - ('student_full_time', models.BooleanField()), - ('pregnant', models.BooleanField()), - ('unemployed', models.BooleanField()), - ('worked_in_last_18_mos', models.BooleanField()), - ('visually_impaired', models.BooleanField()), - ('disabled', models.BooleanField()), - ('veteran', models.BooleanField()), - ('medicaid', models.BooleanField()), - ('disability_medicaid', models.BooleanField()), - ('has_income', models.BooleanField()), - ('has_expenses', models.BooleanField()), - ('screen', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='householdmembers', to='screener.screen')), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("age", models.IntegerField()), + ("zipcode", models.CharField(max_length=5)), + ("student", models.BooleanField()), + ("student_full_time", models.BooleanField()), + ("pregnant", models.BooleanField()), + ("unemployed", models.BooleanField()), + ("worked_in_last_18_mos", models.BooleanField()), + ("visually_impaired", models.BooleanField()), + ("disabled", models.BooleanField()), + ("veteran", models.BooleanField()), + ("medicaid", models.BooleanField()), + ("disability_medicaid", models.BooleanField()), + ("has_income", models.BooleanField()), + ("has_expenses", models.BooleanField()), + ( + "screen", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="householdmembers", + to="screener.screen", + ), + ), ], ), ] diff --git a/screener/migrations/0009_remove_householdmember_zipcode.py b/screener/migrations/0009_remove_householdmember_zipcode.py index ca828419..7ad698b1 100644 --- a/screener/migrations/0009_remove_householdmember_zipcode.py +++ b/screener/migrations/0009_remove_householdmember_zipcode.py @@ -4,14 +4,13 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0008_householdmember'), + ("screener", "0008_householdmember"), ] operations = [ migrations.RemoveField( - model_name='householdmember', - name='zipcode', + model_name="householdmember", + name="zipcode", ), ] diff --git a/screener/migrations/0010_remove_screen_age_remove_screen_disability_medicaid_and_more.py b/screener/migrations/0010_remove_screen_age_remove_screen_disability_medicaid_and_more.py index 9167e3de..940dbabe 100644 --- a/screener/migrations/0010_remove_screen_age_remove_screen_disability_medicaid_and_more.py +++ b/screener/migrations/0010_remove_screen_age_remove_screen_disability_medicaid_and_more.py @@ -4,62 +4,61 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0009_remove_householdmember_zipcode'), + ("screener", "0009_remove_householdmember_zipcode"), ] operations = [ migrations.RemoveField( - model_name='screen', - name='age', + model_name="screen", + name="age", ), migrations.RemoveField( - model_name='screen', - name='disability_medicaid', + model_name="screen", + name="disability_medicaid", ), migrations.RemoveField( - model_name='screen', - name='disabled', + model_name="screen", + name="disabled", ), migrations.RemoveField( - model_name='screen', - name='has_expenses', + model_name="screen", + name="has_expenses", ), migrations.RemoveField( - model_name='screen', - name='has_income', + model_name="screen", + name="has_income", ), migrations.RemoveField( - model_name='screen', - name='medicaid', + model_name="screen", + name="medicaid", ), migrations.RemoveField( - model_name='screen', - name='pregnant', + model_name="screen", + name="pregnant", ), migrations.RemoveField( - model_name='screen', - name='student', + model_name="screen", + name="student", ), migrations.RemoveField( - model_name='screen', - name='student_full_time', + model_name="screen", + name="student_full_time", ), migrations.RemoveField( - model_name='screen', - name='unemployed', + model_name="screen", + name="unemployed", ), migrations.RemoveField( - model_name='screen', - name='veteran', + model_name="screen", + name="veteran", ), migrations.RemoveField( - model_name='screen', - name='visually_impaired', + model_name="screen", + name="visually_impaired", ), migrations.RemoveField( - model_name='screen', - name='worked_in_last_18_mos', + model_name="screen", + name="worked_in_last_18_mos", ), ] diff --git a/screener/migrations/0011_expense_household_member_and_more.py b/screener/migrations/0011_expense_household_member_and_more.py index 38a0147d..c7edfe9d 100644 --- a/screener/migrations/0011_expense_household_member_and_more.py +++ b/screener/migrations/0011_expense_household_member_and_more.py @@ -5,22 +5,31 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0010_remove_screen_age_remove_screen_disability_medicaid_and_more'), + ("screener", "0010_remove_screen_age_remove_screen_disability_medicaid_and_more"), ] operations = [ migrations.AddField( - model_name='expense', - name='household_member', - field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, related_name='expenses', to='screener.householdmember'), + model_name="expense", + name="household_member", + field=models.ForeignKey( + default=1, + on_delete=django.db.models.deletion.CASCADE, + related_name="expenses", + to="screener.householdmember", + ), preserve_default=False, ), migrations.AddField( - model_name='incomestream', - name='household_member', - field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, related_name='incomestreams', to='screener.householdmember'), + model_name="incomestream", + name="household_member", + field=models.ForeignKey( + default=1, + on_delete=django.db.models.deletion.CASCADE, + related_name="incomestreams", + to="screener.householdmember", + ), preserve_default=False, ), ] diff --git a/screener/migrations/0012_alter_householdmember_screen_and_more.py b/screener/migrations/0012_alter_householdmember_screen_and_more.py index 40dcc7ff..0d480450 100644 --- a/screener/migrations/0012_alter_householdmember_screen_and_more.py +++ b/screener/migrations/0012_alter_householdmember_screen_and_more.py @@ -5,25 +5,32 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0011_expense_household_member_and_more'), + ("screener", "0011_expense_household_member_and_more"), ] operations = [ migrations.AlterField( - model_name='householdmember', - name='screen', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='household_members', to='screener.screen'), + model_name="householdmember", + name="screen", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name="household_members", to="screener.screen" + ), ), migrations.AlterField( - model_name='incomestream', - name='household_member', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='income_streams', to='screener.householdmember'), + model_name="incomestream", + name="household_member", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="income_streams", + to="screener.householdmember", + ), ), migrations.AlterField( - model_name='incomestream', - name='screen', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='income_streams', to='screener.screen'), + model_name="incomestream", + name="screen", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name="income_streams", to="screener.screen" + ), ), ] diff --git a/screener/migrations/0013_householdmember_relationship.py b/screener/migrations/0013_householdmember_relationship.py index 3ba8336f..cd66da4e 100644 --- a/screener/migrations/0013_householdmember_relationship.py +++ b/screener/migrations/0013_householdmember_relationship.py @@ -4,16 +4,15 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0012_alter_householdmember_screen_and_more'), + ("screener", "0012_alter_householdmember_screen_and_more"), ] operations = [ migrations.AddField( - model_name='householdmember', - name='relationship', - field=models.CharField(default='parent', max_length=30), + model_name="householdmember", + name="relationship", + field=models.CharField(default="parent", max_length=30), preserve_default=False, ), ] diff --git a/screener/migrations/0014_screen_cell_screen_email.py b/screener/migrations/0014_screen_cell_screen_email.py index 0dc0d7ed..6f7bd68e 100644 --- a/screener/migrations/0014_screen_cell_screen_email.py +++ b/screener/migrations/0014_screen_cell_screen_email.py @@ -5,20 +5,19 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0013_householdmember_relationship'), + ("screener", "0013_householdmember_relationship"), ] operations = [ migrations.AddField( - model_name='screen', - name='cell', + model_name="screen", + name="cell", field=phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, region=None), ), migrations.AddField( - model_name='screen', - name='email', + model_name="screen", + name="email", field=models.CharField(blank=True, max_length=320), ), ] diff --git a/screener/migrations/0015_remove_screen_cell.py b/screener/migrations/0015_remove_screen_cell.py index ba186afd..f2703086 100644 --- a/screener/migrations/0015_remove_screen_cell.py +++ b/screener/migrations/0015_remove_screen_cell.py @@ -4,14 +4,13 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0014_screen_cell_screen_email'), + ("screener", "0014_screen_cell_screen_email"), ] operations = [ migrations.RemoveField( - model_name='screen', - name='cell', + model_name="screen", + name="cell", ), ] diff --git a/screener/migrations/0016_remove_screen_email.py b/screener/migrations/0016_remove_screen_email.py index 6456247b..6ecccab0 100644 --- a/screener/migrations/0016_remove_screen_email.py +++ b/screener/migrations/0016_remove_screen_email.py @@ -4,14 +4,13 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0015_remove_screen_cell'), + ("screener", "0015_remove_screen_cell"), ] operations = [ migrations.RemoveField( - model_name='screen', - name='email', + model_name="screen", + name="email", ), ] diff --git a/screener/migrations/0017_screen_last_email_request_date.py b/screener/migrations/0017_screen_last_email_request_date.py index 2c15230d..5e69a6a8 100644 --- a/screener/migrations/0017_screen_last_email_request_date.py +++ b/screener/migrations/0017_screen_last_email_request_date.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0016_remove_screen_email'), + ("screener", "0016_remove_screen_email"), ] operations = [ migrations.AddField( - model_name='screen', - name='last_email_request_date', + model_name="screen", + name="last_email_request_date", field=models.DateTimeField(blank=True, null=True), ), ] diff --git a/screener/migrations/0018_screen_user.py b/screener/migrations/0018_screen_user.py index 3509e95e..03d0fc79 100644 --- a/screener/migrations/0018_screen_user.py +++ b/screener/migrations/0018_screen_user.py @@ -6,16 +6,21 @@ class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('screener', '0017_screen_last_email_request_date'), + ("screener", "0017_screen_last_email_request_date"), ] operations = [ migrations.AddField( - model_name='screen', - name='user', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='screens', to=settings.AUTH_USER_MODEL), + model_name="screen", + name="user", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="screens", + to=settings.AUTH_USER_MODEL, + ), ), ] diff --git a/screener/migrations/0019_screen_start_date.py b/screener/migrations/0019_screen_start_date.py index 4bdb856b..b7e1a673 100644 --- a/screener/migrations/0019_screen_start_date.py +++ b/screener/migrations/0019_screen_start_date.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0018_screen_user'), + ("screener", "0018_screen_user"), ] operations = [ migrations.AddField( - model_name='screen', - name='start_date', + model_name="screen", + name="start_date", field=models.DateTimeField(blank=True, null=True), ), ] diff --git a/screener/migrations/0020_screen_is_test.py b/screener/migrations/0020_screen_is_test.py index 1bd1fb96..5535a831 100644 --- a/screener/migrations/0020_screen_is_test.py +++ b/screener/migrations/0020_screen_is_test.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0019_screen_start_date'), + ("screener", "0019_screen_start_date"), ] operations = [ migrations.AddField( - model_name='screen', - name='is_test', + model_name="screen", + name="is_test", field=models.BooleanField(blank=True, default=False), ), ] diff --git a/screener/migrations/0021_messages.py b/screener/migrations/0021_messages.py index f8377f68..9f3fb465 100644 --- a/screener/migrations/0021_messages.py +++ b/screener/migrations/0021_messages.py @@ -6,21 +6,33 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0020_screen_is_test'), + ("screener", "0020_screen_is_test"), ] operations = [ migrations.CreateModel( - name='Messages', + name="Messages", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('sent', models.DateTimeField(auto_now=True)), - ('cell', phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, null=True, region=None, unique=True)), - ('email', models.EmailField(blank=True, max_length=254, null=True, unique=True, verbose_name='email address')), - ('message', models.CharField(blank=True, max_length=320, null=True)), - ('screen', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='messages', to='screener.screen')), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("sent", models.DateTimeField(auto_now=True)), + ( + "cell", + phonenumber_field.modelfields.PhoneNumberField( + blank=True, max_length=128, null=True, region=None, unique=True + ), + ), + ( + "email", + models.EmailField(blank=True, max_length=254, null=True, unique=True, verbose_name="email address"), + ), + ("message", models.CharField(blank=True, max_length=320, null=True)), + ( + "screen", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, related_name="messages", to="screener.screen" + ), + ), ], ), ] diff --git a/screener/migrations/0022_rename_messages_message.py b/screener/migrations/0022_rename_messages_message.py index 71f7f1e2..bc9145c0 100644 --- a/screener/migrations/0022_rename_messages_message.py +++ b/screener/migrations/0022_rename_messages_message.py @@ -4,14 +4,13 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0021_messages'), + ("screener", "0021_messages"), ] operations = [ migrations.RenameModel( - old_name='Messages', - new_name='Message', + old_name="Messages", + new_name="Message", ), ] diff --git a/screener/migrations/0023_rename_message_message_content_message_type.py b/screener/migrations/0023_rename_message_message_content_message_type.py index 87ed8481..b5d83512 100644 --- a/screener/migrations/0023_rename_message_message_content_message_type.py +++ b/screener/migrations/0023_rename_message_message_content_message_type.py @@ -4,21 +4,20 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0022_rename_messages_message'), + ("screener", "0022_rename_messages_message"), ] operations = [ migrations.RenameField( - model_name='message', - old_name='message', - new_name='content', + model_name="message", + old_name="message", + new_name="content", ), migrations.AddField( - model_name='message', - name='type', - field=models.CharField(default='', max_length=30), + model_name="message", + name="type", + field=models.CharField(default="", max_length=30), preserve_default=False, ), ] diff --git a/screener/migrations/0024_alter_message_cell_alter_message_email.py b/screener/migrations/0024_alter_message_cell_alter_message_email.py index 263d9d29..9ee9261b 100644 --- a/screener/migrations/0024_alter_message_cell_alter_message_email.py +++ b/screener/migrations/0024_alter_message_cell_alter_message_email.py @@ -5,20 +5,19 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0023_rename_message_message_content_message_type'), + ("screener", "0023_rename_message_message_content_message_type"), ] operations = [ migrations.AlterField( - model_name='message', - name='cell', + model_name="message", + name="cell", field=phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, null=True, region=None), ), migrations.AlterField( - model_name='message', - name='email', - field=models.EmailField(blank=True, max_length=254, null=True, verbose_name='email address'), + model_name="message", + name="email", + field=models.EmailField(blank=True, max_length=254, null=True, verbose_name="email address"), ), ] diff --git a/screener/migrations/0025_screen_external_id.py b/screener/migrations/0025_screen_external_id.py index 67bced38..69083f2d 100644 --- a/screener/migrations/0025_screen_external_id.py +++ b/screener/migrations/0025_screen_external_id.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0024_alter_message_cell_alter_message_email'), + ("screener", "0024_alter_message_cell_alter_message_email"), ] operations = [ migrations.AddField( - model_name='screen', - name='external_id', + model_name="screen", + name="external_id", field=models.CharField(blank=True, max_length=120, null=True), ), ] diff --git a/screener/migrations/0026_screen_filed_taxes.py b/screener/migrations/0026_screen_filed_taxes.py index 40b12481..e2d500fe 100644 --- a/screener/migrations/0026_screen_filed_taxes.py +++ b/screener/migrations/0026_screen_filed_taxes.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0025_screen_external_id'), + ("screener", "0025_screen_external_id"), ] operations = [ migrations.AddField( - model_name='screen', - name='filed_taxes', + model_name="screen", + name="filed_taxes", field=models.BooleanField(blank=True, default=None, null=True), ), ] diff --git a/screener/migrations/0027_remove_screen_filed_taxes.py b/screener/migrations/0027_remove_screen_filed_taxes.py index 98c2743d..1b30d814 100644 --- a/screener/migrations/0027_remove_screen_filed_taxes.py +++ b/screener/migrations/0027_remove_screen_filed_taxes.py @@ -4,14 +4,13 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0026_screen_filed_taxes'), + ("screener", "0026_screen_filed_taxes"), ] operations = [ migrations.RemoveField( - model_name='screen', - name='filed_taxes', + model_name="screen", + name="filed_taxes", ), ] diff --git a/screener/migrations/0028_screen_last_tax_filing_year.py b/screener/migrations/0028_screen_last_tax_filing_year.py index 7e602175..41f24c6d 100644 --- a/screener/migrations/0028_screen_last_tax_filing_year.py +++ b/screener/migrations/0028_screen_last_tax_filing_year.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0027_remove_screen_filed_taxes'), + ("screener", "0027_remove_screen_filed_taxes"), ] operations = [ migrations.AddField( - model_name='screen', - name='last_tax_filing_year', + model_name="screen", + name="last_tax_filing_year", field=models.CharField(blank=True, default=None, max_length=120, null=True), ), ] diff --git a/screener/migrations/0029_alter_screen_housing_situation.py b/screener/migrations/0029_alter_screen_housing_situation.py index 97fa7799..20e71f1c 100644 --- a/screener/migrations/0029_alter_screen_housing_situation.py +++ b/screener/migrations/0029_alter_screen_housing_situation.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0028_screen_last_tax_filing_year'), + ("screener", "0028_screen_last_tax_filing_year"), ] operations = [ migrations.AlterField( - model_name='screen', - name='housing_situation', + model_name="screen", + name="housing_situation", field=models.CharField(blank=True, default=None, max_length=30, null=True), ), ] diff --git a/screener/migrations/0030_screen_has_acp_screen_has_ccb_screen_has_cccap_and_more.py b/screener/migrations/0030_screen_has_acp_screen_has_ccb_screen_has_cccap_and_more.py index 24cf05f0..bd2b3276 100644 --- a/screener/migrations/0030_screen_has_acp_screen_has_ccb_screen_has_cccap_and_more.py +++ b/screener/migrations/0030_screen_has_acp_screen_has_ccb_screen_has_cccap_and_more.py @@ -4,85 +4,84 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0029_alter_screen_housing_situation'), + ("screener", "0029_alter_screen_housing_situation"), ] operations = [ migrations.AddField( - model_name='screen', - name='has_acp', + model_name="screen", + name="has_acp", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_ccb', + model_name="screen", + name="has_ccb", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_cccap', + model_name="screen", + name="has_cccap", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_chp', + model_name="screen", + name="has_chp", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_coeitc', + model_name="screen", + name="has_coeitc", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_ctc', + model_name="screen", + name="has_ctc", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_eitc', + model_name="screen", + name="has_eitc", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_lifeline', + model_name="screen", + name="has_lifeline", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_medicaid', + model_name="screen", + name="has_medicaid", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_mydenver', + model_name="screen", + name="has_mydenver", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_nslp', + model_name="screen", + name="has_nslp", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_rtdlive', + model_name="screen", + name="has_rtdlive", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_snap', + model_name="screen", + name="has_snap", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_tanf', + model_name="screen", + name="has_tanf", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_wic', + model_name="screen", + name="has_wic", field=models.BooleanField(blank=True, default=False, null=True), ), ] diff --git a/screener/migrations/0031_alter_householdmember_disability_medicaid_and_more.py b/screener/migrations/0031_alter_householdmember_disability_medicaid_and_more.py index 4b1dd9c4..d80cc09e 100644 --- a/screener/migrations/0031_alter_householdmember_disability_medicaid_and_more.py +++ b/screener/migrations/0031_alter_householdmember_disability_medicaid_and_more.py @@ -4,20 +4,19 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0030_screen_has_acp_screen_has_ccb_screen_has_cccap_and_more'), + ("screener", "0030_screen_has_acp_screen_has_ccb_screen_has_cccap_and_more"), ] operations = [ migrations.AlterField( - model_name='householdmember', - name='disability_medicaid', + model_name="householdmember", + name="disability_medicaid", field=models.BooleanField(blank=True, null=True), ), migrations.AlterField( - model_name='householdmember', - name='medicaid', + model_name="householdmember", + name="medicaid", field=models.BooleanField(blank=True, null=True), ), ] diff --git a/screener/migrations/0032_message_uid.py b/screener/migrations/0032_message_uid.py index 14ad42c9..d0010baa 100644 --- a/screener/migrations/0032_message_uid.py +++ b/screener/migrations/0032_message_uid.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0031_alter_householdmember_disability_medicaid_and_more'), + ("screener", "0031_alter_householdmember_disability_medicaid_and_more"), ] operations = [ migrations.AddField( - model_name='message', - name='uid', + model_name="message", + name="uid", field=models.IntegerField(blank=True, null=True), ), ] diff --git a/screener/migrations/0033_screen_referral_source.py b/screener/migrations/0033_screen_referral_source.py index 92c783e3..486aeeed 100644 --- a/screener/migrations/0033_screen_referral_source.py +++ b/screener/migrations/0033_screen_referral_source.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0032_message_uid'), + ("screener", "0032_message_uid"), ] operations = [ migrations.AddField( - model_name='screen', - name='referral_source', + model_name="screen", + name="referral_source", field=models.CharField(blank=True, default=None, max_length=320, null=True), ), ] diff --git a/screener/migrations/0034_alter_screen_household_assets.py b/screener/migrations/0034_alter_screen_household_assets.py index 83bff2c4..e586bbab 100644 --- a/screener/migrations/0034_alter_screen_household_assets.py +++ b/screener/migrations/0034_alter_screen_household_assets.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0033_screen_referral_source'), + ("screener", "0033_screen_referral_source"), ] operations = [ migrations.AlterField( - model_name='screen', - name='household_assets', + model_name="screen", + name="household_assets", field=models.DecimalField(blank=True, decimal_places=2, default=None, max_digits=10, null=True), ), ] diff --git a/screener/migrations/0035_screen_county.py b/screener/migrations/0035_screen_county.py index e1717eb8..4fc78071 100644 --- a/screener/migrations/0035_screen_county.py +++ b/screener/migrations/0035_screen_county.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0034_alter_screen_household_assets'), + ("screener", "0034_alter_screen_household_assets"), ] operations = [ migrations.AddField( - model_name='screen', - name='county', + model_name="screen", + name="county", field=models.CharField(blank=True, default=None, max_length=120, null=True), ), ] diff --git a/screener/migrations/0036_screen_request_language_code.py b/screener/migrations/0036_screen_request_language_code.py index a56c4cb9..571c1a5d 100644 --- a/screener/migrations/0036_screen_request_language_code.py +++ b/screener/migrations/0036_screen_request_language_code.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0035_screen_county'), + ("screener", "0035_screen_county"), ] operations = [ migrations.AddField( - model_name='screen', - name='request_language_code', + model_name="screen", + name="request_language_code", field=models.CharField(blank=True, max_length=12, null=True), ), ] diff --git a/screener/migrations/0037_eligibilitysnapshot_programeligibilitysnapshot.py b/screener/migrations/0037_eligibilitysnapshot_programeligibilitysnapshot.py index 89028830..a026c130 100644 --- a/screener/migrations/0037_eligibilitysnapshot_programeligibilitysnapshot.py +++ b/screener/migrations/0037_eligibilitysnapshot_programeligibilitysnapshot.py @@ -5,35 +5,48 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0036_screen_request_language_code'), + ("screener", "0036_screen_request_language_code"), ] operations = [ migrations.CreateModel( - name='EligibilitySnapshot', + name="EligibilitySnapshot", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('submission_date', models.DateTimeField(auto_now=True)), - ('screen', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='eligibility_snapshots', to='screener.screen')), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("submission_date", models.DateTimeField(auto_now=True)), + ( + "screen", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="eligibility_snapshots", + to="screener.screen", + ), + ), ], ), migrations.CreateModel( - name='ProgramEligibilitySnapshot', + name="ProgramEligibilitySnapshot", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=320)), - ('name_abbreviated', models.CharField(max_length=32)), - ('value_type', models.CharField(max_length=120)), - ('estimated_value', models.DecimalField(decimal_places=2, max_digits=10)), - ('estimated_delivery_time', models.CharField(max_length=120)), - ('estimated_application_time', models.CharField(max_length=120)), - ('legal_status_required', models.CharField(max_length=120)), - ('eligible', models.BooleanField()), - ('failed_tests', models.JSONField()), - ('passed_tests', models.JSONField()), - ('eligibility_snapshot', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='program_snapshots', to='screener.eligibilitysnapshot')), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("name", models.CharField(max_length=320)), + ("name_abbreviated", models.CharField(max_length=32)), + ("value_type", models.CharField(max_length=120)), + ("estimated_value", models.DecimalField(decimal_places=2, max_digits=10)), + ("estimated_delivery_time", models.CharField(max_length=120)), + ("estimated_application_time", models.CharField(max_length=120)), + ("legal_status_required", models.CharField(max_length=120)), + ("eligible", models.BooleanField()), + ("failed_tests", models.JSONField()), + ("passed_tests", models.JSONField()), + ( + "eligibility_snapshot", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="program_snapshots", + to="screener.eligibilitysnapshot", + ), + ), ], ), ] diff --git a/screener/migrations/0038_alter_programeligibilitysnapshot_estimated_application_time_and_more.py b/screener/migrations/0038_alter_programeligibilitysnapshot_estimated_application_time_and_more.py index 18bafb77..d8a24e8c 100644 --- a/screener/migrations/0038_alter_programeligibilitysnapshot_estimated_application_time_and_more.py +++ b/screener/migrations/0038_alter_programeligibilitysnapshot_estimated_application_time_and_more.py @@ -4,35 +4,34 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0037_eligibilitysnapshot_programeligibilitysnapshot'), + ("screener", "0037_eligibilitysnapshot_programeligibilitysnapshot"), ] operations = [ migrations.AlterField( - model_name='programeligibilitysnapshot', - name='estimated_application_time', + model_name="programeligibilitysnapshot", + name="estimated_application_time", field=models.CharField(blank=True, max_length=120, null=True), ), migrations.AlterField( - model_name='programeligibilitysnapshot', - name='estimated_delivery_time', + model_name="programeligibilitysnapshot", + name="estimated_delivery_time", field=models.CharField(blank=True, max_length=120, null=True), ), migrations.AlterField( - model_name='programeligibilitysnapshot', - name='failed_tests', + model_name="programeligibilitysnapshot", + name="failed_tests", field=models.JSONField(blank=True, null=True), ), migrations.AlterField( - model_name='programeligibilitysnapshot', - name='legal_status_required', + model_name="programeligibilitysnapshot", + name="legal_status_required", field=models.CharField(blank=True, max_length=120, null=True), ), migrations.AlterField( - model_name='programeligibilitysnapshot', - name='passed_tests', + model_name="programeligibilitysnapshot", + name="passed_tests", field=models.JSONField(blank=True, null=True), ), ] diff --git a/screener/migrations/0039_screen_has_ssi.py b/screener/migrations/0039_screen_has_ssi.py index 116f4e23..84aa63e9 100644 --- a/screener/migrations/0039_screen_has_ssi.py +++ b/screener/migrations/0039_screen_has_ssi.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0038_alter_programeligibilitysnapshot_estimated_application_time_and_more'), + ("screener", "0038_alter_programeligibilitysnapshot_estimated_application_time_and_more"), ] operations = [ migrations.AddField( - model_name='screen', - name='has_ssi', + model_name="screen", + name="has_ssi", field=models.BooleanField(blank=True, default=False, null=True), ), ] diff --git a/screener/migrations/0040_screen_has_chp_hi_screen_has_employer_hi_and_more.py b/screener/migrations/0040_screen_has_chp_hi_screen_has_employer_hi_and_more.py index d5f205d5..b52afd91 100644 --- a/screener/migrations/0040_screen_has_chp_hi_screen_has_employer_hi_and_more.py +++ b/screener/migrations/0040_screen_has_chp_hi_screen_has_employer_hi_and_more.py @@ -4,35 +4,34 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0039_screen_has_ssi'), + ("screener", "0039_screen_has_ssi"), ] operations = [ migrations.AddField( - model_name='screen', - name='has_chp_hi', + model_name="screen", + name="has_chp_hi", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_employer_hi', + model_name="screen", + name="has_employer_hi", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_medicaid_hi', + model_name="screen", + name="has_medicaid_hi", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_no_hi', + model_name="screen", + name="has_no_hi", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_private_hi', + model_name="screen", + name="has_private_hi", field=models.BooleanField(blank=True, default=False, null=True), ), ] diff --git a/screener/migrations/0041_screen_referrer_code.py b/screener/migrations/0041_screen_referrer_code.py index 8cdcb3cd..bfcb342b 100644 --- a/screener/migrations/0041_screen_referrer_code.py +++ b/screener/migrations/0041_screen_referrer_code.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0040_screen_has_chp_hi_screen_has_employer_hi_and_more'), + ("screener", "0040_screen_has_chp_hi_screen_has_employer_hi_and_more"), ] operations = [ migrations.AddField( - model_name='screen', - name='referrer_code', + model_name="screen", + name="referrer_code", field=models.CharField(blank=True, default=None, max_length=320, null=True), ), ] diff --git a/screener/migrations/0042_screen_needs_baby_supplies_and_more.py b/screener/migrations/0042_screen_needs_baby_supplies_and_more.py index e1c1808f..4e6a039a 100644 --- a/screener/migrations/0042_screen_needs_baby_supplies_and_more.py +++ b/screener/migrations/0042_screen_needs_baby_supplies_and_more.py @@ -4,40 +4,39 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0041_screen_referrer_code'), + ("screener", "0041_screen_referrer_code"), ] operations = [ migrations.AddField( - model_name='screen', - name='needs_baby_supplies', + model_name="screen", + name="needs_baby_supplies", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='needs_child_dev_help', + model_name="screen", + name="needs_child_dev_help", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='needs_food', + model_name="screen", + name="needs_food", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='needs_funeral_help', + model_name="screen", + name="needs_funeral_help", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='needs_housing_help', + model_name="screen", + name="needs_housing_help", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='needs_mental_health_help', + model_name="screen", + name="needs_mental_health_help", field=models.BooleanField(blank=True, default=False, null=True), ), ] diff --git a/screener/migrations/0043_screen_has_medicare_hi.py b/screener/migrations/0043_screen_has_medicare_hi.py index e4e6f54e..e5babd3d 100644 --- a/screener/migrations/0043_screen_has_medicare_hi.py +++ b/screener/migrations/0043_screen_has_medicare_hi.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0042_screen_needs_baby_supplies_and_more'), + ("screener", "0042_screen_needs_baby_supplies_and_more"), ] operations = [ migrations.AddField( - model_name='screen', - name='has_medicare_hi', + model_name="screen", + name="has_medicare_hi", field=models.BooleanField(blank=True, default=False, null=True), ), ] diff --git a/screener/migrations/0044_screen_is_verified.py b/screener/migrations/0044_screen_is_verified.py index b0ce051f..65b0ce57 100644 --- a/screener/migrations/0044_screen_is_verified.py +++ b/screener/migrations/0044_screen_is_verified.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0043_screen_has_medicare_hi'), + ("screener", "0043_screen_has_medicare_hi"), ] operations = [ migrations.AddField( - model_name='screen', - name='is_verified', + model_name="screen", + name="is_verified", field=models.BooleanField(blank=True, default=False), ), ] diff --git a/screener/migrations/0045_screen_uuid.py b/screener/migrations/0045_screen_uuid.py index efa0f356..11d1d653 100644 --- a/screener/migrations/0045_screen_uuid.py +++ b/screener/migrations/0045_screen_uuid.py @@ -5,15 +5,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0044_screen_is_verified'), + ("screener", "0044_screen_is_verified"), ] operations = [ migrations.AddField( - model_name='screen', - name='uuid', + model_name="screen", + name="uuid", field=models.UUIDField(default=uuid.uuid4, editable=False), ), ] diff --git a/screener/migrations/0046_alter_screen_uuid.py b/screener/migrations/0046_alter_screen_uuid.py index 55eeae10..5e8d3853 100644 --- a/screener/migrations/0046_alter_screen_uuid.py +++ b/screener/migrations/0046_alter_screen_uuid.py @@ -5,15 +5,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0045_screen_uuid'), + ("screener", "0045_screen_uuid"), ] operations = [ migrations.AlterField( - model_name='screen', - name='uuid', + model_name="screen", + name="uuid", field=models.UUIDField(default=uuid.uuid4), ), ] diff --git a/screener/migrations/0047_incomestream_hours_worked.py b/screener/migrations/0047_incomestream_hours_worked.py index 144f8eb7..9cd2edd9 100644 --- a/screener/migrations/0047_incomestream_hours_worked.py +++ b/screener/migrations/0047_incomestream_hours_worked.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0046_alter_screen_uuid'), + ("screener", "0046_alter_screen_uuid"), ] operations = [ migrations.AddField( - model_name='incomestream', - name='hours_worked', + model_name="incomestream", + name="hours_worked", field=models.IntegerField(null=True), ), ] diff --git a/screener/migrations/0048_screen_needs_family_planning_help.py b/screener/migrations/0048_screen_needs_family_planning_help.py index ebc5c318..2a7f76eb 100644 --- a/screener/migrations/0048_screen_needs_family_planning_help.py +++ b/screener/migrations/0048_screen_needs_family_planning_help.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0047_incomestream_hours_worked'), + ("screener", "0047_incomestream_hours_worked"), ] operations = [ migrations.AddField( - model_name='screen', - name='needs_family_planning_help', + model_name="screen", + name="needs_family_planning_help", field=models.BooleanField(blank=True, default=False, null=True), ), ] diff --git a/screener/migrations/0049_eligibilitysnapshot_batch.py b/screener/migrations/0049_eligibilitysnapshot_batch.py index 00664c9c..4c3142eb 100644 --- a/screener/migrations/0049_eligibilitysnapshot_batch.py +++ b/screener/migrations/0049_eligibilitysnapshot_batch.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0048_screen_needs_family_planning_help'), + ("screener", "0048_screen_needs_family_planning_help"), ] operations = [ migrations.AddField( - model_name='eligibilitysnapshot', - name='batch', + model_name="eligibilitysnapshot", + name="batch", field=models.BooleanField(default=False), ), ] diff --git a/screener/migrations/0050_rename_batch_eligibilitysnapshot_is_batch.py b/screener/migrations/0050_rename_batch_eligibilitysnapshot_is_batch.py index 65329ee0..84ba7698 100644 --- a/screener/migrations/0050_rename_batch_eligibilitysnapshot_is_batch.py +++ b/screener/migrations/0050_rename_batch_eligibilitysnapshot_is_batch.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0049_eligibilitysnapshot_batch'), + ("screener", "0049_eligibilitysnapshot_batch"), ] operations = [ migrations.RenameField( - model_name='eligibilitysnapshot', - old_name='batch', - new_name='is_batch', + model_name="eligibilitysnapshot", + old_name="batch", + new_name="is_batch", ), ] diff --git a/screener/migrations/0051_programeligibilitysnapshot_new.py b/screener/migrations/0051_programeligibilitysnapshot_new.py index fe09c847..aed99351 100644 --- a/screener/migrations/0051_programeligibilitysnapshot_new.py +++ b/screener/migrations/0051_programeligibilitysnapshot_new.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0050_rename_batch_eligibilitysnapshot_is_batch'), + ("screener", "0050_rename_batch_eligibilitysnapshot_is_batch"), ] operations = [ migrations.AddField( - model_name='programeligibilitysnapshot', - name='new', + model_name="programeligibilitysnapshot", + name="new", field=models.BooleanField(default=False), ), ] diff --git a/screener/migrations/0052_alter_expense_household_member.py b/screener/migrations/0052_alter_expense_household_member.py index b9230f44..63d6119a 100644 --- a/screener/migrations/0052_alter_expense_household_member.py +++ b/screener/migrations/0052_alter_expense_household_member.py @@ -5,15 +5,19 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0051_programeligibilitysnapshot_new'), + ("screener", "0051_programeligibilitysnapshot_new"), ] operations = [ migrations.AlterField( - model_name='expense', - name='household_member', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='expenses', to='screener.householdmember'), + model_name="expense", + name="household_member", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="expenses", + to="screener.householdmember", + ), ), ] diff --git a/screener/migrations/0053_alter_householdmember_has_expenses_and_more.py b/screener/migrations/0053_alter_householdmember_has_expenses_and_more.py index f80325bb..7cef8bbb 100644 --- a/screener/migrations/0053_alter_householdmember_has_expenses_and_more.py +++ b/screener/migrations/0053_alter_householdmember_has_expenses_and_more.py @@ -4,20 +4,19 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0052_alter_expense_household_member'), + ("screener", "0052_alter_expense_household_member"), ] operations = [ migrations.AlterField( - model_name='householdmember', - name='has_expenses', + model_name="householdmember", + name="has_expenses", field=models.BooleanField(null=True), ), migrations.AlterField( - model_name='householdmember', - name='has_income', + model_name="householdmember", + name="has_income", field=models.BooleanField(null=True), ), ] diff --git a/screener/migrations/0054_alter_expense_amount_alter_expense_frequency_and_more.py b/screener/migrations/0054_alter_expense_amount_alter_expense_frequency_and_more.py index d7bb9d19..f2044965 100644 --- a/screener/migrations/0054_alter_expense_amount_alter_expense_frequency_and_more.py +++ b/screener/migrations/0054_alter_expense_amount_alter_expense_frequency_and_more.py @@ -4,125 +4,124 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0053_alter_householdmember_has_expenses_and_more'), + ("screener", "0053_alter_householdmember_has_expenses_and_more"), ] operations = [ migrations.AlterField( - model_name='expense', - name='amount', + model_name="expense", + name="amount", field=models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True), ), migrations.AlterField( - model_name='expense', - name='frequency', + model_name="expense", + name="frequency", field=models.CharField(blank=True, max_length=30, null=True), ), migrations.AlterField( - model_name='expense', - name='type', + model_name="expense", + name="type", field=models.CharField(blank=True, max_length=30, null=True), ), migrations.AlterField( - model_name='householdmember', - name='age', + model_name="householdmember", + name="age", field=models.IntegerField(blank=True, null=True), ), migrations.AlterField( - model_name='householdmember', - name='disabled', + model_name="householdmember", + name="disabled", field=models.BooleanField(blank=True, null=True), ), migrations.AlterField( - model_name='householdmember', - name='has_expenses', + model_name="householdmember", + name="has_expenses", field=models.BooleanField(blank=True, null=True), ), migrations.AlterField( - model_name='householdmember', - name='has_income', + model_name="householdmember", + name="has_income", field=models.BooleanField(blank=True, null=True), ), migrations.AlterField( - model_name='householdmember', - name='pregnant', + model_name="householdmember", + name="pregnant", field=models.BooleanField(blank=True, null=True), ), migrations.AlterField( - model_name='householdmember', - name='relationship', + model_name="householdmember", + name="relationship", field=models.CharField(blank=True, max_length=30, null=True), ), migrations.AlterField( - model_name='householdmember', - name='student', + model_name="householdmember", + name="student", field=models.BooleanField(blank=True, null=True), ), migrations.AlterField( - model_name='householdmember', - name='student_full_time', + model_name="householdmember", + name="student_full_time", field=models.BooleanField(blank=True, null=True), ), migrations.AlterField( - model_name='householdmember', - name='unemployed', + model_name="householdmember", + name="unemployed", field=models.BooleanField(blank=True, null=True), ), migrations.AlterField( - model_name='householdmember', - name='veteran', + model_name="householdmember", + name="veteran", field=models.BooleanField(blank=True, null=True), ), migrations.AlterField( - model_name='householdmember', - name='visually_impaired', + model_name="householdmember", + name="visually_impaired", field=models.BooleanField(blank=True, null=True), ), migrations.AlterField( - model_name='householdmember', - name='worked_in_last_18_mos', + model_name="householdmember", + name="worked_in_last_18_mos", field=models.BooleanField(blank=True, null=True), ), migrations.AlterField( - model_name='incomestream', - name='amount', + model_name="incomestream", + name="amount", field=models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True), ), migrations.AlterField( - model_name='incomestream', - name='frequency', + model_name="incomestream", + name="frequency", field=models.CharField(blank=True, max_length=30, null=True), ), migrations.AlterField( - model_name='incomestream', - name='hours_worked', + model_name="incomestream", + name="hours_worked", field=models.IntegerField(blank=True, null=True), ), migrations.AlterField( - model_name='incomestream', - name='type', + model_name="incomestream", + name="type", field=models.CharField(blank=True, max_length=30, null=True), ), migrations.AlterField( - model_name='screen', - name='agree_to_tos', + model_name="screen", + name="agree_to_tos", field=models.BooleanField(blank=True, null=True), ), migrations.AlterField( - model_name='screen', - name='household_size', + model_name="screen", + name="household_size", field=models.IntegerField(blank=True, null=True), ), migrations.AlterField( - model_name='screen', - name='submission_date', + model_name="screen", + name="submission_date", field=models.DateTimeField(blank=True, null=True), ), migrations.AlterField( - model_name='screen', - name='zipcode', + model_name="screen", + name="zipcode", field=models.CharField(blank=True, max_length=5, null=True), ), ] diff --git a/screener/migrations/0055_screen_has_andcs_screen_has_benefits_and_more.py b/screener/migrations/0055_screen_has_andcs_screen_has_benefits_and_more.py index 07b3a853..0499cd39 100644 --- a/screener/migrations/0055_screen_has_andcs_screen_has_benefits_and_more.py +++ b/screener/migrations/0055_screen_has_andcs_screen_has_benefits_and_more.py @@ -4,60 +4,59 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0054_alter_expense_amount_alter_expense_frequency_and_more'), + ("screener", "0054_alter_expense_amount_alter_expense_frequency_and_more"), ] operations = [ migrations.AddField( - model_name='screen', - name='has_andcs', + model_name="screen", + name="has_andcs", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_benefits', - field=models.CharField(blank=True, default='preferNotToAnswer', max_length=32, null=True), + model_name="screen", + name="has_benefits", + field=models.CharField(blank=True, default="preferNotToAnswer", max_length=32, null=True), ), migrations.AddField( - model_name='screen', - name='has_cdhcs', + model_name="screen", + name="has_cdhcs", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_chs', + model_name="screen", + name="has_chs", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_cpcr', + model_name="screen", + name="has_cpcr", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_dpp', + model_name="screen", + name="has_dpp", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_ede', + model_name="screen", + name="has_ede", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_erc', + model_name="screen", + name="has_erc", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_leap', + model_name="screen", + name="has_leap", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_oap', + model_name="screen", + name="has_oap", field=models.BooleanField(blank=True, default=False, null=True), ), ] diff --git a/screener/migrations/0056_screen_completed.py b/screener/migrations/0056_screen_completed.py index 38f8afa1..e2ed6944 100644 --- a/screener/migrations/0056_screen_completed.py +++ b/screener/migrations/0056_screen_completed.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0055_screen_has_andcs_screen_has_benefits_and_more'), + ("screener", "0055_screen_has_andcs_screen_has_benefits_and_more"), ] operations = [ migrations.AddField( - model_name='screen', - name='completed', + model_name="screen", + name="completed", field=models.BooleanField(default=True), preserve_default=False, ), diff --git a/screener/migrations/0057_screen_has_coctc_screen_has_upk.py b/screener/migrations/0057_screen_has_coctc_screen_has_upk.py index 5df00262..c31e431e 100644 --- a/screener/migrations/0057_screen_has_coctc_screen_has_upk.py +++ b/screener/migrations/0057_screen_has_coctc_screen_has_upk.py @@ -4,20 +4,19 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0056_screen_completed'), + ("screener", "0056_screen_completed"), ] operations = [ migrations.AddField( - model_name='screen', - name='has_coctc', + model_name="screen", + name="has_coctc", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='has_upk', + model_name="screen", + name="has_upk", field=models.BooleanField(blank=True, default=False, null=True), ), ] diff --git a/screener/migrations/0058_webhookfunctions_webhooks_webhookstranslation.py b/screener/migrations/0058_webhookfunctions_webhooks_webhookstranslation.py index d0b6c4f7..9535fb58 100644 --- a/screener/migrations/0058_webhookfunctions_webhooks_webhookstranslation.py +++ b/screener/migrations/0058_webhookfunctions_webhooks_webhookstranslation.py @@ -7,46 +7,54 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0057_screen_has_coctc_screen_has_upk'), + ("screener", "0057_screen_has_coctc_screen_has_upk"), ] operations = [ migrations.CreateModel( - name='WebHookFunctions', + name="WebHookFunctions", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=64)), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("name", models.CharField(max_length=64)), ], ), migrations.CreateModel( - name='WebHooks', + name="WebHooks", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('referrer_code', models.CharField(max_length=120)), - ('url', models.CharField(max_length=320)), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("referrer_code", models.CharField(max_length=120)), + ("url", models.CharField(max_length=320)), ], options={ - 'abstract': False, + "abstract": False, }, bases=(parler.models.TranslatableModelMixin, models.Model), ), migrations.CreateModel( - name='WebHooksTranslation', + name="WebHooksTranslation", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('language_code', models.CharField(db_index=True, max_length=15, verbose_name='Language')), - ('consent_text', models.TextField()), - ('master', parler.fields.TranslationsForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='screener.webhooks')), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("language_code", models.CharField(db_index=True, max_length=15, verbose_name="Language")), + ("consent_text", models.TextField()), + ( + "master", + parler.fields.TranslationsForeignKey( + editable=False, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="translations", + to="screener.webhooks", + ), + ), ], options={ - 'verbose_name': 'web hooks Translation', - 'db_table': 'screener_webhooks_translation', - 'db_tablespace': '', - 'managed': True, - 'default_permissions': (), - 'unique_together': {('language_code', 'master')}, + "verbose_name": "web hooks Translation", + "db_table": "screener_webhooks_translation", + "db_tablespace": "", + "managed": True, + "default_permissions": (), + "unique_together": {("language_code", "master")}, }, bases=(parler.models.TranslatedFieldsModelMixin, models.Model), ), diff --git a/screener/migrations/0059_webhook_webhookfunction_webhooktranslation_and_more.py b/screener/migrations/0059_webhook_webhookfunction_webhooktranslation_and_more.py index 936b95c4..ace290bc 100644 --- a/screener/migrations/0059_webhook_webhookfunction_webhooktranslation_and_more.py +++ b/screener/migrations/0059_webhook_webhookfunction_webhooktranslation_and_more.py @@ -7,69 +7,77 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0058_webhookfunctions_webhooks_webhookstranslation'), + ("screener", "0058_webhookfunctions_webhooks_webhookstranslation"), ] operations = [ migrations.CreateModel( - name='WebHook', + name="WebHook", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('referrer_code', models.CharField(max_length=120)), - ('url', models.CharField(max_length=320)), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("referrer_code", models.CharField(max_length=120)), + ("url", models.CharField(max_length=320)), ], options={ - 'abstract': False, + "abstract": False, }, bases=(parler.models.TranslatableModelMixin, models.Model), ), migrations.CreateModel( - name='WebHookFunction', + name="WebHookFunction", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=64)), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("name", models.CharField(max_length=64)), ], ), migrations.CreateModel( - name='WebHookTranslation', + name="WebHookTranslation", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('language_code', models.CharField(db_index=True, max_length=15, verbose_name='Language')), - ('consent_text', models.TextField()), - ('master', parler.fields.TranslationsForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='screener.webhook')), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("language_code", models.CharField(db_index=True, max_length=15, verbose_name="Language")), + ("consent_text", models.TextField()), + ( + "master", + parler.fields.TranslationsForeignKey( + editable=False, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="translations", + to="screener.webhook", + ), + ), ], options={ - 'verbose_name': 'web hook Translation', - 'db_table': 'screener_webhook_translation', - 'db_tablespace': '', - 'managed': True, - 'default_permissions': (), - 'unique_together': {('language_code', 'master')}, + "verbose_name": "web hook Translation", + "db_table": "screener_webhook_translation", + "db_tablespace": "", + "managed": True, + "default_permissions": (), + "unique_together": {("language_code", "master")}, }, bases=(parler.models.TranslatedFieldsModelMixin, models.Model), ), migrations.DeleteModel( - name='WebHookFunctions', + name="WebHookFunctions", ), migrations.AlterUniqueTogether( - name='webhookstranslation', + name="webhookstranslation", unique_together=None, ), migrations.RemoveField( - model_name='webhookstranslation', - name='master', + model_name="webhookstranslation", + name="master", ), migrations.DeleteModel( - name='WebHooks', + name="WebHooks", ), migrations.DeleteModel( - name='WebHooksTranslation', + name="WebHooksTranslation", ), migrations.AddField( - model_name='webhook', - name='functions', - field=models.ManyToManyField(related_name='function', to='screener.webhookfunction'), + model_name="webhook", + name="functions", + field=models.ManyToManyField(related_name="function", to="screener.webhookfunction"), ), ] diff --git a/screener/migrations/0060_screen_is_test_data.py b/screener/migrations/0060_screen_is_test_data.py index 95e95ddf..77b681cf 100644 --- a/screener/migrations/0060_screen_is_test_data.py +++ b/screener/migrations/0060_screen_is_test_data.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0059_webhook_webhookfunction_webhooktranslation_and_more'), + ("screener", "0059_webhook_webhookfunction_webhooktranslation_and_more"), ] operations = [ migrations.AddField( - model_name='screen', - name='is_test_data', + model_name="screen", + name="is_test_data", field=models.BooleanField(blank=True, default=False), ), ] diff --git a/screener/migrations/0061_alter_screen_is_test_data.py b/screener/migrations/0061_alter_screen_is_test_data.py index 809b2542..65e46c3b 100644 --- a/screener/migrations/0061_alter_screen_is_test_data.py +++ b/screener/migrations/0061_alter_screen_is_test_data.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0060_screen_is_test_data'), + ("screener", "0060_screen_is_test_data"), ] operations = [ migrations.AlterField( - model_name='screen', - name='is_test_data', + model_name="screen", + name="is_test_data", field=models.BooleanField(blank=True), ), ] diff --git a/screener/migrations/0062_alter_screen_is_test_data.py b/screener/migrations/0062_alter_screen_is_test_data.py index 22abc76a..8d5e8b56 100644 --- a/screener/migrations/0062_alter_screen_is_test_data.py +++ b/screener/migrations/0062_alter_screen_is_test_data.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0061_alter_screen_is_test_data'), + ("screener", "0061_alter_screen_is_test_data"), ] operations = [ migrations.AlterField( - model_name='screen', - name='is_test_data', + model_name="screen", + name="is_test_data", field=models.BooleanField(blank=True, null=True), ), ] diff --git a/screener/migrations/0063_alter_webhooktranslation_unique_together_and_more.py b/screener/migrations/0063_alter_webhooktranslation_unique_together_and_more.py index 1bceb48f..eb14c3ad 100644 --- a/screener/migrations/0063_alter_webhooktranslation_unique_together_and_more.py +++ b/screener/migrations/0063_alter_webhooktranslation_unique_together_and_more.py @@ -4,27 +4,26 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0062_alter_screen_is_test_data'), + ("screener", "0062_alter_screen_is_test_data"), ] operations = [ migrations.AlterUniqueTogether( - name='webhooktranslation', + name="webhooktranslation", unique_together=None, ), migrations.RemoveField( - model_name='webhooktranslation', - name='master', + model_name="webhooktranslation", + name="master", ), migrations.DeleteModel( - name='WebHook', + name="WebHook", ), migrations.DeleteModel( - name='WebHookFunction', + name="WebHookFunction", ), migrations.DeleteModel( - name='WebHookTranslation', + name="WebHookTranslation", ), ] diff --git a/screener/migrations/0064_screen_needs_dental_care_help_and_more.py b/screener/migrations/0064_screen_needs_dental_care_help_and_more.py index 6f41d27f..9d483c51 100644 --- a/screener/migrations/0064_screen_needs_dental_care_help_and_more.py +++ b/screener/migrations/0064_screen_needs_dental_care_help_and_more.py @@ -4,25 +4,24 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0063_alter_webhooktranslation_unique_together_and_more'), + ("screener", "0063_alter_webhooktranslation_unique_together_and_more"), ] operations = [ migrations.AddField( - model_name='screen', - name='needs_dental_care_help', + model_name="screen", + name="needs_dental_care_help", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='needs_job_resources', + model_name="screen", + name="needs_job_resources", field=models.BooleanField(blank=True, default=False, null=True), ), migrations.AddField( - model_name='screen', - name='needs_legal_services', + model_name="screen", + name="needs_legal_services", field=models.BooleanField(blank=True, default=False, null=True), ), ] diff --git a/screener/migrations/0065_rename_needs_dental_care_help_screen_needs_dental_care.py b/screener/migrations/0065_rename_needs_dental_care_help_screen_needs_dental_care.py index 72b4b84a..10ee521d 100644 --- a/screener/migrations/0065_rename_needs_dental_care_help_screen_needs_dental_care.py +++ b/screener/migrations/0065_rename_needs_dental_care_help_screen_needs_dental_care.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0064_screen_needs_dental_care_help_and_more'), + ("screener", "0064_screen_needs_dental_care_help_and_more"), ] operations = [ migrations.RenameField( - model_name='screen', - old_name='needs_dental_care_help', - new_name='needs_dental_care', + model_name="screen", + old_name="needs_dental_care_help", + new_name="needs_dental_care", ), ] diff --git a/screener/migrations/0066_screen_is_13_or_older.py b/screener/migrations/0066_screen_is_13_or_older.py index d4b9553c..f48e87c7 100644 --- a/screener/migrations/0066_screen_is_13_or_older.py +++ b/screener/migrations/0066_screen_is_13_or_older.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0065_rename_needs_dental_care_help_screen_needs_dental_care'), + ("screener", "0065_rename_needs_dental_care_help_screen_needs_dental_care"), ] operations = [ migrations.AddField( - model_name='screen', - name='is_13_or_older', + model_name="screen", + name="is_13_or_older", field=models.BooleanField(blank=True, null=True), ), ] diff --git a/screener/migrations/0067_alter_expense_household_member_alter_screen_user.py b/screener/migrations/0067_alter_expense_household_member_alter_screen_user.py index b0efdc35..4f5c1320 100644 --- a/screener/migrations/0067_alter_expense_household_member_alter_screen_user.py +++ b/screener/migrations/0067_alter_expense_household_member_alter_screen_user.py @@ -6,21 +6,31 @@ class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('screener', '0066_screen_is_13_or_older'), + ("screener", "0066_screen_is_13_or_older"), ] operations = [ migrations.AlterField( - model_name='expense', - name='household_member', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='expenses', to='screener.householdmember'), + model_name="expense", + name="household_member", + field=models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name="expenses", + to="screener.householdmember", + ), ), migrations.AlterField( - model_name='screen', - name='user', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='screens', to=settings.AUTH_USER_MODEL), + model_name="screen", + name="user", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name="screens", + to=settings.AUTH_USER_MODEL, + ), ), ] diff --git a/screener/migrations/0068_householdmember_insurance.py b/screener/migrations/0068_householdmember_insurance.py index 9d1d2106..eabbbba4 100644 --- a/screener/migrations/0068_householdmember_insurance.py +++ b/screener/migrations/0068_householdmember_insurance.py @@ -4,15 +4,28 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0067_alter_expense_household_member_alter_screen_user'), + ("screener", "0067_alter_expense_household_member_alter_screen_user"), ] operations = [ migrations.AddField( - model_name='householdmember', - name='insurance', - field=models.CharField(choices=[('dont_know', 'Dont Know'), ('none', 'None'), ('employer', 'Employer'), ('private', 'Private'), ('chp', 'Chp'), ('medicaid', 'Medicaid'), ('medicare', 'Medicare'), ('emergency_medicaid', 'Emergency Medicaid'), ('family_planning', 'Family Planning')], default='dont_know', max_length=64), + model_name="householdmember", + name="insurance", + field=models.CharField( + choices=[ + ("dont_know", "Dont Know"), + ("none", "None"), + ("employer", "Employer"), + ("private", "Private"), + ("chp", "Chp"), + ("medicaid", "Medicaid"), + ("medicare", "Medicare"), + ("emergency_medicaid", "Emergency Medicaid"), + ("family_planning", "Family Planning"), + ], + default="dont_know", + max_length=64, + ), ), ] diff --git a/screener/migrations/0069_alter_screen_has_chp_hi_alter_screen_has_employer_hi_and_more.py b/screener/migrations/0069_alter_screen_has_chp_hi_alter_screen_has_employer_hi_and_more.py index 27ab9d63..17c16f92 100644 --- a/screener/migrations/0069_alter_screen_has_chp_hi_alter_screen_has_employer_hi_and_more.py +++ b/screener/migrations/0069_alter_screen_has_chp_hi_alter_screen_has_employer_hi_and_more.py @@ -4,40 +4,39 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0068_householdmember_insurance'), + ("screener", "0068_householdmember_insurance"), ] operations = [ migrations.AlterField( - model_name='screen', - name='has_chp_hi', + model_name="screen", + name="has_chp_hi", field=models.BooleanField(blank=True, default=None, null=True), ), migrations.AlterField( - model_name='screen', - name='has_employer_hi', + model_name="screen", + name="has_employer_hi", field=models.BooleanField(blank=True, default=None, null=True), ), migrations.AlterField( - model_name='screen', - name='has_medicaid_hi', + model_name="screen", + name="has_medicaid_hi", field=models.BooleanField(blank=True, default=None, null=True), ), migrations.AlterField( - model_name='screen', - name='has_medicare_hi', + model_name="screen", + name="has_medicare_hi", field=models.BooleanField(blank=True, default=None, null=True), ), migrations.AlterField( - model_name='screen', - name='has_no_hi', + model_name="screen", + name="has_no_hi", field=models.BooleanField(blank=True, default=None, null=True), ), migrations.AlterField( - model_name='screen', - name='has_private_hi', + model_name="screen", + name="has_private_hi", field=models.BooleanField(blank=True, default=None, null=True), ), ] diff --git a/screener/migrations/0070_remove_programeligibilitysnapshot_legal_status_required.py b/screener/migrations/0070_remove_programeligibilitysnapshot_legal_status_required.py index 7735ee07..be878856 100644 --- a/screener/migrations/0070_remove_programeligibilitysnapshot_legal_status_required.py +++ b/screener/migrations/0070_remove_programeligibilitysnapshot_legal_status_required.py @@ -4,14 +4,13 @@ class Migration(migrations.Migration): - dependencies = [ - ('screener', '0069_alter_screen_has_chp_hi_alter_screen_has_employer_hi_and_more'), + ("screener", "0069_alter_screen_has_chp_hi_alter_screen_has_employer_hi_and_more"), ] operations = [ migrations.RemoveField( - model_name='programeligibilitysnapshot', - name='legal_status_required', + model_name="programeligibilitysnapshot", + name="legal_status_required", ), ] diff --git a/screener/migrations/0074_alter_screen_household_assets.py b/screener/migrations/0074_alter_screen_household_assets.py index 00a2cb39..534b039c 100644 --- a/screener/migrations/0074_alter_screen_household_assets.py +++ b/screener/migrations/0074_alter_screen_household_assets.py @@ -12,8 +12,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name="screen", name="household_assets", - field=models.DecimalField( - blank=True, decimal_places=2, default=0, max_digits=10, null=True - ), + field=models.DecimalField(blank=True, decimal_places=2, default=0, max_digits=10, null=True), ), ] diff --git a/screener/migrations/0075_alter_screen_household_assets.py b/screener/migrations/0075_alter_screen_household_assets.py index 045f3d6e..51896937 100644 --- a/screener/migrations/0075_alter_screen_household_assets.py +++ b/screener/migrations/0075_alter_screen_household_assets.py @@ -12,8 +12,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name="screen", name="household_assets", - field=models.DecimalField( - blank=True, decimal_places=2, default=None, max_digits=10, null=True - ), + field=models.DecimalField(blank=True, decimal_places=2, default=None, max_digits=10, null=True), ), ] diff --git a/screener/models.py b/screener/models.py index 1cab30f1..80bab04e 100644 --- a/screener/models.py +++ b/screener/models.py @@ -30,10 +30,10 @@ class Screen(models.Model): is_test = models.BooleanField(default=False, blank=True) is_test_data = models.BooleanField(blank=True, null=True) is_verified = models.BooleanField(default=False, blank=True) - user = models.ForeignKey(User, related_name='screens', on_delete=models.SET_NULL, blank=True, null=True) + user = models.ForeignKey(User, related_name="screens", on_delete=models.SET_NULL, blank=True, null=True) external_id = models.CharField(max_length=120, blank=True, null=True) request_language_code = models.CharField(max_length=12, blank=True, null=True) - has_benefits = models.CharField(max_length=32, default='preferNotToAnswer', blank=True, null=True) + has_benefits = models.CharField(max_length=32, default="preferNotToAnswer", blank=True, null=True) has_tanf = models.BooleanField(default=False, blank=True, null=True) has_wic = models.BooleanField(default=False, blank=True, null=True) has_snap = models.BooleanField(default=False, blank=True, null=True) @@ -115,15 +115,13 @@ def has_expense(self, expense_types): return True return False - def num_children(self, age_min=0, age_max=18, include_pregnant=False, child_relationship=['all']): + def num_children(self, age_min=0, age_max=18, include_pregnant=False, child_relationship=["all"]): children = 0 household_members = self.household_members.all() for household_member in household_members: - has_child_relationship = household_member.relationship in child_relationship or 'all' in child_relationship - if household_member.age >= age_min and \ - household_member.age <= age_max and \ - has_child_relationship: + has_child_relationship = household_member.relationship in child_relationship or "all" in child_relationship + if household_member.age >= age_min and household_member.age <= age_max and has_child_relationship: children += 1 if household_member.pregnant and include_pregnant: children += 1 @@ -140,15 +138,15 @@ def num_adults(self, age_max=19): def num_guardians(self): parents = 0 - child_relationship = ['child', 'fosterChild'] - guardian_relationship = ['parent', 'fosterParent'] + child_relationship = ["child", "fosterChild"] + guardian_relationship = ["parent", "fosterParent"] hoh_child_exists = False household_members = self.household_members.all() for household_member in household_members: if household_member.relationship in child_relationship: hoh_child_exists = True - elif household_member.relationship == 'headOfHousehold': + elif household_member.relationship == "headOfHousehold": if household_member.pregnant: hoh_child_exists = True elif household_member.pregnant: @@ -157,9 +155,9 @@ def num_guardians(self): parents += 1 for household_member in household_members: - if hoh_child_exists and household_member.relationship == 'spouse': + if hoh_child_exists and household_member.relationship == "spouse": parents += 1 - elif hoh_child_exists and household_member.relationship == 'headOfHousehold': + elif hoh_child_exists and household_member.relationship == "headOfHousehold": parents += 1 return parents @@ -168,7 +166,7 @@ def is_joint(self): is_joint = False household_members = self.household_members.all() for household_member in household_members: - if household_member.relationship == 'spouse': + if household_member.relationship == "spouse": is_joint = True return is_joint @@ -186,35 +184,38 @@ def relationship_map(self): all_members = self.household_members.values() for member in all_members: - if member['id'] in relationship_map and relationship_map[member['id']] is not None: + if member["id"] in relationship_map and relationship_map[member["id"]] is not None: continue - relationship = member['relationship'] + relationship = member["relationship"] probable_spouse = None - if relationship == 'headOfHousehold': + if relationship == "headOfHousehold": for other_member in all_members: - if other_member['relationship'] in ('spouse', 'domesticPartner') and\ - other_member['id'] not in relationship_map: - probable_spouse = other_member['id'] + if ( + other_member["relationship"] in ("spouse", "domesticPartner") + and other_member["id"] not in relationship_map + ): + probable_spouse = other_member["id"] break - elif relationship in ('spouse', 'domesticPartner'): + elif relationship in ("spouse", "domesticPartner"): for other_member in all_members: - if other_member['relationship'] == 'headOfHousehold' and\ - other_member['id'] not in relationship_map: - probable_spouse = other_member['id'] + if other_member["relationship"] == "headOfHousehold" and other_member["id"] not in relationship_map: + probable_spouse = other_member["id"] break - elif relationship in ('parent', 'fosterParent', 'stepParent', 'grandParent'): + elif relationship in ("parent", "fosterParent", "stepParent", "grandParent"): for other_member in all_members: - if other_member['relationship'] == relationship and\ - other_member['id'] != member['id'] and\ - other_member['id'] not in relationship_map: - probable_spouse = other_member['id'] + if ( + other_member["relationship"] == relationship + and other_member["id"] != member["id"] + and other_member["id"] not in relationship_map + ): + probable_spouse = other_member["id"] break - relationship_map[member['id']] = probable_spouse + relationship_map[member["id"]] = probable_spouse if probable_spouse is not None: - relationship_map[probable_spouse] = member['id'] + relationship_map[probable_spouse] = member["id"] return relationship_map @@ -227,41 +228,41 @@ def has_insurance_types(self, types, strict=True): def has_benefit(self, name_abbreviated): name_map = { - 'tanf': self.has_tanf, - 'wic': self.has_wic, - 'snap': self.has_snap, - 'lifeline': self.has_lifeline, - 'acp': self.has_acp, - 'eitc': self.has_eitc, - 'coeitc': self.has_coeitc, - 'nslp': self.has_nslp, - 'ctc': self.has_ctc, - 'rtdlive': self.has_rtdlive, - 'cccap': self.has_cccap, - 'mydenver': self.has_mydenver, - 'ccb': self.has_ccb, - 'ssi': self.has_ssi or self.calc_gross_income('yearly', ('sSI',)) > 0, - 'andcs': self.has_andcs, - 'chs': self.has_chs, - 'cpcr': self.has_cpcr, - 'cdhcs': self.has_cdhcs, - 'dpp': self.has_dpp, - 'ede': self.has_ede, - 'erc': self.has_erc, - 'leap': self.has_leap, - 'oap': self.has_oap, - 'coctc': self.has_coctc, - 'upk': self.has_upk, - 'ssdi': self.has_ssdi or self.calc_gross_income('yearly', ('sSDisability',)) > 0, - 'pell_grant': self.has_pell_grant, - 'rag': self.has_rag, - 'cowap': self.has_cowap, - 'ubp': self.has_ubp, - 'co_medicaid': self.has_medicaid or self.has_medicaid_hi, - 'nc_medicaid': self.has_medicaid or self.has_medicaid_hi, - 'medicare': self.has_medicare_hi, - 'chp': self.has_chp or self.has_chp_hi, - 'va': self.has_va, + "tanf": self.has_tanf, + "wic": self.has_wic, + "snap": self.has_snap, + "lifeline": self.has_lifeline, + "acp": self.has_acp, + "eitc": self.has_eitc, + "coeitc": self.has_coeitc, + "nslp": self.has_nslp, + "ctc": self.has_ctc, + "rtdlive": self.has_rtdlive, + "cccap": self.has_cccap, + "mydenver": self.has_mydenver, + "ccb": self.has_ccb, + "ssi": self.has_ssi or self.calc_gross_income("yearly", ("sSI",)) > 0, + "andcs": self.has_andcs, + "chs": self.has_chs, + "cpcr": self.has_cpcr, + "cdhcs": self.has_cdhcs, + "dpp": self.has_dpp, + "ede": self.has_ede, + "erc": self.has_erc, + "leap": self.has_leap, + "oap": self.has_oap, + "coctc": self.has_coctc, + "upk": self.has_upk, + "ssdi": self.has_ssdi or self.calc_gross_income("yearly", ("sSDisability",)) > 0, + "pell_grant": self.has_pell_grant, + "rag": self.has_rag, + "cowap": self.has_cowap, + "ubp": self.has_ubp, + "co_medicaid": self.has_medicaid or self.has_medicaid_hi, + "nc_medicaid": self.has_medicaid or self.has_medicaid_hi, + "medicare": self.has_medicare_hi, + "chp": self.has_chp or self.has_chp_hi, + "va": self.has_va, } has_insurance = self.has_insurance_types((name_abbreviated,), strict=False) @@ -274,19 +275,21 @@ def has_benefit(self, name_abbreviated): return has_insurance or has_benefit def set_screen_is_test(self): - referral_source_tests = ['testorprospect', 'test'] + referral_source_tests = ["testorprospect", "test"] - self.is_test_data = self.is_test or \ - (self.referral_source is not None and self.referral_source.lower() in referral_source_tests) or \ - (self.referrer_code is not None and self.referrer_code.lower() in referral_source_tests) + self.is_test_data = ( + self.is_test + or (self.referral_source is not None and self.referral_source.lower() in referral_source_tests) + or (self.referrer_code is not None and self.referrer_code.lower() in referral_source_tests) + ) self.save() def get_head(self): for member in self.household_members.all(): - if member.relationship == 'headOfHousehold': + if member.relationship == "headOfHousehold": return member - raise Exception('No head of household') + raise Exception("No head of household") def get_language_code(self): language_code = settings.LANGUAGE_CODE @@ -304,7 +307,7 @@ def has_members_ouside_of_tax_unit(self): return False def missing_fields(self): - screen_fields = ('zipcode', 'county', 'household_size', 'household_assets') + screen_fields = ("zipcode", "county", "household_size", "household_assets") missing_fields = Dependencies() @@ -325,7 +328,7 @@ def missing_fields(self): class Message(models.Model): sent = models.DateTimeField(auto_now=True) type = models.CharField(max_length=30) - screen = models.ForeignKey(Screen, related_name='messages', on_delete=models.CASCADE) + screen = models.ForeignKey(Screen, related_name="messages", on_delete=models.CASCADE) content = models.CharField(max_length=320, blank=True, null=True) uid = models.IntegerField(blank=True, null=True) @@ -333,7 +336,7 @@ class Message(models.Model): # Table of fields specific to individual household members. Parent model is the # Screen class HouseholdMember(models.Model): - screen = models.ForeignKey(Screen, related_name='household_members', on_delete=models.CASCADE) + screen = models.ForeignKey(Screen, related_name="household_members", on_delete=models.CASCADE) relationship = models.CharField(max_length=30, blank=True, null=True) age = models.IntegerField(blank=True, null=True) student = models.BooleanField(blank=True, null=True) @@ -389,13 +392,13 @@ def calc_net_income(self, frequency, income_types, expense_types): return float(net_income) def is_married(self): - if self.relationship in ('spouse', 'domesticPartner'): - head_of_house = HouseholdMember.objects.all().filter(screen=self.screen, relationship='headOfHousehold')[0] + if self.relationship in ("spouse", "domesticPartner"): + head_of_house = HouseholdMember.objects.all().filter(screen=self.screen, relationship="headOfHousehold")[0] return {"is_married": True, "married_to": head_of_house} - if self.relationship == 'headOfHousehold': + if self.relationship == "headOfHousehold": all_household_members = HouseholdMember.objects.all().filter(screen=self.screen) for member in all_household_members: - if member.relationship in ('spouse', 'domesticPartner'): + if member.relationship in ("spouse", "domesticPartner"): return {"is_married": True, "married_to": member} return {"is_married": False} @@ -403,7 +406,7 @@ def has_disability(self): return self.disabled or self.visually_impaired or self.long_term_disability def is_head(self): - return self.relationship == 'headOfHousehold' + return self.relationship == "headOfHousehold" def is_spouse(self): return self.screen.relationship_map()[self.screen.get_head().id] == self.id @@ -412,15 +415,8 @@ def is_dependent(self): is_tax_unit_spouse = self.is_spouse() is_tax_unit_head = self.is_head() is_tax_unit_dependent = ( - ( - self.age <= 18 - or (self.student and self.age <= 23) - or self.has_disability() - ) - and ( - self.calc_gross_income('yearly', ['all']) - <= self.screen.calc_gross_income('yearly', ['all']) / 2 - ) + (self.age <= 18 or (self.student and self.age <= 23) or self.has_disability()) + and (self.calc_gross_income("yearly", ["all"]) <= self.screen.calc_gross_income("yearly", ["all"]) / 2) and (not (is_tax_unit_head or is_tax_unit_spouse)) ) @@ -431,14 +427,14 @@ def is_in_tax_unit(self): def missing_fields(self): member_fields = ( - 'relationship', - 'age', - 'student', - 'pregnant', - 'visually_impaired', - 'disabled', - 'long_term_disability', - 'insurance' + "relationship", + "age", + "student", + "pregnant", + "visually_impaired", + "disabled", + "long_term_disability", + "insurance", ) missing_fields = Dependencies() @@ -455,8 +451,8 @@ def missing_fields(self): # HouseholdMember income streams class IncomeStream(models.Model): - screen = models.ForeignKey(Screen, related_name='income_streams', on_delete=models.CASCADE) - household_member = models.ForeignKey(HouseholdMember, related_name='income_streams', on_delete=models.CASCADE) + screen = models.ForeignKey(Screen, related_name="income_streams", on_delete=models.CASCADE) + household_member = models.ForeignKey(HouseholdMember, related_name="income_streams", on_delete=models.CASCADE) type = models.CharField(max_length=30, blank=True, null=True) amount = models.DecimalField(decimal_places=2, max_digits=10, blank=True, null=True) frequency = models.CharField(max_length=30, blank=True, null=True) @@ -498,20 +494,24 @@ def _hour_to_month(self): return self.amount * self.hours_worked * Decimal(4.35) def missing_fields(self): - income_fields = ('type', 'amount', 'frequency',) + income_fields = ( + "type", + "amount", + "frequency", + ) missing_fields = Dependencies() for field in income_fields: if getattr(self, field) is None: - missing_fields.add('income_' + field) + missing_fields.add("income_" + field) return missing_fields # HouseholdMember expenses class Expense(models.Model): - screen = models.ForeignKey(Screen, related_name='expenses', on_delete=models.CASCADE) - household_member = models.ForeignKey(HouseholdMember, related_name='expenses', on_delete=models.SET_NULL, null=True) + screen = models.ForeignKey(Screen, related_name="expenses", on_delete=models.CASCADE) + household_member = models.ForeignKey(HouseholdMember, related_name="expenses", on_delete=models.SET_NULL, null=True) type = models.CharField(max_length=30, blank=True, null=True) amount = models.DecimalField(decimal_places=2, max_digits=10, blank=True, null=True) frequency = models.CharField(max_length=30, blank=True, null=True) @@ -544,23 +544,20 @@ def yearly(self): return yearly def missing_fields(self): - expense_fields = ('type', 'amount') + expense_fields = ("type", "amount") missing_fields = Dependencies() for field in expense_fields: if getattr(self, field) is None: - missing_fields.add('expense_' + field) + missing_fields.add("expense_" + field) return missing_fields class Insurance(models.Model): household_member = models.OneToOneField( - HouseholdMember, - related_name='insurance', - null=False, - on_delete=models.CASCADE + HouseholdMember, related_name="insurance", null=False, on_delete=models.CASCADE ) dont_know = models.BooleanField(default=False) none = models.BooleanField(default=True) @@ -574,14 +571,14 @@ class Insurance(models.Model): va = models.BooleanField(default=False) def has_insurance_types(self, types, strict=True): - if 'none' in types: - types = (*types, 'dont_know') + if "none" in types: + types = (*types, "dont_know") insurance = self.insurance_map() for hi_type in types: if hi_type not in insurance: if strict: - raise KeyError(f'{hi_type} not in insurance types') + raise KeyError(f"{hi_type} not in insurance types") continue if insurance[hi_type]: @@ -591,18 +588,18 @@ def has_insurance_types(self, types, strict=True): def insurance_map(self): return { - 'dont_know': self.dont_know, - 'none': self.none, - 'employer': self.employer, - 'private': self.private, - 'chp': self.chp, - 'medicaid': self.medicaid, - 'nc_medicaid': self.medicaid, - 'co_medicaid': self.medicaid, - 'medicare': self.medicare, - 'emergency_medicaid': self.emergency_medicaid, - 'family_planning': self.family_planning, - 'va': self.va, + "dont_know": self.dont_know, + "none": self.none, + "employer": self.employer, + "private": self.private, + "chp": self.chp, + "medicaid": self.medicaid, + "nc_medicaid": self.medicaid, + "co_medicaid": self.medicaid, + "medicare": self.medicare, + "emergency_medicaid": self.emergency_medicaid, + "family_planning": self.family_planning, + "va": self.va, } @@ -610,7 +607,7 @@ def insurance_map(self): # for a completed screen. This table is currently used primarily for analytics # but will eventually drive new benefit update notifications class EligibilitySnapshot(models.Model): - screen = models.ForeignKey(Screen, related_name='eligibility_snapshots', on_delete=models.CASCADE) + screen = models.ForeignKey(Screen, related_name="eligibility_snapshots", on_delete=models.CASCADE) submission_date = models.DateTimeField(auto_now=True) is_batch = models.BooleanField(default=False) @@ -618,7 +615,9 @@ class EligibilitySnapshot(models.Model): # Eligibility results for each specific program per screen. These are # aggregated per screen using the EligibilitySnapshot id class ProgramEligibilitySnapshot(models.Model): - eligibility_snapshot = models.ForeignKey(EligibilitySnapshot, related_name='program_snapshots', on_delete=models.CASCADE) + eligibility_snapshot = models.ForeignKey( + EligibilitySnapshot, related_name="program_snapshots", on_delete=models.CASCADE + ) new = models.BooleanField(default=False) name = models.CharField(max_length=320) name_abbreviated = models.CharField(max_length=32) diff --git a/screener/one_time_scripts.py b/screener/one_time_scripts.py index 8ad8f55d..8cbbcf61 100644 --- a/screener/one_time_scripts.py +++ b/screener/one_time_scripts.py @@ -11,18 +11,119 @@ def generate_bwf_snapshots(): - bwf_ids = ['123', '121001', '119201', '119151', '118901', '119001', '118751', '118301', '118001', '117651', - '117501', '117451', '116601', '116551', '116351', '116151', '115851', '115801', '114751', '114501', - '114401', '114201', '114001', '113901', '113651', '113501', '113451', '111301', '108751', '108151', - '107101', '106551', '106201', '101901', '101701', '100451', '100201', '95051', '93801', '82751', - '82701', '77151', '71851', '71051', '70851', '70751', '70701', '70351', '70301', '70201', '68651', - '67401', '67001', '66651', '66601', '66301', '65851', '65101', '65001', '64951', '64801', '64751', - '62951', '59051', '59001', '58801', '58201', '57851', '57651', '57601', '56801', '56351', '56101', - '55901', '55801', '55501', '55451', '55051', '54951', '54801', '54751', '54551', '76501', '54151', - '53351', '53051', '52701', '52351', '52301', '52151', '51601', '51151', '51001', '49901', '49851', - '49551', '49251', '48901', '48701', '48551', '48501', '48401', '47751', '46951', '46751', '46151', - '46001', '41201', '40701', '40101'] - screens = Screen.objects.filter(external_id__in=bwf_ids).order_by('-submission_date') + bwf_ids = [ + "123", + "121001", + "119201", + "119151", + "118901", + "119001", + "118751", + "118301", + "118001", + "117651", + "117501", + "117451", + "116601", + "116551", + "116351", + "116151", + "115851", + "115801", + "114751", + "114501", + "114401", + "114201", + "114001", + "113901", + "113651", + "113501", + "113451", + "111301", + "108751", + "108151", + "107101", + "106551", + "106201", + "101901", + "101701", + "100451", + "100201", + "95051", + "93801", + "82751", + "82701", + "77151", + "71851", + "71051", + "70851", + "70751", + "70701", + "70351", + "70301", + "70201", + "68651", + "67401", + "67001", + "66651", + "66601", + "66301", + "65851", + "65101", + "65001", + "64951", + "64801", + "64751", + "62951", + "59051", + "59001", + "58801", + "58201", + "57851", + "57651", + "57601", + "56801", + "56351", + "56101", + "55901", + "55801", + "55501", + "55451", + "55051", + "54951", + "54801", + "54751", + "54551", + "76501", + "54151", + "53351", + "53051", + "52701", + "52351", + "52301", + "52151", + "51601", + "51151", + "51001", + "49901", + "49851", + "49551", + "49251", + "48901", + "48701", + "48551", + "48501", + "48401", + "47751", + "46951", + "46751", + "46151", + "46001", + "41201", + "40701", + "40101", + ] + screens = Screen.objects.filter(external_id__in=bwf_ids).order_by("-submission_date") total_screens = screens.count() print("Total BWF Screens found: " + str(total_screens)) @@ -42,13 +143,58 @@ def generate_bwf_snapshots(): eligibility_snapshot.save() eligibility_snapshot.generate_program_snapshots() count += 1 - print("Snapshot " + str(count) + "/" + str(total_screens_without_snapshots) + " generated for " + str(screen.external_id)) + print( + "Snapshot " + + str(count) + + "/" + + str(total_screens_without_snapshots) + + " generated for " + + str(screen.external_id) + ) def generate_nav_snapshots(): - nav_ids = ['3171', '3183', '3200', '3230', '3233', '3243', '3245', '3248', '3260', '3373', '3374', '3375', '3376', - '3377', '3300', '3301', '3310', '3312', '3313', '3316', '3343', '3363', '3364', '3365', '3368', '3397', - '3398', '3399', '2686', '2693', '2690', '2688', '2694', '2707', '2715', '2710', '2711', '2709', '2713'] + nav_ids = [ + "3171", + "3183", + "3200", + "3230", + "3233", + "3243", + "3245", + "3248", + "3260", + "3373", + "3374", + "3375", + "3376", + "3377", + "3300", + "3301", + "3310", + "3312", + "3313", + "3316", + "3343", + "3363", + "3364", + "3365", + "3368", + "3397", + "3398", + "3399", + "2686", + "2693", + "2690", + "2688", + "2694", + "2707", + "2715", + "2710", + "2711", + "2709", + "2713", + ] screens = Screen.objects.filter(id__in=nav_ids) total_screens = screens.count() @@ -62,7 +208,7 @@ def generate_nav_snapshots(): def generate_bia_sample_snapshot(): - nav_ids = ['4097', '4147', '4148', '4149'] + nav_ids = ["4097", "4147", "4148", "4149"] screens = Screen.objects.filter(id__in=nav_ids) total_screens = screens.count() @@ -76,40 +222,36 @@ def generate_bia_sample_snapshot(): def add_from_json(new_json_str): - ''' + """ Add json string from screen endpoint as parameter. Use triple quotes if in shell - ''' + """ new_json = json.loads(new_json_str) screen = Screen.objects.create( - **{k: v for k, v in new_json.items() if k not in ('household_members', 'id', 'uuid', 'user', 'expenses')}, - ) + **{k: v for k, v in new_json.items() if k not in ("household_members", "id", "uuid", "user", "expenses")}, + ) members = [] incomes = [] expenses = [] - for member in new_json['household_members']: - household_member = {k: v for k, v in member.items() if k not in ('income_streams', 'expenses', 'screen', 'id')} + for member in new_json["household_members"]: + household_member = {k: v for k, v in member.items() if k not in ("income_streams", "expenses", "screen", "id")} member_model = HouseholdMember(**household_member, screen=screen) members.append(member_model) - for income in member['income_streams']: - income = {k: v for k, v in income.items() if k not in ('household_member', 'screen', 'id')} - incomes.append(IncomeStream(**income, - screen=screen, - household_member=member_model)) - for expense in new_json['expenses']: - expense = {k: v for k, v in expense.items() if k not in ('household_member', 'screen', 'id')} - expenses.append(Expense(**expense, - screen=screen, - household_member=member_model)) + for income in member["income_streams"]: + income = {k: v for k, v in income.items() if k not in ("household_member", "screen", "id")} + incomes.append(IncomeStream(**income, screen=screen, household_member=member_model)) + for expense in new_json["expenses"]: + expense = {k: v for k, v in expense.items() if k not in ("household_member", "screen", "id")} + expenses.append(Expense(**expense, screen=screen, household_member=member_model)) HouseholdMember.objects.bulk_create(members) IncomeStream.objects.bulk_create(incomes) Expense.objects.bulk_create(expenses) - print('id:', screen.id) - print('uuid:', screen.uuid) + print("id:", screen.id) + print("uuid:", screen.uuid) def uniqueUUIDs(): @@ -118,12 +260,12 @@ def uniqueUUIDs(): currentUUIDs = [] for screen in screens: if screen.uuid in currentUUIDs: - print(screen.uuid, 'was replaced') + print(screen.uuid, "was replaced") screen.uuid = uuid.uuid4() screen.save() currentUUIDs.append(screen.uuid) - print('done') + print("done") def update_is_test_data(): @@ -132,7 +274,7 @@ def update_is_test_data(): for screen in screens: screen.set_screen_is_test() - print('done') + print("done") def fix_insurance(): @@ -148,4 +290,4 @@ def fix_insurance(): member.insurance = Insurance.objects.create(household_member=member) member.save() - print('done') + print("done") diff --git a/screener/serializers.py b/screener/serializers.py index d8f4bc37..8b37cefc 100644 --- a/screener/serializers.py +++ b/screener/serializers.py @@ -9,7 +9,7 @@ class MessageSerializer(serializers.ModelSerializer): class Meta: model = Message - fields = '__all__' + fields = "__all__" class InsuranceSerializer(serializers.ModelSerializer): @@ -17,8 +17,8 @@ class InsuranceSerializer(serializers.ModelSerializer): class Meta: model = Insurance - fields = '__all__' - read_only_fields = ('household_member',) + fields = "__all__" + read_only_fields = ("household_member",) class IncomeStreamSerializer(serializers.ModelSerializer): @@ -26,8 +26,8 @@ class IncomeStreamSerializer(serializers.ModelSerializer): class Meta: model = IncomeStream - fields = '__all__' - read_only_fields = ('screen', 'household_member', 'id') + fields = "__all__" + read_only_fields = ("screen", "household_member", "id") class ExpenseSerializer(serializers.ModelSerializer): @@ -35,8 +35,8 @@ class ExpenseSerializer(serializers.ModelSerializer): class Meta: model = Expense - fields = '__all__' - read_only_fields = ('screen', 'household_member', 'id') + fields = "__all__" + read_only_fields = ("screen", "household_member", "id") class HouseholdMemberSerializer(serializers.ModelSerializer): @@ -46,26 +46,26 @@ class HouseholdMemberSerializer(serializers.ModelSerializer): class Meta: model = HouseholdMember fields = ( - 'id', - 'screen', - 'relationship', - 'age', - 'student', - 'student_full_time', - 'pregnant', - 'unemployed', - 'worked_in_last_18_mos', - 'visually_impaired', - 'disabled', - 'long_term_disability', - 'veteran', - 'medicaid', - 'disability_medicaid', - 'has_income', - 'income_streams', - 'insurance', + "id", + "screen", + "relationship", + "age", + "student", + "student_full_time", + "pregnant", + "unemployed", + "worked_in_last_18_mos", + "visually_impaired", + "disabled", + "long_term_disability", + "veteran", + "medicaid", + "disability_medicaid", + "has_income", + "income_streams", + "insurance", ) - read_only_fields = ('screen', 'id') + read_only_fields = ("screen", "id") class ScreenSerializer(serializers.ModelSerializer): @@ -76,98 +76,98 @@ class ScreenSerializer(serializers.ModelSerializer): class Meta: model = Screen fields = ( - 'id', - 'uuid', - 'completed', - 'is_test', - 'is_test_data', - 'start_date', - 'submission_date', - 'agree_to_tos', - 'is_13_or_older', - 'zipcode', - 'county', - 'referral_source', - 'referrer_code', - 'household_size', - 'household_assets', - 'housing_situation', - 'household_members', - 'last_email_request_date', - 'last_tax_filing_year', - 'expenses', - 'user', - 'external_id', - 'request_language_code', - 'has_benefits', - 'has_tanf', - 'has_wic', - 'has_snap', - 'has_lifeline', - 'has_acp', - 'has_eitc', - 'has_coeitc', - 'has_nslp', - 'has_ctc', - 'has_medicaid', - 'has_rtdlive', - 'has_cccap', - 'has_mydenver', - 'has_chp', - 'has_ccb', - 'has_ssi', - 'has_andcs', - 'has_chs', - 'has_cpcr', - 'has_cdhcs', - 'has_dpp', - 'has_ede', - 'has_erc', - 'has_leap', - 'has_oap', - 'has_coctc', - 'has_upk', - 'has_ssdi', - 'has_cowap', - 'has_ubp', - 'has_pell_grant', - 'has_rag', - 'has_employer_hi', - 'has_private_hi', - 'has_medicaid_hi', - 'has_medicare_hi', - 'has_chp_hi', - 'has_no_hi', - 'has_va', - 'needs_food', - 'needs_baby_supplies', - 'needs_housing_help', - 'needs_mental_health_help', - 'needs_child_dev_help', - 'needs_funeral_help', - 'needs_family_planning_help', - 'needs_job_resources', - 'needs_dental_care', - 'needs_legal_services' + "id", + "uuid", + "completed", + "is_test", + "is_test_data", + "start_date", + "submission_date", + "agree_to_tos", + "is_13_or_older", + "zipcode", + "county", + "referral_source", + "referrer_code", + "household_size", + "household_assets", + "housing_situation", + "household_members", + "last_email_request_date", + "last_tax_filing_year", + "expenses", + "user", + "external_id", + "request_language_code", + "has_benefits", + "has_tanf", + "has_wic", + "has_snap", + "has_lifeline", + "has_acp", + "has_eitc", + "has_coeitc", + "has_nslp", + "has_ctc", + "has_medicaid", + "has_rtdlive", + "has_cccap", + "has_mydenver", + "has_chp", + "has_ccb", + "has_ssi", + "has_andcs", + "has_chs", + "has_cpcr", + "has_cdhcs", + "has_dpp", + "has_ede", + "has_erc", + "has_leap", + "has_oap", + "has_coctc", + "has_upk", + "has_ssdi", + "has_cowap", + "has_ubp", + "has_pell_grant", + "has_rag", + "has_employer_hi", + "has_private_hi", + "has_medicaid_hi", + "has_medicare_hi", + "has_chp_hi", + "has_no_hi", + "has_va", + "needs_food", + "needs_baby_supplies", + "needs_housing_help", + "needs_mental_health_help", + "needs_child_dev_help", + "needs_funeral_help", + "needs_family_planning_help", + "needs_job_resources", + "needs_dental_care", + "needs_legal_services", ) read_only_fields = ( - 'id', - 'uuid', - 'submision_date', - 'last_email_request_date', - 'completed', - 'user', - 'is_test_data' + "id", + "uuid", + "submision_date", + "last_email_request_date", + "completed", + "user", + "is_test_data", ) def create(self, validated_data): - household_members = validated_data.pop('household_members') - expenses = validated_data.pop('expenses') + household_members = validated_data.pop("household_members") + expenses = validated_data.pop("expenses") screen = Screen.objects.create(**validated_data, completed=False) screen.set_screen_is_test() for member in household_members: - incomes = member.pop('income_streams') - insurance = member.pop('insurance') + incomes = member.pop("income_streams") + insurance = member.pop("insurance") household_member = HouseholdMember.objects.create(**member, screen=screen) for income in incomes: IncomeStream.objects.create(**income, screen=screen, household_member=household_member) @@ -177,14 +177,14 @@ def create(self, validated_data): return screen def update(self, instance, validated_data): - household_members = validated_data.pop('household_members') - expenses = validated_data.pop('expenses') + household_members = validated_data.pop("household_members") + expenses = validated_data.pop("expenses") Screen.objects.filter(pk=instance.id).update(**validated_data) HouseholdMember.objects.filter(screen=instance).delete() Expense.objects.filter(screen=instance).delete() for member in household_members: - incomes = member.pop('income_streams') - insurance = member.pop('insurance') + incomes = member.pop("income_streams") + insurance = member.pop("insurance") household_member = HouseholdMember.objects.create(**member, screen=instance) for income in incomes: IncomeStream.objects.create(**income, screen=instance, household_member=household_member) @@ -234,14 +234,14 @@ class EligibilitySerializer(serializers.Serializer): estimated_value_override = TranslationSerializer() class Meta: - fields = '__all__' + fields = "__all__" class EligibilityTranslationSerializer(serializers.Serializer): translations = serializers.DictField() class Meta: - fields = ('translations',) + fields = ("translations",) class UrgentNeedSerializer(serializers.Serializer): diff --git a/screener/tests.py b/screener/tests.py index 013defb8..17958a59 100644 --- a/screener/tests.py +++ b/screener/tests.py @@ -8,7 +8,7 @@ def test_create_single_parent_two_children_household(self): self.assertTrue(isinstance(screen, Screen)) -def create_default_household_member(screen, relationship='headOfHousehold', age=25): +def create_default_household_member(screen, relationship="headOfHousehold", age=25): default = screen.household_members.create( relationship=relationship, age=age, @@ -23,7 +23,7 @@ def create_default_household_member(screen, relationship='headOfHousehold', age= medicaid=False, disability_medicaid=False, has_income=True, - has_expenses=True + has_expenses=True, ) return default @@ -34,16 +34,16 @@ def create_default_household_member(screen, relationship='headOfHousehold', age= # 1900 in monthly expenses between childcare and rent # no assets def create_single_parent_two_children_household(annual_income): - screen = Screen.objects.create(household_assets=0, household_size=3, - zipcode='80204', agree_to_tos=True, - housing_situation='renting') + screen = Screen.objects.create( + household_assets=0, household_size=3, zipcode="80204", agree_to_tos=True, housing_situation="renting" + ) parent = create_default_household_member(screen) - parent.expenses.create(type='rent', amount='1200', frequency='monthly', screen=screen) - parent.expenses.create(type='childCare', amount='700', frequency='monthly', screen=screen) - parent.income_streams.create(type='wages', amount=annual_income, frequency='yearly', screen=screen) + parent.expenses.create(type="rent", amount="1200", frequency="monthly", screen=screen) + parent.expenses.create(type="childCare", amount="700", frequency="monthly", screen=screen) + parent.income_streams.create(type="wages", amount=annual_income, frequency="yearly", screen=screen) - create_default_household_member(screen, relationship='child', age=4) - create_default_household_member(screen, relationship='child', age=6) + create_default_household_member(screen, relationship="child", age=4) + create_default_household_member(screen, relationship="child", age=6) return screen diff --git a/screener/urls.py b/screener/urls.py index a91e6c6c..04edf7c5 100644 --- a/screener/urls.py +++ b/screener/urls.py @@ -3,13 +3,12 @@ from . import views router = routers.DefaultRouter() -router.register(r'screens', views.ScreenViewSet) -router.register(r'messages', views.MessageViewSet) +router.register(r"screens", views.ScreenViewSet) +router.register(r"messages", views.MessageViewSet) urlpatterns = [ - path('', views.index, name='index'), - path('', include(router.urls)), - path('api-auth/', include('rest_framework.urls', namespace='rest_framework')), - path('eligibility/', views.EligibilityTranslationView.as_view(), - name='translated screen eligibility endpoint') + path("", views.index, name="index"), + path("", include(router.urls)), + path("api-auth/", include("rest_framework.urls", namespace="rest_framework")), + path("eligibility/", views.EligibilityTranslationView.as_view(), name="translated screen eligibility endpoint"), ] diff --git a/screener/views.py b/screener/views.py index 894f73cf..5c41d4e4 100644 --- a/screener/views.py +++ b/screener/views.py @@ -51,12 +51,12 @@ class ScreenViewSet( API endpoint that allows screens to be viewed or edited. """ - queryset = Screen.objects.all().order_by('-submission_date') + queryset = Screen.objects.all().order_by("-submission_date") serializer_class = ScreenSerializer permission_classes = [permissions.DjangoModelPermissions] - filterset_fields = ['agree_to_tos', 'is_test'] + filterset_fields = ["agree_to_tos", "is_test"] paginate_by = 10 - paginate_by_param = 'page_size' + paginate_by_param = "page_size" max_paginate_by = 100 def retrieve(self, request, pk=None): @@ -83,7 +83,7 @@ class HouseholdMemberViewSet(viewsets.ModelViewSet): queryset = HouseholdMember.objects.all() serializer_class = HouseholdMemberSerializer permission_classes = [permissions.DjangoModelPermissions] - filterset_fields = ['has_income'] + filterset_fields = ["has_income"] class IncomeStreamViewSet(viewsets.ModelViewSet): @@ -94,7 +94,7 @@ class IncomeStreamViewSet(viewsets.ModelViewSet): queryset = IncomeStream.objects.all() serializer_class = IncomeStreamSerializer permission_classes = [permissions.DjangoModelPermissions] - filterset_fields = ['screen'] + filterset_fields = ["screen"] class ExpenseViewSet(viewsets.ModelViewSet): @@ -105,11 +105,10 @@ class ExpenseViewSet(viewsets.ModelViewSet): queryset = Expense.objects.all() serializer_class = ExpenseSerializer permission_classes = [permissions.DjangoModelPermissions] - filterset_fields = ['screen'] + filterset_fields = ["screen"] class EligibilityView(views.APIView): - def get(self, request, id): data = eligibility_results(id) results = EligibilitySerializer(data, many=True).data @@ -117,7 +116,6 @@ def get(self, request, id): class EligibilityTranslationView(views.APIView): - @swagger_auto_schema(responses={200: ResultsSerializer()}) def get(self, request, id): screen = Screen.objects.get(uuid=id) @@ -147,19 +145,19 @@ class MessageViewSet(mixins.CreateModelMixin, viewsets.GenericViewSet): API endpoint that logs messages sent. """ - queryset = Message.objects.all().order_by('-sent') + queryset = Message.objects.all().order_by("-sent") serializer_class = MessageSerializer permission_classes = [permissions.DjangoModelPermissions] def create(self, request): body = json.loads(request.body.decode()) - screen = Screen.objects.get(uuid=body['screen']) + screen = Screen.objects.get(uuid=body["screen"]) message = MessageUser(screen, screen.get_language_code()) - if 'email' in body: - message.email(body['email'], send_tests=True) - if 'phone' in body: - message.text('+1' + body['phone'], send_tests=True) + if "email" in body: + message.email(body["email"], send_tests=True) + if "phone" in body: + message.text("+1" + body["phone"], send_tests=True) return Response({}, status=status.HTTP_201_CREATED) @@ -172,22 +170,18 @@ def eligibility_results(screen, batch=False): excluded_programs = [] if referrer is not None: - excluded_programs = referrer.remove_programs.values('id') + excluded_programs = referrer.remove_programs.values("id") - all_programs = Program.objects.filter(active=True).exclude(id__in=excluded_programs).prefetch_related( - 'legal_status_required', 'documents' + all_programs = ( + Program.objects.filter(active=True) + .exclude(id__in=excluded_programs) + .prefetch_related("legal_status_required", "documents") ) data = [] try: - previous_snapshot = EligibilitySnapshot.objects.filter( - is_batch=False, screen=screen - ).latest('submission_date') - previous_results = ( - None - if previous_snapshot is None - else previous_snapshot.program_snapshots.all() - ) + previous_snapshot = EligibilitySnapshot.objects.filter(is_batch=False, screen=screen).latest("submission_date") + previous_results = None if previous_snapshot is None else previous_snapshot.program_snapshots.all() except ObjectDoesNotExist: previous_snapshot = None snapshot = EligibilitySnapshot.objects.create(screen=screen, is_batch=batch) @@ -205,7 +199,7 @@ def eligibility_results(screen, batch=False): pe_programs = pe_calculators.keys() def sort_first(program): - calc_first = ('tanf', 'ssi', 'medicaid', 'nslp', 'leap') + calc_first = ("tanf", "ssi", "medicaid", "nslp", "leap") if program.name_abbreviated in calc_first: return 0 @@ -232,23 +226,21 @@ def sort_first(program): eligibility = pe_eligibility[program.name_abbreviated] - all_navigators = program.navigator.all().prefetch_related('counties') + all_navigators = program.navigator.all().prefetch_related("counties") county_navigators = [] for nav in all_navigators: counties = nav.counties.all() - if len(counties) == 0 or (screen.county is not None and any( - screen.county in county.name for county in counties - )): + if len(counties) == 0 or ( + screen.county is not None and any(screen.county in county.name for county in counties) + ): county_navigators.append(nav) if referrer is None: navigators = county_navigators else: primary_navigators = referrer.primary_navigators.all() - referrer_navigators = [ - nav for nav in primary_navigators if nav in county_navigators - ] + referrer_navigators = [nav for nav in primary_navigators if nav in county_navigators] if len(referrer_navigators) == 0: navigators = county_navigators else: @@ -259,16 +251,14 @@ def sort_first(program): for previous_snapshot in previous_results: if ( previous_snapshot.name_abbreviated == program.name_abbreviated - and eligibility['eligible'] == previous_snapshot.eligible + and eligibility["eligible"] == previous_snapshot.eligible ): new = False else: new = False if not skip and program.active: - legal_status = [ - status.status for status in program.legal_status_required.all() - ] + legal_status = [status.status for status in program.legal_status_required.all()] ProgramEligibilitySnapshot.objects.create( eligibility_snapshot=snapshot, name=program.name.text, @@ -288,12 +278,8 @@ def sort_first(program): "name": default_message(program.name), "name_abbreviated": program.name_abbreviated, "estimated_value": eligibility["estimated_value"], - "estimated_delivery_time": default_message( - program.estimated_delivery_time - ), - "estimated_application_time": default_message( - program.estimated_application_time - ), + "estimated_delivery_time": default_message(program.estimated_delivery_time), + "estimated_application_time": default_message(program.estimated_application_time), "description_short": default_message(program.description_short), "short_name": program.name_abbreviated, "description": default_message(program.description), @@ -307,23 +293,19 @@ def sort_first(program): "eligible": eligibility["eligible"], "failed_tests": eligibility["failed"], "passed_tests": eligibility["passed"], - "navigators": [ - serialized_navigator(navigator) for navigator in navigators - ], + "navigators": [serialized_navigator(navigator) for navigator in navigators], "already_has": screen.has_benefit(program.name_abbreviated), "new": new, "low_confidence": program.low_confidence, - "documents": [ - default_message(d.text) for d in program.documents.all() - ], - "multiple_tax_units": eligibility["multiple_tax_units"] + "documents": [default_message(d.text) for d in program.documents.all()], + "multiple_tax_units": eligibility["multiple_tax_units"], } ) eligible_programs = [] for program in data: clean_program = program - clean_program['estimated_value'] = math.trunc(clean_program['estimated_value']) + clean_program["estimated_value"] = math.trunc(clean_program["estimated_value"]) eligible_programs.append(clean_program) return eligible_programs, missing_programs @@ -331,7 +313,7 @@ def sort_first(program): def default_message(translation): translation.set_current_language(settings.LANGUAGE_CODE) - return {'default_message': translation.text, 'label': translation.label} + return {"default_message": translation.text, "label": translation.label} def serialized_navigator(navigator): @@ -348,47 +330,35 @@ def serialized_navigator(navigator): def urgent_need_results(screen): possible_needs = { - 'food': screen.needs_food, - 'baby supplies': screen.needs_baby_supplies, - 'housing': screen.needs_housing_help, - 'mental health': screen.needs_mental_health_help, - 'child dev': screen.needs_child_dev_help, - 'funeral': screen.needs_funeral_help, - 'family planning': screen.needs_family_planning_help, - 'job resources': screen.needs_job_resources, - 'dental care': screen.needs_dental_care, - 'legal services': screen.needs_legal_services, + "food": screen.needs_food, + "baby supplies": screen.needs_baby_supplies, + "housing": screen.needs_housing_help, + "mental health": screen.needs_mental_health_help, + "child dev": screen.needs_child_dev_help, + "funeral": screen.needs_funeral_help, + "family planning": screen.needs_family_planning_help, + "job resources": screen.needs_job_resources, + "dental care": screen.needs_dental_care, + "legal services": screen.needs_legal_services, } missing_dependencies = screen.missing_fields() need_functions = { - 'denver': urgent_need_functions.LivesInDenver.calc( - screen, missing_dependencies - ), - 'meal': urgent_need_functions.MealInCounties.calc( - screen, missing_dependencies - ), - 'helpkitchen_zipcode': urgent_need_functions.HelpkitchenZipcode.calc( - screen, missing_dependencies - ), - 'child': urgent_need_functions.Child.calc(screen, missing_dependencies), - 'bia_food_delivery': urgent_need_functions.BiaFoodDelivery.calc( - screen, missing_dependencies - ), - 'trua': urgent_need_functions.Trua.calc(screen, missing_dependencies), - 'ffap': urgent_need_functions.ForeclosureFinAssistProgram.calc(screen, missing_dependencies), - 'eoc': urgent_need_functions.Eoc.calc(screen, missing_dependencies), - 'co_legal_services': urgent_need_functions.CoLegalServices.calc( - screen, missing_dependencies - ), - 'co_emergency_mortgage': urgent_need_functions.CoEmergencyMortgageAssistance.calc( - screen, missing_dependencies - ), - 'child_first': urgent_need_functions.ChildFirst.calc(screen, missing_dependencies), - 'ecmh': urgent_need_functions.EarlyChildhoodMentalHealthSupport.calc(screen, missing_dependencies), - 'hippy': urgent_need_functions.ParentsOfPreschoolYoungsters.calc(screen, missing_dependencies), - 'pat': urgent_need_functions.ParentsAsTeacher.calc(screen, missing_dependencies), + "denver": urgent_need_functions.LivesInDenver.calc(screen, missing_dependencies), + "meal": urgent_need_functions.MealInCounties.calc(screen, missing_dependencies), + "helpkitchen_zipcode": urgent_need_functions.HelpkitchenZipcode.calc(screen, missing_dependencies), + "child": urgent_need_functions.Child.calc(screen, missing_dependencies), + "bia_food_delivery": urgent_need_functions.BiaFoodDelivery.calc(screen, missing_dependencies), + "trua": urgent_need_functions.Trua.calc(screen, missing_dependencies), + "ffap": urgent_need_functions.ForeclosureFinAssistProgram.calc(screen, missing_dependencies), + "eoc": urgent_need_functions.Eoc.calc(screen, missing_dependencies), + "co_legal_services": urgent_need_functions.CoLegalServices.calc(screen, missing_dependencies), + "co_emergency_mortgage": urgent_need_functions.CoEmergencyMortgageAssistance.calc(screen, missing_dependencies), + "child_first": urgent_need_functions.ChildFirst.calc(screen, missing_dependencies), + "ecmh": urgent_need_functions.EarlyChildhoodMentalHealthSupport.calc(screen, missing_dependencies), + "hippy": urgent_need_functions.ParentsOfPreschoolYoungsters.calc(screen, missing_dependencies), + "pat": urgent_need_functions.ParentsAsTeacher.calc(screen, missing_dependencies), } list_of_needs = [] @@ -396,9 +366,7 @@ def urgent_need_results(screen): if has_need: list_of_needs.append(need) - urgent_need_resources = UrgentNeed.objects.filter( - type_short__name__in=list_of_needs, active=True - ).distinct() + urgent_need_resources = UrgentNeed.objects.filter(type_short__name__in=list_of_needs, active=True).distinct() eligible_urgent_needs = [] for need in urgent_need_resources: diff --git a/screener/webhooks.py b/screener/webhooks.py index 624c99e1..c8cf12dd 100644 --- a/screener/webhooks.py +++ b/screener/webhooks.py @@ -4,7 +4,7 @@ import requests -class Hook(): +class Hook: def __init__(self, hook: Referrer): self.hook = hook self.functions = [func.name for func in hook.webhook_functions.all()] @@ -12,11 +12,11 @@ def __init__(self, hook: Referrer): def send(self, screen: Screen, results: dict): if screen.completed: return - request_data = {'external_id': screen.external_id} - if 'send_screen' in self.functions: + request_data = {"external_id": screen.external_id} + if "send_screen" in self.functions: key, value = self.screen_data(screen) request_data[key] = value - if 'send_results' in self.functions: + if "send_results" in self.functions: key, value = self.send_eligibility(results) request_data[key] = value @@ -28,10 +28,10 @@ def send(self, screen: Screen, results: dict): def screen_data(self, screen: Screen): screen_dict = ScreenSerializer(screen).data - return 'screen', screen_dict + return "screen", screen_dict def send_eligibility(self, results: dict): - return 'eligibility', results + return "eligibility", results def eligibility_hooks(): diff --git a/translations/admin.py b/translations/admin.py index 569aca08..d52e34ad 100644 --- a/translations/admin.py +++ b/translations/admin.py @@ -7,21 +7,20 @@ class TranslationAdmin(ModelAdmin, TranslatableAdmin): - search_fields = ('label',) - list_display = ['label', 'used_model', 'no_auto', - 'edited', 'active', 'go_to'] + search_fields = ("label",) + list_display = ["label", "used_model", "no_auto", "edited", "active", "go_to"] def used_model(self, obj): - model_name = obj.used_by['model_name'] + model_name = obj.used_by["model_name"] return model_name.capitalize() - used_model.short_description = 'Used by (Model)' + used_model.short_description = "Used by (Model)" def go_to(self, obj): - url = reverse_lazy('translation_admin_url', args=[obj.pk]) + url = reverse_lazy("translation_admin_url", args=[obj.pk]) return format_html('Label', url) - go_to.short_description = 'Translate:' + go_to.short_description = "Translate:" admin.site.register(Translation, TranslationAdmin) diff --git a/translations/apps.py b/translations/apps.py index cfd4a9e5..f21c6589 100644 --- a/translations/apps.py +++ b/translations/apps.py @@ -2,5 +2,5 @@ class TranslationsConfig(AppConfig): - default_auto_field = 'django.db.models.BigAutoField' - name = 'translations' + default_auto_field = "django.db.models.BigAutoField" + name = "translations" diff --git a/translations/bulk_import_translations.py b/translations/bulk_import_translations.py index 0b6a6d78..8e818e74 100644 --- a/translations/bulk_import_translations.py +++ b/translations/bulk_import_translations.py @@ -9,8 +9,8 @@ @transaction.atomic def bulk_add(translations): - if config('ALLOW_TRANSLATION_IMPORT', 'False') != 'True': - raise Exception('Translation import not allowed') + if config("ALLOW_TRANSLATION_IMPORT", "False") != "True": + raise Exception("Translation import not allowed") protected_translation_ids = [] Translation.objects.select_for_update().all() @@ -28,19 +28,16 @@ def bulk_add(translations): Translation.objects.exclude(id__in=protected_translation_ids).delete() translations_data = list(translations.items()) - for i in trange(len(translations_data), desc='Translations'): + for i in trange(len(translations_data), desc="Translations"): label, details = translations_data[i] translation = Translation.objects.add_translation( - label, - details['langs'][settings.LANGUAGE_CODE][0], - active=details['active'], - no_auto=details['no_auto'] + label, details["langs"][settings.LANGUAGE_CODE][0], active=details["active"], no_auto=details["no_auto"] ) - del details['langs'][settings.LANGUAGE_CODE] + del details["langs"][settings.LANGUAGE_CODE] - if details['reference'] is not False: - ref = details['reference'] - if ref[0] == 'programs_program': + if details["reference"] is not False: + ref = details["reference"] + if ref[0] == "programs_program": try: obj = Program.objects.get(external_name=ref[1]) except ObjectDoesNotExist: @@ -48,14 +45,14 @@ def bulk_add(translations): obj.external_name = ref[1] obj.active = ref[3] if len(ref) == 4 else False obj.save() - elif ref[0] == 'programs_navigator': + elif ref[0] == "programs_navigator": try: obj = Navigator.objects.get(external_name=ref[1]) except ObjectDoesNotExist: obj = Navigator.objects.new_navigator(ref[1], None) obj.external_name = ref[1] obj.save() - elif ref[0] == 'programs_urgentneed': + elif ref[0] == "programs_urgentneed": try: obj = UrgentNeed.objects.get(external_name=ref[1]) except ObjectDoesNotExist: @@ -63,7 +60,7 @@ def bulk_add(translations): obj.external_name = ref[1] obj.active = ref[3] if len(ref) == 4 else False obj.save() - elif ref[0] == 'programs_document': + elif ref[0] == "programs_document": try: obj = Document.objects.get(external_name=ref[1]) except ObjectDoesNotExist: @@ -71,13 +68,8 @@ def bulk_add(translations): getattr(translation, ref[2]).set([obj]) - for lang, message in details['langs'].items(): - Translation.objects.edit_translation_by_id( - translation.id, - lang, - message[0], - manual=message[1] - ) + for lang, message in details["langs"].items(): + Translation.objects.edit_translation_by_id(translation.id, lang, message[0], manual=message[1]) def translation_ids(model): diff --git a/translations/management/commands/bulk_export.py b/translations/management/commands/bulk_export.py index af39210e..fc852287 100644 --- a/translations/management/commands/bulk_export.py +++ b/translations/management/commands/bulk_export.py @@ -4,10 +4,10 @@ class Command(BaseCommand): - help = ''' + help = """ Get translation export - ''' + """ def handle(self, *args, **options) -> str: - self.stdout.reconfigure(encoding='utf-8') + self.stdout.reconfigure(encoding="utf-8") return json.dumps(Translation.objects.export_translations(), ensure_ascii=False) diff --git a/translations/management/commands/bulk_import.py b/translations/management/commands/bulk_import.py index b338e70c..66abce57 100644 --- a/translations/management/commands/bulk_import.py +++ b/translations/management/commands/bulk_import.py @@ -6,21 +6,24 @@ class Command(BaseCommand): - ''' + """ Run on heroku: `heroku run --no-tty -a [HEROKU APP NAME] manage.py bulk_import < [PATH TO FILE]` - ''' + """ - help = ''' + help = """ Get translation export - ''' + """ def add_arguments(self, parser): parser.add_argument( - 'data', nargs='?', type=argparse.FileType('r', encoding='utf-8'), default=stdin, + "data", + nargs="?", + type=argparse.FileType("r", encoding="utf-8"), + default=stdin, ) def handle(self, *args, **options): - data = json.load(options['data']) + data = json.load(options["data"]) bulk_add(data) diff --git a/translations/management/commands/bulk_translate.py b/translations/management/commands/bulk_translate.py index e5c23a63..0d4cca8d 100644 --- a/translations/management/commands/bulk_translate.py +++ b/translations/management/commands/bulk_translate.py @@ -5,24 +5,24 @@ class Command(BaseCommand): - help = ''' + help = """ Get translation export - ''' + """ def add_arguments(self, parser): - parser.add_argument('--limit', default=1, type=int) - parser.add_argument('--all', default=False, type=bool) - parser.add_argument('--lang', default=settings.LANGUAGE_CODE, type=str) + parser.add_argument("--limit", default=1, type=int) + parser.add_argument("--all", default=False, type=bool) + parser.add_argument("--lang", default=settings.LANGUAGE_CODE, type=str) def handle(self, *args, **options): - limit = 10_000 if options['all'] else min(10_000, options['limit']) + limit = 10_000 if options["all"] else min(10_000, options["limit"]) max_batch_size = 128 char_limit = 5_000 - lang = options['lang'] + lang = options["lang"] translate = Translate() - translations = Translation.objects.prefetch_related('translations').language(settings.LANGUAGE_CODE).all() + translations = Translation.objects.prefetch_related("translations").language(settings.LANGUAGE_CODE).all() total_count = 0 temp_chars = 0 diff --git a/translations/migrations/0001_initial.py b/translations/migrations/0001_initial.py index f6231ca7..1d53c90f 100644 --- a/translations/migrations/0001_initial.py +++ b/translations/migrations/0001_initial.py @@ -7,40 +7,47 @@ class Migration(migrations.Migration): - initial = True - dependencies = [ - ] + dependencies = [] operations = [ migrations.CreateModel( - name='Translation', + name="Translation", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('label', models.CharField(max_length=128, unique=True)), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("label", models.CharField(max_length=128, unique=True)), ], options={ - 'abstract': False, + "abstract": False, }, bases=(parler.models.TranslatableModelMixin, models.Model), ), migrations.CreateModel( - name='TranslationTranslation', + name="TranslationTranslation", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('language_code', models.CharField(db_index=True, max_length=15, verbose_name='Language')), - ('text', models.TextField(blank=True, null=True)), - ('edited', models.BooleanField(default=False)), - ('master', parler.fields.TranslationsForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='translations.translation')), + ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), + ("language_code", models.CharField(db_index=True, max_length=15, verbose_name="Language")), + ("text", models.TextField(blank=True, null=True)), + ("edited", models.BooleanField(default=False)), + ( + "master", + parler.fields.TranslationsForeignKey( + editable=False, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="translations", + to="translations.translation", + ), + ), ], options={ - 'verbose_name': 'translation Translation', - 'db_table': 'translations_translation_translation', - 'db_tablespace': '', - 'managed': True, - 'default_permissions': (), - 'unique_together': {('language_code', 'master')}, + "verbose_name": "translation Translation", + "db_table": "translations_translation_translation", + "db_tablespace": "", + "managed": True, + "default_permissions": (), + "unique_together": {("language_code", "master")}, }, bases=(parler.models.TranslatedFieldsModelMixin, models.Model), ), diff --git a/translations/migrations/0002_translation_active.py b/translations/migrations/0002_translation_active.py index af090adf..bcb759be 100644 --- a/translations/migrations/0002_translation_active.py +++ b/translations/migrations/0002_translation_active.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('translations', '0001_initial'), + ("translations", "0001_initial"), ] operations = [ migrations.AddField( - model_name='translation', - name='active', + model_name="translation", + name="active", field=models.BooleanField(default=True), ), ] diff --git a/translations/migrations/0003_alter_translation_managers.py b/translations/migrations/0003_alter_translation_managers.py index 264b0024..e3ae1db4 100644 --- a/translations/migrations/0003_alter_translation_managers.py +++ b/translations/migrations/0003_alter_translation_managers.py @@ -5,16 +5,15 @@ class Migration(migrations.Migration): - dependencies = [ - ('translations', '0002_translation_active'), + ("translations", "0002_translation_active"), ] operations = [ migrations.AlterModelManagers( - name='translation', + name="translation", managers=[ - ('objects', translations.models.TranslationManager()), + ("objects", translations.models.TranslationManager()), ], ), ] diff --git a/translations/migrations/0004_translation_no_auto.py b/translations/migrations/0004_translation_no_auto.py index 7af1943b..7113a986 100644 --- a/translations/migrations/0004_translation_no_auto.py +++ b/translations/migrations/0004_translation_no_auto.py @@ -4,15 +4,14 @@ class Migration(migrations.Migration): - dependencies = [ - ('translations', '0003_alter_translation_managers'), + ("translations", "0003_alter_translation_managers"), ] operations = [ migrations.AddField( - model_name='translation', - name='no_auto', + model_name="translation", + name="no_auto", field=models.BooleanField(default=False), ), ] diff --git a/translations/models.py b/translations/models.py index d3be47de..542e1048 100644 --- a/translations/models.py +++ b/translations/models.py @@ -3,7 +3,7 @@ from django.conf import settings -BLANK_TRANSLATION_PLACEHOLDER = '[PLACEHOLDER]' +BLANK_TRANSLATION_PLACEHOLDER = "[PLACEHOLDER]" class TranslationManager(TranslatableManager): @@ -11,15 +11,13 @@ class TranslationManager(TranslatableManager): def add_translation(self, label, default_message=BLANK_TRANSLATION_PLACEHOLDER, active=True, no_auto=False): default_lang = settings.LANGUAGE_CODE - parent = self.get_or_create(label=label, defaults={ - "active": active, "no_auto": no_auto})[0] + parent = self.get_or_create(label=label, defaults={"active": active, "no_auto": no_auto})[0] if parent.active != active or parent.active != no_auto: parent.active = active parent.no_auto = no_auto parent.save() - parent.create_translation( - default_lang, text=default_message, edited=True) + parent.create_translation(default_lang, text=default_message, edited=True) return parent def edit_translation(self, label, lang, translation, manual=True): @@ -36,8 +34,7 @@ def edit_translation(self, label, lang, translation, manual=True): return parent def edit_translation_by_id(self, id, lang, translation, manual=True): - parent = self.prefetch_related( - "translations").language(lang).get(pk=id) + parent = self.prefetch_related("translations").language(lang).get(pk=id) lang_trans = parent.get_lang(lang) is_edited = lang_trans is not None and lang_trans.edited is True and lang_trans.text != "" @@ -81,8 +78,7 @@ def export_translations(self): for lang in all_langs: translation.set_current_language(lang["code"]) - translations_export[translation.label]["langs"][lang["code"]] = ( - translation.text, translation.edited) + translations_export[translation.label]["langs"][lang["code"]] = (translation.text, translation.edited) return translations_export @@ -93,8 +89,7 @@ class Translation(TranslatableModel): ) active = models.BooleanField(default=True, null=False) no_auto = models.BooleanField(default=False, null=False) - label = models.CharField(max_length=128, null=False, - blank=False, unique=True) + label = models.CharField(max_length=128, null=False, blank=False, unique=True) objects = TranslationManager() @@ -125,10 +120,8 @@ def find_used_model(self, label_unpack=False): except AttributeError: active = True - external_name = getattr( - self, reverse.related_name).first().external_name - table = getattr( - self, reverse.related_name).first()._meta.db_table + external_name = getattr(self, reverse.related_name).first().external_name + table = getattr(self, reverse.related_name).first()._meta.db_table if external_name: return (table, external_name, reverse.related_name, active) has_relationship = True @@ -142,6 +135,7 @@ def find_used_model(self, label_unpack=False): an external name or an abbreviated name). If no relationship is found, it returns default values indicating the translation is unassigned. """ + @property def used_by(self): reverse = self.find_used_model(label_unpack=True) @@ -149,21 +143,11 @@ def used_by(self): instance = getattr(self, reverse.get_accessor_name()).first() model_name = reverse.related_model._meta.model_name field_name = reverse.field.name - external_name = getattr(instance, 'external_name', None) - abbreviated_name = getattr(instance, 'abbreviated_name', None) + external_name = getattr(instance, "external_name", None) + abbreviated_name = getattr(instance, "abbreviated_name", None) display_name = external_name if external_name else abbreviated_name - return { - 'id': instance.id, - 'model_name': model_name, - 'field_name': field_name, - 'display_name': display_name - } - return { - 'id': None, - 'model_name': 'unassigned', - 'field_name': None, - 'display_name': None - } + return {"id": instance.id, "model_name": model_name, "field_name": field_name, "display_name": display_name} + return {"id": None, "model_name": "unassigned", "field_name": None, "display_name": None} def get_lang(self, lang): return self.translations.filter(language_code=lang).first() diff --git a/translations/urls.py b/translations/urls.py index aa5c9cc4..7180ed5d 100644 --- a/translations/urls.py +++ b/translations/urls.py @@ -3,27 +3,27 @@ urlpatterns = [ - path('', views.TranslationView.as_view()), - path('admin', views.admin_view, name='translations_api_url'), - path('admin/filter', views.filter_view), - path('admin/create', views.create_translation_view), - path('admin/programs', views.programs_view), - path('admin/programs/filter', views.programs_filter_view), - path('admin/programs/create', views.create_program_view), - path('admin/programs/', views.program_view), - path('admin/navigators', views.navigators_view), - path('admin/navigators/filter', views.navigator_filter_view), - path('admin/navigators/create', views.create_navigator_view), - path('admin/navigators/', views.navigator_view), - path('admin/documents', views.documents_view), - path('admin/documents/filter', views.document_filter_view), - path('admin/documents/create', views.create_document_view), - path('admin/documents/', views.document_view), - path('admin/urgent_needs', views.urgent_needs_view), - path('admin/urgent_needs/filter', views.urgent_need_filter_view), - path('admin/urgent_needs/create', views.create_urgent_need_view), - path('admin/urgent_needs/', views.urgent_need_view), - path('admin/', views.translation_view, name='translation_admin_url'), - path('admin//', views.edit_translation), - path('admin///auto', views.auto_translate), + path("", views.TranslationView.as_view()), + path("admin", views.admin_view, name="translations_api_url"), + path("admin/filter", views.filter_view), + path("admin/create", views.create_translation_view), + path("admin/programs", views.programs_view), + path("admin/programs/filter", views.programs_filter_view), + path("admin/programs/create", views.create_program_view), + path("admin/programs/", views.program_view), + path("admin/navigators", views.navigators_view), + path("admin/navigators/filter", views.navigator_filter_view), + path("admin/navigators/create", views.create_navigator_view), + path("admin/navigators/", views.navigator_view), + path("admin/documents", views.documents_view), + path("admin/documents/filter", views.document_filter_view), + path("admin/documents/create", views.create_document_view), + path("admin/documents/", views.document_view), + path("admin/urgent_needs", views.urgent_needs_view), + path("admin/urgent_needs/filter", views.urgent_need_filter_view), + path("admin/urgent_needs/create", views.create_urgent_need_view), + path("admin/urgent_needs/", views.urgent_need_view), + path("admin/", views.translation_view, name="translation_admin_url"), + path("admin//", views.edit_translation), + path("admin///auto", views.auto_translate), ] diff --git a/translations/views.py b/translations/views.py index aa014dc5..2d21782d 100644 --- a/translations/views.py +++ b/translations/views.py @@ -17,10 +17,9 @@ class TranslationView(views.APIView): - def get(self, request): - language = request.query_params.get('lang') - all_langs = [lang['code'] for lang in settings.PARLER_LANGUAGES[None]] + language = request.query_params.get("lang") + all_langs = [lang["code"] for lang in settings.PARLER_LANGUAGES[None]] if language in all_langs: translations = Translation.objects.all_translations([language]) @@ -31,507 +30,446 @@ def get(self, request): class NewTranslationForm(forms.Form): - label = forms.CharField(max_length=128, widget=forms.TextInput( - attrs={'class': 'input'})) - default_message = forms.CharField(widget=forms.Textarea( - attrs={'name': 'text', 'rows': 3, 'cols': 50, 'class': 'textarea'})) + label = forms.CharField(max_length=128, widget=forms.TextInput(attrs={"class": "input"})) + default_message = forms.CharField( + widget=forms.Textarea(attrs={"name": "text", "rows": 3, "cols": 50, "class": "textarea"}) + ) -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def admin_view(request): - if request.method == 'GET': - translations = Translation.objects.all().order_by('id') + if request.method == "GET": + translations = Translation.objects.all().order_by("id") # Display 50 translations per page paginator = Paginator(translations, 50) - page_number = request.GET.get('page') + page_number = request.GET.get("page") page_obj = paginator.get_page(page_number) for translation in page_obj: used_by_info = translation.used_by - translation.entry_id = used_by_info['id'] - translation.model_name = used_by_info['model_name'] - translation.field_name = used_by_info['field_name'] - translation.display_name = used_by_info['display_name'] + translation.entry_id = used_by_info["id"] + translation.model_name = used_by_info["model_name"] + translation.field_name = used_by_info["field_name"] + translation.display_name = used_by_info["display_name"] - context = { - 'page_obj': page_obj - } + context = {"page_obj": page_obj} return render(request, "main.html", context) - elif request.method == 'POST': + elif request.method == "POST": form = NewTranslationForm(request.POST) if form.is_valid(): - text = form['default_message'].value() - translation = Translation.objects.add_translation( - form['label'].value(), text) + text = form["default_message"].value() + translation = Translation.objects.add_translation(form["label"].value(), text) - auto_translations = Translate().bulk_translate( - ['__all__'], [text])[text] + auto_translations = Translate().bulk_translate(["__all__"], [text])[text] for [language, auto_text] in auto_translations.items(): - Translation.objects.edit_translation_by_id( - translation.id, language, auto_text, False) + Translation.objects.edit_translation_by_id(translation.id, language, auto_text, False) response = HttpResponse() response.headers["HX-Redirect"] = f"/api/translations/admin/{translation.id}" return response -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def create_translation_view(request): - context = { - 'form': NewTranslationForm(), - 'route': '/api/translations/admin' - } + context = {"form": NewTranslationForm(), "route": "/api/translations/admin"} return render(request, "util/create_form.html", context) -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def filter_view(request): - translations = Translation.objects \ - .filter(label__icontains=request.GET.get('label', '')) \ - .translated(text__icontains=request.GET.get('text', '')) + translations = Translation.objects.filter(label__icontains=request.GET.get("label", "")).translated( + text__icontains=request.GET.get("text", "") + ) paginator = Paginator(translations, 50) - page_number = request.GET.get('page') + page_number = request.GET.get("page") page_obj = paginator.get_page(page_number) for translation in page_obj: used_by_info = translation.used_by - translation.entry_id = used_by_info['id'] - translation.model_name = used_by_info['model_name'] - translation.field_name = used_by_info['field_name'] - translation.display_name = used_by_info['display_name'] + translation.entry_id = used_by_info["id"] + translation.model_name = used_by_info["model_name"] + translation.field_name = used_by_info["field_name"] + translation.display_name = used_by_info["display_name"] - context = { - 'page_obj': page_obj - } + context = {"page_obj": page_obj} return render(request, "translations.html", context) class TranslationForm(forms.Form): - text = forms.CharField(widget=forms.Textarea( - attrs={'name': 'text', 'rows': 3, 'cols': 50, 'class': 'textarea'}), required=False) + text = forms.CharField( + widget=forms.Textarea(attrs={"name": "text", "rows": 3, "cols": 50, "class": "textarea"}), required=False + ) class LabelForm(forms.Form): - label = forms.CharField(max_length=128, widget=forms.TextInput( - attrs={'class': 'input'})) + label = forms.CharField(max_length=128, widget=forms.TextInput(attrs={"class": "input"})) active = forms.BooleanField(required=False) no_auto = forms.BooleanField(required=False) -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def translation_view(request, id=0): - if request.method == 'GET': - translation = Translation.objects.prefetch_related( - 'translations').get(pk=id) - langs = [lang['code'] for lang in settings.PARLER_LANGUAGES[None]] + if request.method == "GET": + translation = Translation.objects.prefetch_related("translations").get(pk=id) + langs = [lang["code"] for lang in settings.PARLER_LANGUAGES[None]] - translations = {t.language_code: TranslationForm( - {'text': t.text}) for t in translation.translations.all()} + translations = {t.language_code: TranslationForm({"text": t.text}) for t in translation.translations.all()} for lang in langs: if lang not in translations: translations[lang] = TranslationForm() context = { - 'translation': translation, - 'langs': translations, - 'label_form': LabelForm({ - 'label': translation.label, - 'active': translation.active, - 'no_auto': translation.no_auto - }) + "translation": translation, + "langs": translations, + "label_form": LabelForm( + {"label": translation.label, "active": translation.active, "no_auto": translation.no_auto} + ), } return render(request, "edit/main.html", context) - elif request.method == 'POST': + elif request.method == "POST": form = LabelForm(request.POST) if form.is_valid(): translation = Translation.objects.get(pk=id) - translation.label = form['label'].value() - translation.active = form['active'].value() - translation.no_auto = form['no_auto'].value() + translation.label = form["label"].value() + translation.active = form["active"].value() + translation.no_auto = form["no_auto"].value() translation.save() context = { - 'form': LabelForm({ - 'label': translation.label, - 'active': translation.active, - 'no_auto': translation.no_auto - }), + "form": LabelForm( + {"label": translation.label, "active": translation.active, "no_auto": translation.no_auto} + ), } return render(request, "edit/label_form.html", context) - elif request.method == 'DELETE': + elif request.method == "DELETE": try: Translation.objects.get(pk=id).delete() except ProtectedError: return render( request, - 'error.html', - {"error_message": "Please delete the program that this translation is attached to if you want to delete this translation"} + "error.html", + { + "error_message": "Please delete the program that this translation is attached to if you want to delete this translation" + }, ) response = HttpResponse() response.headers["HX-Redirect"] = "/api/translations/admin" return response -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required -def edit_translation(request, id=0, lang='en-us'): - if request.method == 'POST': +def edit_translation(request, id=0, lang="en-us"): + if request.method == "POST": form = TranslationForm(request.POST) if form.is_valid(): - text = form['text'].value() - translation = Translation.objects.edit_translation_by_id( - id, lang, text) + text = form["text"].value() + translation = Translation.objects.edit_translation_by_id(id, lang, text) if lang == settings.LANGUAGE_CODE: - translations = Translate().bulk_translate( - ['__all__'], [text])[text] + translations = Translate().bulk_translate(["__all__"], [text])[text] for [language, translation] in translations.items(): - Translation.objects.edit_translation_by_id( - id, language, translation, False) + Translation.objects.edit_translation_by_id(id, language, translation, False) parent = Translation.objects.get(pk=id) - forms = {t.language_code: TranslationForm( - {'text': t.text}) for t in parent.translations.all()} + forms = {t.language_code: TranslationForm({"text": t.text}) for t in parent.translations.all()} context = { - 'translation': parent, - 'langs': forms, + "translation": parent, + "langs": forms, } return render(request, "edit/langs.html", context) -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required -def auto_translate(request, id=0, lang='en-us'): - if request.method == 'POST': - translation = Translation.objects.language( - settings.LANGUAGE_CODE).get(pk=id) +def auto_translate(request, id=0, lang="en-us"): + if request.method == "POST": + translation = Translation.objects.language(settings.LANGUAGE_CODE).get(pk=id) auto = Translate().translate(lang, translation.text) # Set text to manualy edited initially in order to update, and then set it to not edited - new_translation = Translation.objects.edit_translation_by_id( - translation.id, lang, auto) + new_translation = Translation.objects.edit_translation_by_id(translation.id, lang, auto) new_translation.edited = False new_translation.save() context = { - 'form': TranslationForm({'text': new_translation.text}), - 'lang': lang, - 'translation': translation, + "form": TranslationForm({"text": new_translation.text}), + "lang": lang, + "translation": translation, } return render(request, "edit/lang_form.html", context) class NewProgramForm(forms.Form): - name_abbreviated = forms.CharField(max_length=120, widget=forms.TextInput( - attrs={'class': 'input'})) + name_abbreviated = forms.CharField(max_length=120, widget=forms.TextInput(attrs={"class": "input"})) -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def programs_view(request): - if request.method == 'GET': - programs = Program.objects.all().order_by('external_name') + if request.method == "GET": + programs = Program.objects.all().order_by("external_name") paginator = Paginator(programs, 50) - page_number = request.GET.get('page') + page_number = request.GET.get("page") page_obj = paginator.get_page(page_number) - context = { - 'page_obj': page_obj - } + context = {"page_obj": page_obj} - return render(request, 'programs/main.html', context) - elif request.method == 'POST': + return render(request, "programs/main.html", context) + elif request.method == "POST": form = NewProgramForm(request.POST) if form.is_valid(): program = Program.objects.new_program( - form['name_abbreviated'].value(), + form["name_abbreviated"].value(), ) response = HttpResponse() response.headers["HX-Redirect"] = f"/api/translations/admin/programs/{program.id}" return response -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def create_program_view(request): - if request.method == 'GET': - context = { - 'form': NewProgramForm(), - 'route': '/api/translations/admin/programs' - } + if request.method == "GET": + context = {"form": NewProgramForm(), "route": "/api/translations/admin/programs"} - return render(request, 'util/create_form.html', context) + return render(request, "util/create_form.html", context) -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def program_view(request, id=0): - if request.method == 'GET': + if request.method == "GET": program = Program.objects.get(pk=id) - context = { - 'program': program - } + context = {"program": program} - return render(request, 'programs/program.html', context) + return render(request, "programs/program.html", context) -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def programs_filter_view(request): - if request.method == 'GET': - programs = Program.objects.filter( - name__translations__text__icontains=request.GET.get('name', '')).distinct().order_by('external_name') + if request.method == "GET": + programs = ( + Program.objects.filter(name__translations__text__icontains=request.GET.get("name", "")) + .distinct() + .order_by("external_name") + ) paginator = Paginator(programs, 50) - page_number = request.GET.get('page') + page_number = request.GET.get("page") page_obj = paginator.get_page(page_number) - context = { - 'page_obj': page_obj - } + context = {"page_obj": page_obj} - return render(request, 'programs/list.html', context) + return render(request, "programs/list.html", context) class NewNavigatorForm(forms.Form): - label = forms.CharField(max_length=50, widget=forms.TextInput( - attrs={'class': 'input'})) - phone_number = PhoneNumberField(required=False, - widget=forms.TextInput( - attrs={'class': 'input'}) - ) + label = forms.CharField(max_length=50, widget=forms.TextInput(attrs={"class": "input"})) + phone_number = PhoneNumberField(required=False, widget=forms.TextInput(attrs={"class": "input"})) -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def navigators_view(request): - if request.method == 'GET': - navigators = Navigator.objects.all().order_by('external_name') + if request.method == "GET": + navigators = Navigator.objects.all().order_by("external_name") paginator = Paginator(navigators, 50) - page_number = request.GET.get('page') + page_number = request.GET.get("page") page_obj = paginator.get_page(page_number) - context = { - 'page_obj': page_obj - } + context = {"page_obj": page_obj} - return render(request, 'navigators/main.html', context) - if request.method == 'POST': + return render(request, "navigators/main.html", context) + if request.method == "POST": form = NewNavigatorForm(request.POST) if form.is_valid(): navigator = Navigator.objects.new_navigator( - form['label'].value(), - form['phone_number'].value(), + form["label"].value(), + form["phone_number"].value(), ) response = HttpResponse() - response.headers[ - "HX-Redirect"] = f"/api/translations/admin/navigators/{navigator.id}" + response.headers["HX-Redirect"] = f"/api/translations/admin/navigators/{navigator.id}" return response -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def create_navigator_view(request): - if request.method == 'GET': - context = { - 'form': NewNavigatorForm(), - 'route': '/api/translations/admin/navigators' - } + if request.method == "GET": + context = {"form": NewNavigatorForm(), "route": "/api/translations/admin/navigators"} - return render(request, 'util/create_form.html', context) + return render(request, "util/create_form.html", context) -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def navigator_view(request, id=0): - if request.method == 'GET': + if request.method == "GET": navigator = Navigator.objects.get(pk=id) - context = { - 'navigator': navigator - } + context = {"navigator": navigator} - return render(request, 'navigators/navigator.html', context) + return render(request, "navigators/navigator.html", context) -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def navigator_filter_view(request): - if request.method == 'GET': - navigators = Navigator.objects.filter( - name__translations__text__icontains=request.GET.get('name', '')).distinct().order_by('external_name') + if request.method == "GET": + navigators = ( + Navigator.objects.filter(name__translations__text__icontains=request.GET.get("name", "")) + .distinct() + .order_by("external_name") + ) paginator = Paginator(navigators, 50) - page_number = request.GET.get('page') + page_number = request.GET.get("page") page_obj = paginator.get_page(page_number) - context = { - 'page_obj': page_obj - } + context = {"page_obj": page_obj} - return render(request, 'navigators/list.html', context) + return render(request, "navigators/list.html", context) class NewUrgentNeedForm(forms.Form): - label = forms.CharField(max_length=50, widget=forms.TextInput( - attrs={'class': 'input'})) - phone_number = PhoneNumberField(required=False, - widget=forms.TextInput( - attrs={'class': 'input'}) - ) + label = forms.CharField(max_length=50, widget=forms.TextInput(attrs={"class": "input"})) + phone_number = PhoneNumberField(required=False, widget=forms.TextInput(attrs={"class": "input"})) -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def urgent_needs_view(request): - if request.method == 'GET': - urgent_needs = UrgentNeed.objects.all().order_by('external_name') + if request.method == "GET": + urgent_needs = UrgentNeed.objects.all().order_by("external_name") paginator = Paginator(urgent_needs, 50) - page_number = request.GET.get('page') + page_number = request.GET.get("page") page_obj = paginator.get_page(page_number) - context = { - 'page_obj': page_obj - } - return render(request, 'urgent_needs/main.html', context) - if request.method == 'POST': + context = {"page_obj": page_obj} + return render(request, "urgent_needs/main.html", context) + if request.method == "POST": form = NewUrgentNeedForm(request.POST) if form.is_valid(): urgent_need = UrgentNeed.objects.new_urgent_need( - form['label'].value(), - form['phone_number'].value(), + form["label"].value(), + form["phone_number"].value(), ) response = HttpResponse() - response.headers[ - "HX-Redirect"] = f"/api/translations/admin/urgent_needs/{urgent_need.id}" + response.headers["HX-Redirect"] = f"/api/translations/admin/urgent_needs/{urgent_need.id}" return response -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def create_urgent_need_view(request): - if request.method == 'GET': - context = { - 'form': NewUrgentNeedForm(), - 'route': '/api/translations/admin/urgent_needs' - } + if request.method == "GET": + context = {"form": NewUrgentNeedForm(), "route": "/api/translations/admin/urgent_needs"} - return render(request, 'util/create_form.html', context) + return render(request, "util/create_form.html", context) -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def urgent_need_view(request, id=0): - if request.method == 'GET': + if request.method == "GET": urgent_need = UrgentNeed.objects.get(pk=id) - context = { - 'urgent_need': urgent_need - } + context = {"urgent_need": urgent_need} - return render(request, 'urgent_needs/urgent_need.html', context) + return render(request, "urgent_needs/urgent_need.html", context) -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def urgent_need_filter_view(request): - if request.method == 'GET': - urgent_needs = UrgentNeed.objects.filter( - name__translations__text__icontains=request.GET.get('name', '')).distinct().order_by('external_name') + if request.method == "GET": + urgent_needs = ( + UrgentNeed.objects.filter(name__translations__text__icontains=request.GET.get("name", "")) + .distinct() + .order_by("external_name") + ) paginator = Paginator(urgent_needs, 50) - page_number = request.GET.get('page') + page_number = request.GET.get("page") page_obj = paginator.get_page(page_number) - context = { - 'page_obj': page_obj - } + context = {"page_obj": page_obj} - return render(request, 'urgent_needs/list.html', context) + return render(request, "urgent_needs/list.html", context) class NewDocumentForm(forms.Form): - external_name = forms.CharField(max_length=120, widget=forms.TextInput( - attrs={'class': 'input'})) + external_name = forms.CharField(max_length=120, widget=forms.TextInput(attrs={"class": "input"})) -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def documents_view(request): - if request.method == 'GET': - documents = Document.objects.all().order_by('external_name') + if request.method == "GET": + documents = Document.objects.all().order_by("external_name") paginator = Paginator(documents, 50) - page_number = request.GET.get('page') + page_number = request.GET.get("page") page_obj = paginator.get_page(page_number) - context = { - 'page_obj': page_obj - } - return render(request, 'documents/main.html', context) - if request.method == 'POST': + context = {"page_obj": page_obj} + return render(request, "documents/main.html", context) + if request.method == "POST": form = NewDocumentForm(request.POST) if form.is_valid(): - document = Document.objects.new_document( - form['external_name'].value()) + document = Document.objects.new_document(form["external_name"].value()) response = HttpResponse() response.headers["HX-Redirect"] = f"/api/translations/admin/documents/{document.id}" return response -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def create_document_view(request): - if request.method == 'GET': - context = { - 'form': NewDocumentForm(), - 'route': '/api/translations/admin/documents' - } + if request.method == "GET": + context = {"form": NewDocumentForm(), "route": "/api/translations/admin/documents"} - return render(request, 'util/create_form.html', context) + return render(request, "util/create_form.html", context) -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def document_view(request, id=0): - if request.method == 'GET': + if request.method == "GET": document = Document.objects.get(pk=id) - context = { - 'document': document - } + context = {"document": document} - return render(request, 'documents/document.html', context) + return render(request, "documents/document.html", context) -@login_required(login_url='/admin/login') +@login_required(login_url="/admin/login") @staff_member_required def document_filter_view(request): - if request.method == 'GET': - query = request.GET.get('name', '') - documents = Document.objects.filter( - external_name__contains=query).order_by('external_name') + if request.method == "GET": + query = request.GET.get("name", "") + documents = Document.objects.filter(external_name__contains=query).order_by("external_name") paginator = Paginator(documents, 50) - page_number = request.GET.get('page') + page_number = request.GET.get("page") page_obj = paginator.get_page(page_number) - context = { - 'page_obj': page_obj - } + context = {"page_obj": page_obj} - return render(request, 'documents/list.html', context) + return render(request, "documents/list.html", context)