Search in sources :

Example 11 with CarrierClaim

use of gov.cms.bfd.model.rif.CarrierClaim in project beneficiary-fhir-data by CMSgov.

the class ExplanationOfBenefitResourceProviderIT method adjustCarrierClaimForSamhsaDiagnosis.

/**
 * Adjusts the carrier claim to support samhsa.
 *
 * @param loadedRecords the loaded records
 * @param entityManager the entity manager
 */
private void adjustCarrierClaimForSamhsaDiagnosis(List<Object> loadedRecords, EntityManager entityManager) {
    CarrierClaim carrierRifRecord = loadedRecords.stream().filter(r -> r instanceof CarrierClaim).map(r -> (CarrierClaim) r).findFirst().get();
    entityManager.getTransaction().begin();
    carrierRifRecord = entityManager.find(CarrierClaim.class, carrierRifRecord.getClaimId());
    carrierRifRecord.setDiagnosis2Code(Optional.of(Stu3EobSamhsaMatcherTest.SAMPLE_SAMHSA_ICD_9_DIAGNOSIS_CODE));
    carrierRifRecord.setDiagnosis2CodeVersion(Optional.of('9'));
    entityManager.merge(carrierRifRecord);
    entityManager.getTransaction().commit();
}
Also used : Arrays(java.util.Arrays) Bundle(org.hl7.fhir.dstu3.model.Bundle) Date(java.util.Date) Constants(ca.uhn.fhir.rest.api.Constants) InpatientClaim(gov.cms.bfd.model.rif.InpatientClaim) DateTimeDt(ca.uhn.fhir.model.primitive.DateTimeDt) PartDEvent(gov.cms.bfd.model.rif.PartDEvent) SNFClaim(gov.cms.bfd.model.rif.SNFClaim) DateRangeParam(ca.uhn.fhir.rest.param.DateRangeParam) BeforeAll(org.junit.jupiter.api.BeforeAll) IBaseResource(org.hl7.fhir.instance.model.api.IBaseResource) BeneficiaryHistory(gov.cms.bfd.model.rif.BeneficiaryHistory) IGenericClient(ca.uhn.fhir.rest.client.api.IGenericClient) Triple(org.apache.commons.lang3.tuple.Triple) OutpatientClaim(gov.cms.bfd.model.rif.OutpatientClaim) IdDt(ca.uhn.fhir.model.primitive.IdDt) ExplanationOfBenefit(org.hl7.fhir.dstu3.model.ExplanationOfBenefit) InvalidRequestException(ca.uhn.fhir.rest.server.exceptions.InvalidRequestException) Instant(java.time.Instant) Collectors(java.util.stream.Collectors) Test(org.junit.jupiter.api.Test) Beneficiary(gov.cms.bfd.model.rif.Beneficiary) List(java.util.List) TransformerConstants(gov.cms.bfd.server.war.commons.TransformerConstants) EntityManagerFactory(javax.persistence.EntityManagerFactory) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) CarrierClaim(gov.cms.bfd.model.rif.CarrierClaim) Optional(java.util.Optional) TokenAndListParam(ca.uhn.fhir.rest.param.TokenAndListParam) Assertions.assertThrows(org.junit.jupiter.api.Assertions.assertThrows) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) Assertions.assertNull(org.junit.jupiter.api.Assertions.assertNull) RequestHeaders(gov.cms.bfd.server.war.commons.RequestHeaders) IBaseBundle(org.hl7.fhir.instance.model.api.IBaseBundle) ArrayList(java.util.ArrayList) HHAClaim(gov.cms.bfd.model.rif.HHAClaim) PipelineTestUtils(gov.cms.bfd.pipeline.sharedutils.PipelineTestUtils) RequestDetails(ca.uhn.fhir.rest.api.server.RequestDetails) ImmutableList(com.google.common.collect.ImmutableList) ReferenceParam(ca.uhn.fhir.rest.param.ReferenceParam) DMEClaim(gov.cms.bfd.model.rif.DMEClaim) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) ResourceNotFoundException(ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException) StaticRifResourceGroup(gov.cms.bfd.model.rif.samples.StaticRifResourceGroup) ServerTestUtils(gov.cms.bfd.server.war.ServerTestUtils) StringClientParam(ca.uhn.fhir.rest.gclient.StringClientParam) CommonHeaders(gov.cms.bfd.server.war.commons.CommonHeaders) ImmutableTriple(org.apache.commons.lang3.tuple.ImmutableTriple) TokenClientParam(ca.uhn.fhir.rest.gclient.TokenClientParam) HospiceClaim(gov.cms.bfd.model.rif.HospiceClaim) EntityManager(javax.persistence.EntityManager) MedicareBeneficiaryIdHistory(gov.cms.bfd.model.rif.MedicareBeneficiaryIdHistory) AfterEach(org.junit.jupiter.api.AfterEach) ChronoUnit(java.time.temporal.ChronoUnit) Patient(org.hl7.fhir.dstu3.model.Patient) FHIRException(org.hl7.fhir.exceptions.FHIRException) CarrierClaim(gov.cms.bfd.model.rif.CarrierClaim)

