-
Notifications
You must be signed in to change notification settings - Fork 0
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
[CCAP-651] - applications should only route to active SDAs #1199
Open
analoo
wants to merge
4
commits into
main
Choose a base branch
from
CCAP-651-applications-routing-sda6-bug
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
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 |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
|
||
@Service | ||
public class ApplicationRoutingServiceImpl implements ApplicationRouterService{ | ||
|
||
private final List<String> activeCaseLoadCodes = List.of("BB", "QQ"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Limits resources orgs to those that are included in this list. |
||
private final CCMSDataService ccmsDataService; | ||
|
||
@Autowired | ||
|
@@ -26,9 +26,22 @@ public Optional<ResourceOrganization> getOrganizationIdByZipCode(String zipCode) | |
} | ||
final String truncatedZip = zipCode.substring(0, 5); | ||
Optional<County> countyByZipCode = ccmsDataService.getCountyByZipCode(truncatedZip); | ||
if (countyByZipCode.isPresent()) { | ||
County county = countyByZipCode.get(); | ||
List<ResourceOrganization> resourceOrganizationsByCaseloadCode = ccmsDataService.getResourceOrganizationsByCaseloadCode(county.getCaseloadCode()); | ||
if (countyByZipCode.isPresent() && activeCaseLoadCodes.contains(countyByZipCode.get().getCaseloadCode())) { | ||
List<ResourceOrganization> resourceOrganizationsByCaseloadCode = ccmsDataService.getResourceOrganizationsByCaseloadCode(countyByZipCode.get().getCaseloadCode()); | ||
return resourceOrganizationsByCaseloadCode.stream().filter((r) -> !r.getCaseloadCode().equals("SITE")).findFirst(); | ||
} | ||
return Optional.empty(); | ||
} | ||
|
||
@Override | ||
public Optional<ResourceOrganization> getOrganizationByCountyName(String countyName) { | ||
if(countyName == null || countyName.isBlank()){ | ||
return Optional.empty(); | ||
} | ||
List<County> counties = ccmsDataService.getCountyByCountyName(countyName); | ||
Optional<County> activeCounty = counties.stream().filter((c) -> c != null && activeCaseLoadCodes.contains(c.getCaseloadCode())).findFirst(); | ||
if (activeCounty.isPresent()) { | ||
List<ResourceOrganization> resourceOrganizationsByCaseloadCode = ccmsDataService.getResourceOrganizationsByCaseloadCode(activeCounty.get().getCaseloadCode()); | ||
return resourceOrganizationsByCaseloadCode.stream().filter((r) -> !r.getCaseloadCode().equals("SITE")).findFirst(); | ||
} | ||
return Optional.empty(); | ||
|
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 |
---|---|---|
@@ -1,9 +1,8 @@ | ||
package org.ilgcc.app.data; | ||
|
||
import static org.ilgcc.app.utils.ZipcodeOption.zip_60001; | ||
import static org.ilgcc.app.utils.ZipcodeOption.zip_60115; | ||
import static org.ilgcc.app.utils.ZipcodeOption.zip_60304; | ||
import static org.ilgcc.app.utils.ZipcodeOption.zip_60482; | ||
import static org.ilgcc.app.utils.ZipcodeOption.zip_62863; | ||
|
||
import java.math.BigInteger; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
@@ -16,73 +15,66 @@ | |
@Slf4j | ||
@Profile({"test"}) | ||
public class FakeResourceOrganization implements InitializingBean { | ||
|
||
@Autowired | ||
private ResourceOrganizationRepository resourceOrganizationRepository; | ||
@Autowired | ||
private CountyRepository countyRepository; | ||
public static ResourceOrganization FOUR_C_TEST_DATA; | ||
public static County ACTIVE_FOUR_C_COUNTY; | ||
public static ResourceOrganization PROJECT_CHILD_TEST_DATA; | ||
public static County ACTIVE_PROJECT_CHILD_COUNTY; | ||
public static ResourceOrganization OUT_OF_SCOPE_DATA; | ||
public static County ACTIVE_OUT_OF_SCOPE_COUNTY; | ||
|
||
@Override | ||
public void afterPropertiesSet() { | ||
log.info("Starting creating fake provider data."); | ||
|
||
if (!resourceOrganizationRepository.existsById(new BigInteger("12345678901"))) { | ||
ResourceOrganization org = new ResourceOrganization(); | ||
org.setResourceOrgId(new BigInteger("56522729391679")); | ||
org.setName("4C: Community Coordinated Child Care"); | ||
org.setSda(Short.valueOf("2")); | ||
org.setPhone("123456789"); | ||
org.setEmail("[email protected]"); | ||
org.setCaseloadCode("BB"); | ||
resourceOrganizationRepository.save(org); | ||
} | ||
|
||
if (!resourceOrganizationRepository.existsById(new BigInteger("56522729391679"))) { | ||
ResourceOrganization org = new ResourceOrganization(); | ||
org.setResourceOrgId(new BigInteger("56522729391679")); | ||
org.setName("Project CHILD"); | ||
org.setSda(Short.valueOf("15")); | ||
org.setCaseloadCode("QQ"); | ||
org.setPhone("123456789"); | ||
org.setEmail("[email protected]"); | ||
resourceOrganizationRepository.save(org); | ||
} | ||
|
||
if (!resourceOrganizationRepository.existsById(new BigInteger("47522729391670"))) { | ||
ResourceOrganization org = new ResourceOrganization(); | ||
org.setResourceOrgId(new BigInteger("47522729391670")); | ||
org.setName("Illinois Action for Children"); | ||
org.setSda(Short.valueOf("6")); | ||
org.setCaseloadCode("GG"); | ||
org.setPhone("123456789"); | ||
org.setEmail("[email protected]"); | ||
resourceOrganizationRepository.save(org); | ||
} | ||
FOUR_C_TEST_DATA = new ResourceOrganization(); | ||
FOUR_C_TEST_DATA.setResourceOrgId(new BigInteger("12345678901234")); | ||
FOUR_C_TEST_DATA.setName("4C: Community Coordinated Child Care"); | ||
FOUR_C_TEST_DATA.setSda(Short.valueOf("2")); | ||
FOUR_C_TEST_DATA.setPhone("123456789"); | ||
FOUR_C_TEST_DATA.setEmail("[email protected]"); | ||
FOUR_C_TEST_DATA.setCaseloadCode("BB"); | ||
resourceOrganizationRepository.save(FOUR_C_TEST_DATA); | ||
|
||
if (!countyRepository.existsById(zip_60115.getValue())) { | ||
County county = new County(); | ||
county.setCounty("DeKalb"); | ||
county.setZipCode(new BigInteger(zip_60482.getValue())); | ||
county.setCaseloadCode("GG"); | ||
countyRepository.save(county); | ||
} | ||
ACTIVE_FOUR_C_COUNTY = new County(); | ||
ACTIVE_FOUR_C_COUNTY.setCounty("DeKalb"); | ||
ACTIVE_FOUR_C_COUNTY.setZipCode(new BigInteger(zip_60001.getValue())); | ||
ACTIVE_FOUR_C_COUNTY.setCaseloadCode("BB"); | ||
countyRepository.save(ACTIVE_FOUR_C_COUNTY); | ||
|
||
if (!countyRepository.existsById(zip_60001.getValue())) { | ||
County county = new County(); | ||
county.setCounty("DeKalb"); | ||
county.setZipCode(new BigInteger(zip_60001.getValue())); | ||
county.setCaseloadCode("BB"); | ||
countyRepository.save(county); | ||
} | ||
PROJECT_CHILD_TEST_DATA = new ResourceOrganization(); | ||
PROJECT_CHILD_TEST_DATA.setResourceOrgId(new BigInteger("12345678901235")); | ||
PROJECT_CHILD_TEST_DATA.setName("Project CHILD"); | ||
PROJECT_CHILD_TEST_DATA.setSda(Short.valueOf("15")); | ||
PROJECT_CHILD_TEST_DATA.setCaseloadCode("QQ"); | ||
PROJECT_CHILD_TEST_DATA.setPhone("123456789"); | ||
PROJECT_CHILD_TEST_DATA.setEmail("[email protected]"); | ||
resourceOrganizationRepository.save(PROJECT_CHILD_TEST_DATA); | ||
|
||
if (!countyRepository.existsById(zip_60001.getValue())) { | ||
County county = new County(); | ||
county.setCounty("Cook"); | ||
county.setZipCode(new BigInteger(zip_60304.getValue())); | ||
county.setCaseloadCode("GG"); | ||
countyRepository.save(county); | ||
} | ||
ACTIVE_PROJECT_CHILD_COUNTY = new County(); | ||
ACTIVE_PROJECT_CHILD_COUNTY.setCounty("Ramsey"); | ||
ACTIVE_PROJECT_CHILD_COUNTY.setZipCode(new BigInteger(zip_62863.getValue())); | ||
ACTIVE_PROJECT_CHILD_COUNTY.setCaseloadCode("QQ"); | ||
countyRepository.save(ACTIVE_PROJECT_CHILD_COUNTY); | ||
|
||
OUT_OF_SCOPE_DATA = new ResourceOrganization(); | ||
OUT_OF_SCOPE_DATA.setResourceOrgId(new BigInteger("12345678901236")); | ||
OUT_OF_SCOPE_DATA.setName("Illinois Action for Children"); | ||
OUT_OF_SCOPE_DATA.setSda(Short.valueOf("6")); | ||
OUT_OF_SCOPE_DATA.setCaseloadCode("GG"); | ||
OUT_OF_SCOPE_DATA.setPhone("123456789"); | ||
OUT_OF_SCOPE_DATA.setEmail("[email protected]"); | ||
resourceOrganizationRepository.save(OUT_OF_SCOPE_DATA); | ||
|
||
ACTIVE_OUT_OF_SCOPE_COUNTY = new County(); | ||
ACTIVE_OUT_OF_SCOPE_COUNTY.setCounty("Chicago"); | ||
ACTIVE_OUT_OF_SCOPE_COUNTY.setZipCode(new BigInteger(zip_60482.getValue())); | ||
ACTIVE_OUT_OF_SCOPE_COUNTY.setCaseloadCode("GG"); | ||
countyRepository.save(ACTIVE_OUT_OF_SCOPE_COUNTY); | ||
|
||
|
||
} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only saves county from home zip code address