Search in sources :

Example 11 with PreAdjFissClaim

use of gov.cms.bfd.model.rda.PreAdjFissClaim in project beneficiary-fhir-data by CMSgov.

the class R4ClaimSamhsaMatcherTransformerTest method fissTest.

/**
 * These tests check if the transformed FISS claims result in the expected SAMHSA filtering
 * outcomes.
 */
@ParameterizedTest(name = "{index}: {0}")
@MethodSource
public void fissTest(String testName, LocalDate toDate, List<String> diagCodes, List<String> procCodes, boolean expectedResult, String errorMessagePostFix) {
    PreAdjFissClaim entity = new PreAdjFissClaim();
    String principalDxCode = diagCodes.get(0);
    String admittingDxCode = diagCodes.get(1);
    entity.setLastUpdated(Instant.ofEpochMilli(1));
    entity.setStmtCovToDate(toDate);
    entity.setPrincipleDiag(principalDxCode);
    entity.setAdmitDiagCode(admittingDxCode);
    Set<PreAdjFissDiagnosisCode> diagnoses = IntStream.range(0, diagCodes.size()).mapToObj(i -> {
        PreAdjFissDiagnosisCode diagCode = new PreAdjFissDiagnosisCode();
        diagCode.setPriority((short) i);
        diagCode.setDiagCd2(diagCodes.get(i));
        return diagCode;
    }).collect(Collectors.toSet());
    entity.setDiagCodes(diagnoses);
    Set<PreAdjFissProcCode> procedures = IntStream.range(0, procCodes.size()).mapToObj(i -> {
        PreAdjFissProcCode procCode = new PreAdjFissProcCode();
        procCode.setProcDate(LocalDate.EPOCH);
        procCode.setPriority((short) i);
        procCode.setProcCode(procCodes.get(i));
        return procCode;
    }).collect(Collectors.toSet());
    entity.setProcCodes(procedures);
    Claim claim = FissClaimTransformerV2.transform(new MetricRegistry(), entity);
    R4ClaimSamhsaMatcher matcher = new R4ClaimSamhsaMatcher();
    assertEquals(expectedResult, matcher.test(claim), testName + " " + errorMessagePostFix);
}
Also used : PreAdjFissClaim(gov.cms.bfd.model.rda.PreAdjFissClaim) IntStream(java.util.stream.IntStream) MetricRegistry(com.codahale.metrics.MetricRegistry) PreAdjFissProcCode(gov.cms.bfd.model.rda.PreAdjFissProcCode) Set(java.util.Set) Instant(java.time.Instant) Arguments(org.junit.jupiter.params.provider.Arguments) Collectors(java.util.stream.Collectors) PreAdjMcsClaim(gov.cms.bfd.model.rda.PreAdjMcsClaim) List(java.util.List) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) Stream(java.util.stream.Stream) PreAdjMcsDetail(gov.cms.bfd.model.rda.PreAdjMcsDetail) PreAdjMcsDiagnosisCode(gov.cms.bfd.model.rda.PreAdjMcsDiagnosisCode) LocalDate(java.time.LocalDate) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) Arguments.arguments(org.junit.jupiter.params.provider.Arguments.arguments) PreAdjFissDiagnosisCode(gov.cms.bfd.model.rda.PreAdjFissDiagnosisCode) Claim(org.hl7.fhir.r4.model.Claim) MethodSource(org.junit.jupiter.params.provider.MethodSource) PreAdjFissDiagnosisCode(gov.cms.bfd.model.rda.PreAdjFissDiagnosisCode) PreAdjFissProcCode(gov.cms.bfd.model.rda.PreAdjFissProcCode) MetricRegistry(com.codahale.metrics.MetricRegistry) PreAdjFissClaim(gov.cms.bfd.model.rda.PreAdjFissClaim) PreAdjFissClaim(gov.cms.bfd.model.rda.PreAdjFissClaim) PreAdjMcsClaim(gov.cms.bfd.model.rda.PreAdjMcsClaim) Claim(org.hl7.fhir.r4.model.Claim) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 12 with PreAdjFissClaim

use of gov.cms.bfd.model.rda.PreAdjFissClaim in project beneficiary-fhir-data by CMSgov.

the class FissClaimResponseTransformerV2 method getContainedPatient.

