Search in sources :

Example 86 with Coverage

use of org.hl7.fhir.r4.model.Coverage in project beneficiary-fhir-data by CMSgov.

the class CoverageTransformerV2 method transformPartD.

/**
 * @param metricRegistry the {@link MetricRegistry} to use
 * @param beneficiary the {@link Beneficiary} to generate a {@link MedicareSegment#PART_D} {@link
 *     Coverage} resource for
 * @return {@link MedicareSegment#PART_D} {@link Coverage} resource for the specified {@link
 *     Beneficiary}
 */
private static Coverage transformPartD(MetricRegistry metricRegistry, Beneficiary beneficiary) {
    Timer.Context timer = getTimerContext(metricRegistry, "part_d");
    Coverage coverage = new Coverage();
    coverage.getMeta().addProfile(ProfileConstants.C4BB_COVERAGE_URL);
    coverage.setId(TransformerUtilsV2.buildCoverageId(MedicareSegment.PART_D, beneficiary));
    beneficiary.getMedicareBeneficiaryId().ifPresent(value -> coverage.setSubscriberId(value));
    setTypeAndIssuer(coverage);
    setCoverageRelationship(coverage, SubscriberPolicyRelationship.SELF);
    createCoverageClass(coverage, CoverageClass.GROUP, TransformerConstants.COVERAGE_PLAN, Optional.empty());
    createCoverageClass(coverage, CoverageClass.PLAN, TransformerConstants.COVERAGE_PLAN_PART_D, Optional.empty());
    coverage.setStatus(CoverageStatus.ACTIVE);
    coverage.setBeneficiary(TransformerUtilsV2.referencePatient(beneficiary));
    addCoverageExtension(coverage, CcwCodebookVariable.MS_CD, beneficiary.getMedicareEnrollmentStatusCode());
    // Contract Number
    addCoverageExtension(coverage, CcwCodebookVariable.PTDCNTRCT01, beneficiary.getPartDContractNumberJanId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDCNTRCT02, beneficiary.getPartDContractNumberFebId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDCNTRCT03, beneficiary.getPartDContractNumberMarId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDCNTRCT04, beneficiary.getPartDContractNumberAprId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDCNTRCT05, beneficiary.getPartDContractNumberMayId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDCNTRCT06, beneficiary.getPartDContractNumberJunId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDCNTRCT07, beneficiary.getPartDContractNumberJulId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDCNTRCT08, beneficiary.getPartDContractNumberAugId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDCNTRCT09, beneficiary.getPartDContractNumberSeptId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDCNTRCT10, beneficiary.getPartDContractNumberOctId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDCNTRCT11, beneficiary.getPartDContractNumberNovId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDCNTRCT12, beneficiary.getPartDContractNumberDecId());
    // Beneficiary Monthly Data
    beneficiary.getBeneficiaryMonthlys().forEach(beneMonthly -> {
        int month = beneMonthly.getYearMonth().getMonthValue();
        String yearMonth = String.format("%s-%s", String.valueOf(beneMonthly.getYearMonth().getYear()), String.valueOf(month));
        Map<Integer, CcwCodebookVariable> mapOfMonth = new HashMap<Integer, CcwCodebookVariable>() {

            {
                put(1, CcwCodebookVariable.PTDCNTRCT01);
                put(2, CcwCodebookVariable.PTDCNTRCT02);
                put(3, CcwCodebookVariable.PTDCNTRCT03);
                put(4, CcwCodebookVariable.PTDCNTRCT04);
                put(5, CcwCodebookVariable.PTDCNTRCT05);
                put(6, CcwCodebookVariable.PTDCNTRCT06);
                put(7, CcwCodebookVariable.PTDCNTRCT07);
                put(8, CcwCodebookVariable.PTDCNTRCT08);
                put(9, CcwCodebookVariable.PTDCNTRCT09);
                put(10, CcwCodebookVariable.PTDCNTRCT10);
                put(11, CcwCodebookVariable.PTDCNTRCT11);
                put(12, CcwCodebookVariable.PTDCNTRCT12);
            }
        };
        if (mapOfMonth.containsKey(month)) {
            if (!beneMonthly.getPartDContractNumberId().isPresent() || beneMonthly.getPartDContractNumberId().get().isEmpty()) {
                beneMonthly.setPartDContractNumberId(Optional.of("0"));
            }
            coverage.addExtension(TransformerUtilsV2.createExtensionCoding(coverage, mapOfMonth.get(month), yearMonth, beneMonthly.getPartDContractNumberId()));
        }
    });
    // PBP
    addCoverageExtension(coverage, CcwCodebookVariable.PTDPBPID01, beneficiary.getPartDPbpNumberJanId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDPBPID02, beneficiary.getPartDPbpNumberFebId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDPBPID03, beneficiary.getPartDPbpNumberMarId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDPBPID04, beneficiary.getPartDPbpNumberAprId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDPBPID05, beneficiary.getPartDPbpNumberMayId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDPBPID06, beneficiary.getPartDPbpNumberJunId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDPBPID07, beneficiary.getPartDPbpNumberJulId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDPBPID08, beneficiary.getPartDPbpNumberAugId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDPBPID09, beneficiary.getPartDPbpNumberSeptId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDPBPID10, beneficiary.getPartDPbpNumberOctId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDPBPID11, beneficiary.getPartDPbpNumberNovId());
    addCoverageExtension(coverage, CcwCodebookVariable.PTDPBPID12, beneficiary.getPartDPbpNumberDecId());
    // Segment Number
    addCoverageExtension(coverage, CcwCodebookVariable.SGMTID01, beneficiary.getPartDSegmentNumberJanId());
    addCoverageExtension(coverage, CcwCodebookVariable.SGMTID02, beneficiary.getPartDSegmentNumberFebId());
    addCoverageExtension(coverage, CcwCodebookVariable.SGMTID03, beneficiary.getPartDSegmentNumberMarId());
    addCoverageExtension(coverage, CcwCodebookVariable.SGMTID04, beneficiary.getPartDSegmentNumberAprId());
    addCoverageExtension(coverage, CcwCodebookVariable.SGMTID05, beneficiary.getPartDSegmentNumberMayId());
    addCoverageExtension(coverage, CcwCodebookVariable.SGMTID06, beneficiary.getPartDSegmentNumberJunId());
    addCoverageExtension(coverage, CcwCodebookVariable.SGMTID07, beneficiary.getPartDSegmentNumberJulId());
    addCoverageExtension(coverage, CcwCodebookVariable.SGMTID08, beneficiary.getPartDSegmentNumberAugId());
    addCoverageExtension(coverage, CcwCodebookVariable.SGMTID09, beneficiary.getPartDSegmentNumberSeptId());
    addCoverageExtension(coverage, CcwCodebookVariable.SGMTID10, beneficiary.getPartDSegmentNumberOctId());
    addCoverageExtension(coverage, CcwCodebookVariable.SGMTID11, beneficiary.getPartDSegmentNumberNovId());
    addCoverageExtension(coverage, CcwCodebookVariable.SGMTID12, beneficiary.getPartDSegmentNumberDecId());
    // Monthly cost sharing group
    addCoverageExtension(coverage, CcwCodebookVariable.CSTSHR01, beneficiary.getPartDLowIncomeCostShareGroupJanCode());
    addCoverageExtension(coverage, CcwCodebookVariable.CSTSHR02, beneficiary.getPartDLowIncomeCostShareGroupFebCode());
    addCoverageExtension(coverage, CcwCodebookVariable.CSTSHR03, beneficiary.getPartDLowIncomeCostShareGroupMarCode());
    addCoverageExtension(coverage, CcwCodebookVariable.CSTSHR04, beneficiary.getPartDLowIncomeCostShareGroupAprCode());
    addCoverageExtension(coverage, CcwCodebookVariable.CSTSHR05, beneficiary.getPartDLowIncomeCostShareGroupMayCode());
    addCoverageExtension(coverage, CcwCodebookVariable.CSTSHR06, beneficiary.getPartDLowIncomeCostShareGroupJunCode());
    addCoverageExtension(coverage, CcwCodebookVariable.CSTSHR07, beneficiary.getPartDLowIncomeCostShareGroupJulCode());
    addCoverageExtension(coverage, CcwCodebookVariable.CSTSHR08, beneficiary.getPartDLowIncomeCostShareGroupAugCode());
    addCoverageExtension(coverage, CcwCodebookVariable.CSTSHR09, beneficiary.getPartDLowIncomeCostShareGroupSeptCode());
    addCoverageExtension(coverage, CcwCodebookVariable.CSTSHR10, beneficiary.getPartDLowIncomeCostShareGroupOctCode());
    addCoverageExtension(coverage, CcwCodebookVariable.CSTSHR11, beneficiary.getPartDLowIncomeCostShareGroupNovCode());
    addCoverageExtension(coverage, CcwCodebookVariable.CSTSHR12, beneficiary.getPartDLowIncomeCostShareGroupDecCode());
    // Monthly Part D Retiree Drug Subsidy Indicators
    addCoverageCodeExtension(coverage, CcwCodebookVariable.RDSIND01, beneficiary.getPartDRetireeDrugSubsidyJanInd());
    addCoverageCodeExtension(coverage, CcwCodebookVariable.RDSIND02, beneficiary.getPartDRetireeDrugSubsidyFebInd());
    addCoverageCodeExtension(coverage, CcwCodebookVariable.RDSIND03, beneficiary.getPartDRetireeDrugSubsidyMarInd());
    addCoverageCodeExtension(coverage, CcwCodebookVariable.RDSIND04, beneficiary.getPartDRetireeDrugSubsidyAprInd());
    addCoverageCodeExtension(coverage, CcwCodebookVariable.RDSIND05, beneficiary.getPartDRetireeDrugSubsidyMayInd());
    addCoverageCodeExtension(coverage, CcwCodebookVariable.RDSIND06, beneficiary.getPartDRetireeDrugSubsidyJunInd());
    addCoverageCodeExtension(coverage, CcwCodebookVariable.RDSIND07, beneficiary.getPartDRetireeDrugSubsidyJulInd());
    addCoverageCodeExtension(coverage, CcwCodebookVariable.RDSIND08, beneficiary.getPartDRetireeDrugSubsidyAugInd());
    addCoverageCodeExtension(coverage, CcwCodebookVariable.RDSIND09, beneficiary.getPartDRetireeDrugSubsidySeptInd());
    addCoverageCodeExtension(coverage, CcwCodebookVariable.RDSIND10, beneficiary.getPartDRetireeDrugSubsidyOctInd());
    addCoverageCodeExtension(coverage, CcwCodebookVariable.RDSIND11, beneficiary.getPartDRetireeDrugSubsidyNovInd());
    addCoverageCodeExtension(coverage, CcwCodebookVariable.RDSIND12, beneficiary.getPartDRetireeDrugSubsidyDecInd());
    // The reference year of the enrollment data
    addCoverageDecimalExtension(coverage, CcwCodebookVariable.RFRNC_YR, beneficiary.getBeneEnrollmentReferenceYear());
    // Monthly Medicare-Medicaid dual eligibility codes
    transformEntitlementDualEligibility(coverage, beneficiary);
    // update Coverage.meta.lastUpdated
    TransformerUtilsV2.setLastUpdated(coverage, beneficiary.getLastUpdated());
    timer.stop();
    return coverage;
}
Also used : CcwCodebookVariable(gov.cms.bfd.model.codebook.data.CcwCodebookVariable) Timer(com.codahale.metrics.Timer) HashMap(java.util.HashMap) Coverage(org.hl7.fhir.r4.model.Coverage)

