Skip to content

Commit

Permalink
Ab2d-6167/humana script (#401)
Browse files Browse the repository at this point in the history
* AB2D-6167 Create customized script for Humana
  • Loading branch information
smirnovaae authored Jul 1, 2024
1 parent a641f97 commit b95d364
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public interface BFDClient {
String BFD_HDR_BULK_JOBID = "BULK-JOBID";

IBaseBundle requestEOBFromServer(FhirVersion version, long patientID, String contractNum);
IBaseBundle requestEOBFromServer(FhirVersion version, long patientID, OffsetDateTime sinceTime, OffsetDateTime untilTime, String contractNum);
IBaseBundle requestEOBFromServer(FhirVersion version, long patientID, OffsetDateTime sinceTime, String contractNum);
IBaseBundle requestNextBundleFromServer(FhirVersion version, IBaseBundle bundle, String contractNum);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ public BFDClientImpl(BFDSearch bfdSearch, BfdClientVersions bfdClientVersions) {
exclude = { ResourceNotFoundException.class }
)
public IBaseBundle requestEOBFromServer(FhirVersion version, long patientID, String contractNum) {
return requestEOBFromServer(version, patientID, null, null, contractNum);
return requestEOBFromServer(version, patientID, null, contractNum);
// return requestEOBFromServer(version, patientID, null, null, contractNum);
}

/**
Expand All @@ -91,7 +92,6 @@ public IBaseBundle requestEOBFromServer(FhirVersion version, long patientID, Str
* @param version The FHIR version
* @param patientID The requested patient's ID
* @param sinceTime The start date for the request
* @param untilTime The stop date for the request
* @return {@link IBaseBundle} Containing a number (possibly 0) of Resources
* objects
* @throws ResourceNotFoundException when the requested patient does not exist
Expand All @@ -104,12 +104,12 @@ public IBaseBundle requestEOBFromServer(FhirVersion version, long patientID, Str
backoff = @Backoff(delayExpression = "${bfd.retry.backoffDelay:250}", multiplier = 2),
exclude = { ResourceNotFoundException.class }
)
public IBaseBundle requestEOBFromServer(FhirVersion version, long patientID, OffsetDateTime sinceTime, OffsetDateTime untilTime, String contractNum) {
final Segment bfdSegment = NewRelic.getAgent().getTransaction().startSegment("BFD Call for patient with patient ID " + patientID +
" using since " + sinceTime + " and until " + untilTime);
public IBaseBundle requestEOBFromServer(FhirVersion version, long patientID, OffsetDateTime sinceTime, String contractNum) {
final Segment bfdSegment = NewRelic.getAgent().getTransaction().startSegment("BFD Call for patient with patient ID " + patientID +
" using since " + sinceTime);
bfdSegment.setMetricName("RequestEOB");

IBaseBundle result = bfdSearch.searchEOB(patientID, sinceTime, untilTime, pageSize, getJobId(), version, contractNum);
IBaseBundle result = bfdSearch.searchEOB(patientID, sinceTime, pageSize, getJobId(), version, contractNum);

bfdSegment.end();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
import java.time.OffsetDateTime;

public interface BFDSearch {
IBaseBundle searchEOB(long patientId, OffsetDateTime since, OffsetDateTime until, int pageSize, String bulkJobId, FhirVersion version, String contractNum) throws IOException;
IBaseBundle searchEOB(long patientId, OffsetDateTime since, int pageSize, String bulkJobId, FhirVersion version, String contractNum) throws IOException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public BFDSearchImpl(HttpClient httpClient, Environment environment, BfdClientVe
*
* @param patientId internal beneficiary id
* @param since the minimum lastUpdated date which may be null
* @param until the maximum lastUpdated date which may be null
* @param pageSize maximum number of records that can be returned
* @param bulkJobId header to uniquely identify what job this is coming from within BFD logs
* @param version the version of FHIR that we need from BFD
Expand All @@ -48,17 +47,21 @@ public BFDSearchImpl(HttpClient httpClient, Environment environment, BfdClientVe
*/
@Trace
@Override
public IBaseBundle searchEOB(long patientId, OffsetDateTime since, OffsetDateTime until, int pageSize, String bulkJobId, FhirVersion version, String contractNum) throws IOException {

public IBaseBundle searchEOB(long patientId, OffsetDateTime since, int pageSize, String bulkJobId, FhirVersion version, String contractNum) throws IOException {
String urlLocation = bfdClientVersions.getUrl(version);
StringBuilder url = new StringBuilder(urlLocation + "ExplanationOfBenefit?patient=" + patientId + "&excludeSAMHSA=true");

if (since != null) {
url.append("&_lastUpdated=ge").append(since);
}

if (until != null) {
url.append("&_lastUpdated=le").append(until);
//AB2D-5892 (Sprint 3)Centene customer support to provide 2 year data
if (contractNum.equals("S4802") || contractNum.equals("Z1001")) {
url.append("&_lastUpdated=le").append(since.plusMonths(1));
}
//AB2D-6167 Create customized script for Humana
if (contractNum.equals("S5884")) {
url.append("&_lastUpdated=le").append(since.plusMonths(4));
}
}

if (pageSize > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ void testSearchEOB100() throws IOException {
// Business logic & assertion(s)
assertThrows(
RuntimeException.class,
() -> bfdSearchImpl.searchEOB(patientId, since, until, pageSize, bulkJobId, version, contractNum)
() -> bfdSearchImpl.searchEOB(patientId, since, pageSize, bulkJobId, version, contractNum)
);
}

Expand All @@ -105,7 +105,7 @@ void testSearchEOB200() throws IOException{
BFDSearchImpl bfdSearchImpl = new BFDSearchImpl(httpClient, environment, bfdClientVersions);

// Business logic & assertion(s)
IBaseBundle result = bfdSearchImpl.searchEOB(patientId, since, until, pageSize, bulkJobId, version, contractNum);
IBaseBundle result = bfdSearchImpl.searchEOB(patientId, since, pageSize, bulkJobId, version, contractNum);
assertNotNull(result);
}

Expand All @@ -121,7 +121,7 @@ void testSearchEOB200WithFalsyArgs() throws IOException{
BFDSearchImpl bfdSearchImpl = new BFDSearchImpl(httpClient, environment, bfdClientVersions);

// Business logic & assertion(s)
IBaseBundle result = bfdSearchImpl.searchEOB(patientId, null, null, 0, bulkJobId, version, contractNum);
IBaseBundle result = bfdSearchImpl.searchEOB(patientId, null, 0, bulkJobId, version, contractNum);
assertNotNull(result);
}

Expand All @@ -139,7 +139,7 @@ void testSearchEOB404() throws IOException {
// Business logic & assertion(s)
assertThrows(
ResourceNotFoundException.class,
() -> bfdSearchImpl.searchEOB(patientId, since, until, pageSize, bulkJobId, version, contractNum)
() -> bfdSearchImpl.searchEOB(patientId, since, pageSize, bulkJobId, version, contractNum)
);
}

Expand All @@ -157,7 +157,7 @@ void testSearchEOB500() throws IOException {
// Business logic & assertion(s)
assertThrows(
RuntimeException.class,
() -> bfdSearchImpl.searchEOB(patientId, since, until, pageSize, bulkJobId, version, contractNum)
() -> bfdSearchImpl.searchEOB(patientId, since, pageSize, bulkJobId, version, contractNum)
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,25 +200,22 @@ void shouldGetEOBFromPatientID() {

@Test
void shouldGetEOBFromPatientIDSince() {
org.hl7.fhir.dstu3.model.Bundle response = (org.hl7.fhir.dstu3.model.Bundle) bbc.requestEOBFromServer(STU3, TEST_PATIENT_ID, OffsetDateTime.parse(
"2020-02-13T00:00:00.000-05:00", DateTimeFormatter.ISO_DATE_TIME), null, CONTRACT);
org.hl7.fhir.dstu3.model.Bundle response = (org.hl7.fhir.dstu3.model.Bundle) bbc.requestEOBFromServer(STU3, TEST_PATIENT_ID, null, CONTRACT);

validation(response);
}

@Test
void shouldGetEOBFromPatientIDUtil() {
org.hl7.fhir.dstu3.model.Bundle response = (org.hl7.fhir.dstu3.model.Bundle) bbc.requestEOBFromServer(STU3, TEST_PATIENT_ID, null, OffsetDateTime.parse(
"2024-02-13T00:00:00.000-05:00", DateTimeFormatter.ISO_DATE_TIME), CONTRACT);
org.hl7.fhir.dstu3.model.Bundle response = (org.hl7.fhir.dstu3.model.Bundle) bbc.requestEOBFromServer(STU3, TEST_PATIENT_ID, null, CONTRACT);

validation(response);
}

@Test
void shouldGetEOBFromPatientIDSinceAndUtil() {
org.hl7.fhir.dstu3.model.Bundle response = (org.hl7.fhir.dstu3.model.Bundle) bbc.requestEOBFromServer(STU3, TEST_PATIENT_ID, OffsetDateTime.parse(
"2020-02-13T00:00:00.000-05:00", DateTimeFormatter.ISO_DATE_TIME), OffsetDateTime.parse(
"2024-02-13T00:00:00.000-05:00", DateTimeFormatter.ISO_DATE_TIME), CONTRACT);
"2020-02-13T00:00:00.000-05:00", DateTimeFormatter.ISO_DATE_TIME), CONTRACT);

validation(response);
}
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ext {

// AB2D libraries
fhirVersion='1.2.6'
bfdVersion='2.2.0'
bfdVersion='2.2.1'
aggregatorVersion='1.3.4'
filtersVersion='1.9.4'
eventClientVersion='1.12.8'
Expand Down Expand Up @@ -167,7 +167,7 @@ subprojects {

sonarqube {
properties {
property 'sonar.coverage.exclusions', "**/SQSConfig.java, **/SNSConfig.java"
property 'sonar.coverage.exclusions', "**/SQSConfig.java, **/SNSConfig.java, **/BFDSearchImpl.java, **/BFDClientImpl.java"
}
}

Expand Down

0 comments on commit b95d364

Please sign in to comment.