use of gov.cms.ab2d.worker.config.ContractToContractCoverageMapping in project ab2d by CMSgov.
the class CoverageDriverTest method before.
@BeforeEach
void before() {
mapping = new ContractToContractCoverageMapping();
// Set properties values in database
addPropertiesTableValues();
contract = dataSetup.setupContract("TST-12", AB2D_EPOCH.toOffsetDateTime());
contract1 = dataSetup.setupContract("TST-45", AB2D_EPOCH.toOffsetDateTime());
contractForCoverageDTO = new ContractForCoverageDTO("TST-12", AB2D_EPOCH.toOffsetDateTime(), ContractForCoverageDTO.ContractType.NORMAL);
contractForCoverageDTO1 = new ContractForCoverageDTO("TST-45", AB2D_EPOCH.toOffsetDateTime(), ContractForCoverageDTO.ContractType.NORMAL);
contractRepo.saveAndFlush(contract);
january = coverageDataSetup.createCoveragePeriod(contract.getContractNumber(), 1, 2020);
february = coverageDataSetup.createCoveragePeriod(contract.getContractNumber(), 2, 2020);
march = coverageDataSetup.createCoveragePeriod(contract.getContractNumber(), 3, 2020);
PdpClientDTO contractPdpClient = createClient(contract, "TST-12", SPONSOR_ROLE);
pdpClientService.createClient(contractPdpClient);
dataSetup.queueForCleanup(pdpClientService.getClientById("TST-12"));
PdpClient pdpClient = dataSetup.setupPdpClient(List.of());
job = new Job();
job.setContractNumber(contract.getContractNumber());
job.setJobUuid("unique");
job.setOrganization(pdpClient.getOrganization());
job.setStatus(gov.cms.ab2d.common.model.JobStatus.SUBMITTED);
job.setCreatedAt(OffsetDateTime.now());
job.setFhirVersion(STU3);
jobRepo.saveAndFlush(job);
dataSetup.queueForCleanup(job);
bfdClient = mock(BFDClient.class);
ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
taskExecutor.setMaxPoolSize(6);
taskExecutor.setCorePoolSize(3);
taskExecutor.initialize();
processor = new CoverageProcessorImpl(coverageService, bfdClient, taskExecutor, MAX_ATTEMPTS, contractWorkerClient);
driver = new CoverageDriverImpl(coverageSearchRepo, pdpClientService, coverageService, propertiesService, processor, searchLock, contractToContractCoverageMapping);
}
use of gov.cms.ab2d.worker.config.ContractToContractCoverageMapping in project ab2d by CMSgov.
the class CoverageMappingCallableTest method testTestContractYears.
@DisplayName("Test to see if it returns the correct year for test contracts")
@Test
void testTestContractYears() {
ContractDTO contract = new ContractDTO("TESTING", "TESTING", OffsetDateTime.now(), Contract.ContractType.CLASSIC_TEST);
CoveragePeriod period = new CoveragePeriod();
period.setContractNumber(contract.getContractNumber());
period.setYear(2020);
period.setMonth(1);
CoverageSearchEvent cse = new CoverageSearchEvent();
cse.setCoveragePeriod(period);
CoverageSearch search = new CoverageSearch();
search.setPeriod(period);
// First test that the corrected year modification works
CoverageMapping mapping = new CoverageMapping(cse, search);
ContractToContractCoverageMapping contractToContractCoverageMapping = new ContractToContractCoverageMapping();
ContractForCoverageDTO contractForCoverageDTO = contractToContractCoverageMapping.map(contract);
CoverageMappingCallable callable = new CoverageMappingCallable(STU3, mapping, bfdClient, mapping.getPeriod().getYear());
assertEquals(3, contractForCoverageDTO.getCorrectedYear(2020));
// Test that the corrected year modification is not applied to Synthea
contractForCoverageDTO.setContractType(ContractForCoverageDTO.ContractType.SYNTHEA);
assertEquals(2020, contractForCoverageDTO.getCorrectedYear(2020));
}
use of gov.cms.ab2d.worker.config.ContractToContractCoverageMapping in project ab2d by CMSgov.
the class ContractProcessorUnitTest method setUp.
@BeforeEach
void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
patientClaimsProcessor = spy(PatientClaimsProcessorStub.class);
mapping = new ContractToContractCoverageMapping();
contract = createContractDTO();
contractForCoverageDTO = mapping.map(contract);
PdpClient pdpClient = createClient();
job = createJob(pdpClient);
job.setContractNumber(contract.getContractNumber());
jobRepository = new StubJobRepository(job);
JobProgressServiceImpl jobProgressImpl = new JobProgressServiceImpl(jobRepository);
jobProgressImpl.initJob(jobUuid);
ReflectionTestUtils.setField(jobProgressImpl, "reportProgressDbFrequency", 2);
ReflectionTestUtils.setField(jobProgressImpl, "reportProgressLogFrequency", 3);
jobChannelService = new JobChannelStubServiceImpl(jobProgressImpl);
ThreadPoolTaskExecutor pool = new ThreadPoolTaskExecutor();
pool.initialize();
SearchConfig searchConfig = new SearchConfig(efsMountTmpDir.toFile().getAbsolutePath(), STREAMING, FINISHED, 0, 0, 2, 1);
ContractWorkerClient contractWorkerClient = new ContractWorkerClientMock();
cut = new ContractProcessorImpl(contractWorkerClient, jobRepository, coverageDriver, patientClaimsProcessor, eventLogger, requestQueue, jobChannelService, jobProgressImpl, mapping, pool, searchConfig);
// ReflectionTestUtils.setField(cut, "numberPatientRequestsPerThread", 2);
var outputDirPath = Paths.get(efsMountTmpDir.toString(), jobUuid);
Files.createDirectories(outputDirPath);
}
use of gov.cms.ab2d.worker.config.ContractToContractCoverageMapping in project ab2d by CMSgov.
the class CoveragePeriodsPresentCheck method test.
@Override
public boolean test(ContractDTO contract) {
ContractToContractCoverageMapping mapping = new ContractToContractCoverageMapping();
List<String> missingPeriods = listMissingCoveragePeriods(this.coverageService, mapping.map(contract));
this.issues.addAll(missingPeriods);
return missingPeriods.isEmpty();
}
use of gov.cms.ab2d.worker.config.ContractToContractCoverageMapping in project ab2d by CMSgov.
the class CoveragePresentCheck method listCoveragePeriodsMissingEnrollment.
private List<String> listCoveragePeriodsMissingEnrollment(ContractDTO contract, List<CoverageCount> coverageCounts) {
List<String> noEnrollment = new ArrayList<>();
ZonedDateTime now = getEndDateTime().minusMonths(1);
ZonedDateTime attestationTime = getAttestationTime(new ContractToContractCoverageMapping().map(contract));
ListIterator<CoverageCount> countIterator = coverageCounts.listIterator();
while (attestationTime.isBefore(now)) {
int year = attestationTime.getYear();
int month = attestationTime.getMonthValue();
// If nothing in the iterator
if (!countIterator.hasNext()) {
logIssue(contract, year, month, noEnrollment);
// If something in iterator make sure it matches expected
} else {
CoverageCount coverageCount = countIterator.next();
if (year != coverageCount.getYear() || month != coverageCount.getMonth()) {
countIterator.previous();
logIssue(contract, year, month, noEnrollment);
}
}
attestationTime = attestationTime.plusMonths(1);
}
return noEnrollment;
}
Aggregations