use of org.hl7.fhir.r5.utils.validation in project beneficiary-fhir-data by CMSgov.
the class TransformerUtilsV2 method mapEobType.
/**
* maps a blue button claim type to a FHIR claim type
*
* @param eob the {@link CodeableConcept} that will get remapped
* @param blueButtonClaimType the blue button {@link ClaimTypeV2} we are mapping from
* @param ccwNearLineRecordIdCode if present, the blue button near line id code {@link
* Optional}<{@link Character}> gets remapped to a ccw record id code
* @param ccwClaimTypeCode if present, the blue button claim type code {@link Optional}<{@link
* String}> gets remapped to a nch claim type code
*/
static void mapEobType(ExplanationOfBenefit eob, ClaimTypeV2 blueButtonClaimType, Optional<Character> ccwNearLineRecordIdCode, Optional<String> ccwClaimTypeCode) {
// NCH_CLM_TYPE_CD => ExplanationOfBenefit.type.coding
if (ccwClaimTypeCode.isPresent()) {
eob.getType().addCoding(createCoding(eob, CcwCodebookVariable.NCH_CLM_TYPE_CD, ccwClaimTypeCode));
}
// This Coding MUST always be present as it's the only one we can definitely map
// for all 8 of our claim types.
// EOB Type => ExplanationOfBenefit.type.coding
eob.getType().addCoding().setSystem(TransformerConstants.CODING_SYSTEM_BBAPI_EOB_TYPE).setCode(blueButtonClaimType.name());
// Map a Coding for FHIR's ClaimType coding system, if we can.
org.hl7.fhir.r4.model.codesystems.ClaimType fhirClaimType;
switch(blueButtonClaimType) {
case PDE:
fhirClaimType = org.hl7.fhir.r4.model.codesystems.ClaimType.PHARMACY;
break;
case INPATIENT:
case OUTPATIENT:
case HOSPICE:
case SNF:
case DME:
fhirClaimType = org.hl7.fhir.r4.model.codesystems.ClaimType.INSTITUTIONAL;
break;
case CARRIER:
case HHA:
fhirClaimType = org.hl7.fhir.r4.model.codesystems.ClaimType.PROFESSIONAL;
break;
default:
// All options on ClaimTypeV2 are covered above, but this is there to appease linter
throw new BadCodeMonkeyException("No match found for ClaimTypeV2");
}
// Claim Type => ExplanationOfBenefit.type.coding
if (fhirClaimType != null) {
eob.getType().addCoding(new Coding(fhirClaimType.getSystem(), fhirClaimType.toCode(), fhirClaimType.getDisplay()));
}
// NCH_NEAR_LINE_REC_IDENT_CD => ExplanationOfBenefit.extension
if (ccwNearLineRecordIdCode.isPresent()) {
eob.addExtension(createExtensionCoding(eob, CcwCodebookVariable.NCH_NEAR_LINE_REC_IDENT_CD, ccwNearLineRecordIdCode));
}
}
use of org.hl7.fhir.r5.utils.validation in project beneficiary-fhir-data by CMSgov.
the class R4ExplanationOfBenefitResourceProviderIT method readEobForExistingInpatientClaim.
/**
* Verifies that {@link
* gov.cms.bfd.server.war.r4.providers.ExplanationOfBenefitResourceProvider#read(org.hl7.fhir.r4.model.IdType)}
* works as expected for an {@link InpatientClaim}-derived {@link ExplanationOfBenefit} that does
* exist in the DB.
*
* @throws FHIRException (indicates test failure)
*/
@Test
public void readEobForExistingInpatientClaim() throws FHIRException {
List<Object> loadedRecords = ServerTestUtils.get().loadData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
IGenericClient fhirClient = ServerTestUtils.get().createFhirClientV2();
InpatientClaim claim = loadedRecords.stream().filter(r -> r instanceof InpatientClaim).map(r -> (InpatientClaim) r).findFirst().get();
ExplanationOfBenefit eob = fhirClient.read().resource(ExplanationOfBenefit.class).withId(TransformerUtilsV2.buildEobId(ClaimTypeV2.INPATIENT, claim.getClaimId())).execute();
assertNotNull(eob);
// Compare result to transformed EOB
compareEob(ClaimTypeV2.INPATIENT, eob, loadedRecords);
}
use of org.hl7.fhir.r5.utils.validation in project beneficiary-fhir-data by CMSgov.
the class R4ExplanationOfBenefitResourceProviderIT method readEobForExistingCarrierClaim.
/**
* Verifies that {@link
* gov.cms.bfd.server.war.r4.providers.ExplanationOfBenefitResourceProvider#read(org.hl7.fhir.r4.model.IdType)}
* works as expected for a {@link CarrierClaim}-derived {@link ExplanationOfBenefit} that does
* exist in the DB.
*
* @throws FHIRException (indicates test failure)
*/
@Test
public void readEobForExistingCarrierClaim() throws FHIRException {
List<Object> loadedRecords = ServerTestUtils.get().loadData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
IGenericClient fhirClient = ServerTestUtils.get().createFhirClientV2();
CarrierClaim claim = loadedRecords.stream().filter(r -> r instanceof CarrierClaim).map(r -> (CarrierClaim) r).findFirst().get();
ExplanationOfBenefit eob = fhirClient.read().resource(ExplanationOfBenefit.class).withId(TransformerUtilsV2.buildEobId(ClaimTypeV2.CARRIER, claim.getClaimId())).execute();
// Compare result to transformed EOB
compareEob(ClaimTypeV2.CARRIER, eob, loadedRecords);
}
use of org.hl7.fhir.r5.utils.validation in project beneficiary-fhir-data by CMSgov.
the class R4ExplanationOfBenefitResourceProviderIT method readEobForExistingHHAClaim.
/**
* Verifies that {@link
* gov.cms.bfd.server.war.r4.providers.ExplanationOfBenefitResourceProvider#read(org.hl7.fhir.r4.model.IdType)}
* works as expected for an {@link HHAClaim}-derived {@link ExplanationOfBenefit} that does exist
* in the DB.
*
* @throws FHIRException (indicates test failure)
*/
@Test
public void readEobForExistingHHAClaim() throws FHIRException {
List<Object> loadedRecords = ServerTestUtils.get().loadData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
IGenericClient fhirClient = ServerTestUtils.get().createFhirClientV2();
HHAClaim claim = loadedRecords.stream().filter(r -> r instanceof HHAClaim).map(r -> (HHAClaim) r).findFirst().get();
ExplanationOfBenefit eob = fhirClient.read().resource(ExplanationOfBenefit.class).withId(TransformerUtilsV2.buildEobId(ClaimTypeV2.HHA, claim.getClaimId())).execute();
assertNotNull(eob);
// Compare result to transformed EOB
compareEob(ClaimTypeV2.HHA, eob, loadedRecords);
}
use of org.hl7.fhir.r5.utils.validation in project beneficiary-fhir-data by CMSgov.
the class R4ExplanationOfBenefitResourceProviderIT method readEobForExistingDMEClaim.
/**
* Verifies that {@link
* gov.cms.bfd.server.war.r4.providers.ExplanationOfBenefitResourceProvider#read(org.hl7.fhir.r4.model.IdType)}
* works as expected for a {@link DMEClaim}-derived {@link ExplanationOfBenefit} that does exist
* in the DB.
*
* @throws FHIRException (indicates test failure)
*/
@Test
public void readEobForExistingDMEClaim() throws FHIRException {
List<Object> loadedRecords = ServerTestUtils.get().loadData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
IGenericClient fhirClient = ServerTestUtils.get().createFhirClientV2();
DMEClaim claim = loadedRecords.stream().filter(r -> r instanceof DMEClaim).map(r -> (DMEClaim) r).findFirst().get();
ExplanationOfBenefit eob = fhirClient.read().resource(ExplanationOfBenefit.class).withId(TransformerUtilsV2.buildEobId(ClaimTypeV2.DME, claim.getClaimId())).execute();
assertNotNull(eob);
// Compare result to transformed EOB
compareEob(ClaimTypeV2.DME, eob, loadedRecords);
}
Aggregations