private static Resource getContainedPatient(PreAdjFissClaim claimGroup) {
    Optional<PreAdjFissPayer> optional = claimGroup.getPayers().stream().filter(p -> p.getPayerType() == PreAdjFissPayer.PayerType.BeneZ).findFirst();
    Patient patient;
    if (optional.isPresent()) {
        PreAdjFissPayer benePayer = optional.get();
        patient = getContainedPatient(claimGroup.getMbi(), new PatientInfo(benePayer.getBeneFirstName(), benePayer.getBeneLastName(), ifNotNull(benePayer.getBeneMidInit(), s -> s.charAt(0) + "."), benePayer.getBeneDob(), benePayer.getBeneSex()));
    } else {
        patient = getContainedPatient(claimGroup.getMbi(), null);
    }
    return patient;
}
Also used : Trace(com.newrelic.api.agent.Trace) PreAdjFissPayer(gov.cms.bfd.model.rda.PreAdjFissPayer) Date(java.util.Date) Identifier(org.hl7.fhir.r4.model.Identifier) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) Reference(org.hl7.fhir.r4.model.Reference) ArrayList(java.util.ArrayList) C4BBIdentifierType(gov.cms.bfd.server.war.commons.carin.C4BBIdentifierType) Map(java.util.Map) ClaimType(org.hl7.fhir.r4.model.codesystems.ClaimType) Meta(org.hl7.fhir.r4.model.Meta) Patient(org.hl7.fhir.r4.model.Patient) PreAdjFissClaim(gov.cms.bfd.model.rda.PreAdjFissClaim) MetricRegistry(com.codahale.metrics.MetricRegistry) DateType(org.hl7.fhir.r4.model.DateType) BadCodeMonkeyException(gov.cms.bfd.sharedutils.exceptions.BadCodeMonkeyException) Resource(org.hl7.fhir.r4.model.Resource) ClaimResponse(org.hl7.fhir.r4.model.ClaimResponse) BBCodingSystems(gov.cms.bfd.server.war.commons.BBCodingSystems) AbstractTransformerV2(gov.cms.bfd.server.war.r4.providers.preadj.common.AbstractTransformerV2) List(java.util.List) Coding(org.hl7.fhir.r4.model.Coding) Timer(com.codahale.metrics.Timer) Optional(java.util.Optional) Extension(org.hl7.fhir.r4.model.Extension) Patient(org.hl7.fhir.r4.model.Patient) PreAdjFissPayer(gov.cms.bfd.model.rda.PreAdjFissPayer)

Example 13 with PreAdjFissClaim

use of gov.cms.bfd.model.rda.PreAdjFissClaim in project beneficiary-fhir-data by CMSgov.

the class FissClaimTransformerV2 method getContainedPatient.