Example 87 with Coverage

use of org.hl7.fhir.r4.model.Coverage in project beneficiary-fhir-data by CMSgov.

the class PartDEventTransformerV2Test method shouldHaveCtstrphcCvrgCdSupInfo.

@Test
public void shouldHaveCtstrphcCvrgCdSupInfo() {
    SupportingInformationComponent sic = TransformerTestUtilsV2.findSupportingInfoByCode("https://bluebutton.cms.gov/resources/variables/ctstrphc_cvrg_cd", eob.getSupportingInfo());
    SupportingInformationComponent compare = TransformerTestUtilsV2.createSupportingInfo(// We don't care what the sequence number is here
    sic.getSequence(), // Category
    Arrays.asList(new Coding("http://terminology.hl7.org/CodeSystem/claiminformationcategory", "info", "Information"), new Coding("https://bluebutton.cms.gov/resources/codesystem/information", "https://bluebutton.cms.gov/resources/variables/ctstrphc_cvrg_cd", "Catastrophic Coverage Code")), // Code
    new Coding("https://bluebutton.cms.gov/resources/variables/ctstrphc_cvrg_cd", "C", "Above attachment point"));
    assertTrue(compare.equalsDeep(sic));
}
Also used : SupportingInformationComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.SupportingInformationComponent) Coding(org.hl7.fhir.r4.model.Coding) Test(org.junit.jupiter.api.Test)

