generated from codeforamerica/form-flow-starter-app
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into implement-household-sensitive-questions-flow
- Loading branch information
Showing
32 changed files
with
1,069 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/main/java/org/ladocuploader/app/submission/conditions/AllUsCitizens.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/org/ladocuploader/app/submission/conditions/FostersAgedOut.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/org/ladocuploader/app/submission/conditions/HouseholdJobSearch.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/org/ladocuploader/app/submission/conditions/IsFosterPerson.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/org/ladocuploader/app/submission/conditions/IsHomeless.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/org/ladocuploader/app/submission/conditions/IsVeteran.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/org/ladocuploader/app/submission/conditions/PreparesFoodTogether.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.