private static Resource getContainedPatient(PreAdjFissClaim claimGroup) {
    Optional<PreAdjFissPayer> optional = claimGroup.getPayers().stream().filter(p -> p.getPayerType() == PreAdjFissPayer.PayerType.BeneZ).findFirst();
    Patient patient;
    if (optional.isPresent()) {
        PreAdjFissPayer benePayer = optional.get();
        patient = getContainedPatient(claimGroup.getMbi(), new PatientInfo(benePayer.getBeneFirstName(), benePayer.getBeneLastName(), ifNotNull(benePayer.getBeneMidInit(), s -> s.charAt(0) + "."), benePayer.getBeneDob(), benePayer.getBeneSex()));
    } else {
        patient = getContainedPatient(claimGroup.getMbi(), null);
    }
    return patient;
}
Also used : Trace(com.newrelic.api.agent.Trace) PreAdjFissPayer(gov.cms.bfd.model.rda.PreAdjFissPayer) Date(java.util.Date) Identifier(org.hl7.fhir.r4.model.Identifier) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) IcdCode(gov.cms.bfd.server.war.commons.IcdCode) Reference(org.hl7.fhir.r4.model.Reference) C4BBClaimIdentifierType(gov.cms.bfd.server.war.commons.carin.C4BBClaimIdentifierType) Money(org.hl7.fhir.r4.model.Money) C4BBIdentifierType(gov.cms.bfd.server.war.commons.carin.C4BBIdentifierType) Locale(java.util.Locale) ObjectUtils(org.apache.commons.lang3.ObjectUtils) ExDiagnosistype(org.hl7.fhir.r4.model.codesystems.ExDiagnosistype) StringType(org.hl7.fhir.r4.model.StringType) ClaimType(org.hl7.fhir.r4.model.codesystems.ClaimType) PreAdjFissDiagnosisCode(gov.cms.bfd.model.rda.PreAdjFissDiagnosisCode) Meta(org.hl7.fhir.r4.model.Meta) Patient(org.hl7.fhir.r4.model.Patient) PreAdjFissClaim(gov.cms.bfd.model.rda.PreAdjFissClaim) MetricRegistry(com.codahale.metrics.MetricRegistry) C4BBSupportingInfoType(gov.cms.bfd.server.war.commons.carin.C4BBSupportingInfoType) BadCodeMonkeyException(gov.cms.bfd.sharedutils.exceptions.BadCodeMonkeyException) PreAdjFissProcCode(gov.cms.bfd.model.rda.PreAdjFissProcCode) Period(org.hl7.fhir.r4.model.Period) Resource(org.hl7.fhir.r4.model.Resource) ProcessPriority(org.hl7.fhir.r4.model.codesystems.ProcessPriority) Collectors(java.util.stream.Collectors) BBCodingSystems(gov.cms.bfd.server.war.commons.BBCodingSystems) Objects(java.util.Objects) AbstractTransformerV2(gov.cms.bfd.server.war.r4.providers.preadj.common.AbstractTransformerV2) Organization(org.hl7.fhir.r4.model.Organization) List(java.util.List) TransformerConstants(gov.cms.bfd.server.war.commons.TransformerConstants) C4BBOrganizationIdentifierType(gov.cms.bfd.server.war.commons.carin.C4BBOrganizationIdentifierType) Coding(org.hl7.fhir.r4.model.Coding) LocalDate(java.time.LocalDate) Timer(com.codahale.metrics.Timer) Optional(java.util.Optional) Extension(org.hl7.fhir.r4.model.Extension) Comparator(java.util.Comparator) Collections(java.util.Collections) Claim(org.hl7.fhir.r4.model.Claim) Patient(org.hl7.fhir.r4.model.Patient) PreAdjFissPayer(gov.cms.bfd.model.rda.PreAdjFissPayer)

Example 14 with PreAdjFissClaim

use of gov.cms.bfd.model.rda.PreAdjFissClaim in project beneficiary-fhir-data by CMSgov.

the class FissClaimTransformer method transformMessageImpl.

