Search in sources :

Example 51 with Period

use of org.hl7.fhir.r4.model.Period in project ab2d by CMSgov.

the class PatientClaimsCollectorTest method whenEarlyAttestation_allowEarlyEobs.

@DisplayName("Early attestation still allows valid billable periods")
@Test
void whenEarlyAttestation_allowEarlyEobs() {
    try {
        CoverageSummary coverageSummary = new CoverageSummary(createIdentifierWithoutMbi(PATIENT_ID), null, List.of(TestUtil.getOpenRange()));
        // Valid billable period and old attestation date
        ExplanationOfBenefit eob = (ExplanationOfBenefit) EobTestDataUtil.createEOB();
        eob.getBillablePeriod().setStart(SDF.parse("01/02/2020"));
        eob.getBillablePeriod().setEnd(SDF.parse("01/03/2020"));
        IBaseBundle oldBundle = EobTestDataUtil.createBundle(eob);
        PatientClaimsRequest request = new PatientClaimsRequest(List.of(coverageSummary), OffsetDateTime.now().minusYears(100), null, "client", "job", "contractNum", Contract.ContractType.NORMAL, noOpToken, STU3, null);
        PatientClaimsCollector collector = new PatientClaimsCollector(request, EPOCH);
        collector.filterAndAddEntries(oldBundle, coverageSummary);
        assertEquals(1, collector.getEobs().size());
    } catch (ParseException pe) {
        fail("could not build dates", pe);
    }
}
Also used : CoverageSummary(gov.cms.ab2d.coverage.model.CoverageSummary) IBaseBundle(org.hl7.fhir.instance.model.api.IBaseBundle) ParseException(java.text.ParseException) ExplanationOfBenefit(org.hl7.fhir.dstu3.model.ExplanationOfBenefit) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Example 52 with Period

use of org.hl7.fhir.r4.model.Period in project ab2d by CMSgov.

the class PatientClaimsCollectorTest method whenAttestationToday_blockEobs.

@DisplayName("Attestation today valid billable periods should be blocked")
@Test
void whenAttestationToday_blockEobs() {
    try {
        CoverageSummary coverageSummary = new CoverageSummary(createIdentifierWithoutMbi(PATIENT_ID), null, List.of(TestUtil.getOpenRange()));
        // Valid billable period and attestation day of today
        ExplanationOfBenefit eob = (ExplanationOfBenefit) EobTestDataUtil.createEOB();
        eob.getBillablePeriod().setStart(SDF.parse("01/02/2020"));
        eob.getBillablePeriod().setEnd(SDF.parse("01/03/2020"));
        IBaseBundle oldBundle = EobTestDataUtil.createBundle(eob);
        PatientClaimsRequest request = new PatientClaimsRequest(List.of(coverageSummary), OffsetDateTime.now(), null, "client", "job", "contractNum", Contract.ContractType.NORMAL, noOpToken, STU3, null);
        PatientClaimsCollector collector = new PatientClaimsCollector(request, EPOCH);
        collector.filterAndAddEntries(oldBundle, coverageSummary);
        assertTrue(collector.getEobs().isEmpty());
    } catch (ParseException pe) {
        fail("could not build dates", pe);
    }
}
Also used : CoverageSummary(gov.cms.ab2d.coverage.model.CoverageSummary) IBaseBundle(org.hl7.fhir.instance.model.api.IBaseBundle) ParseException(java.text.ParseException) ExplanationOfBenefit(org.hl7.fhir.dstu3.model.ExplanationOfBenefit) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Example 53 with Period

use of org.hl7.fhir.r4.model.Period in project ab2d by CMSgov.

the class PatientClaimsCollectorTest method oldSinceOldAttestation_thenFilterOut.

@DisplayName("Old since and attestation doesn't work if before ab2d epoch")
@Test
void oldSinceOldAttestation_thenFilterOut() {
    try {
        CoverageSummary coverageSummary = new CoverageSummary(createIdentifierWithoutMbi(PATIENT_ID), null, List.of(TestUtil.getOpenRange()));
        // Old billable period date and older attestation date should return nothing
        ExplanationOfBenefit eob = (ExplanationOfBenefit) EobTestDataUtil.createEOB();
        eob.getBillablePeriod().setStart(SDF.parse("10/13/1970"));
        eob.getBillablePeriod().setEnd(SDF.parse("10/13/1970"));
        IBaseBundle oldBundle = EobTestDataUtil.createBundle(eob);
        PatientClaimsRequest request = new PatientClaimsRequest(List.of(coverageSummary), OffsetDateTime.now().minusYears(100), null, "client", "job", "contractNum", Contract.ContractType.NORMAL, noOpToken, STU3, null);
        PatientClaimsCollector collector = new PatientClaimsCollector(request, EPOCH);
        collector.filterAndAddEntries(oldBundle, coverageSummary);
        assertTrue(collector.getEobs().isEmpty());
    } catch (ParseException pe) {
        fail("could not build dates", pe);
    }
}
Also used : CoverageSummary(gov.cms.ab2d.coverage.model.CoverageSummary) IBaseBundle(org.hl7.fhir.instance.model.api.IBaseBundle) ParseException(java.text.ParseException) ExplanationOfBenefit(org.hl7.fhir.dstu3.model.ExplanationOfBenefit) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Example 54 with Period

