Skip to content

Commit

Permalink
Implement household sensitive questions flow (#348)
Browse files Browse the repository at this point in the history
* basic implementation of screens

* before save action cleans up data

* tests :)

* just cleaned up code a bit and made names more intuitive

---------

Co-authored-by: Ana Medrano Fernandez <amedrano@codeforamerica.org@Anas-MacBook-Pro-2.local>
  • Loading branch information
analoo and Ana Medrano Fernandez authored Oct 12, 2023
1 parent 26c3d25 commit 54d5cbd
Show file tree
Hide file tree
Showing 13 changed files with 257 additions and 94 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,26 @@ public class LaDigitalAssister extends FlowInputs {
private String householdSearchingForJob;

private String jobSearch;


// Sensitive Questions
private String householdHasPersonalSituations;

private String personalSituationsHouseholdUUID;

private List<String> personalSituationsListed;

private String householdHasDomesticViolenceSituation;

private String householdHasCriminalJusticeSituation;

private String personalSituationHomelessSwitch;

private String personalSituationOtherIssue;

private String personalSituationStrugglingDrugsAlcohol;

private String personalSituationDomesticViolenceFlag;

private String personalSituationDisability;
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package org.ladocuploader.app.submission.actions;

import formflow.library.config.submission.Action;
import formflow.library.data.Submission;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
*
*/
@Component
@Slf4j
public class ReformatPersonalSituationUserData implements Action {

@Override
public void run(Submission submission) {
Map<String, Object> inputData = submission.getInputData();

submission.getInputData().put("affectedByPersonalSituations[]", reformatPersonalSituations(inputData));
}

private ArrayList<LinkedHashMap> reformatPersonalSituations(Map<String, Object> inputData) {
ArrayList<LinkedHashMap> householdMembers = (ArrayList) inputData.get("household");
ArrayList<String> hasPersonalSituations = (ArrayList) inputData.get("personalSituationsHouseholdUUID[]");
ArrayList<LinkedHashMap> personalSituationsObject = new ArrayList<>();

hasPersonalSituations.forEach((String id) -> {
LinkedHashMap user = new LinkedHashMap();
if (id.equals("you")) {
user.put("uuid", id);
user.put("firstName", inputData.get("firstName") + " (you)");
user.put("lastName", inputData.get("lastName"));
personalSituationsObject.add(user);
} else {
personalSituationsObject.add(householdData(householdMembers, id));
}
}
);

return personalSituationsObject;

}

private LinkedHashMap householdData(ArrayList<LinkedHashMap> household, String uuid) {
LinkedHashMap user = new LinkedHashMap();
for (LinkedHashMap hhmember : household) {
if (hhmember.get("uuid").equals(uuid)) {
user.put("uuid", uuid);
user.put("firstName", hhmember.get("householdMemberFirstName"));
user.put("lastName", hhmember.get("householdMemberLastName"));
continue;
}
}

return user;
};

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package org.ladocuploader.app.submission.conditions;

import formflow.library.config.submission.Condition;
import formflow.library.data.Submission;
import org.springframework.stereotype.Component;

@Component
public class HouseholdHasPersonalSituations implements Condition {
@Override
public Boolean run(Submission submission) {
var inputData = submission.getInputData();
if (inputData.containsKey("householdHasPersonalSituations")) {
return submission.getInputData().get("householdHasPersonalSituations").equals("true");
}
return false;
}
}
6 changes: 3 additions & 3 deletions src/main/resources/flows-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,13 @@ flow:
householdPersonalSituations:
nextScreens:
- name: householdPersonalSituationsWho
condition: HouseholdHasPersonalSituations
- name: householdVictimOfDomesticViolence
householdPersonalSituationsWho:
beforeSaveAction: ReformatPersonalSituationUserData
nextScreens:
- name: householdWhichPersonalSituations
householdWhichPersonalSituations:
nextScreens:
- name: householdMoreInfoPersonalSituations
householdMoreInfoPersonalSituations:
nextScreens:
- name: householdVictimOfDomesticViolence
householdVictimOfDomesticViolence:
Expand Down
49 changes: 43 additions & 6 deletions src/main/resources/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -383,11 +383,6 @@ phone-number-nudge.skip-phone-number=Continue without it

# Shared Household Messages

#Sensitive Questions
sensitive-questions.title=Sensitive Questions
sensitive-questions.header=Next, we have questions about situations that make it hard to work.
sensitive-questions.subheader=We're sorry that we're asking about these sensitive subjects. Sharing information about any barriers to working will give you the best chance of getting benefits.

# Multiple person household
multiple-person-household.title=Multiple person household
multiple-person-household.header=Do you live with any of these people?
Expand Down Expand Up @@ -554,7 +549,6 @@ foster-aged-out.header=Was anyone in foster care until they turned 18?
foster-aged-out-who.title=Foster aged out who
foster-aged-out-who.header=Who was in foster care until they turned 18?


# Homelessness
homeless.title=Homeless
homeless.header=Is anyone in your household currently experiencing homelessness?
Expand All @@ -578,3 +572,46 @@ job-search.header=Is anyone in your household currently looking for a job?
job-search-who.title = Job search who
job-search-who.header=Who in your household is looking for a job?

# Phone number nudge
phone-number-nudge.title=Phone number nudge
phone-number-nudge.header=Are you sure you don't want to provide your phone number?
phone-number-nudge.p1=A caseworker may need to contact you by phone about your application. If you don't have a phone number, you can enter a friend or family member's phone number instead.
phone-number-nudge.add-phone-number=Add a phone number
phone-number-nudge.skip-phone-number=Continue without it

#Sensitive Questions
sensitive-questions.title=Sensitive Questions
sensitive-questions.header=Next, we have questions about situations that make it hard to work.
sensitive-questions.subheader=We're sorry that we're asking about these sensitive subjects. Sharing information about any barriers to working will give you the best chance of getting benefits.
personal-situations.title=Personal Situations
personal-situations.header=Do any of these personal situations that make it hard to work apply to anyone in your household?
personal-situations.subheader=This could be something that keeps them from working at all, or limits the amount they can work.
personal-situations.content.l1=Being homeless
personal-situations.content.l2=Struggling with drugs or alcohol
personal-situations.content.l3=Experiencing domestic abuse
personal-situations.content.l4=A physical, mental, or other personal issue or disability

personal-situations-who.title=Personal Situations Who
personal-situations-who.header=Who has a personal situation that makes it hard to work?

personal-situations-which.title=Which Personal Situations
personal-situations-which.subheader=Which personal situations apply to {0}?
personal-situations.which.option1=Being homeless
personal-situations.which.option2=Struggling with drugs or alcohol
personal-situations.which.option3=Experiencing domestic abuses
personal-situations.which.option4=A physical, mental, or other personal issue or disability
personal-situations.which.option5=Other reason

domestic-violence.title=Domestic Violence Victim
domestic-violence.header=Does anyone in your household need to get away from an abusive situation?
domestic-violence.subheader=If you are a victim of domestic violence or fear for your safety, call the Louisiana Domestic Violence hotline at 1-888-411-1333 for free, confidential 24-hour assistance.

criminal-justice-warning.title=Criminal Justice Involvement Warning
criminal-justice-warning.header=Next, we have questions about involvement with the criminal justice system.
criminal-justice-warning.subheader=We're sorry to ask about these sensitive subjects. This information is required to help determine eligibility for benefits.

criminal-justice.title=Criminal Justice
criminal-justice.header=Do any of these situations apply to anyone in your household?
criminal-justice-content.l1=Have been convicted of breaking rules for SNAP, cash aid, or SSI programs
criminal-justice-content.l2=Have been convicted of a felony
criminal-justice-content.l3=Currently on probation or parole
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
<!DOCTYPE html>
<html th:lang="${#locale.language}">
<head th:replace="~{fragments/head :: head(title='Scaffold')}"></head>
<head th:replace="~{fragments/head :: head(title=#{criminal-justice.title})}"></head>
<body>
<div class="page-wrapper">
<div th:replace="~{fragments/toolbar :: toolbar}"></div>
<section class="slab">
<div class="grid">
<div th:replace="~{fragments/goBack :: goBackLink}"></div>
<main id="content" role="main" class="form-card spacing-above-35">
<!-- <th:block-->
<!-- th:replace="~{'fragments/cardHeader' :: cardHeader(header=#{}, subtext=#{})}"/>-->
<th:block th:replace="~{'fragments/form' :: form(action=${formAction}, content=~{::formContent})}">
<th:block th:ref="formContent">
<th:block th:replace="~{fragments/icons :: personMilestone}"></th:block>
<th:block
th:replace="~{'fragments/cardHeader' :: cardHeader(header=#{criminal-justice.header})}"/>
<th:block th:replace="~{'fragments/form' :: form(action=${formAction}, content=~{::criminalJusticeSituation})}">
<th:block th:ref="criminalJusticeSituation">
<div class="form-card__content">

<ul class="list--bulleted">
<li th:utext="#{criminal-justice-content.l1}"></li>
<li th:utext="#{criminal-justice-content.l2}"></li>
<li th:utext="#{criminal-justice-content.l3}"></li>
</ul>
</div>
<div class="form-card__footer">

<th:block th:replace="~{fragments/inputs/yesOrNo :: yesOrNo(
inputName='householdHasCriminalJusticeSituation',
ariaDescribe=#{criminal-justice.header})}"/>
</div>
</th:block>
</th:block>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
<!DOCTYPE html>
<html th:lang="${#locale.language}">
<head th:replace="~{fragments/head :: head(title='Household Personal Situations')}"></head>
<head th:replace="~{fragments/head :: head(title=#{personal-situations.title})}"></head>
<body>
<div class="page-wrapper">
<div th:replace="~{fragments/toolbar :: toolbar}"></div>
<section class="slab">
<div class="grid">
<div th:replace="~{fragments/goBack :: goBackLink}"></div>
<main id="content" role="main" class="form-card spacing-above-35">
<!-- <th:block-->
<!-- th:replace="~{'fragments/cardHeader' :: cardHeader(header=#{}, subtext=#{})}"/>-->
<th:block th:replace="~{'fragments/form' :: form(action=${formAction}, content=~{::formContent})}">
<th:block th:ref="formContent">
<th:block th:replace="~{fragments/icons :: briefcase}"></th:block>
<th:block
th:replace="~{fragments/cardHeader :: cardHeader(header=#{personal-situations.header}, subtext=#{personal-situations.subheader})}"/>
<th:block th:replace="~{'fragments/form' :: form(action=${formAction}, content=~{::householdPersonalSituations})}">
<th:block th:ref="householdPersonalSituations">
<div class="form-card__content">

<ul class="list--bulleted">
<li th:utext="#{personal-situations.content.l1}"></li>
<li th:utext="#{personal-situations.content.l2}"></li>
<li th:utext="#{personal-situations.content.l3}"></li>
<li th:utext="#{personal-situations.content.l4}"></li>
</ul>
</div>
<div class="form-card__footer">

<th:block th:replace="~{fragments/inputs/yesOrNo :: yesOrNo(
inputName='householdHasPersonalSituations',
ariaDescribe=#{personal-situations.header})}"/>
</div>
</th:block>
</th:block>
Expand All @@ -26,4 +34,4 @@
</div>
<th:block th:replace="~{fragments/footer :: footer}" />
</body>
</html>
</html>
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
<!DOCTYPE html>
<html th:lang="${#locale.language}">
<head th:replace="~{fragments/head :: head(title='Scaffold')}"></head>
<head th:replace="~{fragments/head :: head(title=#{personal-situations-who.title})}"></head>
<body>
<div class="page-wrapper">
<div th:replace="~{fragments/toolbar :: toolbar}"></div>
<section class="slab">
<div class="grid">
<div th:replace="~{fragments/goBack :: goBackLink}"></div>
<main id="content" role="main" class="form-card spacing-above-35">
<!-- <th:block-->
<!-- th:replace="~{'fragments/cardHeader' :: cardHeader(header=#{}, subtext=#{})}"/>-->
<th:block th:replace="~{'fragments/form' :: form(action=${formAction}, content=~{::formContent})}">
<th:block th:ref="formContent">
<th:block th:replace="~{fragments/icons :: briefcase}"></th:block>
<th:block
th:replace="~{'fragments/cardHeader' :: cardHeader(header=#{personal-situations-who.header})}"/>
<th:block th:replace="~{fragments/form :: form(action=${formAction}, content=~{::formContents})}">
<th:block th:ref="formContents">
<div class="form-card__content">

<th:block th:replace="~{'fragments/inputs/householdCheckboxFieldset' ::
householdCheckboxFieldset(inputName='personalSituationsHouseholdUUID')}"/>
</div>
<div class="form-card__footer">

<th:block th:replace="~{fragments/inputs/submitButton :: submitButton(
text=#{general.inputs.continue})}"/>
</div>
</th:block>
</th:block>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
<!DOCTYPE html>
<html th:lang="${#locale.language}">
<head th:replace="~{fragments/head :: head(title='Scaffold')}"></head>
<head th:replace="~{fragments/head :: head(title=#{criminal-justice-warning.title})}"></head>
<body>
<div class="page-wrapper">
<div th:replace="~{fragments/toolbar :: toolbar}"></div>
<section class="slab">
<div class="grid">
<div th:replace="~{fragments/goBack :: goBackLink}"></div>
<main id="content" role="main" class="form-card spacing-above-35">
<!-- <th:block-->
<!-- th:replace="~{'fragments/cardHeader' :: cardHeader(header=#{}, subtext=#{})}"/>-->
<th:block th:replace="~{'fragments/form' :: form(action=${formAction}, content=~{::formContent})}">
<th:block th:ref="formContent">
<div class="form-card__content">

</div>
<div class="form-card__footer">

</div>
</th:block>
</th:block>
<th:block
th:replace="~{'fragments/cardHeader' :: cardHeader(header=#{criminal-justice-warning.header}, subtext=#{criminal-justice-warning.subheader})}"/>
<div class="form-card__footer spacing-below-35">
<th:block th:replace="~{fragments/continueButton :: continue}"/>
</div>
</main>
</div>
</section>
Expand Down
Loading

0 comments on commit 54d5cbd

Please sign in to comment.