private PreAdjFissClaim transformMessageImpl(FissClaim from, DataTransformer transformer, Instant now, String namePrefix) {
    final PreAdjFissClaim to = new PreAdjFissClaim();
    transformer.copyString(namePrefix + PreAdjFissClaim.Fields.dcn, false, 1, 23, from.getDcn(), to::setDcn);
    transformer.copyString(namePrefix + PreAdjFissClaim.Fields.hicNo, false, 1, 12, from.getHicNo(), to::setHicNo);
    transformer.copyEnumAsCharacter(namePrefix + PreAdjFissClaim.Fields.currStatus, PreAdjFissClaim_currStatus_Extractor.getEnumString(from), to::setCurrStatus);
    transformer.copyEnumAsCharacter(namePrefix + PreAdjFissClaim.Fields.currLoc1, PreAdjFissClaim_currLoc1_Extractor.getEnumString(from), to::setCurrLoc1);
    transformer.copyEnumAsString(namePrefix + PreAdjFissClaim.Fields.currLoc2, false, 5, PreAdjFissClaim_currLoc2_Extractor.getEnumString(from), to::setCurrLoc2);
    transformer.copyOptionalString(namePrefix + PreAdjFissClaim.Fields.medaProvId, 1, 13, from::hasMedaProvId, from::getMedaProvId, to::setMedaProvId);
    transformer.copyOptionalString(namePrefix + PreAdjFissClaim.Fields.medaProv_6, 1, 6, from::hasMedaProv6, from::getMedaProv6, to::setMedaProv_6);
    transformer.copyOptionalAmount(namePrefix + PreAdjFissClaim.Fields.totalChargeAmount, from::hasTotalChargeAmount, from::getTotalChargeAmount, to::setTotalChargeAmount);
    transformer.copyOptionalDate(namePrefix + PreAdjFissClaim.Fields.receivedDate, from::hasRecdDtCymd, from::getRecdDtCymd, to::setReceivedDate);
    transformer.copyOptionalDate(namePrefix + PreAdjFissClaim.Fields.currTranDate, from::hasCurrTranDtCymd, from::getCurrTranDtCymd, to::setCurrTranDate);
    transformer.copyOptionalString(namePrefix + PreAdjFissClaim.Fields.admitDiagCode, 1, 7, from::hasAdmDiagCode, from::getAdmDiagCode, to::setAdmitDiagCode);
    transformer.copyOptionalString(namePrefix + PreAdjFissClaim.Fields.principleDiag, 1, 7, from::hasPrincipleDiag, from::getPrincipleDiag, to::setPrincipleDiag);
    transformer.copyOptionalString(namePrefix + PreAdjFissClaim.Fields.npiNumber, 1, 10, from::hasNpiNumber, from::getNpiNumber, to::setNpiNumber);
    if (from.hasMbi()) {
        final var mbi = from.getMbi();
        if (transformer.validateString(namePrefix + PreAdjFissClaim.Fields.mbi, false, 1, 11, mbi)) {
            to.setMbiRecord(mbiCache.lookupMbi(mbi));
        }
    }
    transformer.copyOptionalString(namePrefix + PreAdjFissClaim.Fields.fedTaxNumber, 1, 10, from::hasFedTaxNb, from::getFedTaxNb, to::setFedTaxNumber);
    transformer.copyOptionalString(namePrefix + PreAdjFissClaim.Fields.pracLocAddr1, 1, 2147483647, from::hasPracLocAddr1, from::getPracLocAddr1, to::setPracLocAddr1);
    transformer.copyOptionalString(namePrefix + PreAdjFissClaim.Fields.pracLocAddr2, 1, 2147483647, from::hasPracLocAddr2, from::getPracLocAddr2, to::setPracLocAddr2);
    transformer.copyOptionalString(namePrefix + PreAdjFissClaim.Fields.pracLocCity, 1, 2147483647, from::hasPracLocCity, from::getPracLocCity, to::setPracLocCity);
    transformer.copyOptionalString(namePrefix + PreAdjFissClaim.Fields.pracLocState, 1, 2, from::hasPracLocState, from::getPracLocState, to::setPracLocState);
    transformer.copyOptionalString(namePrefix + PreAdjFissClaim.Fields.pracLocZip, 1, 15, from::hasPracLocZip, from::getPracLocZip, to::setPracLocZip);
    transformer.copyOptionalDate(namePrefix + PreAdjFissClaim.Fields.stmtCovFromDate, from::hasStmtCovFromCymd, from::getStmtCovFromCymd, to::setStmtCovFromDate);
    transformer.copyOptionalDate(namePrefix + PreAdjFissClaim.Fields.stmtCovToDate, from::hasStmtCovToCymd, from::getStmtCovToCymd, to::setStmtCovToDate);
    transformer.copyEnumAsString(namePrefix + PreAdjFissClaim.Fields.lobCd, true, 1, PreAdjFissClaim_lobCd_Extractor.getEnumString(from), to::setLobCd);
    if (from.hasServTypeCdEnum()) {
        to.setServTypeCdMapping(PreAdjFissClaim.ServTypeCdMapping.Normal);
    }
    if (from.hasServTypeCdForClinicsEnum()) {
        to.setServTypeCdMapping(PreAdjFissClaim.ServTypeCdMapping.Clinic);
    }
    if (from.hasServTypeCdForSpecialFacilitiesEnum()) {
        to.setServTypeCdMapping(PreAdjFissClaim.ServTypeCdMapping.SpecialFacility);
    }
    if (from.hasServTypCdUnrecognized()) {
        to.setServTypeCdMapping(PreAdjFissClaim.ServTypeCdMapping.Unrecognized);
    }
    transformer.copyEnumAsString(namePrefix + PreAdjFissClaim.Fields.servTypeCd, true, 1, PreAdjFissClaim_servTypeCd_Extractor.getEnumString(from), to::setServTypeCd);
    transformer.copyEnumAsString(namePrefix + PreAdjFissClaim.Fields.servTypeCd, true, 1, PreAdjFissClaim_servTypeCdForClinics_Extractor.getEnumString(from), to::setServTypeCd);
    transformer.copyEnumAsString(namePrefix + PreAdjFissClaim.Fields.servTypeCd, true, 1, PreAdjFissClaim_servTypeCdForSpecialFacilities_Extractor.getEnumString(from), to::setServTypeCd);
    transformer.copyOptionalString(namePrefix + PreAdjFissClaim.Fields.servTypeCd, 1, 1, from::hasServTypCdUnrecognized, from::getServTypCdUnrecognized, to::setServTypeCd);
    transformer.copyEnumAsString(namePrefix + PreAdjFissClaim.Fields.freqCd, true, 1, PreAdjFissClaim_freqCd_Extractor.getEnumString(from), to::setFreqCd);
    transformer.copyOptionalString(namePrefix + PreAdjFissClaim.Fields.billTypCd, 1, 3, from::hasBillTypCd, from::getBillTypCd, to::setBillTypCd);
    transformer.copyOptionalString(namePrefix + PreAdjFissClaim.Fields.rejectCd, 1, 5, from::hasRejectCd, from::getRejectCd, to::setRejectCd);
    transformer.copyOptionalString(namePrefix + PreAdjFissClaim.Fields.fullPartDenInd, 1, 1, from::hasFullPartDenInd, from::getFullPartDenInd, to::setFullPartDenInd);
    transformer.copyOptionalString(namePrefix + PreAdjFissClaim.Fields.nonPayInd, 1, 2, from::hasNonPayInd, from::getNonPayInd, to::setNonPayInd);
    transformer.copyOptionalString(namePrefix + PreAdjFissClaim.Fields.xrefDcnNbr, 1, 23, from::hasXrefDcnNbr, from::getXrefDcnNbr, to::setXrefDcnNbr);
    transformer.copyEnumAsString(namePrefix + PreAdjFissClaim.Fields.adjReqCd, true, 1, PreAdjFissClaim_adjReqCd_Extractor.getEnumString(from), to::setAdjReqCd);
    transformer.copyOptionalString(namePrefix + PreAdjFissClaim.Fields.adjReasCd, 1, 2, from::hasAdjReasCd, from::getAdjReasCd, to::setAdjReasCd);
    transformer.copyOptionalString(namePrefix + PreAdjFissClaim.Fields.cancelXrefDcn, 1, 23, from::hasCancelXrefDcn, from::getCancelXrefDcn, to::setCancelXrefDcn);
    transformer.copyOptionalDate(namePrefix + PreAdjFissClaim.Fields.cancelDate, from::hasCancelDateCymd, from::getCancelDateCymd, to::setCancelDate);
    transformer.copyEnumAsString(namePrefix + PreAdjFissClaim.Fields.cancAdjCd, true, 1, PreAdjFissClaim_cancAdjCd_Extractor.getEnumString(from), to::setCancAdjCd);
    transformer.copyOptionalString(namePrefix + PreAdjFissClaim.Fields.originalXrefDcn, 1, 23, from::hasOriginalXrefDcn, from::getOriginalXrefDcn, to::setOriginalXrefDcn);
    transformer.copyOptionalDate(namePrefix + PreAdjFissClaim.Fields.paidDt, from::hasPaidDtCymd, from::getPaidDtCymd, to::setPaidDt);
    transformer.copyOptionalDate(namePrefix + PreAdjFissClaim.Fields.admDate, from::hasAdmDateCymd, from::getAdmDateCymd, to::setAdmDate);
    transformer.copyEnumAsString(namePrefix + PreAdjFissClaim.Fields.admSource, true, 1, PreAdjFissClaim_admSource_Extractor.getEnumString(from), to::setAdmSource);
    transformer.copyEnumAsString(namePrefix + PreAdjFissClaim.Fields.primaryPayerCode, true, 1, PreAdjFissClaim_primaryPayerCode_Extractor.getEnumString(from), to::setPrimaryPayerCode);
    transformer.copyOptionalString(namePrefix + PreAdjFissClaim.Fields.attendPhysId, 1, 16, from::hasAttendPhysId, from::getAttendPhysId, to::setAttendPhysId);
    transformer.copyOptionalString(namePrefix + PreAdjFissClaim.Fields.attendPhysLname, 1, 17, from::hasAttendPhysLname, from::getAttendPhysLname, to::setAttendPhysLname);
    transformer.copyOptionalString(namePrefix + PreAdjFissClaim.Fields.attendPhysFname, 1, 18, from::hasAttendPhysFname, from::getAttendPhysFname, to::setAttendPhysFname);
    transformer.copyOptionalString(namePrefix + PreAdjFissClaim.Fields.attendPhysMint, 1, 1, from::hasAttendPhysMint, from::getAttendPhysMint, to::setAttendPhysMint);
    transformer.copyEnumAsString(namePrefix + PreAdjFissClaim.Fields.attendPhysFlag, true, 1, PreAdjFissClaim_attendPhysFlag_Extractor.getEnumString(from), to::setAttendPhysFlag);
    transformer.copyOptionalString(namePrefix + PreAdjFissClaim.Fields.operatingPhysId, 1, 16, from::hasOperatingPhysId, from::getOperatingPhysId, to::setOperatingPhysId);
    transformer.copyOptionalString(namePrefix + PreAdjFissClaim.Fields.operPhysLname, 1, 17, from::hasOperPhysLname, from::getOperPhysLname, to::setOperPhysLname);
    transformer.copyOptionalString(namePrefix + PreAdjFissClaim.Fields.operPhysFname, 1, 18, from::hasOperPhysFname, from::getOperPhysFname, to::setOperPhysFname);
    transformer.copyOptionalString(namePrefix + PreAdjFissClaim.Fields.operPhysMint, 1, 1, from::hasOperPhysMint, from::getOperPhysMint, to::setOperPhysMint);
    transformer.copyEnumAsString(namePrefix + PreAdjFissClaim.Fields.operPhysFlag, true, 1, PreAdjFissClaim_operPhysFlag_Extractor.getEnumString(from), to::setOperPhysFlag);
    transformer.copyOptionalString(namePrefix + PreAdjFissClaim.Fields.othPhysId, 1, 16, from::hasOthPhysId, from::getOthPhysId, to::setOthPhysId);
    transformer.copyOptionalString(namePrefix + PreAdjFissClaim.Fields.othPhysLname, 1, 17, from::hasOthPhysLname, from::getOthPhysLname, to::setOthPhysLname);
    transformer.copyOptionalString(namePrefix + PreAdjFissClaim.Fields.othPhysFname, 1, 18, from::hasOthPhysFname, from::getOthPhysFname, to::setOthPhysFname);
    transformer.copyOptionalString(namePrefix + PreAdjFissClaim.Fields.othPhysMint, 1, 1, from::hasOthPhysMint, from::getOthPhysMint, to::setOthPhysMint);
    transformer.copyEnumAsString(namePrefix + PreAdjFissClaim.Fields.othPhysFlag, true, 1, PreAdjFissClaim_othPhysFlag_Extractor.getEnumString(from), to::setOthPhysFlag);
    transformer.copyOptionalString(namePrefix + PreAdjFissClaim.Fields.xrefHicNbr, 1, 12, from::hasXrefHicNbr, from::getXrefHicNbr, to::setXrefHicNbr);
    transformer.copyEnumAsString(namePrefix + PreAdjFissClaim.Fields.procNewHicInd, true, 1, PreAdjFissClaim_procNewHicInd_Extractor.getEnumString(from), to::setProcNewHicInd);
    transformer.copyOptionalString(namePrefix + PreAdjFissClaim.Fields.newHic, 1, 12, from::hasNewHic, from::getNewHic, to::setNewHic);
    transformer.copyEnumAsString(namePrefix + PreAdjFissClaim.Fields.reposInd, true, 1, PreAdjFissClaim_reposInd_Extractor.getEnumString(from), to::setReposInd);
    transformer.copyOptionalString(namePrefix + PreAdjFissClaim.Fields.reposHic, 1, 12, from::hasReposHic, from::getReposHic, to::setReposHic);
    transformer.copyEnumAsString(namePrefix + PreAdjFissClaim.Fields.mbiSubmBeneInd, true, 1, PreAdjFissClaim_mbiSubmBeneInd_Extractor.getEnumString(from), to::setMbiSubmBeneInd);
    transformer.copyEnumAsString(namePrefix + PreAdjFissClaim.Fields.adjMbiInd, true, 1, PreAdjFissClaim_adjMbiInd_Extractor.getEnumString(from), to::setAdjMbiInd);
    transformer.copyOptionalString(namePrefix + PreAdjFissClaim.Fields.adjMbi, 1, 11, from::hasAdjMbi, from::getAdjMbi, to::setAdjMbi);
    transformer.copyOptionalString(namePrefix + PreAdjFissClaim.Fields.medicalRecordNo, 1, 17, from::hasMedicalRecordNo, from::getMedicalRecordNo, to::setMedicalRecordNo);
    to.setLastUpdated(now);
    return to;
}
Also used : PreAdjFissClaim(gov.cms.bfd.model.rda.PreAdjFissClaim)