Example 88 with Coverage

use of org.hl7.fhir.r4.model.Coverage in project beneficiary-fhir-data by CMSgov.

the class R4CoverageResourceProviderIT method readCoveragesForExistingBeneficiary.

/**
 * Verifies that {@link
 * gov.cms.bfd.server.war.r4.providers.R4CoverageResourceProvider#read(org.hl7.fhir.r4.model.IdType)}
 * works as expected for {@link Beneficiary}-derived {@link Coverage}s that do exist in the DB.
 *
 * @throws FHIRException (indicates test failure)
 */
@Test
public void readCoveragesForExistingBeneficiary() throws FHIRException {
    List<Object> loadedRecords = ServerTestUtils.get().loadData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
    IGenericClient fhirClient = ServerTestUtils.get().createFhirClientV2();
    Beneficiary beneficiary = loadedRecords.stream().filter(r -> r instanceof Beneficiary).map(r -> (Beneficiary) r).findFirst().get();
    Coverage partACoverage = fhirClient.read().resource(Coverage.class).withId(TransformerUtilsV2.buildCoverageId(MedicareSegment.PART_A, beneficiary)).execute();
    CoverageTransformerV2Test.assertPartAMatches(beneficiary, partACoverage);
    Coverage partBCoverage = fhirClient.read().resource(Coverage.class).withId(TransformerUtilsV2.buildCoverageId(MedicareSegment.PART_B, beneficiary)).execute();
    CoverageTransformerV2Test.assertPartBMatches(beneficiary, partBCoverage);
    Coverage partDCoverage = fhirClient.read().resource(Coverage.class).withId(TransformerUtilsV2.buildCoverageId(MedicareSegment.PART_D, beneficiary)).execute();
    CoverageTransformerV2Test.assertPartDMatches(beneficiary, partDCoverage);
}
Also used : Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) Arrays(java.util.Arrays) Date(java.util.Date) Assertions.assertNull(org.junit.jupiter.api.Assertions.assertNull) Constants(ca.uhn.fhir.rest.api.Constants) LoggerFactory(org.slf4j.LoggerFactory) PipelineTestUtils(gov.cms.bfd.pipeline.sharedutils.PipelineTestUtils) DateRangeParam(ca.uhn.fhir.rest.param.DateRangeParam) BeforeAll(org.junit.jupiter.api.BeforeAll) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) IGenericClient(ca.uhn.fhir.rest.client.api.IGenericClient) ResourceNotFoundException(ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException) StaticRifResourceGroup(gov.cms.bfd.model.rif.samples.StaticRifResourceGroup) ServerTestUtils(gov.cms.bfd.server.war.ServerTestUtils) Coverage(org.hl7.fhir.r4.model.Coverage) Logger(org.slf4j.Logger) MedicareSegment(gov.cms.bfd.server.war.commons.MedicareSegment) InvalidRequestException(ca.uhn.fhir.rest.server.exceptions.InvalidRequestException) Instant(java.time.Instant) Test(org.junit.jupiter.api.Test) Beneficiary(gov.cms.bfd.model.rif.Beneficiary) List(java.util.List) AfterEach(org.junit.jupiter.api.AfterEach) TransformerConstants(gov.cms.bfd.server.war.commons.TransformerConstants) FHIRException(org.hl7.fhir.exceptions.FHIRException) Bundle(org.hl7.fhir.r4.model.Bundle) IGenericClient(ca.uhn.fhir.rest.client.api.IGenericClient) Coverage(org.hl7.fhir.r4.model.Coverage) Beneficiary(gov.cms.bfd.model.rif.Beneficiary) Test(org.junit.jupiter.api.Test)

