Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds PDF preparer code for race and ethnicity #492

Merged
merged 6 commits into from
Jan 8, 2024

Conversation

bseeger
Copy link
Contributor

@bseeger bseeger commented Jan 3, 2024

Note that the race and ethnicity for the applicant are covered via mapping in the pdf-map.yml file. I didn't have to do anything explicitly for those except to tweak the mapping a little.

The mapping for household member's got tucked into the household details preparer.

@sree-cfa sree-cfa temporarily deployed to test-la-doc-uploader-pr-492 January 3, 2024 20:57 Inactive
@sree-cfa sree-cfa temporarily deployed to test-la-doc-uploader-pr-492 January 3, 2024 20:59 Inactive
@sree-cfa sree-cfa temporarily deployed to test-la-doc-uploader-pr-492 January 3, 2024 22:23 Inactive
@sree-cfa sree-cfa temporarily deployed to test-la-doc-uploader-pr-492 January 4, 2024 16:25 Inactive
@bseeger bseeger force-pushed the pdf_preparer_race_ethnicity branch from 0655517 to b303507 Compare January 4, 2024 16:26
@bseeger bseeger marked this pull request as ready for review January 4, 2024 16:26
@sree-cfa sree-cfa temporarily deployed to test-la-doc-uploader-pr-492 January 4, 2024 16:26 Inactive
@bseeger bseeger added the ready for review This PR is ready for code-review label Jan 4, 2024
@@ -45,6 +50,23 @@ public Map<String, SubmissionField> prepareSubmissionFields(Submission submissio

var uuid = householdMember.get("uuid");
results.put("householdUSCitizen" + i, new SingleField("householdUSCitizenDerived", nonCitizens != null && nonCitizens.contains(uuid) ? "No" : "Yes", i + 1));

List<String> raceInput = (List)submission.getInputData().get(RACE_PREFIX + uuid + "[]");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bseeger we have a field called "permissionToAskAboutRace" that determines whether the race questions were asked. If it's false then we wouldn't have displayed the race and ethnicity questions to the form filler.

Maybe there is a benefit to using that here to exit out of the process sooner.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding in this logic. Thanks for pointing that out, @analoo.

if (ethnicityInput != null && !ethnicityInput.isEmpty()) {
raceEthnicCode += "/" + EthnicityType.getAbbreviationFromValue(ethnicityInput);
}
results.put("householdRaceEthnicCode" + i, new SingleField("householdRaceEthnicCode", raceEthnicCode, i+1));
}
}
return results;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is more for me: curious about whether it makes sense to make each of these inout checks into a method separate from the main method. Just noticing that it's getting pretty big. I could also see a good reason to split it out into methods for testing purposes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did refactor the code a little here.

src/main/resources/pdf-map.yaml Outdated Show resolved Hide resolved
Copy link
Contributor

@analoo analoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - comments are things that I am curious about.

Copy link
Contributor

@sree-cfa sree-cfa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also LGTM - thanks for all the cleanup

@bseeger bseeger force-pushed the pdf_preparer_race_ethnicity branch from fdc6490 to 020abde Compare January 8, 2024 18:32
@sree-cfa sree-cfa temporarily deployed to test-la-doc-uploader-pr-492 January 8, 2024 18:32 Inactive
@sree-cfa sree-cfa temporarily deployed to test-la-doc-uploader-pr-492 January 8, 2024 22:29 Inactive
@bseeger bseeger merged commit 36a95e4 into main Jan 8, 2024
5 checks passed
@bseeger bseeger deleted the pdf_preparer_race_ethnicity branch January 8, 2024 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for review This PR is ready for code-review
Projects
None yet
3 participants