Example 12 with CarrierClaim

use of gov.cms.bfd.model.rif.CarrierClaim in project beneficiary-fhir-data by CMSgov.

the class EndpointJsonResponseComparatorV2IT method eobReadCarrier.

/**
 * @return the results of the {@link
 *     ExplanationOfBenefitResourceProvider#read(org.hl7.fhir.dstu3.model.IdType)} operation for
 *     Carrier claims
 */
public static String eobReadCarrier() {
    List<Object> loadedRecords = ServerTestUtils.get().loadData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
    IGenericClient fhirClient = createFhirClientAndSetEncoding();
    JsonInterceptor jsonInterceptor = createAndRegisterJsonInterceptor(fhirClient);
    CarrierClaim carrClaim = loadedRecords.stream().filter(r -> r instanceof CarrierClaim).map(r -> (CarrierClaim) r).findFirst().get();
    fhirClient.read().resource(ExplanationOfBenefit.class).withId(TransformerUtilsV2.buildEobId(ClaimTypeV2.CARRIER, carrClaim.getClaimId())).execute();
    return jsonInterceptor.getResponse();
}
Also used : Arrays(java.util.Arrays) R4PatientResourceProvider(gov.cms.bfd.server.war.r4.providers.R4PatientResourceProvider) InpatientClaim(gov.cms.bfd.model.rif.InpatientClaim) Disabled(org.junit.jupiter.api.Disabled) PartDEvent(gov.cms.bfd.model.rif.PartDEvent) SNFClaim(gov.cms.bfd.model.rif.SNFClaim) TransformerUtilsV2(gov.cms.bfd.server.war.r4.providers.TransformerUtilsV2) Matcher(java.util.regex.Matcher) CapabilityStatement(org.hl7.fhir.r4.model.CapabilityStatement) BeforeAll(org.junit.jupiter.api.BeforeAll) JsonNode(com.fasterxml.jackson.databind.JsonNode) IGenericClient(ca.uhn.fhir.rest.client.api.IGenericClient) Path(java.nio.file.Path) Coverage(org.hl7.fhir.r4.model.Coverage) Patient(org.hl7.fhir.r4.model.Patient) MethodSource(org.junit.jupiter.params.provider.MethodSource) OutpatientClaim(gov.cms.bfd.model.rif.OutpatientClaim) ImmutableSet(com.google.common.collect.ImmutableSet) MedicareSegment(gov.cms.bfd.server.war.commons.MedicareSegment) Set(java.util.Set) Arguments(org.junit.jupiter.params.provider.Arguments) Collectors(java.util.stream.Collectors) ExplanationOfBenefitResourceProvider(gov.cms.bfd.server.war.stu3.providers.ExplanationOfBenefitResourceProvider) StandardCharsets(java.nio.charset.StandardCharsets) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode) UncheckedIOException(java.io.UncheckedIOException) JsonArray(com.google.gson.JsonArray) Beneficiary(gov.cms.bfd.model.rif.Beneficiary) List(java.util.List) TransformerConstants(gov.cms.bfd.server.war.commons.TransformerConstants) Stream(java.util.stream.Stream) CarrierClaim(gov.cms.bfd.model.rif.CarrierClaim) Optional(java.util.Optional) Pattern(java.util.regex.Pattern) ClaimTypeV2(gov.cms.bfd.server.war.r4.providers.ClaimTypeV2) ExtraParamsInterceptor(gov.cms.bfd.server.war.stu3.providers.ExtraParamsInterceptor) CoverageResourceProvider(gov.cms.bfd.server.war.stu3.providers.CoverageResourceProvider) RequestHeaders(gov.cms.bfd.server.war.commons.RequestHeaders) Supplier(java.util.function.Supplier) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) ArrayList(java.util.ArrayList) HHAClaim(gov.cms.bfd.model.rif.HHAClaim) PipelineTestUtils(gov.cms.bfd.pipeline.sharedutils.PipelineTestUtils) Lists(com.google.common.collect.Lists) OutputStreamWriter(java.io.OutputStreamWriter) DMEClaim(gov.cms.bfd.model.rif.DMEClaim) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) StaticRifResourceGroup(gov.cms.bfd.model.rif.samples.StaticRifResourceGroup) ServerTestUtils(gov.cms.bfd.server.war.ServerTestUtils) Arguments.arguments(org.junit.jupiter.params.provider.Arguments.arguments) CommonHeaders(gov.cms.bfd.server.war.commons.CommonHeaders) Iterator(java.util.Iterator) Files(java.nio.file.Files) HospiceClaim(gov.cms.bfd.model.rif.HospiceClaim) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) FileOutputStream(java.io.FileOutputStream) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) IOException(java.io.IOException) EncodingEnum(ca.uhn.fhir.rest.api.EncodingEnum) File(java.io.File) Consumer(java.util.function.Consumer) AfterEach(org.junit.jupiter.api.AfterEach) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) Paths(java.nio.file.Paths) ExplanationOfBenefit(org.hl7.fhir.r4.model.ExplanationOfBenefit) Bundle(org.hl7.fhir.r4.model.Bundle) Comparator(java.util.Comparator) Collections(java.util.Collections) IGenericClient(ca.uhn.fhir.rest.client.api.IGenericClient) CarrierClaim(gov.cms.bfd.model.rif.CarrierClaim)