Example 89 with Coverage

use of org.hl7.fhir.r4.model.Coverage in project beneficiary-fhir-data by CMSgov.

the class PatientLinkBuilderTest method testMdcLogsInAddResourcesToBundle.

@Test
public void testMdcLogsInAddResourcesToBundle() {
    PatientLinkBuilder paging = new PatientLinkBuilder(TEST_CONTRACT_URL + "&_count=10");
    assertTrue(paging.isPagingRequested());
    assertTrue(paging.isFirstPage());
    assertEquals(10, paging.getPageSize());
    Bundle bundle = new Bundle();
    TransformerUtils.addResourcesToBundle(bundle, Collections.singletonList(new Patient().setId("Id")));
    assertTrue(bundle.getLink().isEmpty());
    paging.addLinks(bundle);
    assertNotNull(bundle.getLink(Constants.LINK_SELF));
    assertNotNull(bundle.getLink(Constants.LINK_FIRST));
    UriComponents firstLink = UriComponentsBuilder.fromUriString(bundle.getLink(Constants.LINK_FIRST).getUrl()).build();
    assertEquals("10", firstLink.getQueryParams().getFirst(Constants.PARAM_COUNT));
    assertNull(bundle.getLink(Constants.LINK_NEXT));
    bundle = new Bundle();
    TransformerUtils.addResourcesToBundle(bundle, Collections.singletonList(new Coverage().setBeneficiary(new Reference("Patient/Id"))));
    assertTrue(bundle.getLink().isEmpty());
    paging.addLinks(bundle);
    assertNotNull(bundle.getLink(Constants.LINK_SELF));
    assertNotNull(bundle.getLink(Constants.LINK_FIRST));
    firstLink = UriComponentsBuilder.fromUriString(bundle.getLink(Constants.LINK_FIRST).getUrl()).build();
    assertEquals("10", firstLink.getQueryParams().getFirst(Constants.PARAM_COUNT));
    assertNull(bundle.getLink(Constants.LINK_NEXT));
    bundle = new Bundle();
    TransformerUtils.addResourcesToBundle(bundle, Collections.singletonList(new ExplanationOfBenefit().setPatient(new Reference("Patient/Id"))));
    assertTrue(bundle.getLink().isEmpty());
    paging.addLinks(bundle);
    assertNotNull(bundle.getLink(Constants.LINK_SELF));
    assertNotNull(bundle.getLink(Constants.LINK_FIRST));
    firstLink = UriComponentsBuilder.fromUriString(bundle.getLink(Constants.LINK_FIRST).getUrl()).build();
    assertEquals("10", firstLink.getQueryParams().getFirst(Constants.PARAM_COUNT));
    assertNull(bundle.getLink(Constants.LINK_NEXT));
}
Also used : PatientLinkBuilder(gov.cms.bfd.server.war.commons.PatientLinkBuilder) UriComponents(org.springframework.web.util.UriComponents) Bundle(org.hl7.fhir.dstu3.model.Bundle) Reference(org.hl7.fhir.dstu3.model.Reference) Patient(org.hl7.fhir.dstu3.model.Patient) Coverage(org.hl7.fhir.dstu3.model.Coverage) ExplanationOfBenefit(org.hl7.fhir.dstu3.model.ExplanationOfBenefit) Test(org.junit.jupiter.api.Test)