use of org.hl7.fhir.r4.model.Period in project integration-adaptor-111 by nhsconnect.

the class ParticipantMapperTest method shouldMapParticipant.

@Test
public void shouldMapParticipant() {
    POCDMT000002UK01Participant1 encounterParticipant = mock(POCDMT000002UK01Participant1.class);
    POCDMT000002UK01AssociatedEntity associatedEntity = mock(POCDMT000002UK01AssociatedEntity.class);
    IVLTS time = mock(IVLTS.class);
    when(encounterParticipant.getTypeCode()).thenReturn("CON");
    when(encounterParticipant.getAssociatedEntity()).thenReturn(associatedEntity);
    when(encounterParticipant.isSetTime()).thenReturn(true);
    when(encounterParticipant.getTime()).thenReturn(time);
    when(periodMapper.mapPeriod(ArgumentMatchers.isA(IVLTS.class))).thenReturn(period);
    when(practitionerMapper.mapPractitioner(ArgumentMatchers.isA(POCDMT000002UK01AssociatedEntity.class))).thenReturn(practitioner);
    when(resourceUtil.createReference(practitioner)).thenReturn(new Reference(practitioner));
    Encounter.EncounterParticipantComponent participantComponent = participantMapper.mapEncounterParticipant(encounterParticipant);
    assertThat(participantComponent.getIndividualTarget()).isEqualTo(practitioner);
    assertThat(participantComponent.getPeriod()).isEqualTo(period);
    assertThat(participantComponent.getType().get(0).getText()).isEqualTo("CON");
}
Also used : IVLTS(uk.nhs.connect.iucds.cda.ucr.IVLTS) Reference(org.hl7.fhir.dstu3.model.Reference) POCDMT000002UK01Participant1(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Participant1) Encounter(org.hl7.fhir.dstu3.model.Encounter) POCDMT000002UK01AssociatedEntity(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01AssociatedEntity) Test(org.junit.jupiter.api.Test)

Example 55 with Period

use of org.hl7.fhir.r4.model.Period in project integration-adaptor-111 by nhsconnect.

the class ParticipantMapperTest method shouldMapEncounterRelatedPerson.

@Test
public void shouldMapEncounterRelatedPerson() {
    IVLTS time = IVLTS.Factory.newInstance();
    POCDMT000002UK01RelatedEntity relatedEntity = POCDMT000002UK01RelatedEntity.Factory.newInstance();
    relatedEntity.setEffectiveTime(time);
    POCDMT000002UK01Informant12 informant = POCDMT000002UK01Informant12.Factory.newInstance();
    informant.setTypeCode("INF");
    informant.setRelatedEntity(relatedEntity);
    Encounter encounter = new Encounter();
    RelatedPerson relatedPerson = new RelatedPerson();
    relatedPerson.setId(RELATED_PERSON_ID);
    when(relatedPersonMapper.mapRelatedPerson(informant, encounter)).thenReturn(relatedPerson);
    when(periodMapper.mapPeriod(ArgumentMatchers.isA(IVLTS.class))).thenReturn(period);
    when(resourceUtil.createReference(relatedPerson)).thenReturn(new Reference(relatedPerson));
    Encounter.EncounterParticipantComponent participantComponent = participantMapper.mapEncounterRelatedPerson(informant, encounter);
    assertThat(participantComponent.getType().get(0).getText()).isEqualTo("Informant");
    assertThat(participantComponent.getIndividualTarget().getId()).isEqualTo(RELATED_PERSON_ID);
    assertThat(participantComponent.getPeriod()).isEqualTo(period);
}
Also used : IVLTS(uk.nhs.connect.iucds.cda.ucr.IVLTS) POCDMT000002UK01Informant12(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Informant12) POCDMT000002UK01RelatedEntity(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01RelatedEntity) Reference(org.hl7.fhir.dstu3.model.Reference) Encounter(org.hl7.fhir.dstu3.model.Encounter) RelatedPerson(org.hl7.fhir.dstu3.model.RelatedPerson) Test(org.junit.jupiter.api.Test)

Aggregations

Period (org.hl7.fhir.r4.model.Period)87 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)44 Date (java.util.Date)42 Test (org.junit.Test)42 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)40 Coding (org.hl7.fhir.r4.model.Coding)34 Test (org.junit.jupiter.api.Test)34 Complex (org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)32 Period (org.hl7.fhir.dstu3.model.Period)30 ArrayList (java.util.ArrayList)29 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)27 DateTimeType (org.hl7.fhir.r4.model.DateTimeType)20 Encounter (org.hl7.fhir.r4.model.Encounter)20 Reference (org.hl7.fhir.r4.model.Reference)20 Patient (org.hl7.fhir.r4.model.Patient)19 Reference (org.hl7.fhir.dstu3.model.Reference)18 HashMap (java.util.HashMap)17 Identifier (org.hl7.fhir.r4.model.Identifier)17 NotImplementedException (org.apache.commons.lang3.NotImplementedException)15 List (java.util.List)14