Example 15 with PreAdjFissClaim

use of gov.cms.bfd.model.rda.PreAdjFissClaim in project beneficiary-fhir-data by CMSgov.

the class FissClaimRdaSinkIT method fissClaim.

@Test
public void fissClaim() throws Exception {
    RdaPipelineTestUtils.runTestWithTemporaryDb(FissClaimRdaSinkIT.class, Clock.systemUTC(), (appState, entityManager) -> {
        final LocalDate today = LocalDate.of(2022, 1, 3);
        final Instant now = today.atStartOfDay().toInstant(ZoneOffset.UTC);
        final Clock clock = Clock.fixed(now, ZoneOffset.UTC);
        final PreAdjFissClaim claim = new PreAdjFissClaim();
        claim.setSequenceNumber(3L);
        claim.setDcn("1");
        claim.setHicNo("h1");
        claim.setCurrStatus('T');
        claim.setCurrLoc1('A');
        claim.setCurrLoc2("1A");
        claim.setPracLocCity("city name can be very long indeed");
        claim.setMbiRecord(new Mbi(1L, "12345678901", "hash-of-12345678901"));
        final PreAdjFissProcCode procCode0 = new PreAdjFissProcCode();
        procCode0.setDcn(claim.getDcn());
        procCode0.setPriority((short) 0);
        procCode0.setProcCode("P");
        procCode0.setProcFlag("F");
        procCode0.setProcDate(today);
        claim.getProcCodes().add(procCode0);
        final PreAdjFissDiagnosisCode diagCode0 = new PreAdjFissDiagnosisCode();
        diagCode0.setDcn(claim.getDcn());
        diagCode0.setPriority((short) 0);
        diagCode0.setDiagCd2("cd2");
        diagCode0.setDiagPoaInd("Q");
        claim.getDiagCodes().add(diagCode0);
        final FissProcedureCode procCodeMessage = FissProcedureCode.newBuilder().setProcCd("P").setProcFlag("F").setProcDt("2022-01-03").build();
        final FissDiagnosisCode diagCodeMessage = FissDiagnosisCode.newBuilder().setDiagCd2("cd2").setDiagPoaIndUnrecognized("Q").build();
        final FissClaim claimMessage = FissClaim.newBuilder().setDcn(claim.getDcn()).setHicNo(claim.getHicNo()).setCurrStatusEnum(FissClaimStatus.CLAIM_STATUS_RTP).setCurrLoc1Unrecognized(String.valueOf(claim.getCurrLoc1())).setCurrLoc2Unrecognized(claim.getCurrLoc2()).setPracLocCity("city name can be very long indeed").addFissProcCodes(0, procCodeMessage).addFissDiagCodes(0, diagCodeMessage).setMbi(claim.getMbi()).build();
        final FissClaimChange message = FissClaimChange.newBuilder().setSeq(claim.getSequenceNumber()).setDcn(claim.getDcn()).setClaim(claimMessage).build();
        final IdHasher defaultIdHasher = new IdHasher(new IdHasher.Config(1, "notarealpepper"));
        final FissClaimTransformer transformer = new FissClaimTransformer(clock, MbiCache.computedCache(defaultIdHasher.getConfig()));
        final FissClaimRdaSink sink = new FissClaimRdaSink(appState, transformer, true);
        final String expectedMbiHash = defaultIdHasher.computeIdentifierHash(claim.getMbi());
        assertEquals(Optional.empty(), sink.readMaxExistingSequenceNumber());
        int count = sink.writeMessage("version", message);
        assertEquals(1, count);
        List<PreAdjFissClaim> claims = entityManager.createQuery("select c from PreAdjFissClaim c", PreAdjFissClaim.class).getResultList();
        assertEquals(1, claims.size());
        PreAdjFissClaim resultClaim = claims.get(0);
        assertEquals(Long.valueOf(3), resultClaim.getSequenceNumber());
        assertEquals(claim.getHicNo(), resultClaim.getHicNo());
        assertEquals(claim.getPracLocCity(), resultClaim.getPracLocCity());
        assertEquals(claim.getMbi(), resultClaim.getMbi());
        assertEquals(expectedMbiHash, resultClaim.getMbiHash());
        assertEquals(claim.getProcCodes().size(), resultClaim.getProcCodes().size());
        assertEquals(claim.getDiagCodes().size(), resultClaim.getDiagCodes().size());
        assertEquals(Optional.of(claim.getSequenceNumber()), sink.readMaxExistingSequenceNumber());
        Mbi databaseMbiEntity = RdaPipelineTestUtils.lookupCachedMbi(entityManager, claimMessage.getMbi());
        assertNotNull(databaseMbiEntity);
        assertEquals(claim.getMbi(), databaseMbiEntity.getMbi());
        assertEquals(expectedMbiHash, databaseMbiEntity.getHash());
    });
}
Also used : FissProcedureCode(gov.cms.mpsm.rda.v1.fiss.FissProcedureCode) Instant(java.time.Instant) PreAdjFissClaim(gov.cms.bfd.model.rda.PreAdjFissClaim) FissClaim(gov.cms.mpsm.rda.v1.fiss.FissClaim) FissClaimChange(gov.cms.mpsm.rda.v1.FissClaimChange) PreAdjFissClaim(gov.cms.bfd.model.rda.PreAdjFissClaim) FissDiagnosisCode(gov.cms.mpsm.rda.v1.fiss.FissDiagnosisCode) PreAdjFissDiagnosisCode(gov.cms.bfd.model.rda.PreAdjFissDiagnosisCode) Clock(java.time.Clock) LocalDate(java.time.LocalDate) PreAdjFissDiagnosisCode(gov.cms.bfd.model.rda.PreAdjFissDiagnosisCode) Mbi(gov.cms.bfd.model.rda.Mbi) PreAdjFissProcCode(gov.cms.bfd.model.rda.PreAdjFissProcCode) IdHasher(gov.cms.bfd.pipeline.sharedutils.IdHasher) FissClaimTransformer(gov.cms.bfd.pipeline.rda.grpc.source.FissClaimTransformer) Test(org.junit.jupiter.api.Test)