Example 90 with Coverage

use of org.hl7.fhir.r4.model.Coverage in project hl7v2-fhir-converter by LinuxForHealth.

the class Hl7DFTMessageTest method testResourceCreationFromDFT.

@Test
void testResourceCreationFromDFT() throws IOException {
    // Tests structure of DFT_P03 message type and DFT messages in general
    // DFT_P03 message types and IN1 are tested in detail in Hl7FinancialInsuranceTest
    String hl7message = "MSH|^~\\&|||||20151008111200||DFT^P03^DFT_P03|MSGID000001|T|2.6|||||||||\n" + "EVN||20210407191342||||||\n" + "PID|||MR1^^^XYZ^MR||DOE^JANE^|||F||||||||||||||||||||||\n" + "PV1||I||||||||||||||||||||||||||||||||||||||||||\n" + // Minimal ORC for ServiceRequest
    "ORC|NW|||||||||||||||\n" + // Minimal OBR for ServiceRequest
    "OBR|1||||||||||||||||||||||||||||||||\n" + "NTE|1|O|TEST ORC/OBR NOTE AA|||\n" + // OBX is type ST so an observation will be created
    "OBX|1|ST|100||This is content|||||||X\n" + "NTE|1|L|TEST OBXa NOTE|\n" + // FT1.7 is required transaction code (currently not used)
    "FT1||||20201231145045||CG|FAKE|||||||||||||||||||||||||||||||||||||\n" + // IN1.2.4, IN1.2.6 to Identifier 2
    "IN1|1|Value1^^System3^Value4^^System6" + // IN1.5 to 15 NOT REFERENCED (See test testBasicInsuranceCoverageFields)
    "|IdValue1^^^IdSystem4^^^^|Large Blue Organization|||||||||||" + // IN1.18 through IN1.35 NOT REFERENCED
    "|DoeFake^Judy^^^Rev.|PAR||||||||||||||||||" + // IN1.50 through IN1.53 NOT REFERENCED
    "|MEMBER36||||||||||Value46|||J494949||||\n";
    List<BundleEntryComponent> e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7message);
    List<Resource> encounters = ResourceUtils.getResourceList(e, ResourceType.Encounter);
    // From PV1
    assertThat(encounters).hasSize(1);
    List<Resource> patients = ResourceUtils.getResourceList(e, ResourceType.Patient);
    // From PID
    assertThat(patients).hasSize(1);
    List<Resource> organizations = ResourceUtils.getResourceList(e, ResourceType.Organization);
    // From Payor created by IN1
    assertThat(organizations).hasSize(1);
    List<Resource> coverages = ResourceUtils.getResourceList(e, ResourceType.Coverage);
    // From IN1 segment
    assertThat(coverages).hasSize(1);
    List<Resource> relatedPersons = ResourceUtils.getResourceList(e, ResourceType.RelatedPerson);
    // From IN1.16 through IN1.19; IN1.43; INI.49
    assertThat(relatedPersons).hasSize(1);
    List<Resource> serviceRequests = ResourceUtils.getResourceList(e, ResourceType.ServiceRequest);
    // From ORC / OBR
    assertThat(serviceRequests).hasSize(1);
    ServiceRequest serviceRequest = ResourceUtils.getResourceServiceRequest(serviceRequests.get(0), ResourceUtils.context);
    assertThat(serviceRequest.getNote()).hasSize(1);
    assertThat(serviceRequest.getNote().get(0).getTextElement().getValueAsString()).isEqualTo("TEST ORC/OBR NOTE AA");
    List<Resource> observations = ResourceUtils.getResourceList(e, ResourceType.Observation);
    // From OBX
    assertThat(observations).hasSize(1);
    Observation observation = ResourceUtils.getResourceObservation(observations.get(0), ResourceUtils.context);
    assertThat(observation.getNote()).hasSize(1);
    assertThat(observation.getNote().get(0).getTextElement().getValueAsString()).isEqualTo("TEST OBXa NOTE");
    // Confirm there are no unaccounted for resources
    // Expected: Coverage, Organization, Patient, Encounter, RelatedPerson, ServiceRequest, Observation
    assertThat(e).hasSize(7);
}
Also used : BundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent) Resource(org.hl7.fhir.r4.model.Resource) Observation(org.hl7.fhir.r4.model.Observation) ServiceRequest(org.hl7.fhir.r4.model.ServiceRequest) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)34 Coverage (org.hl7.fhir.r4.model.Coverage)31 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)17 Beneficiary (gov.cms.bfd.model.rif.Beneficiary)16 MedicareSegment (gov.cms.bfd.server.war.commons.MedicareSegment)15 Coverage (org.hl7.fhir.dstu3.model.Coverage)15 List (java.util.List)14 Reference (org.hl7.fhir.r4.model.Reference)14 Resource (org.hl7.fhir.r4.model.Resource)14 TransformerConstants (gov.cms.bfd.server.war.commons.TransformerConstants)13 Arrays (java.util.Arrays)13 Instant (java.time.Instant)12 Bundle (org.hl7.fhir.r4.model.Bundle)12 Logger (org.slf4j.Logger)12 LoggerFactory (org.slf4j.LoggerFactory)12 Date (java.util.Date)11 Complex (org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)11 Constants (ca.uhn.fhir.rest.api.Constants)10 Timer (com.codahale.metrics.Timer)10 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)10