Skip to content

Commit

Permalink
Merge branch 'main' into implement-household-sensitive-questions-flow
Browse files Browse the repository at this point in the history
  • Loading branch information
analoo authored Oct 12, 2023
2 parents e05d290 + 26c3d25 commit cab44a5
Show file tree
Hide file tree
Showing 32 changed files with 1,069 additions and 100 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ dependencies {
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
testImplementation 'org.apache.httpcomponents.client5:httpclient5:5.2.1'
testImplementation 'org.seleniumhq.selenium:selenium-java:4.13.0'
testImplementation 'org.seleniumhq.selenium:selenium-java:4.14.0'
testImplementation 'io.percy:percy-java-selenium:2.0.1'
testImplementation 'org.awaitility:awaitility'
testImplementation 'io.github.bonigarcia:webdrivermanager:5.5.3'
Expand Down
482 changes: 482 additions & 0 deletions messages_full.properties

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions scripts/generate-message-properties.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
csvFile="${1:-"/Users/lkemperman/Desktop/digital-assister-all-designs-phase-1-multi-person-snap-only-leave-comments-here.csv"}"
outfileFilepath="${2:-messages_temp_3.properties}"
declare -A fieldMappings
declare -A pageTitles

preprocess_input () {
columnValue=$1
processedInput=${columnValue// /}
echo $processedInput | sed -e 's/ */ /g' | tr A-Z a-z
}

while IFS="," read -r id frame group layer_name figma_text

# TODO: handle special characters
# TODO: make the field names generic for duplicates

do
propertyName="$(preprocess_input $frame)"
title=$( echo "${propertyName}.title" | tr -d '"')
pageTitles+=( [$title]=${frame} )
groupName="$(preprocess_input $group)"
fieldName=$( echo $propertyName.$groupName | tr -d '"')
if [ -z "$groupName" ] || [ -z "$figma_text" ]; then
continue
fi
if [[ ${!fieldMappings[@]} =~ $fieldName ]]
then
((fieldMappings["${fieldName}"]++))
else
fieldMappings+=( ["${fieldName}"]=0 )
fi
echo "${fieldName}${fieldMappings[$fieldName]}=${figma_text}" | tr -d "0" | tr -d '"' >> $outfileFilepath
done < <(sort -u -t, -k5,5 $csvFile) # this removes duplicate figma text
# adds page titles
for title in "${!pageTitles[@]}"; do
echo "${title} = ${pageTitles["${title}"]}" >> $outfileFilepath
done
1 change: 1 addition & 0 deletions scripts/scaffold.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

</div>
<div class="form-card__footer">
<th:block th:replace="~{fragments/continueButton :: continue}" />

</div>
</th:block>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,26 +61,73 @@ public class LaDigitalAssister extends FlowInputs {

private String homeAddressStreetAddress1;

private String mailingAddressZipCode;

private String mailingAddressState;

private String mailingAddressCity;

private String mailingAddressStreetAddress2;

private String mailingAddressStreetAddress1;

private String goingToSchool;

private String isPregnant;

private String receivedOutOfStateBenefits;

private String buyPrepareMealsSeparateIndicator;

private String preparesFood;

private String migrantOrSeasonalFarmWorkerInd;

private String citizenshipInd;

// Sensitive Questions
private String nonCitizens;

private String citizenshipNumber;

private String fosterInd;

private String fosters;

private String fosterAgedOutInd;

private String fostersAgedOut;

private String veteranInd;

private String veterans;

private String homelessInd;

private String homeless;

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,12 @@
package org.ladocuploader.app.submission.conditions;

import formflow.library.data.Submission;
import org.springframework.stereotype.Component;

@Component
public class AllUsCitizens extends BasicCondition {
@Override
public Boolean run(Submission submission) {
return run(submission, "citizenshipInd", "true");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.ladocuploader.app.submission.conditions;

import formflow.library.data.Submission;
import org.springframework.stereotype.Component;

@Component
public class FostersAgedOut extends BasicCondition {

@Override
public Boolean run(Submission submission) {
return run(submission, "fosterAgedOutInd", "true");
}
}
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 HouseholdJobSearch implements Condition {
@Override
public Boolean run(Submission submission) {
var inputData = submission.getInputData();
if (inputData.containsKey("householdSearchingForJob")) {
return submission.getInputData().get("householdSearchingForJob").equals("true");
}
return false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.ladocuploader.app.submission.conditions;

import formflow.library.data.Submission;
import org.springframework.stereotype.Component;

@Component
public class IsFosterPerson extends BasicCondition {
@Override
public Boolean run(Submission submission) {
return run(submission, "fosterInd", "true");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.ladocuploader.app.submission.conditions;

import formflow.library.data.Submission;
import org.springframework.stereotype.Component;

@Component
public class IsHomeless extends BasicCondition {

@Override
public Boolean run(Submission submission) {
return run(submission, "homelessInd", "true");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.ladocuploader.app.submission.conditions;

import formflow.library.data.Submission;
import org.springframework.stereotype.Component;

@Component
public class IsVeteran extends BasicCondition {
@Override
public Boolean run(Submission submission) {
return run(submission, "veteranInd", "true");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.ladocuploader.app.submission.conditions;

import formflow.library.data.Submission;
import org.springframework.stereotype.Component;

@Component
public class PreparesFoodTogether extends BasicCondition {
@Override
public Boolean run(Submission submission) {
return run(submission, "buyPrepareMealsSeparateIndicator", "true");
}
}
20 changes: 20 additions & 0 deletions src/main/resources/flows-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ flow:
- name: householdPrepareFood
householdPrepareFood:
nextScreens:
- name: householdSeasonalFarmWorker
condition: PreparesFoodTogether
- name: householdPrepareFoodWho
householdPrepareFoodWho:
nextScreens:
Expand All @@ -127,6 +129,8 @@ flow:
- name: householdCitizenship
householdCitizenship:
nextScreens:
- name: householdVeteran
condition: AllUsCitizens
- name: householdNonCitizenWho
householdNonCitizenWho:
nextScreens:
Expand All @@ -137,19 +141,33 @@ flow:
householdVeteran:
nextScreens:
- name: householdVeteranWho
condition: IsVeteran
- name: householdFoster
householdVeteranWho:
nextScreens:
- name: householdFoster
householdFoster:
nextScreens:
- name: householdFosterWho
condition: IsFosterPerson
- name: householdFosterAgedOut
householdFosterWho:
nextScreens:
- name: householdFosterAgedOut
householdFosterAgedOut:
nextScreens:
- name: householdFosterAgedOutWho
condition: FostersAgedOut
- name: householdRoomRental
householdFosterAgedOutWho:
nextScreens:
- name: householdHomeless
householdHomeless:
nextScreens:
- name: householdHomelessnessWho
condition: IsHomeless
- name: householdRoomRental
householdHomelessnessWho:
nextScreens:
- name: householdRoomRental
householdRoomRental:
Expand Down Expand Up @@ -194,6 +212,8 @@ flow:
householdJobSearch:
nextScreens:
- name: householdJobSearchWho
condition: HouseholdJobSearch
- name: householdWorkDisqualifications
householdJobSearchWho:
nextScreens:
- name: householdWorkDisqualifications
Expand Down
Loading

0 comments on commit cab44a5

Please sign in to comment.