use of org.hl7.fhir.dstu3.model.Contract in project ab2d by CMSgov.
the class CoverageMappingCallableTest method testNullMbi.
@Test
void testNullMbi() {
ContractDTO contract = new ContractDTO("TESTING", "TESTING", null, null);
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);
CoverageMapping mapping = new CoverageMapping(cse, search);
CoverageMappingCallable callable = new CoverageMappingCallable(STU3, mapping, bfdClient, mapping.getPeriod().getYear());
Patient patient = new Patient();
Identifiers ids = callable.extractPatientId(patient);
assertNull(ids);
Identifier beneId = new Identifier();
beneId.setSystem(BENEFICIARY_ID);
beneId.setValue("1");
patient.getIdentifier().add(beneId);
ids = callable.extractPatientId(patient);
assertEquals(1L, ids.getBeneficiaryId());
assertNull(ids.getCurrentMbi());
assertEquals(0, ids.getHistoricMbis().size());
Identifier mbiHist = new Identifier();
mbiHist.setSystem(MBI_ID);
mbiHist.setValue("HIST_MBI");
Extension extension = new Extension();
extension.setUrl(CURRENCY_IDENTIFIER);
Coding code1 = new Coding();
code1.setCode("historic");
extension.setValue(code1);
mbiHist.getExtension().add(extension);
patient.getIdentifier().add(mbiHist);
ids = callable.extractPatientId(patient);
assertEquals(1L, ids.getBeneficiaryId());
assertNull(ids.getCurrentMbi());
assertEquals(1, ids.getHistoricMbis().size());
assertEquals("HIST_MBI", ids.getHistoricMbis().stream().findAny().get());
Identifier mbiCurrent = new Identifier();
mbiCurrent.setSystem(MBI_ID);
mbiCurrent.setValue("CURR_MBI");
Extension extension2 = new Extension();
extension2.setUrl(CURRENCY_IDENTIFIER);
Coding code2 = new Coding();
code2.setCode("current");
extension2.setValue(code2);
mbiCurrent.getExtension().add(extension2);
patient.getIdentifier().add(mbiCurrent);
ids = callable.extractPatientId(patient);
assertEquals(1L, ids.getBeneficiaryId());
assertEquals(1, ids.getHistoricMbis().size());
assertEquals("CURR_MBI", ids.getCurrentMbi());
assertEquals(1, ids.getHistoricMbis().size());
assertEquals("HIST_MBI", ids.getHistoricMbis().stream().findAny().get());
}
use of org.hl7.fhir.dstu3.model.Contract in project ab2d by CMSgov.
the class JobProcessorIntegrationTest method setUp.
@BeforeEach
void setUp() {
MockitoAnnotations.openMocks(this);
LogManager logManager = new LogManager(sqlEventLogger, kinesisEventLogger, slackLogger);
PdpClient pdpClient = createClient();
contract = createContract();
contractForCoverageDTO = mapping.map(contract);
fail = new RuntimeException("TEST EXCEPTION");
job = createJob(pdpClient);
job.setContractNumber(contract.getContractNumber());
job.setStatus(JobStatus.IN_PROGRESS);
jobRepository.saveAndFlush(job);
when(mockBfdClient.requestEOBFromServer(eq(STU3), anyLong())).thenAnswer((args) -> {
ExplanationOfBenefit copy = EOB.copy();
copy.getPatient().setReference("Patient/" + args.getArgument(1));
return EobTestDataUtil.createBundle(copy);
});
when(mockBfdClient.requestEOBFromServer(eq(STU3), anyLong(), any())).thenAnswer((args) -> {
ExplanationOfBenefit copy = EOB.copy();
copy.getPatient().setReference("Patient/" + args.getArgument(1));
return EobTestDataUtil.createBundle(copy);
});
when(mockCoverageDriver.numberOfBeneficiariesToProcess(any(Job.class), any(ContractDTO.class))).thenReturn(100);
when(mockCoverageDriver.pageCoverage(any(CoveragePagingRequest.class))).thenReturn(new CoveragePagingResult(loadFauxMetadata(contractForCoverageDTO, 99), null));
SearchConfig searchConfig = new SearchConfig(tmpEfsMountDir.getAbsolutePath(), STREAMING_DIR, FINISHED_DIR, 0, 0, MULTIPLIER, NUMBER_PATIENT_REQUESTS_PER_THREAD);
PatientClaimsProcessor patientClaimsProcessor = new PatientClaimsProcessorImpl(mockBfdClient, logManager, searchConfig);
ReflectionTestUtils.setField(patientClaimsProcessor, "earliestDataDate", "01/01/1900");
ThreadPoolTaskExecutor pool = new ThreadPoolTaskExecutor();
pool.initialize();
ContractProcessor contractProcessor = new ContractProcessorImpl(contractWorkerClient, jobRepository, mockCoverageDriver, patientClaimsProcessor, logManager, eobClaimRequestsQueue, jobChannelService, jobProgressService, mapping, pool, searchConfig);
cut = new JobProcessorImpl(fileService, jobChannelService, jobProgressService, jobProgressUpdateService, jobRepository, jobOutputRepository, contractProcessor, logManager);
ReflectionTestUtils.setField(cut, "efsMount", tmpEfsMountDir.toString());
ReflectionTestUtils.setField(cut, "failureThreshold", 10);
}
use of org.hl7.fhir.dstu3.model.Contract in project ab2d by CMSgov.
the class EndToEndBfdTests method disableContractWeDontNeed.
/**
* For all but the contract we want to use, disable them
*/
private void disableContractWeDontNeed() {
List<PdpClient> clients = pdpClientRepository.findAllByEnabledTrue().stream().filter(client -> client.getContract().getAttestedOn() != null).collect(toList());
for (PdpClient pdp : clients) {
if (!pdp.getContract().getContractNumber().equals(CONTRACT_TO_USE)) {
pdp.setEnabled(false);
pdpClientRepository.save(pdp);
}
}
}
use of org.hl7.fhir.dstu3.model.Contract in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeContractValuedItemComponent.
protected void composeContractValuedItemComponent(Complex parent, String parentType, String name, Contract.ValuedItemComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "valuedItem", name, element, index);
if (element.hasEntity())
composeType(t, "Contract", "entity", element.getEntity(), -1);
if (element.hasIdentifier())
composeIdentifier(t, "Contract", "identifier", element.getIdentifier(), -1);
if (element.hasEffectiveTimeElement())
composeDateTime(t, "Contract", "effectiveTime", element.getEffectiveTimeElement(), -1);
if (element.hasQuantity())
composeQuantity(t, "Contract", "quantity", element.getQuantity(), -1);
if (element.hasUnitPrice())
composeQuantity(t, "Contract", "unitPrice", element.getUnitPrice(), -1);
if (element.hasFactorElement())
composeDecimal(t, "Contract", "factor", element.getFactorElement(), -1);
if (element.hasPointsElement())
composeDecimal(t, "Contract", "points", element.getPointsElement(), -1);
if (element.hasNet())
composeQuantity(t, "Contract", "net", element.getNet(), -1);
}
use of org.hl7.fhir.dstu3.model.Contract in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeCoverage.
protected void composeCoverage(Complex parent, String parentType, String name, Coverage element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "Coverage", name, element, index);
if (element.hasIssuer())
composeType(t, "Coverage", "issuer", element.getIssuer(), -1);
if (element.hasBinElement())
composeString(t, "Coverage", "bin", element.getBinElement(), -1);
if (element.hasPeriod())
composePeriod(t, "Coverage", "period", element.getPeriod(), -1);
if (element.hasType())
composeCoding(t, "Coverage", "type", element.getType(), -1);
if (element.hasPlanholder())
composeType(t, "Coverage", "planholder", element.getPlanholder(), -1);
if (element.hasBeneficiary())
composeType(t, "Coverage", "beneficiary", element.getBeneficiary(), -1);
if (element.hasRelationship())
composeCoding(t, "Coverage", "relationship", element.getRelationship(), -1);
for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "Coverage", "identifier", element.getIdentifier().get(i), i);
if (element.hasGroupElement())
composeString(t, "Coverage", "group", element.getGroupElement(), -1);
if (element.hasPlanElement())
composeString(t, "Coverage", "plan", element.getPlanElement(), -1);
if (element.hasSubPlanElement())
composeString(t, "Coverage", "subPlan", element.getSubPlanElement(), -1);
if (element.hasDependentElement())
composePositiveInt(t, "Coverage", "dependent", element.getDependentElement(), -1);
if (element.hasSequenceElement())
composePositiveInt(t, "Coverage", "sequence", element.getSequenceElement(), -1);
for (int i = 0; i < element.getException().size(); i++) composeCoding(t, "Coverage", "exception", element.getException().get(i), i);
if (element.hasSchoolElement())
composeString(t, "Coverage", "school", element.getSchoolElement(), -1);
if (element.hasNetworkElement())
composeString(t, "Coverage", "network", element.getNetworkElement(), -1);
for (int i = 0; i < element.getContract().size(); i++) composeReference(t, "Coverage", "contract", element.getContract().get(i), i);
}
Aggregations