Skip to content

Commit

Permalink
Clean up FHIR feature flags (#7046)
Browse files Browse the repository at this point in the history
* Remove FHIR feature flags

* Clean up fhir-enabled usages
  • Loading branch information
mpbrown authored Dec 6, 2023
1 parent 3a090b4 commit 775c689
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import gov.cdc.usds.simplereport.db.model.TestEvent;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.transaction.event.TransactionPhase;
import org.springframework.transaction.event.TransactionalEventListener;
Expand All @@ -24,9 +23,6 @@ public class ReportTestEventToRSEventListener {
@Qualifier("fhirQueueReportingService")
private final TestEventReportingService fhirQueueReportingService;

@Value("${simple-report.fhir-reporting-enabled:false}")
private boolean fhirReportingEnabled;

@TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT)
public void handleEvent(ReportTestEventToRSEvent event) {
reportTestEventToRS(event.testEvent());
Expand All @@ -37,8 +33,6 @@ private void reportTestEventToRS(TestEvent savedEvent) {
testEventReportingService.report(savedEvent);
}

if (fhirReportingEnabled) {
fhirQueueReportingService.report(savedEvent);
}
fhirQueueReportingService.report(savedEvent);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.hibernate.Hibernate;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
Expand All @@ -76,15 +74,6 @@ public class TestOrderService {
private final PatientLinkService _patientLinkService;
private final ResultService resultService;

@Qualifier("csvQueueReportingService")
private final TestEventReportingService _testEventReportingService;

@Qualifier("fhirQueueReportingService")
private final TestEventReportingService _fhirQueueReportingService;

@Value("${simple-report.fhir-reporting-enabled:false}")
private boolean fhirReportingEnabled;

private final TestResultsDeliveryService testResultsDeliveryService;
private final DiseaseService _diseaseService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,6 @@ public class TestResultUploadService {
@Value("${simple-report.processing-mode-code:P}")
private String processingModeCodeValue;

@Value("${data-hub.fhir-enabled:false}")
private boolean fhirEnabled;

private static final int FIVE_MINUTES_MS = 300 * 1000;
public static final String PROCESSING_MODE_CODE_COLUMN_NAME = "processing_mode_code";
private static final String ORDER_TEST_DATE_COLUMN_NAME = "order_test_date";
Expand Down Expand Up @@ -364,19 +361,16 @@ private CompletableFuture<UniversalSubmissionSummary> submitResultsToUniversalPi
return CompletableFuture.supplyAsync(
withMDC(
() -> {
if (fhirEnabled) {
long start = System.currentTimeMillis();
// convert csv to fhir and serialize to json
FHIRBundleRecord fhirBundleWithMeta =
fhirConverter.convertToFhirBundles(content, org.getInternalId());
UploadResponse response = uploadBundleAsFhir(fhirBundleWithMeta.serializedBundle());
log.info(
"FHIR submitted in " + (System.currentTimeMillis() - start) + " milliseconds");

return new UniversalSubmissionSummary(
submissionId, org, response, fhirBundleWithMeta.metadata());
}
return null;
long start = System.currentTimeMillis();
// convert csv to fhir and serialize to json
FHIRBundleRecord fhirBundleWithMeta =
fhirConverter.convertToFhirBundles(content, org.getInternalId());
UploadResponse response = uploadBundleAsFhir(fhirBundleWithMeta.serializedBundle());
log.info(
"FHIR submitted in " + (System.currentTimeMillis() - start) + " milliseconds");

return new UniversalSubmissionSummary(
submissionId, org, response, fhirBundleWithMeta.metadata());
}));
}

Expand Down Expand Up @@ -582,7 +576,7 @@ public TestResultUpload processConditionAgnosticResultCSV(InputStream csvStream)
if (content.length > 0) {
fhirResponse = submitConditionAgnosticAsFhir(new ByteArrayInputStream(content));
try {
if (fhirResponse != null && fhirResponse.get() != null) {
if (fhirResponse.get() != null) {
fhirResult = mapFhirResponseToUploadResponse(fhirResponse.get(), org, submissionId);
}
} catch (CsvProcessingException | ExecutionException | InterruptedException e) {
Expand Down
1 change: 0 additions & 1 deletion backend/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ datahub:
signing-key: ${DATAHUB_SIGNING_KEY:super-secret-signing-key}
csv-upload-api-client: "simple_report.csvuploader"
csv-upload-api-fhir-client: "simple_report.fullelr"
fhir-enabled: true
features:
hivEnabled: true
singleEntryRsvEnabled: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,12 @@
import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock;
import org.springframework.http.HttpStatus;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.test.web.servlet.MockMvc;

@SliceTestConfiguration.WithSimpleReportStandardUser
@AutoConfigureWireMock(port = 9561)
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@TestPropertySource(properties = {"data-hub.fhir-enabled=true"})
class UploadConditionAgnosticResultsIntegrationTest extends BaseAuthenticatedFullStackTest {
@Autowired private MockMvc mockMvc;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,12 @@
import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock;
import org.springframework.http.HttpStatus;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.test.web.servlet.MockMvc;

@SliceTestConfiguration.WithSimpleReportStandardUser
@AutoConfigureWireMock(port = 9561)
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@TestPropertySource(properties = {"data-hub.fhir-enabled=true"})
class UploadTestResultsIntegrationTest extends BaseAuthenticatedFullStackTest {
@Autowired private MockMvc mockMvc;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,10 +426,8 @@ void uploadService_processCsv_translatesSpecimenNameToSNOMED() {
}

@Test
void uploadService_FhirEnabled_UploadSentTwice() {
void uploadService_UploadSentTwice() {
// given
ReflectionTestUtils.setField(sut, "fhirEnabled", true);

UploadResponse response = buildUploadResponse();
var tokenResponse = new TokenResponse();
tokenResponse.setAccessToken("fake-rs-access-token");
Expand Down Expand Up @@ -459,10 +457,8 @@ void uploadService_FhirEnabled_UploadSentTwice() {
}

@Test
void uploadService_FhirEnabled_FhirFailure_ReportsCSVResult() {
void uploadService_FhirFailure_ReportsCSVResult() {
// given
ReflectionTestUtils.setField(sut, "fhirEnabled", true);

var org = factory.saveValidOrganization();
var csvReportId = UUID.randomUUID();
var csvResponse = new UploadResponse();
Expand Down Expand Up @@ -517,10 +513,8 @@ void uploadService_FhirEnabled_FhirFailure_ReportsCSVResult() {
}

@Test
void uploadService_FhirEnabled_FhirException_ReportsCSVResult() {
void uploadService_FhirException_ReportsCSVResult() {
// given
ReflectionTestUtils.setField(sut, "fhirEnabled", true);

var org = factory.saveValidOrganization();
var csvReportId = UUID.randomUUID();
var successfulCsvResponse = new UploadResponse();
Expand Down Expand Up @@ -774,8 +768,6 @@ void uploadService_processCsv_filter_out_non_covid_csv() throws IOException {
@Test
@SliceTestConfiguration.WithSimpleReportStandardUser
void uploadService_processCsv_only_submit_fhir_when_flu_only_csv() {
ReflectionTestUtils.setField(sut, "fhirEnabled", true);

// GIVEN
InputStream input = loadCsv("testResultUpload/test-results-upload-valid-flu-only.csv");
UploadResponse response = buildUploadResponse();
Expand Down
3 changes: 1 addition & 2 deletions backend/src/test/resources/application-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -274,5 +274,4 @@ simple-report-initialization:
datahub:
url: http://localhost:9561
api-key: "super-secret-api-key"
jwt-scope: "simple_report.*.report"
fhir-enabled: false
jwt-scope: "simple_report.*.report"

0 comments on commit 775c689

Please sign in to comment.