Aggregations

PreAdjFissClaim (gov.cms.bfd.model.rda.PreAdjFissClaim)21 Test (org.junit.jupiter.api.Test)10 PreAdjFissDiagnosisCode (gov.cms.bfd.model.rda.PreAdjFissDiagnosisCode)6 PreAdjFissPayer (gov.cms.bfd.model.rda.PreAdjFissPayer)6 PreAdjFissProcCode (gov.cms.bfd.model.rda.PreAdjFissProcCode)6 FissClaimChange (gov.cms.mpsm.rda.v1.FissClaimChange)4 LocalDate (java.time.LocalDate)4 MetricRegistry (com.codahale.metrics.MetricRegistry)3 PreAdjMcsClaim (gov.cms.bfd.model.rda.PreAdjMcsClaim)3 BigDecimal (java.math.BigDecimal)3 Date (java.util.Date)3 List (java.util.List)3 Claim (org.hl7.fhir.r4.model.Claim)3 Meta (org.hl7.fhir.r4.model.Meta)3 Reference (org.hl7.fhir.r4.model.Reference)3 Timer (com.codahale.metrics.Timer)2 Trace (com.newrelic.api.agent.Trace)2 RdaChange (gov.cms.bfd.pipeline.rda.grpc.RdaChange)2 JsonMessageSource (gov.cms.bfd.pipeline.rda.grpc.server.JsonMessageSource)2 FissClaimStreamCaller (gov.cms.bfd.pipeline.rda.grpc.source.FissClaimStreamCaller)2