Example 13 with CarrierClaim

use of gov.cms.bfd.model.rif.CarrierClaim in project beneficiary-fhir-data by CMSgov.

the class EndpointJsonResponseComparatorV2IT method eobReadCarrierWithTaxNumbers.

/**
 * @return the results of the {@link
 *     ExplanationOfBenefitResourceProvider#read(org.hl7.fhir.dstu3.model.IdType)} operation for
 *     Carrier claims, with the {@link
 *     ExplanationOfBenefitResourceProvider#HEADER_NAME_INCLUDE_TAX_NUMBERS} set to <code>true
 *     </code>
 */
public static String eobReadCarrierWithTaxNumbers() {
    List<Object> loadedRecords = ServerTestUtils.get().loadData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
    IGenericClient fhirClient = createFhirClientAndSetEncoding();
    RequestHeaders requestHeader = RequestHeaders.getHeaderWrapper(CommonHeaders.HEADER_NAME_INCLUDE_TAX_NUMBERS, "true");
    ExtraParamsInterceptor extraParamsInterceptor = new ExtraParamsInterceptor();
    extraParamsInterceptor.setHeaders(requestHeader);
    fhirClient.registerInterceptor(extraParamsInterceptor);
    JsonInterceptor jsonInterceptor = createAndRegisterJsonInterceptor(fhirClient);
    CarrierClaim carrClaim = loadedRecords.stream().filter(r -> r instanceof CarrierClaim).map(r -> (CarrierClaim) r).findFirst().get();
    fhirClient.read().resource(ExplanationOfBenefit.class).withId(TransformerUtilsV2.buildEobId(ClaimTypeV2.CARRIER, carrClaim.getClaimId())).execute();
    return jsonInterceptor.getResponse();
}
Also used : Arrays(java.util.Arrays) R4PatientResourceProvider(gov.cms.bfd.server.war.r4.providers.R4PatientResourceProvider) InpatientClaim(gov.cms.bfd.model.rif.InpatientClaim) Disabled(org.junit.jupiter.api.Disabled) PartDEvent(gov.cms.bfd.model.rif.PartDEvent) SNFClaim(gov.cms.bfd.model.rif.SNFClaim) TransformerUtilsV2(gov.cms.bfd.server.war.r4.providers.TransformerUtilsV2) Matcher(java.util.regex.Matcher) CapabilityStatement(org.hl7.fhir.r4.model.CapabilityStatement) BeforeAll(org.junit.jupiter.api.BeforeAll) JsonNode(com.fasterxml.jackson.databind.JsonNode) IGenericClient(ca.uhn.fhir.rest.client.api.IGenericClient) Path(java.nio.file.Path) Coverage(org.hl7.fhir.r4.model.Coverage) Patient(org.hl7.fhir.r4.model.Patient) MethodSource(org.junit.jupiter.params.provider.MethodSource) OutpatientClaim(gov.cms.bfd.model.rif.OutpatientClaim) ImmutableSet(com.google.common.collect.ImmutableSet) MedicareSegment(gov.cms.bfd.server.war.commons.MedicareSegment) Set(java.util.Set) Arguments(org.junit.jupiter.params.provider.Arguments) Collectors(java.util.stream.Collectors) ExplanationOfBenefitResourceProvider(gov.cms.bfd.server.war.stu3.providers.ExplanationOfBenefitResourceProvider) StandardCharsets(java.nio.charset.StandardCharsets) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode) UncheckedIOException(java.io.UncheckedIOException) JsonArray(com.google.gson.JsonArray) Beneficiary(gov.cms.bfd.model.rif.Beneficiary) List(java.util.List) TransformerConstants(gov.cms.bfd.server.war.commons.TransformerConstants) Stream(java.util.stream.Stream) CarrierClaim(gov.cms.bfd.model.rif.CarrierClaim) Optional(java.util.Optional) Pattern(java.util.regex.Pattern) ClaimTypeV2(gov.cms.bfd.server.war.r4.providers.ClaimTypeV2) ExtraParamsInterceptor(gov.cms.bfd.server.war.stu3.providers.ExtraParamsInterceptor) CoverageResourceProvider(gov.cms.bfd.server.war.stu3.providers.CoverageResourceProvider) RequestHeaders(gov.cms.bfd.server.war.commons.RequestHeaders) Supplier(java.util.function.Supplier) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) ArrayList(java.util.ArrayList) HHAClaim(gov.cms.bfd.model.rif.HHAClaim) PipelineTestUtils(gov.cms.bfd.pipeline.sharedutils.PipelineTestUtils) Lists(com.google.common.collect.Lists) OutputStreamWriter(java.io.OutputStreamWriter) DMEClaim(gov.cms.bfd.model.rif.DMEClaim) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) StaticRifResourceGroup(gov.cms.bfd.model.rif.samples.StaticRifResourceGroup) ServerTestUtils(gov.cms.bfd.server.war.ServerTestUtils) Arguments.arguments(org.junit.jupiter.params.provider.Arguments.arguments) CommonHeaders(gov.cms.bfd.server.war.commons.CommonHeaders) Iterator(java.util.Iterator) Files(java.nio.file.Files) HospiceClaim(gov.cms.bfd.model.rif.HospiceClaim) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) FileOutputStream(java.io.FileOutputStream) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) IOException(java.io.IOException) EncodingEnum(ca.uhn.fhir.rest.api.EncodingEnum) File(java.io.File) Consumer(java.util.function.Consumer) AfterEach(org.junit.jupiter.api.AfterEach) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) Paths(java.nio.file.Paths) ExplanationOfBenefit(org.hl7.fhir.r4.model.ExplanationOfBenefit) Bundle(org.hl7.fhir.r4.model.Bundle) Comparator(java.util.Comparator) Collections(java.util.Collections) IGenericClient(ca.uhn.fhir.rest.client.api.IGenericClient) CarrierClaim(gov.cms.bfd.model.rif.CarrierClaim) RequestHeaders(gov.cms.bfd.server.war.commons.RequestHeaders) ExtraParamsInterceptor(gov.cms.bfd.server.war.stu3.providers.ExtraParamsInterceptor)

