Urgent Needs - Gary-Community-Ventures/benefits-api GitHub Wiki
Urgent Needs
A secondary list of resources on the results page. These "urgent needs" are meant to support the more immediate needs of the user. Urgent needs do not have values, and should not have many eligibility requirements (because they should have no/a quicker application proccess), as they are meant to be a quick way for users meet a need. An example urgent need would be a food pantry because it helps the user solve the immediate need food.
Admin
The Admin allows non developers to edit urgent need information (like name and description) without the help of a developer.
Creating an urgent need
- Go to the "Translation Admin".
- Go to "Urgent Needs".
- Click "Add New".
- Enter a "Label" (just a string to identify the urgent need) and optional "Phone number".
-
Add all of the text for the urgent need by clicking the links, and replacing the placeholder text with the desired text.
- Translation documentation
- Documentation for each field can be found in the Translation admin section.
-
Click "Edit in Main Admin"
- Update the fields
- Documentation for each field can be found in the Main Admin section.
Updating an urgent need
Translation admin
To edit any of the text in the translation admin:
- Go to the "Translation Admin".
- Go to "Urgent Needs".
- Search the name of the urgent need.
- Select "Go to".
- Select the field to update.
The translations can also be accessed through the main admin by clicking on the hamburger menu in the "Translate" column
Main Admin
- Go to "Urgent Needs".
- Search the name of the urgent need.
- Click on the name.
- Update the fields.
What things mean
Translation admin
The following translated text can be edited in the translation admin:
- Name: The name that is displayed to the user
- Description: The description that is displayed to the user
- Link: The link to the urgent need website
- Type: The category that the urgent need goes in. If multiple urgent needs have the same type, they will be grouped. The type is also used to select the icon
- Warning: Deprecated
- Website Description: The description on the page that lists all of the MFB benefits
Main admin
- White label: The white label to show this urgent need in
- External name: Syncs urgent needs across environments
- Phone number: An optional phone number for the urgent need
- Type short: The needs on step-9 to show this benefit for
- Active: Only active urgent needs are showed to the user
- Low confidence: Display a flag to the user that reads "Low Confidence"
- Functions: The calculators that are used to determine if the urgent need should be shown
Development
A base class is provided to determine if an urgent need should be shown.
Custom Rules
Add a new class
in /programs/programs/urgent_needs/urgent_need_functions.py that inherits from the UrgentNeedFunction
class.
The following methods and attributes can be overridden:
eligible
: Returns if the urgent need should be shown to the user.dependencies
(attribute): A list of fields needed so that the urgent need does not through an error when run. If the screen is missing one of these fields, then the urgent need will be skipped. Syntax:- Screen and HouseholdMember fields: {field}
- IncomeStream fields: income_{field}
- Expense fields: expense_{field}
Add the new urgent need class to the urgent_need_functions
at the bottom of the file. The key is matched to the functions
of the urgent need
Brief technical overview
- The urgent need functions are located in /programs/programs/urgent_needs/urgent_need_functions.py
- The urgent need functions are used in
urgent_need_results
to return the API response for the results page. - How urgent needs are imported/exported is controlled by the
UrgentNeedDataController