From 98e1f81d7fe6f8db694235b40e59787b382f7918 Mon Sep 17 00:00:00 2001 From: h0und <79583632+msrezaie@users.noreply.github.com> Date: Tue, 26 Nov 2024 13:22:46 -0500 Subject: [PATCH 01/23] added sun bucks program --- programs/programs/helpers.py | 9 +++++ programs/programs/nc/__init__.py | 2 ++ programs/programs/nc/sun_bucks/__init__.py | 0 programs/programs/nc/sun_bucks/calculator.py | 36 ++++++++++++++++++++ 4 files changed, 47 insertions(+) create mode 100644 programs/programs/nc/sun_bucks/__init__.py create mode 100644 programs/programs/nc/sun_bucks/calculator.py diff --git a/programs/programs/helpers.py b/programs/programs/helpers.py index 74ea9f94..ec457e15 100644 --- a/programs/programs/helpers.py +++ b/programs/programs/helpers.py @@ -3,6 +3,7 @@ STATE_MEDICAID_OPTIONS = ("co_medicaid", "nc_medicaid") +STATE_SNAP_OPTIONS = ("co_snap", "nc_snap") def medicaid_eligible(data: dict[str, Eligibility]): @@ -13,6 +14,14 @@ def medicaid_eligible(data: dict[str, Eligibility]): return False +def snap_eligible(data: dict[str, Eligibility]): + for name in STATE_SNAP_OPTIONS: + if name in data: + return data[name].eligible + + return False + + def snap_ineligible_student(screen: Screen, member: HouseholdMember): if not member.student: return False diff --git a/programs/programs/nc/__init__.py b/programs/programs/nc/__init__.py index feff9b0b..fe001050 100644 --- a/programs/programs/nc/__init__.py +++ b/programs/programs/nc/__init__.py @@ -1,9 +1,11 @@ from .nc_aca.calculator import ACASubsidiesNC from .medicaid.emergency_medicaid.calculator import EmergencyMedicaid +from .sun_bucks.calculator import SunBucks from ..calc import ProgramCalculator nc_calculators: dict[str, type[ProgramCalculator]] = { "nc_aca": ACASubsidiesNC, "nc_emergency_medicaid": EmergencyMedicaid, + "sunbucks": SunBucks, } diff --git a/programs/programs/nc/sun_bucks/__init__.py b/programs/programs/nc/sun_bucks/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/programs/programs/nc/sun_bucks/calculator.py b/programs/programs/nc/sun_bucks/calculator.py new file mode 100644 index 00000000..c2a87879 --- /dev/null +++ b/programs/programs/nc/sun_bucks/calculator.py @@ -0,0 +1,36 @@ +from programs.programs.calc import MemberEligibility, ProgramCalculator, Eligibility +from programs.programs.helpers import medicaid_eligible, snap_eligible +import programs.programs.messages as messages + + +class SunBucks(ProgramCalculator): + member_amount = 1440 + min_age = 7 + max_age = 16 + fpl_percent = 1.85 + dependencies = ["age", "insurance", "income_amount", "income_frequency", "household_size"] + + def household_eligible(self, e: Eligibility): + # Must not have Medicaid + e.condition(not medicaid_eligible(self.data), messages.must_not_have_benefit("Medicaid")) + + # Must not have SNAP + e.condition(not snap_eligible(self.data), messages.must_not_have_benefit("SNAP")) + + # Income + fpl = self.program.fpl + income_limit = int(self.fpl_percent * fpl.get_limit(self.screen.household_size)) + gross_income = int(self.screen.calc_gross_income("yearly", ["all"])) + + e.condition(gross_income < income_limit, messages.income(gross_income, income_limit)) + + def member_eligible(self, e: MemberEligibility): + member = e.member + + # age eligibility + child_eligible = False + if member.age >= SunBucks.min_age and member.age <= SunBucks.max_age: + child_eligible = True + + e.condition(child_eligible) + From e8107a0166ae18b9661044eb68f3dbb6a88f099a Mon Sep 17 00:00:00 2001 From: h0und <79583632+msrezaie@users.noreply.github.com> Date: Tue, 26 Nov 2024 14:22:48 -0500 Subject: [PATCH 02/23] added new helper methods --- programs/programs/helpers.py | 9 +++++++++ programs/programs/nc/sun_bucks/calculator.py | 5 ++++- screener/views.py | 4 +++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/programs/programs/helpers.py b/programs/programs/helpers.py index ec457e15..0d38828a 100644 --- a/programs/programs/helpers.py +++ b/programs/programs/helpers.py @@ -4,6 +4,7 @@ STATE_MEDICAID_OPTIONS = ("co_medicaid", "nc_medicaid") STATE_SNAP_OPTIONS = ("co_snap", "nc_snap") +STATE_TANF_OPTIONS = ("co_tanf", "nc_tanf") def medicaid_eligible(data: dict[str, Eligibility]): @@ -22,6 +23,14 @@ def snap_eligible(data: dict[str, Eligibility]): return False +def tanf_eligible(data: dict[str, Eligibility]): + for name in STATE_TANF_OPTIONS: + if name in data: + return data[name].eligible + + return False + + def snap_ineligible_student(screen: Screen, member: HouseholdMember): if not member.student: return False diff --git a/programs/programs/nc/sun_bucks/calculator.py b/programs/programs/nc/sun_bucks/calculator.py index c2a87879..a0fd1ebd 100644 --- a/programs/programs/nc/sun_bucks/calculator.py +++ b/programs/programs/nc/sun_bucks/calculator.py @@ -1,5 +1,5 @@ from programs.programs.calc import MemberEligibility, ProgramCalculator, Eligibility -from programs.programs.helpers import medicaid_eligible, snap_eligible +from programs.programs.helpers import medicaid_eligible, snap_eligible, tanf_eligible import programs.programs.messages as messages @@ -16,6 +16,9 @@ def household_eligible(self, e: Eligibility): # Must not have SNAP e.condition(not snap_eligible(self.data), messages.must_not_have_benefit("SNAP")) + + # Must not have TANF + e.condition(not tanf_eligible(self.data), messages.must_not_have_benefit("TANF")) # Income fpl = self.program.fpl diff --git a/screener/views.py b/screener/views.py index b4fd2816..d252306c 100644 --- a/screener/views.py +++ b/screener/views.py @@ -4,7 +4,7 @@ from rest_framework.relations import reverse from integrations.services.communications import MessageUser from programs.programs import categories -from programs.programs.helpers import STATE_MEDICAID_OPTIONS +from programs.programs.helpers import STATE_MEDICAID_OPTIONS, STATE_SNAP_OPTIONS, STATE_TANF_OPTIONS from programs.programs.policyengine.calculators import all_calculators from screener.models import ( Screen, @@ -258,7 +258,9 @@ def sort_first(program): "nslp", "leap", "chp", + *STATE_TANF_OPTIONS, *STATE_MEDICAID_OPTIONS, + *STATE_SNAP_OPTIONS, "emergency_medicaid", "wic", "andcs", From cdf99e627f485dfc4a45cc28be79171d86a681c8 Mon Sep 17 00:00:00 2001 From: h0und <79583632+msrezaie@users.noreply.github.com> Date: Mon, 2 Dec 2024 13:02:32 -0500 Subject: [PATCH 03/23] removed unnecessary conditions --- programs/programs/nc/sun_bucks/calculator.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/programs/programs/nc/sun_bucks/calculator.py b/programs/programs/nc/sun_bucks/calculator.py index a0fd1ebd..5871c049 100644 --- a/programs/programs/nc/sun_bucks/calculator.py +++ b/programs/programs/nc/sun_bucks/calculator.py @@ -11,15 +11,6 @@ class SunBucks(ProgramCalculator): dependencies = ["age", "insurance", "income_amount", "income_frequency", "household_size"] def household_eligible(self, e: Eligibility): - # Must not have Medicaid - e.condition(not medicaid_eligible(self.data), messages.must_not_have_benefit("Medicaid")) - - # Must not have SNAP - e.condition(not snap_eligible(self.data), messages.must_not_have_benefit("SNAP")) - - # Must not have TANF - e.condition(not tanf_eligible(self.data), messages.must_not_have_benefit("TANF")) - # Income fpl = self.program.fpl income_limit = int(self.fpl_percent * fpl.get_limit(self.screen.household_size)) From 698af43f2c170f9c15ba3f80bc2134e4915fc89a Mon Sep 17 00:00:00 2001 From: h0und <79583632+msrezaie@users.noreply.github.com> Date: Mon, 2 Dec 2024 13:11:51 -0500 Subject: [PATCH 04/23] format fix --- programs/programs/nc/sun_bucks/calculator.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/programs/programs/nc/sun_bucks/calculator.py b/programs/programs/nc/sun_bucks/calculator.py index 5871c049..38ff39c8 100644 --- a/programs/programs/nc/sun_bucks/calculator.py +++ b/programs/programs/nc/sun_bucks/calculator.py @@ -25,6 +25,5 @@ def member_eligible(self, e: MemberEligibility): child_eligible = False if member.age >= SunBucks.min_age and member.age <= SunBucks.max_age: child_eligible = True - - e.condition(child_eligible) + e.condition(child_eligible) From 56ad2fd773e1fe36a0ff3bb872def395fd5c266a Mon Sep 17 00:00:00 2001 From: h0und <79583632+msrezaie@users.noreply.github.com> Date: Mon, 2 Dec 2024 14:31:16 -0500 Subject: [PATCH 05/23] removed unused changes --- programs/programs/helpers.py | 18 ------------------ programs/programs/nc/sun_bucks/calculator.py | 1 - screener/views.py | 4 +--- 3 files changed, 1 insertion(+), 22 deletions(-) diff --git a/programs/programs/helpers.py b/programs/programs/helpers.py index 0d38828a..74ea9f94 100644 --- a/programs/programs/helpers.py +++ b/programs/programs/helpers.py @@ -3,8 +3,6 @@ STATE_MEDICAID_OPTIONS = ("co_medicaid", "nc_medicaid") -STATE_SNAP_OPTIONS = ("co_snap", "nc_snap") -STATE_TANF_OPTIONS = ("co_tanf", "nc_tanf") def medicaid_eligible(data: dict[str, Eligibility]): @@ -15,22 +13,6 @@ def medicaid_eligible(data: dict[str, Eligibility]): return False -def snap_eligible(data: dict[str, Eligibility]): - for name in STATE_SNAP_OPTIONS: - if name in data: - return data[name].eligible - - return False - - -def tanf_eligible(data: dict[str, Eligibility]): - for name in STATE_TANF_OPTIONS: - if name in data: - return data[name].eligible - - return False - - def snap_ineligible_student(screen: Screen, member: HouseholdMember): if not member.student: return False diff --git a/programs/programs/nc/sun_bucks/calculator.py b/programs/programs/nc/sun_bucks/calculator.py index 38ff39c8..8fd94d4a 100644 --- a/programs/programs/nc/sun_bucks/calculator.py +++ b/programs/programs/nc/sun_bucks/calculator.py @@ -1,5 +1,4 @@ from programs.programs.calc import MemberEligibility, ProgramCalculator, Eligibility -from programs.programs.helpers import medicaid_eligible, snap_eligible, tanf_eligible import programs.programs.messages as messages diff --git a/screener/views.py b/screener/views.py index d252306c..b4fd2816 100644 --- a/screener/views.py +++ b/screener/views.py @@ -4,7 +4,7 @@ from rest_framework.relations import reverse from integrations.services.communications import MessageUser from programs.programs import categories -from programs.programs.helpers import STATE_MEDICAID_OPTIONS, STATE_SNAP_OPTIONS, STATE_TANF_OPTIONS +from programs.programs.helpers import STATE_MEDICAID_OPTIONS from programs.programs.policyengine.calculators import all_calculators from screener.models import ( Screen, @@ -258,9 +258,7 @@ def sort_first(program): "nslp", "leap", "chp", - *STATE_TANF_OPTIONS, *STATE_MEDICAID_OPTIONS, - *STATE_SNAP_OPTIONS, "emergency_medicaid", "wic", "andcs", From 640b74a991f2dc0297f7d5c5b362d2bb638a6425 Mon Sep 17 00:00:00 2001 From: h0und <79583632+msrezaie@users.noreply.github.com> Date: Tue, 3 Dec 2024 14:04:05 -0500 Subject: [PATCH 06/23] added has_sunbucks in the screener model --- .../migrations/0089_screen_has_sunbucks.py | 18 ++++++++++++++++++ screener/models.py | 2 ++ screener/serializers.py | 1 + 3 files changed, 21 insertions(+) create mode 100644 screener/migrations/0089_screen_has_sunbucks.py diff --git a/screener/migrations/0089_screen_has_sunbucks.py b/screener/migrations/0089_screen_has_sunbucks.py new file mode 100644 index 00000000..2111c5e3 --- /dev/null +++ b/screener/migrations/0089_screen_has_sunbucks.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.15 on 2024-12-03 18:08 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("screener", "0088_alter_screen_white_label"), + ] + + operations = [ + migrations.AddField( + model_name="screen", + name="has_sunbucks", + field=models.BooleanField(blank=True, default=False, null=True), + ), + ] diff --git a/screener/models.py b/screener/models.py index 32d1bfe4..2dc2256b 100644 --- a/screener/models.py +++ b/screener/models.py @@ -50,6 +50,7 @@ class Screen(models.Model): 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) + has_sunbucks = models.BooleanField(default=False, blank=True, null=True) has_lifeline = models.BooleanField(default=False, blank=True, null=True) has_acp = models.BooleanField(default=False, blank=True, null=True) has_eitc = models.BooleanField(default=False, blank=True, null=True) @@ -281,6 +282,7 @@ def has_benefit(self, name_abbreviated): "wic": self.has_wic, "nc_wic": self.has_wic, "snap": self.has_snap, + "sunbucks": self.has_sunbucks or self.has_tanf or self.has_snap or self.has_medicaid or self.has_medicaid_hi, "co_snap": self.has_snap, "nc_snap": self.has_snap, "lifeline": self.has_lifeline, diff --git a/screener/serializers.py b/screener/serializers.py index 857f1acc..21521ebc 100644 --- a/screener/serializers.py +++ b/screener/serializers.py @@ -136,6 +136,7 @@ class Meta: "has_tanf", "has_wic", "has_snap", + "has_sunbucks", "has_lifeline", "has_acp", "has_eitc", From 18f8897ca9687f6cf17fc0537a1aa9abdc42a458 Mon Sep 17 00:00:00 2001 From: Mo S Rezaie <79583632+msrezaie@users.noreply.github.com> Date: Tue, 3 Dec 2024 14:05:25 -0500 Subject: [PATCH 07/23] Update programs/programs/nc/sun_bucks/calculator.py Co-authored-by: CalebPena <62856626+CalebPena@users.noreply.github.com> --- programs/programs/nc/sun_bucks/calculator.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/programs/programs/nc/sun_bucks/calculator.py b/programs/programs/nc/sun_bucks/calculator.py index 8fd94d4a..1b70cebe 100644 --- a/programs/programs/nc/sun_bucks/calculator.py +++ b/programs/programs/nc/sun_bucks/calculator.py @@ -21,8 +21,4 @@ def member_eligible(self, e: MemberEligibility): member = e.member # age eligibility - child_eligible = False - if member.age >= SunBucks.min_age and member.age <= SunBucks.max_age: - child_eligible = True - - e.condition(child_eligible) + e.condition(SunBucks.min_age <= member.age <= SubBucks.max_age) From f5795d31ace1bc26fe65c44b85fbaceed2730cb8 Mon Sep 17 00:00:00 2001 From: h0und <79583632+msrezaie@users.noreply.github.com> Date: Tue, 3 Dec 2024 14:06:26 -0500 Subject: [PATCH 08/23] format fix --- screener/models.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/screener/models.py b/screener/models.py index 2dc2256b..e891bcd6 100644 --- a/screener/models.py +++ b/screener/models.py @@ -282,7 +282,11 @@ def has_benefit(self, name_abbreviated): "wic": self.has_wic, "nc_wic": self.has_wic, "snap": self.has_snap, - "sunbucks": self.has_sunbucks or self.has_tanf or self.has_snap or self.has_medicaid or self.has_medicaid_hi, + "sunbucks": self.has_sunbucks + or self.has_tanf + or self.has_snap + or self.has_medicaid + or self.has_medicaid_hi, "co_snap": self.has_snap, "nc_snap": self.has_snap, "lifeline": self.has_lifeline, From 8a225de09fc232018cb84ca7cc0ed21fc73d1ff3 Mon Sep 17 00:00:00 2001 From: Caleb Date: Wed, 4 Dec 2024 15:28:43 -0700 Subject: [PATCH 09/23] fix ccig referrer --- configuration/white_labels/co.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configuration/white_labels/co.py b/configuration/white_labels/co.py index 11ffaf97..877f133c 100644 --- a/configuration/white_labels/co.py +++ b/configuration/white_labels/co.py @@ -146,7 +146,7 @@ def get_white_label(self) -> WhiteLabel: "_label": "referralOptions.fircsummitresourcecenter", "_default_message": "FIRC Summit Resource Center", }, - "ccig": "Colorado Community Insight Group", + "ccig": "Colorado Design Insight Group", "eaglecounty": "Eagle County", "searchEngine": {"_label": "referralOptions.searchEngine", "_default_message": "Google or other search engine"}, "socialMedia": {"_label": "referralOptions.socialMedia", "_default_message": "Social Media"}, From 5e3f3d006750d7081eb23d1e306fd06fa18cfac1 Mon Sep 17 00:00:00 2001 From: h0und <79583632+msrezaie@users.noreply.github.com> Date: Thu, 5 Dec 2024 11:27:06 -0500 Subject: [PATCH 10/23] fixed typo --- programs/programs/nc/sun_bucks/calculator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/programs/nc/sun_bucks/calculator.py b/programs/programs/nc/sun_bucks/calculator.py index 1b70cebe..db8077e7 100644 --- a/programs/programs/nc/sun_bucks/calculator.py +++ b/programs/programs/nc/sun_bucks/calculator.py @@ -21,4 +21,4 @@ def member_eligible(self, e: MemberEligibility): member = e.member # age eligibility - e.condition(SunBucks.min_age <= member.age <= SubBucks.max_age) + e.condition(SunBucks.min_age <= member.age <= SunBucks.max_age) From 6f496f783e6ddfd154a86333731f317dac7ccf08 Mon Sep 17 00:00:00 2001 From: Caleb Date: Mon, 9 Dec 2024 10:10:54 -0700 Subject: [PATCH 11/23] update email results link --- integrations/services/communications/message.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integrations/services/communications/message.py b/integrations/services/communications/message.py index 9830d6af..32daa863 100644 --- a/integrations/services/communications/message.py +++ b/integrations/services/communications/message.py @@ -81,7 +81,7 @@ 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" + return f"{self.front_end_domain}/{self.screen.white_label.code}/{self.screen.uuid}/results" def log(self, type: Literal["emailScreen", "textScreen"]): self.screen.last_email_request_date = timezone.now() From 5ddb149a371d711dfc806013b0c92de78f3d8508 Mon Sep 17 00:00:00 2001 From: h0und <79583632+msrezaie@users.noreply.github.com> Date: Mon, 9 Dec 2024 12:25:28 -0500 Subject: [PATCH 12/23] corrected eligibility condition --- programs/programs/nc/sun_bucks/calculator.py | 5 +++++ screener/models.py | 6 +----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/programs/programs/nc/sun_bucks/calculator.py b/programs/programs/nc/sun_bucks/calculator.py index db8077e7..31b672da 100644 --- a/programs/programs/nc/sun_bucks/calculator.py +++ b/programs/programs/nc/sun_bucks/calculator.py @@ -15,6 +15,11 @@ def household_eligible(self, e: Eligibility): income_limit = int(self.fpl_percent * fpl.get_limit(self.screen.household_size)) gross_income = int(self.screen.calc_gross_income("yearly", ["all"])) + # Must not have the following benefits + e.condition(not self.screen.has_benefit("snap"), messages.must_not_have_benefit("snap")) + e.condition(not self.screen.has_benefit("tanf"), messages.must_not_have_benefit("tanf")) + e.condition(not self.screen.has_benefit("medicaid"), messages.must_not_have_benefit("medicaid")) + e.condition(gross_income < income_limit, messages.income(gross_income, income_limit)) def member_eligible(self, e: MemberEligibility): diff --git a/screener/models.py b/screener/models.py index e891bcd6..f6064645 100644 --- a/screener/models.py +++ b/screener/models.py @@ -282,11 +282,7 @@ def has_benefit(self, name_abbreviated): "wic": self.has_wic, "nc_wic": self.has_wic, "snap": self.has_snap, - "sunbucks": self.has_sunbucks - or self.has_tanf - or self.has_snap - or self.has_medicaid - or self.has_medicaid_hi, + "sunbucks": self.has_sunbucks, "co_snap": self.has_snap, "nc_snap": self.has_snap, "lifeline": self.has_lifeline, From 7ac2f04fb0fb16adf33ac181e331569ce2341e39 Mon Sep 17 00:00:00 2001 From: Caleb Date: Mon, 9 Dec 2024 14:06:39 -0700 Subject: [PATCH 13/23] fix create_instance methods --- programs/models.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/programs/models.py b/programs/models.py index 30a1f9e1..9ce9cfd5 100644 --- a/programs/models.py +++ b/programs/models.py @@ -153,7 +153,7 @@ def from_model_data(self, data: DataType): @classmethod def create_instance(cls, external_name: str, Model: type["ProgramCategory"]) -> "ProgramCategory": - return Model.objects.new_program_category(external_name, "housing") + return Model.objects.new_program_category('_default', external_name, "housing") class ProgramCategory(models.Model): @@ -229,7 +229,7 @@ def from_model_data(self, data: DataType): @classmethod def create_instance(cls, external_name: str, Model: type["Document"]) -> "Document": - return Model.objects.new_document(external_name) + return Model.objects.new_document('_default', external_name) class Document(models.Model): @@ -397,7 +397,7 @@ def from_model_data(self, data: DataType): @classmethod def create_instance(cls, external_name: str, Model: type["Program"]) -> "Program": - return Model.objects.new_program(external_name) + return Model.objects.new_program('_default', external_name) # This model describes all of the benefit programs available in the screener @@ -637,7 +637,7 @@ def from_model_data(self, data: DataType): @classmethod def create_instance(cls, external_name: str, Model: type["UrgentNeed"]) -> "UrgentNeed": - return Model.objects.new_urgent_need(external_name, None) + return Model.objects.new_urgent_need('_default', external_name, None) class UrgentNeed(models.Model): @@ -704,7 +704,7 @@ class NavigatorManager(models.Manager): ) no_auto_fields = ("assistance_link",) - def new_navigator(self, white_label: str, name: str, phone_number: str): + def new_navigator(self, white_label: str, name: str, phone_number: Optional[str] = None): translations = {} for field in self.translated_fields: translations[field] = Translation.objects.add_translation( @@ -808,7 +808,7 @@ def from_model_data(self, data: DataType): @classmethod def create_instance(cls, external_name: str, Model: type["Navigator"]) -> "Navigator": - return Model.objects.new_navigator(external_name, None) + return Model.objects.new_navigator('_default', external_name, None) class Navigator(models.Model): @@ -925,7 +925,7 @@ def from_model_data(self, data: DataType): @classmethod def create_instance(cls, external_name: str, Model: type["WarningMessage"]) -> "WarningMessage": - return Model.objects.new_warning("_show", external_name) + return Model.objects.new_warning('_default', "_show", external_name) class WarningMessage(models.Model): @@ -1067,7 +1067,7 @@ def from_model_data(self, data: DataType): @classmethod def create_instance(cls, external_name: str, Model: type["TranslationOverride"]) -> "TranslationOverride": - return Model.objects.new_translation_override("_show", "", external_name) + return Model.objects.new_translation_override('_default', "_show", "", external_name) class TranslationOverride(models.Model): From 835aef863758b81fdb8ba85b126a709bbac3b105 Mon Sep 17 00:00:00 2001 From: Caleb Date: Mon, 9 Dec 2024 14:06:50 -0700 Subject: [PATCH 14/23] format --- programs/models.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/programs/models.py b/programs/models.py index 9ce9cfd5..7b69f91a 100644 --- a/programs/models.py +++ b/programs/models.py @@ -153,7 +153,7 @@ def from_model_data(self, data: DataType): @classmethod def create_instance(cls, external_name: str, Model: type["ProgramCategory"]) -> "ProgramCategory": - return Model.objects.new_program_category('_default', external_name, "housing") + return Model.objects.new_program_category("_default", external_name, "housing") class ProgramCategory(models.Model): @@ -229,7 +229,7 @@ def from_model_data(self, data: DataType): @classmethod def create_instance(cls, external_name: str, Model: type["Document"]) -> "Document": - return Model.objects.new_document('_default', external_name) + return Model.objects.new_document("_default", external_name) class Document(models.Model): @@ -397,7 +397,7 @@ def from_model_data(self, data: DataType): @classmethod def create_instance(cls, external_name: str, Model: type["Program"]) -> "Program": - return Model.objects.new_program('_default', external_name) + return Model.objects.new_program("_default", external_name) # This model describes all of the benefit programs available in the screener @@ -637,7 +637,7 @@ def from_model_data(self, data: DataType): @classmethod def create_instance(cls, external_name: str, Model: type["UrgentNeed"]) -> "UrgentNeed": - return Model.objects.new_urgent_need('_default', external_name, None) + return Model.objects.new_urgent_need("_default", external_name, None) class UrgentNeed(models.Model): @@ -808,7 +808,7 @@ def from_model_data(self, data: DataType): @classmethod def create_instance(cls, external_name: str, Model: type["Navigator"]) -> "Navigator": - return Model.objects.new_navigator('_default', external_name, None) + return Model.objects.new_navigator("_default", external_name, None) class Navigator(models.Model): @@ -925,7 +925,7 @@ def from_model_data(self, data: DataType): @classmethod def create_instance(cls, external_name: str, Model: type["WarningMessage"]) -> "WarningMessage": - return Model.objects.new_warning('_default', "_show", external_name) + return Model.objects.new_warning("_default", "_show", external_name) class WarningMessage(models.Model): @@ -1067,7 +1067,7 @@ def from_model_data(self, data: DataType): @classmethod def create_instance(cls, external_name: str, Model: type["TranslationOverride"]) -> "TranslationOverride": - return Model.objects.new_translation_override('_default', "_show", "", external_name) + return Model.objects.new_translation_override("_default", "_show", "", external_name) class TranslationOverride(models.Model): From 177f502f8b0baea9e6a1c0bd123da57d9eb68b80 Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 10 Dec 2024 11:35:31 -0700 Subject: [PATCH 15/23] make health check account for old screens --- integrations/management/commands/health_check.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/integrations/management/commands/health_check.py b/integrations/management/commands/health_check.py index 036e2cf3..36c63b28 100644 --- a/integrations/management/commands/health_check.py +++ b/integrations/management/commands/health_check.py @@ -1,10 +1,8 @@ -from typing import Optional from django.core.management.base import BaseCommand from django.conf import settings from decouple import config from hubspot import HubSpot from hubspot.crm.contacts.exceptions import ForbiddenException -from django.db.models import Q from authentication.models import User from integrations.models import Link from programs.models import Navigator, Program, TranslationOverride, UrgentNeed @@ -57,13 +55,7 @@ def _cant_read_hubspot(self) -> bool: return False def _no_pii_in_db(self) -> bool: - users = User.objects.filter(is_staff=False).filter( - Q(first_name__isnull=False) - | Q(last_name__isnull=False) - | Q(cell__isnull=False) - | Q(email__isnull=False) - | Q(external_id__isnull=True) - ) + users = User.objects.filter(is_staff=False).filter(external_id__isnull=True) if len(users) > 0: return False From f748100af2cfda6769daed5ccec2667090542912 Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 10 Dec 2024 11:57:41 -0700 Subject: [PATCH 16/23] create urgent need category instead of urgentneed function --- programs/models.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/programs/models.py b/programs/models.py index 7b69f91a..a5b93437 100644 --- a/programs/models.py +++ b/programs/models.py @@ -616,9 +616,8 @@ def from_model_data(self, data: DataType): try: cat_instance = UrgentNeedCategory.objects.get(name=category["name"]) except UrgentNeedCategory.DoesNotExist: - cat_instance = UrgentNeedFunction.objects.create(name=category["name"]) + cat_instance = UrgentNeedCategory.objects.create(name=category["name"]) - cat_instance.white_label = white_label cat_instance.save() categories.append(cat_instance) need.type_short.set(categories) From dd996904c7c25b42f82a204cd3d0537b2b1d66f6 Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 10 Dec 2024 11:59:06 -0700 Subject: [PATCH 17/23] add white label back --- programs/models.py | 1 + 1 file changed, 1 insertion(+) diff --git a/programs/models.py b/programs/models.py index a5b93437..38c04fc2 100644 --- a/programs/models.py +++ b/programs/models.py @@ -618,6 +618,7 @@ def from_model_data(self, data: DataType): except UrgentNeedCategory.DoesNotExist: cat_instance = UrgentNeedCategory.objects.create(name=category["name"]) + cat_instance.white_label = white_label cat_instance.save() categories.append(cat_instance) need.type_short.set(categories) From 5a3b2c88c94683ff71b68bc173d8eaba0dcf6a75 Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 10 Dec 2024 13:06:47 -0700 Subject: [PATCH 18/23] fix creating the urgent need category to add a whitelabel --- programs/models.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/programs/models.py b/programs/models.py index 38c04fc2..3bb075a0 100644 --- a/programs/models.py +++ b/programs/models.py @@ -615,11 +615,11 @@ def from_model_data(self, data: DataType): for category in data["categories"]: try: cat_instance = UrgentNeedCategory.objects.get(name=category["name"]) + cat_instance.white_label = white_label + cat_instance.save() except UrgentNeedCategory.DoesNotExist: - cat_instance = UrgentNeedCategory.objects.create(name=category["name"]) + cat_instance = UrgentNeedCategory.objects.create(name=category["name"], white_label=white_label) - cat_instance.white_label = white_label - cat_instance.save() categories.append(cat_instance) need.type_short.set(categories) From f71e4cc4ba65c8648cb185cd9842fb6ae70fa7f4 Mon Sep 17 00:00:00 2001 From: Caleb Date: Tue, 10 Dec 2024 13:10:12 -0700 Subject: [PATCH 19/23] add white label to create methods --- programs/models.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/programs/models.py b/programs/models.py index 3bb075a0..e94292d5 100644 --- a/programs/models.py +++ b/programs/models.py @@ -779,11 +779,11 @@ def from_model_data(self, data: DataType): for county in data["counties"]: try: county_instance = County.objects.get(name=county["name"]) + county_instance.white_label = white_label + county_instance.save() except County.DoesNotExist: - county_instance = County.objects.create(name=county["name"]) + county_instance = County.objects.create(name=county["name"], white_label=white_label) - county_instance.white_label = white_label - county_instance.save() counties.append(county_instance) navigator.counties.set(counties) @@ -909,8 +909,10 @@ def from_model_data(self, data: DataType): for county in data["counties"]: try: county_instance = County.objects.get(name=county["name"]) + county_instance.white_label = white_label + county_instance.save() except County.DoesNotExist: - county_instance = County.objects.create(name=county["name"]) + county_instance = County.objects.create(name=county["name"], white_label=white_label) counties.append(county_instance) warning.counties.set(counties) @@ -1055,8 +1057,10 @@ def from_model_data(self, data: DataType): for county in data["counties"]: try: county_instance = County.objects.get(name=county["name"]) + county_instance.white_label = white_label + county_instance.save() except County.DoesNotExist: - county_instance = County.objects.create(name=county["name"]) + county_instance = County.objects.create(name=county["name"], white_label=white_label) counties.append(county_instance) translation_override.counties.set(counties) From 4b66f14b20a27edd07270079824b18d472529bd8 Mon Sep 17 00:00:00 2001 From: h0und <79583632+msrezaie@users.noreply.github.com> Date: Wed, 11 Dec 2024 11:12:00 -0500 Subject: [PATCH 20/23] corrected switched values --- programs/programs/nc/pe/member.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/programs/programs/nc/pe/member.py b/programs/programs/nc/pe/member.py index 1e3256a6..76611fef 100644 --- a/programs/programs/nc/pe/member.py +++ b/programs/programs/nc/pe/member.py @@ -17,8 +17,8 @@ class NcMedicaid(Medicaid): "YOUNG_ADULT": 512, # * 12 = 6146, Medicaid Expansion Adults "PARENT": 0, "SSI_RECIPIENT": 0, - "AGED": 1519, # * 12 = 13035, Medicaid for the Aged - "DISABLED": 1086, # * 12 = 18227, Medicaid for the Disabled + "AGED": 1086, # * 12 = 13035, Medicaid for the Aged + "DISABLED": 1519, # * 12 = 18227, Medicaid for the Disabled } pe_inputs = [ From c7557f4c43daea5d93aeefd2c3badfe350fbe013 Mon Sep 17 00:00:00 2001 From: h0und <79583632+msrezaie@users.noreply.github.com> Date: Wed, 11 Dec 2024 11:17:07 -0500 Subject: [PATCH 21/23] format fix --- programs/programs/nc/pe/member.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/programs/nc/pe/member.py b/programs/programs/nc/pe/member.py index 76611fef..aa2aa533 100644 --- a/programs/programs/nc/pe/member.py +++ b/programs/programs/nc/pe/member.py @@ -17,7 +17,7 @@ class NcMedicaid(Medicaid): "YOUNG_ADULT": 512, # * 12 = 6146, Medicaid Expansion Adults "PARENT": 0, "SSI_RECIPIENT": 0, - "AGED": 1086, # * 12 = 13035, Medicaid for the Aged + "AGED": 1086, # * 12 = 13035, Medicaid for the Aged "DISABLED": 1519, # * 12 = 18227, Medicaid for the Disabled } From feab5bdd1451e311bf30e69e36899533b923601a Mon Sep 17 00:00:00 2001 From: Caleb Date: Fri, 13 Dec 2024 10:26:43 -0700 Subject: [PATCH 22/23] merge migrations --- screener/migrations/0090_merge_20241213_1726.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 screener/migrations/0090_merge_20241213_1726.py diff --git a/screener/migrations/0090_merge_20241213_1726.py b/screener/migrations/0090_merge_20241213_1726.py new file mode 100644 index 00000000..ce555af6 --- /dev/null +++ b/screener/migrations/0090_merge_20241213_1726.py @@ -0,0 +1,13 @@ +# Generated by Django 4.2.15 on 2024-12-13 17:26 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("screener", "0089_screen_has_sunbucks"), + ("screener", "0089_whitelabel_cms_method"), + ] + + operations = [] From 7a6e992905fc89572cc0ecfdde0fd9fd6591975b Mon Sep 17 00:00:00 2001 From: Caleb Date: Fri, 13 Dec 2024 10:57:23 -0700 Subject: [PATCH 23/23] fix already has wic --- screener/models.py | 1 + 1 file changed, 1 insertion(+) diff --git a/screener/models.py b/screener/models.py index ebef3881..99157c93 100644 --- a/screener/models.py +++ b/screener/models.py @@ -281,6 +281,7 @@ def has_benefit(self, name_abbreviated): "nc_tanf": self.has_tanf, "co_tanf": self.has_tanf, "wic": self.has_wic, + "co_wic": self.has_wic, "nc_wic": self.has_wic, "snap": self.has_snap, "sunbucks": self.has_sunbucks,