Example 14 with CarrierClaim

use of gov.cms.bfd.model.rif.CarrierClaim in project beneficiary-fhir-data by CMSgov.

the class CarrierClaimTransformerTest method transformSampleARecord.

/**
 * Verifies that {@link
 * gov.cms.bfd.server.war.stu3.providers.CarrierClaimTransformer#transform(Object)} works as
 * expected when run against the {@link StaticRifResource#SAMPLE_A_CARRIER} {@link CarrierClaim}.
 *
 * @throws FHIRException (indicates test failure)
 */
@Test
public void transformSampleARecord() throws FHIRException {
    List<Object> parsedRecords = ServerTestUtils.parseData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
    CarrierClaim claim = parsedRecords.stream().filter(r -> r instanceof CarrierClaim).map(r -> (CarrierClaim) r).findFirst().get();
    claim.setLastUpdated(Instant.now());
    ExplanationOfBenefit eobWithLastUpdated = CarrierClaimTransformer.transform(new MetricRegistry(), claim, Optional.of(true));
    assertMatches(claim, eobWithLastUpdated, Optional.of(true));
    claim.setLastUpdated(Optional.empty());
    ExplanationOfBenefit eobWithoutLastUpdated = CarrierClaimTransformer.transform(new MetricRegistry(), claim, Optional.of(true));
    assertMatches(claim, eobWithoutLastUpdated, Optional.of(true));
}
Also used : Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) Arrays(java.util.Arrays) MetricRegistry(com.codahale.metrics.MetricRegistry) ExplanationOfBenefit(org.hl7.fhir.dstu3.model.ExplanationOfBenefit) StaticRifResource(gov.cms.bfd.model.rif.samples.StaticRifResource) MedicareSegment(gov.cms.bfd.server.war.commons.MedicareSegment) Assertions.assertNull(org.junit.jupiter.api.Assertions.assertNull) ItemComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.ItemComponent) Instant(java.time.Instant) ClaimCareteamrole(org.hl7.fhir.dstu3.model.codesystems.ClaimCareteamrole) Test(org.junit.jupiter.api.Test) BigDecimal(java.math.BigDecimal) List(java.util.List) CareTeamComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.CareTeamComponent) TransformerConstants(gov.cms.bfd.server.war.commons.TransformerConstants) CcwCodebookVariable(gov.cms.bfd.model.codebook.data.CcwCodebookVariable) CarrierClaim(gov.cms.bfd.model.rif.CarrierClaim) CarrierClaimLine(gov.cms.bfd.model.rif.CarrierClaimLine) Optional(java.util.Optional) FHIRException(org.hl7.fhir.exceptions.FHIRException) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) StaticRifResourceGroup(gov.cms.bfd.model.rif.samples.StaticRifResourceGroup) ServerTestUtils(gov.cms.bfd.server.war.ServerTestUtils) MetricRegistry(com.codahale.metrics.MetricRegistry) CarrierClaim(gov.cms.bfd.model.rif.CarrierClaim) ExplanationOfBenefit(org.hl7.fhir.dstu3.model.ExplanationOfBenefit) Test(org.junit.jupiter.api.Test)

