Search in sources :

Example 16 with PartDEvent

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

the class EndpointJsonResponseComparatorV2IT method eobReadPde.

/**
 * @return the results of the {@link
 *     ExplanationOfBenefitResourceProvider#read(org.hl7.fhir.dstu3.model.IdType)} operation for
 *     PDE claims
 */
public static String eobReadPde() {
    List<Object> loadedRecords = ServerTestUtils.get().loadData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
    IGenericClient fhirClient = createFhirClientAndSetEncoding();
    JsonInterceptor jsonInterceptor = createAndRegisterJsonInterceptor(fhirClient);
    PartDEvent pdeClaim = loadedRecords.stream().filter(r -> r instanceof PartDEvent).map(r -> (PartDEvent) r).findFirst().get();
    fhirClient.read().resource(ExplanationOfBenefit.class).withId(TransformerUtilsV2.buildEobId(ClaimTypeV2.PDE, pdeClaim.getEventId())).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) PartDEvent(gov.cms.bfd.model.rif.PartDEvent)

Example 17 with PartDEvent

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

the class PartDEventTransformerTest method getPartDEventClaim.

private PartDEvent getPartDEventClaim() {
    List<Object> parsedRecords = ServerTestUtils.parseData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
    PartDEvent claim = parsedRecords.stream().filter(r -> r instanceof PartDEvent).map(r -> (PartDEvent) r).findFirst().get();
    return claim;
}
Also used : V3ActCode(org.hl7.fhir.dstu3.model.codesystems.V3ActCode) 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) ItemComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.ItemComponent) IOException(java.io.IOException) Date(java.sql.Date) PartDEvent(gov.cms.bfd.model.rif.PartDEvent) UncheckedIOException(java.io.UncheckedIOException) Test(org.junit.jupiter.api.Test) List(java.util.List) TransformerConstants(gov.cms.bfd.server.war.commons.TransformerConstants) CcwCodebookVariable(gov.cms.bfd.model.codebook.data.CcwCodebookVariable) 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) IdentifierType(gov.cms.bfd.server.war.commons.IdentifierType) PartDEvent(gov.cms.bfd.model.rif.PartDEvent)

Example 18 with PartDEvent

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

the class PartDEventTransformerTest method transformSampleARecord.

/**
 * Verifies that {@link
 * gov.cms.bfd.server.war.stu3.providers.PartDEventTransformer#transform(Object)} works as
 * expected when run against the {@link StaticRifResource#SAMPLE_A_PDE} {@link PartDEvent}.
 *
 * @throws FHIRException (indicates test failure)
 */
@Test
public void transformSampleARecord() throws FHIRException {
    PartDEvent claim = getPartDEventClaim();
    ExplanationOfBenefit eob = PartDEventTransformer.transform(new MetricRegistry(), claim, Optional.empty());
    assertMatches(claim, eob);
}
Also used : MetricRegistry(com.codahale.metrics.MetricRegistry) ExplanationOfBenefit(org.hl7.fhir.dstu3.model.ExplanationOfBenefit) PartDEvent(gov.cms.bfd.model.rif.PartDEvent) Test(org.junit.jupiter.api.Test)

Example 19 with PartDEvent

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

the class PartDEventTransformerTest method checkOrgAndFacility.

/**
 * Verifies that {@link
 * gov.cms.bfd.server.war.stu3.providers.PartDEventTransformer#transform(com.codahale.metrics.MetricRegistry,
 * Object)} works as expected when run against the {@link String serviceProviderIdQualiferCode}
 * and {@link String serviceProviderCode}.
 */
private void checkOrgAndFacility(String serviceProviderIdQualiferCode, String serviceProviderCode) {
    PartDEvent claim = getPartDEventClaim();
    claim.setServiceProviderIdQualiferCode(serviceProviderIdQualiferCode);
    ExplanationOfBenefit eob = PartDEventTransformer.transform(new MetricRegistry(), claim, Optional.empty());
    TransformerTestUtils.assertReferenceEquals(serviceProviderCode, claim.getServiceProviderId(), eob.getOrganization());
    TransformerTestUtils.assertReferenceEquals(serviceProviderCode, claim.getServiceProviderId(), eob.getFacility());
}
Also used : MetricRegistry(com.codahale.metrics.MetricRegistry) ExplanationOfBenefit(org.hl7.fhir.dstu3.model.ExplanationOfBenefit) PartDEvent(gov.cms.bfd.model.rif.PartDEvent)

Example 20 with PartDEvent

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

the class EndpointJsonResponseComparatorIT method eobReadPde.

/**
 * @return the results of the {@link
 *     ExplanationOfBenefitResourceProvider#read(org.hl7.fhir.dstu3.model.IdType)} operation for
 *     PDE claims
 */
public static String eobReadPde() {
    List<Object> loadedRecords = ServerTestUtils.get().loadData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
    IGenericClient fhirClient = createFhirClientAndSetEncoding();
    JsonInterceptor jsonInterceptor = createAndRegisterJsonInterceptor(fhirClient);
    PartDEvent pdeClaim = loadedRecords.stream().filter(r -> r instanceof PartDEvent).map(r -> (PartDEvent) r).findFirst().get();
    fhirClient.read().resource(ExplanationOfBenefit.class).withId(TransformerUtils.buildEobId(ClaimType.PDE, pdeClaim.getEventId())).execute();
    return jsonInterceptor.getResponse();
}
Also used : Arrays(java.util.Arrays) Bundle(org.hl7.fhir.dstu3.model.Bundle) 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) Matcher(java.util.regex.Matcher) 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) MethodSource(org.junit.jupiter.params.provider.MethodSource) OutpatientClaim(gov.cms.bfd.model.rif.OutpatientClaim) Coverage(org.hl7.fhir.dstu3.model.Coverage) ImmutableSet(com.google.common.collect.ImmutableSet) ExplanationOfBenefit(org.hl7.fhir.dstu3.model.ExplanationOfBenefit) 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) CapabilityStatement(org.hl7.fhir.dstu3.model.CapabilityStatement) 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) TransformerUtils(gov.cms.bfd.server.war.stu3.providers.TransformerUtils) 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) ClaimType(gov.cms.bfd.server.war.stu3.providers.ClaimType) 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) 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) PatientResourceProvider(gov.cms.bfd.server.war.stu3.providers.PatientResourceProvider) 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) Patient(org.hl7.fhir.dstu3.model.Patient) Comparator(java.util.Comparator) Collections(java.util.Collections) IGenericClient(ca.uhn.fhir.rest.client.api.IGenericClient) PartDEvent(gov.cms.bfd.model.rif.PartDEvent)

Aggregations

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