Example 15 with CarrierClaim

use of gov.cms.bfd.model.rif.CarrierClaim in project beneficiary-fhir-data by CMSgov.

the class CarrierClaimTransformerV2Test method transformSampleARecord.

/**
 * Verifies that {@link
 * gov.cms.bfd.server.war.r4.providers.CarrierClaimTransformerV2#transform(MetricRegistry, Object,
 * Optional<Boolean>)} works as expected when run against the {@link
 * StaticRifResource#SAMPLE_A_INPATIENT} {@link InpatientClaim}.
 *
 * @throws FHIRException (indicates test failure)
 */
@Test
public void transformSampleARecord() throws FHIRException {
    CarrierClaim claim = generateClaim();
    assertMatches(claim, CarrierClaimTransformerV2.transform(new MetricRegistry(), claim, Optional.of(false)));
}
Also used : MetricRegistry(com.codahale.metrics.MetricRegistry) CarrierClaim(gov.cms.bfd.model.rif.CarrierClaim) Test(org.junit.jupiter.api.Test)

Aggregations

CarrierClaim (gov.cms.bfd.model.rif.CarrierClaim)26 Test (org.junit.jupiter.api.Test)19 InpatientClaim (gov.cms.bfd.model.rif.InpatientClaim)18 StaticRifResourceGroup (gov.cms.bfd.model.rif.samples.StaticRifResourceGroup)18 ServerTestUtils (gov.cms.bfd.server.war.ServerTestUtils)18 TransformerConstants (gov.cms.bfd.server.war.commons.TransformerConstants)18 Arrays (java.util.Arrays)18 List (java.util.List)18 Optional (java.util.Optional)18 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)18 DMEClaim (gov.cms.bfd.model.rif.DMEClaim)17 HHAClaim (gov.cms.bfd.model.rif.HHAClaim)17 HospiceClaim (gov.cms.bfd.model.rif.HospiceClaim)17 OutpatientClaim (gov.cms.bfd.model.rif.OutpatientClaim)17 PartDEvent (gov.cms.bfd.model.rif.PartDEvent)17 SNFClaim (gov.cms.bfd.model.rif.SNFClaim)17 Beneficiary (gov.cms.bfd.model.rif.Beneficiary)16 IGenericClient (ca.uhn.fhir.rest.client.api.IGenericClient)15 PipelineTestUtils (gov.cms.bfd.pipeline.sharedutils.PipelineTestUtils)15 CommonHeaders (gov.cms.bfd.server.war.commons.CommonHeaders)15